Class ResourceUtilities


  • public class ResourceUtilities
    extends Object
    A class that holds utility/helper routines. Expected to contain static methods to perform utility operations.
    Since:
    Appserver 9.0
    • Method Detail

      • getResourceConfigConflicts

        public static Set<Resource> getResourceConfigConflicts​(Set<Resource> resSet,
                                                               Resources resources)
        Checks if any of the Resource in the given set has a conflict with resource definitions in the domain.xml. A conflict is defined based on the type of the resource. For example, a JDBC Resource has "jndi-name" that is the identifying key where as for a JDBC Connection Pool, it is the "name" that must be unique.
        Parameters:
        resSet - a Set of Resource elements.
        resources - instance of ConfigContext that you want to confirm this against. May not be null.
        Returns:
        a Set of Resource elements that contains conflicting elements from the given Set. This method does not create any Resource elements. It just references an element in conflict from a Set that is returned. If there are no conflicts, an empty Set is returned. This method never returns a null. If the given Set is null, an empty Set is returned.
      • resolveResourceDuplicatesConflictsWithinArchive

        public static Set<Resource> resolveResourceDuplicatesConflictsWithinArchive​(List<SunResourcesXML> sunResList)
                                                                             throws ResourceConflictException
        Resolves all duplicates and conflicts within an archive and returns a set of resources that needs to be created for the archive being deployed. The deployment backend would then use these set of resources to check for conflicts with resources existing in domain.xml and then continue with deployment. All resource duplicates within an archive found are flagged with a WARNING and only one resource is added in the final Resource Set returned. We currently do not handle any resource conflicts found within the archive and the method throws an exception when this condition is detected.
        Parameters:
        sunResList - a list of SunResourcesXML corresponding to sun-resources.xml found within an archive.
        Returns:
        a Set of Resources that have been resolved of duplicates and conflicts.
        Throws:
        org.glassfish.resources.api.ResourceConflictException - an exception is thrown when an archive is found to have two or more resources that conflict with each other.
        ResourceConflictException
      • getResourceConflictsWithDomainXML

        public static void getResourceConflictsWithDomainXML​(List<Resource> resList,
                                                             Resources resources)
                                                      throws ResourceConflictException
        Checks if any of the Resource in the given set has a conflict with resource definitions in the domain.xml. A conflict is defined based on the type of the resource. For example, a JDBC Resource has "jndi-name" that is the identifying key where as for a JDBC Connection Pool, it is the "name" that must be unique.
        Parameters:
        resList - a Set of Resource elements.
        resources - all resources from domain.xml
        Throws:
        org.glassfish.resources.api.ResourceConflictException - an exception is thrown when an archive is found to have two or more resources that conflict with resources already present in domain.xml.
        ResourceConflictException