Search in sources :

Example 11 with FeatureContainerPathConsumer

use of org.jboss.galleon.cli.path.FeatureContainerPathConsumer 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 FeatureContainerPathConsumer

use of org.jboss.galleon.cli.path.FeatureContainerPathConsumer in project galleon by wildfly.

the class StateResetConfigCommand method getConfiguration.

protected ConfigInfo getConfiguration(State state) throws PathParserException, PathConsumerException, ProvisioningException, Exception {
    String path = FeatureContainerPathConsumer.FINAL_CONFIGS_PATH + configuration + PathParser.PATH_SEPARATOR;
    FeatureContainerPathConsumer consumer = new FeatureContainerPathConsumer(state.getContainer(), false);
    PathParser.parse(path, consumer);
    ConfigInfo ci = consumer.getConfig();
    if (ci == null) {
        throw new ProvisioningException("Not a valid config " + configuration);
    }
    return ci;
}
Also used : FeatureContainerPathConsumer(org.jboss.galleon.cli.path.FeatureContainerPathConsumer) ProvisioningException(org.jboss.galleon.ProvisioningException) ConfigInfo(org.jboss.galleon.cli.model.ConfigInfo)

Aggregations

FeatureContainerPathConsumer (org.jboss.galleon.cli.path.FeatureContainerPathConsumer)12 ProvisioningException (org.jboss.galleon.ProvisioningException)7 Group (org.jboss.galleon.cli.model.Group)7 ConfigInfo (org.jboss.galleon.cli.model.ConfigInfo)5 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)3 FeatureContainer (org.jboss.galleon.cli.model.FeatureContainer)3 PmSession (org.jboss.galleon.cli.PmSession)2 PathConsumerException (org.jboss.galleon.cli.path.PathConsumerException)2 PathParserException (org.jboss.galleon.cli.path.PathParserException)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 FeatureInfo (org.jboss.galleon.cli.model.FeatureInfo)1 PackageInfo (org.jboss.galleon.cli.model.PackageInfo)1