use of com.sun.enterprise.deployment.ConnectorDescriptor in project Payara by payara.
the class ConnectorsRecoveryResourceHandler method getdbUserPasswordOfConnectorConnectionPool.
private String[] getdbUserPasswordOfConnectorConnectionPool(ConnectorConnectionPool connectorConnectionPool) {
String[] userPassword = new String[2];
userPassword[0] = null;
userPassword[1] = null;
List<Property> properties = connectorConnectionPool.getProperty();
if (properties != null) {
boolean foundUserPassword = false;
for (Property elementProperty : properties) {
String prop = elementProperty.getName().toUpperCase(locale);
if ("USERNAME".equals(prop) || "USER".equals(prop)) {
userPassword[0] = elementProperty.getValue();
foundUserPassword = true;
} else if ("PASSWORD".equals(prop)) {
userPassword[1] = elementProperty.getValue();
foundUserPassword = true;
}
}
if (foundUserPassword == true) {
return userPassword;
}
}
PoolInfo poolInfo = ConnectorsUtil.getPoolInfo(connectorConnectionPool);
String rarName = connectorConnectionPool.getResourceAdapterName();
String connectionDefName = connectorConnectionPool.getConnectionDefinitionName();
ConnectorRegistry connectorRegistry = ConnectorRegistry.getInstance();
ConnectorDescriptor connectorDescriptor = connectorRegistry.getDescriptor(rarName);
ConnectionDefDescriptor cdd = connectorDescriptor.getConnectionDefinitionByCFType(connectionDefName);
Set configProps = cdd.getConfigProperties();
for (Iterator iter = configProps.iterator(); iter.hasNext(); ) {
ConnectorConfigProperty envProp = (ConnectorConfigProperty) iter.next();
String prop = envProp.getName().toUpperCase(locale);
if ("USER".equals(prop) || "USERNAME".equals(prop)) {
userPassword[0] = envProp.getValue();
} else if ("PASSWORD".equals(prop)) {
userPassword[1] = envProp.getValue();
}
}
if (userPassword[0] != null && !"".equals(userPassword[0].trim())) {
return userPassword;
}
// else read the default username and password from the ra.xml
ManagedConnectionFactory mcf = connectorRegistry.getManagedConnectionFactory(poolInfo);
userPassword[0] = ConnectionPoolObjectsUtils.getValueFromMCF("UserName", poolInfo, mcf);
userPassword[1] = ConnectionPoolObjectsUtils.getValueFromMCF("Password", poolInfo, mcf);
return userPassword;
}
use of com.sun.enterprise.deployment.ConnectorDescriptor in project Payara by payara.
the class ConnectorValidator method accept.
public void accept(BundleDescriptor descriptor) {
if (descriptor instanceof ConnectorDescriptor) {
ConnectorDescriptor connectorDesc = (ConnectorDescriptor) descriptor;
accept(connectorDesc);
}
}
use of com.sun.enterprise.deployment.ConnectorDescriptor in project Payara by payara.
the class ConnectorTracerVisitor method accept.
@Override
public void accept(BundleDescriptor descriptor) {
if (descriptor instanceof ConnectorDescriptor) {
ConnectorDescriptor connectorDesc = (ConnectorDescriptor) descriptor;
accept(connectorDesc);
}
}
use of com.sun.enterprise.deployment.ConnectorDescriptor in project Payara by payara.
the class JdbcConnectionPoolDeployer method createConnectorConnectionPool.
public ConnectorConnectionPool createConnectorConnectionPool(JdbcConnectionPool adminPool, PoolInfo poolInfo) throws ConnectorRuntimeException {
String moduleName = JdbcResourcesUtil.createInstance().getRANameofJdbcConnectionPool(adminPool);
int txSupport = getTxSupport(moduleName);
ConnectorDescriptor connDesc = runtime.getConnectorDescriptor(moduleName);
// Create the connector Connection Pool object from the configbean object
ConnectorConnectionPool conConnPool = new ConnectorConnectionPool(poolInfo);
conConnPool.setTransactionSupport(txSupport);
setConnectorConnectionPoolAttributes(conConnPool, adminPool);
// Initially create the ConnectorDescriptor
ConnectorDescriptorInfo connDescInfo = createConnectorDescriptorInfo(connDesc, moduleName);
connDescInfo.setMCFConfigProperties(getMCFConfigProperties(adminPool, conConnPool, connDesc));
// since we are deploying a 1.0 RAR, this is null
connDescInfo.setResourceAdapterConfigProperties((Set) null);
conConnPool.setConnectorDescriptorInfo(connDescInfo);
return conConnPool;
}
use of com.sun.enterprise.deployment.ConnectorDescriptor in project Payara by payara.
the class ActivationHandler method processAnnotation.
public HandlerProcessingResult processAnnotation(AnnotationInfo element) throws AnnotationProcessorException {
AnnotatedElementHandler aeHandler = element.getProcessingContext().getHandler();
Activation activation = (Activation) element.getAnnotation();
if (aeHandler instanceof RarBundleContext) {
RarBundleContext rarContext = (RarBundleContext) aeHandler;
ConnectorDescriptor desc = rarContext.getDescriptor();
// process annotation only if message-listeners are provided
if (activation.messageListeners().length > 0) {
// initialize inbound if it was not done already
if (!desc.getInBoundDefined()) {
desc.setInboundResourceAdapter(new InboundResourceAdapter());
}
InboundResourceAdapter ira = desc.getInboundResourceAdapter();
// get the activation-spec implementation class-name
Class c = (Class) element.getAnnotatedElement();
String activationSpecClass = c.getName();
// process all message-listeners, ensure that no duplicate message-listener-types are found
for (Class mlClass : activation.messageListeners()) {
MessageListener ml = new MessageListener();
ml.setActivationSpecClass(activationSpecClass);
ml.setMessageListenerType(mlClass.getName());
if (!ira.hasMessageListenerType(mlClass.getName())) {
ira.addMessageListener(ml);
}
// else {
// ignore the duplicates
// duplicates can be via :
// (i) message listner defined in DD
// (ii) as part of this particular annotation processing,
// already this message-listener-type is defined
// TODO V3 how to handle (ii)
// }
}
}
} else {
getFailureResult(element, "Not a rar bundle context", true);
}
return getDefaultProcessedResult();
}
Aggregations