Package com.sun.enterprise.connectors

Examples of com.sun.enterprise.connectors.ConnectorRuntime


        // loads dependent jdbc connection pool if not loaded
        loadPool(jdbcRes);

      ManagementObjectManager mgr = Switch.getSwitch().getManagementObjectManager();
      mgr.registerJDBCResource( jndiName );
      ConnectorRuntime runtime = ConnectorRuntime.getRuntime();
      runtime.createConnectorResource( jndiName, poolName, null);
      runtime.createConnectorResource( getPMJndiName( jndiName),
              poolName, null);
      _logger.finest("deployed resource " + jndiName );     
        } else {
            _logger.log(Level.INFO, "core.resource_disabled",
                new Object[] {jdbcRes.getJndiName(),
View Full Code Here


            (com.sun.enterprise.config.serverbeans.JdbcResource) resource;
       
  String jndiName = jdbcRes.getJndiName();
  String pmJndiName = getPMJndiName( jdbcRes.getJndiName() );

  ConnectorRuntime runtime = ConnectorRuntime.getRuntime();
  runtime.deleteConnectorResource( jndiName );
  runtime.deleteConnectorResource( pmJndiName );
 
        ManagementObjectManager mgr =
                Switch.getSwitch().getManagementObjectManager();
        mgr.unregisterJDBCResource( jndiName );
View Full Code Here

    public synchronized void deployResource(Object resource) throws Exception {

        ResourceAdapterConfig domainConfig =
            (com.sun.enterprise.config.serverbeans.ResourceAdapterConfig)resource;
        String rarName = domainConfig.getResourceAdapterName();
        ConnectorRuntime crt = ConnectorRuntime.getRuntime();
        _logger.log(Level.FINE,
                   "Calling backend to add resource adapterConfig ",rarName);
        crt.addResourceAdapterConfig(rarName,domainConfig);
        _logger.log(Level.FINE,
                   "Added resource adapterConfig in backend",rarName);
    }
View Full Code Here

    public synchronized void undeployResource(Object resource)
                  throws Exception {
        ResourceAdapterConfig domainConfig =
            (com.sun.enterprise.config.serverbeans.ResourceAdapterConfig)resource;
        String rarName = domainConfig.getResourceAdapterName();
        ConnectorRuntime crt = ConnectorRuntime.getRuntime();
        crt.deleteResourceAdapterConfig(rarName);
    }
View Full Code Here

        }catch(ConfigException cex){
            _logger.log(Level.INFO,"jdbc.config_error",cex);
           
        }

        ConnectorRuntime crt = ConnectorRuntime.getRuntime();

        //for(int i=0; i<jdbcConnectionPools.length; ++i) {
  Iterator iter = jdbcPools.iterator();
  while( iter.hasNext() ) {
      com.sun.enterprise.config.serverbeans.JdbcConnectionPool
          jdbcConnectionPool = (com.sun.enterprise.config.serverbeans.JdbcConnectionPool)
    iter.next();
            if(jdbcConnectionPool.getResType()==null
                || jdbcConnectionPool.getName()==null
                || !jdbcConnectionPool.getResType().equals(
                          "javax.sql.XADataSource")) {
                continue;
            }
            String poolName = jdbcConnectionPool.getName();
            try {
               
                String[] dbUserPassword =
                      resourceUtil.getdbUserPasswordOfJdbcConnectionPool(
                      jdbcConnectionPool);
                String dbUser = dbUserPassword[0];
                String dbPassword = dbUserPassword[1];
                ManagedConnectionFactory fac =
                      crt.obtainManagedConnectionFactory(poolName);
                Subject subject = new Subject();
                PasswordCredential pc = new PasswordCredential(
                      dbUser, dbPassword.toCharArray());
                pc.setManagedConnectionFactory(fac);
                Principal prin = new ResourcePrincipal(dbUser, dbPassword);
View Full Code Here

  }
  loadAllConnectorResources();
  Iterator iter = connPools.iterator();
 
  _logger.log(Level.FINE,"Recovering pools : " + connPools.size());
        ConnectorRuntime crt = ConnectorRuntime.getRuntime();
        //for(int i = 0; i<connectorConnectionPools.length;++i) {
  while( iter.hasNext() ) {
      com.sun.enterprise.config.serverbeans.ConnectorConnectionPool
          connPool = (com.sun.enterprise.config.serverbeans.ConnectorConnectionPool)
          iter.next();
            String poolName = connPool.getName();
            try {
                String[] dbUserPassword =
                       resourceUtil.getdbUserPasswordOfConnectorConnectionPool(
                       connPool);
    if ( dbUserPassword == null ) {
        continue;
    }
                String dbUser = dbUserPassword[0];
                String dbPassword = dbUserPassword[1];
                Subject subject = new Subject();
               
                //If username or password of the connector connection pool
                //is null a warning is logged and recovery continues with
                //empty String username or password as the case may be,
                //because some databases allow null[as in empty string]
                //username [pointbase interprets this as "root"]/password.
                if(dbPassword==null) {
                    dbPassword = "";
                    _logger.log(Level.WARNING,
                        "datasource.xadatasource_nullpassword_error",poolName);
                }
               
    if(dbUser == null){
                    dbUser = "";
                    _logger.log(Level.WARNING,
                       "datasource.xadatasource_nulluser_error",poolName);
    }
          String rarName = connPool.getResourceAdapterName()
     if (ConnectorAdminServiceUtils.isJMSRA(rarName)) {
          _logger.log(Level.FINE,"Performing recovery for JMS RA, poolName  " + poolName);
                    ManagedConnectionFactory[] mcfs =
                       crt.obtainManagedConnectionFactories(poolName);
        _logger.log (Level.INFO, "JMS resource recovery has created CFs = " + mcfs.length);
          for (int i = 0; i<mcfs.length;i++) {
                  PasswordCredential pc = new PasswordCredential(
                           dbUser, dbPassword.toCharArray());
                        pc.setManagedConnectionFactory(mcfs[i]);
                      Principal prin =
        new ResourcePrincipal(dbUser, dbPassword);
                      subject.getPrincipals().add(prin);
                      subject.getPrivateCredentials().add(pc);
          ManagedConnection mc = mcfs[i].
        createManagedConnection(subject, null)
                        connList.addElement(mc);
                      try {
                                XAResource xares = mc.getXAResource();
                          if (xares != null) {
                             xaresList.addElement(xares);
                           }
                      } catch (ResourceException ex) {
                        // ignored. Not at XA_TRANSACTION level
                      }
        }     

    } else {
                    ManagedConnectionFactory mcf =
                       crt.obtainManagedConnectionFactory(poolName);
                    PasswordCredential pc = new PasswordCredential(
                       dbUser, dbPassword.toCharArray());
                    pc.setManagedConnectionFactory(mcf);
                    Principal prin = new ResourcePrincipal(dbUser, dbPassword);
                    subject.getPrincipals().add(prin);
View Full Code Here

      if (xaEnabledMDBList.size() == 0) {
      _logger.log(Level.FINE, "Found no CMT MDBs in all applications");
      return;
    }
     
      ConnectorRuntime cr = ConnectorRuntime.getRuntime();
      ConnectorRegistry creg = ConnectorRegistry.getInstance();

         //@TODO : Check whether this call is needed
        ClassLoader cl = ConnectorClassLoader.getInstance();

      // for each RA (key in the hashtable) get the list (value) of MDB Descriptors
      Hashtable mappings = createRAEjbMapping(xaEnabledMDBList);
      // To iterate through the keys(ramid), get the key Set from Hashtable.
      Set raMidSet = mappings.keySet();
     
      Iterator iter = raMidSet.iterator();
     
        //For each RA
      while (iter.hasNext()){
       
        String raMid = (String)iter.next();
                ArrayList respectiveDesc = (ArrayList)mappings.get(raMid);
               
                try{
                    createActiveResourceAdapter(raMid);
                } catch(Exception ex) {
                    _logger.log(Level.SEVERE,"error.loading.connector.resources.during.recovery", raMid);
                    if (_logger.isLoggable(Level.FINE)) {
                        _logger.log( Level.FINE, ex.toString() , ex);
                    }
                }
               
                ActiveInboundResourceAdapter activeInboundRA = (ActiveInboundResourceAdapter) creg
                        .getActiveResourceAdapter(raMid);
               
                assert activeInboundRA instanceof ActiveInboundResourceAdapter;
               
                boolean isSystemJmsRA = false;
                if (activeInboundRA instanceof ActiveJmsResourceAdapter) {
                    isSystemJmsRA = true;
                }
               
                javax.resource.spi.ResourceAdapter resourceAdapter = activeInboundRA
                        .getResourceAdapter();
                // activationSpecList represents the ActivationSpec[] that would be
                // sent to the getXAResources() method.
                ArrayList activationSpecList = new ArrayList();
       
        try{
          for (int i=0; i<respectiveDesc.size(); i++){
            try{
            // Get a MessageBeanDescriptor from respectiveDesc ArrayList
            EjbMessageBeanDescriptor descriptor =
              (EjbMessageBeanDescriptor)respectiveDesc.get(i);
                        // A descriptor using 1.3 System JMS RA style properties needs
                        // to be updated J2EE 1.4 style props.
                        if (isSystemJmsRA) {
                             //XXX: Find out the pool descriptor corres to MDB and update
                             //MDBRuntimeInfo with that.
                             ((ActiveJmsResourceAdapter) activeInboundRA)
                                                            .updateMDBRuntimeInfo(descriptor, null);
                        }
             
            // Get the ActivationConfig Properties from the MDB Descriptor
            Set activationConfigProps =
              RARUtils.getMergedActivationConfigProperties(descriptor);
            // get message listener type
            String msgListenerType = descriptor.getMessageListenerType();
           
            // start resource adapter and get ActivationSpec class for
            // the given message listener type from the ConnectorRuntime

                        ActivationSpec aspec = (ActivationSpec) (Class.forName(
                                                       cr.getActivationSpecClass(raMid,
                                                       msgListenerType), false,
                                                       resourceAdapter.getClass().getClassLoader()).newInstance());
                        aspec.setResourceAdapter(resourceAdapter);
           
            // Populate ActivationSpec class with ActivationConfig properties
View Full Code Here

   
    }

     private void createActiveResourceAdapter(String rarModuleName) throws ConfigException, ConnectorRuntimeException {
        
         ConnectorRuntime cr = ConnectorRuntime.getRuntime();
         ResourcesUtil resutil = ResourcesUtil.createInstance();
         ConnectorRegistry creg = ConnectorRegistry.getInstance();
        
         if(creg.isRegistered(rarModuleName))
             return;
        
         // If RA is embedded RA, find location of exploded rar.
         if (ConnectorAdminServiceUtils.isEmbeddedConnectorModule(rarModuleName)) {
             String appName = ConnectorAdminServiceUtils .getApplicationName(rarModuleName);
             String rarFileName = ConnectorAdminServiceUtils
                     .getConnectorModuleName(rarModuleName)+".rar";
             ConnectorDescriptor cd = resutil.getConnectorDescriptorFromUri(appName, rarFileName);
             String loc = resutil.getApplicationDeployLocation(appName);
             loc = loc + File.separator + FileUtils.makeFriendlyFilename(rarFileName);
            
             // start RA
             cr.createActiveResourceAdapter(cd,rarModuleName, loc);
            
             // else if RA is not embedded, it is already present in the
             // ConnectorRegistry. Start it straight away.
         } else {
             cr.createActiveResourceAdapter(resutil.getLocation(rarModuleName), rarModuleName);
         }
     }
View Full Code Here

      addPool( pool );
      //--Monitoring
      //create Stats object for this pool and add it to the stats
      //registry
      try {
          ConnectorRuntime runtime = ConnectorRuntime.getRuntime();
          if ( runtime.getEnviron() == ConnectorConstants.SERVER ) {
            if (isJdbcPool( poolName ) ) {
                enableJDBCPoolMonitoring(pool, poolName);
            } else {
                enableConnectorConnectionPoolMonitoring(pool, poolName);
            }
View Full Code Here

        if (listener != null)
            listener.poolDestroyed(poolName);
           
      //--Monitoring
      try {
          ConnectorRuntime runtime = ConnectorRuntime.getRuntime();
         
          if ( runtime.getEnviron() == ConnectorConstants.SERVER ) {
              final String fPoolName = poolName;
              if (isJdbcPool( fPoolName )) {
                  disableJDBCPoolMonitoring(fPoolName);
              } else {
                  disableConnectorConnectionPoolMonitoring(fPoolName);
View Full Code Here

TOP

Related Classes of com.sun.enterprise.connectors.ConnectorRuntime

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.