/** * Gets look up reference from resource if exist. * * @param resourceBase resource base object * @return lookup ref */ private LookupRef lookForLookupRef(ResourceBase resourceBase) { String lookupName = resourceBase.getLookupName(); if ((lookupName != null && !lookupName.equals(""))) { return new LookupRef(resourceBase.getType(), lookupName); } return null; } }
/** * Gets look up reference from resource if exist. * * @param resourceBase resource base object * @return lookup ref */ private LookupRef lookForLookupRef(ResourceBase resourceBase) { String lookupName = resourceBase.getLookupName(); if ((lookupName != null && !lookupName.equals(""))) { return new LookupRef(resourceBase.getType(), lookupName); } return null; } }
/** * 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(""); } }
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; }
private void bindResource(final ResourceBase res) { try { final Context globalNamingContext = standardServer.getGlobalNamingContext(); final Object value = globalNamingContext.lookup(res.getName()); final String type = res.getType(); bindResource(res.getName(), value, type); } catch (final NamingException e) { logger.error("Unable to lookup Global Tomcat resource " + res.getName(), e); } }
String typeName = resource.getType(); Class<?> typeClass = null; if (typeName != null) {
String typeName = resource.getType(); Class<?> typeClass = null; if (typeName != null) {
String typeName = resource.getType(); Class<?> typeClass = null; if (typeName != null) {
final boolean isDataSource = DataSource.class.getName().equals(resource.getType()); final boolean isAlreadyCreated = ContextResource.class.isInstance(resource) && ContextResource.class.cast(resource).getSingleton() && isDataSource; newResource = new Resource(name, resource.getType()); newResource = new Resource(name, resource.getType(), "org.apache.tomee:ProvidedByTomcat");