hlship      2003/08/21 13:07:47

  Modified:    hivemind/src/java/org/apache/commons/hivemind/parse
                        ServiceDescriptor.java DescriptorParser.java
               hivemind/xdocs descriptor.xml services.xml
               hivemind/src/java/org/apache/commons/hivemind/service/impl
                        DefaultsSymbolSource.java FactoryDefault.java
                        NameLookupImpl.java
               hivemind/src/java/org/apache/commons/hivemind/impl
                        ServiceExtensionPointImpl.java RegistryBuilder.java
               hivemind/src/java/org/apache/commons/hivemind
                        HiveMindMessages.properties HiveMind.java
               hivemind/src/test/hivemind/test/config
                        TestExtensionPoint.java
               hivemind/src/test/hivemind/test/parse
                        TestDescriptorParser.java
               hivemind/src/test/hivemind/test/services TestServices.java
               hivemind/src/META-INF hivemodule.xml
  Added:       hivemind/src/test/hivemind/test/config DupeSymbol.xml
  Removed:     hivemind/src/test/hivemind/test/services ServiceOverride.xml
  Log:
  Remove overridable attribute from <service>; just not a good idea.
  Add hivemind.ApplicationDefaults to complement hivemind.FactoryDefaults.
  Have DefaultsSymbolSource identify conflicting symbol defaults.
  Make it easier to specify/override JNDI configuration values for NameLookup service 
without replacing the service itself.
  Replace more explicit service lookups with BuilderFactory and <set-service>.
  
  Revision  Changes    Path
  1.8       +1 -10     
jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/ServiceDescriptor.java
  
  Index: ServiceDescriptor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/ServiceDescriptor.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ServiceDescriptor.java    12 Aug 2003 17:31:54 -0000      1.7
  +++ ServiceDescriptor.java    21 Aug 2003 20:07:47 -0000      1.8
  @@ -72,7 +72,6 @@
       private String _id;
       private String _interfaceClassName;
       private boolean _required = true;
  -    private boolean _overridable;
       private Schema _parametersSchema;
       private boolean _deferrable;
   
  @@ -115,15 +114,7 @@
           builder.append("parametersSchema", _parametersSchema);
       }
   
  -    public boolean isOverridable()
  -    {
  -        return _overridable;
  -    }
   
  -    public void setOverridable(boolean b)
  -    {
  -        _overridable = b;
  -    }
   
       public Schema getParametersSchema()
       {
  
  
  
  1.26      +1 -3      
jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/DescriptorParser.java
  
  Index: DescriptorParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/parse/DescriptorParser.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- DescriptorParser.java     20 Aug 2003 20:40:45 -0000      1.25
  +++ DescriptorParser.java     21 Aug 2003 20:07:47 -0000      1.26
  @@ -211,7 +211,6 @@
           SERVICE_ATTRIBUTES.put("id", Boolean.TRUE);
           SERVICE_ATTRIBUTES.put("interface", Boolean.TRUE);
           SERVICE_ATTRIBUTES.put("required", Boolean.FALSE);
  -        SERVICE_ATTRIBUTES.put("overridable", Boolean.FALSE);
           SERVICE_ATTRIBUTES.put("deferrable", Boolean.FALSE);
       }
   
  @@ -880,7 +879,6 @@
               sd.setId(getAttribute("id"));
               sd.setInterfaceClassName(getAttribute("interface"));
               sd.setRequired(getBooleanAttribute("required", true));
  -            sd.setOverridable(getBooleanAttribute("overridable", false));
               sd.setDeferrable(getBooleanAttribute("deferrable", true));
   
               md.addService(sd);
  
  
  
  1.20      +2 -13     jakarta-commons-sandbox/hivemind/xdocs/descriptor.xml
  
  Index: descriptor.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/xdocs/descriptor.xml,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- descriptor.xml    20 Aug 2003 20:40:44 -0000      1.19
  +++ descriptor.xml    21 Aug 2003 20:07:47 -0000      1.20
  @@ -409,18 +409,7 @@
                                        <td>If true (the default), then a factory 
contribution must be made to
                                                the extension point. If false, then 
the service provided by the
                                                extension point is optional.</td>
  -                             </tr>
  -                             <tr>
  -                                     <td>overridable</td>    
  -                                     <td>boolean</td>
  -                                     <td>no</td>
  -                                     <td>
  -                                     If true, then the factory contribution 
provided as an internal contribution
  -                                     may be overriden by another module.  The core 
