use of com.sun.enterprise.deployment.ConnectorDescriptor in project Payara by payara.
the class ActiveJmsResourceAdapter method setConnectionURL.
// This is a MQ workaround. In PE, when the broker type is
// EMBEDDED or LOCAL, do not set the addresslist, else
// MQ RA assumes that there are two URLs and fails (EE limitation).
private void setConnectionURL(JmsService jmsService, MQAddressList urlList) {
ConnectorDescriptor cd = super.getDescriptor();
String val = urlList.toString();
if (_logger.isLoggable(Level.INFO)) {
_logger.log(Level.INFO, JMSLoggerInfo.JMS_CONNECTION_URL, new Object[] { val });
}
ConnectorConfigProperty envProp1 = new ConnectorConfigProperty(CONNECTION_URL, val, val, "java.lang.String");
setProperty(cd, envProp1);
}
use of com.sun.enterprise.deployment.ConnectorDescriptor in project Payara by payara.
the class ActiveJmsResourceAdapter method setMdbContainerProperties.
private void setMdbContainerProperties() throws ConnectorRuntimeException {
JmsRaUtil raUtil = new JmsRaUtil(null);
ConnectorDescriptor cd = super.getDescriptor();
raUtil.setMdbContainerProperties();
String val = "" + MdbContainerProps.getReconnectEnabled();
ConnectorConfigProperty envProp2 = new ConnectorConfigProperty(RECONNECTENABLED, val, val, "java.lang.Boolean");
setProperty(cd, envProp2);
val = "" + MdbContainerProps.getReconnectDelay();
ConnectorConfigProperty envProp3 = new ConnectorConfigProperty(RECONNECTINTERVAL, val, val, "java.lang.Integer");
setProperty(cd, envProp3);
val = "" + MdbContainerProps.getReconnectMaxRetries();
ConnectorConfigProperty envProp4 = new ConnectorConfigProperty(RECONNECTATTEMPTS, val, val, "java.lang.Integer");
setProperty(cd, envProp4);
String integrationMode = getJmsService().getType();
boolean lazyInit = Boolean.valueOf(getJmsHost().getLazyInit());
val = "true";
if (EMBEDDED.equals(integrationMode) && lazyInit) {
val = "false";
}
doBind = Boolean.valueOf(val);
ConnectorConfigProperty envProp5 = new ConnectorConfigProperty(MQ_PORTMAPPER_BIND, val, val, "java.lang.Boolean");
setProperty(cd, envProp5);
// The above properties will be set in ConnectorDescriptor and
// will be bound in JNDI. This will be available to appclient
// and standalone client.
}
use of com.sun.enterprise.deployment.ConnectorDescriptor in project Payara by payara.
the class ActiveJmsResourceAdapter method setAppClientRABeanProperties.
/**
* Sets the SE/EE specific MQ-RA bean properties
* @throws ConnectorRuntimeException
*/
private void setAppClientRABeanProperties() throws ConnectorRuntimeException {
if (_logger.isLoggable(Level.FINE))
logFine("In Appclient container!!!");
ConnectorDescriptor cd = super.getDescriptor();
// if the CONNECTION_URL is localhost, in JMSRA,
// use the ORB hostname so multi-homed connections work properly
ORBLocator orbHelper = habitat.getService(ORBLocator.class);
if (orbHelper != null && orbHelper.getORB() != null) {
String jmsHost = null;
String orbHost = orbHelper.getORBHost(orbHelper.getORB());
String jmsPort = "7676";
Set<?> props = cd.getConfigProperties();
for (Object prop_ : props) {
if (prop_ instanceof ConnectorConfigProperty) {
final ConnectorConfigProperty prop = (ConnectorConfigProperty) prop_;
if (prop.getName().equals(CONNECTION_URL)) {
try {
URI url = new URI(prop.getValue());
jmsPort = Integer.toString(url.getPort());
if ("localhost".equalsIgnoreCase(url.getHost())) {
jmsHost = orbHost;
}
} catch (URISyntaxException ex) {
_logger.fine(String.format("Invalid Connection URL: %s", prop.getValue()));
}
}
}
}
if (jmsHost != null) {
setProperty(cd, new ConnectorConfigProperty(CONNECTION_URL, String.format("mq://%s:%s", orbHost, jmsPort), "ORB Address List", "java.lang.String"));
}
}
ConnectorConfigProperty envProp1 = new ConnectorConfigProperty(BROKERTYPE, REMOTE, "Broker Type", "java.lang.String");
setProperty(cd, envProp1);
ConnectorConfigProperty envProp2 = new ConnectorConfigProperty(GROUPNAME, "", "Group Name", "java.lang.String");
cd.removeConfigProperty(envProp2);
ConnectorConfigProperty envProp3 = new ConnectorConfigProperty(CLUSTERCONTAINER, "false", "Cluster flag", "java.lang.Boolean");
setProperty(cd, envProp3);
}
use of com.sun.enterprise.deployment.ConnectorDescriptor in project Payara by payara.
the class ConnectorURI method check.
/**
* The connector element specifies the URI of a connector
* module, relative to the top level of the application package.
*
* @param descriptor the Application deployment descriptor
*
* @return <code>Result</code> the results for this assertion
*/
public Result check(Application descriptor) {
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
Result result = getInitializedResult();
for (Iterator itr = descriptor.getBundleDescriptors(ConnectorDescriptor.class).iterator(); itr.hasNext(); ) {
ConnectorDescriptor cond = (ConnectorDescriptor) itr.next();
if (!cond.getModuleDescriptor().getArchiveUri().endsWith(".rar")) {
addErrorDetails(result, compName);
result.failed(smh.getLocalString(getClass().getName() + ".failed", "Error: [ {0} ] does not specify the URI [ {1} ] of a Connector module, relative to the top level of the application package [ {2} ], or does not end with \".rar\"", new Object[] { cond.getName(), cond.getModuleDescriptor().getArchiveUri(), descriptor.getName() }));
}
}
if (result.getStatus() != Result.FAILED) {
addGoodDetails(result, compName);
result.passed(smh.getLocalString(getClass().getName() + ".passed", "All the Connector URIs are valid."));
}
return result;
}
use of com.sun.enterprise.deployment.ConnectorDescriptor in project Payara by payara.
the class AdministeredObjectFactory method getObjectInstance.
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable env) throws Exception {
Reference ref = (Reference) obj;
if (logger.isLoggable(Level.FINE)) {
logger.fine("AdministeredObjectFactory: " + ref + " Name:" + name);
}
AdministeredObjectResource aor = (AdministeredObjectResource) ref.get(0).getContent();
String moduleName = aor.getResourceAdapter();
// If call fom application client, start resource adapter lazily.
// todo: Similar code in ConnectorObjectFactory - to refactor.
ConnectorRuntime runtime = ConnectorNamingUtils.getRuntime();
if (runtime.isACCRuntime() || runtime.isNonACCRuntime()) {
ConnectorDescriptor connectorDescriptor = null;
try {
Context ic = new InitialContext(env);
String descriptorJNDIName = ConnectorAdminServiceUtils.getReservePrefixedJNDINameForDescriptor(moduleName);
connectorDescriptor = (ConnectorDescriptor) ic.lookup(descriptorJNDIName);
} catch (NamingException ne) {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "Failed to look up ConnectorDescriptor " + "from JNDI", moduleName);
}
throw new ConnectorRuntimeException("Failed to look up " + "ConnectorDescriptor from JNDI");
}
runtime.createActiveResourceAdapter(connectorDescriptor, moduleName, null);
}
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (runtime.checkAccessibility(moduleName, loader) == false) {
throw new NamingException("Only the application that has the embedded resource" + "adapter can access the resource adapter");
}
if (logger.isLoggable(Level.FINE)) {
logger.fine("[AdministeredObjectFactory] ==> Got AdministeredObjectResource = " + aor);
}
// all RARs except system RARs should have been available now.
if (ConnectorsUtil.belongsToSystemRA(moduleName)) {
// make sure that system rar is started and hence added to connector classloader chain
if (ConnectorRegistry.getInstance().getActiveResourceAdapter(moduleName) == null) {
String moduleLocation = ConnectorsUtil.getSystemModuleLocation(moduleName);
runtime.createActiveResourceAdapter(moduleLocation, moduleName, null);
}
loader = ConnectorRegistry.getInstance().getActiveResourceAdapter(moduleName).getClassLoader();
} else if (runtime.isServer()) {
if (ConnectorsUtil.isStandAloneRA(moduleName)) {
loader = ConnectorRegistry.getInstance().getActiveResourceAdapter(moduleName).getClassLoader();
}
}
return aor.createAdministeredObject(loader);
}
Aggregations