Package com.sun.enterprise.connectors.util

Examples of com.sun.enterprise.connectors.util.ResourcesUtil


    }

     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


        ConfigBean cb = resources.getConnectorConnectionPoolByName(poolName);
        com.sun.enterprise.config.serverbeans.ConnectorConnectionPool cp =
          (com.sun.enterprise.config.serverbeans.ConnectorConnectionPool)cb;

        if(cp != null){
            ResourcesUtil util = ResourcesUtil.createInstance();
            String raName = cp.getResourceAdapterName();
            if(util.belongToEmbeddedRar(raName)){
                if(ConnectorRegistry.getInstance().getDescriptor(raName) == null){
                    //connector descriptor for embedded rar can't be null during resource-deploy, as embedded rars are loaded
                    //during startup / deployment itself
                    result = false;
                }
View Full Code Here

   
    private void enableConnectorConnectionPoolMonitoring(ResourcePool pool,
        final String poolName) {
       
        MonitorableResourcePool mrp = null;
        final ResourcesUtil resUtil = ResourcesUtil.createInstance();
       
        if ( pool instanceof MonitorableResourcePool ) {
            mrp = (MonitorableResourcePool)pool;
        } else {
            return;
        }
       
        final com.sun.enterprise.config.serverbeans.ConnectorConnectionPool ccp =
                resUtil.getConnectorConnectionPoolByName(poolName);
       
        //this is a connector connection pool
        //check if monitoring level is ON and only then do
        //registration
        if (getConnectorPoolMonitoringLevel() != MonitoringLevel.OFF ) {
            final ConnectorConnectionPoolStatsImpl ccpStatsImpl =
          new ConnectorConnectionPoolStatsImpl(mrp );

            if (getConnectorPoolMonitoringLevel() == MonitoringLevel.HIGH ) {
                setMonitoringEnabledHigh( poolName );
            }
            if (getConnectorPoolMonitoringLevel() == MonitoringLevel.LOW ) {
                setMonitoringEnabledLow(poolName );
            }

            AccessController.doPrivileged( new PrivilegedAction() {
                public Object run() {
                    try {
                        monitoringRegistry_.registerConnectorConnectionPoolStats(
          ccpStatsImpl,
                                poolName,
                                resUtil.getAppName(ccp),
                                resUtil.getRAName(ccp),
                                null);
                    } catch( Exception mre ) {
                        _logger.log( Level.INFO, "poolmon.cannot_reg",
          (mre.getMessage() != null ? mre.getMessage() : " ") );
                        _logger.fine("Error while enabling Connector Pool monitoring for pool "
View Full Code Here

      }
      //--Monitoring End
    }

    private void disableConnectorConnectionPoolMonitoring(final String fPoolName) {
        final ResourcesUtil resUtil = ResourcesUtil.createInstance();
        final com.sun.enterprise.config.serverbeans.ConnectorConnectionPool ccp =
                resUtil.getConnectorConnectionPoolByName(fPoolName);
        if (getConnectorPoolMonitoringLevel() != MonitoringLevel.OFF ) {
            AccessController.doPrivileged( new PrivilegedAction() {
                public Object run() {
                    try {   
                        monitoringRegistry_.unregisterConnectorConnectionPoolStats(
                                fPoolName,
                                resUtil.getAppName(ccp),
                                resUtil.getRAName(ccp) );
                    } catch( Exception mre) {
                        _logger.log( Level.INFO, "poolmon.cannot_unreg",
                            mre.getMessage() );
                    }
                    return null;
View Full Code Here

        for(int j = 0; j<configbeanArray.length; ++j) {
            if(configbeanArray[j] == null || configbeanArray[j].length == 0) {
                continue;
            }
            ConfigBean[] configBeanSet = configbeanArray[j];
            ResourcesUtil resourceUtil = ResourcesUtil.createInstance();
            String resourceType = resourceUtil.getResourceType(
                         configBeanSet[0]);
            if(resourceType == null) {
                _logger.log(Level.SEVERE,"core.no_resource_type" );
                continue;
            }
            ResourceDeployer deployer = null;
            try {
                deployer = factory_.getResourceDeployer(resourceType);
            } catch(Exception ex) {
                _logger.log(Level.SEVERE,
                          "core.no_resource_deployer",resourceType );
                _logger.log(Level.SEVERE,"",ex);
                continue;
            }
            for (int i=0; i<configBeanSet.length; i++) {

                try {
                    if(resourceUtil.isEnabled(configBeanSet[i])) {
                        deployer.deployResource(configBeanSet[i]);
                    }
                } catch(Exception ex) {
                    _logger.log(Level.SEVERE,"core.resource_loading_error");
                    _logger.log(Level.SEVERE,"",ex);
View Full Code Here


    public void load() {
        ConfigBean[][] cb = null;
        try {
            ResourcesUtil resourceUtil = ResourcesUtil.createInstance();
            cb = resourceUtil.getJdbcResources();
            if(cb != null)
                load(cb);
        }
        catch(ConfigException ce) {
            _logger.log(Level.SEVERE,"core.connectorresource_read_error" );
View Full Code Here

    /*
     * Query the resources util and get a list of jdbc pools
     */
    private MonitorableResourcePool[] getPoolList() {
        ResourcesUtil resUtil = ResourcesUtil.createInstance();
  JdbcConnectionPool[] jp = resUtil.getJdbcConnectionPools();

  if (jp == null) {
      return null;
  }
 
View Full Code Here

    private PoolManager getPoolManager() {
        return Switch.getSwitch().getPoolManager();
    }

    private void transitionToHigh() {
        final ResourcesUtil resUtil = ResourcesUtil.createInstance();
        AccessController.doPrivileged( new PrivilegedAction() {   
            public Object run() {
                //we should create a new pool object everytime since
                //the stats have to be collected afresh
                Map<ConnectorConnectionPool, MonitorableResourcePool> poolMap
                    = resUtil.getPoolMap();
                if (poolMap == null) {
                    return null;
                }
       
                for (Map.Entry<ConnectorConnectionPool, MonitorableResourcePool> entry :
                        poolMap.entrySet() ) {
                    ConnectorConnectionPool ccp = entry.getKey();
                    MonitorableResourcePool pool = entry.getValue();
                    if ( pool != null ) {
                        try {
                            ConnectorConnectionPoolStatsImpl stats = new
                                ConnectorConnectionPoolStatsImpl(pool);
                            getPoolManager().setMonitoringEnabledHigh(
                                pool.getPoolName());
                            registry_.registerConnectorConnectionPoolStats(
                                stats, pool.getPoolName(),
                                resUtil.getAppName(ccp),
                                resUtil.getRAName(ccp),
                                null);
                        } catch (Exception mre) {
                            try {
                                _logger.log( Level.WARNING, "poolmon.cannot_reg",
                                    mre.getMessage() );
View Full Code Here

            }
        });
    }

    private void switchOffMonitoring() {
        final ResourcesUtil resUtil = ResourcesUtil.createInstance();
        //deregister stats
        AccessController.doPrivileged( new PrivilegedAction() {
            public Object run() {
                //Unregister all connector connection pools
                Map<ConnectorConnectionPool, MonitorableResourcePool>
                    pools = resUtil.getPoolMap();
                if (pools == null) {
                    return null;
                }
                       
                for (Map.Entry<ConnectorConnectionPool, MonitorableResourcePool> entry :  pools.entrySet() ) {
                    ConnectorConnectionPool ccp = entry.getKey();
                    MonitorableResourcePool pool = entry.getValue();
                    if (pool != null) {
                        try {
                            registry_.unregisterConnectorConnectionPoolStats(
                                pool.getPoolName(),
                                resUtil.getAppName(ccp),
                                resUtil.getRAName(ccp) );
                            getPoolManager().disableMonitoring(
                                pool.getPoolName());
                        } catch( Exception mre ) {
                            _logger.log( Level.INFO, "poolmon.cannot_unreg");
                        }
View Full Code Here

            }
        });
    }

    private void transitionToLow() {
        final ResourcesUtil resUtil = ResourcesUtil.createInstance();
        AccessController.doPrivileged( new PrivilegedAction() {   
            public Object run() {
                //we should create a new pool object everytime since
                //the stats have to be collected afresh
                Map<ConnectorConnectionPool, MonitorableResourcePool> poolMap
                    = resUtil.getPoolMap();
                if (poolMap == null) {
                    return null;
                }
       
                for (Map.Entry<ConnectorConnectionPool, MonitorableResourcePool> entry :
                        poolMap.entrySet() ) {
                    ConnectorConnectionPool ccp = entry.getKey();
                    MonitorableResourcePool pool = entry.getValue();
                    if ( pool != null ) {
                        try {
                            ConnectorConnectionPoolStatsImpl stats = new
                                ConnectorConnectionPoolStatsImpl(pool);
                            getPoolManager().setMonitoringEnabledLow(
                                pool.getPoolName());
                            registry_.registerConnectorConnectionPoolStats(
                                stats, pool.getPoolName(),
                                resUtil.getAppName(ccp),
                                resUtil.getRAName(ccp), null);
                        } catch (Exception mre) {
                            try {
                                _logger.log( Level.WARNING, "poolmon.cannot_reg",
                                    mre.getMessage() );
                                getPoolManager().disableMonitoring(
View Full Code Here

TOP

Related Classes of com.sun.enterprise.connectors.util.ResourcesUtil

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.