wip made remote ejb working over http
This commit is contained in:
parent
d4e537a2bf
commit
2a0d992642
393 changed files with 8916 additions and 3872 deletions
|
|
@ -22,10 +22,14 @@
|
|||
|
||||
package net.forwardfire.vasc.xpql;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.el.ValueExpression;
|
||||
|
||||
import org.x4o.xml.core.X4OParser;
|
||||
import org.x4o.xml.element.ElementContext;
|
||||
import org.x4o.xml.core.config.X4OLanguageProperty;
|
||||
import org.x4o.xml.element.ElementLanguage;
|
||||
|
||||
/**
|
||||
* Parse an xpql file/resource
|
||||
|
|
@ -38,6 +42,7 @@ public class XPQLParser extends X4OParser {
|
|||
static public String XPQL_LANGUAGE = "xpql";
|
||||
|
||||
private QueryStore queryStore = null;
|
||||
private Map<String,Object> beanMap = null;
|
||||
|
||||
public XPQLParser() {
|
||||
this(new QueryStore());
|
||||
|
|
@ -49,19 +54,21 @@ public class XPQLParser extends X4OParser {
|
|||
throw new NullPointerException("Can work with null QueryStore.");
|
||||
}
|
||||
this.queryStore=queryStore;
|
||||
addGlobalELBean("__queryStore__", queryStore);
|
||||
beanMap = new HashMap<String,Object>(2);
|
||||
beanMap.put("__queryStore__", queryStore);
|
||||
setProperty(X4OLanguageProperty.EL_BEAN_INSTANCE_MAP.toUri(), beanMap);
|
||||
}
|
||||
|
||||
public QueryStore getQueryStore() {
|
||||
return queryStore;
|
||||
}
|
||||
|
||||
static public QueryStore getQueryStore(ElementContext elementContext) {
|
||||
if (elementContext==null) {
|
||||
throw new NullPointerException("ElementContext may not be null.");
|
||||
static public QueryStore getQueryStore(ElementLanguage elementLanguage) {
|
||||
if (elementLanguage==null) {
|
||||
throw new NullPointerException("elementLanguage may not be null.");
|
||||
}
|
||||
ValueExpression ee = elementContext.getExpressionFactory().createValueExpression(elementContext.getELContext(),"${__queryStore__}",QueryStore.class);
|
||||
QueryStore qs = (QueryStore)ee.getValue(elementContext.getELContext());
|
||||
ValueExpression ee = elementLanguage.getExpressionFactory().createValueExpression(elementLanguage.getELContext(),"${__queryStore__}",QueryStore.class);
|
||||
QueryStore qs = (QueryStore)ee.getValue(elementLanguage.getELContext());
|
||||
return qs;
|
||||
}
|
||||
}
|
||||
|
|
@ -52,9 +52,9 @@ public class ParameterTypeObjectConverter extends AbstractStringObjectConverter
|
|||
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
|
||||
try {
|
||||
return QueryParameterType.valueOf(""+str);
|
||||
} catch (Exception ex) {
|
||||
throw new ObjectConverterException(this,"Could not convert to QueryParameterType value="+str,ex);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw new ObjectConverterException(this,"Could not convert to QueryParameterType value="+str,ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -34,49 +34,54 @@ import org.x4o.xml.element.ElementBindingHandlerException;
|
|||
|
||||
|
||||
/**
|
||||
* QueryBindingHandler binds query elements.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 21, 2007
|
||||
*/
|
||||
public class QueryBindingHandler extends AbstractElementBindingHandler {
|
||||
|
||||
public boolean canBind(Element element) {
|
||||
Object parent = element.getParent().getElementObject();
|
||||
Object child = element.getElementObject();
|
||||
boolean p = false;
|
||||
boolean c = false;
|
||||
if(parent instanceof Query) { p=true; }
|
||||
if(child instanceof QueryPart) { c=true; }
|
||||
if(child instanceof QueryParameterValue) { c=true; }
|
||||
|
||||
// remove recuive stack
|
||||
if(element instanceof SQLElement) { c=false; }
|
||||
|
||||
if(p&c) { return true; } else { return false; }
|
||||
}
|
||||
|
||||
public void doBind(Element element) throws ElementBindingHandlerException {
|
||||
Object parent = element.getParent().getElementObject();
|
||||
Object child = element.getElementObject();
|
||||
if(parent instanceof Query) {
|
||||
Query query = (Query)parent;
|
||||
|
||||
// skip those with diffent life cycle because of sql characters adding elements in sax phase.
|
||||
if (child instanceof QueryParameter) {
|
||||
return;
|
||||
}
|
||||
if (child instanceof QueryInclude) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (child instanceof QueryPart) {
|
||||
query.addQueryPart((QueryPart)child);
|
||||
}
|
||||
if (child instanceof QueryParameterValue) {
|
||||
query.addLocalQueryParameterValue((QueryParameterValue)child);
|
||||
query.addQueryParameterValue((QueryParameterValue)child);
|
||||
}
|
||||
}
|
||||
}
|
||||
private final static Class<?>[] CLASSES_CHILD = new Class[] {
|
||||
QueryPart.class,
|
||||
QueryParameterValue.class
|
||||
};
|
||||
|
||||
}
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
|
||||
*/
|
||||
public Class<?> getBindParentClass() {
|
||||
return Query.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
|
||||
*/
|
||||
public Class<?>[] getBindChildClasses() {
|
||||
return CLASSES_CHILD;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#doBind(java.lang.Object, java.lang.Object, org.x4o.xml.element.Element)
|
||||
*/
|
||||
public void doBind(Object parentObject, Object childObject,Element childElement) throws ElementBindingHandlerException {
|
||||
if(parentObject instanceof Query) {
|
||||
Query query = (Query)parentObject;
|
||||
|
||||
// skip those with different life cycle because of sql characters adding elements in sax phase.
|
||||
if (childObject instanceof QueryParameter) {
|
||||
return;
|
||||
}
|
||||
if (childObject instanceof QueryInclude) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (childObject instanceof QueryPart) {
|
||||
query.addQueryPart((QueryPart)childObject);
|
||||
}
|
||||
if (childObject instanceof QueryParameterValue) {
|
||||
query.addLocalQueryParameterValue((QueryParameterValue)childObject);
|
||||
query.addQueryParameterValue((QueryParameterValue)childObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ public class QueryElementConfigurator extends AbstractElementConfigurator {
|
|||
if ((element.getElementObject() instanceof Query)==false) {
|
||||
throw new ElementConfiguratorException(this,"No query element object");
|
||||
}
|
||||
QueryStore store = XPQLParser.getQueryStore(element.getElementContext());
|
||||
QueryStore store = XPQLParser.getQueryStore(element.getElementLanguage());
|
||||
Query query = (Query)element.getElementObject();
|
||||
query.setQueryStore(store);
|
||||
store.addQuery(query);
|
||||
store.addQuery(query);
|
||||
}
|
||||
}
|
||||
|
|
@ -53,9 +53,9 @@ public class QueryTypeObjectConverter extends AbstractStringObjectConverter {
|
|||
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
|
||||
try {
|
||||
return QueryType.valueOf(""+str);
|
||||
} catch (Exception ex) {
|
||||
throw new ObjectConverterException(this,"Could not convert to QueryType value="+str,ex);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw new ObjectConverterException(this,"Could not convert to QueryType value="+str,ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -64,4 +64,4 @@ public class QueryTypeObjectConverter extends AbstractStringObjectConverter {
|
|||
result.converters=cloneConverters();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
10
vasc-xpql/src/main/resources/META-INF/vasc/vasc-modules.xml
Normal file
10
vasc-xpql/src/main/resources/META-INF/vasc/vasc-modules.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<modules version="1.0"
|
||||
xmlns="http://language.x4o.org/xml/ns/modules"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://language.x4o.org/xml/ns/modules http://language.x4o.org/xml/ns/modules-1.0.xsd"
|
||||
>
|
||||
<language version="1.0">
|
||||
<eld-resource>vasc-xpql.eld</eld-resource>
|
||||
</language>
|
||||
</modules>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
|
||||
<properties>
|
||||
<comment>
|
||||
Vasc namespace for the vasc-xpql backend
|
||||
</comment>
|
||||
<entry key="eld.http://vasc.forwardfire.net/eld/vasc-xpql.eld">vasc-xpql.eld</entry>
|
||||
</properties>
|
||||
|
|
@ -1,4 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld">
|
||||
<eld:elementClass tag="xpqlLoadQueries" elementClassName="net.forwardfire.vasc.xpql.x4o.XpqlLoadQueriesElement"/>
|
||||
</eld:root>
|
||||
<root:module
|
||||
xmlns="http://eld.x4o.org/xml/ns/eld-lang"
|
||||
xmlns:root="http://eld.x4o.org/xml/ns/eld-root"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
|
||||
providerName="vasc.forwardfire.net"
|
||||
name="Xpql query loading"
|
||||
id="mod-vasc-xpql"
|
||||
>
|
||||
<namespace uri="http://vasc.forwardfire.net/xml/ns/vasc-xpql"
|
||||
schemaUri="http://vasc.forwardfire.net/xml/ns/vasc-xpql-1.0.xsd"
|
||||
schemaResource="vasc-xpql-1.0.xsd"
|
||||
schemaPrefix="xpql"
|
||||
name="Vasc Xpql"
|
||||
id="ns-vasc-xpql"
|
||||
>
|
||||
<element tag="xpqlLoadQueries" elementClass="net.forwardfire.vasc.xpql.x4o.XpqlLoadQueriesElement"/>
|
||||
</namespace>
|
||||
</root:module>
|
||||
|
|
|
|||
|
|
@ -1,27 +1,52 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld">
|
||||
|
||||
<eld:elementBindingHandler bean.class="net.forwardfire.vasc.xpql.impl.x4o.QueryBindingHandler"/>
|
||||
|
||||
<eld:elementClass tag="xpql" objectClassName="java.lang.Object"/>
|
||||
|
||||
<eld:elementClass tag="query" objectClassName="net.forwardfire.vasc.xpql.impl.DefaultQuery">
|
||||
<eld:elementClassAttribute attributeName="type" defaultValue="sql">
|
||||
<eld:attributeBeanConverter bean.class="net.forwardfire.vasc.xpql.impl.x4o.QueryTypeObjectConverter"/>
|
||||
</eld:elementClassAttribute>
|
||||
<eld:elementConfigurator configAction="true" bean.class="net.forwardfire.vasc.xpql.impl.x4o.QueryElementConfigurator"/>
|
||||
</eld:elementClass>
|
||||
<eld:elementClass tag="sql" elementClassName="net.forwardfire.vasc.xpql.impl.x4o.SQLElement"/>
|
||||
<eld:elementClass tag="parameter" objectClassName="net.forwardfire.vasc.xpql.impl.QueryParameter" elementClassName="net.forwardfire.vasc.xpql.impl.x4o.QueryParameterElement"/>
|
||||
<eld:elementClass tag="include" objectClassName="net.forwardfire.vasc.xpql.impl.QueryInclude" elementClassName="net.forwardfire.vasc.xpql.impl.x4o.QueryIncludeElement"/>
|
||||
<eld:elementClass tag="comment" elementClassName="net.forwardfire.vasc.xpql.impl.x4o.CommentElement"/>
|
||||
<eld:elementClass tag="parameterValue" objectClassName="net.forwardfire.vasc.xpql.impl.DefaultQueryParameterValue">
|
||||
<eld:elementClassAttribute attributeName="type" defaultValue="parameter">
|
||||
<eld:attributeBeanConverter bean.class="net.forwardfire.vasc.xpql.impl.x4o.ParameterTypeObjectConverter"/>
|
||||
</eld:elementClassAttribute>
|
||||
<eld:elementClassAttribute attributeName="valueType">
|
||||
<eld:attributeClassConverter/>
|
||||
</eld:elementClassAttribute>
|
||||
</eld:elementClass>
|
||||
</eld:root>
|
||||
<root:module
|
||||
xmlns="http://eld.x4o.org/xml/ns/eld-lang"
|
||||
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
|
||||
xmlns:root="http://eld.x4o.org/xml/ns/eld-root"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
|
||||
providerName="xpql.vasc.forwardfire.net"
|
||||
name="XML Parmeterized Query Language"
|
||||
id="mod-xpql-lang"
|
||||
>
|
||||
<bindingHandler id="QueryBindingHandler" bean.class="net.forwardfire.vasc.xpql.impl.x4o.QueryBindingHandler"/>
|
||||
<namespace uri="http://xpql.vasc.forwardfire.net/xml/ns/xpql-root"
|
||||
schemaUri="http://xpql.vasc.forwardfire.net/xml/ns/xpql-root-1.0.xsd"
|
||||
schemaResource="xpql-root-1.0.xsd"
|
||||
schemaPrefix="root"
|
||||
name="Xpql Language Root"
|
||||
languageRoot="true"
|
||||
id="ns-xpql-root"
|
||||
>
|
||||
<element tag="xpql" objectClass="java.lang.Object">
|
||||
<description>The module root element.</description>
|
||||
</element>
|
||||
</namespace>
|
||||
<namespace uri="http://xpql.vasc.forwardfire.net/xml/ns/xpql-lang"
|
||||
schemaUri="http://xpql.vasc.forwardfire.net/xml/ns/xpql-lang-1.0.xsd"
|
||||
schemaResource="xpql-lang-1.0.xsd"
|
||||
schemaPrefix="xpql"
|
||||
name="Vasc Xpql Language"
|
||||
id="ns-xpql-lang"
|
||||
>
|
||||
<element tag="query" objectClass="net.forwardfire.vasc.xpql.impl.DefaultQuery">
|
||||
<attribute name="type" defaultValue="sql">
|
||||
<conv:beanConverter bean.class="net.forwardfire.vasc.xpql.impl.x4o.QueryTypeObjectConverter"/>
|
||||
</attribute>
|
||||
<configurator id="QueryElementConfigurator" configAction="true" bean.class="net.forwardfire.vasc.xpql.impl.x4o.QueryElementConfigurator"/>
|
||||
</element>
|
||||
<element tag="sql" elementClass="net.forwardfire.vasc.xpql.impl.x4o.SQLElement"/>
|
||||
<element tag="parameter" objectClass="net.forwardfire.vasc.xpql.impl.QueryParameter" elementClass="net.forwardfire.vasc.xpql.impl.x4o.QueryParameterElement"/>
|
||||
<element tag="include" objectClass="net.forwardfire.vasc.xpql.impl.QueryInclude" elementClass="net.forwardfire.vasc.xpql.impl.x4o.QueryIncludeElement"/>
|
||||
<element tag="comment" elementClass="net.forwardfire.vasc.xpql.impl.x4o.CommentElement"/>
|
||||
<element tag="parameterValue" objectClass="net.forwardfire.vasc.xpql.impl.DefaultQueryParameterValue">
|
||||
<attribute name="type" defaultValue="parameter">
|
||||
<conv:beanConverter bean.class="net.forwardfire.vasc.xpql.impl.x4o.ParameterTypeObjectConverter"/>
|
||||
</attribute>
|
||||
<attribute name="valueType">
|
||||
<conv:classConverter/>
|
||||
</attribute>
|
||||
</element>
|
||||
</namespace>
|
||||
</root:module>
|
||||
|
||||
|
|
|
|||
10
vasc-xpql/src/main/resources/META-INF/xpql/xpql-modules.xml
Normal file
10
vasc-xpql/src/main/resources/META-INF/xpql/xpql-modules.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<modules version="1.0"
|
||||
xmlns="http://language.x4o.org/xml/ns/modules"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://language.x4o.org/xml/ns/modules http://language.x4o.org/xml/ns/modules-1.0.xsd"
|
||||
>
|
||||
<language version="1.0">
|
||||
<eld-resource>xpql-lang.eld</eld-resource>
|
||||
</language>
|
||||
</modules>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
|
||||
<properties>
|
||||
<comment>
|
||||
xpql namespace
|
||||
</comment>
|
||||
<entry key="eld.http://xpql.vasc.forwardfire.net/eld/xpql-lang.eld">xpql-lang.eld</entry>
|
||||
<!--
|
||||
<entry key="eld.http://xpql.vasc.forwardfire.net/eld/xpql-query.eld">xtes-xpql.eld</entry>
|
||||
-->
|
||||
</properties>
|
||||
Loading…
Add table
Add a link
Reference in a new issue