if (prepareResourceForActivation(resource, container, updatedPluginConfig)) {
container.setResourceComponentState(ResourceComponentState.STARTING);
ResourceContext context;
ResourceComponent component;
try {
context = container.getResourceContext();
// Wrap the component in a proxy that will provide locking and a timeout for the call to start().
component = container.createResourceComponentProxy(ResourceComponent.class, FacetLockType.READ,
COMPONENT_START_TIMEOUT, true, false, true);
} catch (Throwable t) {
container.setResourceComponentState(ResourceComponentState.STOPPED);
throw new PluginContainerException("Failed getting proxy for resource " + resource + ".", t);
}
try {
component.start(context);
container.setResourceComponentState(ResourceComponentState.STARTED);
resource.setConnected(true); // This tells the server-side that the resource has connected successfully.
} catch (Throwable t) {
// Don't leave in a STARTING state. Don't actually call component.stop(),