Package org.glassfish.resource.common

Examples of org.glassfish.resource.common.ResourceInfo


            runtime.deleteConnectorResource(resourceInfo);
            ConnectorRegistry.getInstance().removeResourceFactories(resourceInfo);
            //In-case the resource is explicitly created with a suffix (__nontx or __PM), no need to delete one
            if (ConnectorsUtil.getValidSuffix(resourceInfo.getName()) == null) {
                String pmJndiName = ConnectorsUtil.getPMJndiName(resourceInfo.getName());
                ResourceInfo pmResourceInfo = new ResourceInfo(pmJndiName, resourceInfo.getApplicationName(),
                        resourceInfo.getModuleName());
                runtime.deleteConnectorResource(pmResourceInfo);
                ConnectorRegistry.getInstance().removeResourceFactories(pmResourceInfo);
            }
View Full Code Here


     * @throws Exception if unable to access configuration/undeploy resource.
     * @since 8.1 pe/se/ee
     */
    private void checkAndDeletePool(JdbcResource 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 JdbcResource here is a DataSourceDefinition. Ignore optimization.
        if(resources != null){
            try {
                boolean poolReferred =
View Full Code Here

                    //} catch (NameNotFoundException ne) {
                    } catch (NamingException ne) {
                        //If you are here then it is most probably an embedded RAR resource
                        //So we need to explicitly load that rar and create the resources
                        try {
                            ResourceInfo resourceInfo = ConnectorsUtil.getResourceInfo(connResource);
                            com.sun.enterprise.config.serverbeans.ConnectorConnectionPool connConnectionPool =
                                    ResourcesUtil.createInstance().getConnectorConnectionPoolOfResource(resourceInfo);
                            if(connConnectionPool != null){
                                //TODO V3 ideally this should not happen if connector modules (and embedded rars)
                                //TODO  are loaded before recovery
View Full Code Here

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

        PoolMetaData pmd = registry.getPoolMetaData(poolInfo);
        defaultPrin = pmd.getResourcePrincipal();
    }

    private void validateResourceAndPool() throws ResourceException {
        ResourceInfo resourceInfo = this.resourceInfo;
        ResourcesUtil resourcesUtil = ResourcesUtil.createInstance();

        ConnectorRuntime runtime = ConnectorRuntime.getRuntime();
        ConnectorRegistry registry = ConnectorRegistry.getInstance();
        // adding a perf. optimization check so that "config-bean" is not accessed at all for
        // cases where the resource is enabled (deployed). Only for cases where resource
        // is not available, we look further and determine whether resource/resource-ref
        // are disabled.
        if (!registry.isResourceDeployed(resourceInfo)) {
            if(logger.isLoggable(Level.FINEST)){
                logger.log(Level.FINEST,"resourceInfo not found in connector-registry : " + resourceInfo);
            }
            boolean isDefaultResource = false;
            boolean isSunRAResource = false;
            ConnectorDescriptor descriptor = registry.getDescriptor(rarName);
            if (descriptor != null) {
                isDefaultResource = descriptor.getDefaultResourcesNames().contains(resourceInfo.getName());
                if (descriptor.getSunDescriptor() != null) {
                    com.sun.enterprise.deployment.runtime.connector.ResourceAdapter rar =
                            descriptor.getSunDescriptor().getResourceAdapter();
                    if (rar != null) {
                        String sunRAJndiName = (String)
                                rar.getValue(com.sun.enterprise.deployment.runtime.connector.ResourceAdapter.JNDI_NAME);
                        isSunRAResource = resourceInfo.getName().equals(sunRAJndiName);
                    }
                }
            }

            if ((runtime.isServer() || runtime.isEmbedded()) &&
                    (!resourceInfo.getName().contains(ConnectorConstants.DATASOURCE_DEFINITION_JNDINAME_PREFIX) &&
                            (!isDefaultResource) && (!isSunRAResource))) {
                // performance optimization so that resource configuration is not retrieved from
                // resources config bean each time.
                if (resourceConfiguration == null) {
                    resourceConfiguration =
                            (BindableResource) resourcesUtil.getResource(resourceInfo, BindableResource.class);
                    if (resourceConfiguration == null) {
                        String suffix = ConnectorsUtil.getValidSuffix(resourceInfo.getName());
                        // it is possible that the resource is a __PM or __NONTX suffixed resource used by JPA/EJB Container
                        // check for the enabled status and existence using non-prefixed resource-name
                        if (suffix != null) {
                            String nonPrefixedName = resourceInfo.getName().substring(0, resourceInfo.getName().lastIndexOf(suffix));
                            resourceInfo = new ResourceInfo(nonPrefixedName, resourceInfo.getApplicationName(),
                                    resourceInfo.getModuleName());
                            resourceConfiguration = (BindableResource)
                                    resourcesUtil.getResource(resourceInfo, BindableResource.class);
                        }
                    }
                } else {
                    // we cache the resourceConfiguration for performance optimization.
                    // make sure that appropriate (actual) resourceInfo is used for validation.
                    String suffix = ConnectorsUtil.getValidSuffix(resourceInfo.getName());
                    // it is possible that the resource is a __PM or __NONTX suffixed resource used by JPA/EJB Container
                    // check for the enabled status and existence using non-prefixed resource-name
                    if (suffix != null) {
                        String nonPrefixedName = resourceInfo.getName().substring(0, resourceInfo.getName().lastIndexOf(suffix));
                        resourceInfo = new ResourceInfo(nonPrefixedName, resourceInfo.getApplicationName(),
                                resourceInfo.getModuleName());
                    }
                }
                if (resourceConfiguration == null) {
                    throw new ResourceException("No such resource : " + resourceInfo);
                }
View Full Code Here

     * {@inheritDoc}
     */
    public synchronized void deployResource(Object resource, String applicationName, String moduleName) throws Exception {
        com.sun.enterprise.config.serverbeans.ExternalJndiResource jndiRes =
                (com.sun.enterprise.config.serverbeans.ExternalJndiResource) resource;
        ResourceInfo resourceInfo = new ResourceInfo(jndiRes.getJndiName(), applicationName, moduleName);
        createExternalJndiResource(jndiRes, resourceInfo);
    }
View Full Code Here

     */
  public synchronized void deployResource(Object resource) throws Exception {

        com.sun.enterprise.config.serverbeans.ExternalJndiResource jndiRes =
                (com.sun.enterprise.config.serverbeans.ExternalJndiResource) resource;
        ResourceInfo resourceInfo = ConnectorsUtil.getResourceInfo(jndiRes);
        createExternalJndiResource(jndiRes, resourceInfo);
    }
View Full Code Here

     * {@inheritDoc}
     */
    public void undeployResource(Object resource, String applicationName, String moduleName) throws Exception{
        com.sun.enterprise.config.serverbeans.ExternalJndiResource jndiRes =
            (com.sun.enterprise.config.serverbeans.ExternalJndiResource) resource;
        ResourceInfo resourceInfo = new ResourceInfo(jndiRes.getJndiName(), applicationName, moduleName);
        deleteResource(jndiRes, resourceInfo);
    }
View Full Code Here

  public synchronized void undeployResource(Object resource)
            throws Exception {

        com.sun.enterprise.config.serverbeans.ExternalJndiResource jndiRes =
            (com.sun.enterprise.config.serverbeans.ExternalJndiResource) resource;
        ResourceInfo resourceInfo = ConnectorsUtil.getResourceInfo(jndiRes);
        deleteResource(jndiRes, resourceInfo);
    }
View Full Code Here

            //reconfig is being switched off, invalidate proxies
            Collection<BindableResource> resources =
                    runtime.getResources(oldPool.getPoolInfo()).getResourcesOfPool(oldPool.getPoolInfo().getName());
            ConnectorRegistry registry = ConnectorRegistry.getInstance();
            for(BindableResource resource : resources){
                ResourceInfo resourceInfo = ConnectorsUtil.getResourceInfo(resource);
                registry.removeResourceFactories(resourceInfo);
            }
            //recreate the pool now.
            recreatePool(connConnPool);
        }else {
View Full Code Here

TOP

Related Classes of org.glassfish.resource.common.ResourceInfo

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.