Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2012-02-22 14:59:12 -0500
committerRyan D. Brooks2012-02-22 14:59:12 -0500
commit5258e6a1ace816ae2f9e057b22845fbd24562e08 (patch)
tree28b90b0dc464cd956282efdf0b1ba4d1ece5747b /plugins/org.eclipse.osee.framework.core.message/src/org
parentaf8a27e75f9ed5965d37bc0c5787ee9a226673a3 (diff)
downloadorg.eclipse.osee-5258e6a1ace816ae2f9e057b22845fbd24562e08.tar.gz
org.eclipse.osee-5258e6a1ace816ae2f9e057b22845fbd24562e08.tar.xz
org.eclipse.osee-5258e6a1ace816ae2f9e057b22845fbd24562e08.zip
feature[ats_VVMH0]: Integrate org.eclipse.osee.framework.core.message with X Server
Make services DS based Add org.eclipse.osee.framework.core.message into X Server Maven build
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.message/src/org')
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java8
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/Activator.java33
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java27
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceFactory.java5
-rw-r--r--plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceRegHandler.java63
5 files changed, 26 insertions, 110 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java
index 715ce1691c..dba2683f96 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/BranchCacheUpdateUtil.java
@@ -17,10 +17,8 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import java.util.logging.Level;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.message.internal.Activator;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.BranchFactory;
import org.eclipse.osee.framework.core.model.MergeBranch;
@@ -30,7 +28,6 @@ import org.eclipse.osee.framework.core.model.cache.TransactionCache;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
import org.eclipse.osee.framework.jdk.core.type.Triplet;
import org.eclipse.osee.framework.jdk.core.util.Strings;
-import org.eclipse.osee.framework.logging.OseeLog;
/**
* @author Megumi Telles
@@ -100,9 +97,8 @@ public final class BranchCacheUpdateUtil {
mergeBranch.setSourceBranch(sourceBranch);
mergeBranch.setDestinationBranch(destinationBranch);
} catch (ClassCastException ex) {
- OseeLog.logf(Activator.class, Level.SEVERE,
- "Problem casting branch [%s] to MergeBranch, source: [%s], dest: [%s]\r\nException: %s", branch,
- sourceBranch, destinationBranch, ex);
+ throw new OseeCoreException(ex, "Problem casting branch [%s] to MergeBranch, source: [%s], dest: [%s]",
+ branch, sourceBranch, destinationBranch);
}
}
return updatedItems;
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
deleted file mode 100644
index 018cdc4667..0000000000
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/Activator.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * 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 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;
-
-public class Activator implements BundleActivator {
-
- private ServiceDependencyTracker dependencyTracker;
-
- @Override
- public void start(BundleContext context) throws Exception {
- dependencyTracker = new ServiceDependencyTracker(context, new DataTranslationServiceRegHandler());
- dependencyTracker.open();
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- Lib.close(dependencyTracker);
- }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java
index 5f86b15159..3955501ce6 100644
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java
+++ b/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationService.java
@@ -14,12 +14,15 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.Collection;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeExceptions;
import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
+import org.eclipse.osee.framework.core.model.type.AttributeTypeFactory;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
import org.eclipse.osee.framework.core.translation.IDataTranslationService;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.eclipse.osee.framework.core.translation.ITranslatorId;
@@ -31,10 +34,26 @@ import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
*/
public class DataTranslationService implements IDataTranslationService {
- private final Map<ITranslatorId, ITranslator<?>> translators;
+ private final DataTranslationServiceFactory factoryConfigurator = new DataTranslationServiceFactory();
+ private final Map<ITranslatorId, ITranslator<?>> translators =
+ new ConcurrentHashMap<ITranslatorId, ITranslator<?>>();
- public DataTranslationService() {
- this.translators = new HashMap<ITranslatorId, ITranslator<?>>();
+ private IOseeModelFactoryService modelFactory;
+
+ public void setModelFactory(IOseeModelFactoryService modelFactory) {
+ this.modelFactory = modelFactory;
+ }
+
+ public void start() throws OseeCoreException {
+ TransactionRecordFactory txFactory = modelFactory.getTransactionFactory();
+ AttributeTypeFactory attributeTypeFactory = modelFactory.getAttributeTypeFactory();
+
+ translators.clear();
+ factoryConfigurator.configureService(this, txFactory, attributeTypeFactory);
+ }
+
+ public void stop() {
+ translators.clear();
}
@SuppressWarnings("unchecked")
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 cb90f7b3a9..4002fc9eb9 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
@@ -51,9 +51,7 @@ public class DataTranslationServiceFactory {
//
}
- public IDataTranslationService createService(TransactionRecordFactory txRecordFactory, AttributeTypeFactory attributeTypeFactory) throws OseeCoreException {
- IDataTranslationService service = new DataTranslationService();
-
+ public void configureService(IDataTranslationService service, TransactionRecordFactory txRecordFactory, AttributeTypeFactory attributeTypeFactory) throws OseeCoreException {
service.addTranslator(new TransactionRecordTranslator(txRecordFactory), CoreTranslatorId.TRANSACTION_RECORD);
service.addTranslator(new BranchCreationRequestTranslator(), CoreTranslatorId.BRANCH_CREATION_REQUEST);
@@ -98,6 +96,5 @@ public class DataTranslationServiceFactory {
service.addTranslator(new SearchRequestTranslator(), CoreTranslatorId.SEARCH_REQUEST);
service.addTranslator(new SearchResponseTranslator(), CoreTranslatorId.SEARCH_RESPONSE);
- return service;
}
}
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
deleted file mode 100644
index 5606876637..0000000000
--- a/plugins/org.eclipse.osee.framework.core.message/src/org/eclipse/osee/framework/core/message/internal/DataTranslationServiceRegHandler.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * 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.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<?>[] {//
- IOseeModelFactoryService.class //
- };
-
- private ServiceRegistration registration;
-
- @Override
- public Class<?>[] getDependencies() {
- return DEPENDENCIES;
- }
-
- @Override
- public void onActivate(BundleContext context, Map<Class<?>, Object> services) {
- IOseeModelFactoryService factoryService = getService(IOseeModelFactoryService.class, services);
-
- TransactionRecordFactory txFactory = factoryService.getTransactionFactory();
- AttributeTypeFactory attributeTypeFactory = factoryService.getAttributeTypeFactory();
- DataTranslationServiceFactory factory = new DataTranslationServiceFactory();
- try {
- IDataTranslationService service = factory.createService(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();
- }
- }
-
-}

Back to the top