2
0
Fork 0

made first demo almost fully working

This commit is contained in:
Willem Cazander 2012-11-26 16:08:45 +01:00
parent 2a0d992642
commit 01b3b5cc54
104 changed files with 3259 additions and 2181 deletions

View file

@ -98,40 +98,28 @@ public class VascServiceManagerImpl implements VascServiceManagerRemote,VascServ
// resourceBundle = ResourceBundle.getBundle(value);
//}
}
/*
if (entityManager==null) {
new NullPointerException("Have no entityManager");
}
if (xpqlController==null) {
new NullPointerException("Have no xpqlController");
}*/
//if (resourceBundle==null) {
// new NullPointerException("Have no resourceBundle");
//}
long s = System.currentTimeMillis();
// get local jvm plugging controller
if (vascController==null) {
vascController = DefaultVascFactory.getDefaultVascController();
}
for (String key:keys.keySet()) {
String value = keys.get(key);
if (key.startsWith("load")) {
// TODO made reuse working.
VascParser vp = new VascParser(vascController);
if (xpqlController!=null) {
vp.addELBean("xpqlController", new XpqlController());
}
if (entityManager!=null) {
vp.addELBean("entityManagerProvider", new LocalEntityManagerProvider());
}
vp.parseResource(value);
}
}
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
for (String key:keys.keySet()) {
String value = keys.get(key);
if (key.startsWith("load")) {
// TODO made reuse working.
VascParser vp = new VascParser(vascController);
if (xpqlController!=null) {
vp.addELBean("xpqlController", new XpqlController());
}
if (entityManager!=null) {
vp.addELBean("entityManagerProvider", new LocalEntityManagerProvider());
}
vp.parseResource(value);
}
}
DefaultVascFactory.fillVascControllerLocalEntries((VascEntryControllerLocal) vascController.getVascEntryController(), vascController);
long t = System.currentTimeMillis()-s;
logger.info("Total loaded vasc entries: "+vascController.getVascEntryController().getVascEntryIds().size()+" in "+t+" ms.");
} catch (Exception e) {
@ -139,56 +127,53 @@ public class VascServiceManagerImpl implements VascServiceManagerRemote,VascServ
throw new RuntimeException("Error while init resources error: "+e.getMessage(),e);
}
}
/**
* Loads xtes-xpql-ejb3.xml from meta-inf and gives the keys
*/
protected Map<String,String> loadKeys() throws IOException {
Properties properties = new Properties();
logger.fine("Getting urls");
Enumeration<URL> e = Thread.currentThread().getContextClassLoader().getResources("META-INF/vasc-ejb3.xml");
while(e.hasMoreElements()) {
URL u = e.nextElement();
logger.finer("Loading reletive namespaces of: "+u+" for: META-INF/vasc-ejb3.xml");
InputStream in = u.openStream();
try {
properties.loadFromXML(in);
} finally {
if (in!=null) {
in.close();
}
}
}
e = Thread.currentThread().getContextClassLoader().getResources("/META-INF/vasc-ejb3.xml");
while(e.hasMoreElements()) {
URL u = e.nextElement();
logger.finer("Loading root namespaces of: "+u+" for: /META-INF/vasc-ejb3.xml");
InputStream in = u.openStream();
try {
properties.loadFromXML(in);
} finally {
if (in!=null) {
in.close();
}
}
}
logger.fine("done loading");
Map<String,String> result = new HashMap<String,String>(20);
for (Object key:properties.keySet()) {
if (key instanceof String) {
String key2 = (String) key;
String value = properties.getProperty(key2);
result.put(key2, value);
}
}
return result;
}
/**
* Loads xtes-xpql-ejb3.xml from meta-inf and gives the keys
*/
protected Map<String,String> loadKeys() throws IOException {
Properties properties = new Properties();
logger.fine("Getting urls");
Enumeration<URL> e = Thread.currentThread().getContextClassLoader().getResources("META-INF/vasc-ejb3.xml");
while(e.hasMoreElements()) {
URL u = e.nextElement();
logger.finer("Loading reletive namespaces of: "+u+" for: META-INF/vasc-ejb3.xml");
InputStream in = u.openStream();
try {
properties.loadFromXML(in);
} finally {
if (in!=null) {
in.close();
}
}
}
e = Thread.currentThread().getContextClassLoader().getResources("/META-INF/vasc-ejb3.xml");
while(e.hasMoreElements()) {
URL u = e.nextElement();
logger.finer("Loading root namespaces of: "+u+" for: /META-INF/vasc-ejb3.xml");
InputStream in = u.openStream();
try {
properties.loadFromXML(in);
} finally {
if (in!=null) {
in.close();
}
}
}
logger.fine("done loading");
Map<String,String> result = new HashMap<String,String>(20);
for (Object key:properties.keySet()) {
if (key instanceof String) {
String key2 = (String) key;
String value = properties.getProperty(key2);
result.put(key2, value);
}
}
return result;
}
/*
public Map<String,String> getResourceBundle(String locale) {
Map<String,String> result = new HashMap<String,String>(resourceBundle.keySet().size());
@ -199,7 +184,7 @@ public class VascServiceManagerImpl implements VascServiceManagerRemote,VascServ
return result;
}
*/
public List<String> getVascEntryIds() {
VascController v = getVascController();
if (v==null) {
@ -291,7 +276,7 @@ public class VascServiceManagerImpl implements VascServiceManagerRemote,VascServ
return null;
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "rawtypes" })
public void putAll(Map m) {
}