aad.setType(AgentAssetData.ORG);
  private AgentAssetData parsePrototypeFile(String agentName) {    String filename = agentName + "-prototype-ini.dat";    // Use the same domainname for all org assets now    String uic = "";    String className = "";    String unitName = null;    String dataItem = "";    int newVal;    BufferedReader input = null;    Reader fileStream = null;    AgentAssetData aad = new AgentAssetData(null);    aad.setType(AgentAssetData.ORG);    try {      fileStream =         new InputStreamReader(ConfigFinder.getInstance().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;              aad.setAssetClass(className);              if(log.isDebugEnabled()) {                log.debug("AgentAssetData Class: " + aad.getAssetClass());              }              newVal = tokens.nextToken();            } else if (dataItem.equals("[UniqueId]")) {              tokens.nextToken();              aad.setUniqueID(tokens.sval);              if(log.isDebugEnabled()) {                log.debug("AgentAssetData UniqueID: " + aad.getUniqueID());              }              newVal = tokens.nextToken();            } else if (dataItem.equals("[UnitName]")) {              // This field is optional               tokens.nextToken();              aad.setUnitName(tokens.sval);              if(log.isDebugEnabled()) {                log.debug("AgentAssetData UnitName: " + aad.getUnitName());              }              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;		}                aad.setUIC(uic);                if(log.isDebugEnabled()) {                  log.debug("AgentAssetData UIC: " + aad.getUIC());                }//                 aad.addPropertyGroup(setTypeIdentificationPG());	      	// Use unitName if it occurred, else use agentName                aad.addPropertyGroup(setItemIdentificationPG(uic,                                                  (unitName!=null) ? unitName : agentName,                                                 agentName));                aad.addPropertyGroup(setClusterPG(agentName));                              } else {                if(log.isErrorEnabled()) {                  log.error("PrototypeParser Error: [Prototype] value is null");                }              }              newVal = tokens.nextToken();            } else if (dataItem.equals("[Relationship]")) {              newVal = setRelationshipData(newVal, tokens, aad);            } else if (dataItem.equals("[AssignmentPG]")) {              newVal = setAssignmentPG(newVal, tokens, aad);            } else if (dataItem.substring(0,1).equals("[")) {              // We've got a property or capability              newVal = setGenericPropertyPG(dataItem, newVal, tokens, aad);            } else {              // If the token you read is not one of the valid              // choices from above              if(log.isErrorEnabled()) {                log.error("PrototypeParser 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);//       Collection roles =  org.getOrganizationPG().getRoles();//       if (roles != null) {//         assignedCap.setRoles(new ArrayList(roles));//       }//       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) {      if(log.isErrorEnabled()) {        log.error("Exception", e);      }    }    return aad;  } 