geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r639555 - in /geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell: console/TerminalFactory.java lookup/EnvironmentLookup.java lookup/IOLookup.java lookup/LookupFactorySupport.java
Date Fri, 21 Mar 2008 06:48:56 GMT
Author: jdillon
Date: Thu Mar 20 23:48:52 2008
New Revision: 639555

URL: http://svn.apache.org/viewvc?rev=639555&view=rev
Log:
Drop use of lame super-class, generify lookup support

Modified:
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/TerminalFactory.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/EnvironmentLookup.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/IOLookup.java
    geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/LookupFactorySupport.java

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/TerminalFactory.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/TerminalFactory.java?rev=639555&r1=639554&r2=639555&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/TerminalFactory.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/console/TerminalFactory.java
Thu Mar 20 23:48:52 2008
@@ -23,7 +23,6 @@
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.classworlds.realm.ClassRealm;
 import org.codehaus.plexus.component.annotations.Component;
-import org.codehaus.plexus.component.factory.AbstractComponentFactory;
 import org.codehaus.plexus.component.factory.ComponentFactory;
 import org.codehaus.plexus.component.factory.ComponentInstantiationException;
 import org.codehaus.plexus.component.repository.ComponentDescriptor;
@@ -37,9 +36,16 @@
  */
 @Component(role=ComponentFactory.class, hint="Terminal")
 public class TerminalFactory
-    extends AbstractComponentFactory
+    implements ComponentFactory
 {
     protected Logger log = LoggerFactory.getLogger(getClass());
+
+    public String getId() {
+        //
+        // FIXME: What is this supposed to return?
+        //
+        return null;
+    }
 
     public Object newInstance(ComponentDescriptor d, ClassRealm cr, PlexusContainer c) throws
ComponentInstantiationException {
         Terminal term =  Terminal.getTerminal();

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/EnvironmentLookup.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/EnvironmentLookup.java?rev=639555&r1=639554&r2=639555&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/EnvironmentLookup.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/EnvironmentLookup.java
Thu Mar 20 23:48:52 2008
@@ -32,7 +32,7 @@
  */
 @Component(role=ComponentFactory.class, hint="EnvironmentLookup")
 public class EnvironmentLookup
-    extends LookupFactorySupport
+    extends LookupFactorySupport<Environment>
 {
     public static void set(final PlexusContainer container, final Environment env) throws
ComponentLookupException {
         assert container != null;

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/IOLookup.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/IOLookup.java?rev=639555&r1=639554&r2=639555&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/IOLookup.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/IOLookup.java
Thu Mar 20 23:48:52 2008
@@ -32,7 +32,7 @@
  */
 @Component(role=ComponentFactory.class, hint="IOLookup")
 public class IOLookup
-    extends LookupFactorySupport
+    extends LookupFactorySupport<IO>
 {
     public static void set(final PlexusContainer container, final IO io) throws ComponentLookupException
{
         assert container != null;

Modified: geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/LookupFactorySupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/LookupFactorySupport.java?rev=639555&r1=639554&r2=639555&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/LookupFactorySupport.java
(original)
+++ geronimo/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/lookup/LookupFactorySupport.java
Thu Mar 20 23:48:52 2008
@@ -21,8 +21,8 @@
 
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.classworlds.realm.ClassRealm;
-import org.codehaus.plexus.component.factory.AbstractComponentFactory;
 import org.codehaus.plexus.component.factory.ComponentInstantiationException;
+import org.codehaus.plexus.component.factory.ComponentFactory;
 import org.codehaus.plexus.component.repository.ComponentDescriptor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -32,14 +32,14 @@
  *
  * @version $Rev$ $Date$
  */
-public class LookupFactorySupport
-    extends AbstractComponentFactory
+public class LookupFactorySupport<T>
+    implements ComponentFactory
 {
     protected Logger log = LoggerFactory.getLogger(getClass());
 
-    protected final ThreadLocal holder = new ThreadLocal();
+    protected final ThreadLocal<T> holder = new ThreadLocal<T>();
 
-    public synchronized void set(final Object obj) {
+    public synchronized void set(final T obj) {
         if (obj == null) {
             throw new IllegalArgumentException("Instance can not be null");
         }
@@ -55,11 +55,18 @@
         holder.set(obj);
     }
 
-    public synchronized Object get() {
+    public synchronized T get() {
         return holder.get();
     }
 
-    public Object newInstance(ComponentDescriptor descriptor, ClassRealm classRealm, PlexusContainer
container) throws ComponentInstantiationException {
+    public String getId() {
+        //
+        // FIXME: What is this supposed to return?
+        //
+        return null;
+    }
+
+    public Object newInstance(final ComponentDescriptor descriptor, final ClassRealm classRealm,
final PlexusContainer container) throws ComponentInstantiationException {
         Object obj = get();
 
         if (obj == null) {



Mime
View raw message