Example #1
0
  void setRequirements(List<Requirement> requirements) {
    allRequirements = requirements;

    requirementMap = new HashMap<String, List<Requirement>>();
    for (Requirement requirement : requirements) {
      List<Requirement> list = requirementMap.get(requirement.getNamespace());
      if (list == null) {
        list = new LinkedList<Requirement>();
        requirementMap.put(requirement.getNamespace(), list);
      }
      list.add(requirement);
    }
  }
Example #2
0
  void setCapabilities(List<Capability> capabilities) {
    allCapabilities = capabilities;

    capabilityMap = new HashMap<String, List<Capability>>();
    for (Capability capability : capabilities) {
      List<Capability> list = capabilityMap.get(capability.getNamespace());
      if (list == null) {
        list = new LinkedList<Capability>();
        capabilityMap.put(capability.getNamespace(), list);
      }
      list.add(capability);
    }
  }
Example #3
0
  @Override
  public String toString() {
    final StringBuilder builder = new StringBuilder();
    List<Capability> identities = getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE);
    if (identities != null && identities.size() == 1) {
      Capability idCap = identities.get(0);
      Object id = idCap.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE);
      Object version = idCap.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);

      builder.append(id).append(" ver=").append(version);
    } else {
      // Generic toString
      builder.append("ResourceImpl [caps=");
      builder.append(allCapabilities);
      builder.append(", reqs=");
      builder.append(allRequirements);
      builder.append("]");
    }
    return builder.toString();
  }