Search in sources :

Example 1 with JMSDestinationDefinitionDescriptor

use of com.sun.enterprise.deployment.JMSDestinationDefinitionDescriptor in project Payara by payara.

the class JMSDestinationDefinitionDeployer method deployResource.

public void deployResource(Object resource) throws Exception {
    final JMSDestinationDefinitionDescriptor desc = (JMSDestinationDefinitionDescriptor) resource;
    String resourceName = ConnectorsUtil.deriveResourceName(desc.getResourceId(), desc.getName(), desc.getResourceType());
    if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE, "JMSDestinationDefinitionDeployer.deployResource() : resource-name [" + resourceName + "]");
    }
    // deploy resource
    MyJMSDestinationResource jmsDestinationResource = new MyJMSDestinationResource(desc, resourceName);
    getDeployer(jmsDestinationResource).deployResource(jmsDestinationResource);
}
Also used : JMSDestinationDefinitionDescriptor(com.sun.enterprise.deployment.JMSDestinationDefinitionDescriptor)

Example 2 with JMSDestinationDefinitionDescriptor

use of com.sun.enterprise.deployment.JMSDestinationDefinitionDescriptor in project Payara by payara.

the class JMSDestinationDefinitionDeployer method undeployResource.

public void undeployResource(Object resource) throws Exception {
    final JMSDestinationDefinitionDescriptor desc = (JMSDestinationDefinitionDescriptor) resource;
    String resourceName = ConnectorsUtil.deriveResourceName(desc.getResourceId(), desc.getName(), desc.getResourceType());
    if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE, "JMSDestinationDefinitionDeployer.undeployResource() : resource-name [" + resourceName + "]");
    }
    // undeploy resource
    MyJMSDestinationResource jmsDestinationResource = new MyJMSDestinationResource(desc, resourceName);
    getDeployer(jmsDestinationResource).undeployResource(jmsDestinationResource);
}
Also used : JMSDestinationDefinitionDescriptor(com.sun.enterprise.deployment.JMSDestinationDefinitionDescriptor)

Example 3 with JMSDestinationDefinitionDescriptor

use of com.sun.enterprise.deployment.JMSDestinationDefinitionDescriptor in project Payara by payara.

the class ActiveJmsResourceAdapter method updateMDBRuntimeInfo.

/**
 * This is the most appropriate time (??) to update the runtime
 * info of a 1.3 MDB into 1.4 MDB.  <p>
 *
 * Assumptions : <p>
 * 0. Assume it is a 1.3 MDB if no RA mid is specified.
 * 1. Use the default system JMS resource adapter. <p>
 * 2. The ActivationSpec of the default JMS RA will provide the
 *    setDestination, setDestinationType, setSubscriptionName methods.
 * 3. The jndi-name of the 1.3 MDB is the value for the Destination
 *    property for the ActivationSpec.
 * 4. The ActivationSpec provides setter methods for the properties
 *    defined in the CF that corresponds to the mdb-connection-factory
 *    JNDI name.
 *
 * @param descriptor_
 * @param poolDescriptor
 * @throws com.sun.appserv.connectors.internal.api.ConnectorRuntimeException
 */
