public static String getApplicationName(Resource resource){ String applicationName = null; if(resource.getParent() != null && resource.getParent().getParent() instanceof Application){ Application application = (Application)resource.getParent().getParent(); applicationName = application.getName(); } return applicationName; }
@Override public boolean isValid(final Resource resource, final ConstraintValidatorContext constraintValidatorContext) { if (domain != null) { if (resource.getParent().getParent() instanceof Domain) { for (Resource res : domain.getResources().getResources()) { if (resource.getIdentity().equals(res.getIdentity())) { Class[] resourceInterfaces = resource.getClass().getInterfaces(); Class[] resInterfaces = res.getClass().getInterfaces(); for (Class resourceClass : resourceInterfaces) { for (Class resClass : resInterfaces) { if (resClass.getName().equals(resourceClass.getName())) { return true; } } } return false; } } } } return true; } }
public static boolean copyToInstance(Resource resource) { String ot = resource.getObjectType(); return "system-all".equals(ot) || "system-all-req".equals(ot) || "system-instance".equals(ot); } }
/** * given a resource config bean, returns the resource name / jndi-name * @param resource * @return resource name / jndi-name */ public static ResourceInfo getGenericResourceInfo(Resource resource){ ResourceInfo resourceInfo = null; String resourceName = resource.getIdentity(); resourceInfo = getGenericResourceInfo(resource, resourceName); return resourceInfo; }
int i1 = Integer.parseInt(o1.getDeploymentOrder()); int i2 = Integer.parseInt(o2.getDeploymentOrder()); return (i2>i1 ? -1 : (i1==i2 ? 0 : 1));
public static Resource getResourceByName(Class<? extends Resource> clazz, Resources resources, String name) { Collection<? extends Resource> typedResources = resources.getResources(clazz); if (typedResources != null) for (Resource resource : typedResources) { if (resource.getIdentity().equals(name)) { return resource; } } return null; }
public static ResourceInfo getGenericResourceInfo(Resource resource, String resourceName){ if(resource.getParent() != null && resource.getParent().getParent() instanceof Application){ Application application = (Application)resource.getParent().getParent(); return new ResourceInfo(resourceName, application.getName()); }else if(resource.getParent() != null && resource.getParent().getParent() instanceof Module){ Module module = (Module)resource.getParent().getParent(); Application application = (Application)module.getParent(); return new ResourceInfo(resourceName, application.getName(), module.getName()); }else{ return new ResourceInfo(resourceName); } }
public static Resource getResourceByIdentity(Resources resources, String name) { for (Resource resource : resources.getResources()) { if (resource.getIdentity().equals(name)) { return resource; } } return null; }
if (SYSTEM_ALL_REQ.equals(resource.getObjectType())) { String msg = localStrings.getLocalString("delete.concurrent.resource.notAllowed", "The {0} resource cannot be deleted as it is required to be configured in the system.", jndiName); return new ResourceStatus(ResourceStatus.FAILURE, msg);
public static ResourceInfo getGenericResourceInfo(Resource resource, String resourceName){ if(resource.getParent() != null && resource.getParent().getParent() instanceof Application){ Application application = (Application)resource.getParent().getParent(); return new ResourceInfo(resourceName, application.getName()); }else if(resource.getParent() != null && resource.getParent().getParent() instanceof Module){ Module module = (Module)resource.getParent().getParent(); Application application = (Application)module.getParent(); return new ResourceInfo(resourceName, application.getName(), module.getName()); }else{ return new ResourceInfo(resourceName); } }
public static <T> Resource getResourceByName(Resources resources, Class<T> type, String name) { Resource foundRes = null; Iterator itr = resources.getResources(type).iterator(); while (itr.hasNext()) { Resource res = (Resource)(itr.next()); String resourceName = res.getIdentity(); if (name.equals(resourceName)) { foundRes = res; break; } } // make sure that the "type" provided and the matched resource are compatible. // eg: its possible that the requested resource is "ConnectorResource", // and matching resource is "JdbcResource" as we filter based on // the generic type (in this case BindableResource) and not on exact type. if (type != null && foundRes != null && type.isAssignableFrom(foundRes.getClass())) { return foundRes; } else { return null; } } }
if (resource.getObjectType().equals("system-all") || resource.getObjectType().equals("system-instance")) { String name = null; if (resource instanceof BindableResource) {
@Override public boolean isValid(final Resource resource, final ConstraintValidatorContext constraintValidatorContext) { if(resource.getParent().getParent() instanceof Domain){ if(resource instanceof BindableResource){ if(((BindableResource)resource).getJndiName().contains(":")){ return false; } }else if(resource instanceof ResourcePool){ if(((ResourcePool)resource).getName().contains(":")){ return false; } } } return true; } }
private Resource getResourceByIdentity(String id) { for (Resource resource : domain.getResources().getResources()) { if (resource.getIdentity().equals(id)) { return resource; } } return null; }
if (resource.getObjectType().equals("system-all") || resource.getObjectType().equals("system-instance")) { String name=null; if (resource instanceof BindableResource) {
@Override public boolean isValid(final Resource resource, final ConstraintValidatorContext constraintValidatorContext) { if(resource.getParent().getParent() instanceof Domain){ if(resource instanceof BindableResource){ if(((BindableResource)resource).getJndiName().contains(":")){ return false; } }else if(resource instanceof ResourcePool){ if(((ResourcePool)resource).getName().contains(":")){ return false; } } } return true; } }
public String getNameForConfigBean(Object configBean, Class configBeanType) throws InvocationTargetException, IllegalAccessException { if (configBean instanceof Named) { Named nme = (Named) configBean; return nme.getName(); } if (configBean instanceof Resource) { Resource res = (Resource) configBean; return res.getIdentity(); } Method[] methods = configBeanType.getMethods(); for (Method method : methods) { Attribute attributeAnnotation = method.getAnnotation(Attribute.class); if ((attributeAnnotation != null) && attributeAnnotation.key()) { return (String) method.invoke(configBean); } } return null; }
if (SYSTEM_ALL_REQ.equals(resource.getObjectType())) { String msg = localStrings.getLocalString("delete.concurrent.resource.notAllowed", "The {0} resource cannot be deleted as it is required to be configured in the system.", jndiName); return new ResourceStatus(ResourceStatus.FAILURE, msg);
Object parentObject = resource.getParent().getParent(); if(parentObject instanceof Application){ applicationName = ((Application)parentObject).getName();
Level.WARNING, ResourceLoggingConstansts.UNABLE_TO_FIND_RESOURCEDEPLOYER, new Object[] { resource.getIdentity() } ); return; if (deployed && !enabledLocally) { if (logger.isLoggable(Level.FINE)) logger.fine("Undeploy resource " + resource.getIdentity()); } else if (enabledLocally) { if (logger.isLoggable(Level.FINE)) logger.fine("Deploy resource " + resource.getIdentity());