Rename xxx.lttng to xxx.lttng.core
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf / src / org / eclipse / linuxtools / tmf / component / TmfComponent.java
index eefb3248ec881e699652f8c3959fd9ce72f23943..62d863fc703cd9aaba0caac06693c47099dd6124 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009 Ericsson
+ * Copyright (c) 2009, 2010 Ericsson
  * 
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
 
 package org.eclipse.linuxtools.tmf.component;
 
+import org.eclipse.linuxtools.tmf.signal.TmfSignal;
 import org.eclipse.linuxtools.tmf.signal.TmfSignalManager;
 
 /**
  * <b><u>TmfComponent</u></b>
  * <p>
- * TODO: Implement me. Please.
+ * This is the base class of the TMF components.
+ * <p>
+ *  Currently, it only addresses the inter-component signaling.
  */
 public abstract class TmfComponent implements ITmfComponent {
 
-       public TmfComponent() {
-               TmfSignalManager.addListener(this);
+    // ------------------------------------------------------------------------
+    // Attributes
+    // ------------------------------------------------------------------------
+
+       private String fName;
+       
+       // ------------------------------------------------------------------------
+       // Constructor
+       // ------------------------------------------------------------------------
+
+    public TmfComponent() {
+           this(""); //$NON-NLS-1$
+    }
+
+    public void init(String name) {
+        fName = name;
+        TmfSignalManager.register(this);
+    }
+
+       public TmfComponent(String name) {
+               init(name);
+       }
+       
+       public TmfComponent(TmfComponent other) {
+        init(other.fName);
        }
+       
+    // ------------------------------------------------------------------------
+    // Accessors
+    // ------------------------------------------------------------------------
 
+       protected void setName(String name) {
+               fName = name;
+       }
+
+       // ------------------------------------------------------------------------
+       // ITmfComponent
+       // ------------------------------------------------------------------------
+
+       @Override
+       public String getName() {
+               return fName;
+       }
+
+       @Override
        public void dispose() {
-               TmfSignalManager.removeListener(this);
+               TmfSignalManager.deregister(this);
+//             if (Tracer.isComponentTraced()) Tracer.traceComponent(this, "terminated");
+       }
+
+       @Override
+       public void broadcast(TmfSignal signal) {
+               TmfSignalManager.dispatchSignal(signal);
        }
 
 }
This page took 0.024448 seconds and 5 git commands to generate.