implementation is therefore
  -                                     just a placeholder.  The default is false.     
 
  -                                     </td>
  -                             </tr>
  -                             
  +                             </tr>                           
                                <tr>
                                        <td>deferrable</td>     
                                        <td>boolean</td>
  
  
  
  1.17      +9 -22     jakarta-commons-sandbox/hivemind/xdocs/services.xml
  
  Index: services.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/xdocs/services.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- services.xml      20 Aug 2003 20:40:45 -0000      1.16
  +++ services.xml      21 Aug 2003 20:07:47 -0000      1.17
  @@ -22,8 +22,12 @@
                <section name="Defining Services">
                        <p>A service definition begins with a Java interface. Any 
interface will
                                do, HiveMind doesn't care, and there's no base 
HiveMind interface.</p>
  -                     <p>A module descriptor may include &service; element to define 
a service. 
  -                             This establishes an
  +                     <p>A module descriptor may include &service; elements to 
define  services. 
  +                             A module may contain any number of services.
  +                     </p>
  +                     
  +                     <p>Each &_service;
  +                      establishes an
                                id for the service, defines the interface for the 
service, and indicates
                                whether the service is optional or required (required 
is the default).
                                An example is provided later in this document.</p>
  @@ -168,7 +172,7 @@
                                        <p>
                                        If <code>toString()</code>       is part of 
the service interface (really, a very rare
                                        case), then the interceptor <em>does not</em> 
override the service implementation's
  -                                     implementation.
  +                                     method.
                                        </p>
                                
                        </subsection>
  @@ -250,24 +254,7 @@
                                against interfaces instead of implementations, the 
client code neither
                                knows nor cares about this.</p>
                </section>
  -             
  -             <section name="Overridable Services">
  -             
  -             <p>
  -             In some cases, you may want to be able to override the core 
implementation of a service.
  -             The <code>overridable</code> attribute in &service; can be set to 
<code>true</code>.  This allows for
  -             an implementation constructor to be provided, even if the service 
already has one.  Multiple
  -             constructors are still prohibited.
  -             </p>
  -             
  -             <p>
  -             As an example, you may want to replace the
  -             <a 
href="base-registry/hivemind.html#service:hivemind.NameLookup">hivemind.NameLookup</a> 
      
  -             service, to change its JNDI configuration.
  -             </p>
                        
  -             </section>
  -             
                <section name="Deferring Service Creation">
                        
                <p>
  @@ -275,7 +262,7 @@
                service implementation, configuring its properties (some of which may 
also be services),
                and building the stack of interceptors for the service.  Although 
HiveMind
                encourages you to define your application in terms of a large number 
of small, simple, testable
  -             services, it is also desirable to avoid a cascade of uneccesary object 
creation
  +             services, it is also desirable to avoid a cascade of unneccesary 
object creation
                due to the dependencies between services.
                </p>
                
  
  
  
  1.2       +34 -5     
jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/DefaultsSymbolSource.java
  
  Index: DefaultsSymbolSource.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/DefaultsSymbolSource.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultsSymbolSource.java 21 Aug 2003 14:52:09 -0000      1.1
  +++ DefaultsSymbolSource.java 21 Aug 2003 20:07:47 -0000      1.2
  @@ -61,10 +61,13 @@
   import java.util.List;
   import java.util.Map;
   
  +import org.apache.commons.hivemind.HiveMind;
   import org.apache.commons.hivemind.Initializable;
  +import org.apache.commons.hivemind.Location;
   import org.apache.commons.hivemind.ServiceExtensionPoint;
   import org.apache.commons.hivemind.SymbolSource;
   import org.apache.commons.hivemind.impl.BaseLocatable;
  +import org.apache.commons.logging.Log;
   
   /**
    * Implementation of [EMAIL PROTECTED] org.apache.commons.hivemind.SymbolSource} 
driven
  @@ -73,10 +76,9 @@
    * @author Howard Lewis Ship
    * @version $Id$
    */
  -public class DefaultsSymbolSource
  -    extends BaseLocatable
  -    implements SymbolSource, Initializable
  +public class DefaultsSymbolSource extends BaseLocatable implements SymbolSource, 
