This rule flags the use of the following application management methods:
These methods were deprecated in WebSphere Application Server Version 5.0 and provide no functionality. They can be replaced with calls to the setModuleInfo method in the same class.
For example, a call to moveModule might be similar to the following:
|
appManagement.moveModule(appName, prefs, uniqueModuleURI, objectName, workspaceID);
|
Using many of the same arguments, it could be coded using the setModuleInfo method. A sample is shown:
|
int TARGET_COL = 2; String newTarget = null; // Get the new target from the ObjectName if (objectName.getKeyProperty("server")!=null) { newTarget = objectName.getKeyProperty("server"); } else if (objectName.getKeyProperty("cluster")!=null) { newTarget = objectName.getKeyProperty("cluster"); } if (newTarget!=null) { Vector taskVector = appManagement.getModuleInfo(appName, prefs, uniqueModuleURI, workspaceID); Iterator iter = taskVector.iterator(); // Loop through the task data while ( iter.hasNext()) { AppDeploymentTask task = (AppDeploymentTask) iter.next(); String taskName = task.getName().trim(); // Find the MapModulesToServers task if (taskName.equals("MapModulesToServers")) { String[][] taskData = task.getTaskData(); for (int i=1; i<taskData.length; i++) { // update the target taskData[i][TARGET_COL] = newTarget; } break; } } appManagement.setModuleInfo(appName, prefs, uniqueModuleURI, workspaceID, taskVector); } |
For more class information, see