/* (non-Javadoc) * @see eu.planets_project.tb.api.services.TestbedServiceTemplate#getAllServiceOperationsByType(java.lang.String) */ public List<ServiceOperation> getAllServiceOperationsByType(String serviceOperationType) { List<ServiceOperation> ret = new Vector<ServiceOperation>(); Iterator<ServiceOperation> operations = getAllServiceOperations().iterator(); while (operations.hasNext()) { ServiceOperation operation = operations.next(); if (operation.getServiceOperationType().equals(serviceOperationType)) ret.add(operation); } return ret; }
public void addServiceOperation( String sOperationName, String xmlRequestTemplate, String xpathtoOutput) { if ((sOperationName != null) && (xmlRequestTemplate != null) && (xpathtoOutput != null)) { ServiceOperation op = new ServiceOperationImpl(xmlRequestTemplate, xpathtoOutput); op.setName(sOperationName); // now add this service operation addServiceOperation(op); } }
/* (non-Javadoc) * @see eu.planets.test.backend.api.model.mockup.TestbedService#getServiceOperation(java.lang.String) */ public ServiceOperation getServiceOperation(String sName) { if (sName != null) { if (this.getAllServiceOperationNames().contains(sName)) { Iterator<ServiceOperation> it = this.getAllServiceOperations().iterator(); while (it.hasNext()) { ServiceOperation op = it.next(); if (op.getName().equals(sName)) { return op; } } } } // else return null; }
protected void createServiceDescription() { List<Operation> opList = new ArrayList<Operation>(); for (Method operation : this.getClass().getMethods()) { if (operation.getAnnotation(ServiceOperation.class) != null) { ServiceOperation serviceOperation = operation.getAnnotation(ServiceOperation.class); Operation op = new Operation( operation.getName(), operation.getParameterTypes(), operation.getReturnType().getName()); op.setOpCost(serviceOperation.OperationCost()); opList.add(op); } } description.setOperationList(opList); description.setServiceType(this.getClass().getSimpleName()); }
/* (non-Javadoc) * @see eu.planets.test.backend.api.model.mockup.TestbedService#removeServiceOperation(java.lang.String) */ public void removeServiceOperation(String sOperationName) { if (sOperationName != null) { if (this.getAllServiceOperationNames().contains(sOperationName)) { Iterator<ServiceOperation> it = this.getAllServiceOperations().iterator(); boolean bFound = false; ServiceOperation opRet = null; while (it.hasNext()) { ServiceOperation op = it.next(); if (op.getName().equals(sOperationName)) { opRet = op; bFound = true; } } if (bFound) { this.lAllRegisteredServiceOperations.remove(opRet); } } } }