isAppDeployedToLibertyServer メソッドは、指定されたアプリケーションが管理された Liberty サーバーにデプロイされているか、対象になっているかを確認します。 このメソッドは、アプリケーションが管理された Liberty サーバーにデプロイされているか、ターゲットになっている場合、 true
を返します。 このメソッドは、アプリケーションが管理された Liberty サーバーサーバーにデプロイされていないか、ターゲットになっていない場合は、 false
を返します。 アプリケーションが存在しない場合、このメソッドは null
を返します。
次の例では、 isAppDeployedToLibertyServer メソッドを使用し、ブール値の結果を返します。
try {
// Connect to WebSphere Application Server.
String host = "localhost";
String port = "8880";
String appName = "HelloLondon";
Properties config = new Properties();
config.put (AdminClient.CONNECTOR_HOST, host);
config.put (AdminClient.CONNECTOR_PORT, port);
config.put (AdminClient.CONNECTOR_TYPE, AdminClient.CONNECTOR_TYPE_SOAP);
System.out.println ("Config: " + config);
AdminClient _soapClient = AdminClientFactory.createAdminClient(config);
// Create the application management proxy, AppManagement.
AppManagement appMgmtProxy = AppManagementProxy. getJMXProxyForClient (_soapClient);
Hashtable prefs = new Hashtable();
prefs.put(AppConstants.APPDEPL_LOCALE, Locale.getDefault());
Boolean result = appMgmtProxy.isAppDeployedToLibertyServer (appName, prefs, null);
} catch (Exception e) {
e.printStackTrace();
}
詳細については、 Network Deployment 9.0.5 ドキュメントの 「プログラミングによるアプリケーションの管理」を参照してください。