use of com.sun.enterprise.deployment.runtime.connector.SunConnector in project Payara by payara.
the class ConnectionPoolObjectsUtils method createSunRaConnectorPoolObject.
/**
* Creates ConnectorConnectionPool object pertaining to the pool props
* mentioned in the sun-ra/xml i.e it represents the pool mentioned in the
* sun-ra.xm.
*
* @param poolInfo Name of the pool
* @param desc ConnectorDescriptor which represent ra.xml and sun-ra.xml.
* @return ConnectorConnectionPool created ConnectorConnectionPool instance
*/
public static ConnectorConnectionPool createSunRaConnectorPoolObject(PoolInfo poolInfo, ConnectorDescriptor desc, String rarName) {
ConnectorConnectionPool connectorPoolObj = new ConnectorConnectionPool(poolInfo);
SunConnector sundesc = desc.getSunDescriptor();
ResourceAdapter sunRAXML = sundesc.getResourceAdapter();
connectorPoolObj.setMaxPoolSize((String) sunRAXML.getValue(ResourceAdapter.MAX_POOL_SIZE));
connectorPoolObj.setSteadyPoolSize((String) sunRAXML.getValue(ResourceAdapter.STEADY_POOL_SIZE));
connectorPoolObj.setMaxWaitTimeInMillis((String) sunRAXML.getValue(ResourceAdapter.MAX_WAIT_TIME_IN_MILLIS));
connectorPoolObj.setIdleTimeoutInSeconds((String) sunRAXML.getValue(ResourceAdapter.IDLE_TIMEOUT_IN_SECONDS));
connectorPoolObj.setPoolResizeQuantity((String) "2");
connectorPoolObj.setFailAllConnections(false);
// always
connectorPoolObj.setMatchConnections(true);
setDefaultAdvancedPoolAttributes(connectorPoolObj);
try {
connectorPoolObj.setTransactionSupport(getTransactionSupportFromRaXml(rarName));
} catch (Exception ex) {
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("error in setting txSupport");
}
}
boolean validateAtmostEveryIdleSecs = false;
// For SunRAPool, get the value of system property VALIDATE_ATMOST_EVERY_IDLE_SECS.
if (validateAtmostEveryIdleSecsProperty != null && validateAtmostEveryIdleSecsProperty.equalsIgnoreCase("TRUE")) {
validateAtmostEveryIdleSecs = true;
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "CCP.ValidateAtmostEveryIdleSecs.Set", poolInfo);
}
}
connectorPoolObj.setValidateAtmostEveryIdleSecs(validateAtmostEveryIdleSecs);
return connectorPoolObj;
}
use of com.sun.enterprise.deployment.runtime.connector.SunConnector 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 com.sun.enterprise.deployment.runtime.connector.SunConnector in project Payara by payara.
the class ConnectorNode method getSunConnectorDescriptor.
/**
* @return the descriptor instance to associate with this XMLNode
*/
public SunConnector getSunConnectorDescriptor() {
if (connector == null) {
connector = new SunConnector();
descriptor.setSunDescriptor(connector);
}
return connector;
}
use of com.sun.enterprise.deployment.runtime.connector.SunConnector in project Payara by payara.
the class ConnectorNode method writeDescriptor.
/**
* write the descriptor class to a DOM tree and return it
*
* @param parent node for the DOM tree
* @param node name for the descriptor
* @param the descriptor to write
* @return the DOM tree top node
*/
public Node writeDescriptor(Node parent, String nodeName, ConnectorDescriptor connector) {
Node connectorNode = super.writeDescriptor(parent, nodeName, connector);
// resource-adapter
SunConnector sunDesc = connector.getSunDescriptor();
if (sunDesc != null) {
ResourceAdapterNode ran = new ResourceAdapterNode();
ran.writeDescriptor(connectorNode, RuntimeTagNames.RESOURCE_ADAPTER, sunDesc.getResourceAdapter());
// role-map ?
if (sunDesc.getRoleMap() != null) {
RoleMapNode rmn = new RoleMapNode();
rmn.writeDescriptor(connectorNode, RuntimeTagNames.ROLE_MAP, sunDesc.getRoleMap());
}
}
return connectorNode;
}
Aggregations