@Override
public void updateMDBRuntimeInfo(EjbMessageBeanDescriptor descriptor_, BeanPoolDescriptor poolDescriptor) throws ConnectorRuntimeException {
    String jndiName = descriptor_.getJndiName();
    if (jndiName == null || "".equals(jndiName)) {
        MessageDestinationDescriptor destDescriptor = descriptor_.getMessageDestination();
        if (destDescriptor != null)
            jndiName = destDescriptor.getJndiName();
    }
    String destinationLookup = descriptor_.getActivationConfigValue("destinationLookup");
    String destinationProp = descriptor_.getActivationConfigValue("destination");
    if (destinationLookup == null && destinationProp == null && (jndiName == null || "".equals(jndiName))) {
        if (_logger.isLoggable(Level.SEVERE)) {
            _logger.log(Level.SEVERE, JMSLoggerInfo.ERROR_IN_DD);
        }
        String msg = sm.getString("ajra.error_in_dd");
        throw new ConnectorRuntimeException(msg);
    }
    String resourceAdapterMid = ConnectorRuntime.DEFAULT_JMS_ADAPTER;
    descriptor_.setResourceAdapterMid(resourceAdapterMid);
    if (destinationLookup == null && destinationProp == null) {
        String appName = descriptor_.getApplication().getAppName();
        String moduleName = ConnectorsUtil.getModuleName(descriptor_);
        JMSDestinationDefinitionDescriptor destination = getJMSDestinationFromDescriptor(jndiName, descriptor_);
        String destName = null;
        if (isValidDestination(destination)) {
            destName = destination.getDestinationName();
        } else {
            destName = getPhysicalDestinationFromConfiguration(jndiName, appName, moduleName);
        }
        // 1.3 jndi-name ==> 1.4 setDestination
        descriptor_.putRuntimeActivationConfigProperty(new EnvironmentProperty(DESTINATION, destName, null));
        // XXX Do we really need this???
        if (descriptor_.getDestinationType() != null && !"".equals(descriptor_.getDestinationType())) {
            descriptor_.putRuntimeActivationConfigProperty(new EnvironmentProperty(DESTINATION_TYPE, descriptor_.getDestinationType(), null));
            if (_logger.isLoggable(Level.INFO)) {
                _logger.log(Level.INFO, JMSLoggerInfo.ENDPOINT_DEST_NAME, new Object[] { descriptor_.getDestinationType(), jndiName, descriptor_.getName() });
            }
        } else if (isValidDestination(destination) && ConnectorConstants.DEFAULT_JMS_ADAPTER.equals(destination.getResourceAdapter())) {
            descriptor_.putRuntimeActivationConfigProperty(new EnvironmentProperty(DESTINATION_TYPE, destination.getInterfaceName(), null));
            if (_logger.isLoggable(Level.INFO)) {
                _logger.log(Level.INFO, JMSLoggerInfo.ENDPOINT_DEST_NAME, new Object[] { destination.getInterfaceName(), destination.getName(), descriptor_.getName() });
            }
        } else {
            /*
                 * If destination type is not provided by the MDB component
                 * [typically used by EJB3.0 styled MDBs which create MDBs without
                 * a destination type activation-config property] and the MDB is for
                 * the default JMS RA, attempt to infer the destination type by trying
                 * to find out if there has been any JMS destination resource already
                 * defined for default JMS RA. This is a best attempt guess and if there
                 * are no JMS destination resources/admin-objects defined, AS would pass
                 * the properties as defined by the MDB.
                 */
            try {
                AdminObjectResource aor = (AdminObjectResource) ResourcesUtil.createInstance().getResource(jndiName, appName, moduleName, AdminObjectResource.class);
                if (aor != null && ConnectorConstants.DEFAULT_JMS_ADAPTER.equals(aor.getResAdapter())) {
                    descriptor_.putRuntimeActivationConfigProperty(new EnvironmentProperty(DESTINATION_TYPE, aor.getResType(), null));
                    if (_logger.isLoggable(Level.INFO)) {
                        _logger.log(Level.INFO, JMSLoggerInfo.ENDPOINT_DEST_NAME, new Object[] { aor.getResType(), aor.getJndiName(), descriptor_.getName() });
                    }
                }
            } catch (Exception e) {
            }
        }
    }
    // 1.3 durable-subscription-name == 1.4 setSubscriptionName
    descriptor_.putRuntimeActivationConfigProperty(new EnvironmentProperty(SUBSCRIPTION_NAME, descriptor_.getDurableSubscriptionName(), null));
    String mdbCF = null;
    try {
        mdbCF = descriptor_.getMdbConnectionFactoryJndiName();
    } catch (NullPointerException ne) {
    // Dont process connection factory.
    }
    if (mdbCF != null && !"".equals(mdbCF)) {
        setValuesFromConfiguration(mdbCF, descriptor_);
    }
    if (poolDescriptor != null) {
        descriptor_.putRuntimeActivationConfigProperty(new EnvironmentProperty(MAXPOOLSIZE, "" + poolDescriptor.getMaxPoolSize(), "", "java.lang.Integer"));
        descriptor_.putRuntimeActivationConfigProperty(new EnvironmentProperty(MINPOOLSIZE, "" + poolDescriptor.getSteadyPoolSize(), "", "java.lang.Integer"));
        descriptor_.putRuntimeActivationConfigProperty(new EnvironmentProperty(RESIZECOUNT, "" + poolDescriptor.getPoolResizeQuantity(), "", "java.lang.Integer"));
        descriptor_.putRuntimeActivationConfigProperty(new EnvironmentProperty(RESIZETIMEOUT, "" + poolDescriptor.getPoolIdleTimeoutInSeconds(), "", "java.lang.Integer"));
        /**
         * The runtime activation config property holds all the
         * vendor specific properties, unfortunately the vendor
         * specific way of configuring exception count and the
         * standard way of configuring redelivery attempts is
         * through the same property REDELIVERYCOUNT . So, we first
         * check if the user (MDB assember) has configured a value
         * if not we set the one from mdb-container props
         * We have to check for both cases here because it has been
         * documented as "endpointExceptionRedeliveryAttempts" but
         * used in the code as "EndpointExceptionRedeliveryAttempts"
         */
        if ((descriptor_.getActivationConfigValue(REDELIVERYCOUNT) == null) && (descriptor_.getActivationConfigValue(LOWERCASE_REDELIVERYCOUNT) == null)) {
            descriptor_.putRuntimeActivationConfigProperty(new EnvironmentProperty(REDELIVERYCOUNT, "" + MdbContainerProps.getMaxRuntimeExceptions(), "", "java.lang.Integer"));
        }
    }
    // Set SE/EE specific MQ-RA ActivationSpec properties
    try {
        boolean clustered = isClustered();
        if (_logger.isLoggable(Level.FINE))
            logFine("Are we in a Clustered contained ? " + clustered);
        if (clustered)
            setClusterActivationSpecProperties(descriptor_);
    } catch (Exception e) {
        ConnectorRuntimeException crex = new ConnectorRuntimeException(e.getMessage());
        throw (ConnectorRuntimeException) crex.initCause(e);
    }
}
Also used : ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException) MessageDestinationDescriptor(com.sun.enterprise.deployment.MessageDestinationDescriptor) JMSDestinationDefinitionDescriptor(com.sun.enterprise.deployment.JMSDestinationDefinitionDescriptor) EnvironmentProperty(com.sun.enterprise.deployment.EnvironmentProperty) AdminObjectResource(org.glassfish.connectors.config.AdminObjectResource) MultiException(org.glassfish.hk2.api.MultiException) PrivilegedActionException(java.security.PrivilegedActionException) ExecutionException(java.util.concurrent.ExecutionException) ResourceAdapterInternalException(javax.resource.spi.ResourceAdapterInternalException) URISyntaxException(java.net.URISyntaxException) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Example 4 with JMSDestinationDefinitionDescriptor

