use of com.sun.enterprise.container.common.spi.WebServiceReferenceManager in project Payara by payara.
the class ComponentEnvManagerImpl method addResourceReferences.
private void addResourceReferences(ScopeType scope, Iterator resRefItr, Collection<JNDIBinding> jndiBindings) {
while (resRefItr.hasNext()) {
ResourceReferenceDescriptor resourceRef = (ResourceReferenceDescriptor) resRefItr.next();
if (!dependencyAppliesToScope(resourceRef, scope)) {
continue;
}
resourceRef.checkType();
String name = descriptorToLogicalJndiName(resourceRef);
Object value = null;
String physicalJndiName = resourceRef.getJndiName();
// or another jndi-name that can be looked up
if (resourceRef.isURLResource()) {
if (physicalJndiName.startsWith(JAVA_GLOBAL_PREFIX) || physicalJndiName.startsWith(JAVA_APP_PREFIX) || physicalJndiName.startsWith(JAVA_MODULE_PREFIX) || physicalJndiName.startsWith(JAVA_COMP_PREFIX)) {
// for jndi-name or lookup-name like "java:module/env/url/testUrl"
value = namingUtils.createLazyNamingObjectFactory(name, physicalJndiName, false);
} else {
try {
// for jndi-name like "http://localhost:8080/index.html"
Object obj = new java.net.URL(physicalJndiName);
NamingObjectFactory factory = namingUtils.createSimpleNamingObjectFactory(name, obj);
value = namingUtils.createCloningNamingObjectFactory(name, factory);
} catch (MalformedURLException e) {
// for jndi-name or lookup-name like "url/testUrl"
value = namingUtils.createLazyNamingObjectFactory(name, physicalJndiName, false);
}
}
} else if (resourceRef.isORB()) {
// TODO handle non-default ORBs
value = namingUtils.createLazyNamingObjectFactory(name, physicalJndiName, false);
} else if (resourceRef.isWebServiceContext()) {
WebServiceReferenceManager wsRefMgr = locator.getService(WebServiceReferenceManager.class);
if (wsRefMgr != null) {
value = wsRefMgr.getWSContextObject();
} else {
_logger.log(Level.SEVERE, "Cannot find the following class to proceed with @Resource WebServiceContext" + wsRefMgr + "Please confirm if webservices module is installed ");
}
} else if (resourceRef.isJDBCResource() || resourceRef.isJMSConnectionFactory() || resourceRef.isMailResource() || resourceRef.isResourceConnectionFactory()) {
value = namingUtils.createLazyInitializationNamingObjectFactory(name, physicalJndiName, false);
} else {
value = namingUtils.createLazyNamingObjectFactory(name, physicalJndiName, false);
}
jndiBindings.add(new CompEnvBinding(name, value));
}
}
Aggregations