/** * Generate a unique id name for each J2EE component. */ public String getComponentEnvId(JndiNameEnvironment env) { String id = DOLUtils.getComponentEnvId(env); if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, DOLUtils.getApplicationName(env) + "Component Id: " + id); } return id; }
/** * Find the jndi name in our namespace. * @return True if the jndi name is found in the namespace. False otherwise. */ public boolean find(String jndiName, JndiNameEnvironment env) { if (jndiName == null) return false; if (jndiName.startsWith(ResourceConstants.JAVA_COMP_SCOPE_PREFIX)) { String componentId = DOLUtils.getComponentEnvId(env); List jndiNames = componentNamespaces.get(componentId); return jndiNames != null && jndiNames.contains(jndiName); } else if (jndiName.startsWith(ResourceConstants.JAVA_MODULE_SCOPE_PREFIX)) { String moduleName = getActualModuleName(DOLUtils.getModuleName(env)); List jndiNames = moduleNamespaces.get(moduleName); return jndiNames != null && jndiNames.contains(jndiName); } else if (jndiName.startsWith(ResourceConstants.JAVA_APP_SCOPE_PREFIX)) return appNamespace.contains(jndiName); else if (jndiName.startsWith(ResourceConstants.JAVA_GLOBAL_SCOPE_PREFIX)) return globalNameSpace.contains(jndiName); else return nonPortableJndiNames.contains(jndiName); }
String componentId = DOLUtils.getComponentEnvId(env); List<String> jndiNames = componentNamespaces.get(componentId); if (jndiNames == null) {
private Map getNamespace(String logicalJndiName, JndiNameEnvironment env) { String appName = DOLUtils.getApplicationName(env); Map namespace = null; if (logicalJndiName.startsWith(JAVA_COMP_PREFIX)) { String componentId = DOLUtils.getComponentEnvId(env); namespace = (Map) componentNamespaces.get(componentId); if (namespace == null) { namespace = new HashMap<String, Map>(); componentNamespaces.put(componentId, namespace); } } else if (logicalJndiName.startsWith(JAVA_MODULE_PREFIX)) { String moduleName = DOLUtils.getModuleName(env); AppModuleKey appModuleKey = new AppModuleKey(appName, moduleName); namespace = moduleNamespaces.get(appModuleKey); if (namespace == null) { namespace = new HashMap<AppModuleKey, Map>(); moduleNamespaces.put(appModuleKey, namespace); } } else if (logicalJndiName.startsWith(JAVA_APP_PREFIX)) { namespace = appNamespaces.get(appName); if (namespace == null) { namespace = new HashMap<String, Map>(); appNamespaces.put(appName, namespace); } } else { // java:global namespace = globalNameSpace; } return namespace; }