use of com.sun.enterprise.deployment.JMSDestinationDefinitionDescriptor in project Payara by payara.

the class ActiveJmsResourceAdapter method getJMSDestination.

/*
     * Get JMS destination resource from web module
     */
private JMSDestinationDefinitionDescriptor getJMSDestination(String logicalDestination, ModuleDescriptor moduleDescriptor) {
    WebBundleDescriptor webBundleDescriptor = (WebBundleDescriptor) moduleDescriptor.getDescriptor();
    JMSDestinationDefinitionDescriptor destination = getJMSDestination(logicalDestination, webBundleDescriptor.getResourceDescriptors(JavaEEResourceType.JMSDD));
    if (isValidDestination(destination)) {
        return destination;
    }
    Collection<EjbBundleDescriptor> ejbBundleDescriptors = moduleDescriptor.getDescriptor().getExtensionsDescriptors(EjbBundleDescriptor.class);
    for (EjbBundleDescriptor ejbBundleDescriptor : ejbBundleDescriptors) {
        destination = getJMSDestination(logicalDestination, ejbBundleDescriptor);
        if (isValidDestination(destination)) {
            return destination;
        }
    }
    return null;
}
Also used : JMSDestinationDefinitionDescriptor(com.sun.enterprise.deployment.JMSDestinationDefinitionDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor)

