Skip to content

Instantly share code, notes, and snippets.

@i386
Created April 19, 2012 02:09
Show Gist options
  • Save i386/2417878 to your computer and use it in GitHub Desktop.
Save i386/2417878 to your computer and use it in GitHub Desktop.
private void initialiseTaskExecutables(final Plugin plugin, final Element element)
{
@SuppressWarnings({"unchecked"})
final List<Element> executableElements = element.elements("executable");
if (executableElements != null && !executableElements.isEmpty())
{
final Element executableElement = Iterables.getFirst(executableElements, null);
if (executableElement != null)
{
final Attribute key = executableElement.attribute("key");
if (key != null && StringUtils.isNotEmpty(key.getValue()))
{
final Attribute nameKey = executableElement.attribute("nameKey");
final Attribute pathHelpKey = executableElement.attribute("pathHelpKey");
final Attribute primaryCapabilityProvider = executableElement.attribute("primaryCapabilityProvider");
taskExecutables.add(new TaskExecutableTypeImpl(key, nameKey, pathHelpKey, primaryCapabilityProvider));
}
else
{
log.warn("Task Type Module (" + getKey() + ") of plugin " + plugin.getKey()
+ " contains an incorrectly configured 'executable'"
+ " element. Please use the 'key' attribute to define your"
+ " unique executable key");
}
}
if (executableElements.size() > 1)
{
log.warn("Task Type Module (" + getKey() + ") of plugin " + plugin.getKey() + " specifies more than one 'executable' element which is not supported at this time");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment