コード例 #1
0
 private void processComponent(IConfigurationElement element) {
   if (!"component".equals(element.getName())) { // $NON-NLS-1$
     Activator.getDefault()
         .getLog()
         .log(
             new Status(
                 Status.ERROR,
                 Activator.PLUGIN_ID,
                 Messages.SwitchYardComponentExtensionManager_InvalidElementStatus
                     + element.getName()
                     + ", plugin="
                     + element.getContributor().getName())); // $NON-NLS-1$
     return;
   }
   String id = element.getAttribute("id"); // $NON-NLS-1$
   String name = element.getAttribute("name"); // $NON-NLS-1$
   Category category = parseCategory(element);
   String description = parseDescription(element);
   String bundleId = parseBundleId(element);
   List<Dependency> dependencies = parseDependencies(element);
   if (id == null) {
     Activator.getDefault()
         .getLog()
         .log(
             new Status(
                 Status.ERROR,
                 Activator.PLUGIN_ID,
                 Messages.SwitchYardComponentExtensionManager_InvalidIDStatus
                     + element.getContributor().getName()));
     return;
   } else if (_extensions.containsKey(id)) {
     Activator.getDefault()
         .getLog()
         .log(
             new Status(
                 Status.ERROR,
                 Activator.PLUGIN_ID,
                 Messages.SwitchYardComponentExtensionManager_DuplicateIDStatus
                     + element.getContributor().getName()));
     return;
   } else if (name == null || name.length() == 0) {
     name = id;
   }
   ISwitchYardComponentExtension extension =
       new SwitchYardComponentExtension(
           id,
           name,
           category,
           element.getAttribute("scannerClass"),
           description,
           bundleId,
           dependencies); //$NON-NLS-1$
   _extensions.put(id, extension);
   _extensionsByCategory.get(category).add(extension);
 }
コード例 #2
0
 private List<Dependency> parseDependencies(IConfigurationElement element) {
   IConfigurationElement[] dependencyElements = element.getChildren("dependency"); // $NON-NLS-1$
   if (dependencyElements == null) {
     return Collections.emptyList();
   }
   List<Dependency> dependencies = new ArrayList<Dependency>(dependencyElements.length);
   for (IConfigurationElement dependencyElement : dependencyElements) {
     String artifactId = parseArtifactId(dependencyElement);
     String groupId = parseGroupId(dependencyElement);
     String scope = parseScope(dependencyElement);
     if (artifactId == null
         || artifactId.length() == 0
         || groupId == null
         || groupId.length() == 0) {
       Activator.getDefault()
           .getLog()
           .log(
               new Status(
                   Status.ERROR,
                   Activator.PLUGIN_ID,
                   Messages.SwitchYardComponentExtensionManager_InvalidDependencyStatus
                       + element.getContributor().getName()));
       continue;
     }
     dependencies.add(M2EUtils.createSwitchYardDependency(groupId, artifactId, scope));
   }
   return dependencies;
 }
コード例 #3
0
  private void initControls() {

    _switchYardProject =
        SwitchYardProjectManager.instance().getSwitchYardProject(getProject()).createWorkingCopy();
    if (_switchYardProject.needsLoading()) {
      BusyIndicator.showWhile(
          getShell().getDisplay(),
          new Runnable() {
            @Override
            public void run() {
              _switchYardProject.load(new NullProgressMonitor());
            }
          });
    }
    try {
      _ifp = ProjectFacetsManager.create(_switchYardProject.getProject());
      _ifpwc = SharedWorkingCopyManager.getWorkingCopy(_ifp);
      _configuredRuntimes = _ifpwc.getTargetedRuntimes();
    } catch (CoreException e) {
      Activator.getDefault().getLog().log(e.getStatus());
    }

    _settingsGroup.setProject(_ifpwc);

    initTargetRuntime();
    initRuntimeVersion();
    initComponentsTable();

    _useSwitchYardDependencyBOMCheckbox.setSelection(pomUsesSwitchYardBOM());

    String errmsg = null;
    if (!pomDefinesSwitchYardVersion()) {
      _settingsGroup.setRuntimeControlEnablement(false);
    } else if (pomUsesSwitchYardBOM()) {
      if (!isSelectedRuntimeVersion2OrHigher()) {
        // only valid versions with BOM dependency support are 2.0+
        errmsg = Messages.ProjectConfigurationWizardPage_errorMessage_bomRequiresVersion2;
      }
    } else if (!isSelectedConfigurationVersionOkForRuntime()) {
      String configVersion = getMajorMinorFromVersion(getRuntimeVersion().toString());
      errmsg =
          "The Configuration Version must be "
              + configVersion
              + " or lower to work with Library Version "
              + getRuntimeVersion().toString()
              + ".";
    }
    setErrorMessage(errmsg);
    getContainer().updateMessage();
  }
コード例 #4
0
 private String parseArtifactId(IConfigurationElement element) {
   IConfigurationElement[] artifactIds = element.getChildren("artifactId"); // $NON-NLS-1$
   if (artifactIds.length != 1) {
     Activator.getDefault()
         .getLog()
         .log(
             new Status(
                 Status.ERROR,
                 Activator.PLUGIN_ID,
                 Messages.SwitchYardComponentExtensionManager_MultipleArtifactIDsStatus
                     + element.getContributor().getName()));
     return null;
   }
   return artifactIds[0].getValue().trim();
 }
コード例 #5
0
 private String parseScope(IConfigurationElement element) {
   IConfigurationElement[] scopes = element.getChildren("scope"); // $NON-NLS-1$
   if (scopes.length == 0) {
     return null;
   } else if (scopes.length != 1) {
     Activator.getDefault()
         .getLog()
         .log(
             new Status(
                 Status.ERROR,
                 Activator.PLUGIN_ID,
                 Messages.SwitchYardComponentExtensionManager_MultipleScopesStatus
                     + element.getContributor().getName()));
     // we'll fall through and return the first element's value
   }
   String scope = scopes[0].getValue().trim();
   return scope.length() == 0 ? null : scope;
 }
コード例 #6
0
 private Category parseCategory(IConfigurationElement element) {
   String categoryString = element.getAttribute("category"); // $NON-NLS-1$
   if (categoryString == null || categoryString.length() == 0) {
     return Category.UNKNOWN;
   }
   try {
     return Category.valueOf(categoryString.toUpperCase());
   } catch (Exception e) {
     Activator.getDefault()
         .getLog()
         .log(
             new Status(
                 Status.ERROR,
                 Activator.PLUGIN_ID,
                 Messages.SwitchYardComponentExtensionManager_InvalidCategoryStatus
                     + element.getContributor().getName()
                     + ", id="
                     + element.getAttribute("id"))); // $NON-NLS-1$ //$NON-NLS-2$
   }
   return Category.UNKNOWN;
 }