コード例 #1
0
 /*
  * (non-Javadoc)
  *
  * @see org.jboss.forge.addon.deltaspike.facets.DeltaSpikeFacet#install(org.jboss.forge.addon.deltaspike.DeltaSpikeModule)
  */
 @Override
 public DeltaSpikeFacet install(DeltaSpikeModule deltaSpikeModule) {
   for (Dependency dependency : deltaSpikeModule.getDependencies()) {
     installDependency(getFaceted(), dependency);
   }
   return this;
 }
コード例 #2
0
 /*
  * (non-Javadoc)
  *
  * @see org.jboss.forge.addon.deltaspike.facets.DeltaSpikeFacet#remove(org.jboss.forge.addon.deltaspike.DeltaSpikeModule)
  */
 @Override
 public DeltaSpikeFacet remove(DeltaSpikeModule deltaSpikeModule) {
   DependencyFacet dependencyFacet = getFaceted().getFacet(DependencyFacet.class);
   for (Dependency dependency : deltaSpikeModule.getDependencies()) {
     dependencyFacet.removeManagedDependency(dependency);
     dependencyFacet.removeDependency(dependency);
   }
   return this;
 }
コード例 #3
0
  @Override
  public Result execute(UIExecutionContext context) throws Exception {
    Project project = getSelectedProject(context);
    DeltaSpikeFacet deltaSpikeFacet = project.getFacet(DeltaSpikeFacet.class);

    Iterable<DeltaSpikeModule> selectedModules = dsModules.getValue();
    Set<DeltaSpikeModule> modulesInstalled = new HashSet<DeltaSpikeModule>();
    Set<DeltaSpikeModule> modulesRemoved = new HashSet<DeltaSpikeModule>();
    for (DeltaSpikeModule dsModule : DeltaSpikeModules.values()) {
      boolean selected = false;
      for (DeltaSpikeModule selectedModule : selectedModules) {
        if (selectedModule.equals(dsModule)) {
          selected = true;
        }
      }
      // Modules to Install
      if (selected && !deltaSpikeFacet.isModuleInstalled(dsModule)) {
        modulesInstalled.add(dsModule);
        deltaSpikeFacet.install(dsModule);
        if (dsModule.getInstallationExtraStep() != null) {
          dsModule.getInstallationExtraStep().install(project);
        }
      }
      // Modules to Remove
      if (!selected && deltaSpikeFacet.isModuleInstalled(dsModule)) {
        modulesRemoved.add(dsModule);
        deltaSpikeFacet.remove(dsModule);
        if (dsModule.getInstallationExtraStep() != null) {
          dsModule.getInstallationExtraStep().remove(project);
        }
      }
    }

    return Results.success(
        "DeltaSpike modules installed:"
            + modulesInstalled
            + "\nDeltaSpike modules removed:"
            + modulesRemoved);
  }
コード例 #4
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.jboss.forge.addon.deltaspike.facets.DeltaSpikeFacet#isModuleInstalled(org.jboss.forge.addon.deltaspike.DeltaSpikeModule
  * )
  */
 @Override
 public boolean isModuleInstalled(DeltaSpikeModule deltaSpikeModule) {
   return dependencyInstaller.isInstalled(getFaceted(), deltaSpikeModule.getDependencies()[0]);
 }