in taverna-plugin-impl/src/main/java/org/apache/taverna/plugin/impl/PluginImpl.java [99:128]
public void start() throws PluginException {
if (state == STARTED) {
return;
}
if (state == UNINSTALLED) {
throw new PluginException("Cannot start an uninstalled plugin");
}
List<Bundle> startedBundles = new ArrayList<Bundle>();
for (Bundle bundle : getBundles()) {
if (bundle.getHeaders().get(Constants.FRAGMENT_HOST) == null) {
if (bundle.getState() != Bundle.ACTIVE) {
try {
bundle.start();
startedBundles.add(bundle);
} catch (BundleException e) {
// clean up by stopping bundles already started
for (Bundle startedBundle : startedBundles) {
try {
startedBundle.stop();
} catch (BundleException ex) {
logger.warn("Error unistalling bundle", ex);
}
}
throw new PluginException(String.format("Error starting bundle %1$s",
bundle.getSymbolicName()), e);
}
}
}
}
}