Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockRequestFactory.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java7
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceFactoryTest.java18
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java8
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java8
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/Activator.java98
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java30
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceRegHandler.java67
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/AttributeTypeCacheUpdateResponseTranslator.java13
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java13
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java12
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/internal/Activator.java22
13 files changed, 140 insertions, 162 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockRequestFactory.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockRequestFactory.java
index fe3519447f..bdd9a87236 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockRequestFactory.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockRequestFactory.java
@@ -33,14 +33,16 @@ import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider
import org.eclipse.osee.framework.jdk.core.util.GUID;
public final class MockRequestFactory {
+
private MockRequestFactory() {
+ // Utility class
}
public static IOseeModelFactoryServiceProvider createFactoryProvider() {
return new MockOseeModelFactoryServiceProvider(createFactoryService());
}
- private static IOseeModelFactoryService createFactoryService() {
+ public static IOseeModelFactoryService createFactoryService() {
return new OseeModelFactoryService(new BranchFactory(), new TransactionRecordFactory(),
new ArtifactTypeFactory(), new AttributeTypeFactory(), new RelationTypeFactory(), new OseeEnumTypeFactory());
}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java
index 67f3623264..6d3d3c8dd0 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java
@@ -20,10 +20,9 @@ import org.eclipse.osee.framework.core.message.internal.DataTranslationService;
import org.eclipse.osee.framework.core.message.internal.translation.BranchCommitResponseTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator;
import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
-import org.eclipse.osee.framework.core.message.test.mocks.MockRequestFactory;
import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
import org.eclipse.osee.framework.core.model.test.mocks.MockDataFactory;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.junit.runner.RunWith;
@@ -49,11 +48,11 @@ public class BranchCommitResponseTranslatorTest extends BaseTranslatorTest<Branc
@Parameters
public static Collection<Object[]> data() throws OseeCoreException {
- IOseeModelFactoryServiceProvider factoryProvider = MockRequestFactory.createFactoryProvider();
List<Object[]> data = new ArrayList<Object[]>();
IDataTranslationService service = new DataTranslationService();
- service.addTranslator(new TransactionRecordTranslator(factoryProvider), CoreTranslatorId.TRANSACTION_RECORD);
+ service.addTranslator(new TransactionRecordTranslator(new TransactionRecordFactory()),
+ CoreTranslatorId.TRANSACTION_RECORD);
ITranslator<BranchCommitResponse> translator = new BranchCommitResponseTranslator(service);
for (int index = 1; index <= 2; index++) {
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceFactoryTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceFactoryTest.java
index 6c8758993c..50322ca848 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceFactoryTest.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceFactoryTest.java
@@ -35,8 +35,8 @@ import org.eclipse.osee.framework.core.message.internal.translation.RelationType
import org.eclipse.osee.framework.core.message.internal.translation.TableDataTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.TransactionCacheUpdateResponseTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator;
-import org.eclipse.osee.framework.core.message.test.mocks.MockOseeModelFactoryServiceProvider;
-import org.eclipse.osee.framework.core.model.test.mocks.MockOseeCachingServiceProvider;
+import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
+import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.eclipse.osee.framework.core.translation.ITranslatorId;
@@ -51,9 +51,9 @@ public class DataTranslationServiceFactoryTest {
@Test
public void testServiceCreation() throws OseeCoreException {
+ DataTranslationServiceFactory transalationFactoryService = new DataTranslationServiceFactory();
IDataTranslationService srvc =
- new DataTranslationServiceFactory().createService(new MockOseeCachingServiceProvider(null),
- new MockOseeModelFactoryServiceProvider(null));
+ transalationFactoryService.createService(null, new TransactionRecordFactory(), new AttributeTypeFactory());
checkExists(srvc, TransactionRecordTranslator.class, CoreTranslatorId.TRANSACTION_RECORD);
@@ -85,17 +85,9 @@ public class DataTranslationServiceFactoryTest {
checkExists(srvc, TableDataTranslator.class, CoreTranslatorId.TABLE_DATA);
checkExists(srvc, DatastoreInitRequestTranslator.class, CoreTranslatorId.OSEE_DATASTORE_INIT_REQUEST);
- // checkExists(srvc, BasicArtifactTranslator.class, CoreTranslatorId.ARTIFACT_METADATA);
- // checkExists(srvc, BranchTranslator.class, CoreTranslatorId.BRANCH);
- // checkExists(srvc, ArtifactTypeTranslator.class, CoreTranslatorId.ARTIFACT_TYPE);
- // checkExists(srvc, AttributeTypeTranslator.class, CoreTranslatorId.ATTRIBUTE_TYPE);
- // checkExists(srvc, RelationTypeTranslator.class, CoreTranslatorId.RELATION_TYPE);
- // checkExists(srvc, OseeEnumTypeTranslator.class, CoreTranslatorId.OSEE_ENUM_TYPE);
- // checkExists(srvc, OseeEnumEntryTranslator.class, CoreTranslatorId.OSEE_ENUM_ENTRY);
}
- @SuppressWarnings("unchecked")
- private void checkExists(IDataTranslationService service, Class<? extends ITranslator> expected, ITranslatorId key) throws OseeCoreException {
+ private void checkExists(IDataTranslationService service, Class<? extends ITranslator<?>> expected, ITranslatorId key) throws OseeCoreException {
ITranslator<?> actual = service.getTranslator(key);
Assert.assertNotNull(actual);
Assert.assertEquals(expected, actual.getClass());
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java
index ea2f1ec4c9..0c649a5378 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java
@@ -18,10 +18,9 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.message.TransactionCacheUpdateResponse;
import org.eclipse.osee.framework.core.message.internal.translation.TransactionCacheUpdateResponseTranslator;
import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
-import org.eclipse.osee.framework.core.message.test.mocks.MockRequestFactory;
import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
import org.eclipse.osee.framework.core.model.test.mocks.MockDataFactory;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -51,10 +50,9 @@ public class TransactionCacheUpdateResponseTranslatorTest extends BaseTranslator
}
@Parameters
- public static Collection<Object[]> data() throws OseeCoreException {
- IOseeModelFactoryServiceProvider factoryProvider = MockRequestFactory.createFactoryProvider();
+ public static Collection<Object[]> data() {
ITranslator<TransactionCacheUpdateResponse> translator =
- new TransactionCacheUpdateResponseTranslator(factoryProvider);
+ new TransactionCacheUpdateResponseTranslator(new TransactionRecordFactory());
List<Object[]> data = new ArrayList<Object[]>();
for (int index = 1; index <= 2; index++) {
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java
index d55489f2ea..b55f2e5d24 100644
--- a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java
@@ -16,10 +16,9 @@ import java.util.List;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator;
import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
-import org.eclipse.osee.framework.core.message.test.mocks.MockRequestFactory;
import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
import org.eclipse.osee.framework.core.model.test.mocks.MockDataFactory;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.junit.Assert;
import org.junit.runner.RunWith;
@@ -45,9 +44,8 @@ public class TransactionRecordTranslatorTest extends BaseTranslatorTest<Transact
}
@Parameters
- public static Collection<Object[]> data() throws OseeCoreException {
- IOseeModelFactoryServiceProvider factoryProvider = MockRequestFactory.createFactoryProvider();
- ITranslator<TransactionRecord> translator = new TransactionRecordTranslator(factoryProvider);
+ public static Collection<Object[]> data() {
+ ITranslator<TransactionRecord> translator = new TransactionRecordTranslator(new TransactionRecordFactory());
List<Object[]> data = new ArrayList<Object[]>();
for (int index = 1; index <= 2; index++) {
data.add(new Object[] {MockDataFactory.createTransaction(index * 10, index * 3), translator});
diff --git a/plugins/org.eclipse.osee.framework.core.message/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.message/META-INF/MANIFEST.MF
index 7357b027f1..b7809717fd 100644
--- a/plugins/org.eclipse.osee.framework.core.message/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.core.message/META-INF/MANIFEST.MF
@@ -17,6 +17,8 @@ Import-Package: org.eclipse.core.runtime,
org.eclipse.osee.framework.core.translation,
org.eclipse.osee.framework.core.util,
org.eclipse.osee.framework.jdk.core.type,
+ org.eclipse.osee.framework.jdk.core.util,
+ org.eclipse.osee.framework.logging,
org.osgi.framework,
org.osgi.util.tracker
Export-Package: org.eclipse.osee.framework.core.message
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/Activator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/Activator.java
index cc1f1e8902..d2edeeaaa6 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/Activator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/Activator.java
@@ -10,109 +10,25 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.message.internal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.eclipse.osee.framework.core.enums.OseeServiceTrackerId;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.BranchFactory;
-import org.eclipse.osee.framework.core.model.OseeModelFactoryService;
-import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
-import org.eclipse.osee.framework.core.model.type.ArtifactTypeFactory;
-import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory;
-import org.eclipse.osee.framework.core.model.type.OseeEnumTypeFactory;
-import org.eclipse.osee.framework.core.model.type.RelationTypeFactory;
-import org.eclipse.osee.framework.core.services.IOseeCachingService;
-import org.eclipse.osee.framework.core.services.IOseeCachingServiceProvider;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
-import org.eclipse.osee.framework.core.translation.IDataTranslationService;
+import org.eclipse.osee.framework.core.util.ServiceDependencyTracker;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.util.tracker.ServiceTracker;
-public class Activator implements BundleActivator, IOseeCachingServiceProvider, IOseeModelFactoryServiceProvider {
+public class Activator implements BundleActivator {
public static final String PLUGIN_ID = "org.eclipse.osee.framework.core.model";
- private static Activator instance = null;
- private BundleContext bundleContext;
- private final List<ServiceRegistration> services;
- private final Map<OseeServiceTrackerId, ServiceTracker> mappedTrackers;
-
- public Activator() {
- services = new ArrayList<ServiceRegistration>();
- mappedTrackers = new HashMap<OseeServiceTrackerId, ServiceTracker>();
- }
+ private ServiceDependencyTracker dependencyTracker;
@Override
public void start(BundleContext context) throws Exception {
- instance = this;
- instance.bundleContext = context;
-
- IOseeModelFactoryService factories = createFactoryService();
- IDataTranslationService service = new DataTranslationServiceFactory().createService(this, this);
-
- createService(context, IOseeModelFactoryService.class, factories);
- createService(context, IDataTranslationService.class, service);
-
- createServiceTracker(context, IOseeCachingService.class, OseeServiceTrackerId.OSEE_CACHING_SERVICE);
- createServiceTracker(context, IOseeModelFactoryService.class, OseeServiceTrackerId.OSEE_MODEL_FACTORY);
- }
-
- private IOseeModelFactoryService createFactoryService() {
- return new OseeModelFactoryService(new BranchFactory(), new TransactionRecordFactory(),
- new ArtifactTypeFactory(), new AttributeTypeFactory(), new RelationTypeFactory(), new OseeEnumTypeFactory());
+ dependencyTracker = new ServiceDependencyTracker(context, new DataTranslationServiceRegHandler());
+ dependencyTracker.open();
}
@Override
public void stop(BundleContext context) throws Exception {
- for (ServiceRegistration service : services) {
- service.unregister();
- }
-
- for (ServiceTracker tracker : mappedTrackers.values()) {
- tracker.close();
- }
- services.clear();
- mappedTrackers.clear();
-
- instance.bundleContext = null;
- instance = null;
- }
-
- public static BundleContext getBundleContext() {
- return instance.bundleContext;
- }
-
- private void createService(BundleContext context, Class<?> serviceInterface, Object serviceImplementation) {
- services.add(context.registerService(serviceInterface.getName(), serviceImplementation, null));
- }
-
- private void createServiceTracker(BundleContext context, Class<?> clazz, OseeServiceTrackerId trackerId) {
- ServiceTracker tracker = new ServiceTracker(context, clazz.getName(), null);
- tracker.open();
- mappedTrackers.put(trackerId, tracker);
- }
-
- @Override
- public IOseeCachingService getOseeCachingService() {
- return getTracker(OseeServiceTrackerId.OSEE_CACHING_SERVICE, IOseeCachingService.class);
+ Lib.close(dependencyTracker);
}
- private <T> T getTracker(OseeServiceTrackerId trackerId, Class<T> clazz) {
- ServiceTracker tracker = mappedTrackers.get(trackerId);
- Object service = tracker.getService();
- return clazz.cast(service);
- }
-
- @Override
- public IOseeModelFactoryService getOseeFactoryService() throws OseeCoreException {
- return getTracker(OseeServiceTrackerId.OSEE_MODEL_FACTORY, IOseeModelFactoryService.class);
- }
-
- public static Activator getInstance() {
- return instance;
- }
}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java
index 920e272b50..c8157d3c08 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java
@@ -37,8 +37,9 @@ import org.eclipse.osee.framework.core.message.internal.translation.RelationType
import org.eclipse.osee.framework.core.message.internal.translation.TableDataTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.TransactionCacheUpdateResponseTranslator;
import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator;
-import org.eclipse.osee.framework.core.services.IOseeCachingServiceProvider;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
+import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
/**
@@ -48,28 +49,13 @@ import org.eclipse.osee.framework.core.translation.IDataTranslationService;
public class DataTranslationServiceFactory {
public DataTranslationServiceFactory() {
+ //
}
- public IDataTranslationService createService(IOseeCachingServiceProvider cachingService, IOseeModelFactoryServiceProvider factoryProvider) throws OseeCoreException {
+ public IDataTranslationService createService(IOseeCachingService cachingService, TransactionRecordFactory txRecordFactory, AttributeTypeFactory attributeTypeFactory) throws OseeCoreException {
IDataTranslationService service = new DataTranslationService();
- // service.addTranslator(new BasicArtifactTranslator(),
- // CoreTranslatorId.ARTIFACT_METADATA);
- // service.addTranslator(new BranchTranslator(service, factoryProvider),
- // CoreTranslatorId.BRANCH);
-
- // service.addTranslator(new ArtifactTypeTranslator(service,
- // factoryProvider), CoreTranslatorId.ARTIFACT_TYPE);
- // service.addTranslator(new AttributeTypeTranslator(service,
- // factoryProvider), CoreTranslatorId.ATTRIBUTE_TYPE);
- // service.addTranslator(new RelationTypeTranslator(service,
- // factoryProvider), CoreTranslatorId.RELATION_TYPE);
- // service.addTranslator(new OseeEnumEntryTranslator(factoryProvider),
- // CoreTranslatorId.OSEE_ENUM_ENTRY);
- // service.addTranslator(new OseeEnumTypeTranslator(service,
- // factoryProvider), CoreTranslatorId.OSEE_ENUM_TYPE);
-
- service.addTranslator(new TransactionRecordTranslator(factoryProvider), CoreTranslatorId.TRANSACTION_RECORD);
+ service.addTranslator(new TransactionRecordTranslator(txRecordFactory), CoreTranslatorId.TRANSACTION_RECORD);
service.addTranslator(new BranchCreationRequestTranslator(), CoreTranslatorId.BRANCH_CREATION_REQUEST);
service.addTranslator(new BranchCreationResponseTranslator(), CoreTranslatorId.BRANCH_CREATION_RESPONSE);
@@ -92,13 +78,13 @@ public class DataTranslationServiceFactory {
service.addTranslator(new BranchCacheUpdateResponseTranslator(), CoreTranslatorId.BRANCH_CACHE_UPDATE_RESPONSE);
service.addTranslator(new BranchCacheStoreRequestTranslator(), CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST);
- service.addTranslator(new TransactionCacheUpdateResponseTranslator(factoryProvider),
+ service.addTranslator(new TransactionCacheUpdateResponseTranslator(txRecordFactory),
CoreTranslatorId.TX_CACHE_UPDATE_RESPONSE);
service.addTranslator(new ArtifactTypeCacheUpdateResponseTranslator(),
CoreTranslatorId.ARTIFACT_TYPE_CACHE_UPDATE_RESPONSE);
- service.addTranslator(new AttributeTypeCacheUpdateResponseTranslator(factoryProvider),
+ service.addTranslator(new AttributeTypeCacheUpdateResponseTranslator(attributeTypeFactory),
CoreTranslatorId.ATTRIBUTE_TYPE_CACHE_UPDATE_RESPONSE);
service.addTranslator(new RelationTypeCacheUpdateResponseTranslator(),
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceRegHandler.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceRegHandler.java
new file mode 100644
index 0000000000..b5a40ecca6
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceRegHandler.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.internal;
+
+import java.util.Map;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
+import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
+import org.eclipse.osee.framework.core.translation.IDataTranslationService;
+import org.eclipse.osee.framework.core.util.AbstractTrackingHandler;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DataTranslationServiceRegHandler extends AbstractTrackingHandler {
+
+ private static final Class<?>[] DEPENDENCIES = new Class<?>[] {//
+ IOseeCachingService.class, //
+ IOseeModelFactoryService.class //
+ };
+
+ private ServiceRegistration registration;
+
+ @Override
+ public Class<?>[] getDependencies() {
+ return DEPENDENCIES;
+ }
+
+ @Override
+ public void onActivate(BundleContext context, Map<Class<?>, Object> services) {
+ IOseeCachingService cachingService = getService(IOseeCachingService.class, services);
+ IOseeModelFactoryService factoryService = getService(IOseeModelFactoryService.class, services);
+
+ TransactionRecordFactory txFactory = factoryService.getTransactionFactory();
+ AttributeTypeFactory attributeTypeFactory = factoryService.getAttributeTypeFactory();
+
+ DataTranslationServiceFactory factory = new DataTranslationServiceFactory();
+ try {
+ IDataTranslationService service = factory.createService(cachingService, txFactory, attributeTypeFactory);
+ registration = context.registerService(IDataTranslationService.class.getName(), service, null);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, Level.SEVERE, ex);
+ }
+ }
+
+ @Override
+ public void onDeActivate() {
+ if (registration != null) {
+ registration.unregister();
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/AttributeTypeCacheUpdateResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/AttributeTypeCacheUpdateResponseTranslator.java
index e71057fc5d..f3b6cd5588 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/AttributeTypeCacheUpdateResponseTranslator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/AttributeTypeCacheUpdateResponseTranslator.java
@@ -20,7 +20,6 @@ import org.eclipse.osee.framework.core.message.AttributeTypeCacheUpdateResponse;
import org.eclipse.osee.framework.core.message.TranslationUtil;
import org.eclipse.osee.framework.core.model.type.AttributeType;
import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
@@ -35,14 +34,14 @@ public class AttributeTypeCacheUpdateResponseTranslator implements ITranslator<A
ATTR_TO_ENUM;
}
- private final IOseeModelFactoryServiceProvider provider;
+ private final AttributeTypeFactory attributeTypeFactory;
- public AttributeTypeCacheUpdateResponseTranslator(IOseeModelFactoryServiceProvider provider) {
- this.provider = provider;
+ public AttributeTypeCacheUpdateResponseTranslator(AttributeTypeFactory attributeTypeFactory) {
+ this.attributeTypeFactory = attributeTypeFactory;
}
- private AttributeTypeFactory getFactory() throws OseeCoreException {
- return provider.getOseeFactoryService().getAttributeTypeFactory();
+ private AttributeTypeFactory getFactory() {
+ return attributeTypeFactory;
}
@Override
@@ -60,7 +59,7 @@ public class AttributeTypeCacheUpdateResponseTranslator implements ITranslator<A
}
@Override
- public PropertyStore convert(AttributeTypeCacheUpdateResponse object) throws OseeCoreException {
+ public PropertyStore convert(AttributeTypeCacheUpdateResponse object) {
PropertyStore store = new PropertyStore();
List<AttributeType> rows = object.getAttrTypeRows();
for (int index = 0; index < rows.size(); index++) {
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java
index 68a614fa0f..89883fe1db 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionCacheUpdateResponseTranslator.java
@@ -18,7 +18,6 @@ import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.message.TransactionCacheUpdateResponse;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
@@ -34,14 +33,14 @@ public class TransactionCacheUpdateResponseTranslator implements ITranslator<Tra
TX_TO_BRANCH;
}
- private final IOseeModelFactoryServiceProvider provider;
+ private final TransactionRecordFactory txRecordFactory;
- public TransactionCacheUpdateResponseTranslator(IOseeModelFactoryServiceProvider provider) {
- this.provider = provider;
+ public TransactionCacheUpdateResponseTranslator(TransactionRecordFactory txRecordFactory) {
+ this.txRecordFactory = txRecordFactory;
}
- private TransactionRecordFactory getFactory() throws OseeCoreException {
- return provider.getOseeFactoryService().getTransactionFactory();
+ private TransactionRecordFactory getFactory() {
+ return txRecordFactory;
}
@Override
@@ -57,7 +56,7 @@ public class TransactionCacheUpdateResponseTranslator implements ITranslator<Tra
}
@Override
- public PropertyStore convert(TransactionCacheUpdateResponse object) throws OseeCoreException {
+ public PropertyStore convert(TransactionCacheUpdateResponse object) {
PropertyStore store = new PropertyStore();
List<TransactionRecord> rows = object.getTxRows();
for (int index = 0; index < rows.size(); index++) {
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java
index e54132f7f3..77b3405062 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/translation/TransactionRecordTranslator.java
@@ -16,7 +16,6 @@ import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.TransactionRecord;
import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
-import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
@@ -35,10 +34,10 @@ public final class TransactionRecordTranslator implements ITranslator<Transactio
TRANSACTION_COMMIT_ART_ID;
}
- private final IOseeModelFactoryServiceProvider factoryProvider;
+ private final TransactionRecordFactory txRecordFactory;
- public TransactionRecordTranslator(IOseeModelFactoryServiceProvider factoryProvider) {
- this.factoryProvider = factoryProvider;
+ public TransactionRecordTranslator(TransactionRecordFactory txRecordFactory) {
+ this.txRecordFactory = txRecordFactory;
}
@Override
@@ -50,12 +49,11 @@ public final class TransactionRecordTranslator implements ITranslator<Transactio
int authorArtId = store.getInt(Entry.TRANSACTION_AUTHOR_ART_ID.name());
int commitArtId = store.getInt(Entry.TRANSACTION_COMMIT_ART_ID.name());
int branchId = store.getInt(Entry.TRANSACTION_BRANCH.name());
- TransactionRecordFactory factory = factoryProvider.getOseeFactoryService().getTransactionFactory();
- return factory.create(transactionNumber, branchId, comment, time, authorArtId, commitArtId, txType);
+ return txRecordFactory.create(transactionNumber, branchId, comment, time, authorArtId, commitArtId, txType);
}
@Override
- public PropertyStore convert(TransactionRecord data) throws OseeCoreException {
+ public PropertyStore convert(TransactionRecord data) {
PropertyStore store = new PropertyStore();
store.put(Entry.TRANSACTION_ID.name(), data.getId());
store.put(Entry.TRANSACTION_TX_TYPE.name(), data.getTxType().name());
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/internal/Activator.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/internal/Activator.java
index aaae2a2b65..fb92aede60 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/internal/Activator.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/internal/Activator.java
@@ -10,16 +10,38 @@
*******************************************************************************/
package org.eclipse.osee.framework.core.model.internal;
+import org.eclipse.osee.framework.core.model.BranchFactory;
+import org.eclipse.osee.framework.core.model.OseeModelFactoryService;
+import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
+import org.eclipse.osee.framework.core.model.type.ArtifactTypeFactory;
+import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory;
+import org.eclipse.osee.framework.core.model.type.OseeEnumTypeFactory;
+import org.eclipse.osee.framework.core.model.type.RelationTypeFactory;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
public class Activator implements BundleActivator {
+ private ServiceRegistration registration;
+
@Override
public void start(BundleContext context) throws Exception {
+ IOseeModelFactoryService service = createFactoryService();
+ registration = context.registerService(IOseeModelFactoryService.class.getName(), service, null);
}
@Override
public void stop(BundleContext context) throws Exception {
+ if (registration != null) {
+ registration.unregister();
+ }
+ }
+
+ private IOseeModelFactoryService createFactoryService() {
+ return new OseeModelFactoryService(new BranchFactory(), new TransactionRecordFactory(),
+ new ArtifactTypeFactory(), new AttributeTypeFactory(), new RelationTypeFactory(), new OseeEnumTypeFactory());
}
+
}

Back to the top