Package org.glassfish.resource.common

Examples of org.glassfish.resource.common.Resource


        }
        Node resAdapterNode = attributes.getNamedItem(RES_ADAPTER);
        String resAdapter = resAdapterNode.getNodeValue();
        Node enabledNode = attributes.getNamedItem(ENABLED);

        Resource adminObjectResource =
                    new Resource(Resource.ADMIN_OBJECT_RESOURCE);
        adminObjectResource.setAttribute(JNDI_NAME, jndiName);
        adminObjectResource.setAttribute(RES_TYPE, resType);
        if(classNameNode != null){
            adminObjectResource.setAttribute(ADMIN_OBJECT_CLASS_NAME, className);
        }
        adminObjectResource.setAttribute(RES_ADAPTER, resAdapter);

        if (enabledNode != null) {
           String sEnabled = enabledNode.getNodeValue();
           adminObjectResource.setAttribute(ENABLED, sEnabled);
        }
       
        NodeList children = nextKid.getChildNodes();
        generatePropertyElement(adminObjectResource, children);
        vResources.add(adminObjectResource);
View Full Code Here


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

        Resource connectorResource =
                    new Resource(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;
       
        Resource connectorConnPoolResource = new Resource(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(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

            return ;
        Node nameNode
            = attributes.getNamedItem(SECURITY_MAP_NAME);
              
             
        Resource map = new Resource(Resource.CONNECTOR_SECURITY_MAP);
        if(nameNode != null){
            String name = nameNode.getNodeValue();
            map.setAttribute(SECURITY_MAP_NAME, name);
        }
        if(poolName != null)
           map.setAttribute(POOL_NAME,poolName);
       
        StringBuffer principal = new StringBuffer();
        StringBuffer usergroup = new StringBuffer();
       
        NodeList children = mapNode.getChildNodes();
       
        if(children != null){
            for (int i=0; i<children.getLength(); i++){
                Node gChild = children.item(i);
                String strNodeName = gChild.getNodeName();
                if(strNodeName.equals(PRINCIPAL)){
                    String p = (gChild.getFirstChild()).getNodeValue();
                    principal.append(p).append(",");
                }
                if(strNodeName.equals(USERGROUP)){
                    String u = (gChild.getFirstChild()).getNodeValue();
                    usergroup.append(u).append(",");
                }
                if((strNodeName.equals(BACKEND_PRINCIPAL))){
                    NamedNodeMap attributes1 = (children.item(i)).getAttributes();   
                    if(attributes1 != null){
                        Node userNode = attributes1.getNamedItem(USER_NAME);
                        if(userNode != null){
                            String userName =userNode.getNodeValue();
                            map.setAttribute(USER_NAME,userName);
                        }
                        Node passwordNode = attributes1.getNamedItem(PASSWORD);
                        if(passwordNode != null){
                            String pwd = passwordNode.getNodeValue();
                            map.setAttribute(PASSWORD,pwd);
                        }
                    }
                }
            }
        }
            map.setAttribute(PRINCIPAL,convertToStringArray(principal.toString()));
            map.setAttribute("user_group",convertToStringArray(usergroup.toString()));
       vResources.add(map);
    }//end of generateSecurityMap....    
View Full Code Here

       
        NamedNodeMap attributes = nextKid.getAttributes();
        if (attributes == null)
            return;
       
        Resource resAdapterConfigResource = new Resource(Resource.RESOURCE_ADAPTER_CONFIG);
        Node resAdapConfigNode = attributes.getNamedItem(RES_ADAPTER_CONFIG);
        if(resAdapConfigNode != null){
            String resAdapConfig = resAdapConfigNode.getNodeValue();
            resAdapterConfigResource.setAttribute(RES_ADAPTER_CONFIG,resAdapConfig);
        }
        Node poolIdNode = attributes.getNamedItem(THREAD_POOL_IDS);
        if(poolIdNode != null){
            String threadPoolId = poolIdNode.getNodeValue();
            resAdapterConfigResource.setAttribute(THREAD_POOL_IDS,threadPoolId);
        }
        Node resAdapNameNode = attributes.getNamedItem(RES_ADAPTER_NAME);
        if(resAdapNameNode != null){
            String resAdapName = resAdapNameNode.getNodeValue();
            resAdapterConfigResource.setAttribute(RES_ADAPTER_NAME,resAdapName);
        }
       
        NodeList children = nextKid.getChildNodes();
        generatePropertyElement(resAdapterConfigResource, children);
        vResources.add(resAdapterConfigResource);
View Full Code Here

            new ResourcesXMLParser(resourceXMLFile);
        List<Resource> vResources = resourcesParser.getResourcesList();
        //First add all non connector resources.
        Iterator<Resource> nonConnectorResources = ResourcesXMLParser.getNonConnectorResourcesList(vResources,false, false).iterator();
        while (nonConnectorResources.hasNext()) {
            Resource resource = (Resource) nonConnectorResources.next();
            HashMap attrList = resource.getAttributes();
            String desc = resource.getDescription();
            if (desc != null)
                attrList.put("description", desc);

            Properties props = resource.getProperties();

            ResourceStatus rs;
            try {
                ResourceManager rm = resourceFactory.getResourceManager(resource);
                rs = rm.create(resources, attrList, props, target);
            } catch (Exception e) {
                String msg = e.getMessage();
                rs = new ResourceStatus(ResourceStatus.FAILURE, msg);
            }
            results.add(rs);
        }

        //Now add all connector resources
        Iterator connectorResources = ResourcesXMLParser.getConnectorResourcesList(vResources, false, false).iterator();
        while (connectorResources.hasNext()) {
            Resource resource = (Resource) connectorResources.next();
            HashMap attrList = resource.getAttributes();
            String desc = resource.getDescription();
            if (desc != null)
                attrList.put("description", desc);

            Properties props = resource.getProperties();

            ResourceStatus rs;
            try {
                ResourceManager rm = resourceFactory.getResourceManager(resource);
                rs = rm.create(resources, attrList, props, target);
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 Resource(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);
       
        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

TOP

Related Classes of org.glassfish.resource.common.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.