コード例 #1
0
 /* (non-Javadoc)
  * @see org.bonitasoft.studio.configuration.AbstractConnectorConfigurationSynchronizer#updateJarDependencies(org.bonitasoft.studio.model.configuration.FragmentContainer, org.bonitasoft.studio.connector.model.implementation.ConnectorImplementation, org.eclipse.emf.edit.domain.EditingDomain, org.eclipse.emf.common.command.CompoundCommand)
  */
 @Override
 protected void updateJarDependencies(
     FragmentContainer connectorContainer,
     ConnectorImplementation implementation,
     EditingDomain editingDomain,
     CompoundCommand cc,
     boolean forceDriver) {
   super.updateJarDependencies(connectorContainer, implementation, editingDomain, cc, forceDriver);
   store =
       (DatabaseConnectorPropertiesRepositoryStore)
           RepositoryManager.getInstance()
               .getRepositoryStore(DatabaseConnectorPropertiesRepositoryStore.class);
   DatabaseConnectorPropertiesFileStore fileStore =
       (DatabaseConnectorPropertiesFileStore)
           store.getChild(
               implementation.getDefinitionId()
                   + "."
                   + DatabaseConnectorPropertiesRepositoryStore.CONF_EXT);
   if (fileStore != null) {
     String defaultDriver = fileStore.getDefault();
     List<String> jars = fileStore.getJarList();
     boolean autoAddDriver = fileStore.getAutoAddDriver() || forceDriver;
     Configuration conf = (Configuration) connectorContainer.eContainer().eContainer();
     FragmentContainer otherDependencies = null;
     for (FragmentContainer c : conf.getProcessDependencies()) {
       if (FragmentTypes.OTHER.equals(c.getId())) {
         otherDependencies = c;
       }
     }
     for (String jar : jars) {
       boolean exists = false;
       for (Fragment dep : otherDependencies.getFragments()) {
         if (dep.getValue().equals(jar)) {
           exists = true;
           break;
         }
       }
       if (!exists) {
         Fragment depFragment = ConfigurationFactory.eINSTANCE.createFragment();
         if (jar.equals(defaultDriver) && autoAddDriver) {
           depFragment.setExported(true);
         } else {
           depFragment.setExported(false);
         }
         depFragment.setKey(jar);
         depFragment.setValue(jar);
         depFragment.setType(FragmentTypes.JAR);
         cc.append(
             AddCommand.create(
                 editingDomain,
                 otherDependencies,
                 ConfigurationPackage.Literals.FRAGMENT_CONTAINER__FRAGMENTS,
                 depFragment));
       }
     }
   }
 }
 @Override
 protected FragmentContainer getContainer(Configuration configuration) {
   for (FragmentContainer container : configuration.getProcessDependencies()) {
     if (container.getId().equals(FragmentTypes.GROOVY_SCRIPT)) {
       return container;
     }
   }
   return null;
 }