Commit f560e3e6 authored by Bonita CI's avatar Bonita CI
Browse files

Merge branch 'MasterBugFixing' into 'master'

parents ff56a9ee 18559725
......@@ -24,7 +24,7 @@
<xLocation>115</xLocation>
<yLocation>200</yLocation>
<color>#0B4361</color>
<versionLabel>7.1.0</versionLabel>
<versionLabel>${project.version}</versionLabel>
</configuration>
<executions>
<execution>
......
......@@ -98,8 +98,8 @@ dropBusinessDataDBOnExit=Clean business data database on exit
dropBusinessDataDBOnBDMChanges=Clean business data database on changes
queryExpressionGuidance=Select the Business Object and the corresponding query to execute. Set the value for each parameter required by the query.
bdmCompatibilityTitle=Warning: Impact of changes
bdmCompatibilityMsg=Changes made could cause incompatibilities between the Business Data Model and Business Data used in the pools.\nYou will need to Validate the diagrams to list impacts on Business Data.\n\nIf modifications to mandatory or unique constraints have been made, you must reset the Business Data Model to apply the changes. This will clear existing entries.
clearExistingBusinessData=Reset Business Data Model
bdmCompatibilityMsg=This BDM is available to all processes in your Studio, and to pages using REST API calls. Changing the BDM might cause inconsistencies.\nAfter the BDM update, validate each diagram and check your pages.\nIf you have changed the Mandatory or Multiple setting for an attribute, or if you have changed a unique constraint, you must clear the values of the business data in the database.
clearExistingBusinessData=Clear data
businessObjectNameAlreadyExists=A Business Object already exists with the same name
installFailedTitle=Deploy failed
installFailedMessage=An error occurred while deploying the Business Data Model in engine
......@@ -114,7 +114,7 @@ paginationParameterHint=2 Pagination parameters are offered, to be used through
newQueryTitle=Create query
editQueryTitle=Edit query
howToUseBusinessObjects=How to use Business Objects
howToUseBusinessObjectsContent=To use Business Objects (initialize or change values in forms), create Business Data in pools. To display Business Objects queries results in forms, create Transient Data in forms and set the default values with a Query expression. Then, create a Groovy script to transform business objects into display labels.
howToUseBusinessObjectsContent=To use business data in a process, you need to define a business variable at pool level.\nTo read business data in a process, you can also use the business object DAO in a Groovy script or use a query expression.\n\nTo use business data in a form or application page, use the REST API in the widget value property.
multipleBusinessData=Is multiple
composition=Composition
aggregation=Aggregation
......@@ -145,4 +145,5 @@ disabledMandatoryTooltip=A multiple attribute cannot be mandatory.
defaultValue=Default value
defaultValueReturnTypeValidationMessage=Default value expression returns {0} but {1} is expected
addBusinessObjectDataWindowTitle=New business variable
defaultValueBusinessDataTooltip=Business data can be initialized with existing Business Objects using a query\nor by creating a new one using a Groovy Script and the provided dao variable (XXXDAO.newInstance()).
\ No newline at end of file
defaultValueBusinessDataTooltip=Business data can be initialized with existing Business Objects using a query\nor by creating a new one using a Groovy Script and the provided dao variable (XXXDAO.newInstance()).
cleaningBusinessObjects=Cleaning Business data model...
\ No newline at end of file
......@@ -19,6 +19,7 @@ import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
......@@ -83,6 +84,7 @@ public class DeployBDMOperationTest {
when(manager.getTenantAdministrationAPI((APISession) anyObject())).thenReturn(tenantAdminAPI);
doReturn(manager).when(operationUnderTest).getBOSEngineManagerEx();
doNothing().when(operationUnderTest).updateDependency(any(byte[].class));
doNothing().when(operationUnderTest).removeDependency();
parentFolder = new File("test");
parentFolder.mkdirs();
doReturn(parentFolder).when(operationUnderTest).getTargetFolder();
......@@ -131,4 +133,20 @@ public class DeployBDMOperationTest {
verify(tenantAdminAPI).getClientBDMZip();
}
@Test
public void should_uninstall_bdm_from_tenant_when_bdm_is_empty() throws Exception {
final BusinessObjectModel emptyBom = new BusinessObjectModel();
doReturn(emptyBom).when(bdmFileStore).getContent();
doReturn(parentFolder).when(operationUnderTest).getTargetFolder();
operationUnderTest.run(Repository.NULL_PROGRESS_MONITOR);
verify(manager).loginDefaultTenant(Repository.NULL_PROGRESS_MONITOR);
verify(bdmFileStore).getContent();
final InOrder inOrder = inOrder(tenantAdminAPI);
inOrder.verify(tenantAdminAPI).pause();
inOrder.verify(tenantAdminAPI).uninstallBusinessDataModel();
inOrder.verify(tenantAdminAPI).resume();
verify(operationUnderTest).removeDependency();
verify(tenantAdminAPI, never()).installBusinessDataModel(any(byte[].class));
}
}
......@@ -23,6 +23,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.bonitasoft.engine.api.TenantAdministrationAPI;
import org.bonitasoft.engine.bdm.model.BusinessObjectModel;
import org.bonitasoft.engine.business.data.BusinessDataRepositoryDeploymentException;
import org.bonitasoft.engine.exception.UpdateException;
import org.bonitasoft.engine.session.APISession;
......@@ -93,18 +94,20 @@ public class DeployBDMOperation implements IRunnableWithProgress {
}
}
private String progressMessage(BusinessObjectModel bom) {
return containsBusinessObjects(bom) ? Messages.deployingBusinessObjects : Messages.cleaningBusinessObjects;
}
protected void doDeployBDM(IProgressMonitor monitor) throws InvocationTargetException {
if (monitor == null) {
monitor = Repository.NULL_PROGRESS_MONITOR;
}
if (fileStore.getContent().getBusinessObjects().isEmpty()) {
return;
}
monitor.beginTask(Messages.deployingBusinessObjects, IProgressMonitor.UNKNOWN);
BonitaStudioLog.debug(Messages.deployingBusinessObjects, BusinessObjectPlugin.PLUGIN_ID);
final BusinessObjectModel bom = fileStore.getContent();
final String progressMessage = progressMessage(bom);
monitor.beginTask(progressMessage, IProgressMonitor.UNKNOWN);
BonitaStudioLog.debug(progressMessage, BusinessObjectPlugin.PLUGIN_ID);
final BOSEngineManager engineManagerEx = getBOSEngineManagerEx();
TenantAdministrationAPI tenantManagementAPI = null;
try {
tenantManagementAPI = engineManagerEx.getTenantAdministrationAPI(session);
......@@ -120,12 +123,19 @@ public class DeployBDMOperation implements IRunnableWithProgress {
} catch (final BusinessDataRepositoryDeploymentException bdrde) {
// ignore exception
}
tenantManagementAPI.installBusinessDataModel(fileStore.toByteArray());
if (containsBusinessObjects(bom)) {
tenantManagementAPI.installBusinessDataModel(fileStore.toByteArray());
}
tenantManagementAPI.resume();
final byte[] zipContent = tenantManagementAPI.getClientBDMZip();
final byte[] jarContent = retrieveModelJarContent(zipContent);
updateDependency(jarContent);
if (containsBusinessObjects(bom)) {
final byte[] zipContent = tenantManagementAPI.getClientBDMZip();
final byte[] jarContent = retrieveModelJarContent(zipContent);
updateDependency(jarContent);
} else {
removeDependency();
}
} catch (final Exception e) {
BonitaStudioLog.error(e);
try {
......@@ -150,6 +160,19 @@ public class DeployBDMOperation implements IRunnableWithProgress {
}
}
protected void removeDependency() {
final DependencyRepositoryStore dependencyRepositoryStore = RepositoryManager.getInstance()
.getRepositoryStore(DependencyRepositoryStore.class);
final DependencyFileStore bdmFileStore = dependencyRepositoryStore.getChild(BusinessObjectModelFileStore.DEFAULT_BDM_FILENAME);
if (bdmFileStore != null) {
bdmFileStore.delete();
}
}
private boolean containsBusinessObjects(final BusinessObjectModel bom) {
return bom != null && !bom.getBusinessObjects().isEmpty();
}
protected boolean dropDBOnInstall() {
final IPreferenceStore preferenceStore = EnginePlugin.getDefault().getPreferenceStore();
return preferenceStore.getBoolean(EnginePreferenceConstants.DROP_BUSINESS_DATA_DB_ON_INSTALL);
......
......@@ -314,6 +314,7 @@ public class Messages extends NLS {
public static String addBusinessObjectDataWindowTitle;
public static String editBusinessObjectDataWindowTitle;
public static String defaultValueBusinessDataTooltip;
public static String cleaningBusinessObjects;
private Messages() {
}
......
......@@ -107,30 +107,33 @@ public class ManageBusinessDataModelWizard extends Wizard {
return false;
}
private boolean validateAndSaveBDM() {
try {
getContainer().run(true, false, new IRunnableWithProgress() {
@Override
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask(Messages.validatingBDM, IProgressMonitor.UNKNOWN);
if (businessObjectModel.getBusinessObjects().isEmpty()) {
throw new InvocationTargetException(new Exception(Messages.atLeastOneBusinessObjectShouldExists));
}
for (final BusinessObject bo : businessObjectModel.getBusinessObjects()) {
if (bo.getFields().isEmpty()) {
throw new InvocationTargetException(new Exception(Messages.bind(Messages.atLeastOneAttributeShouldExists,
NamingUtils.getSimpleName(bo.getQualifiedName()))));
}
for (final Index index : bo.getIndexes()) {
validateIndex(index, bo);
}
for (final UniqueConstraint uc : bo.getUniqueConstraints()) {
validateUniqueConstraint(uc, bo);
fStore.delete();
} else {
monitor.beginTask(Messages.validatingBDM, IProgressMonitor.UNKNOWN);
for (final BusinessObject bo : businessObjectModel.getBusinessObjects()) {
if (bo.getFields().isEmpty()) {
throw new InvocationTargetException(new Exception(Messages.bind(Messages.atLeastOneAttributeShouldExists,
NamingUtils.getSimpleName(bo.getQualifiedName()))));
}
for (final Index index : bo.getIndexes()) {
validateIndex(index, bo);
}
for (final UniqueConstraint uc : bo.getUniqueConstraints()) {
validateUniqueConstraint(uc, bo);
}
}
monitor.setTaskName(Messages.saving);
fStore.save(businessObjectModel);
monitor.done();
}
monitor.beginTask(Messages.saving, IProgressMonitor.UNKNOWN);
fStore.save(businessObjectModel);
}
});
} catch (final InvocationTargetException e) {
......@@ -155,7 +158,7 @@ public class ManageBusinessDataModelWizard extends Wizard {
} catch (final InvocationTargetException e) {
new BonitaErrorDialog(Display.getDefault().getActiveShell(), Messages.installFailedTitle, Messages.installFailedMessage,
handleTargetExceptionStacktrace(e))
.open();
.open();
return false;
} catch (final InterruptedException e) {
return false;
......
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-test/java"/>
......
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.7
......@@ -4,7 +4,7 @@ Bundle-Name: Diagram Utils
Bundle-SymbolicName: org.bonitasoft.studio.common.diagram;singleton:=true
Bundle-Version: 7.1.0.qualifier
Bundle-Vendor: BonitaSoft S.A.
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.gmf.runtime.lite.svg;bundle-version="1.0.0",
org.bonitasoft.studio.model;bundle-version="1.0.0",
org.bonitasoft.studio.common;bundle-version="1.0.0",
......
/**
* Copyright (C) 2015 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.connectors.configuration;
import static org.assertj.core.api.Assertions.assertThat;
import static org.bonitasoft.studio.model.configuration.builders.ConfigurationBuilder.aConfiguration;
import static org.bonitasoft.studio.model.configuration.builders.DefinitionMappingBuilder.aDefinitionMapping;
import static org.bonitasoft.studio.model.configuration.builders.FragmentBuilder.aFragment;
import static org.bonitasoft.studio.model.configuration.builders.FragmentContainerBuilder.aFragmentContainer;
import static org.bonitasoft.studio.model.process.builders.PoolBuilder.aPool;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.Collections;
import org.bonitasoft.engine.bpm.bar.BarResource;
import org.bonitasoft.engine.bpm.bar.BusinessArchiveBuilder;
import org.bonitasoft.studio.common.FragmentTypes;
import org.bonitasoft.studio.common.NamingUtils;
import org.bonitasoft.studio.common.repository.RepositoryAccessor;
import org.bonitasoft.studio.common.repository.filestore.PackageFileStore;
import org.bonitasoft.studio.connector.model.implementation.ConnectorImplementation;
import org.bonitasoft.studio.connector.model.implementation.ConnectorImplementationFactory;
import org.bonitasoft.studio.connectors.repository.ConnectorImplFileStore;
import org.bonitasoft.studio.connectors.repository.ConnectorImplRepositoryStore;
import org.bonitasoft.studio.connectors.repository.ConnectorSourceRepositoryStore;
import org.bonitasoft.studio.dependencies.repository.DependencyFileStore;
import org.bonitasoft.studio.dependencies.repository.DependencyRepositoryStore;
import org.bonitasoft.studio.model.configuration.Configuration;
import org.eclipse.emf.ecore.EObject;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
/**
* @author aurelie
*/
@RunWith(MockitoJUnitRunner.class)
public class ConnectorBarResourceProviderTest {
@Mock
private ConnectorImplRepositoryStore connectorImplStore;
@Mock
private DependencyRepositoryStore depStore;
@Mock
private ConnectorSourceRepositoryStore connectorSourceStore;
@Mock
private RepositoryAccessor repositoryAccessor;
@Mock
private ConnectorImplFileStore myConnectorImplFileStore;
@Mock
private PackageFileStore connectorSourceFileStore;
@Rule
public TemporaryFolder fileRule = new TemporaryFolder();
@Mock
private DependencyFileStore libFileStore;
@Before
public void initRepositoryAccessor() throws Exception {
when(repositoryAccessor.getRepositoryStore(ConnectorImplRepositoryStore.class)).thenReturn(connectorImplStore);
when(repositoryAccessor.getRepositoryStore(DependencyRepositoryStore.class)).thenReturn(depStore);
when(repositoryAccessor.getRepositoryStore(ConnectorSourceRepositoryStore.class)).thenReturn(connectorSourceStore);
}
@Test
public void should_add_implementation_jar_in_bar_resource_from_source() throws Exception {
final ConnectorBarResourceProvider provider = spy(new ConnectorBarResourceProvider(repositoryAccessor));
doReturn(fileRule.newFile("myConnectorImpl-1.0.0.jar")).when(provider).exportJar(anyString(), any(PackageFileStore.class));
when(myConnectorImplFileStore.getContent()).thenReturn(aConnectorImplementation("myConnectorDef", "1.0.0", "myConnectorImpl", "1.0.0",
"org.test.MyConnector"));
when(myConnectorImplFileStore.canBeShared()).thenReturn(true);
when(connectorSourceStore.getChild("org.test")).thenReturn(connectorSourceFileStore);
when(connectorImplStore.getImplementationFileStore("myConnectorImpl", "1.0.0")).thenReturn(myConnectorImplFileStore);
when(connectorImplStore.getImplementation("myConnectorImpl", "1.0.0")).thenReturn(
aConnectorImplementation("myConnectorDef", "1.0.0", "myConnectorImpl", "1.0.0",
"org.test.MyConnector"));
final BusinessArchiveBuilder builder = mock(BusinessArchiveBuilder.class);
provider.addResourcesForConfiguration(builder, aPool().build(), connectorConfiguration("myConnectorDef", "1.0.0", "myConnectorImpl", "1.0.0"),
Collections.<EObject> emptySet());
final ArgumentCaptor<BarResource> barResourceCaptor = ArgumentCaptor.forClass(BarResource.class);
verify(builder).addClasspathResource(barResourceCaptor.capture());
assertThat(barResourceCaptor.getValue().getName()).isEqualTo("myConnectorImpl-1.0.0.jar");
}
@Test
public void should_add_implementation_jar_in_bar_resource_from_dependency_store() throws Exception {
final ConnectorBarResourceProvider provider = spy(new ConnectorBarResourceProvider(repositoryAccessor));
doReturn(fileRule.newFile("myConnectorImpl-1.0.0.jar")).when(provider).exportJar(anyString(), any(PackageFileStore.class));
when(myConnectorImplFileStore.getContent()).thenReturn(aConnectorImplementation("myConnectorDef", "1.0.0", "myConnectorImpl", "1.0.0",
"org.test.MyConnector"));
when(myConnectorImplFileStore.canBeShared()).thenReturn(true);
when(libFileStore.getName()).thenReturn("myConnectorImpl-1.0.0.jar");
when(depStore.getChild("myConnectorImpl-1.0.0.jar")).thenReturn(libFileStore);
when(connectorImplStore.getImplementationFileStore("myConnectorImpl", "1.0.0")).thenReturn(myConnectorImplFileStore);
final BusinessArchiveBuilder builder = mock(BusinessArchiveBuilder.class);
provider.addResourcesForConfiguration(builder, aPool().build(), connectorConfiguration("myConnectorDef", "1.0.0", "myConnectorImpl", "1.0.0"),
Collections.<EObject> emptySet());
final ArgumentCaptor<BarResource> barResourceCaptor = ArgumentCaptor.forClass(BarResource.class);
verify(builder).addClasspathResource(barResourceCaptor.capture());
assertThat(barResourceCaptor.getValue().getName()).isEqualTo("myConnectorImpl-1.0.0.jar");
}
private ConnectorImplementation aConnectorImplementation(final String definitionId,
final String definitionVersion,
final String implementationId,
final String implementationVersion,
final String className) {
final ConnectorImplementation connectorImplementation = ConnectorImplementationFactory.eINSTANCE.createConnectorImplementation();
connectorImplementation.setDefinitionId(definitionId);
connectorImplementation.setDefinitionId(definitionVersion);
connectorImplementation.setImplementationId(implementationId);
connectorImplementation.setImplementationVersion(implementationVersion);
connectorImplementation.setImplementationClassname(className);
return connectorImplementation;
}
private Configuration connectorConfiguration(final String defId,
final String defVersion,
final String implId,
final String implVersion) {
return aConfiguration()
.havingDefinitionMappings(aDefinitionMapping()
.withDefinitionId(defId)
.withDefinitionVersion(defVersion)
.withImplementationId(implId)
.withImplementationVersion(implVersion)
.withType(FragmentTypes.CONNECTOR))
.havingProcessDependencies(
aFragmentContainer(FragmentTypes.CONNECTOR)
.havingChildren(
aFragmentContainer(NamingUtils.toConnectorImplementationFilename(implId, implVersion, false)).havingFragments(
aFragment().withValue(NamingUtils.toConnectorImplementationFilename(implId, implVersion, false) + ".jar")
.exported()))).build();
}
}
......@@ -14,23 +14,32 @@
*/
package org.bonitasoft.studio.connectors.configuration;
import static com.google.common.base.Predicates.and;
import static com.google.common.base.Strings.isNullOrEmpty;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.io.Files.toByteArray;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.inject.Inject;
import org.bonitasoft.engine.bpm.bar.BarResource;
import org.bonitasoft.engine.bpm.bar.BusinessArchiveBuilder;
import org.bonitasoft.studio.common.FragmentTypes;
import org.bonitasoft.studio.common.NamingUtils;
import org.bonitasoft.studio.common.ProjectUtil;
import org.bonitasoft.studio.common.extension.BARResourcesProvider;
import org.bonitasoft.studio.common.log.BonitaStudioLog;
import org.bonitasoft.studio.common.repository.RepositoryManager;
import org.bonitasoft.studio.common.repository.RepositoryAccessor;
import org.bonitasoft.studio.common.repository.filestore.EMFFileStore;
import org.bonitasoft.studio.common.repository.filestore.PackageFileStore;
import org.bonitasoft.studio.common.repository.model.IRepositoryFileStore;
import org.bonitasoft.studio.common.repository.store.SourceRepositoryStore;
import org.bonitasoft.studio.connector.model.implementation.ConnectorImplementation;
import org.bonitasoft.studio.connectors.repository.ConnectorImplRepositoryStore;
import org.bonitasoft.studio.connectors.repository.ConnectorSourceRepositoryStore;
......@@ -40,115 +49,185 @@ import org.bonitasoft.studio.model.configuration.DefinitionMapping;
import org.bonitasoft.studio.model.configuration.Fragment;
import org.bonitasoft.studio.model.configuration.FragmentContainer;
import org.bonitasoft.studio.model.process.AbstractProcess;
import org.eclipse.core.runtime.Assert;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import com.google.common.io.Files;
import com.google.common.base.Predicate;
/**
* @author Romain Bioteau
*/
public class ConnectorBarResourceProvider implements BARResourcesProvider {
protected final RepositoryAccessor repositoryAccessor;
@Inject
public ConnectorBarResourceProvider(final RepositoryAccessor repositoryAccessor) {
this.repositoryAccessor = repositoryAccessor;
}
@Override
public void addResourcesForConfiguration(final BusinessArchiveBuilder builder, final AbstractProcess process, final Configuration configuration,
final Set<EObject> excludedObjects) {
final Set<EObject> excludedObjects) throws IOException, InvocationTargetException, InterruptedException {
if (configuration == null) {
return;
}
final List<BarResource> resources = new ArrayList<BarResource>();
final DependencyRepositoryStore libStore = RepositoryManager.getInstance().getRepositoryStore(DependencyRepositoryStore.class);
final ConnectorImplRepositoryStore implStore = RepositoryManager.getInstance().getRepositoryStore(ConnectorImplRepositoryStore.class);
for (final DefinitionMapping association : configuration.getDefinitionMappings()) {
if (association.getType().equals(FragmentTypes.CONNECTOR)) {
final String implId = association.getImplementationId();
final String implVersion = association.getImplementationVersion();
if (implId != null && implVersion != null) {
final ConnectorImplementation implementation = implStore.getImplementation(implId, implVersion);
if (implementation == null) {
throw new RuntimeException(implId + "(" + implVersion + ") not found in repository");
}
final String fileName = URI.decode(implementation.eResource().getURI().lastSegment());
final EMFFileStore file = implStore.getChild(fileName);
Assert.isNotNull(file);
final boolean isUserImplementation = file.canBeShared();
try {
File implementationFile = file.getResource().getLocation().toFile();
if (!implementationFile.exists()) {
implementationFile = new File(URI.decode(file.getEMFResource().getURI().toFileString()));
}
final FileInputStream fis = new FileInputStream(implementationFile);
final byte[] content = new byte[fis.available()];
fis.read(content);
fis.close();
builder.addConnectorImplementation(new BarResource(NamingUtils.toConnectorImplementationFilename(implId, implVersion, true), content));
//Add jar dependencies
for (final FragmentContainer fc : configuration.getProcessDependencies()) {
if (fc.getId().equals(FragmentTypes.CONNECTOR)) {
for (final FragmentContainer connector : fc.getChildren()) {
if (connector.getId().equals(NamingUtils.toConnectorImplementationFilename(implId, implVersion, false))) {
for (final Fragment fragment : connector.getFragments()) {
final String jarName = fragment.getValue();
if (jarName.endsWith(".jar") && fragment.isExported()) {