use of org.jboss.galleon.config.ConfigId in project galleon by wildfly.
the class ProvisionedConfigXmlWriter method toElement.
protected ElementNode toElement(ProvisionedConfig config, String ns) throws XMLStreamException {
final ElementNode configE = addElement(null, Element.CONFIG.getLocalName(), ns);
if (config.getName() != null) {
addAttribute(configE, Attribute.NAME, config.getName());
}
if (config.getModel() != null) {
addAttribute(configE, Attribute.MODEL, config.getModel());
}
if (config.hasProperties()) {
final ElementNode propsE = addElement(configE, Element.PROPS.getLocalName(), ns);
for (Map.Entry<String, String> entry : config.getProperties().entrySet()) {
final ElementNode propE = addElement(propsE, Element.PROP.getLocalName(), ns);
addAttribute(propE, Attribute.NAME, entry.getKey());
addAttribute(propE, Attribute.VALUE, entry.getValue());
}
}
if (config.hasLayers()) {
final ElementNode propsE = addElement(configE, Element.LAYERS.getLocalName(), ns);
for (ConfigId layerId : config.getLayers()) {
final ElementNode propE = addElement(propsE, Element.LAYER.getLocalName(), ns);
if (layerId.getModel() != null) {
addAttribute(propE, Attribute.MODEL, layerId.getModel());
}
addAttribute(propE, Attribute.NAME, layerId.getName());
}
}
if (config.hasFeatures()) {
try {
config.handle(new XmlConfigHandler(configE));
} catch (ProvisioningException e) {
throw new XMLStreamException("Failed to marshal ProvisionedConfig", e);
}
}
return configE;
}
use of org.jboss.galleon.config.ConfigId in project galleon by wildfly.
the class ConfigXmlWriter method toElement.
protected ElementNode toElement(ConfigModel config, String ns) {
final ElementNode configE = addElement(null, Element.CONFIG.getLocalName(), ns);
if (config.getModel() != null) {
addAttribute(configE, Attribute.MODEL, config.getModel());
}
if (config.hasProperties()) {
final ElementNode propsE = addElement(configE, Element.PROPS.getLocalName(), ns);
for (Map.Entry<String, String> prop : config.getProperties().entrySet()) {
final ElementNode propE = addElement(propsE, Element.PROP.getLocalName(), ns);
addAttribute(propE, Attribute.NAME, prop.getKey());
addAttribute(propE, Attribute.VALUE, prop.getValue());
}
}
if (config.hasConfigDeps()) {
final ElementNode configDeps = addElement(configE, Element.CONFIG_DEPS.getLocalName(), ns);
for (Map.Entry<String, ConfigId> dep : config.getConfigDeps().entrySet()) {
final ElementNode configDep = addElement(configDeps, Element.CONFIG_DEP.getLocalName(), ns);
addAttribute(configDep, Attribute.ID.getLocalName(), dep.getKey());
final ConfigId configId = dep.getValue();
if (configId.getModel() != null) {
addAttribute(configDep, Attribute.MODEL.getLocalName(), configId.getModel());
}
if (configId.getName() != null) {
addAttribute(configDep, Attribute.NAME.getLocalName(), configId.getName());
}
}
}
ElementNode layers = null;
if (!config.isInheritLayers()) {
layers = addElement(configE, Element.LAYERS.getLocalName(), ns);
addAttribute(layers, Attribute.INHERIT, "false");
}
if (config.hasIncludedLayers()) {
if (layers == null) {
layers = addElement(configE, Element.LAYERS.getLocalName(), ns);
}
for (String layerDep : config.getIncludedLayers()) {
final ElementNode layer = addElement(layers, Element.INCLUDE.getLocalName(), ns);
addAttribute(layer, Attribute.NAME, layerDep);
}
}
if (config.hasExcludedLayers()) {
if (layers == null) {
layers = addElement(configE, Element.LAYERS.getLocalName(), ns);
}
for (String layerDep : config.getExcludedLayers()) {
final ElementNode layer = addElement(layers, Element.EXCLUDE.getLocalName(), ns);
addAttribute(layer, Attribute.NAME, layerDep);
}
}
FeatureGroupXmlWriter.addFeatureGroupDepBody(config, configE, ns);
return configE;
}
use of org.jboss.galleon.config.ConfigId in project galleon by wildfly.
the class State method resetConfiguration.
public void resetConfiguration(PmSession pmSession, ConfigInfo configuration) throws ProvisioningException, IOException {
ConfigId id = new ConfigId(configuration.getModel(), configuration.getName());
Action action = configProvisioning.resetConfiguration(id);
config = pushState(action, pmSession);
}
use of org.jboss.galleon.config.ConfigId in project galleon by wildfly.
the class State method addFeature.
public void addFeature(PmSession pmSession, FeatureSpecInfo spec, ConfigInfo configuration, Map<String, String> options) throws ProvisioningException, IOException {
ConfigId id = new ConfigId(configuration.getModel(), configuration.getName());
Action action = configProvisioning.addFeature(id, spec, options);
config = pushState(action, pmSession);
}
Aggregations