Package javax.resource.spi

Examples of javax.resource.spi.ResourceAdapter


        ConnectorDescriptor cd, String moduleName, ClassLoader loader)
        throws ConnectorRuntimeException{

        ActiveResourceAdapter activeResourceAdapter = null;
        int environment = ConnectorRuntime.getRuntime().getEnviron();
        ResourceAdapter ra = null;
        String raClass = cd.getResourceAdapterClass();

        try {

            // If raClass is available, load it...
View Full Code Here


                        activeRA = ConnectorRegistry.getInstance().
                                getActiveResourceAdapter(resourceAdapterName);
                    }

                    //Associate RAR
                    ResourceAdapter raInstance =
                            ((ActiveInboundResourceAdapter) (activeRA)).getResourceAdapter();
                    if (loadedInstance instanceof ResourceAdapterAssociation) {
                        ((ResourceAdapterAssociation) loadedInstance).
                                setResourceAdapter(raInstance);
                    }
View Full Code Here

     */
    private static MQJMXConnectorInfo _getMQJMXConnectorInfoForCluster(
                    String target, JmsService jmsService, Class mqRAClassName)
                    throws ConnectorRuntimeException {
        // Create a new RA instance.
        ResourceAdapter raInstance = null;
        // Set the ConnectionURL.
        try {
            MQAddressList list = null;

            if (jmsService.getType().equalsIgnoreCase(ActiveJmsResourceAdapter.REMOTE)) {
                list = getDefaultAddressList(jmsService);
            } else {
                String domainurl  =
                    ApplicationServer.getServerContext().getServerConfigURL();
                AppserverClusterViewFromCacheRepository rep
                    = new AppserverClusterViewFromCacheRepository(domainurl);

                java.util.Map<String,JmsHost> hostMap =
                    rep.getResolvedLocalJmsHostsInCluster(target);

                if ( hostMap.size() == 0 ) {
                    String msg = sm.getString("mqjmx.no_jms_hosts");
                    throw new ConnectorRuntimeException(msg);
                }
               
                list = new MQAddressList();
                for (JmsHost host : hostMap.values()) {
                    list.addMQUrl(host);
                }
            }

            String connectionUrl = list.toString();
            String adminUserName = null;
       String adminPassword = null;
       JmsHost jmsHost = getDefaultJmsHost(jmsService);
       if (jmsHost != null && jmsHost.isEnabled()) {
           adminUserName = jmsHost.getAdminUserName();
           adminPassword = jmsHost.getAdminPassword();
       } else {
           logFine(" _getMQJMXConnectorInfo, using default jms admin user and password ");
       }
        raInstance = getConfiguredRA(mqRAClassName, connectionUrl,
                                    adminUserName, adminPassword);
        } catch (Exception e) {
            e.printStackTrace();
            ConnectorRuntimeException cre = new ConnectorRuntimeException(e.getMessage());
            cre.initCause(e);
            throw cre;
        }
       
        try {
            String jmxServiceURL = null, jmxServiceURLList = null;
            Map<String, ?> jmxConnectorEnv = null;
            Method[] methds = raInstance.getClass().getMethods();
            for (int i = 0; i < methds.length; i++) {
                Method m = methds[i];
                if (m.getName().equalsIgnoreCase("get" + JMXSERVICEURLLIST)){
                    jmxServiceURLList = (String)m.invoke(raInstance, new Object[]{});
                    if (jmxServiceURLList != null && !jmxServiceURLList.trim().equals("")){
View Full Code Here

           adminUserName = jmsHost.getAdminUserName();
           adminPassword = jmsHost.getAdminPassword();
       } else {
           logFine(" _getMQJMXConnectorInfo, using default jms admin user and password ");
       }
       ResourceAdapter raInstance = getConfiguredRA(mqRAClassName,
                   connectionURL, adminUserName, adminPassword);
            String jmxServiceURL = null, jmxServiceURLList = null;
            Map<String, ?> jmxConnectorEnv = null;
            Method[] methds = raInstance.getClass().getMethods();
            for (int i = 0; i < methds.length; i++) {
                Method m = methds[i];
    if (m.getName().equalsIgnoreCase("get" + JMXSERVICEURLLIST)){
                    jmxServiceURLList = (String)m.invoke(raInstance, new Object[]{});
                } else if (m.getName().equalsIgnoreCase("get" + JMXCONNECTORENV)){
View Full Code Here

     *  This configured RA is then used to obtain the JMXServiceURL/JMXServiceURLList
     */
    private static ResourceAdapter getConfiguredRA(Class mqRAclassname,
                                        String connectionURL, String adminuser,
                                        String adminpasswd) throws Exception {
        ResourceAdapter raInstance = (ResourceAdapter) mqRAclassname.newInstance();
        Method setConnectionURL = mqRAclassname.getMethod(
                       "set" + ActiveJmsResourceAdapter.CONNECTION_URL,
                        new Class[] { String.class});
        setConnectionURL.invoke(raInstance, new Object[] {connectionURL});
        logFine(" getConfiguredRA - set connectionURL as " + connectionURL);
View Full Code Here

                    adminUserName = jmsHost.getAdminUserName();
                    adminPassword = JmsRaUtil.getUnAliasedPwd(jmsHost.getAdminPassword());
                } else {
                    logger.log(Level.FINE, " _getMQJMXConnectorInfo, using default jms admin user and password ");
                }
                ResourceAdapter raInstance = getConfiguredRA(mqRAClassName,
                            connectionURL, adminUserName, adminPassword);
                   String jmxServiceURL = null, jmxServiceURLList = null;
                   Map<String, ?> jmxConnectorEnv = null;
                   Method[] methds = raInstance.getClass().getMethods();
                   for (int i = 0; i < methds.length; i++) {
                       Method m = methds[i];
               if (m.getName().equalsIgnoreCase("get" + JMXSERVICEURLLIST)){
                           jmxServiceURLList = (String)m.invoke(raInstance, new Object[]{});
                       } else if (m.getName().equalsIgnoreCase("get" + JMXCONNECTORENV)){
View Full Code Here

          */
         protected  MQJMXConnectorInfo _getMQJMXConnectorInfoForCluster(
                         String target, JmsService jmsService, Class mqRAClassName, ServerContext serverContext)
                         throws ConnectorRuntimeException {
            // Create a new RA instance.
             ResourceAdapter raInstance = null;
             // Set the ConnectionURL
            MQAddressList list = null;
             try {
                 if (jmsService.getType().equalsIgnoreCase(ActiveJmsResourceAdapter.REMOTE)) {
                     list = getDefaultAddressList(jmsService);
                 } else {
                     list = new MQAddressList();
                     CommandTarget ctarget = this.getTypeForTarget(target);
                     if (ctarget == CommandTarget.CLUSTER)
                     {
                         Server[] servers = list.getServersInCluster(target);
                         if (servers != null && servers.length > 0)
                            list.setInstanceName(servers[0].getName());
                     } else if (ctarget == CommandTarget.CLUSTERED_INSTANCE ){
                         list.setInstanceName(target);
                     }
                     java.util.Map<String,JmsHost> hostMap =  list.getResolvedLocalJmsHostsInMyCluster(true);

                     if ( hostMap.size() == 0 ) {
                         String msg = localStrings.getLocalString("mqjmx.no_jms_hosts", "No JMS Hosts Configured");
                         throw new ConnectorRuntimeException(msg);

                     }


                     for (JmsHost host : hostMap.values()) {
                         list.addMQUrl(host);
                     }
                 }

              String connectionUrl = list.toString();
              String adminUserName = null;
              String adminPassword = null;
              JmsHost jmsHost = list.getDefaultJmsHost(jmsService);
              if (jmsHost != null){// && jmsHost.isEnabled()) {
                  adminUserName = jmsHost.getAdminUserName();
                  adminPassword = JmsRaUtil.getUnAliasedPwd(jmsHost.getAdminPassword());
              } else {
                  logger.log(Level.FINE, " _getMQJMXConnectorInfo, using default jms admin user and password ");
              }
               raInstance = getConfiguredRA(mqRAClassName, connectionUrl,
                                           adminUserName, adminPassword);
             } catch (Exception e) {
                 e.printStackTrace();
                 ConnectorRuntimeException cre = new ConnectorRuntimeException(e.getMessage());
                 cre.initCause(e);
                 throw cre;
             }

             try {
                 String jmxServiceURL = null, jmxServiceURLList = null;
                 Map<String, ?> jmxConnectorEnv = null;
                 Method[] methds = raInstance.getClass().getMethods();
                 for (int i = 0; i < methds.length; i++) {
                     Method m = methds[i];
                     if (m.getName().equalsIgnoreCase("get" + JMXSERVICEURLLIST)){
                         jmxServiceURLList = (String)m.invoke(raInstance, new Object[]{});
                         if (jmxServiceURLList != null && !jmxServiceURLList.trim().equals("")){
View Full Code Here

         *  This configured RA is then used to obtain the JMXServiceURL/JMXServiceURLList
         */
        protected ResourceAdapter getConfiguredRA(Class mqRAclassname,
                                                  String connectionURL, String adminuser,
                                                  String adminpasswd) throws Exception {
            ResourceAdapter raInstance = (ResourceAdapter) mqRAclassname.newInstance();
            Method setConnectionURL = mqRAclassname.getMethod(
                           "set" + ActiveJmsResourceAdapter.CONNECTION_URL,
                            new Class[] { String.class});
            setConnectionURL.invoke(raInstance, new Object[] {connectionURL});
            logger.log(Level.FINE, " getConfiguredRA - set connectionURL as " + connectionURL);
View Full Code Here

        aira.updateMDBRuntimeInfo(descriptor_,
                                       messageBeanPM_.getPoolDescriptor());

        //the resource adapter this MDB client is deployed to
        ResourceAdapter ra = aira.getResourceAdapter();

        if(ra == null){
            String i18nMsg = localStrings.getString("msg-bean-client.ra.class.not.specified", resourceAdapterMid);
            throw new ConnectorRuntimeException(i18nMsg);
        }

        ConnectorDescriptor desc = aira.getDescriptor();

        MessageListener msgListener = getMessageListener(desc);

        String activationSpecClassName = null;
        if (msgListener != null) {
            activationSpecClassName = msgListener.getActivationSpecClass();
        }

        if (activationSpecClassName != null) {
            if (logger.isLoggable(Level.FINEST)) {
                String msg = "ActivationSpecClassName = " + activationSpecClassName;
                logger.log(Level.FINEST, msg);
            }

            try {
                ActivationSpec activationSpec = getActivationSpec(aira, activationSpecClassName);
                activationSpec.setResourceAdapter(ra);

                //at this stage, activation-spec is created, config properties merged with ejb-descriptor.
                //validate activation-spec now
                ConnectorRuntime runtime = ConnectorRuntime.getRuntime();
                runtime.getConnectorBeanValidator().validateJavaBean(activationSpec, resourceAdapterMid);

                aira.validateActivationSpec(activationSpec);

                myState = BLOCKED;

                ra.endpointActivation(this, activationSpec);

                aira.addEndpointFactoryInfo(beanID_,
                        new MessageEndpointFactoryInfo(this, activationSpec));

            } catch (Exception ex) {
View Full Code Here

    public void afterPropertiesSet() throws Exception {
        if (activationSpec == null) {
            throw new IllegalArgumentException("activationSpec must be set");
        }

        ResourceAdapter temp = activationSpec.getResourceAdapter();
        if (temp == null && resourceAdapter != null) {
            activationSpec.setResourceAdapter(resourceAdapter);
        }
        else if (resourceAdapter == null) {
            resourceAdapter = activationSpec.getResourceAdapter();
View Full Code Here

TOP

Related Classes of javax.resource.spi.ResourceAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.