use of org.codehaus.plexus.interpolation.MapBasedValueSource in project maven-plugins by apache.
the class GenerateApplicationXmlMojo method buildEjbEntries.
/**
* Builds the ejb-ref based on the configuration.
*
* @return a list of EjbRef object(s)
* @throws EarPluginException if the configuration is invalid
*/
private List<EjbRef> buildEjbEntries() throws EarPluginException {
final List<EjbRef> result = new ArrayList<EjbRef>();
if (ejbRefs == null) {
return result;
}
try {
StringSearchInterpolator ssi = new StringSearchInterpolator();
ValueSource vs = new MapBasedValueSource(project.getProperties());
ssi.addValueSource(vs);
final PlexusConfiguration[] allEjbEntries = ejbRefs.getChildren(EjbRef.EJB_REF);
for (PlexusConfiguration ejbEntry : allEjbEntries) {
// CHECKSTYLE_OFF: LineLength
final String childDescription = interpolate(ssi, ejbEntry.getChild(EnvEntry.DESCRIPTION).getValue());
final String childEjbEntryName = interpolate(ssi, ejbEntry.getChild(EjbRef.EJB_NAME).getValue());
final String childEjbEntryType = interpolate(ssi, ejbEntry.getChild(EjbRef.EJB_TYPE).getValue());
final String childEjbLookupNameValue = interpolate(ssi, ejbEntry.getChild(EjbRef.EJB_LOOKUP_NAME).getValue());
try {
result.add(new EjbRef(childDescription, childEjbEntryName, childEjbEntryType, childEjbLookupNameValue));
} catch (IllegalArgumentException e) {
throw new EarPluginException("Invalid ejb-ref [" + ejbEntry + "]", e);
}
}
return result;
} catch (InterpolationException e) {
throw new EarPluginException("Interpolation exception:", e);
}
}
use of org.codehaus.plexus.interpolation.MapBasedValueSource in project maven-plugins by apache.
the class GenerateApplicationXmlMojo method buildResourceRefs.
/**
* Builds the <code>resource-ref</code> based on the configuration.
*
* @return a list of ResourceRef object(s)
* @throws EarPluginException if the configuration is invalid
*/
private List<ResourceRef> buildResourceRefs() throws EarPluginException {
final List<ResourceRef> result = new ArrayList<ResourceRef>();
if (resourceRefs == null) {
return result;
}
try {
getLog().debug("Resources found");
StringSearchInterpolator ssi = new StringSearchInterpolator();
ValueSource vs = new MapBasedValueSource(project.getProperties());
ssi.addValueSource(vs);
// TODO: Check if this is a good idea hard code that here? Better idea?
final PlexusConfiguration[] allResourceRefEntries = resourceRefs.getChildren("resourceRef");
getLog().debug("allResourceRefEntries: " + allResourceRefEntries);
getLog().debug("allResourceRefEntries length: " + allResourceRefEntries.length);
for (PlexusConfiguration resEntry : allResourceRefEntries) {
getLog().debug("Resources resEntry:" + resEntry.getName());
// CHECKSTYLE_OFF: LineLength
final String childResRefName = interpolate(ssi, resEntry.getChild(ResourceRef.RESOURCE_REF_NAME).getValue());
final String childResType = interpolate(ssi, resEntry.getChild(ResourceRef.RESOURCE_TYPE).getValue());
final String childResRefAuth = interpolate(ssi, resEntry.getChild(ResourceRef.RESOURCE_AUTH).getValue());
try {
result.add(new ResourceRef(childResRefName, childResType, childResRefAuth));
} catch (IllegalArgumentException e) {
throw new EarPluginException("Invalid resource-ref [" + resEntry + "]", e);
}
}
return result;
} catch (InterpolationException e) {
throw new EarPluginException("Interpolation exception:", e);
}
}
Aggregations