From be9d96b7e3c94308373305d6878787e330c06f95 Mon Sep 17 00:00:00 2001 From: Francois Chouinard Date: Tue, 22 Sep 2009 15:31:17 +0000 Subject: [PATCH] [290145] Preliminary patch uploaded --- .../tmf/component/ITmfComponent.java | 3 +- .../tmf/component/ITmfTransform.java | 26 +++++++++ .../tmf/component/TmfComponent.java | 58 ++----------------- .../tmf/component/TmfTransform.java | 7 +-- .../tmf/signal/TmfSignalManager.java | 43 -------------- 5 files changed, 34 insertions(+), 103 deletions(-) create mode 100644 org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/ITmfTransform.java diff --git a/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/ITmfComponent.java b/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/ITmfComponent.java index 4acefa5cfa..64f68c2099 100644 --- a/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/ITmfComponent.java +++ b/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/ITmfComponent.java @@ -12,11 +12,12 @@ package org.eclipse.linuxtools.tmf.component; - /** * ITmfComponent *

* TODO: Implement me. Please. */ public interface ITmfComponent { + + public void dispose(); } diff --git a/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/ITmfTransform.java b/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/ITmfTransform.java new file mode 100644 index 0000000000..1bbf929386 --- /dev/null +++ b/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/ITmfTransform.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2009 Ericsson + * + * 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: + * Francois Chouinard - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.linuxtools.tmf.component; + +/** + * ITmfTransform + *

+ * TODO: Implement me. Please. + */ +public interface ITmfTransform { + + /** + * + */ + public void transformData(); +} diff --git a/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfComponent.java b/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfComponent.java index 4a6082bff8..eefb3248ec 100644 --- a/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfComponent.java +++ b/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfComponent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson + * Copyright (c) 2009 Ericsson * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which @@ -12,69 +12,21 @@ package org.eclipse.linuxtools.tmf.component; -import org.eclipse.linuxtools.tmf.Tracer; -import org.eclipse.linuxtools.tmf.signal.TmfSignal; import org.eclipse.linuxtools.tmf.signal.TmfSignalManager; /** * TmfComponent *

- * This is the base class of the TMF components. - *

- * Currently, it only addresses the inter-component signaling. + * TODO: Implement me. Please. */ public abstract class TmfComponent implements ITmfComponent { - private String fName; - - // ------------------------------------------------------------------------ - // Constructor - // ------------------------------------------------------------------------ - - public TmfComponent(String name) { - fName = name; - if (Tracer.isComponentTraced()) Tracer.traceComponent(this, "created"); - TmfSignalManager.register(this); - } - - public TmfComponent(TmfComponent oldComponent) { - this.fName = oldComponent.fName; - - // Should we register? Probably not but I'm not quite sure what this does - //register(); - } - - /* (non-Javadoc) - * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#getName() - */ - protected void setName(String name) { - fName = name; - } - - // ------------------------------------------------------------------------ - // ITmfComponent - // ------------------------------------------------------------------------ - - /* (non-Javadoc) - * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#getName() - */ - public String getName() { - return fName; + public TmfComponent() { + TmfSignalManager.addListener(this); } - /* (non-Javadoc) - * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#dispose() - */ public void dispose() { - TmfSignalManager.deregister(this); - if (Tracer.isComponentTraced()) Tracer.traceComponent(this, "terminated"); - } - - /* (non-Javadoc) - * @see org.eclipse.linuxtools.tmf.component.ITmfComponent#broadcast(org.eclipse.linuxtools.tmf.signal.TmfSignal) - */ - public void broadcast(TmfSignal signal) { - TmfSignalManager.dispatchSignal(signal); + TmfSignalManager.removeListener(this); } } diff --git a/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfTransform.java b/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfTransform.java index 1f457be7af..a666aaf5fc 100644 --- a/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfTransform.java +++ b/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/component/TmfTransform.java @@ -17,11 +17,6 @@ package org.eclipse.linuxtools.tmf.component; *

* TODO: Implement me. Please. */ -public abstract class TmfTransform implements ITmfComponent { +public abstract class TmfTransform extends TmfComponent implements ITmfTransform { - /** - * - */ - public void transformData() { - } } diff --git a/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/signal/TmfSignalManager.java b/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/signal/TmfSignalManager.java index c0fa6a214c..200137cc94 100644 --- a/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/signal/TmfSignalManager.java +++ b/org.eclipse.linuxtools.tmf/src/org/eclipse/linuxtools/tmf/signal/TmfSignalManager.java @@ -37,8 +37,6 @@ public class TmfSignalManager { private static boolean fTraceIsActive = false; private static TmfSignalTrace fSignalTracer; -// private static TmfSignalManager fInstance; - static { if (fTraceIsActive) { fSignalTracer = new TmfSignalTrace(); @@ -56,13 +54,6 @@ public class TmfSignalManager { fListeners.remove(listener); } -// public static TmfSignalManager getInstance() { -// if (fInstance == null) { -// fInstance = new TmfSignalManager(); -// } -// return fInstance; -// } - /** * Invokes the handling methods that expect this signal. * @@ -73,39 +64,6 @@ public class TmfSignalManager { * * @param signal */ -// private class Dispatch implements Runnable { -// -// private final Method method; -// private final Object entry; -// private final Object signal; -// -// public Dispatch(Method m, Object e, Object s) { -// method = m; -// entry = e; -// signal = s; -// } -// -// public void run() { -// try { -// method.invoke(entry, new Object[] { signal }); -// } catch (IllegalArgumentException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } catch (IllegalAccessException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } catch (InvocationTargetException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// } -// } -// -// private void dispatch(Method method, Object key, Object signal) { -// Dispatch disp = new Dispatch(method, key, signal); -// new Thread(disp).start(); -// } - static public synchronized void dispatchSignal(Object signal) { // Build the list of listener methods that are registered for this signal @@ -127,7 +85,6 @@ public class TmfSignalManager { // Call the signal handlers for (Map.Entry> entry : listeners.entrySet()) { for (Method method : entry.getValue()) { -// getInstance().dispatch(method, entry.getKey(), signal); try { method.invoke(entry.getKey(), new Object[] { signal }); } catch (IllegalArgumentException e) { -- 2.34.1