/** * tomcat uses a hastable to store entry type, null values are not allowed * <p/> * These occur when the reference is declared using a 'lookup' attribute These do not have a type associated * * @param ref */ private void normalize(final ResourceBase ref) { final String name = ref.getName(); if (name.startsWith(JAVA_PREFIX)) { // tomcat adds mbeans and a ":" in a mbean is not very cool for the objectname ref.setName(name.substring(JAVA_PREFIX.length())); } else if (name.startsWith("openejb/Resource/")) { final String id = (String) ref.getProperty(NamingUtil.RESOURCE_ID); if (id != null) { // id can be != substring (else) in case of app resource scope ref.setProperty(NamingUtil.JNDI_NAME, "openejb:Resource/" + id); } else { ref.setProperty(NamingUtil.JNDI_NAME, "openejb:" + name.substring("openejb/".length())); } } if (ref.getType() == null) { ref.setType(""); } }
for (Iterator<String> iter = resource.listProperties(); iter.hasNext();) { String name = iter.next(); Object value = resource.getProperty(name); if (!isPersistable(value.getClass())) { continue;
private static Reference createReference(final ResourceBase resource) { final Reference ref; if (resource instanceof ContextResource) { final ContextResource cr = (ContextResource) resource; ref = new ResourceRef(resource.getType(), resource.getDescription(), cr.getScope(), cr.getAuth(), cr.getSingleton()); } else { ref = new ResourceEnvRef(resource.getType()); } final Iterator<String> params = resource.listProperties(); while (params.hasNext()) { final String paramName = params.next(); final String paramValue = (String) resource.getProperty(paramName); final StringRefAddr refAddr = new StringRefAddr(paramName, paramValue); ref.add(refAddr); } return ref; }
while (params.hasNext()) { final String paramName = params.next(); final String paramValue = (String) resource.getProperty(paramName); properties.setProperty("jndiName", newResource.getId()); properties.setProperty("appName", getId(standardContext)); properties.setProperty("factory", (String) resource.getProperty("factory"));