Package org.glassfish.resources.api

Examples of org.glassfish.resources.api.Resource


            }

            try {
                final ResourceManager rm = resourceFactory.getResourceManager(resource);
                if(embedded && isEmbeddedResource(resource, resourcesToRegister)){
                    Resource configBeanResource =
                            rm.createConfigBean(resources, attrList, props, false);
                    resources.getResources().add(configBeanResource);
                    resourceConfigs.add(configBeanResource);
                }else if(!embedded && !isEmbeddedResource(resource, resourcesToRegister)){
                    com.sun.enterprise.config.serverbeans.Resource configBeanResource =
View Full Code Here


                 org.glassfish.resources.api.Resource res = resourcesIter.next();
                 Iterator<org.glassfish.resources.api.Resource> resSetIter = resourceSet.iterator();
                 boolean addResource = true;
                 //check if a duplicate has already been added
                 while(resSetIter.hasNext()){
                     Resource existingRes = resSetIter.next();
                     if(existingRes.equals(res)){
                         //duplicate within an archive
                         addResource = false;
                         _logger.warning(localStrings.getString("duplicate.resource.sun.resource.xml",
                                 getIdToCompare(res), sunResXML.getXMLPath()));
                         break;
                     }
                     //check if another existing resource conflicts with the
                     //resource being added
                     if(existingRes.isAConflict(res)){
                         //conflict within an archive
                         addResource = false;
                         conflictingResources.append("\n");
                         String message = localStrings.getString("conflict.resource.sun.resource.xml",
                                 getIdToCompare(res), sunResXML.getXMLPath());
View Full Code Here

        String jndiName = jndiNameNode.getNodeValue();
        Node factoryClassNode = attributes.getNamedItem(FACTORY_CLASS);
        Node poolNameNode = attributes.getNamedItem(JDBC_RESOURCE_JNDI_NAME);
        Node enabledNode = attributes.getNamedItem(ENABLED);

        Resource persistenceResource =
                    new org.glassfish.resources.api.Resource(org.glassfish.resources.api.Resource.PERSISTENCE_MANAGER_FACTORY_RESOURCE);
        persistenceResource.setAttribute(JNDI_NAME, jndiName);
        if (factoryClassNode != null) {
           String factoryClass = factoryClassNode.getNodeValue();
           persistenceResource.setAttribute(FACTORY_CLASS, factoryClass);
        }
        if (poolNameNode != null) {
           String poolName = poolNameNode.getNodeValue();
           persistenceResource.setAttribute(JDBC_RESOURCE_JNDI_NAME, poolName);
        }
        if (enabledNode != null) {
           String sEnabled = enabledNode.getNodeValue();
           persistenceResource.setAttribute(ENABLED, sEnabled);
        }

        NodeList children = nextKid.getChildNodes();
        generatePropertyElement(persistenceResource, children);
        vResources.add(persistenceResource);
View Full Code Here

        Node factoryClassNode = attributes.getNamedItem(FACTORY_CLASS);
        String factoryClass = factoryClassNode.getNodeValue();
       
        Node enabledNode = attributes.getNamedItem(ENABLED);
       
        Resource customResource = new Resource(Resource.CUSTOM_RESOURCE);
        customResource.setAttribute(JNDI_NAME, jndiName);
        customResource.setAttribute(RES_TYPE, resType);
        customResource.setAttribute(FACTORY_CLASS, factoryClass);
        if (enabledNode != null) {
           String sEnabled = enabledNode.getNodeValue();
           customResource.setAttribute(ENABLED, sEnabled);
        }
       
        NodeList children = nextKid.getChildNodes();
        generatePropertyElement(customResource, children);
        vResources.add(customResource);
View Full Code Here

        String resType = resTypeNode.getNodeValue();
        Node factoryClassNode = attributes.getNamedItem(FACTORY_CLASS);
        String factoryClass = factoryClassNode.getNodeValue();
        Node enabledNode = attributes.getNamedItem(ENABLED);
       
        org.glassfish.resources.api.Resource jndiResource = new Resource(Resource.EXTERNAL_JNDI_RESOURCE);
        jndiResource.setAttribute(JNDI_NAME, jndiName);
        jndiResource.setAttribute(JNDI_LOOKUP, jndiLookup);
        jndiResource.setAttribute(RES_TYPE, resType);
        jndiResource.setAttribute(FACTORY_CLASS, factoryClass);
        if (enabledNode != null) {
           String sEnabled = enabledNode.getNodeValue();
           jndiResource.setAttribute(ENABLED, sEnabled);
        }
       
        NodeList children = nextKid.getChildNodes();
        generatePropertyElement(jndiResource, children);
        vResources.add(jndiResource);
View Full Code Here

        String jndiName = getScopedName(jndiNameNode.getNodeValue(), scope);
        Node poolNameNode = attributes.getNamedItem(POOL_NAME);
        String poolName = getScopedName(poolNameNode.getNodeValue(), scope);
        Node enabledNode = attributes.getNamedItem(ENABLED);

        Resource jdbcResource = new org.glassfish.resources.api.Resource(org.glassfish.resources.api.Resource.JDBC_RESOURCE);
        jdbcResource.setAttribute(JNDI_NAME, jndiName);
        jdbcResource.setAttribute(POOL_NAME, poolName);
        if (enabledNode != null) {
           String enabledName = enabledNode.getNodeValue();
           jdbcResource.setAttribute(ENABLED, enabledName);
        }
       
        NodeList children = nextKid.getChildNodes();
        //get description
        if (children != null)
        {
            for (int ii=0; ii<children.getLength(); ii++)
            {
                if (children.item(ii).getNodeName().equals("description")) {
                    if (children.item(ii).getFirstChild() != null) {
                        jdbcResource.setDescription(
                            children.item(ii).getFirstChild().getNodeValue());
                    }
                }
            }
        }
View Full Code Here

                attributes.getNamedItem(STATEMENT_LEAK_TIMEOUT_IN_SECONDS);
        Node statementLeakReclaimNode =
                attributes.getNamedItem(STATEMENT_LEAK_RECLAIM);


        org.glassfish.resources.api.Resource jdbcConnPool = new Resource(org.glassfish.resources.api.Resource.JDBC_CONNECTION_POOL);
        jdbcConnPool.setAttribute(CONNECTION_POOL_NAME, name);

        if(datasourceNode != null){
            String datasource = datasourceNode.getNodeValue();
            jdbcConnPool.setAttribute(DATASOURCE_CLASS, datasource);
        }

        if (nSteadyPoolSizeNode != null) {
           String sSteadyPoolSize = nSteadyPoolSizeNode.getNodeValue();
           jdbcConnPool.setAttribute(STEADY_POOL_SIZE, sSteadyPoolSize);
        }
        if (nMaxPoolSizeNode != null) {
           String sMaxPoolSize = nMaxPoolSizeNode.getNodeValue();
           jdbcConnPool.setAttribute(MAX_POOL_SIZE, sMaxPoolSize);
        }
        if (nMaxWaitTimeInMillisNode != null) {
           String sMaxWaitTimeInMillis = nMaxWaitTimeInMillisNode.getNodeValue();
           jdbcConnPool.setAttribute(MAX_WAIT_TIME_IN_MILLIS, sMaxWaitTimeInMillis);
        }
        if (nPoolSizeQuantityNode != null) {
           String sPoolSizeQuantity = nPoolSizeQuantityNode.getNodeValue();
           jdbcConnPool.setAttribute(POOL_SIZE_QUANTITY, sPoolSizeQuantity);
        }
        if (nIdleTimeoutInSecNode != null) {
           String sIdleTimeoutInSec = nIdleTimeoutInSecNode.getNodeValue();
           jdbcConnPool.setAttribute(IDLE_TIME_OUT_IN_SECONDS, sIdleTimeoutInSec);
        }
        if (nIsConnectionValidationRequiredNode != null) {
           String sIsConnectionValidationRequired = nIsConnectionValidationRequiredNode.getNodeValue();
           jdbcConnPool.setAttribute(IS_CONNECTION_VALIDATION_REQUIRED, sIsConnectionValidationRequired);
        }
        if (nConnectionValidationMethodNode != null) {
           String sConnectionValidationMethod = nConnectionValidationMethodNode.getNodeValue();
           jdbcConnPool.setAttribute(CONNECTION_VALIDATION_METHOD, sConnectionValidationMethod);
        }
        if (nFailAllConnectionsNode != null) {
           String sFailAllConnection = nFailAllConnectionsNode.getNodeValue();
           jdbcConnPool.setAttribute(FAIL_ALL_CONNECTIONS, sFailAllConnection);
        }
        if (nValidationTableNameNode != null) {
           String sValidationTableName = nValidationTableNameNode.getNodeValue();
           jdbcConnPool.setAttribute(VALIDATION_TABLE_NAME, sValidationTableName);
        }
        if (nResType != null) {
           String sResType = nResType.getNodeValue();
           jdbcConnPool.setAttribute(RES_TYPE, sResType);
        }
        if (nTransIsolationLevel != null) {
           String sTransIsolationLevel = nTransIsolationLevel.getNodeValue();
           jdbcConnPool.setAttribute(TRANS_ISOLATION_LEVEL, sTransIsolationLevel);
        }
        if (nIsIsolationLevelQuaranteed != null) {
           String sIsIsolationLevelQuaranteed =
                  nIsIsolationLevelQuaranteed.getNodeValue();
           jdbcConnPool.setAttribute(IS_ISOLATION_LEVEL_GUARANTEED,
                                     sIsIsolationLevelQuaranteed);
        }
        if (nonTransactionalConnectionsNode != null) {
           jdbcConnPool.setAttribute(NON_TRANSACTIONAL_CONNECTIONS,
                                        nonTransactionalConnectionsNode.getNodeValue());
        }
        if (allowNonComponentCallersNode != null) {
           jdbcConnPool.setAttribute(ALLOW_NON_COMPONENT_CALLERS,
                                        allowNonComponentCallersNode.getNodeValue());
        }
        if (validateAtmostOncePeriodNode != null) {
           jdbcConnPool.setAttribute(VALIDATE_ATMOST_ONCE_PERIOD_IN_SECONDS,
                                        validateAtmostOncePeriodNode.getNodeValue());
        }
        if (connectionLeakTimeoutNode != null) {
           jdbcConnPool.setAttribute(CONNECTION_LEAK_TIMEOUT_IN_SECONDS,
                                        connectionLeakTimeoutNode.getNodeValue());
        }
        if (connectionLeakReclaimNode != null) {
           jdbcConnPool.setAttribute(CONNECTION_LEAK_RECLAIM,
                                        connectionLeakReclaimNode.getNodeValue());
        }
        if (connectionCreationRetryAttemptsNode != null) {
           jdbcConnPool.setAttribute(CONNECTION_CREATION_RETRY_ATTEMPTS,
                                        connectionCreationRetryAttemptsNode.getNodeValue());
        }
        if (connectionCreationRetryIntervalNode != null) {
           jdbcConnPool.setAttribute(CONNECTION_CREATION_RETRY_INTERVAL_IN_SECONDS,
                                        connectionCreationRetryIntervalNode.getNodeValue());
        }
        if (statementTimeoutNode != null) {
           jdbcConnPool.setAttribute(STATEMENT_TIMEOUT_IN_SECONDS,
                                        statementTimeoutNode.getNodeValue());
        }
        if (lazyConnectionEnlistmentNode != null) {
           jdbcConnPool.setAttribute(LAZY_CONNECTION_ENLISTMENT,
                                        lazyConnectionEnlistmentNode.getNodeValue());
        }
        if (lazyConnectionAssociationNode != null) {
           jdbcConnPool.setAttribute(LAZY_CONNECTION_ASSOCIATION,
                                        lazyConnectionAssociationNode.getNodeValue());
        }
        if (associateWithThreadNode != null) {
           jdbcConnPool.setAttribute(ASSOCIATE_WITH_THREAD,
                                        associateWithThreadNode.getNodeValue());
        }
        if (matchConnectionsNode != null) {
           jdbcConnPool.setAttribute(MATCH_CONNECTIONS,
                                        matchConnectionsNode.getNodeValue());
        }
        if (maxConnectionUsageCountNode != null) {
           jdbcConnPool.setAttribute(MAX_CONNECTION_USAGE_COUNT,
                                        maxConnectionUsageCountNode.getNodeValue());
        }
        if (wrapJDBCObjectsNode != null) {
           jdbcConnPool.setAttribute(WRAP_JDBC_OBJECTS,
                                        wrapJDBCObjectsNode.getNodeValue());
        }
        if(poolingNode != null){
           String pooling = poolingNode.getNodeValue();
           jdbcConnPool.setAttribute(POOLING,pooling);
        }
        if(pingNode != null){
           String ping = pingNode.getNodeValue();
           jdbcConnPool.setAttribute(PING,ping);
        }
        if(initSqlNode != null){
           String initSQL = initSqlNode.getNodeValue();
           jdbcConnPool.setAttribute(INIT_SQL,initSQL);
        }
        if(sqlTraceListenersNode != null){
           String sqlTraceListeners= sqlTraceListenersNode.getNodeValue();
           jdbcConnPool.setAttribute(SQL_TRACE_LISTENERS, sqlTraceListeners);
        }
        if(customValidationNode != null){
           String customValidation = customValidationNode.getNodeValue();
           jdbcConnPool.setAttribute(CUSTOM_VALIDATION,customValidation);
        }
        if(driverClassNameNode != null){
           String driverClassName = driverClassNameNode.getNodeValue();
           jdbcConnPool.setAttribute(DRIVER_CLASSNAME,driverClassName);
        }
        if(statementCacheSizeNode != null){
           String statementCacheSize = statementCacheSizeNode.getNodeValue();
           jdbcConnPool.setAttribute(STATEMENT_CACHE_SIZE,statementCacheSize);
        }
        if (statementLeakTimeoutNode != null) {
           jdbcConnPool.setAttribute(STATEMENT_LEAK_TIMEOUT_IN_SECONDS,
                                        statementLeakTimeoutNode.getNodeValue());
        }
        if (statementLeakReclaimNode != null) {
           jdbcConnPool.setAttribute(STATEMENT_LEAK_RECLAIM,
                                        statementLeakReclaimNode.getNodeValue());
        }

        NodeList children = nextKid.getChildNodes();
        generatePropertyElement(jdbcConnPool, children);
View Full Code Here

        String poolName = getScopedName(poolNameNode.getNodeValue(), scope);
        Node resTypeNode = attributes.getNamedItem(RESOURCE_TYPE);
        Node enabledNode = attributes.getNamedItem(ENABLED);

        org.glassfish.resources.api.Resource connectorResource =
                    new Resource(org.glassfish.resources.api.Resource.CONNECTOR_RESOURCE);
        connectorResource.setAttribute(JNDI_NAME, jndiName);
        connectorResource.setAttribute(POOL_NAME, poolName);
        if (resTypeNode != null) {
           String resType = resTypeNode.getNodeValue();
           connectorResource.setAttribute(RESOURCE_TYPE, resType);
        }
        if (enabledNode != null) {
           String sEnabled = enabledNode.getNodeValue();
           connectorResource.setAttribute(ENABLED, sEnabled);
        }
       
        NodeList children = nextKid.getChildNodes();
        generatePropertyElement(connectorResource, children);
        vResources.add(connectorResource);
View Full Code Here

        Node pingNode
            = attributes.getNamedItem(PING);

        String poolName = null;
       
        org.glassfish.resources.api.Resource connectorConnPoolResource = new Resource(org.glassfish.resources.api.Resource.CONNECTOR_CONNECTION_POOL);
        if(nameNode != null){
            poolName = getScopedName(nameNode.getNodeValue(), scope);
            connectorConnPoolResource.setAttribute(CONNECTION_POOL_NAME, poolName);
        }   
       if(raConfigNode != null){
            String raConfig = raConfigNode.getNodeValue();
            connectorConnPoolResource.setAttribute(RESOURCE_ADAPTER_CONFIG_NAME,raConfig);
        }
        if(conDefNode != null){
            String conDef = conDefNode.getNodeValue();
            connectorConnPoolResource.setAttribute(CONN_DEF_NAME,conDef);
        }
        if(steadyPoolSizeNode != null){
            String steadyPoolSize = steadyPoolSizeNode.getNodeValue();
            connectorConnPoolResource.setAttribute(CONN_STEADY_POOL_SIZE,steadyPoolSize);
        }
        if(maxPoolSizeNode != null){
            String maxPoolSize = maxPoolSizeNode.getNodeValue();
            connectorConnPoolResource.setAttribute(CONN_MAX_POOL_SIZE,maxPoolSize);
        }
        if(poolResizeNode != null){
            String poolResize = poolResizeNode.getNodeValue();
            connectorConnPoolResource.setAttribute(CONN_POOL_RESIZE_QUANTITY,poolResize);
        }
        if(idleTimeOutNode != null){
            String idleTimeOut = idleTimeOutNode.getNodeValue();
            connectorConnPoolResource.setAttribute(CONN_IDLE_TIME_OUT,idleTimeOut);
        }
        if(failAllConnNode != null){
            String failAllConn = failAllConnNode.getNodeValue();
            connectorConnPoolResource.setAttribute(CONN_FAIL_ALL_CONNECTIONS,
                                                   failAllConn);
        }
        if(maxWaitTimeMillisNode != null){
           String maxWaitTimeMillis = maxWaitTimeMillisNode.getNodeValue();
           connectorConnPoolResource.setAttribute(MAX_WAIT_TIME_IN_MILLIS,
                                                      maxWaitTimeMillis);
        }
        if(transactionSupportNode != null){
           String transactionSupport = transactionSupportNode.getNodeValue();
           connectorConnPoolResource.setAttribute(CONN_TRANSACTION_SUPPORT,
                                                      transactionSupport);
        }
        if(connValidationReqdNode != null){
           String connValidationReqd = connValidationReqdNode.getNodeValue();
           connectorConnPoolResource.setAttribute(IS_CONNECTION_VALIDATION_REQUIRED,
                                                      connValidationReqd);
        }
        if(validateAtmostOncePeriodNode != null){
           String validateAtmostOncePeriod = validateAtmostOncePeriodNode.getNodeValue();
           connectorConnPoolResource.setAttribute(VALIDATE_ATMOST_ONCE_PERIOD_IN_SECONDS,
                                          validateAtmostOncePeriod);
        }
        if(connLeakTimeoutNode != null){
           String connLeakTimeout = connLeakTimeoutNode.getNodeValue();
           connectorConnPoolResource.setAttribute(CONNECTION_LEAK_TIMEOUT_IN_SECONDS,
                                          connLeakTimeout);
        }
        if(connLeakReclaimNode != null){
           String connLeakReclaim = connLeakReclaimNode.getNodeValue();
           connectorConnPoolResource.setAttribute(CONNECTION_LEAK_RECLAIM,
                                                      connLeakReclaim);
        }
        if(connCreationRetryAttemptsNode != null){
           String connCreationRetryAttempts = connCreationRetryAttemptsNode.getNodeValue();
           connectorConnPoolResource.setAttribute(CONNECTION_CREATION_RETRY_ATTEMPTS,
                                                      connCreationRetryAttempts);
        }
            if(connCreationRetryIntervalNode != null){
               String connCreationRetryInterval = connCreationRetryIntervalNode.getNodeValue();
           connectorConnPoolResource.setAttribute(CONNECTION_CREATION_RETRY_INTERVAL_IN_SECONDS,
                                          connCreationRetryInterval);
        }
        if(lazyConnEnlistmentNode != null){
               String lazyConnEnlistment = lazyConnEnlistmentNode.getNodeValue();
           connectorConnPoolResource.setAttribute(LAZY_CONNECTION_ENLISTMENT,
                                                      lazyConnEnlistment);
        }
        if(lazyConnAssociationNode != null){
               String lazyConnAssociation = lazyConnAssociationNode.getNodeValue();
           connectorConnPoolResource.setAttribute(LAZY_CONNECTION_ASSOCIATION,
                                                      lazyConnAssociation);
        }
            if(associateWithThreadNode != null){
               String associateWithThread = associateWithThreadNode.getNodeValue();
           connectorConnPoolResource.setAttribute(ASSOCIATE_WITH_THREAD,
                                                      associateWithThread);
        }
        if(matchConnectionsNode != null){
           String matchConnections = matchConnectionsNode.getNodeValue();
           connectorConnPoolResource.setAttribute(MATCH_CONNECTIONS,
                                                      matchConnections);
        }
        if(maxConnUsageCountNode != null){
           String maxConnUsageCount = maxConnUsageCountNode.getNodeValue();
           connectorConnPoolResource.setAttribute(MAX_CONNECTION_USAGE_COUNT,
                                                      maxConnUsageCount);
        }
        if(poolingNode != null){
           String pooling = poolingNode.getNodeValue();
           connectorConnPoolResource.setAttribute(POOLING,pooling);
        }
        if(pingNode != null){
           String ping = pingNode.getNodeValue();
           connectorConnPoolResource.setAttribute(PING,ping);
        }

        NodeList children = nextKid.getChildNodes();
        //get description
        generatePropertyElement(connectorConnPoolResource, children);
View Full Code Here

            return;
        }

        Node nameNode = attributes.getNamedItem(WORK_SECURITY_MAP_NAME);

        Resource workSecurityMapResource = new Resource(org.glassfish.resources.api.Resource.CONNECTOR_WORK_SECURITY_MAP);
        if(nameNode != null){
            String name = nameNode.getNodeValue();
            workSecurityMapResource.setAttribute(WORK_SECURITY_MAP_NAME, name);
        }

        Node raNameNode = attributes.getNamedItem(WORK_SECURITY_MAP_RA_NAME);
        if(raNameNode != null) {
            workSecurityMapResource.setAttribute(WORK_SECURITY_MAP_RA_NAME, raNameNode.getNodeValue());
        }

        NodeList children = node.getChildNodes();
        if(children != null){
            for(int i=0; i<children.getLength();i++){
                Node child = children.item(i);
                String nodeName = child.getNodeName();
                if(nodeName.equals(WORK_SECURITY_MAP_GROUP_MAP)){
                    Properties groupMaps = new Properties();
                    NamedNodeMap childAttributes = child.getAttributes();
                    if(childAttributes != null){
                        Node eisGroup = childAttributes.getNamedItem(WORK_SECURITY_MAP_EIS_GROUP);
                        Node mappedGroup = childAttributes.getNamedItem(WORK_SECURITY_MAP_MAPPED_GROUP);
                        if(eisGroup != null && mappedGroup != null){
                            String eisGroupValue = eisGroup.getNodeValue();
                            String serverGroupValue = mappedGroup.getNodeValue();
                            if(eisGroupValue != null && serverGroupValue != null){
                                groupMaps.put(eisGroupValue, serverGroupValue);
                            }
                        }
                        workSecurityMapResource.setAttribute(WORK_SECURITY_MAP_GROUP_MAP, groupMaps);
                    }
                }else if(nodeName.equals(WORK_SECURITY_MAP_PRINCIPAL_MAP)){
                    Properties principalMaps = new Properties();
                    NamedNodeMap childAttributes = child.getAttributes();
                    if(childAttributes != null){
                        Node eisPrincipal = childAttributes.getNamedItem(WORK_SECURITY_MAP_EIS_PRINCIPAL);
                        Node mappedPrincipal = childAttributes.getNamedItem(WORK_SECURITY_MAP_MAPPED_PRINCIPAL);
                        if(eisPrincipal != null && mappedPrincipal != null){
                            String eisPrincipalValue = eisPrincipal.getNodeValue();
                            String serverPrincipalValue = mappedPrincipal.getNodeValue();
                            if(eisPrincipalValue != null && serverPrincipalValue != null){
                                principalMaps.put(eisPrincipalValue, serverPrincipalValue);
                            }
                        }
                        workSecurityMapResource.setAttribute(WORK_SECURITY_MAP_PRINCIPAL_MAP, principalMaps);
                    }
                }
            }
        }
        vResources.add(workSecurityMapResource);
View Full Code Here

TOP

Related Classes of org.glassfish.resources.api.Resource

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.