Initializable
   {
  +    private Log _log;
       private List _defaults;
       private Map _symbols = new HashMap();
   
  @@ -87,18 +89,45 @@
   
       public void initializeService(ServiceExtensionPoint point, Object service)
       {
  +        Map symbolMap = new HashMap();
  +
           int count = _defaults.size();
           for (int i = 0; i < count; i++)
           {
               FactoryDefault fd = (FactoryDefault) _defaults.get(i);
   
  -            _symbols.put(fd.getSymbol(), fd.getValue());
  +            String symbol = fd.getSymbol();
  +            String value = fd.getValue();
  +            Location location = fd.getLocation();
  +
  +            Location priorLocation = (Location) symbolMap.get(symbol);
  +
  +            if (priorLocation != null)
  +            {
  +                _log.error(
  +                    HiveMind.format(
  +                        "DefaultsSymbolSource.duplicate-symbol",
  +                        symbol,
  +                        location,
  +                        priorLocation));
  +            }
  +            else
  +            {
  +                _symbols.put(symbol, value);
  +                symbolMap.put(symbol, location);
  +            }
  +
           }
       }
   
       public void setDefaults(List list)
       {
           _defaults = list;
  +    }
  +
  +    public void setLog(Log log)
  +    {
  +        _log = log;
       }
   
   }
  
  
  
  1.2       +4 -2      
jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/FactoryDefault.java
  
  Index: FactoryDefault.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/FactoryDefault.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FactoryDefault.java       11 Aug 2003 17:45:27 -0000      1.1
  +++ FactoryDefault.java       21 Aug 2003 20:07:47 -0000      1.2
  @@ -57,6 +57,8 @@
   
   package org.apache.commons.hivemind.service.impl;
   
  +import org.apache.commons.hivemind.impl.BaseLocatable;
  +
   /**
    * Default symbol value defined by the 
    * <code>hivemind.FactoryDefaults</code> extension point.
  @@ -64,7 +66,7 @@
    * @author Howard Lewis Ship
    * @version $Id$
    */
  -public class FactoryDefault
  +public class FactoryDefault extends BaseLocatable
   {
        private String _symbol;
        private String _value;
  
  
  
  1.4       +11 -28    
jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/NameLookupImpl.java
  
  Index: NameLookupImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/NameLookupImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NameLookupImpl.java       8 Aug 2003 13:51:10 -0000       1.3
  +++ NameLookupImpl.java       21 Aug 2003 20:07:47 -0000      1.4
  @@ -66,12 +66,12 @@
   import org.apache.commons.hivemind.ApplicationRuntimeException;
   import org.apache.commons.hivemind.HiveMind;
   import org.apache.commons.hivemind.Initializable;
  -import org.apache.commons.hivemind.Registry;
   import org.apache.commons.hivemind.ServiceExtensionPoint;
   import org.apache.commons.hivemind.service.NameLookup;
   import org.apache.commons.hivemind.service.RemoteExceptionCoordinator;
   import org.apache.commons.hivemind.service.RemoteExceptionEvent;
   import org.apache.commons.hivemind.service.RemoteExceptionListener;
  +import org.apache.commons.lang.StringUtils;
   
   /**
    * Standard implementation of the [EMAIL PROTECTED] 
org.apache.commons.hivemind.service.NameLookup}
  @@ -126,17 +126,17 @@
           }
       }
   
  -    protected Context getInitialContext() throws NamingException
  +    private Context getInitialContext() throws NamingException
       {
           Hashtable properties = new Hashtable();
   
  -        if (_initialFactory != null)
  +        if (!StringUtils.isEmpty(_initialFactory))
               properties.put(Context.INITIAL_CONTEXT_FACTORY, _initialFactory);
   
  -        if (_providerURL != null)
  +        if (!StringUtils.isEmpty(_providerURL))
               properties.put(Context.PROVIDER_URL, _providerURL);
   
  -        if (_URLPackages != null)
  +        if (!StringUtils.isEmpty(_URLPackages))
               properties.put(Context.URL_PKG_PREFIXES, _URLPackages);
   
           return constructContext(properties);
  @@ -153,13 +153,6 @@
   
       public void initializeService(ServiceExtensionPoint point, Object service)
       {
  -        Registry registry = point.getModule().getRegistry();
  -
  -        _coordinator =
  -            (RemoteExceptionCoordinator) registry.getService(
  -                HiveMind.REMOTE_EXCEPTION_COORDINATOR_SERVICE_ID,
  -                RemoteExceptionCoordinator.class);
  -
           _coordinator.addRemoteExceptionListener(this);
       }
   
  @@ -171,21 +164,6 @@
           _initialContext = null;
       }
   
  -    public String getInitialFactory()
  -    {
  -        return _initialFactory;
  -    }
  -
  -    public String getProviderURL()
  -    {
  -        return _providerURL;
  -    }
  -
  -    public String getURLPackages()
  -    {
  -        return _URLPackages;
  -    }
  -
       /**
        * Sets the initial factory used to create the initial JNDI context.
        * Equivalent to the system property <code>java.naming.factory.initial</code>.
  @@ -213,6 +191,11 @@
       public void setURLPackages(String string)
       {
           _URLPackages = string;
  +    }
  +
  +    public void setCoordinator(RemoteExceptionCoordinator coordinator)
  +    {
  +        _coordinator = coordinator;
       }
   
   }
  
  
  
  1.10      +2 -16     
jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/impl/ServiceExtensionPointImpl.java
  
  Index: ServiceExtensionPointImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/impl/ServiceExtensionPointImpl.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ServiceExtensionPointImpl.java    20 Aug 2003 20:40:45 -0000      1.9
  +++ ServiceExtensionPointImpl.java    21 Aug 2003 20:07:47 -0000      1.10
  @@ -97,7 +97,6 @@
       private ServiceImplementationConstructor _serviceConstructor;
       private List _interceptorContributions;
       private boolean _required;
  -    private boolean _overridable;
       private boolean _building;
       private Schema _parametersSchema;
       private Object _constructedService;
  @@ -109,7 +108,6 @@
           builder.append("serviceInterfaceName", _serviceInterfaceName);
           builder.append("deferrable", _deferrable);
           builder.append("required", _required);
  -        builder.append("overridable", _overridable);
           builder.append("factoryContribution", _serviceConstructor);
           builder.append("interceptorContributions", _interceptorContributions);
           builder.append("parametersSchema", _parametersSchema);
  @@ -328,16 +326,6 @@
           return stack.peek();
       }
   
  -    public boolean isOverridable()
  -    {
  -        return _overridable;
  -    }
  -
  -    public void setOverridable(boolean b)
  -    {
  -        _overridable = b;
  -    }
  -
       public Schema getParametersSchema()
       {
           return _parametersSchema;
  @@ -433,9 +421,7 @@
           Registry registry = getModule().getRegistry();
   
           ClassFactory factory =
  -            (ClassFactory) registry.getService(
  -                HiveMind.CLASS_FACTORY_SERVICE_ID,
  -                ClassFactory.class);
  +            (ClassFactory) registry.getService("hivemind.ClassFactory", 
ClassFactory.class);
   
           String className = ClassFabUtils.generateClassName("Proxy");
   
  
  
  
  1.23      +2 -8      
jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/impl/RegistryBuilder.java
  
  Index: RegistryBuilder.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/impl/RegistryBuilder.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- RegistryBuilder.java      20 Aug 2003 20:40:45 -0000      1.22
  +++ RegistryBuilder.java      21 Aug 2003 20:07:47 -0000      1.23
  @@ -333,7 +333,6 @@
               point.setLocation(sd.getLocation());
               point.setModule(module);
               point.setRequired(sd.isRequired());
  -            point.setOverridable(sd.isOverridable());
               point.setDeferrable(sd.isDeferrable());
               point.setServiceInterfaceName(sd.getInterfaceClassName());
               point.setParametersSchema(sd.getParametersSchema());
  @@ -593,7 +592,7 @@
               return;
           }
   
  -        if (sep.getServiceConstructor() != null && !sep.isOverridable())
  +        if (sep.getServiceConstructor() != null)
           {
               LOG.error(
                   HiveMind.format(
  @@ -605,11 +604,6 @@
           }
   
           sep.setServiceConstructor(builder.createConstructor(sep, sourceModule));
  -
  -        // The first non-internal contribution "locks" the 
  -        // extension point so that no further contribution may be made.
  -        if (!isInternal)
  -            sep.setOverridable(false);
       }
   
        private void addServiceExtension(
  
  
  
  1.24      +2 -1      
jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/HiveMindMessages.properties
  
  Index: HiveMindMessages.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/HiveMindMessages.properties,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- HiveMindMessages.properties       20 Aug 2003 20:40:45 -0000      1.23
  +++ HiveMindMessages.properties       21 Aug 2003 20:07:47 -0000      1.24
  @@ -14,6 +14,7 @@
   
   # impl package
   
  +DefaultsSymbolSource.duplicate-symbol=Default for symbol ''{0}'' (at {1}) 
duplicates prior value (at {2}) and has been ignored.
   
   DefaultClassResolver.unable-to-load-class=Could not load class {0} from {1}: {2}
   
  
  
  
  1.17      +1 -19     
jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/HiveMind.java
  
  Index: HiveMind.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/HiveMind.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- HiveMind.java     20 Aug 2003 20:40:45 -0000      1.16
  +++ HiveMind.java     21 Aug 2003 20:07:47 -0000      1.17
  @@ -79,24 +79,6 @@
   {
       private static final Log LOG = LogFactory.getLog(HiveMind.class);
   
  -    /**
  -     * Service id for the [EMAIL PROTECTED] 
org.apache.commons.hivemind.service.RemoteExceptionCoordinator}
  -     * service.
  -     */
  -    public static final String REMOTE_EXCEPTION_COORDINATOR_SERVICE_ID =
  -        "hivemind.RemoteExceptionCoordinator";
  -
  -    /**
  -     * Service id for the [EMAIL PROTECTED] 
org.apache.commons.hivemind.service.NameLookup} service.
  -     */
  -    public static final String NAME_LOOKUP_SERVICE_ID = "hivemind.NameLookup";
  -
  -    /**
  -     * Service id for the [EMAIL PROTECTED] 
org.apache.commons.hivemind.service.ClassFactory} service.
  -     */
  -
  -    public static final String CLASS_FACTORY_SERVICE_ID = "hivemind.ClassFactory";
  -
       private static Registry _registry;
       private static final ResourceBundle _bundle;
   
  
  
  
  1.9       +17 -1     
jakarta-commons-sandbox/hivemind/src/test/hivemind/test/config/TestExtensionPoint.java
  
  Index: TestExtensionPoint.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/hivemind/src/test/hivemind/test/config/TestExtensionPoint.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestExtensionPoint.java   20 Aug 2003 20:40:45 -0000      1.8
  +++ TestExtensionPoint.java   21 Aug 2003 20:07:47 -0000      1.9
  @@ -501,4 +501,20 @@
                   "Unable to create instance of Rule class 
hivemind.test.config.XetContributingModuleRule");
           }
       }
  +
  +    public void testDupeSymbol() throws Exception
  +    {
  +        Registry r = buildRegistry("DupeSymbol.xml");
  +
  +        interceptLogging("hivemind.ApplicationDefaultsSymbolSource");
  +
  +        assertEquals(
  +            "Fred's friend is barney.",
  +            r.expandSymbols("Fred's friend is ${fred}.", null));
  +
  +        checkLoggingEvent(
  +            null,
  +            "Default for symbol 'fred' \\(at .*?\\) duplicates prior value \\(at 
.*\\) and has been ignored\\.",
  +            false);
  +    }
   }
  
  
  
  1.1                  
