use of org.jboss.galleon.cli.path.PathParserException in project galleon by wildfly.
the class AbstractPackageCommand method getProducer.
@Override
public ProducerSpec getProducer(PmSession session) throws CommandExecutionException {
if (pkg == null) {
throw new CommandExecutionException("No package set.");
}
String fullpath = FeatureContainerPathConsumer.PACKAGES_PATH + pkg;
FeatureContainerPathConsumer consumer = new FeatureContainerPathConsumer(new AllPackagesContainer(session.getState().getContainer()), false);
try {
PathParser.parse(fullpath, consumer);
Group grp = consumer.getCurrentNode(fullpath);
if (grp == null) {
throw new CommandExecutionException("Invalid package " + pkg);
}
PackageInfo info = grp.getPackage();
if (info == null) {
throw new CommandExecutionException("Invalid package " + pkg);
}
return info.getFPID().getProducer();
} catch (PathParserException | PathConsumerException ex) {
throw new CommandExecutionException(session, CliErrors.retrieveProducerFailed(), ex);
}
}
use of org.jboss.galleon.cli.path.PathParserException 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;
}
Aggregations