Package org.eclipse.wst.server.core

Examples of org.eclipse.wst.server.core.IModule


  @Override
  public IStatus canModifyModules(IModule[] add, IModule[] remove) {
    if (add != null) {
      int size = add.length;
      for (int i = 0; i < size; i++) {
        IModule module = add[i];
        if (!ApplicationRegistry.isSupportedModule(module)) {
          return new Status(IStatus.ERROR, CloudFoundryPlugin.PLUGIN_ID, 0,
              NLS.bind(Messages.CloudFoundryServer_ERROR_APPTYPE_NOT_SUPPORTED, module.getModuleType().getId()),
              null);
        }

        IStatus status;
        // If the module, in a non-faceted project, has been determined
        // to be deployable to CF (ie. a single zip application
        // archive), then
        // this facet check is unnecessary.
        boolean ignoreFacetCheck = false;
        // FIXNS: Enable with IModule2 workaround is in place, as its
        // not available in Eclipse 4.3 and older.
//         if (module instanceof IModule2) {
//           String property = ((IModule2)module).getProperty(CloudFoundryConstants.PROPERTY_MODULE_NO_FACET);
//           if (property != null && property.equals("true")) {
//             ignoreFacetCheck = true;
//           }
//         }

// Workaround - Remove the following and use the above commented out code
        ClassLoader classLoader = module.getClass().getClassLoader();
        if (classLoader != null) {
          try {
            Class iModule2 = classLoader.loadClass("org.eclipse.wst.server.core.IModule2"); //$NON-NLS-1$
            if (iModule2 != null) {
              Method getProperty = iModule2.getMethod("getProperty", String.class); //$NON-NLS-1$
              Object o = getProperty.invoke(module, CloudFoundryConstants.PROPERTY_MODULE_NO_FACET);
              if (o instanceof String && ((String)o).equals("true")) { //$NON-NLS-1$
                ignoreFacetCheck = true;
              }
            }
          } catch (Exception e) {
            // If any issues, just go ahead and do the facet check below
          }
        }
// End of workaround

        if (module.getProject() != null && !ignoreFacetCheck) {
          status = FacetUtil.verifyFacets(module.getProject(), getServer());
          if (status != null && !status.isOK()) {
            return status;
          }
        }
      }
View Full Code Here


    return "Refresh application"; //$NON-NLS-1$
  }

  @Override
  protected void display404Error(IStatus status) {
    IModule currentModule = getEditorPage().getMasterDetailsBlock().getCurrentModule();
    if (currentModule != null) {
      getEditorPage().setMessage(Messages.RefreshApplicationEditorAction_WARNING_CANNOT_REFRESH,
          IMessageProvider.WARNING);
    }
    else {
View Full Code Here

    // First check if the module is set for automatic republish (i.e. a
    // prior publish for the application
    // failed, but the deployment info is available through the republish
    // module

    IModule module = appModule.getLocalModule();

    RepublishModule repModule = CloudFoundryPlugin.getModuleCache().getData(server.getServerOriginal())
        .untagForAutomaticRepublish(module);

    if (repModule != null) {
View Full Code Here

    // This step is a substitute for the Application deployment wizard
    String projectName = harness.getDefaultWebAppProjectName();
    String expectedAppName = harness.getDefaultWebAppName(appPrefix);
    getTestFixture().configureForApplicationDeployment(expectedAppName, false);

    IModule module = getModule(projectName);

    assertNotNull("Expected non-null IModule when deploying application", module);

    // Publish with non-WST publish API (i.e. publish that is not invoked by
    // WST framework)
    serverBehavior.publishAdd(module.getName(), new NullProgressMonitor());

    Collection<CloudFoundryApplicationModule> appModules = cloudServer.getExistingCloudModules();
    assertNotNull("Expected list of cloud modules after deploying: " + appPrefix, appModules);
    assertTrue("Expected one application module for " + appPrefix + " but got: " + appModules.size(),
        appModules.size() == 1);
View Full Code Here

    // This step is a substitute for the Application deployment wizard
    String projectName = harness.getDefaultWebAppProjectName();
    String expectedAppName = harness.getDefaultWebAppName(appPrefix);
    getTestFixture().configureForApplicationDeployment(expectedAppName, false);

    IModule module = getModule(projectName);

    assertNotNull("Expected non-null IModule when deploying application", module);

    // Publish through WST publish method
    serverBehavior.publish(IServer.PUBLISH_INCREMENTAL, new NullProgressMonitor());
View Full Code Here

    // Verify it is deployed
    CloudFoundryApplicationModule appModule = assertApplicationIsDeployed(prefix, IServer.STATE_STARTED);
    assertNotNull("Expected non-null Cloud Foundry application module", appModule);

    IModule module = getModule(harness.getDefaultWebAppProjectName());

    // Verify the app is running
    assertApplicationIsRunning(module, prefix);

    // Now CHECK that the expected conditions in the helper method assert to
View Full Code Here

        modules.length);
    int moduleState = server.getModulePublishState(modules);
    assertEquals(IServer.PUBLISH_STATE_UNKNOWN, moduleState);

    // Verify that the WST module that exists matches the app project app
    IModule module = getModule(projectName);

    assertNotNull(module);
    assertTrue(module.getName().equals(projectName));

  }
View Full Code Here

    assertTrue("Expected application to be stopped", appModule.getState() == Server.STATE_STOPPED);

  }

  protected void assertRemoveApplication(CloudApplication cloudApplication) throws Exception {
    IModule module = getModule(cloudApplication.getName());
    assertNotNull(module);
    serverBehavior.deleteModules(new IModule[] { module }, false, new NullProgressMonitor());

    serverBehavior.refreshModules(new NullProgressMonitor());
    List<CloudApplication> applications = serverBehavior.getApplications(new NullProgressMonitor());
View Full Code Here

      throws Exception {
    // Get the local WST IModule. NOTE that the PROJECT name needs to be
    // used as opposed to the
    // app name, as the project name and app name may differ, and the
    // IModule is mapped to the project.
    IModule module = getModule(harness.getDefaultWebAppProjectName());
    int moduleState = server.getModuleState(new IModule[] { module });
    assertEquals(expectedAppState, moduleState);

    // Once the application is started, verify that the Cloud module (the
    // "Enhanced" WST
View Full Code Here

    // Configure the test fixture for deployment.
    // This step is a substitute for the Application deployment wizard
    getTestFixture().configureForApplicationDeployment(expectedAppName, deployStopped);

    IModule module = getModule(projectName);

    assertNotNull("Expected non-null IModule when deploying application", module);

    serverBehavior.publish(IServer.PUBLISH_INCREMENTAL, new NullProgressMonitor());
View Full Code Here

TOP

Related Classes of org.eclipse.wst.server.core.IModule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.