protected ILiferayRuntime getLiferayRuntime() {
   IRuntimeWorkingCopy runtimeWC =
       (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
   ILiferayRuntime liferayRuntime =
       (ILiferayRuntime) runtimeWC.loadAdapter(ILiferayRuntime.class, null);
   return liferayRuntime;
 }
Beispiel #2
0
  public static Object getRuntimeAdapter(
      org.eclipse.wst.common.project.facet.core.runtime.IRuntime facetRuntime,
      Class<?> adapterClass) {

    String runtimeId = facetRuntime.getProperty("id");

    for (org.eclipse.wst.server.core.IRuntime runtime : ServerCore.getRuntimes()) {
      if (runtime.getId().equals(runtimeId)) {

        if (IRuntime.class.equals(adapterClass)) {
          return runtime;
        }

        IRuntimeWorkingCopy runtimeWC = null;

        if (!runtime.isWorkingCopy()) {
          runtimeWC = runtime.createWorkingCopy();
        } else {
          runtimeWC = (IRuntimeWorkingCopy) runtime;
        }

        return (ILiferayRuntime) runtimeWC.loadAdapter(adapterClass, null);
      }
    }

    return null;
  }
  public void setRuntime(IRuntimeWorkingCopy newRuntime) {
    if (newRuntime == null) {
      runtimeWC = null;
      liferayRuntime = null;
    } else {
      runtimeWC = newRuntime;
      liferayRuntime = (ILiferayRuntime) newRuntime.loadAdapter(ILiferayRuntime.class, null);
    }

    initialize();
    validate();
  }
 /** updates the model from runtime. */
 protected void populateModel() {
   IRuntimeWorkingCopy workingCopy = getRuntimeWorkingCopy();
   if (workingCopy != null) {
     // workCopy will be instance of ServerDelegate classs.
     // We need to get the params, so IFuseESBRuntime will be enough.
     IKarafRuntime karafRuntime =
         (IKarafRuntime) workingCopy.loadAdapter(IKarafRuntime.class, new NullProgressMonitor());
     if (karafRuntime != null) {
       model.setKarafInstallDir(karafRuntime.getKarafInstallDir());
       model.setKarafVersion(FuseESBUtils.getVersion(new File(model.getKarafInstallDir())));
     }
   }
 }
  public boolean isComplete() {
    runtime = (IRuntimeWorkingCopy) getTaskModel().getObject(TaskModel.TASK_RUNTIME);

    if (runtime != null) {
      GenericServerRuntime gRuntime =
          (GenericServerRuntime)
              runtime.loadAdapter(GenericServerRuntime.class, new NullProgressMonitor());

      Map properties = gRuntime.getServerInstanceProperties();
      String serverName = (String) properties.get("server.name");
      if (serverName != null) {
        runtime.setName(serverName);
      }
    }
    return super.isComplete();
  }
 protected LiferayRuntimeStubDelegate getStubDelegate() {
   return (LiferayRuntimeStubDelegate)
       runtimeWC.loadAdapter(LiferayRuntimeStubDelegate.class, new NullProgressMonitor());
 }