/** * ************************************************************************ * * Method: performSet * * Input: CMIRequest theRequest - tokenized LMSSetValue() request * DMErrorManager dmErroMgr - * Error Manager * Output: none * * Description: This method takes the necessary steps to process * * an LMSSetValue() request * * ************************************************************************* */ public void performSet(CMIRequest theRequest, DMErrorManager dmErrorMgr) { if (true) { System.out.println("CMIObjectives::performSet()"); } // The next token must be an array. If not throw // an exception for this request. int index = -1; // Get the next token off of the request String token = theRequest.getNextToken(); if (true) { System.out.println("Token being processed: " + token); } // Check to see if next token is an array index. For // a LMSSetValue() this is true try { // Try to convert the token to the index Integer tmpInt = new Integer(token); index = tmpInt.intValue(); // Get the Objective Data at position of the index CMIObjectiveData tmpObj = (CMIObjectiveData) objectives.elementAt(index); // An objective existed at the given index. // Invoke the performSet() on the Objective Data tmpObj.performSet(theRequest, dmErrorMgr); // replace the old ObjectiveData with the newly set Objective // Data. objectives.set(index, tmpObj); } catch (NumberFormatException nfe) { if (theRequest.isAKeywordRequest() == true) { dmErrorMgr.recKeyWordError(token); } else { if (true) { // Invalid parameter passed to LMSSetValue() System.out.println("Error - Data Model Element not implemented"); System.out.println( "Invalid data model element: " + theRequest.getRequest() + " passed to LMSSetValue()"); } // Notify error manager dmErrorMgr.recNotImplementedError(theRequest); } } catch (ArrayIndexOutOfBoundsException e) { if (true) { System.out.println("First time setting the Objective Data"); } if (index <= objectives.size()) { // A new Objective Data. CMIObjectiveData objData = new CMIObjectiveData(); // Invoke performSet() on the new Objective Data objData.performSet(theRequest, dmErrorMgr); // Place the Objective data into the vector at the // index position objectives.add(index, objData); } else { dmErrorMgr.SetCurrentErrorCode("201"); } } // Done processing. Let CMIRequest object know the processing // of the LMSGetValue() is done. theRequest.done(); return; } // end of performSet