Package org.glassfish.resourcebase.resources.api

Examples of org.glassfish.resourcebase.resources.api.PoolInfo


        }
        logFine("new ccp :\n" + ccp.toString());

        //see if the new ConnectorConnectionPool is different from
        //the original one and update relevant properties
        PoolInfo poolInfo = ccp.getPoolInfo();
        ConnectorConnectionPool origCcp = null;
        try {
            origCcp = getOriginalConnectorConnectionPool(poolInfo);
        } catch (NamingException ne) {
            throw new ConnectorRuntimeException(ne.getMessage());
View Full Code Here


        return false;
    }

    private void updateMCFAndPoolAttributes(ConnectorConnectionPool
            ccp) throws ConnectorRuntimeException {
        PoolInfo poolInfo = ccp.getPoolInfo();
        try {
            ConnectorConnectionPool origCcp =
                    getOriginalConnectorConnectionPool(poolInfo);

            //update properties
View Full Code Here

        ConnectorRegistry registry = ConnectorRegistry.getInstance();
        if (registry == null) {
            throw new ConnectorRuntimeException(
                    "Cannot get ConnectorRegistry");
        }
        PoolInfo poolInfo = ccp.getPoolInfo();
        //First remove this pool from memory
        try {
            unloadAndKillPool(poolInfo);
        } catch (ConnectorRuntimeException cre) {
            throw cre;
View Full Code Here

    public Connection getConnection(ResourceInfo resourceInfo, String user, String password)
            throws SQLException {
        java.sql.Connection con = null;
        try {
            //DASResourcesUtil.setAdminConfigContext();
            PoolInfo poolInfo = getPoolNameFromResourceJndiName(resourceInfo);
            if(poolInfo == null){
                throw new SQLException("No pool by name exists ");
            }
            if (_logger.isLoggable(Level.FINE)) {
                _logger.fine("ConnectorRuntime.getConnection :: poolName : " + poolInfo);
View Full Code Here

    public Connection getConnection(ResourceInfo resourceInfo)
            throws SQLException {
        java.sql.Connection con = null;
        try {
            //DASResourcesUtil.setAdminConfigContext();
            PoolInfo poolInfo = getPoolNameFromResourceJndiName(resourceInfo);
            if(poolInfo == null){
                throw new SQLException("No pool by name exists ");
            }
            if (_logger.isLoggable(Level.FINE)) {
                _logger.fine("ConnectorRuntime.getConnection :: poolName : "
View Full Code Here

     * @param jndiName the jndi name of the resource being used to get Connection from
     *                 This resource can either be a pmf resource or a jdbc resource
     * @return poolName of the pool that this resource directly/indirectly points to
     */
    private PoolInfo getPoolNameFromResourceJndiName(ResourceInfo resourceInfo) {
        PoolInfo poolInfo= null;
        Collection<ConnectorRuntimeExtension> extensions =
                Globals.getDefaultHabitat().getAllServices(ConnectorRuntimeExtension.class);
        for(ConnectorRuntimeExtension extension : extensions) {
            poolInfo = extension.getPoolNameFromResourceJndiName(resourceInfo);
        }
View Full Code Here

    public synchronized void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
        //deployResource is not synchronized as there is only one caller
        //ResourceProxy which is synchronized
        ConnectorResource domainResource = (ConnectorResource) resource;
        ResourceInfo resourceInfo = new ResourceInfo(domainResource.getJndiName(), applicationName, moduleName);
        PoolInfo poolInfo = new PoolInfo(domainResource.getPoolName(), applicationName, moduleName);
        createConnectorResource(domainResource, resourceInfo, poolInfo);
    }
View Full Code Here

        //deployResource is not synchronized as there is only one caller
        //ResourceProxy which is synchronized
        ConnectorResource domainResource = (ConnectorResource) resource;
        String poolName = domainResource.getPoolName();
        ResourceInfo resourceInfo = ConnectorsUtil.getResourceInfo(domainResource);
        PoolInfo poolInfo = new PoolInfo(poolName, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
        createConnectorResource(domainResource, resourceInfo, poolInfo);
    }
View Full Code Here

        Reference ref = (Reference) obj;
        if(_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE,"ConnectorObjectFactory: " + ref +
                " Name:" + name);
        }
            PoolInfo poolInfo = (PoolInfo) ref.get(0).getContent();
            String moduleName  = (String) ref.get(1).getContent();
            ResourceInfo resourceInfo = (ResourceInfo) ref.get(2).getContent();


        if (getRuntime().isACCRuntime() || getRuntime().isNonACCRuntime()) {
            ConnectorDescriptor connectorDescriptor = null;

            String descriptorJNDIName = ConnectorAdminServiceUtils.
                    getReservePrefixedJNDINameForDescriptor(moduleName);
            Context ic = new InitialContext(env);
            connectorDescriptor = (ConnectorDescriptor) ic.lookup(descriptorJNDIName);
            try {
                getRuntime().createActiveResourceAdapter(connectorDescriptor, moduleName, null);
            } catch (ConnectorRuntimeException e) {
                if(_logger.isLoggable(Level.FINE)) {
                    _logger.log(Level.FINE,
                            "Failed to look up ConnectorDescriptor from JNDI",
                            moduleName);
                }
                NamingException ne = new NamingException("Failed to look up ConnectorDescriptor from JNDI");
                ne.setRootCause(e);
                throw ne;
            }
        }

        ClassLoader loader = Thread.currentThread().getContextClassLoader();
        if (!getRuntime().checkAccessibility(moduleName, loader)) {
            String msg = localStrings.getString("cof.no_access_to_embedded_rar", moduleName);
            throw new NamingException(msg);
        }

        Object cf = null;
        try {
            ManagedConnectionFactory mcf = getRuntime().obtainManagedConnectionFactory(poolInfo, env);
            if (mcf == null) {
                if(_logger.isLoggable(Level.FINE)) {
                    _logger.log(Level.FINE, "Failed to create MCF ", poolInfo);
                }
                throw new ConnectorRuntimeException("Failed to create MCF");
            }

            boolean forceNoLazyAssoc = false;

            String jndiName = name.toString();
            if (jndiName.endsWith(ConnectorConstants.PM_JNDI_SUFFIX)) {
                forceNoLazyAssoc = true;
            }

            String derivedJndiName = ConnectorsUtil.deriveJndiName(jndiName, env);
            ConnectionManagerImpl mgr = (ConnectionManagerImpl)
                    getRuntime().obtainConnectionManager(poolInfo, forceNoLazyAssoc, resourceInfo);
            mgr.setJndiName(derivedJndiName);
            mgr.setRarName(moduleName);

            String logicalName = (String)env.get(GlassfishNamingManager.LOGICAL_NAME);
            if(logicalName != null){
                mgr.setLogicalName(logicalName);
            }
           
            mgr.initialize();

            cf = mcf.createConnectionFactory(mgr);
            if (cf == null) {
                String msg = localStrings.getString("cof.no.resource.adapter");
                throw new RuntimeException(new ConfigurationException(msg));
            }

            if (getRuntime().isServer() || getRuntime().isEmbedded()) {
                ConnectorRegistry registry = ConnectorRegistry.getInstance();
                if (registry.isTransparentDynamicReconfigPool(poolInfo)) {
                    Resources resources = getRuntime().getResources(poolInfo);
                    ResourcePool resourcePool = null;
                    if (resources != null) {
                        resourcePool = (ResourcePool) ConnectorsUtil.getResourceByName(resources, ResourcePool.class, poolInfo.getName());
                        if (resourcePool != null) {
                            ResourceDeployer deployer = getRuntime().getResourceDeployer(resourcePool);
                            if (deployer != null && deployer.supportsDynamicReconfiguration() &&
                                    ConnectorsUtil.isDynamicReconfigurationEnabled(resourcePool)) {
View Full Code Here

     * @since 8.1 pe/se/ee
     */
    private void checkAndDeletePool(ConnectorResource cr) throws Exception {
        String poolName = cr.getPoolName();
        ResourceInfo resourceInfo = ConnectorsUtil.getResourceInfo(cr);
        PoolInfo poolInfo = new PoolInfo(poolName, resourceInfo.getApplicationName(), resourceInfo.getModuleName());
        Resources resources = (Resources) cr.getParent();
        //Its possible that the ConnectorResource here is a ConnectorResourceeDefinition. Ignore optimization.
        if (resources != null) {
            try {
                boolean poolReferred =
View Full Code Here

TOP

Related Classes of org.glassfish.resourcebase.resources.api.PoolInfo

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.