Evitare di utilizzare il metodo moveModule di gestione dell'applicazione obsoleto

Questa regola contrassegna l'utilizzo dei seguenti metodi di gestione dell'applicazione:

Tali metodi sono stati resi obsoleti in WebSphere Application Server Versione 5.0 e non forniscono alcuna funzionalità. Possono essere sostituiti con chiamate al setModuleInfo nella stessa classe.

Ad esempio, una chiamata a moveModule potrebbe essere simile al seguente:

< span class="Code"> appManagement.moveModule(appName, prefs, uniqueModuleURI, objectName, workspaceID);

Utilizzando molti degli stessi argomenti, potrebbe essere codificato utilizzando setModuleInfo metodo. Di seguito viene visualizzato un esempio:

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();
per (int i=1; i <taskData.length; i + +) {
// update the target
taskData[i][TARGET_COL] = newTarget;
}
break;
}
}

appManagement.setModuleInfo(appName, prefs, uniqueModuleURI, workspaceID, taskVector);
}

Per ulteriori informazioni sulla classe, consultare