Example 5 with JMSDestinationDefinitionDescriptor

use of com.sun.enterprise.deployment.JMSDestinationDefinitionDescriptor in project Payara by payara.

the class ActiveJmsResourceAdapter method getJMSDestination.

/*
     * Get JMS destination resource from application
     */
private JMSDestinationDefinitionDescriptor getJMSDestination(String logicalDestination, Application application) {
    if (application == null) {
        return null;
    }
    JMSDestinationDefinitionDescriptor destination = getJMSDestination(logicalDestination, application.getResourceDescriptors(JavaEEResourceType.JMSDD));
    if (isValidDestination(destination)) {
        return destination;
    }
    Set<WebBundleDescriptor> webBundleDescriptors = application.getBundleDescriptors(WebBundleDescriptor.class);
    for (WebBundleDescriptor webBundleDescriptor : webBundleDescriptors) {
        destination = getJMSDestination(logicalDestination, webBundleDescriptor.getResourceDescriptors(JavaEEResourceType.JMSDD));
        if (isValidDestination(destination)) {
            return destination;
        }
    }
    Set<EjbBundleDescriptor> ejbBundleDescriptors = application.getBundleDescriptors(EjbBundleDescriptor.class);
    for (EjbBundleDescriptor ejbBundleDescriptor : ejbBundleDescriptors) {
        destination = getJMSDestination(logicalDestination, ejbBundleDescriptor);
        if (isValidDestination(destination)) {
            return destination;
        }
    }
    Set<ApplicationClientDescriptor> appClientDescriptors = application.getBundleDescriptors(ApplicationClientDescriptor.class);
    for (ApplicationClientDescriptor appClientDescriptor : appClientDescriptors) {
        destination = getJMSDestination(logicalDestination, appClientDescriptor.getResourceDescriptors(JavaEEResourceType.JMSDD));
        if (isValidDestination(destination)) {
            return destination;
        }
    }
    return null;
}
Also used : JMSDestinationDefinitionDescriptor(com.sun.enterprise.deployment.JMSDestinationDefinitionDescriptor) EjbBundleDescriptor(com.sun.enterprise.deployment.EjbBundleDescriptor) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) ApplicationClientDescriptor(com.sun.enterprise.deployment.ApplicationClientDescriptor)

Aggregations

JMSDestinationDefinitionDescriptor (com.sun.enterprise.deployment.JMSDestinationDefinitionDescriptor)7 EjbBundleDescriptor (com.sun.enterprise.deployment.EjbBundleDescriptor)2 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)2 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)1 Applications (com.sun.enterprise.config.serverbeans.Applications)1 Domain (com.sun.enterprise.config.serverbeans.Domain)1 Application (com.sun.enterprise.deployment.Application)1 ApplicationClientDescriptor (com.sun.enterprise.deployment.ApplicationClientDescriptor)1 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)1 EnvironmentProperty (com.sun.enterprise.deployment.EnvironmentProperty)1 MessageDestinationDescriptor (com.sun.enterprise.deployment.MessageDestinationDescriptor)1 URISyntaxException (java.net.URISyntaxException)1 PrivilegedActionException (java.security.PrivilegedActionException)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 ExecutionException (java.util.concurrent.ExecutionException)1 ResourceAdapterInternalException (javax.resource.spi.ResourceAdapterInternalException)1 AdminObjectResource (org.glassfish.connectors.config.AdminObjectResource)1 MultiException (org.glassfish.hk2.api.MultiException)1 ApplicationInfo (org.glassfish.internal.data.ApplicationInfo)1