Author: ruschein
Date: 2010-08-13 14:16:35 -0700 (Fri, 13 Aug 2010)
New Revision: 21386

Modified:
   core3/work-api/trunk/pom.xml
   
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTunableInterceptor.java
Log:
Added logging support.

Modified: core3/work-api/trunk/pom.xml
===================================================================
--- core3/work-api/trunk/pom.xml        2010-08-13 21:05:21 UTC (rev 21385)
+++ core3/work-api/trunk/pom.xml        2010-08-13 21:16:35 UTC (rev 21386)
@@ -112,5 +112,10 @@
       <version>${junit.version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.logging</groupId>
+      <artifactId>pax-logging-api</artifactId>
+      <version>1.5.2</version>
+</dependency>
   </dependencies>
 </project>

Modified: 
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTunableInterceptor.java
===================================================================
--- 
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTunableInterceptor.java
       2010-08-13 21:05:21 UTC (rev 21385)
+++ 
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTunableInterceptor.java
       2010-08-13 21:16:35 UTC (rev 21386)
@@ -36,7 +36,10 @@
 import java.util.LinkedHashMap;
 import java.util.Map;
 
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
 
+
 /**
  * Interceptor for Tunables : detect them, create an appropriate 
<code>Handler</code> from the <code>HandlerFactory</code> for each of them, and 
store them in a HashMap for further use.
  *
@@ -87,6 +90,8 @@
         */
        protected Map<Object, Method> guiProviderMap;
 
+       protected Logger logger;
+
        /**
         * Creates a new AbstractTunableInterceptor object.
         *
@@ -98,11 +103,16 @@
                this.factory = tunableHandlerFactory;
                handlerMap = new HashMap<Object, LinkedHashMap<String, TH>>();
                guiProviderMap = new HashMap<Object, Method>();
+               logger = LoggerFactory.getLogger(getClass());
        }
 
        /**
-        *      To detect the Field and Methods annotated as 
<code>Tunable</code>, create a <code>Handler</code> for each from the factory, 
and store it.
-        * @param obj A class that contains <code>Tunable</code> that need to 
be caught to interact with the users
+        *  To detect fields and methods annotated with <code>Tunable</code>, 
create a <code>Handler</code> for
+        *  each from the factory, and store it in <code>handlerMap</code>.
+        *  In addition we also detect methods annotated with 
<code>ProvidesGUI</code> and store those in
+        *  <code>guiProviderMap</code>.
+        *
+        *  @param obj A class that contains <code>Tunable</code> that need to 
be caught to interact with the users
         */
        public void loadTunables(final Object obj) {
                if (!handlerMap.containsKey(obj)) {
@@ -198,9 +208,9 @@
                                        }
                                } else if 
(method.isAnnotationPresent(ProvidesGUI.class)) {
                                        if (method.getReturnType() != 
void.class)
-                                               
System.err.println(method.getName() + " annotated with @ProvidesGUI must return 
void!");
+                                               logger.error(method.getName() + 
" annotated with @ProvidesGUI must return void!");
                                        else if 
(method.getParameterTypes().length != 0)
-                                               
System.err.println(method.getName() + " annotated with @ProvidesGUI must take 0 
arguments!");
+                                               logger.error(method.getName() + 
" annotated with @ProvidesGUI must take 0 arguments!");
                                        else
                                                guiProviderMap.put(obj, method);
                                }

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to