コード例 #1
0
  /* (non-Javadoc)
   * @see eu.planets_project.tb.api.services.TestbedServiceTemplate#getTag(java.lang.String)
   */
  public ServiceTag getTag(String sTagName) {
    if (sTagName != null) {
      Iterator<ServiceTagImpl> tags = this.lTags.iterator();

      while (tags.hasNext()) {
        ServiceTag tagit = tags.next();
        // Tag was found, as TagName only may exist once
        if (tagit.getName().equals(sTagName)) {
          return tagit;
        }
      }
    }
    return null;
  }
コード例 #2
0
 /* (non-Javadoc)
  * @see eu.planets_project.tb.api.services.TestbedServiceTemplate#removeTag(java.lang.String)
  */
 public void removeTag(String sTagName) {
   if (sTagName != null) {
     Iterator<ServiceTagImpl> tags = this.lTags.iterator();
     boolean bFound = false;
     ServiceTag bFoundTag = null;
     while (tags.hasNext()) {
       ServiceTag tagit = tags.next();
       // Tag to replace was found
       if (tagit.getName().equals(sTagName)) {
         bFound = true;
         bFoundTag = tagit;
       }
     }
     // remove the old item
     if (bFound) {
       this.lTags.remove(bFoundTag);
     }
   }
 }
コード例 #3
0
  /* (non-Javadoc)
   * @see eu.planets_project.tb.api.services.TestbedServiceTemplate#addTag(eu.planets_project.tb.api.services.TestbedServiceTemplate.ServiceTag)
   */
  public void addTag(ServiceTag tag) {
    if (tag != null) {

      // try to remove a previous tag with the same name
      this.removeTag(tag.getName());

      // add the new item
      this.lTags.add((ServiceTagImpl) tag);
    }
  }