Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M Finkbeiner2012-04-02 12:02:03 -0400
committerRoberto E. Escobar2012-04-02 12:02:03 -0400
commit9b5d850481315fd2a9dd4a37c5eba77738461905 (patch)
tree73ac4d0742eda5ac7a7fb659b5c6abd9ae49b0fe
parent224db6dc2caebbc847aafaf0ce8eb8e16fef343d (diff)
downloadorg.eclipse.osee-9b5d850481315fd2a9dd4a37c5eba77738461905.tar.gz
org.eclipse.osee-9b5d850481315fd2a9dd4a37c5eba77738461905.tar.xz
org.eclipse.osee-9b5d850481315fd2a9dd4a37c5eba77738461905.zip
feature[ats_PBMQF]: Remove IMessageDictionary and related dependencies
-rw-r--r--plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/internal/state/UnresolvedState.java5
-rw-r--r--plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/ILibraryLoader.java30
-rw-r--r--plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IMessageDictionary.java41
-rw-r--r--plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IOteClientService.java7
-rw-r--r--plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IOteRuntimeLibraryProvider.java19
-rw-r--r--plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestClientServiceImpl.java32
-rw-r--r--plugins/org.eclipse.osee.ote.ui.message.util/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageElementSelectionDialog.java18
-rw-r--r--plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageSelectionDialog.java43
9 files changed, 33 insertions, 165 deletions
diff --git a/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/internal/state/UnresolvedState.java b/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/internal/state/UnresolvedState.java
index aef6ef9a2e..fbd807d654 100644
--- a/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/internal/state/UnresolvedState.java
+++ b/plugins/org.eclipse.osee.ote.client.msg/src/org/eclipse/osee/ote/client/msg/core/internal/state/UnresolvedState.java
@@ -12,8 +12,7 @@ package org.eclipse.osee.ote.client.msg.core.internal.state;
import java.util.HashSet;
import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.osee.framework.logging.OseeLog;
+
import org.eclipse.osee.ote.client.msg.core.db.AbstractMessageDataBase;
import org.eclipse.osee.ote.client.msg.core.db.MessageInstance;
import org.eclipse.osee.ote.client.msg.core.internal.MessageSubscription;
@@ -60,7 +59,7 @@ public class UnresolvedState extends AbstractSubscriptionState {
getSubscription().notifyResolved();
return new InactiveState(instance, msgDB, this);
} catch (Exception e) {
- OseeLog.log(UnresolvedState.class, Level.SEVERE, "problems acquring instance for " + getMsgClassName(), e);
+// OseeLog.log(UnresolvedState.class, Level.SEVERE, "problems acquring instance for " + getMsgClassName(), e); should we be logging this?
getSubscription().notifyInvalidated();
return this;
}
diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/ILibraryLoader.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/ILibraryLoader.java
deleted file mode 100644
index b97c0e6e07..0000000000
--- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/ILibraryLoader.java
+++ /dev/null
@@ -1,30 +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.ote.service;
-
-public interface ILibraryLoader {
- /**
- * loads a message class dictionary. If one is already loaded then it will be unloaded.
- */
- void loadMessageDictionary(IMessageDictionary dictionary);
-
- /**
- * unloads the current {@link IMessageDictionary} from the system.
- */
- void unloadMessageDictionary();
-
- /**
- * gets the currently loaded {@link IMessageDictionary}
- *
- * @return the {@link IMessageDictionary} or null if one is not loaded
- */
- IMessageDictionary getLoadedDictionary();
-}
diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IMessageDictionary.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IMessageDictionary.java
deleted file mode 100644
index ec09e6964e..0000000000
--- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IMessageDictionary.java
+++ /dev/null
@@ -1,41 +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.ote.service;
-
-import java.io.IOException;
-import org.eclipse.osee.ote.message.Message;
-import org.eclipse.osee.ote.message.MessageSink;
-
-/**
- * Allows the lookup of message definitions
- *
- * @author Ken J. Aguilar
- */
-public interface IMessageDictionary {
-
- String getMessageLibraryVersion() throws IOException;
-
- /**
- * Generates a listing of all messages and associated elements defined in the message jar. The intent is to provide a
- * method for searching the message jar for certain messages
- */
- void generateMessageIndex(final MessageSink sink) throws Exception;
-
- /**
- * Finds the class definition of a message of the given name
- *
- * @return Returns values reference.
- * @throws ClassNotFoundException if no class definition was found with the given name
- */
- Class<? extends Message> lookupMessage(String messageName) throws ClassNotFoundException;
-
- void dispose();
-}
diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IOteClientService.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IOteClientService.java
index 3b4b7ad6d7..4eff06b00b 100644
--- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IOteClientService.java
+++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IOteClientService.java
@@ -100,13 +100,6 @@ public interface IOteClientService {
void setSessionDelegate(SessionDelegate sessionDelegate);
/**
- * gets the currently loaded {@link IMessageDictionary}
- *
- * @return the {@link IMessageDictionary} or null if one is not loaded
- */
- IMessageDictionary getLoadedDictionary();
-
- /**
* returns a collection of all the {@link IHostTestEnvironment} that are currently available.
*/
List<IServiceConnector> getAvailableTestHosts();
diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IOteRuntimeLibraryProvider.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IOteRuntimeLibraryProvider.java
deleted file mode 100644
index 9f46e401f6..0000000000
--- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/IOteRuntimeLibraryProvider.java
+++ /dev/null
@@ -1,19 +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.ote.service;
-
-import java.util.Collection;
-
-public interface IOteRuntimeLibraryProvider {
- void initialize(ILibraryLoader libraryLoader);
-
- Collection<IMessageDictionary> getLibraries();
-}
diff --git a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestClientServiceImpl.java b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestClientServiceImpl.java
index 2c18302a0d..67f3fab274 100644
--- a/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestClientServiceImpl.java
+++ b/plugins/org.eclipse.osee.ote.client/src/org/eclipse/osee/ote/service/core/TestClientServiceImpl.java
@@ -35,8 +35,6 @@ import org.eclipse.osee.ote.core.environment.interfaces.ITestEnvironment;
import org.eclipse.osee.ote.service.Activator;
import org.eclipse.osee.ote.service.ConnectionEvent;
import org.eclipse.osee.ote.service.IEnvironmentConfigurer;
-import org.eclipse.osee.ote.service.ILibraryLoader;
-import org.eclipse.osee.ote.service.IMessageDictionary;
import org.eclipse.osee.ote.service.IOteClientService;
import org.eclipse.osee.ote.service.ITestConnectionListener;
import org.eclipse.osee.ote.service.ITestEnvironmentAvailibilityListener;
@@ -45,7 +43,7 @@ import org.eclipse.osee.ote.service.OteServiceProperties;
import org.eclipse.osee.ote.service.SessionDelegate;
import org.eclipse.osee.ote.service.TestSessionException;
-public class TestClientServiceImpl implements IOteClientService, IConnectorListener, ILibraryLoader {
+public class TestClientServiceImpl implements IOteClientService, IConnectorListener {
private static final String NO_USER_MSG = "a user has not been set";
private final IConnectionService connectionService;
@@ -57,7 +55,6 @@ public class TestClientServiceImpl implements IOteClientService, IConnectorListe
private ClientSession session = null;
private volatile boolean stopped = false;
private final ArrayList<ITestEnvironmentFilter> environmentFilters = new ArrayList<ITestEnvironmentFilter>();
- private IMessageDictionary dictionary;
private TestHostConnection testConnection;
private final OteClientEndpointSend endpointSend;
@@ -212,13 +209,6 @@ public class TestClientServiceImpl implements IOteClientService, IConnectorListe
session.close();
}
}
- if (dictionary != null) {
- try {
- unloadMessageDictionary();
- } catch (Exception e) {
- Activator.log(Level.SEVERE, "exception while trying to unload dictionary during stop()", e);
- }
- }
stopped = true;
hostAvailabilityListeners.clear();
environmentFilters.clear();
@@ -437,26 +427,6 @@ public class TestClientServiceImpl implements IOteClientService, IConnectorListe
}
@Override
- public synchronized void loadMessageDictionary(IMessageDictionary newDictionary) {
- checkState();
- if (newDictionary == null) {
- throw new NullPointerException("dictionary cannot be null");
- }
- dictionary = newDictionary;
- }
-
- @Override
- public synchronized void unloadMessageDictionary() {
- checkState();
- dictionary = null;
- }
-
- @Override
- public synchronized IMessageDictionary getLoadedDictionary() {
- return dictionary;
- }
-
- @Override
public void onConnectionServiceStopped() {
}
diff --git a/plugins/org.eclipse.osee.ote.ui.message.util/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.ui.message.util/META-INF/MANIFEST.MF
index 111fb2fa4e..1165e8057f 100644
--- a/plugins/org.eclipse.osee.ote.ui.message.util/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ote.ui.message.util/META-INF/MANIFEST.MF
@@ -13,5 +13,6 @@ Require-Bundle: org.eclipse.ui,
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.osee.ote.ui.message.util
-Import-Package: org.eclipse.osee.framework.jdk.core.persistence
+Import-Package: org.eclipse.osee.framework.jdk.core.persistence,
+ org.eclipse.osee.framework.plugin.core.util
Bundle-Vendor: Eclipse Open System Engineering Environment
diff --git a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageElementSelectionDialog.java b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageElementSelectionDialog.java
index 8a493f25cc..6010c6e2b2 100644
--- a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageElementSelectionDialog.java
+++ b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageElementSelectionDialog.java
@@ -12,19 +12,20 @@ package org.eclipse.osee.ote.ui.message.util;
import java.util.LinkedList;
import java.util.List;
+
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.osee.framework.plugin.core.util.ExportClassLoader;
import org.eclipse.osee.ote.message.ElementPath;
import org.eclipse.osee.ote.message.Message;
+import org.eclipse.osee.ote.message.MessageDefinitionProvider;
import org.eclipse.osee.ote.message.elements.Element;
import org.eclipse.osee.ote.message.elements.RecordElement;
import org.eclipse.osee.ote.message.elements.RecordMap;
-import org.eclipse.osee.ote.service.IMessageDictionary;
-import org.eclipse.osee.ote.service.IOteClientService;
-import org.eclipse.osee.ote.ui.message.util.internal.Activator;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.osgi.framework.FrameworkUtil;
import org.osgi.util.tracker.ServiceTracker;
/**
@@ -54,18 +55,15 @@ public class MessageElementSelectionDialog extends ElementListSelectionDialog {
private static Message<?, ?, ?> getMessage(String msg) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
ServiceTracker tracker =
- new ServiceTracker(Activator.getDefault().getBundle().getBundleContext(), IOteClientService.class.getName(),
+ new ServiceTracker(FrameworkUtil.getBundle(MessageElementSelectionDialog.class).getBundleContext(), MessageDefinitionProvider.class.getName(),
null);
tracker.open(true);
try {
- IMessageDictionary dictionary = ((IOteClientService) tracker.waitForService(1000)).getLoadedDictionary();
- if (dictionary == null) {
+ Object[] dictionary = tracker.getServices();
+ if (dictionary.length == 0) {
throw new IllegalStateException("no dictionary loaded");
}
- return dictionary.lookupMessage(msg).newInstance();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new IllegalStateException("interrupted", e);
+ return ExportClassLoader.getInstance().loadClass(msg).asSubclass(Message.class).newInstance();
} finally {
tracker.close();
}
diff --git a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageSelectionDialog.java b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageSelectionDialog.java
index 531c4fe032..78772b062c 100644
--- a/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageSelectionDialog.java
+++ b/plugins/org.eclipse.osee.ote.ui.message.util/src/org/eclipse/osee/ote/ui/message/util/MessageSelectionDialog.java
@@ -12,16 +12,16 @@ package org.eclipse.osee.ote.ui.message.util;
import java.util.ArrayList;
import java.util.logging.Level;
+
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.ote.message.MessageDefinitionProvider;
import org.eclipse.osee.ote.message.MessageSink;
-import org.eclipse.osee.ote.service.IMessageDictionary;
-import org.eclipse.osee.ote.service.IOteClientService;
-import org.eclipse.osee.ote.ui.message.util.internal.Activator;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.osgi.framework.FrameworkUtil;
import org.osgi.util.tracker.ServiceTracker;
/**
@@ -66,28 +66,25 @@ public class MessageSelectionDialog extends ElementListSelectionDialog {
});
ServiceTracker tracker =
- new ServiceTracker(Activator.getDefault().getBundle().getBundleContext(), IOteClientService.class.getName(),
- null);
+ new ServiceTracker(FrameworkUtil.getBundle(getClass()).getBundleContext(), MessageDefinitionProvider.class.getName(), null);
tracker.open(true);
try {
- IMessageDictionary dictionary = ((IOteClientService) tracker.waitForService(1000)).getLoadedDictionary();
- final ArrayList<String> messages = new ArrayList<String>(4096);
- dictionary.generateMessageIndex(new MessageSink() {
-
- @Override
- public void absorbElement(String elementName) {
- }
-
- @Override
- public void absorbMessage(String messageName) {
- messages.add(messageName);
- }
-
- @Override
- public void absorbProvider(String providerName) {
- }
-
- });
+ Object[] dictionaries = tracker.getServices();
+ final ArrayList<String> messages = new ArrayList<String>(4096);
+ for(Object dictionary:dictionaries){
+ ((MessageDefinitionProvider)dictionary).generateMessageIndex(new MessageSink() {
+ @Override
+ public void absorbElement(String elementName) {
+ }
+ @Override
+ public void absorbMessage(String messageName) {
+ messages.add(messageName);
+ }
+ @Override
+ public void absorbProvider(String providerName) {
+ }
+ });
+ }
setElements(messages.toArray());
} catch (Exception e) {
OseeLog.log(MessageSelectionDialog.class, Level.SEVERE, "failed to generate message listing", e);

Back to the top