Search in sources :

Example 11 with FeatureContainer

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

the class ConfigurationUtil method getConfig.

private static ConfigInfo getConfig(PmSession session, FPID fpid, String configuration) throws ProvisioningException, IOException, PathParserException, PathConsumerException {
    String path = FeatureContainerPathConsumer.FINAL_CONFIGS_PATH + configuration + PathParser.PATH_SEPARATOR;
    FeatureContainer full = FeatureContainers.fromFeaturePackId(session, fpid, null);
    ConfigInfo ci = null;
    try {
        FeatureContainerPathConsumer consumer = new FeatureContainerPathConsumer(full, false);
        PathParser.parse(path, consumer);
        ci = consumer.getConfig();
    } catch (PathParserException | PathConsumerException ex) {
    // XXX OK, return null
    }
    return ci;
}
Also used : FeatureContainerPathConsumer(org.jboss.galleon.cli.path.FeatureContainerPathConsumer) FeatureContainer(org.jboss.galleon.cli.model.FeatureContainer) PathParserException(org.jboss.galleon.cli.path.PathParserException) ConfigInfo(org.jboss.galleon.cli.model.ConfigInfo) PathConsumerException(org.jboss.galleon.cli.path.PathConsumerException)

Example 12 with FeatureContainer

use of org.jboss.galleon.cli.model.FeatureContainer 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)

Aggregations

FeatureContainer (org.jboss.galleon.cli.model.FeatureContainer)12 CommandExecutionException (org.jboss.galleon.cli.CommandExecutionException)6 ProvisioningException (org.jboss.galleon.ProvisioningException)5 FeatureContainerPathConsumer (org.jboss.galleon.cli.path.FeatureContainerPathConsumer)3 PathConsumerException (org.jboss.galleon.cli.path.PathConsumerException)3 PathParserException (org.jboss.galleon.cli.path.PathParserException)3 ProvisioningConfig (org.jboss.galleon.config.ProvisioningConfig)3 FeaturePackLayout (org.jboss.galleon.layout.FeaturePackLayout)3 IOException (java.io.IOException)2 Function (java.util.function.Function)2 ProvisioningManager (org.jboss.galleon.ProvisioningManager)2 PmSession (org.jboss.galleon.cli.PmSession)2 ProvisioningLayout (org.jboss.galleon.layout.ProvisioningLayout)2 ProvisioningRuntime (org.jboss.galleon.runtime.ProvisioningRuntime)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 ConfigInfo (org.jboss.galleon.cli.model.ConfigInfo)1 Group (org.jboss.galleon.cli.model.Group)1 FeaturePackConfig (org.jboss.galleon.config.FeaturePackConfig)1 FeaturePackRuntime (org.jboss.galleon.runtime.FeaturePackRuntime)1