private boolean hasRAName(org.glassfish.resources.api.Resource resource) { return resource.getType().equals(ADMIN_OBJECT_RESOURCE) || resource.getType().equals(CONNECTOR_CONNECTION_POOL) || resource.getType().equals(RESOURCE_ADAPTER_CONFIG) || resource.getType().equals(CONNECTOR_WORK_SECURITY_MAP); }
private static boolean isConnectorResource(org.glassfish.resources.api.Resource resource){ if(resource.getType().equals(ADMIN_OBJECT_RESOURCE) || resource.getType().equals(CONNECTOR_CONNECTION_POOL) || resource.getType().equals(CONNECTOR_RESOURCE) || resource.getType().equals(RESOURCE_ADAPTER_CONFIG) || resource.getType().equals(CONNECTOR_WORK_SECURITY_MAP)){ return true; }else{ return false; } }
private static org.glassfish.resources.api.Resource getPoolResource( String poolName, Collection<org.glassfish.resources.api.Resource> resources){ org.glassfish.resources.api.Resource result = null; for(org.glassfish.resources.api.Resource resource : resources){ if(resource.getType().equals(CONNECTOR_CONNECTION_POOL)){ String cpName = (String)resource.getAttributes().get(CONNECTION_POOL_NAME); if(poolName.equals(cpName)){ result = resource; break; } } } return result; }
/** * Extract the RA name for a connector resource. Collecting for resource validation. * * @param resource * @return resource adapter name */ private String extractRAName(org.glassfish.resources.api.Resource resource) { if (resource.getType().equals(ADMIN_OBJECT_RESOURCE)) return (String)resource.getAttributes().get(RES_ADAPTER); else return (String)resource.getAttributes().get(RES_ADAPTER_NAME); }
private static boolean isEmbeddedResource(org.glassfish.resources.api.Resource resource, Collection<org.glassfish.resources.api.Resource> resources){ boolean result = false; if(isConnectorResource(resource)){ String attributeName = null; if(resource.getType().equals(ADMIN_OBJECT_RESOURCE)){ attributeName = RES_ADAPTER; } else if(resource.getType().equals(CONNECTOR_CONNECTION_POOL)){ attributeName = RES_ADAPTER_NAME; } else if(resource.getType().equals(CONNECTOR_RESOURCE)){ String poolName = (String)resource.getAttributes().get(POOL_NAME); if(poolName != null){ org.glassfish.resources.api.Resource poolResource = getPoolResource(poolName, resources); //point to poolResource resource = poolResource; attributeName = RES_ADAPTER_NAME; } }/* else if(resource.getType().equals(org.glassfish.resources.api.Resource.RESOURCE_ADAPTER_CONFIG)){ attributeName = ResourceConstants.RES_ADAPTER_NAME; } */else if(resource.getType().equals(CONNECTOR_WORK_SECURITY_MAP)){ attributeName = RES_ADAPTER_NAME; } if(attributeName != null && resource != null){ result = isEmbeddedRar(resource, attributeName); } } return result; }
private static String getIdToCompare(final Resource res) { final HashMap attrs = res.getAttributes(); final String type = res.getType(); String id; if (org.glassfish.resources.api.Resource.JDBC_CONNECTION_POOL.equals(type) || Resource.CONNECTOR_CONNECTION_POOL.equals(type)){ id = getNamedAttributeValue(attrs, CONNECTION_POOL_NAME); // this should come from refactored stuff TBD } else if (org.glassfish.resources.api.Resource.CONNECTOR_SECURITY_MAP.equals(type)) { id = getNamedAttributeValue(attrs, SECURITY_MAP_NAME); // this should come from refactored stuff TBD } else if (org.glassfish.resources.api.Resource.RESOURCE_ADAPTER_CONFIG.equals(type)) { id = getNamedAttributeValue(attrs, RESOURCE_ADAPTER_CONFIG_NAME); // this should come from refactored stuff TBD } else if(org.glassfish.resources.api.Resource.CONNECTOR_WORK_SECURITY_MAP.equals(type)){ id = getNamedAttributeValue(attrs, WORK_SECURITY_MAP_NAME); } else { //it is OK to assume that this Resource will one of the *RESOURCEs? id = getNamedAttributeValue(attrs, JNDI_NAME); // this should come from refactored stuff TBD } return ( id ); }
String jndiName = extractJNDIName(resource); if (hasRAName(resource)) { raNames.add(new AbstractMap.SimpleEntry<>(extractRAName(resource), resource.getType())); String jndiName = extractJNDIName(resource); if (hasRAName(resource)) { raNames.add(new AbstractMap.SimpleEntry<>(extractRAName(resource), resource.getType()));