Search in sources :

Example 11 with Group

use of org.jboss.galleon.cli.model.Group in project galleon by wildfly.

the class PackagesUtil method getPackage.

public static String getPackage(PmSession session, FeaturePackLocation.FPID fpid, String pkg) throws PathParserException, PathConsumerException, ProvisioningException, Exception {
    String path = FeatureContainerPathConsumer.PACKAGES_PATH + pkg + (pkg.endsWith("" + PathParser.PATH_SEPARATOR) ? "" : PathParser.PATH_SEPARATOR);
    FeatureContainer full = FeatureContainers.fromFeaturePackId(session, fpid, null);
    FeatureContainerPathConsumer consumer = new FeatureContainerPathConsumer(full, false);
    PathParser.parse(path, consumer);
    Group grp = consumer.getCurrentNode(path);
    if (grp == null || grp.getPackage() == null) {
        throw new ProvisioningException("Not a valid package " + pkg);
    }
    return grp.getPackage().getSpec().getName();
}
Also used : FeatureContainerPathConsumer(org.jboss.galleon.cli.path.FeatureContainerPathConsumer) Group(org.jboss.galleon.cli.model.Group) ProvisioningException(org.jboss.galleon.ProvisioningException) FeatureContainer(org.jboss.galleon.cli.model.FeatureContainer)

Example 12 with Group

use of org.jboss.galleon.cli.model.Group in project galleon by wildfly.

the class FeatureContainerPathConsumer method enterFeaturesContent.

private void enterFeaturesContent(PathParser.Node node) throws PathConsumerException {
    Group next = null;
    if (current == null) {
        current = info.getFeatureSpecs().get(featuresGav);
        if (current == null) {
            throw new PathConsumerException("no feature in " + featuresGav);
        }
    }
    for (Group info : current.getGroups()) {
        if (info.getIdentity().getName().equals(node.getName())) {
            next = info;
            break;
        }
    }
    if (next == null) {
        if (completion) {
            if (inError) {
                throw new PathConsumerException("no node for name " + node.getName());
            } else {
                inError = true;
            }
        } else {
            throw new PathConsumerException("no node for name " + node.getName());
        }
    } else {
        current = next;
    }
    featuresGav = null;
}
Also used : Group(org.jboss.galleon.cli.model.Group)

Aggregations

Group (org.jboss.galleon.cli.model.Group)12 FeatureContainerPathConsumer (org.jboss.galleon.cli.path.FeatureContainerPathConsumer)7 ProvisioningException (org.jboss.galleon.ProvisioningException)4 PackageInfo (org.jboss.galleon.cli.model.PackageInfo)4 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)3 FeatureInfo (org.jboss.galleon.cli.model.FeatureInfo)2 Identity (org.jboss.galleon.cli.model.Identity)2 ResolvedSpecId (org.jboss.galleon.runtime.ResolvedSpecId)2 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 List (java.util.List)1 PmSession (org.jboss.galleon.cli.PmSession)1 ConfigInfo (org.jboss.galleon.cli.model.ConfigInfo)1 FeatureContainer (org.jboss.galleon.cli.model.FeatureContainer)1 FeatureSpecInfo (org.jboss.galleon.cli.model.FeatureSpecInfo)1 PathConsumerException (org.jboss.galleon.cli.path.PathConsumerException)1 PathParserException (org.jboss.galleon.cli.path.PathParserException)1