private ActionResponse executeAction(IAction action) throws CapabilityException { ActionResponse response; try { IProtocolManager protocolManager = Activator.getProtocolManagerService(); IProtocolSessionManager protocolSessionManager = protocolManager.getProtocolSessionManager(this.resourceId); response = action.execute(protocolSessionManager); } catch (ProtocolException pe) { log.error("Error with protocol session - " + pe.getMessage()); throw new CapabilityException(pe); } catch (ActivatorException ae) { String errorMsg = "Error getting protocol manager - " + ae.getMessage(); log.error(errorMsg); throw new CapabilityException(errorMsg, ae); } catch (ActionException ae) { log.error("Error executing " + action.getActionID() + " action - " + ae.getMessage()); throw (ae); } if (!response.getStatus().equals(ActionResponse.STATUS.OK)) { String errMsg = "Error executing " + action.getActionID() + " action - " + response.getInformation(); log.error(errMsg); throw new ActionException(errMsg); } return response; }
/* * (non-Javadoc) * * @see org.opennaas.core.resources.caactivatepability.AbstractCapability#activate() */ @Override public void activate() throws CapabilityException { registerService( Activator.getContext(), CAPABILITY_TYPE, getResourceType(), getResourceName(), IOpenflowForwardingCapability.class.getName()); super.activate(); }
@Override public IActionSet getActionSet() throws CapabilityException { String name = this.descriptor.getPropertyValue(ResourceDescriptorConstants.ACTION_NAME); String version = this.descriptor.getPropertyValue(ResourceDescriptorConstants.ACTION_VERSION); try { return Activator.getOpenflowForwardingActionSetService(name, version); } catch (ActivatorException e) { throw new CapabilityException(e); } }