Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M Finkbeiner2012-09-06 23:45:12 +0000
committerAndrew M Finkbeiner2012-09-06 23:45:12 +0000
commitd5e619b434b8e547d88eb2b3084f408e07040559 (patch)
tree3cc37cfe6e572d5c1cdc293dd3826e2d1cbd0545
parent1743b2808f8377a94a3342cac9acb2c401a8eea2 (diff)
downloadorg.eclipse.osee-d5e619b434b8e547d88eb2b3084f408e07040559.tar.gz
org.eclipse.osee-d5e619b434b8e547d88eb2b3084f408e07040559.tar.xz
org.eclipse.osee-d5e619b434b8e547d88eb2b3084f408e07040559.zip
bug: Clean up exception when recorder not set up by environment and use DS to register
-rw-r--r--plugins/org.eclipse.osee.ote.core/OSGI-INF/MessageToolServiceComponent.xml8
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/Activator.java6
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/internal/MessageWatchActivator.java68
-rw-r--r--plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/AbstractMessageToolService.java35
4 files changed, 38 insertions, 79 deletions
diff --git a/plugins/org.eclipse.osee.ote.core/OSGI-INF/MessageToolServiceComponent.xml b/plugins/org.eclipse.osee.ote.core/OSGI-INF/MessageToolServiceComponent.xml
new file mode 100644
index 00000000000..33d062c9541
--- /dev/null
+++ b/plugins/org.eclipse.osee.ote.core/OSGI-INF/MessageToolServiceComponent.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" name="org.eclipse.osee.ote.core.messageToolService">
+ <implementation class="org.eclipse.osee.ote.message.tool.AbstractMessageToolService"/>
+ <service>
+ <provide interface="org.eclipse.osee.ote.message.interfaces.IRemoteMessageService"/>
+ </service>
+ <reference bind="bindMessageManager" cardinality="1..1" interface="org.eclipse.osee.ote.message.interfaces.IMessageManager" name="IMessageManager" policy="static" unbind="unbindMessageManager"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/Activator.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/Activator.java
index df511c3d299..7fa95059bbe 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/Activator.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/core/internal/Activator.java
@@ -25,7 +25,6 @@ import org.eclipse.osee.ote.core.environment.TestEnvironmentInterface;
import org.eclipse.osee.ote.core.environment.console.ConsoleCommandManager;
import org.eclipse.osee.ote.core.environment.console.ICommandManager;
import org.eclipse.osee.ote.message.internal.MessageIoManagementStarter;
-import org.eclipse.osee.ote.message.internal.MessageWatchActivator;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
@@ -49,7 +48,6 @@ public class Activator implements BundleActivator {
private ServiceRegistration consoleCommandRegistration;
private ServiceRegistration commandDistributerRegistration;
private ServiceDependencyTracker serviceDependencyTracker;
- private MessageWatchActivator messageWatchActivator;
private MessageIoManagementStarter messageIoManagementStarter;
private ServiceTracker testEnvTracker;
@@ -77,9 +75,6 @@ public class Activator implements BundleActivator {
testEnvTracker = new ServiceTracker(context, TestEnvironmentInterface.class.getName(), null);
testEnvTracker.open(true);
- messageWatchActivator = new MessageWatchActivator(context);
- messageWatchActivator.open(true);
-
messageIoManagementStarter = new MessageIoManagementStarter(context);
messageIoManagementStarter.open(true);
}
@@ -97,7 +92,6 @@ public class Activator implements BundleActivator {
consoleCommandRegistration.unregister();
commandDistributerRegistration.unregister();
- messageWatchActivator.close();
messageIoManagementStarter.close();
testEnvTracker.close();
}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/internal/MessageWatchActivator.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/internal/MessageWatchActivator.java
deleted file mode 100644
index 1ccf2fbd79d..00000000000
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/internal/MessageWatchActivator.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.ote.message.internal;
-
-import java.util.logging.Level;
-
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.ote.message.interfaces.IMessageManager;
-import org.eclipse.osee.ote.message.interfaces.IRemoteMessageService;
-import org.eclipse.osee.ote.message.tool.AbstractMessageToolService;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.util.tracker.ServiceTracker;
-
-public class MessageWatchActivator extends ServiceTracker {
-
- private ServiceRegistration registration;
-
- public MessageWatchActivator(BundleContext context) {
- super(context, IMessageManager.class.getName(), null);
- }
-
- @Override
- public synchronized IMessageManager addingService(ServiceReference reference) {
- IMessageManager manager = (IMessageManager) super.addingService(reference);
- try {
- AbstractMessageToolService toolService = new AbstractMessageToolService(manager);
- registration = context.registerService(IRemoteMessageService.class.getName(), toolService, null);
- } catch (Exception e) {
- OseeLog.log(MessageWatchActivator.class, Level.SEVERE, "!!!failed to create message tool service", e);
- }
- return manager;
- }
-
- @Override
- public synchronized void removedService(ServiceReference reference, Object service) {
- disposeToolService();
- super.removedService(reference, service);
- }
-
- private void disposeToolService() {
- try {
- AbstractMessageToolService toolService =
- (AbstractMessageToolService) context.getService(registration.getReference());
- toolService.terminateService();
- } finally {
- registration.unregister();
- registration = null;
- }
- }
-
- @Override
- public synchronized void close() {
- if (registration != null) {
- disposeToolService();
- }
- super.close();
- }
-}
diff --git a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/AbstractMessageToolService.java b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/AbstractMessageToolService.java
index d5e8112295e..0a4991d680e 100644
--- a/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/AbstractMessageToolService.java
+++ b/plugins/org.eclipse.osee.ote.core/src/org/eclipse/osee/ote/message/tool/AbstractMessageToolService.java
@@ -73,12 +73,13 @@ public class AbstractMessageToolService implements IRemoteMessageService {
private static final boolean debugEnabled = false;
+ private IMessageManager messageManager;
private final HashMap<String, Throwable> cancelledSubscriptions = new HashMap<String, Throwable>(40);
private DatagramChannel channel;
private final HashMap<String, Map<DataType, EnumMap<MessageMode, SubscriptionRecord>>> messageMap =
new HashMap<String, Map<DataType, EnumMap<MessageMode, SubscriptionRecord>>>(100);
- private final IMessageRequestor messageRequestor;
+ private IMessageRequestor messageRequestor;
private MessageRecorder recorder;
private DatagramChannel recorderOutputChannel;
private volatile boolean terminated = false;
@@ -340,12 +341,34 @@ public class AbstractMessageToolService implements IRemoteMessageService {
/**
* Constructs a new message manager service
*/
- public AbstractMessageToolService(IMessageManager messageManager) throws IOException {
- openXmitChannel();
+ public AbstractMessageToolService() {
- messageRequestor = messageManager.createMessageRequestor(getClass().getName());
}
+
+ public void start(){
+ try {
+ openXmitChannel();
+ messageRequestor = messageManager.createMessageRequestor(getClass().getName());
+ } catch (IOException e) {
+ OseeLog.log(getClass(), Level.SEVERE, e);
+ }
+
+ }
+
+ public void stop(){
+ terminateService();
+ }
+
+ public void bindMessageManager(IMessageManager messageManager){
+ this.messageManager = messageManager;
+ }
+
+ public void unbindMessageManager(IMessageManager messageManager){
+ this.messageManager = null;
+ }
+
+
private void openXmitChannel() throws IOException {
channel = DatagramChannel.open();
if (channel.socket().getSendBufferSize() < SEND_BUFFER_SIZE) {
@@ -859,7 +882,9 @@ public class AbstractMessageToolService implements IRemoteMessageService {
}
try {
- recorderOutputChannel.close();
+ if(recorderOutputChannel != null){
+ recorderOutputChannel.close();
+ }
} catch (IOException ex) {
OseeLog.log(MessageSystemTestEnvironment.class, Level.SEVERE, ex.getMessage(), ex);
}

Back to the top