Programming commands in MoRE

IBM® Modernized Runtime Extension for Java™ (MoRE) introduces new programming methods, getAppDeployedMetadata and isAppDeployedToLibertyServer, to the AppManagement MBean interface. The methods provide information about applications that are deployed or targeted to a managed Liberty server.

[1.0.1.0 and later][Network Deployment 9.0.5.26 or
later]getAppDeployedMetadata(String appName, Hashtable prefs, String workspaceID) throws AdminException

The getAppDeployedMetadata method returns a map that contains key-value pairs of the deployment metadata for an application that is deployed or targeted to a managed Liberty server. If the application does not exist, the method returns null.

The following example uses the getAppDeployedMetadata method.

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());

    Map<String, Object>  result = appMgmtProxy.getAppDeployedMetadata (appName, prefs, null);

 } catch (Exception e) {
      e.printStackTrace();
 }
isAppDeployedToLibertyServer

The isAppDeployedToLibertyServer method checks if the specified application is deployed or targeted to a managed Liberty server. The method returns true if the application is deployed or targeted to a managed Liberty server. The method returns false if the application is not deployed or targeted to the managed Liberty server. The method returns null if the application does not exist.

The following example uses the isAppDeployedToLibertyServer method and returns a Boolean result.

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();
 }

For more information, see Managing applications through programming in the Network Deployment 9.0.5 documentation.