Search in sources :

Example 1 with TargetException

use of javax.enterprise.deploy.spi.exceptions.TargetException in project Payara by payara.

the class SunDeploymentManager method getModules.

/**
 *Get all modules in the specified state from the targets specified in the
 *     argument list.
 *@param moduleType which returned modules must match
 *@param array of Target indicating which targets should be searched for matching modules
 *@param state state of the modules
 *have for the indicated attribute to be matched
 *@exception TargetException if a target was improperly formed
 *@exception IllegalStateException if the method is called after release was called
 */
private TargetModuleID[] getModules(ModuleType moduleType, Target[] targetList, String state) throws TargetException, IllegalStateException {
    verifyConnected();
    if (moduleType == null) {
        return null;
    }
    try {
        Vector resultingTMIDs = new Vector();
        for (int i = 0; i < targetList.length; i++) {
            TargetImpl aTarget = (TargetImpl) targetList[i];
            TargetModuleID[] tmids = deploymentFacility._listAppRefs(new Target[] { aTarget }, state, getTypeFromModuleType(moduleType));
            addToTargetModuleIDs(tmids, moduleType, aTarget, resultingTMIDs);
        }
        /*
             *Return an array of runtime type TargetModuleIDImpl [].
             */
        TargetModuleID[] answer = (TargetModuleID[]) resultingTMIDs.toArray(new TargetModuleIDImpl[resultingTMIDs.size()]);
        return answer;
    } catch (Exception e) {
        TargetException tg = new TargetException(localStrings.getLocalString("enterprise.deployapi.spi.errorgetreqmods", "Error getting required modules"));
        tg.initCause(e);
        throw tg;
    }
}
Also used : TargetException(javax.enterprise.deploy.spi.exceptions.TargetException) TargetModuleID(javax.enterprise.deploy.spi.TargetModuleID) Vector(java.util.Vector) DConfigBeanVersionUnsupportedException(javax.enterprise.deploy.spi.exceptions.DConfigBeanVersionUnsupportedException) ConfigurationException(javax.enterprise.deploy.spi.exceptions.ConfigurationException) TargetException(javax.enterprise.deploy.spi.exceptions.TargetException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) InvalidModuleException(javax.enterprise.deploy.spi.exceptions.InvalidModuleException)

Aggregations

IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 Vector (java.util.Vector)1 TargetModuleID (javax.enterprise.deploy.spi.TargetModuleID)1 ConfigurationException (javax.enterprise.deploy.spi.exceptions.ConfigurationException)1 DConfigBeanVersionUnsupportedException (javax.enterprise.deploy.spi.exceptions.DConfigBeanVersionUnsupportedException)1 InvalidModuleException (javax.enterprise.deploy.spi.exceptions.InvalidModuleException)1 TargetException (javax.enterprise.deploy.spi.exceptions.TargetException)1