jakarta-commons-sandbox/hivemind/src/test/hivemind/test/config/DupeSymbol.xml
  
  Index: DupeSymbol.xml
  ===================================================================
  <?xml version="1.0"?>
  <module id="hivemind.test.config" version="1.0.0">
  
   <extension point-id="hivemind.ApplicationDefaults">
   
     <default symbol="fred" value="barney"/>
     
     <default symbol="wilma" value="betty"/>
     
     <default symbol="fred" value="dino"/>      
        
   </extension>
  
  </module>
  
  
  1.21      +1 -2      
jakarta-commons-sandbox/hivemind/src/test/hivemind/test/parse/TestDescriptorParser.java
  
  Index: TestDescriptorParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/hivemind/src/test/hivemind/test/parse/TestDescriptorParser.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- TestDescriptorParser.java 11 Aug 2003 17:45:28 -0000      1.20
  +++ TestDescriptorParser.java 21 Aug 2003 20:07:47 -0000      1.21
  @@ -206,7 +206,6 @@
           assertEquals("MyService1", sd.getId());
           assertEquals("package.MyService", sd.getInterfaceClassName());
           assertEquals(true, sd.isRequired());
  -        assertEquals(false, sd.isOverridable());
   
           CreateInstanceDescriptor cid = (CreateInstanceDescriptor) 
sd.getInstanceBuilder();
           assertEquals("package.impl.MyServiceImpl", cid.getInstanceClassName());
  
  
  
  1.22      +1 -13     
