◆ getAction()
static IAction org.turro.elephant.impl.context.ContextFactory.getAction |
( |
IConstructor |
constructor | ) |
|
|
static |
Definition at line 100 of file ContextFactory.java.
102 String type = constructor.getRequest().getServletPath().substring(9);
103 Element element = getConfNode(
"actions/action[@type='" + type +
"']");
104 if(element !=
null) {
106 String jClass = element.getAttributeValue(
"java-class");
107 Class cls = Class.forName(makeItTurro(jClass));
109 Constructor cons = cls.getConstructor(
new Class[] {});
111 impl = (IAction)cons.newInstance(
new Object[] {});
114 }
catch(Exception ex) {
115 Logger.getLogger(ContextFactory.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
119 impl.setConstructor(constructor);
◆ getContext() [1/2]
static IContext org.turro.elephant.impl.context.ContextFactory.getContext |
( |
IConstructor |
constructor | ) |
|
|
static |
◆ getContext() [2/2]
static IContext org.turro.elephant.impl.context.ContextFactory.getContext |
( |
IConstructor |
constructor, |
|
|
String |
path |
|
) |
| |
|
static |
Definition at line 61 of file ContextFactory.java.
62 IContext impl =
new DefaultContext();
64 impl.setConstructor(constructor, path);
◆ getContextElement() [1/2]
static IElement org.turro.elephant.impl.context.ContextFactory.getContextElement |
( |
IContext |
context, |
|
|
Element |
node |
|
) |
| |
|
static |
Definition at line 69 of file ContextFactory.java.
static IElement getContextElement(IContext context, Element node)
◆ getContextElement() [2/2]
static IElement org.turro.elephant.impl.context.ContextFactory.getContextElement |
( |
IContext |
context, |
|
|
String |
type, |
|
|
Element |
node |
|
) |
| |
|
static |
Definition at line 73 of file ContextFactory.java.
75 Element element =
null;
76 if(!
"none".equals(type)) {
77 element = getConfNode(
"elements/element[@type='" + type +
"']");
81 String jClass = element.getAttributeValue(
"java-class");
82 Class cls = Class.forName(makeItTurro(jClass));
84 Constructor cons = cls.getConstructor(
new Class[] {});
86 impl = (IElement)cons.newInstance(
new Object[] {});
89 }
catch(ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
90 Logger.getLogger(ContextFactory.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
93 if(impl instanceof AbstractElement) {
94 ((AbstractElement) impl).setConfiguration(node, element);
◆ getImplementation() [1/2]
static Object org.turro.elephant.impl.context.ContextFactory.getImplementation |
( |
IConstructor |
constructor, |
|
|
String |
name |
|
) |
| |
|
static |
Definition at line 169 of file ContextFactory.java.
171 Element element = getConfNode(
"implementations/impl[@interface='" + name +
"']");
172 if(element !=
null) {
174 String jClass = element.getAttributeValue(
"java-class");
175 Class cls = Class.forName(makeItTurro(jClass));
177 Constructor cons = cls.getConstructor(
new Class[] {});
179 impl = cons.newInstance(
new Object[] {});
182 }
catch(Exception ex) {
183 Logger.getLogger(ContextFactory.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
187 if(impl instanceof IImplementation) {
188 ((IImplementation)impl).setConstructor(constructor);
189 if(element !=
null) {
190 ((IImplementation)impl).setConfiguration((Element)element.clone());
◆ getImplementation() [2/2]
static Object org.turro.elephant.impl.context.ContextFactory.getImplementation |
( |
IElement |
iel, |
|
|
String |
name |
|
) |
| |
|
static |
Definition at line 154 of file ContextFactory.java.
155 IConstructor xpcons =
null;
157 if(iel !=
null) xpcons = iel.getConstructor();
161 if(impl instanceof IImplementation) {
162 ((IImplementation)impl).setElement(iel);
static Object getImplementation(IElement iel, String name)
◆ getImplementationNamesByType()
static List org.turro.elephant.impl.context.ContextFactory.getImplementationNamesByType |
( |
String |
type | ) |
|
|
static |
Definition at line 137 of file ContextFactory.java.
138 List list =
new ArrayList();
139 for(Element element : (List<Element>) getConfNodes(
"implementations")) {
140 if(element !=
null) {
142 Iterator it = XPath.selectNodes(element,
"impl[starts-with(@interface,'" + type +
"_')]/@interface").iterator();
143 while(it.hasNext()) {
144 list.add(((Attribute)it.next()).getValue());
146 }
catch(Exception ex) {
147 Logger.getLogger(ContextFactory.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
◆ getInclude()
static Element org.turro.elephant.impl.context.ContextFactory.getInclude |
( |
IConstructor |
constructor | ) |
|
|
static |
Definition at line 124 of file ContextFactory.java.
125 String type = constructor.getRequest().getServletPath();
126 return getConfNode(
"includes/include[@type='" + type +
"']");
◆ getInstance()
static Object org.turro.elephant.impl.context.ContextFactory.getInstance |
( |
String |
node, |
|
|
Class |
defaultClass |
|
) |
| |
|
static |
Definition at line 213 of file ContextFactory.java.
214 Constructor cons = impls.get(node);
216 Class javaClass =
null;
217 Element element = getConfNode(node);
218 if(element !=
null) {
220 String jClass = element.getAttributeValue(
"java-class");
221 javaClass = Class.forName(makeItTurro(jClass));
222 }
catch(Exception ex) {
223 Logger.getLogger(ContextFactory.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
226 if(javaClass ==
null) {
227 javaClass = defaultClass;
230 impls.put(node, javaClass.getConstructor(
new Class[] {}));
231 return Reflections.of(javaClass).instance();
232 }
catch (Exception ex) {
233 Logger.getLogger(ContextFactory.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
237 return cons.newInstance(
new Object[] {} );
238 }
catch (Exception ex) {
239 Logger.getLogger(ContextFactory.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
◆ getJavaClass()
static Object org.turro.elephant.impl.context.ContextFactory.getJavaClass |
( |
String |
jClass | ) |
|
|
static |
Definition at line 197 of file ContextFactory.java.
200 Class cls = Class.forName(makeItTurro(jClass));
202 Constructor cons = cls.getConstructor(
new Class[] {});
204 impl = cons.newInstance(
new Object[] {});
207 }
catch(Exception ex) {
208 Logger.getLogger(ContextFactory.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
◆ getRedirection()
static Element org.turro.elephant.impl.context.ContextFactory.getRedirection |
( |
String |
path | ) |
|
|
static |
Definition at line 129 of file ContextFactory.java.
130 return getConfNode(
"redirections/redirect[@request and starts-with('" + path +
"',@request)]");
◆ getVirtual()
static Element org.turro.elephant.impl.context.ContextFactory.getVirtual |
( |
String |
server | ) |
|
|
static |
Definition at line 133 of file ContextFactory.java.
134 return getConfNode(
"virtuals/virtual[@server='" + server +
"']");
◆ resetImplementationsStartingWith()
static void org.turro.elephant.impl.context.ContextFactory.resetImplementationsStartingWith |
( |
String |
name | ) |
|
|
static |
Definition at line 245 of file ContextFactory.java.
246 elements.entrySet().removeIf(e -> e.getKey().startsWith(
"implementations/impl[@interface='" + name));
The documentation for this class was generated from the following file: