*/
public static CannedGroupExpressions loadCannedExpressionsFromUrl(URL pluginJarFileUrl) throws PluginContainerException {
final Log logger = LogFactory.getLog(AgentPluginDescriptorUtil.class);
if (pluginJarFileUrl == null) {
throw new PluginContainerException("A valid plugin JAR URL must be supplied.");
}
logger.debug("Loading plugin additions from plugin jar at [" + pluginJarFileUrl + "]...");
ValidationEventCollector validationEventCollector = new ValidationEventCollector();
testPluginJarIsReadable(pluginJarFileUrl);
JarInputStream jis = null;
JarEntry descriptorEntry = null;
try {
jis = new JarInputStream(pluginJarFileUrl.openStream());
JarEntry nextEntry = jis.getNextJarEntry();
while (nextEntry != null && descriptorEntry == null) {
if (CANNED_GROUP_EXPRESSION_DESCRIPTOR_PATH.equals(nextEntry.getName())) {
descriptorEntry = nextEntry;
} else {
jis.closeEntry();
nextEntry = jis.getNextJarEntry();
}
}
if (descriptorEntry == null) {
logger.debug("Plugin additions not found");
// plugin additions are optional thing
return null;
}
return parseCannedGroupExpressionsDescriptor(jis, validationEventCollector);
} catch (Exception e) {
throw new PluginContainerException("Could not parse the plugin additions ["
+ CANNED_GROUP_EXPRESSION_DESCRIPTOR_PATH + "] found in plugin jar at [" + pluginJarFileUrl + "].",
new WrappedRemotingException(e));
} finally {
if (jis != null) {
try {