Search in sources :

Example 21 with ConnectorDescriptor

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;
}
Also used : ConnectionDefDescriptor(com.sun.enterprise.deployment.ConnectionDefDescriptor) ConnectorConfigProperty(com.sun.enterprise.deployment.ConnectorConfigProperty) ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) ManagedConnectionFactory(javax.resource.spi.ManagedConnectionFactory) PoolInfo(org.glassfish.resourcebase.resources.api.PoolInfo) ConnectorRegistry(com.sun.enterprise.connectors.ConnectorRegistry) ConnectorConfigProperty(com.sun.enterprise.deployment.ConnectorConfigProperty) Property(org.jvnet.hk2.config.types.Property)

Example 22 with ConnectorDescriptor

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);
    }
}
Also used : ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor)

Example 23 with ConnectorDescriptor

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);
    }
}
Also used : ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor)

Example 24 with ConnectorDescriptor

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;
}
Also used : ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) ConnectorConnectionPool(com.sun.enterprise.connectors.ConnectorConnectionPool) ConnectorDescriptorInfo(com.sun.enterprise.connectors.ConnectorDescriptorInfo)

Example 25 with ConnectorDescriptor

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();
}
Also used : ConnectorDescriptor(com.sun.enterprise.deployment.ConnectorDescriptor) InboundResourceAdapter(com.sun.enterprise.deployment.InboundResourceAdapter) RarBundleContext(com.sun.enterprise.deployment.annotation.context.RarBundleContext) MessageListener(com.sun.enterprise.deployment.MessageListener) Activation(javax.resource.spi.Activation)

Aggregations

ConnectorDescriptor (com.sun.enterprise.deployment.ConnectorDescriptor)40 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)11 ConnectorConfigProperty (com.sun.enterprise.deployment.ConnectorConfigProperty)9 RarBundleContext (com.sun.enterprise.deployment.annotation.context.RarBundleContext)8 OutboundResourceAdapter (com.sun.enterprise.deployment.OutboundResourceAdapter)5 Iterator (java.util.Iterator)5 AuthMechanism (com.sun.enterprise.deployment.AuthMechanism)4 URISyntaxException (java.net.URISyntaxException)4 ConnectionDefDescriptor (com.sun.enterprise.deployment.ConnectionDefDescriptor)3 DeploymentDescriptorNode (com.sun.enterprise.deployment.node.DeploymentDescriptorNode)3 ResourcePool (com.sun.enterprise.config.serverbeans.ResourcePool)2 ActiveResourceAdapter (com.sun.enterprise.connectors.ActiveResourceAdapter)2 ConnectorDescriptorInfo (com.sun.enterprise.connectors.ConnectorDescriptorInfo)2 ConnectorRegistry (com.sun.enterprise.connectors.ConnectorRegistry)2 ConnectorRuntime (com.sun.enterprise.connectors.ConnectorRuntime)2 JmsService (com.sun.enterprise.connectors.jms.config.JmsService)2 JmsRaUtil (com.sun.enterprise.connectors.jms.util.JmsRaUtil)2 MessageListener (com.sun.enterprise.deployment.MessageListener)2 AdministeredObjectResource (com.sun.enterprise.resource.beans.AdministeredObjectResource)2 URI (java.net.URI)2