assignedCap.setRoles(new ArrayList(org.getOrganizationPG().getRoles()));
Collection roles =  org.getOrganizationPG().getRoles(); if (roles != null) { assignedCap.setRoles(new ArrayList(roles)); }
  protected void ParsePrototypeFile(String clusterId, String relationship) {    // Use the same domainname for all org assets now    String uic = "";    String className = "";    String unitName = null;    String dataItem = "";    Organization org = null;    int newVal;    String filename = clusterId + "-prototype-ini.dat";    BufferedReader input = null;    Reader fileStream = null;    try {      fileStream =         new InputStreamReader(getConfigFinder().open(filename));      input = new BufferedReader(fileStream);      StreamTokenizer tokens = new StreamTokenizer(input);      tokens.commentChar('#');      tokens.wordChars('[', ']');      tokens.wordChars('_', '_');      tokens.wordChars('<', '>');            tokens.wordChars('/', '/');            tokens.ordinaryChars('0', '9');            tokens.wordChars('0', '9');            newVal = tokens.nextToken();      // Parse the prototype-ini file      while (newVal != StreamTokenizer.TT_EOF) {          if (tokens.ttype == StreamTokenizer.TT_WORD) {            dataItem = tokens.sval;            if (dataItem.equals("[Prototype]")) {              tokens.nextToken();              className = tokens.sval;              newVal = tokens.nextToken();            } else if (dataItem.equals("[UniqueId]")) {              tokens.nextToken();              // Dont use unique-id as domain name anymore, just skip it              //utc = tokens.sval;              newVal = tokens.nextToken();            } else if (dataItem.equals("[UnitName]")) {              // This field is optional               tokens.nextToken();              unitName = tokens.sval;              newVal = tokens.nextToken();            } else if (dataItem.equals("[UIC]")) {              if (className != null) {                tokens.nextToken();	      	uic = tokens.sval;		// This is a silly fix to a dumb bug		if (!uic.startsWith("UIC/")) {		  uic = "UIC/" + uic;		}                org = (Organization)getFactory().createAsset("Organization");                org.initRelationshipSchedule();                org.setLocal(false);                NewTypeIdentificationPG typeIdPG =                   (NewTypeIdentificationPG)org.getTypeIdentificationPG();                typeIdPG.setTypeIdentification(UTC);	      	NewItemIdentificationPG itemIdPG =                   (NewItemIdentificationPG)org.getItemIdentificationPG();                itemIdPG.setItemIdentification(uic);	      	// Use unitName if it occurred, else use clusterId		if (unitName!=null) {                  itemIdPG.setNomenclature(unitName);		} else {                  itemIdPG.setNomenclature(clusterId);	      	}		itemIdPG.setAlternateItemIdentification(clusterId);                NewClusterPG cpg = (NewClusterPG) org.getClusterPG();                cpg.setClusterIdentifier(ClusterIdentifier.getClusterIdentifier(clusterId));                CommunityPGImpl communityPG =                   (CommunityPGImpl)getFactory().createPropertyGroup(CommunityPGImpl.class);                // add in default community                ArrayList communities = new ArrayList(1);                communities.add("COUGAAR");                communityPG.setCommunities(communities);                communityPG.setTimeSpan(DEFAULT_START_TIME, DEFAULT_END_TIME);                org.getCommunityPGSchedule().add(communityPG);                              } else {                System.err.println("OrgRTDataPlugIn Error: [Prototype] value is null");              }              newVal = tokens.nextToken();            } else if (dataItem.equals("[Relationship]")) {              newVal = FillOrganizationVector(org, newVal, tokens, relationship);              // ADDED BY TOPS            } else if (dataItem.equals("[AssignmentPG]")) {              newVal = setAssignmentForOrganization(org, dataItem, newVal, tokens);              // END ADDED BY TOPS            } else if (dataItem.substring(0,1).equals("[")) {              // We've got a property or capability              newVal = setPropertyForOrganization(org, dataItem, newVal, tokens);            } else {              // if The token you read is not one of the valid              // choices from above              System.err.println("OrgRTDataPlugIn Incorrect token: " + dataItem);            }          } else {            throw new RuntimeException("Format error in \""+filename+"\".");          }      }      // For each organization, the following code sets      // CapableRoles and Relationship slots for the      // AssignedPG property      // It adds the property to the organization and      // adds the organization to ccv2 collections      NewAssignedPG assignedCap = (NewAssignedPG)getFactory().createPropertyGroup(AssignedPGImpl.class);      assignedCap.setRoles(new ArrayList(org.getOrganizationPG().getRoles()));      org.setAssignedPG(assignedCap);            // set up this asset's available schedule      myCalendar.set(1990, 0, 1, 0, 0, 0);      Date start = myCalendar.getTime();      // set the end date of the available schedule to 01/01/2010      myCalendar.set(2010, 0, 1, 0, 0, 0);      Date end = myCalendar.getTime();      NewSchedule availsched = getFactory().newSimpleSchedule(start, end);      // set the available schedule      ((NewRoleSchedule)org.getRoleSchedule()).setAvailableSchedule(availsched);      if (relationship.equals(GLMRelationship.SELF)) {        Relationship selfRelationship =           getFactory().newRelationship(Constants.Role.SELF, org, org,                                       ETERNITY);          org.getRelationshipSchedule().add(selfRelationship);        org.setLocal(true);        publish(org);      	selfOrg = org;      }       // Closing BufferedReader      if (input != null)	input.close();      //only generates a NoSuchMethodException for AssetSkeleton because of a coding error      //if we are successul in creating it here  it then the AssetSkeletomn will end up with two copies      //the add/search criteria in AssetSkeleton is for a Vecotr and does not gurantee only one instance of       //each class.  Thus the Org allocator plugin fails to recognixe the correct set of cpabilities.          } catch (Exception e) {      e.printStackTrace();    }  } 