Small refactor for comming converters
This commit is contained in:
parent
75b3d5e0a0
commit
1c308a684a
178 changed files with 5865 additions and 1531 deletions
10
vasc-xpql-ejb3-client/.classpath
Normal file
10
vasc-xpql-ejb3-client/.classpath
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
23
vasc-xpql-ejb3-client/.project
Normal file
23
vasc-xpql-ejb3-client/.project
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>vasc-xpql-ejb3-client</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#Wed Jan 11 23:36:06 CET 2012
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/main/resources=UTF-8
|
||||
encoding//src/test/java=UTF-8
|
||||
encoding//src/test/resources=UTF-8
|
||||
encoding/<project>=UTF-8
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#Wed Jan 11 23:36:06 CET 2012
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#Wed Jan 11 23:36:06 CET 2012
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
25
vasc-xpql-ejb3-client/pom.xml
Normal file
25
vasc-xpql-ejb3-client/pom.xml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>vasc</artifactId>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<version>0.3.5-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>vasc-xpql-ejb3-client</artifactId>
|
||||
<name>vasc-xpql-ejb3-client</name>
|
||||
<description>xpql parsing client interface for ejb3</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<artifactId>vasc-xpql</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.ejb</groupId>
|
||||
<artifactId>ejb-api</artifactId>
|
||||
<version>3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright 2007-2012 forwardfire.net All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.forwardfire.vasc.xpql.ejb3;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.ejb.Remote;
|
||||
|
||||
import net.forwardfire.vasc.xpql.query.Query;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 17 Sep 2010
|
||||
*/
|
||||
public interface XpqlQueryManager {
|
||||
|
||||
public Query getQuery(String name);
|
||||
|
||||
public List<Object> execute(Query query);
|
||||
|
||||
public Object executeObject(Query query);
|
||||
|
||||
public Integer executeUpdate(Query query);
|
||||
|
||||
public List<Object> execute(String query,Map<String,Object> parameters);
|
||||
|
||||
public Object executeObject(String query,Map<String,Object> parameters);
|
||||
|
||||
public Integer executeUpdate(String query,Map<String,Object> parameters);
|
||||
|
||||
@Local
|
||||
public interface ILocal extends XpqlQueryManager {
|
||||
}
|
||||
|
||||
@Remote
|
||||
public interface IRemote extends XpqlQueryManager {
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package net.forwardfire.vasc.xpql.ejb3.x4o;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
|
||||
import net.forwardfire.vasc.xpql.ejb3.XpqlQueryManager;
|
||||
import net.forwardfire.vasc.xpql.query.Query;
|
||||
|
||||
import org.x4o.xml.element.AbstractElement;
|
||||
import org.x4o.xml.element.ElementException;
|
||||
|
||||
public class XpqlEjb3QueriesElement extends AbstractElement {
|
||||
|
||||
|
||||
@Override
|
||||
public void doElementEnd() throws ElementException {
|
||||
|
||||
// set queries map to element object
|
||||
Map<String,Query> queries = new HashMap<String,Query>(100);
|
||||
setElementObject(queries);
|
||||
|
||||
String jndiName = getAttributes().get("jndi");
|
||||
if (jndiName==null) {
|
||||
throw new ElementException("No 'jndi' attributes defined.");
|
||||
}
|
||||
if (jndiName.isEmpty()) {
|
||||
throw new ElementException("Empty 'jndi' attributes can't load.");
|
||||
}
|
||||
|
||||
// load queries from ejb3 bean reference
|
||||
XpqlQueryManager xpqlManager = null;
|
||||
try {
|
||||
Context context = new InitialContext();
|
||||
xpqlManager = (XpqlQueryManager)context.lookup( jndiName );
|
||||
} catch (Exception e) {
|
||||
throw new ElementException("Could not get the ejb resource bundle: "+e.getMessage(),e);
|
||||
}
|
||||
if (xpqlManager==null) {
|
||||
throw new ElementException("XpqlQueryManager ejb resource is null.");
|
||||
}
|
||||
XpqlController refBean = new XpqlController(xpqlManager);
|
||||
setElementObject(refBean);
|
||||
}
|
||||
|
||||
class XpqlController implements Map<String,Query> {
|
||||
private XpqlQueryManager xpqlManager = null;
|
||||
|
||||
public XpqlController(XpqlQueryManager xpqlManager) {
|
||||
this.xpqlManager=xpqlManager;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
public boolean containsKey(Object key) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean containsValue(Object value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Set<Map.Entry<String, Query>> entrySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Query get(Object key) {
|
||||
return xpqlManager.getQuery((String)key);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Set<String> keySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Query put(String key, Query value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void putAll(Map m) {
|
||||
}
|
||||
|
||||
public Query remove(Object key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Collection<Query> values() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
|
||||
<properties>
|
||||
<comment>
|
||||
Vasc namespace for the xpql ejb3 backend
|
||||
</comment>
|
||||
<entry key="eld.http://vasc.forwardfire.net/eld/vasc-xpql-ejb3.eld">vasc-xpql-ejb3.eld</entry>
|
||||
</properties>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<eld:root xmlns:eld="http://eld.x4o.org/eld/eld-lang.eld">
|
||||
<eld:elementClass tag="xpqlEjb3Queries" elementClassName="net.forwardfire.vasc.backends.jpa.x4o.XpqlEjb3QueriesElement"/>
|
||||
</eld:root>
|
||||
Loading…
Add table
Add a link
Reference in a new issue