Package eu.planets_project.tb.api.services

Examples of eu.planets_project.tb.api.services.TestbedServiceTemplate


      this.sSelSerOperationName = null;
    }

    public ServiceOperation getSelectedServiceOperation(){
      if( this.selSerTemplate != null ) {
        TestbedServiceTemplate template = this.getSelectedServiceTemplate();
        List<String> allOpNames = template.getAllServiceOperationNames();
        String selOpName = this.getSelectedServiceOperationName();
        //template contains no operations
        if(allOpNames.size()==0)
          return null;
        //template is being changed - select first op as selected
        if(!allOpNames.contains(selOpName)){
          this.setSelectedServiceOperationName(allOpNames.iterator().next());
        }
       
        return template.getServiceOperation(this.getSelectedServiceOperationName());
      }
      return null;
    }
View Full Code Here


      //test if at least one template exists
      if((templates!=null)&&(templates.size()>0)){
        //add data for rendering
      Iterator<TestbedServiceTemplate> itTemplates = templates.iterator();
      while(itTemplates.hasNext()){
        TestbedServiceTemplate template = itTemplates.next();
        //use the deployment date to extend the service name for selection
        String format = "yyyy-MM-dd HH:mm:ss";
        String date = doFormat(format, template.getDeploymentDate());
        ret.put(template.getName()+" - "+date+" - "+template.getDescription(),String.valueOf(template.getUUID()));
      }
     
      //only triggered for the first time
      if(expBean.getSelectedServiceTemplate()==null){
        expBean.setSelServiceTemplateID(ret.values().iterator().next());
View Full Code Here

     * @return
     */
    public Map<String,String> getAllAvailableServiceOperations(){
      TreeMap<String,String> ret = new TreeMap<String,String>();
      ExperimentBean expBean = (ExperimentBean)JSFUtil.getManagedObject("ExperimentBean");
      TestbedServiceTemplate template = expBean.getSelectedServiceTemplate();
      //log.debug("Looking up service operations for template: "+template);
      if(template!=null){
            log.debug("Looking for services of type: "+expBean.getEtype());
        List<ServiceOperation> lOperations = null;
          //simple migration experiment
          if(expBean.getEtype().equals("experimentType.simpleMigration")){
            //mapping between operationTypeID and experiment type ID
            lOperations = template.getAllServiceOperationsByType(
                TestbedServiceTemplate.ServiceOperation.SERVICE_OPERATION_TYPE_MIGRATION
                );
          }
           //simple characterisation experiment
          if(expBean.getEtype().equals("experimentType.simpleCharacterisation")){
            lOperations = template.getAllServiceOperationsByType(
                TestbedServiceTemplate.ServiceOperation.SERVICE_OPERATION_TYPE_CHARACTERISATION
                );
          }
         
          if(lOperations!=null){
View Full Code Here

     * ServiceOperations and select the first one in the list
     */
    private void reloadOperations(){
      ExperimentBean expBean = (ExperimentBean)JSFUtil.getManagedObject("ExperimentBean");
      List<ServiceOperation> lOperations = new Vector<ServiceOperation>();
      TestbedServiceTemplate template = expBean.getSelectedServiceTemplate();
     
      if(expBean.getEtype().equals("experimentType.simpleMigration")){
        //mapping between operationTypeID and experiment type ID
        lOperations = template.getAllServiceOperationsByType(
            TestbedServiceTemplate.ServiceOperation.SERVICE_OPERATION_TYPE_MIGRATION
            );
      }
       //simple characterisation experiment
      if(expBean.getEtype().equals("experimentType.simpleCharacterisation")){
        lOperations = template.getAllServiceOperationsByType(
            TestbedServiceTemplate.ServiceOperation.SERVICE_OPERATION_TYPE_CHARACTERISATION
            );
      }

      if((lOperations!=null)&&(lOperations.size()>0)){
View Full Code Here

      if((templates!=null)&&(templates.size()>0)){
        Iterator<TestbedServiceTemplate> itTemplates = templates.iterator();
        //iterate over all templates
        while(itTemplates.hasNext()){
          //the current template: iterate over all Serviceperations
          TestbedServiceTemplate template = itTemplates.next();
          //build new child node containing a serviceTemplate
          TreeNodeBase nodeServiceTemplate = new TreeNodeBase("TBServiceTemplate",template.getName()+": "+template.getDescription(),template.getUUID(),false);
         
          //addServiceTemplate properties
          nodeServiceTemplate.getChildren().add(new TreeNodeBase("Description",template.getDescription(),true));
          nodeServiceTemplate.getChildren().add(new TreeNodeBase("Endpoint",template.getEndpoint(),true));
          nodeServiceTemplate.getChildren().add(new TreeNodeBase("WSDLContent",template.getWSDLContent(),true));
          nodeServiceTemplate.getChildren().add(new TreeNodeBase("UUID",template.getUUID(),true));
          nodeServiceTemplate.getChildren().add(new TreeNodeBase("DeploymentDate",template.getDeploymentDate().getTime()+"",true));
         
          Collection<ServiceTag> tags = template.getAllTags();
          if((tags!=null)&&(tags.size()>0)){
            Iterator<ServiceTag> itTags = tags.iterator();
            while(itTags.hasNext()){
              ServiceTag tag = itTags.next();
              TreeNodeBase nodeTag = new TreeNodeBase("Tag",tag.getName(),tag.getName(),false);
              nodeTag.getChildren().add(new TreeNodeBase("TagValue",tag.getValue(),true));
              nodeTag.getChildren().add(new TreeNodeBase("TagDescription",tag.getDescription(),true));
              nodeTag.getChildren().add(new TreeNodeBase("TagPriority",tag.getPriority()+"",true));
             
              //add to serviceTemplate node
              nodeServiceTemplate.getChildren().add(nodeTag);
            }
          }
         
          Collection<ServiceOperation> operations = template.getAllServiceOperations();
          if((operations!=null)&&(operations.size()>0)){
            //Iterate over all serviceOperations
            Iterator<ServiceOperation> itOperations = operations.iterator();
            while(itOperations.hasNext()){
              ServiceOperation operation = itOperations.next();
View Full Code Here

    Set<Entry<String,TestbedServiceTemplate>> setRet = new HashSet<Entry<String,TestbedServiceTemplate>>();
   
    Iterator<Entry<String,TestbedServiceTemplate>> it = setUUIDAndService.iterator();
    while(it.hasNext()){
      Entry<String,TestbedServiceTemplate> entry = it.next();
      TestbedServiceTemplate service = entry.getValue();
      Map<String,TestbedServiceTemplate> mapHelper = new HashMap<String,TestbedServiceTemplate>();
      //now put ServiceName and TestbedService as return value
      mapHelper.put(service.getName(), service);
      Iterator<Entry<String,TestbedServiceTemplate>> entryret = mapHelper.entrySet().iterator();
      setRet.add(entryret.next());
    }
   
    return setRet;
View Full Code Here

  public Collection<TestbedServiceTemplate> getAllServicesWithType(String serviceOperationType){
    Collection<TestbedServiceTemplate> ret = new Vector<TestbedServiceTemplate>();
    Iterator<String> itIDs = this.hm_AllServices.keySet().iterator();
    while(itIDs.hasNext()){
      String id = itIDs.next();
      TestbedServiceTemplate template = this.hm_AllServices.get(id);
      Iterator<ServiceOperation> operations = template.getAllServiceOperations().iterator();
      boolean bFound = false;
      while(operations.hasNext()){
        ServiceOperation operation = operations.next();
        if(operation.getServiceOperationType().equals(serviceOperationType))
          bFound = true;
View Full Code Here

   */
  public TestbedServiceTemplate getServiceByWSDLContent(String sWSDLContent){
    if(sWSDLContent!=null){
      Iterator<TestbedServiceTemplate> it = this.getAllServices().iterator();
      while(it.hasNext()){
        TestbedServiceTemplate tbService = it.next();
        String content = tbService.getWSDLContent();
        if((content!=null)&&(sWSDLContent.equals(content))){
          return tbService;
        }
      }
    }
View Full Code Here

  public Map<String, TestbedServiceTemplate> getAllTBServiceIDAndTemplates() {
    Query query = manager.createQuery("from TestbedServiceTemplateImpl where discr='template'");
    Iterator<TestbedServiceTemplate> itTemplates = query.getResultList().iterator();
    Map<String, TestbedServiceTemplate> ret = new HashMap<String, TestbedServiceTemplate>();
    while(itTemplates.hasNext()){
      TestbedServiceTemplate template = itTemplates.next();
      ret.put(template.getUUID(),template);
    }
    return ret;
  }
View Full Code Here

    Iterator<TestbedServiceTemplate> itTemplates = query.getResultList().iterator();
    Map<String, List<ServiceTag>> ret = new HashMap<String, List<ServiceTag>>();
   
    while(itTemplates.hasNext()){
      List<ServiceTag> tags = new Vector<ServiceTag>();
      TestbedServiceTemplate template = itTemplates.next();
      tags.addAll(template.getAllTags());
      ret.put(template.getUUID(),tags);
    }
    return ret;
  }
View Full Code Here

TOP

Related Classes of eu.planets_project.tb.api.services.TestbedServiceTemplate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.