jakarta-commons-sandbox/hivemind/src/test/hivemind/test/services/TestServices.java
  
  Index: TestServices.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/hivemind/src/test/hivemind/test/services/TestServices.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- TestServices.java 20 Aug 2003 20:40:45 -0000      1.21
  +++ TestServices.java 21 Aug 2003 20:07:47 -0000      1.22
  @@ -329,18 +329,6 @@
   //        }
   //    }
   
  -    public void testServiceOverride() throws Exception
  -    {
  -        Registry r = buildRegistry("ServiceOverride.xml");
  -
  -        SimpleService s =
  -            (SimpleService) r.getService(
  -                "hivemind.test.services.ServiceOverride",
  -                SimpleService.class);
  -
  -        // The bad impl multiplies, not add.
  -        assertEquals(28, s.add(4, 7));
  -    }
   
       public void testServiceTranslator() throws Exception
       {
  
  
  
  1.18      +28 -9     jakarta-commons-sandbox/hivemind/src/META-INF/hivemodule.xml
  
  Index: hivemodule.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/META-INF/hivemodule.xml,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- hivemodule.xml    21 Aug 2003 14:52:09 -0000      1.17
  +++ hivemodule.xml    21 Aug 2003 20:07:47 -0000      1.18
  @@ -102,7 +102,9 @@
                </description>
                
                <invoke-factory service-id="BuilderFactory">
  -                     <construct 
class="org.apache.commons.hivemind.service.impl.DefaultsSymbolSource">
  +                     <construct
  +                             
class="org.apache.commons.hivemind.service.impl.DefaultsSymbolSource"
  +                             log-property="log">
                          <set-extension-point point-id="FactoryDefaults" 
property="defaults"/>
                        </construct>
                </invoke-factory>
  @@ -114,7 +116,9 @@
                </description>
                
                <invoke-factory service-id="BuilderFactory">
  -                     <construct 
class="org.apache.commons.hivemind.service.impl.DefaultsSymbolSource">
  +                     <construct
  +                             
class="org.apache.commons.hivemind.service.impl.DefaultsSymbolSource"
  +                             log-property="log">
                          <set-extension-point point-id="ApplicationDefaults" 
property="defaults"/>
                        </construct>
                </invoke-factory>
  @@ -151,16 +155,29 @@
        
        <service id="NameLookup"
                        interface="org.apache.commons.hivemind.service.NameLookup"
  -                     overridable="true"
                        deferrable="false">
                <description>
  -                     A service which can perform name lookups of objects; typically 
an implementation based on JNDI is supplied.     
  -                     The default implementation uses JNDI but may be overriden for 
other environments, or to override its
  -                     configuration.
  +                     A service which can perform name lookups of objects using JNDI.
                </description>  
  -             <create-instance 
class="org.apache.commons.hivemind.service.impl.NameLookupImpl"/>      
  +             
  +             <invoke-factory service-id="BuilderFactory">
  +               <construct
  +                 class="org.apache.commons.hivemind.service.impl.NameLookupImpl">
  +                 <set property="initialFactory" 
value="${java.naming.factory.initial}"/>
  +                 <set property="URLPackages" 
value="${java.naming.factory.url.pkgs}"/>
  +                 <set property="providerURL" value="${java.naming.provider.url}"/>
  +                 <set-service property="coordinator" 
service-id="RemoteExceptionCoordinator"/>
  +                </construct>
  +             </invoke-factory>
  +
        </service>
        
  +     <extension point-id="FactoryDefaults">
  +             <default symbol="java.naming.factory.initial" value=""/>
  +             <default symbol="java.naming.factory.url.pkgs" value=""/>
  +             <default symbol="java.naming.provider.url" value=""/>   
  +     </extension>
  +     
        <service id="BuilderFactory" 
interface="org.apache.commons.hivemind.ServiceImplementationFactory" 
deferrable="false">
                <description>
                Used to construct a service from a class name and a set of properties 
and values to be set in the instantiated class.   
  @@ -295,7 +312,9 @@
        <service id="EJBProxyFactory"
                interface="org.apache.commons.hivemind.ServiceImplementationFactory" 
deferrable="false">
                <description>
  -             Core service implementation factory that constructs dynamic proxies to 
EJB stateless session beans.  A single parameter, the JNDI name of the proxy, is 
required.       
  +             Core service implementation factory that constructs dynamic proxies to 
EJB stateless session beans. 
  +             Factory parameters are used to specify the JNDI name of the EJB and 
the name 
  +             of its home interface. This implementation uses the default NameLookup 
service.
                </description>
                
                <parameters-schema>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to