Package com.sun.enterprise.connectors

Examples of com.sun.enterprise.connectors.ConnectorRuntime


                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;
View Full Code Here


        // Except system-rars, all other rars are loaded eagerly.
        // Check whether the rar is a system-rar.
        // (as of now, jms-ra is the only inbound system-rar) 
        if (activeRar == null && ConnectorsUtil.belongsToSystemRA(resourceAdapterMid)) {
            ConnectorRuntime crt = ConnectorRuntime.getRuntime();
            crt.loadDeferredResourceAdapter(resourceAdapterMid);
            activeRar = registry_.getActiveResourceAdapter(resourceAdapterMid);
        }

        if (activeRar == null) {
            String msg = "Resource adapter " + resourceAdapterMid + " is not deployed";
View Full Code Here

        JdbcResource jdbcResource = null;
        String jndiName = resourceInfo.getName();

        ResourceInfo actualResourceInfo =
                new ResourceInfo(jndiName, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
        ConnectorRuntime runtime = ConnectorRuntime.getRuntime();
        jdbcResource = (JdbcResource) ConnectorsUtil.getResourceByName(runtime.getResources(actualResourceInfo),
                JdbcResource.class, actualResourceInfo.getName());
        if(jdbcResource == null){
            String suffix = ConnectorsUtil.getValidSuffix(jndiName);
            if(suffix != null){
                jndiName = jndiName.substring(0, jndiName.lastIndexOf(suffix));
                actualResourceInfo =
                        new ResourceInfo(jndiName, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
            }
        }
        jdbcResource = (JdbcResource) ConnectorsUtil.getResourceByName(runtime.getResources(actualResourceInfo),
                JdbcResource.class, actualResourceInfo.getName());

        if (jdbcResource != null) {
            if (logger.isLoggable(Level.FINE)) {
                logger.fine("jdbcRes is ---: " + jdbcResource.getJndiName());
View Full Code Here

            cachedCF = connectionFactory;
        }
        if(cachedCF == null) {
            javax.naming.Context ctx = new javax.naming.InitialContext();
            if (isCFPM) {
                ConnectorRuntime connectorRuntime = ConnectorRuntime.getRuntime();
                cachedCF = (ConnectionFactory) connectorRuntime.lookupPMResource(DEFAULT_CF_PHYS, false);
                connectionFactoryPM = cachedCF;
            } else {
                cachedCF = (ConnectionFactory) ctx.lookup(DEFAULT_CF_PHYS);
                connectionFactory = cachedCF;
            }
View Full Code Here

                        _logger.log(Level.FINE, "No classloader available with connector descriptor");
                    }
                    loader = null;
                }
            }
            ConnectorRuntime connectorRuntime = ConnectorRuntime.getRuntime();
            ModuleDescriptor moduleDescriptor = null;
            Application application = null;
            if(_logger.isLoggable(Level.FINE)) {
                _logger.fine("ResourceAdapterAdminServiceImpl :: createActiveRA "
                    + moduleName + " at " + moduleDir + " loader :: " + loader);
            }
            //class-loader can not be null for standalone rar as deployer should have provided one.
            //class-laoder can (may) be null for system-rars as they are not actually deployed.
            //TODO V3 don't check for system-ra if the resource-adapters are not loaded before recovery
            // (standalone + embedded)
            if (loader == null && ConnectorsUtil.belongsToSystemRA(moduleName)) {
                if (connectorRuntime.isServer()) {
                    loader = connectorRuntime.getSystemRARClassLoader(moduleName);
                }
            } else {
                connectorDescriptor.setClassLoader(null);
                moduleDescriptor = connectorDescriptor.getModuleDescriptor();
                application = connectorDescriptor.getApplication();
                connectorDescriptor.setModuleDescriptor(null);
                connectorDescriptor.setApplication(null);
            }
            try {

                activeResourceAdapter =
                        connectorRuntime.getActiveRAFactory().
                                createActiveResourceAdapter(connectorDescriptor, moduleName, loader);
                if(_logger.isLoggable(Level.FINE)) {
                    _logger.fine("ResourceAdapterAdminServiceImpl :: createActiveRA " +
                        moduleName + " at " + moduleDir +
                        " adding to registry " + activeResourceAdapter);
                }
                _registry.addActiveResourceAdapter(moduleName, activeResourceAdapter);
                if(_logger.isLoggable(Level.FINE)) {
                    _logger.fine("ResourceAdapterAdminServiceImpl:: createActiveRA " +
                        moduleName + " at " + moduleDir
                        + " env =server ? " + (connectorRuntime.isServer()));
                }

                if (connectorRuntime.isServer()) {
                    //Update RAConfig in Connector Descriptor and bind in JNDI
                    //so that ACC clients could use RAConfig
                    updateRAConfigInDescriptor(connectorDescriptor, moduleName);
                    String descriptorJNDIName = ConnectorAdminServiceUtils.getReservePrefixedJNDINameForDescriptor(moduleName);
                    if(_logger.isLoggable(Level.FINE)) {
                        _logger.fine("ResourceAdapterAdminServiceImpl :: createActiveRA "
                            + moduleName + " at " + moduleDir
                            + " publishing descriptor " + descriptorJNDIName);
                    }
                    _runtime.getNamingManager().publishObject(descriptorJNDIName, connectorDescriptor, true);

                    activeResourceAdapter.setup();

                    String securityWarningMessage=
                        connectorRuntime.getSecurityPermissionSpec(moduleName);
                    // To i18N.
                    if (securityWarningMessage != null) {
                        _logger.log(Level.WARNING, securityWarningMessage);
                    }
                }
View Full Code Here

   */

    public void reCreateActiveResourceAdapter(String moduleName)
            throws ConnectorRuntimeException {

        ConnectorRuntime runtime = ConnectorRuntime.getRuntime();

        if (isRarDeployed(moduleName)) {
            if(!ConnectorsUtil.belongsToSystemRA(moduleName)){
                ConnectorApplication app = _registry.getConnectorApplication(moduleName);
                app.undeployResources();
                stopAndRemoveActiveResourceAdapter(moduleName);
                String moduleDir = ConnectorsUtil.getLocation(moduleName);
                createActiveResourceAdapter(moduleDir, moduleName, app.getClassLoader());
                _registry.getConnectorApplication(moduleName).deployResources();
            }else{
             Collection<Resource> resources =
                     getResourcesUtil().filterConnectorResources(getResourcesUtil().getGlobalResources(), moduleName, true);
                runtime.getGlobalResourceManager().undeployResources(resources);
                stopAndRemoveActiveResourceAdapter(moduleName);
                String moduleDir = ConnectorsUtil.getLocation(moduleName);
                createActiveResourceAdapter(moduleDir, moduleName,
                        runtime.getSystemRARClassLoader(moduleName));
                runtime.getGlobalResourceManager().deployResources(resources);
            }
        }
     /*   //No need to deploy the .rar, it may be a case where rar is not deployed yet
        //Also, when the rar is started, RA-Config is anyway used
        else {
View Full Code Here

            File module = new File(moduleDir);

            FileArchive fileArchive = new FileArchive();
            fileArchive.open(module.toURI())// directory where rar is exploded
            ConnectorRuntime runtime = ConnectorRuntime.getRuntime();
            ClassLoader loader ;
            if(ConnectorsUtil.belongsToSystemRA(rarModuleName)){
                loader = ConnectorRuntime.getRuntime().getSystemRARClassLoader(rarModuleName);
                Thread.currentThread().setContextClassLoader(loader);
            }else{
                loader = runtime.createConnectorClassLoader(moduleDir, null, rarModuleName);
            }

            ConnectorArchivist connectorArchivist = runtime.getConnectorArchvist();
            //TODO V3 what happens to embedded .rar ? as its parent classloader should be application CL
            //setting the classloader so that annotation processor can make use of it.
            connectorArchivist.setClassLoader(loader);
            //fileArchive.entries("META-INF/ra.xml");
            //TODO V3 need to check whether ra.xml is present, if so, check the version. process annotations
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();
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE,
                    "Calling backend to add resource adapterConfig ", rarName);
        }
        crt.addResourceAdapterConfig(rarName, domainConfig);
        if (_logger.isLoggable(Level.FINE)) {
            _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

        if (connectorResources == null || connectorResources.size() == 0) {
            return;
        }

        //TODO V3 done so as to initialize connectors-runtime before loading connector-resources. need a better way ?
        ConnectorRuntime crt = connectorRuntimeHabitat.getComponent(ConnectorRuntime.class);

        //TODO V3 done so as to load all connector-modules. need to load only connector-modules instead of all apps
        applicationLoaderServiceHabitat.getComponent(Startup.class,"ApplicationLoaderService");

        List<ConnectorConnectionPool> connPools = new ArrayList<ConnectorConnectionPool>();
        for (Resource resource : connectorResources) {
            ConnectorResource connResource = (ConnectorResource) resource;
            if(getResourcesUtil().isEnabled(connResource)) {
                ResourceInfo resourceInfo = ConnectorsUtil.getResourceInfo(connResource);
                ConnectorConnectionPool pool = ResourcesUtil.createInstance().getConnectorConnectionPoolOfResource(resourceInfo);
                if (pool != null &&
                        ConnectorConstants.XA_TRANSACTION_TX_SUPPORT_STRING.equals(
                                getTransactionSupport(pool))) {
                    connPools.add(pool);
                    if (_logger.isLoggable(Level.FINE)) {
                        _logger.fine("ConnectorsRecoveryResourceHandler loadXAResourcesAndItsConnections :: "
                                + "adding : " + connResource.getPoolName());
                    }
                }
            }
        }
        loadAllConnectorResources();

        if(_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "Recovering pools : " + connPools.size());
        }

        for(ConnectorConnectionPool connPool : connPools){

            PoolInfo poolInfo = ConnectorsUtil.getPoolInfo(connPool);

            try {
                String[] dbUserPassword = 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 = "";
                    if (_logger.isLoggable(Level.FINEST)) {
                        _logger.log(Level.FINEST,
                                "datasource.xadatasource_nullpassword_error", poolInfo);
                    }
                }

                if (dbUser == null) {
                    dbUser = "";
                    if (_logger.isLoggable(Level.FINEST)) {
                        _logger.log(Level.FINEST,
                                "datasource.xadatasource_nulluser_error", poolInfo);
                    }
                }
                String rarName = connPool.getResourceAdapterName();
                //TODO V3 JMS-RA ??
                if (ConnectorAdminServiceUtils.isJMSRA(rarName)) {
                    if(_logger.isLoggable(Level.FINE)) {
                        _logger.log(Level.FINE, "Performing recovery for JMS RA, poolName  " + poolInfo);
                    }
                    ManagedConnectionFactory[] mcfs =
                            crt.obtainManagedConnectionFactories(poolInfo);
                    _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.add(mc);
                        try {
                            XAResource xares = mc.getXAResource();
                            if (xares != null) {
                                xaresList.add(xares);
                            }
                        } catch (ResourceException ex) {
                            // ignored. Not at XA_TRANSACTION level
                        }
                    }

                } else {
                    ManagedConnectionFactory mcf =
                            crt.obtainManagedConnectionFactory(poolInfo);
                    PasswordCredential pc = new PasswordCredential(
                            dbUser, dbPassword.toCharArray());
                    pc.setManagedConnectionFactory(mcf);
                    Principal prin = new ResourcePrincipal(dbUser, dbPassword);
                    subject.getPrincipals().add(prin);
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.