예제 #1
0
 private static File getSeamRoot(RuntimeDefinition runtimeDefinition) {
   String type = runtimeDefinition.getType();
   if (SEAM.equals(type)) {
     return runtimeDefinition.getLocation();
   }
   return null;
 }
예제 #2
0
 @Override
 public String getVersion(RuntimeDefinition runtimeDefinition) {
   if (runtimeDefinition == null || runtimeDefinition.getLocation() == null) {
     return null;
   }
   return getVersion(runtimeDefinition.getLocation().getAbsolutePath(), DEFAULT_CONFIGURATION);
 }
예제 #3
0
  @Override
  public void initializeRuntimes(List<RuntimeDefinition> runtimeDefinitions) {

    Map<String, SeamRuntime> map = new HashMap<String, SeamRuntime>();

    for (RuntimeDefinition runtimeDefinition : runtimeDefinitions) {
      if (runtimeDefinition.isEnabled()) {
        String type = runtimeDefinition.getType();
        if (SEAM.equals(type)) {
          addSeam(map, runtimeDefinition, runtimeDefinition.getLocation());
        }
      }
      initializeRuntimes(runtimeDefinition.getIncludedRuntimeDefinitions());
    }
    SeamRuntimeManager.getInstance().save();
  }
예제 #4
0
 @Override
 public boolean exists(RuntimeDefinition runtimeDefinition) {
   if (runtimeDefinition == null || runtimeDefinition.getLocation() == null) {
     return false;
   }
   return esbExists(runtimeDefinition);
 }
예제 #5
0
  @Override
  public void computeIncludedRuntimeDefinition(RuntimeDefinition runtimeDefinition) {
    runtimeDefinition.getIncludedRuntimeDefinitions().clear();
    List<RuntimeDefinition> runtimeDefinitions = runtimeDefinition.getIncludedRuntimeDefinitions();

    final File location = getLocation(runtimeDefinition);
    File[] directories =
        runtimeDefinition
            .getLocation()
            .listFiles(
                new FileFilter() {
                  public boolean accept(File file) {
                    if (!file.isDirectory() || file.equals(location)) {
                      return false;
                    }
                    return true;
                  }
                });
    List<RuntimeDefinition> definitions = new ArrayList<RuntimeDefinition>();
    JBossRuntimeLocator locator = new JBossRuntimeLocator();
    Set<IRuntimeDetector> seamDetectors = new HashSet<IRuntimeDetector>();
    Set<IRuntimeDetector> runtimeDetectors =
        RuntimeCoreActivator.getDefault().getRuntimeDetectors();
    for (IRuntimeDetector runtimeDetector : runtimeDetectors) {
      if (runtimeDetector instanceof RuntimeDetector) {
        IRuntimeDetectorDelegate delegate = ((RuntimeDetector) runtimeDetector).getDelegate();
        if (delegate instanceof SeamHandler) {
          seamDetectors.add(runtimeDetector);
          break;
        }
      }
    }
    for (File directory : directories) {
      locator.searchDirectory(directory, definitions, 1, seamDetectors, new NullProgressMonitor());
      for (RuntimeDefinition definition : definitions) {
        definition.setParent(runtimeDefinition);
      }
    }
    for (RuntimeDefinition definition : definitions) {
      if (!runtimeDefinitions.contains(definition)) {
        runtimeDefinitions.add(definition);
      }
    }
  }
예제 #6
0
 private static void addSeam(
     Map<String, SeamRuntime> map, RuntimeDefinition runtimeDefinition, File seamFile) {
   if (seamFile.exists() && seamFile.canRead() && seamFile.isDirectory()) {
     SeamVersion seamVersion = getSeamVersion(seamFile.getAbsolutePath());
     if (seamVersion != null) {
       String name =
           "Seam " + runtimeDefinition.getName() + " " + seamVersion; // $NON-NLS-1$ //$NON-NLS-2$
       List<String> names = SeamRuntimeManager.getInstance().getAllRuntimeNames();
       if (names != null && names.size() > 0) {
         int i = 2;
         String baseName = "Seam " + runtimeDefinition.getName(); // $NON-NLS-1$
         while (names.contains(name)) {
           name = baseName + " (" + i++ + ") " + seamVersion; // $NON-NLS-1$ //$NON-NLS-2$
         }
       }
       addSeam(map, seamFile.getAbsolutePath(), seamVersion, name);
     }
   }
 }
