hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahue...@apache.org
Subject svn commit: r453391 - in /hivemind/branches/branch-2-0-annot: ./ framework/src/java/org/apache/hivemind/impl/ xml/src/test/hivemind/test/config/
Date Thu, 05 Oct 2006 21:31:43 GMT
Author: ahuegen
Date: Thu Oct  5 14:31:42 2006
New Revision: 453391

URL: http://svn.apache.org/viewvc?view=rev&rev=453391
Log:
Fixed toString Method of configurations proxies

Modified:
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ConfigurationPointImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ProxyBuilder.java
    hivemind/branches/branch-2-0-annot/pom.xml
    hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/config/TestConfigurationPoint.java

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ConfigurationPointImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ConfigurationPointImpl.java?view=diff&rev=453391&r1=453390&r2=453391
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ConfigurationPointImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ConfigurationPointImpl.java
Thu Oct  5 14:31:42 2006
@@ -313,8 +313,7 @@
             Constructor c = innerProxyClass.getConstructor(new Class[]
             { proxyClass, getClass() });
 
-            Object _innerProxy = (SingletonInnerProxy) c.newInstance(new Object[]
-            { result, this });
+            c.newInstance(new Object[] { result, this });
 
             return result;
         }
@@ -359,7 +358,20 @@
         classFab.addMethod(Modifier.PRIVATE, new MethodSignature(configurationInterface,
"_getInner",
                 null, null), builder.toString());
 
-        proxyBuilder.addServiceMethods("_getInner()");
+        proxyBuilder.addServiceMethods("_getInner()", false);
+
+        // The toString calls the toString method of the configuration if it is
+        // created already
+//        String proxyToStringMessage = "<LazyConstructionProxy for "
+//            + getExtensionPointId() + "(" + configurationInterface.getName() + ")>";
+        builder.clear();
+        builder.begin();
+        builder.addln(" return _inner.toString();");
+        builder.end();
+
+        MethodSignature toStringSignature = new MethodSignature(String.class, "toString",
null,
+                null);
+        classFab.addMethod(Modifier.PUBLIC, toStringSignature, builder.toString());
 
         return classFab.createClass();
     }

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ProxyBuilder.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ProxyBuilder.java?view=diff&rev=453391&r1=453390&r2=453391
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ProxyBuilder.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ProxyBuilder.java
Thu Oct  5 14:31:42 2006
@@ -138,6 +138,14 @@
     {
         return _classFab;
     }
+    
+    /**
+     * @see #addServiceMethods(String, boolean)
+     */
+    public void addServiceMethods(String indirection)
+    {
+        addServiceMethods(indirection, true);
+    }
 
     /**
      * Creates the service methods for the class.
@@ -145,8 +153,10 @@
      * @param indirection
      *            the name of a variable, or a method invocation snippet, used to redirect
the
      *            invocation on the proxy to the actual service implementation.
+     * @param addToString if true, a implementation of the toString method is generated that
+     *    returns some info about the proxy
      */
-    public void addServiceMethods(String indirection)
+    public void addServiceMethods(String indirection, boolean addToString)
     {
         BodyBuilder builder = new BodyBuilder();
 
@@ -168,7 +178,7 @@
             }
         }
 
-        if (!mi.getToString())
+        if (!mi.getToString() && addToString)
             ClassFabUtils.addToStringMethod(_classFab, "<" + _type + " for "
                     + _extensionPointId + "(" + _serviceInterface.getName() + ")>");
     }

Modified: hivemind/branches/branch-2-0-annot/pom.xml
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/pom.xml?view=diff&rev=453391&r1=453390&r2=453391
==============================================================================
--- hivemind/branches/branch-2-0-annot/pom.xml (original)
+++ hivemind/branches/branch-2-0-annot/pom.xml Thu Oct  5 14:31:42 2006
@@ -98,7 +98,7 @@
                 <scope>test</scope>
             </dependency>
             <dependency>
-                <groupId>hivemind</groupId>
+                <groupId>org.apache.hivemind</groupId>
                 <artifactId>hivemind</artifactId>
                 <version>2.0.0_M1</version>
             </dependency>

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/config/TestConfigurationPoint.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/config/TestConfigurationPoint.java?view=diff&rev=453391&r1=453390&r2=453391
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/config/TestConfigurationPoint.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/config/TestConfigurationPoint.java
Thu Oct  5 14:31:42 2006
@@ -321,7 +321,7 @@
 
         List l = (List) r.getConfiguration("hivemind.test.config.Simple");
 
-        assertEquals("<LazyConstructionProxy for hivemind.test.config.Simple(java.util.List)>",
l.toString());
+        assertEquals("<InnerProxy for hivemind.test.config.Simple(java.util.List)>",
l.toString());
 
         assertEquals(true, l.equals(l));
         assertEquals(false, l.equals(null));



Mime
View raw message