use of org.glassfish.connectors.config.AdminObjectResource in project Payara by payara.
the class AdminObjectResourceDeployer method deployResource.
/**
* {@inheritDoc}
*/
public synchronized void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
final AdminObjectResource aor = (AdminObjectResource) resource;
String jndiName = aor.getJndiName();
ResourceInfo resourceInfo = new ResourceInfo(jndiName, applicationName, moduleName);
createAdminObjectResource(aor, resourceInfo);
}
use of org.glassfish.connectors.config.AdminObjectResource in project Payara by payara.
the class AdminObjectResourceDeployer method undeployResource.
/**
* {@inheritDoc}
*/
public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception {
final AdminObjectResource aor = (AdminObjectResource) resource;
ResourceInfo resourceInfo = new ResourceInfo(aor.getJndiName(), applicationName, moduleName);
deleteAdminObjectResource(aor, resourceInfo);
}
use of org.glassfish.connectors.config.AdminObjectResource in project Payara by payara.
the class AppSpecificConnectorClassLoaderUtil method detectResourceInRA.
private void detectResourceInRA(Application app, String moduleName, String jndiName) {
// domain.xml
Resource res = null;
if (jndiName.startsWith(ConnectorConstants.JAVA_APP_SCOPE_PREFIX)) /*|| jndiName.startsWith("java:global/")*/
{
ApplicationInfo appInfo = appRegistry.get(app.getName());
res = getApplicationScopedResource(jndiName, BindableResource.class, appInfo);
} else if (jndiName.startsWith(ConnectorConstants.JAVA_MODULE_SCOPE_PREFIX)) {
ApplicationInfo appInfo = appRegistry.get(app.getName());
res = getModuleScopedResource(jndiName, moduleName, BindableResource.class, appInfo);
} else {
res = ConnectorsUtil.getResourceByName(getResources(), BindableResource.class, jndiName);
}
// (and .ear may refer to these resources in DD)
if (res != null) {
if (ConnectorResource.class.isAssignableFrom(res.getClass())) {
ConnectorResource connResource = (ConnectorResource) res;
String poolName = connResource.getPoolName();
Resource pool;
ApplicationInfo appInfo = appRegistry.get(app.getName());
if (jndiName.startsWith(ConnectorConstants.JAVA_APP_SCOPE_PREFIX)) /*|| jndiName.startsWith("java:global/")*/
{
pool = getApplicationScopedResource(poolName, ResourcePool.class, appInfo);
} else if (jndiName.startsWith(ConnectorConstants.JAVA_MODULE_SCOPE_PREFIX)) {
pool = getModuleScopedResource(poolName, moduleName, ResourcePool.class, appInfo);
} else {
pool = ConnectorsUtil.getResourceByName(getResources(), ResourcePool.class, poolName);
}
if (ConnectorConnectionPool.class.isAssignableFrom(pool.getClass())) {
String raName = ((ConnectorConnectionPool) pool).getResourceAdapterName();
app.addResourceAdapter(raName);
}
} else if (AdminObjectResource.class.isAssignableFrom(res.getClass())) {
String raName = ((AdminObjectResource) res).getResAdapter();
app.addResourceAdapter(raName);
}
} else {
boolean found = false;
// detect sun-ra.xml
// find all the standalone connector modules
List<com.sun.enterprise.config.serverbeans.Application> applications = getApplications().getApplicationsWithSnifferType(com.sun.enterprise.config.serverbeans.ServerTags.CONNECTOR, true);
Iterator itr = applications.iterator();
while (itr.hasNext()) {
com.sun.enterprise.config.serverbeans.Application application = (com.sun.enterprise.config.serverbeans.Application) itr.next();
String appName = application.getName();
ApplicationInfo appInfo = appRegistry.get(appName);
if (appInfo == null) {
// the app is not deployed on this node
continue;
}
Application dolApp = appInfo.getMetaData(Application.class);
Collection<ConnectorDescriptor> rarDescriptors = dolApp.getBundleDescriptors(ConnectorDescriptor.class);
for (ConnectorDescriptor desc : rarDescriptors) {
SunConnector sunraDesc = desc.getSunDescriptor();
if (sunraDesc != null) {
String sunRAJndiName = (String) sunraDesc.getResourceAdapter().getValue(ResourceAdapter.JNDI_NAME);
if (jndiName.equals(sunRAJndiName)) {
app.addResourceAdapter(desc.getName());
found = true;
break;
}
} else {
// check whether it is default resource in the connector
if (desc.getDefaultResourcesNames().contains(jndiName)) {
app.addResourceAdapter(desc.getName());
found = true;
break;
}
}
}
}
if (!found) {
if (DOLUtils.getDefaultLogger().isLoggable(Level.FINEST)) {
DOLUtils.getDefaultLogger().log(Level.FINEST, "could not find resource by name : " + jndiName);
}
}
}
}
use of org.glassfish.connectors.config.AdminObjectResource in project Payara by payara.
the class AdminObjectResourceDeployer method undeployResource.
/**
* {@inheritDoc}
*/
public synchronized void undeployResource(Object resource) throws Exception {
final AdminObjectResource aor = (AdminObjectResource) resource;
ResourceInfo resourceInfo = ConnectorsUtil.getResourceInfo(aor);
deleteAdminObjectResource(aor, resourceInfo);
}
use of org.glassfish.connectors.config.AdminObjectResource in project Payara by payara.
the class AdminObjectManager method createConfigBean.
private AdminObjectResource createConfigBean(Resources param, Properties props) throws PropertyVetoException, TransactionFailure {
AdminObjectResource newResource = param.createChild(AdminObjectResource.class);
newResource.setJndiName(jndiName);
if (description != null) {
newResource.setDescription(description);
}
newResource.setResAdapter(raName);
newResource.setResType(resType);
newResource.setClassName(className);
newResource.setEnabled(enabled);
if (props != null) {
for (Map.Entry e : props.entrySet()) {
Property prop = newResource.createChild(Property.class);
prop.setName((String) e.getKey());
prop.setValue((String) e.getValue());
newResource.getProperty().add(prop);
}
}
return newResource;
}
Aggregations