예제 #7
0
 /**
  * @param serverDefinition
  * @return
  */
 private static boolean esbExists(RuntimeDefinition runtimeDefinition) {
   JBossESBRuntime[] runtimes = JBossRuntimeManager.getInstance().getRuntimes();
   for (JBossESBRuntime runtime : runtimes) {
     String location = runtime.getHomeDir();
     if (location != null && location.equals(runtimeDefinition.getLocation().getAbsolutePath())) {
       return true;
     }
   }
   return false;
 }
예제 #8
0
 @Override
 public boolean exists(RuntimeDefinition runtimeDefinition) {
   if (runtimeDefinition == null || runtimeDefinition.getLocation() == null) {
     return false;
   }
   File seamRoot = getSeamRoot(runtimeDefinition);
   if (seamRoot == null || !seamRoot.isDirectory()) {
     return false;
   }
   String path = seamRoot.getAbsolutePath();
   return seamExists(path);
 }
예제 #9
0
 @Override
 public void computeIncludedRuntimeDefinition(RuntimeDefinition runtimeDefinition) {
   File esbRoot = null;
   if (JBossServerType.SOAP.getId().equals(runtimeDefinition.getType())) {
     esbRoot = runtimeDefinition.getLocation();
   }
   if (JBossServerType.SOAP_STD.getId().equals(runtimeDefinition.getType())) {
     esbRoot = new File(runtimeDefinition.getLocation(), JBOSS_ESB_FOLDER);
   }
   RuntimeDefinition child =
       createRuntimeDefinition(esbRoot, runtimeDefinition.getName(), new NullProgressMonitor());
   if (child != null) {
     child.setParent(runtimeDefinition);
     runtimeDefinition.getIncludedRuntimeDefinitions().add(child);
   }
 }
예제 #10
0
 public void initializeRuntimes(List<RuntimeDefinition> runtimeDefinitions) {
   for (RuntimeDefinition runtimeDefinition : runtimeDefinitions) {
     String type = runtimeDefinition.getType();
     if (runtimeDefinition.isEnabled() && !esbExists(runtimeDefinition)) {
       if (ESB.equals(type)) {
         JBossESBRuntime runtime = new JBossESBRuntime();
         if (!runtimeDefinition.getName().startsWith(ESB_PREFIX))
           runtime.setName(ESB_PREFIX + runtimeDefinition.getName());
         runtime.setHomeDir(runtimeDefinition.getLocation().getAbsolutePath());
         runtime.setConfiguration(DEFAULT_CONFIGURATION);
         runtime.setVersion(runtimeDefinition.getVersion());
         JBossRuntimeManager.getInstance().addRuntime(runtime);
       }
     }
     initializeRuntimes(runtimeDefinition.getIncludedRuntimeDefinitions());
   }
 }
예제 #11
0
 private static File getLocation(RuntimeDefinition runtimeDefinitions) {
   String type = runtimeDefinitions.getType();
   String version = runtimeDefinitions.getVersion();
   if ("EAP".equals(type)
       && version != null
       && version.startsWith("6")) { // $NON-NLS-1$ //$NON-NLS-2$
     return runtimeDefinitions.getLocation();
   }
   if ("SOA_P".equals(type)
       || "EAP".equals(type)
       || "EPP".equals(type)) { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     return new File(runtimeDefinitions.getLocation(), "jboss-as"); // $NON-NLS-1$
   }
   if ("SOA_P_STD".equals(type)) { // $NON-NLS-1$
     return new File(runtimeDefinitions.getLocation(), "jboss-esb"); // $NON-NLS-1$				
   }
   if ("EWP".equals(type)) { // $NON-NLS-1$
     return new File(runtimeDefinitions.getLocation(), "jboss-as-web"); // $NON-NLS-1$
   }
   if ("AS".equals(type) || "EAP_STD".equals(type)) { // $NON-NLS-1$//$NON-NLS-2$
     return runtimeDefinitions.getLocation();
   }
   return null;
 }
예제 #12
0
 @Override
 public String getVersion(RuntimeDefinition runtimeDefinition) {
   return runtimeDefinition.getVersion();
 }