コード例 #1
0
 public String getDefinitionText(DefinitionMapping association) {
   ConnectorDefinition definition =
       defStore.getDefinition(association.getDefinitionId(), association.getDefinitionVersion());
   if (definition != null) {
     String connectorDefinitionLabel = resourceProvider.getConnectorDefinitionLabel(definition);
     if (connectorDefinitionLabel == null) {
       connectorDefinitionLabel = definition.getId();
     }
     return connectorDefinitionLabel + " (" + definition.getVersion() + ")";
   } else {
     return "defintion not found for "
         + association.getDefinitionId()
         + " with version"
         + association.getDefinitionVersion();
   }
 }
コード例 #2
0
 public Image getDefinitionImage(DefinitionMapping association) {
   ConnectorDefinition definition =
       defStore.getDefinition(association.getDefinitionId(), association.getDefinitionVersion());
   return resourceProvider.getDefinitionIcon(definition);
 }
コード例 #3
0
  protected IStatus addDependencies(ConnectorImplementation impl, IFolder classpathFolder)
      throws CoreException {
    final IDefinitionRepositoryStore store = (IDefinitionRepositoryStore) getDefinitionStore();
    final DependencyRepositoryStore depStore =
        (DependencyRepositoryStore)
            RepositoryManager.getInstance().getRepositoryStore(DependencyRepositoryStore.class);
    final DefinitionResourceProvider resourceProvider =
        DefinitionResourceProvider.getInstance(getDefinitionStore(), getBundle());

    ConnectorDefinition def =
        store.getDefinition(impl.getDefinitionId(), impl.getDefinitionVersion());
    for (String jarName : def.getJarDependency()) {
      if (ignoredLibs.contains(jarName)) {
        continue;
      }
      IRepositoryFileStore file = depStore.getChild(jarName);
      if (file != null) {
        if (file.getResource().exists()) {
          if (!classpathFolder.getFile(file.getName()).exists()) {
            try {
              file.getResource()
                  .copy(
                      classpathFolder.getFullPath().append(file.getName()),
                      true,
                      Repository.NULL_PROGRESS_MONITOR);
            } catch (CoreException e) {
              BonitaStudioLog.error(e);
            }
          }
        }
      } else { // Search in provided jars
        InputStream is = resourceProvider.getDependencyInputStream(jarName);
        if (is != null) {
          IFile jarFile = classpathFolder.getFile(jarName);
          if (!jarFile.exists()) {
            jarFile.create(is, true, Repository.NULL_PROGRESS_MONITOR);
          }
        } else {
          return ValidationStatus.error(Messages.bind(Messages.implementationDepNotFound, jarName));
        }
      }
    }
    for (String jarName : impl.getJarDependencies().getJarDependency()) {
      if (ignoredLibs.contains(jarName)) {
        continue;
      }
      IRepositoryFileStore file = depStore.getChild(jarName);
      if (file != null) {
        if (file.getResource().exists()) {
          if (!classpathFolder.getFile(file.getName()).exists()) {
            try {
              file.getResource()
                  .copy(
                      classpathFolder.getFullPath().append(file.getName()),
                      true,
                      Repository.NULL_PROGRESS_MONITOR);
            } catch (CoreException e) {
              BonitaStudioLog.error(e);
            }
          }
        }
      } else { // Search in provided jars
        InputStream is = resourceProvider.getDependencyInputStream(jarName);
        if (is != null) {
          IFile jarFile = classpathFolder.getFile(jarName);
          if (!jarFile.exists()) {
            jarFile.create(is, true, Repository.NULL_PROGRESS_MONITOR);
          }
        } else {
          return ValidationStatus.error(Messages.bind(Messages.implementationDepNotFound, jarName));
        }
      }
    }
    return Status.OK_STATUS;
  }