hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-hivemind/library/src/test/org/apache/hivemind/lib/impl TestServicePropertyFactory.java
Date Wed, 18 Aug 2004 19:34:13 GMT
hlship      2004/08/18 12:34:12

  Modified:    framework/src/java/org/apache/hivemind/impl
                        RegistryBuilder.java
                        InvokeFactoryServiceConstructor.java
                        InterceptorStackImpl.java ImplStrings.properties
                        ImplMessages.java ServicePointImpl.java
               library/src/test/hivemind/test/lib
                        TestSpringLookupFactory.java
                        TestDefaultImplementationBuilder.java
               library/src/java/org/apache/hivemind/lib/impl
                        EJBProxyFactory.java SpringLookupFactory.java
                        ServicePropertyFactory.java PlaceholderFactory.java
               framework/src/java/org/apache/hivemind
                        ServiceImplementationFactory.java
                        HiveMindStrings.properties
                        ServiceInterceptorFactory.java Occurances.java
                        InterceptorStack.java HiveMind.java
                        HiveMindMessages.java
               examples/src/documentation/content/xdocs/hivemind-examples
                        logging.xml
               examples/src/java/org/apache/hivemind/examples/impl
                        ProxyLoggingInterceptorFactory.java
               framework/src/test/hivemind/test TestMisc.java
               library/src/test/org/apache/hivemind/lib/factory
                        TestBeanFactoryImpl.java
               framework/src/java/org/apache/hivemind/parse
                        DescriptorParser.properties
                        ServicePointDescriptor.java DescriptorParser.java
               .        status.xml
               framework/src/java/org/apache/hivemind/service/impl
                        LoggingInterceptorFactory.java BuilderFactory.java
               framework/src/test/hivemind/test/services
                        TestThreadedModel.java TestBuilderFactory.java
               src/documentation/content/xdocs descriptor.xml
               framework/src/java/org/apache/hivemind/impl/servicemodel
                        PooledServiceModel.java ThreadedServiceModel.java
               library/src/test/org/apache/hivemind/lib/pipeline
                        TestPipelineAssembler.java
               framework/src/java/org/apache/hivemind/internal
                        ServicePoint.java
               library/src/java/org/apache/hivemind/lib/pipeline
                        PipelineFactory.java
               library/src/java/org/apache/hivemind/lib/factory
                        BeanFactoryBuilder.java
               library/src/descriptor/META-INF hivemodule.xml
               library/src/test/org/apache/hivemind/lib/impl
                        TestServicePropertyFactory.java
  Added:       framework/src/test/org/apache/hivemind TestOccurances.java
               framework/src/test/org/apache/hivemind/impl
                        TestInvokeFactoryServiceConstructor.java
  Log:
  [HIVEMIND-33] Add parameters-occurs element to <service-point>
  [HIVEMIND-23] Identify location in module parse exceptions
  
  Revision  Changes    Path
  1.1                  jakarta-hivemind/framework/src/test/org/apache/hivemind/TestOccurances.java
  
  Index: TestOccurances.java
  ===================================================================
  //  Copyright 2004 The Apache Software Foundation
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  //     http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.
  
  package org.apache.hivemind;
  
  import junit.framework.TestCase;
  
  /**
   * Tests {@link org.apache.hivemind.Occurances#inRange(int)} for different
   * types of occurances.
   *
   * @author Howard Lewis Ship
   */
  public class TestOccurances extends TestCase
  {
      public void testNone()
      {
          Occurances o = Occurances.NONE;
  
          assertEquals(true, o.inRange(0));
          assertEquals(false, o.inRange(1));
      }
  
      public void testOnePlus()
      {
          Occurances o = Occurances.ONE_PLUS;
          assertEquals(false, o.inRange(0));
          assertEquals(true, o.inRange(1));
          assertEquals(true, o.inRange(2));
      }
  
      public void testRequired()
      {
          Occurances o = Occurances.REQUIRED;
  
          assertEquals(false, o.inRange(0));
          assertEquals(true, o.inRange(1));
          assertEquals(false, o.inRange(2));
      }
  
      public void testUnbounded()
      {
          Occurances o = Occurances.UNBOUNDED;
  
          assertEquals(true, o.inRange(0));
          assertEquals(true, o.inRange(1));
          assertEquals(true, o.inRange(2));
      }
  
      public void testOptional()
      {
          Occurances o = Occurances.OPTIONAL;
  
          assertEquals(true, o.inRange(0));
          assertEquals(true, o.inRange(1));
          assertEquals(false, o.inRange(2));
      }
  }
  
  
  
  1.18      +5 -25     jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java
  
  Index: RegistryBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- RegistryBuilder.java	3 Aug 2004 14:02:19 -0000	1.17
  +++ RegistryBuilder.java	18 Aug 2004 19:34:09 -0000	1.18
  @@ -317,6 +317,7 @@
   
               point.setServiceInterfaceName(sd.getInterfaceClassName());
               point.setParametersSchema(sd.getParametersSchema());
  +            point.setParametersCount(sd.getParametersCount());
   
               point.setShutdownCoordinator(_shutdownCoordinator);
   
  @@ -673,35 +674,14 @@
   
               Occurances expected = point.getExpectedCount();
   
  -            if (expected == Occurances.UNBOUNDED)
  -                continue;
  -
  -            int count = point.getContributionCount();
  -
  -            // Ok, so sometimes a case statement for Enums
  -            // would be nice.  Guess that's coming in JDK 1.5.
  +            int actual = point.getContributionCount();
   
  -            if (expected == Occurances.ONE_PLUS)
  -            {
  -                if (count > 0)
  -                    continue;
  -            }
  -            else
  -                if (expected == Occurances.OPTIONAL)
  -                {
  -
  -                    if (count < 2)
  -                        continue;
  -                }
  -                else
  -                {
  -                    if (count == 1)
  -                        continue;
  -                }
  +            if (expected.inRange(actual))
  +                continue;
   
               _errorHandler.error(
                   LOG,
  -                ImplMessages.wrongNumberOfContributions(point, count, expected),
  +                ImplMessages.wrongNumberOfContributions(point, actual, expected),
                   point.getLocation(),
                   null);
           }
  
  
  
  1.8       +37 -11    jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/InvokeFactoryServiceConstructor.java
  
  Index: InvokeFactoryServiceConstructor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/InvokeFactoryServiceConstructor.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- InvokeFactoryServiceConstructor.java	25 Jul 2004 22:12:51 -0000	1.7
  +++ InvokeFactoryServiceConstructor.java	18 Aug 2004 19:34:09 -0000	1.8
  @@ -16,11 +16,14 @@
   
   import java.util.List;
   
  +import org.apache.commons.logging.Log;
   import org.apache.hivemind.ApplicationRuntimeException;
  +import org.apache.hivemind.ErrorHandler;
  +import org.apache.hivemind.Occurances;
   import org.apache.hivemind.ServiceImplementationFactory;
   import org.apache.hivemind.internal.Module;
  -import org.apache.hivemind.internal.ServicePoint;
   import org.apache.hivemind.internal.ServiceImplementationConstructor;
  +import org.apache.hivemind.internal.ServicePoint;
   import org.apache.hivemind.schema.Schema;
   
   /**
  @@ -47,33 +50,40 @@
       /** The parameters converted to objects as per the factory's parameter schema. */
       private List _convertedParameters;
   
  +    // TODO: Should this method be synchronized?
  +
       public Object constructCoreServiceImplementation()
       {
  +        Log serviceLog = _serviceExtensionPoint.getServiceLog();
  +
           if (_factory == null)
           {
               ServicePoint factoryPoint = _contributingModule.getServicePoint(_factoryServiceId);
   
  +            Occurances expected = factoryPoint.getParametersCount();
  +
               _factory =
                   (ServiceImplementationFactory) factoryPoint.getService(
                       ServiceImplementationFactory.class);
   
               Schema schema = factoryPoint.getParametersSchema();
   
  -			// Note: it's kind of a toss up whether logging should occur using the
  -			// id of the service being constructed, or of the factory being invoked.
  -			// Here, we're using the constructed service ... with the intent being that
  -			// users will enable debugging for the service (or search the logs for the service)
  -			// if it fails to build properly.
  -		
  +            // Note: it's kind of a toss up whether logging should occur using the
  +            // id of the service being constructed, or of the factory being invoked.
  +            // Here, we're using the constructed service ... with the intent being that
  +            // users will enable debugging for the service (or search the logs for the service)
  +            // if it fails to build properly.
  +
  +            ErrorHandler errorHandler = _contributingModule.getErrorHandler();
  +            
               SchemaProcessorImpl processor =
  -                new SchemaProcessorImpl(
  -                    _contributingModule.getErrorHandler(),
  -                    _serviceExtensionPoint.getServiceLog(),
  -                    schema);
  +                new SchemaProcessorImpl(errorHandler, serviceLog, schema);
   
               processor.process(_parameters, _contributingModule);
   
               _convertedParameters = processor.getElements();
  +
  +            checkParameterCounts(errorHandler, serviceLog, expected);
           }
   
           try
  @@ -81,6 +91,7 @@
               return _factory.createCoreServiceImplementation(
                   _serviceExtensionPoint.getExtensionPointId(),
                   _serviceExtensionPoint.getServiceInterface(),
  +                serviceLog,
                   _contributingModule,
                   _convertedParameters);
           }
  @@ -88,6 +99,21 @@
           {
               throw new ApplicationRuntimeException(ex.getMessage(), getLocation(), ex);
           }
  +    }
  +
  +    /**
  +     * Checks that the number of parameter elements matches the expected count.
  +     */
  +    private void checkParameterCounts(ErrorHandler handler, Log log, Occurances expected)
  +    {
  +        int actual = _convertedParameters.size();
  +
  +        if (expected.inRange(actual))
  +            return;
  +
  +        String message = ImplMessages.wrongNumberOfParameters(_factoryServiceId, actual, expected);
  +
  +        handler.error(log, message, getLocation(), null);
       }
   
       public Module getContributingModule()
  
  
  
  1.7       +4 -0      jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/InterceptorStackImpl.java
  
  Index: InterceptorStackImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/InterceptorStackImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- InterceptorStackImpl.java	29 Jul 2004 13:18:49 -0000	1.6
  +++ InterceptorStackImpl.java	18 Aug 2004 19:34:09 -0000	1.7
  @@ -121,4 +121,8 @@
           }
       }
   
  +	public Log getServiceLog()
  +	{
  +		return _log;
  +	}
   }
  
  
  
  1.9       +9 -4      jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ImplStrings.properties
  
  Index: ImplStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ImplStrings.properties,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ImplStrings.properties	11 Aug 2004 18:47:56 -0000	1.8
  +++ ImplStrings.properties	18 Aug 2004 19:34:09 -0000	1.9
  @@ -38,10 +38,15 @@
   missing-service=No module has contributed a service constructor for service point {0}.
   duplicate-factory=Module {0} has contributed a instance builder to service point {1}, which conflicts with an existing contribution by module {2}. The duplicate contribution has been ignored.  
   
  -optional=an optional
  -required=exactly one
  -one-or-more=at least one
  -wrong-number-of-contributions=Configuration point {0} contains {1,choice,0#no contributions|1#one contribution|1<{1,number,integer} contributions} but expects {2} contribution.
  +occurances.NONE=no contributions
  +occurances.OPTIONAL=an optional contribution
  +occurances.REQUIRED=exactly one contribution
  +occurances.ONE_PLUS=at least one contribution
  +
  +contribution-count={0,choice,0#no contributions|1#one contribution|1<{0,number,integer} contributions}
  +
  +wrong-number-of-contributions=Configuration point {0} contains {1} but expects {2}.
  +wrong-number-of-parameters=Parameters to service implementation factory {0} contains {1} but expects {2}.
   
   no-such-configuration=Configuration point {0} does not exist.
   no-such-symbol=No value available for symbol ''{0}''.
  
  
  
  1.15      +26 -9     jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ImplMessages.java
  
  Index: ImplMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ImplMessages.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ImplMessages.java	11 Aug 2004 18:47:56 -0000	1.14
  +++ ImplMessages.java	18 Aug 2004 19:34:09 -0000	1.15
  @@ -198,19 +198,36 @@
           int actualCount,
           Occurances expectation)
       {
  -        String key = "optional";
  -
  -        if (expectation == Occurances.REQUIRED)
  -            key = "required";
  -        else
  -            if (expectation == Occurances.ONE_PLUS)
  -                key = "one-or-more";
  +        String key = "occurances." + expectation.getName();
   
           return _formatter.format(
               "wrong-number-of-contributions",
               point.getExtensionPointId(),
  -            new Integer(actualCount),
  -            _formatter.getMessage(key));
  +            contributionCount(actualCount),
  +            occurances(expectation));
  +    }
  +
  +    public static String occurances(Occurances occurances)
  +    {
  +        return _formatter.getMessage("occurances." + occurances.getName());
  +    }
  +
  +    public static String contributionCount(int count)
  +    {
  +        return _formatter.format("contribution-count", new Integer(count));
  +    }
  +
  +    public static String wrongNumberOfParameters(
  +        String factoryServiceId,
  +        int actualCount,
  +        Occurances expectation)
  +    {
  +        return _formatter.format(
  +            "wrong-number-of-parameters",
  +            factoryServiceId,
  +            contributionCount(actualCount),
  +            occurances(expectation));
  +
       }
   
       public static String noSuchConfiguration(String pointId)
  
  
  
  1.6       +14 -0     jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ServicePointImpl.java
  
  Index: ServicePointImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ServicePointImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ServicePointImpl.java	25 Jul 2004 22:12:51 -0000	1.5
  +++ ServicePointImpl.java	18 Aug 2004 19:34:09 -0000	1.6
  @@ -23,6 +23,7 @@
   import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.ClassResolver;
   import org.apache.hivemind.HiveMind;
  +import org.apache.hivemind.Occurances;
   import org.apache.hivemind.ShutdownCoordinator;
   import org.apache.hivemind.internal.ServiceImplementationConstructor;
   import org.apache.hivemind.internal.ServiceInterceptorContribution;
  @@ -52,6 +53,7 @@
       private List _interceptorContributions;
       private boolean _interceptorsOrdered;
       private Schema _parametersSchema;
  +    private Occurances _parametersCount;
       private String _serviceModel;
       private ShutdownCoordinator _shutdownCoordinator;
       private ServiceModel _serviceModelObject;
  @@ -65,6 +67,7 @@
           builder.append("factoryContribution", _serviceConstructor);
           builder.append("interceptorContributions", _interceptorContributions);
           builder.append("parametersSchema", _parametersSchema);
  +        builder.append("parametersCount", _parametersCount);
           builder.append("serviceModel", _serviceModel);
   
           if (_building)
  @@ -276,4 +279,15 @@
       {
           return LogFactory.getLog(getExtensionPointId());
       }
  +    
  +    public Occurances getParametersCount()
  +    {
  +        return _parametersCount;
  +    }
  +
  +    public void setParametersCount(Occurances occurances)
  +    {
  +        _parametersCount = occurances;
  +    }
  +
   }
  
  
  
  1.5       +2 -2      jakarta-hivemind/library/src/test/hivemind/test/lib/TestSpringLookupFactory.java
  
  Index: TestSpringLookupFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/test/hivemind/test/lib/TestSpringLookupFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestSpringLookupFactory.java	3 Aug 2004 14:02:10 -0000	1.4
  +++ TestSpringLookupFactory.java	18 Aug 2004 19:34:10 -0000	1.5
  @@ -76,7 +76,7 @@
   
           replayControls();
   
  -        Object actual = lf.createCoreServiceImplementation("fred", List.class, null, params);
  +        Object actual = lf.createCoreServiceImplementation("fred", List.class, null, null, params);
   
           assertSame(fred, actual);
   
  @@ -99,7 +99,7 @@
   
           replayControls();
   
  -        Object actual = lf.createCoreServiceImplementation("fred", List.class, null, params);
  +        Object actual = lf.createCoreServiceImplementation("fred", List.class, null, null, params);
   
           assertSame(fred, actual);
   
  
  
  
  1.6       +1 -1      jakarta-hivemind/library/src/test/hivemind/test/lib/TestDefaultImplementationBuilder.java
  
  Index: TestDefaultImplementationBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/test/hivemind/test/lib/TestDefaultImplementationBuilder.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestDefaultImplementationBuilder.java	3 Aug 2004 14:02:11 -0000	1.5
  +++ TestDefaultImplementationBuilder.java	18 Aug 2004 19:34:10 -0000	1.6
  @@ -153,7 +153,7 @@
           replayControls();
   
           Runnable r =
  -            (Runnable) db.createCoreServiceImplementation("foo", Runnable.class, _module, null);
  +            (Runnable) db.createCoreServiceImplementation("foo", Runnable.class, null, _module, null);
   
           r.run();
   
  
  
  
  1.7       +2 -11     jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/EJBProxyFactory.java
  
  Index: EJBProxyFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/EJBProxyFactory.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- EJBProxyFactory.java	29 Jul 2004 13:18:50 -0000	1.6
  +++ EJBProxyFactory.java	18 Aug 2004 19:34:10 -0000	1.7
  @@ -20,6 +20,7 @@
   import java.rmi.RemoteException;
   import java.util.List;
   
  +import org.apache.commons.logging.Log;
   import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.HiveMind;
   import org.apache.hivemind.ServiceImplementationFactory;
  @@ -48,10 +49,6 @@
    */
   public class EJBProxyFactory extends BaseLocatable implements ServiceImplementationFactory
   {
  -    /**
  -     * SEP for the EJBProxyFactory.
  -     */
  -    private String _pointId;
       private NameLookup _nameLookup;
       private RemoteExceptionCoordinator _coordinator;
       private ClassFactory _classFactory;
  @@ -59,11 +56,10 @@
       public Object createCoreServiceImplementation(
           String serviceId,
           Class serviceInterface,
  +        Log serviceLog,
           Module invokingModule,
           List parameters)
       {
  -        HiveMind.checkFactoryParameterCount(_pointId, parameters, 1);
  -
           EJBProxyParameters proxyParameters = (EJBProxyParameters) parameters.get(0);
           String jndiName = proxyParameters.getJndiName();
           String homeInterfaceClassName = proxyParameters.getHomeInterfaceClassName();
  @@ -251,11 +247,6 @@
           {
               throw new ApplicationRuntimeException(ex);
           }
  -    }
  -
  -    public void setPointId(String string)
  -    {
  -        _pointId = string;
       }
   
       public void setClassFactory(ClassFactory factory)
  
  
  
  1.3       +2 -8      jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/SpringLookupFactory.java
  
  Index: SpringLookupFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/SpringLookupFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SpringLookupFactory.java	17 Jun 2004 15:16:14 -0000	1.2
  +++ SpringLookupFactory.java	18 Aug 2004 19:34:10 -0000	1.3
  @@ -16,6 +16,7 @@
   
   import java.util.List;
   
  +import org.apache.commons.logging.Log;
   import org.apache.hivemind.HiveMind;
   import org.apache.hivemind.ServiceImplementationFactory;
   import org.apache.hivemind.impl.BaseLocatable;
  @@ -32,17 +33,15 @@
    */
   public class SpringLookupFactory extends BaseLocatable implements ServiceImplementationFactory
   {
  -    private String _pointId;
       private SpringBeanFactorySource _defaultBeanFactorySource;
   
       public Object createCoreServiceImplementation(
           String serviceId,
           Class serviceInterface,
  +        Log serviceLog,
           Module invokingModule,
           List parameters)
       {
  -        HiveMind.checkFactoryParameterCount(_pointId, parameters, 1);
  -
           SpringBeanParameter p = (SpringBeanParameter) parameters.get(0);
   
           String beanName = p.getName();
  @@ -59,10 +58,5 @@
       public void setDefaultBeanFactorySource(SpringBeanFactorySource source)
       {
           _defaultBeanFactorySource = source;
  -    }
  -
  -    public void setPointId(String string)
  -    {
  -        _pointId = string;
       }
   }
  
  
  
  1.2       +2 -9      jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/ServicePropertyFactory.java
  
  Index: ServicePropertyFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/ServicePropertyFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServicePropertyFactory.java	6 Aug 2004 17:03:31 -0000	1.1
  +++ ServicePropertyFactory.java	18 Aug 2004 19:34:10 -0000	1.2
  @@ -18,6 +18,7 @@
   import java.lang.reflect.Modifier;
   import java.util.List;
   
  +import org.apache.commons.logging.Log;
   import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.HiveMind;
   import org.apache.hivemind.ServiceImplementationFactory;
  @@ -41,17 +42,15 @@
    */
   public class ServicePropertyFactory implements ServiceImplementationFactory
   {
  -    private String _serviceId;
       private ClassFactory _classFactory;
   
       public Object createCoreServiceImplementation(
           String serviceId,
           Class serviceInterface,
  +        Log serviceLog,
           Module invokingModule,
           List parameters)
       {
  -        HiveMind.checkFactoryParameterCount(_serviceId, parameters, 1);
  -
           ServicePropertyFactoryParameter p = (ServicePropertyFactoryParameter) parameters.get(0);
   
           Object targetService = p.getService();
  @@ -176,10 +175,4 @@
       {
           _classFactory = factory;
       }
  -
  -    public void setServiceId(String string)
  -    {
  -        _serviceId = string;
  -    }
  -
   }
  
  
  
  1.2       +2 -0      jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/PlaceholderFactory.java
  
  Index: PlaceholderFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/PlaceholderFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PlaceholderFactory.java	9 Jun 2004 14:56:13 -0000	1.1
  +++ PlaceholderFactory.java	18 Aug 2004 19:34:10 -0000	1.2
  @@ -16,6 +16,7 @@
   
   import java.util.List;
   
  +import org.apache.commons.logging.Log;
   import org.apache.hivemind.ServiceImplementationFactory;
   import org.apache.hivemind.impl.BaseLocatable;
   import org.apache.hivemind.internal.Module;
  @@ -34,6 +35,7 @@
       public Object createCoreServiceImplementation(
           String serviceId,
           Class serviceInterface,
  +        Log serviceLog,
           Module invokingModule,
           List parameters)
       {
  
  
  
  1.4       +6 -2      jakarta-hivemind/framework/src/java/org/apache/hivemind/ServiceImplementationFactory.java
  
  Index: ServiceImplementationFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/ServiceImplementationFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ServiceImplementationFactory.java	25 Jun 2004 20:20:01 -0000	1.3
  +++ ServiceImplementationFactory.java	18 Aug 2004 19:34:10 -0000	1.4
  @@ -16,6 +16,7 @@
   
   import java.util.List;
   
  +import org.apache.commons.logging.Log;
   import org.apache.hivemind.internal.Module;
   
   /**
  @@ -36,14 +37,17 @@
        * @param serviceInterface the interface for the service
        * @param invokingModule the module containing the service extension which invokes
        * the factory
  +     * @param serviceLog the logger to use for any output concerning the service
        * @param parameters the parameters passed to the factory (possibly converted, if
        * the factory has a parameter schema).  May be empty but won't be null.
        */
       public Object createCoreServiceImplementation(
           String serviceId,
           Class serviceInterface,
  -        // TODO: Can we use something else here? Module is in internal and it would be best
  -        // to not expose it.
  +        Log serviceLog,
           Module invokingModule,
           List parameters);
  +        
  +    // TODO: Can we use something else here? Module is in internal and it would be best
  +    // to not expose it.
   }
  
  
  
  1.2       +0 -1      jakarta-hivemind/framework/src/java/org/apache/hivemind/HiveMindStrings.properties
  
  Index: HiveMindStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/HiveMindStrings.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HiveMindStrings.properties	17 Jun 2004 15:16:11 -0000	1.1
  +++ HiveMindStrings.properties	18 Aug 2004 19:34:10 -0000	1.2
  @@ -16,7 +16,6 @@
   
   null-parameter-invalid=Parameter {0} may not be null.
   unknown-location=unknown location
  -wrong-factory-parameter-count=Service implementation factory {0} expects {1,choice,0#no parameters|1#one parameter|1<{1,number,integer} parameters} but received {2,choice,0#none|1#one|1<{2,number,integer}}.
   unimplemented-method=Class {0} must provide an overridden implementation of method {1}().
   registry-shutdown=The HiveMind Registry has been shutdown.
   
  
  
  
  1.4       +6 -0      jakarta-hivemind/framework/src/java/org/apache/hivemind/ServiceInterceptorFactory.java
  
  Index: ServiceInterceptorFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/ServiceInterceptorFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ServiceInterceptorFactory.java	25 Jun 2004 20:20:01 -0000	1.3
  +++ ServiceInterceptorFactory.java	18 Aug 2004 19:34:10 -0000	1.4
  @@ -23,6 +23,12 @@
    * an interceptor.  Interceptors are objects that implement a particular
    * interface, adding logic before or after invoking methods on a wrapped
    * object (implementing the same instance).
  + * 
  + * <p>
  + * Implementations must be stateless and multi-threaded. 
  + * An interceptor may only be applied once to any single service.
  + * The factory will only be invoked once for any single service (even in the case
  + * of non-standard service models such as threaded and pooled).
    *
    * @author Howard Lewis Ship
    */
  
  
  
  1.4       +50 -5     jakarta-hivemind/framework/src/java/org/apache/hivemind/Occurances.java
  
  Index: Occurances.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/Occurances.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Occurances.java	25 Jun 2004 20:20:01 -0000	1.3
  +++ Occurances.java	18 Aug 2004 19:34:10 -0000	1.4
  @@ -20,30 +20,62 @@
    *
    * @author Howard Lewis Ship
    */
  -public final class Occurances
  +public abstract class Occurances
   {
       /**
        * An unbounded number, zero or more.
        */
  -    public static final Occurances UNBOUNDED = new Occurances("UNBOUNDED");
  +    public static final Occurances UNBOUNDED = new Occurances("UNBOUNDED")
  +    {
  +        public boolean inRange(int count)
  +        {
  +            return true;
  +        }
  +    };
   
       /**
        * Optional, may be zero or one, but not more.
        */
   
  -    public static final Occurances OPTIONAL = new Occurances("OPTIONAL");
  +    public static final Occurances OPTIONAL = new Occurances("OPTIONAL")
  +    {
  +        public boolean inRange(int count)
  +        {
  +            return count < 2;
  +        }
  +    };
   
       /**
        * Exactly one is required.
        */
   
  -    public static final Occurances REQUIRED = new Occurances("REQUIRED");
  +    public static final Occurances REQUIRED = new Occurances("REQUIRED")
  +    {
  +        public boolean inRange(int count)
  +        {
  +            return count == 1;
  +        }
  +    };
   
       /**
        * At least one is required.
        */
   
  -    public static final Occurances ONE_PLUS = new Occurances("ONE_PLUS");
  +    public static final Occurances ONE_PLUS = new Occurances("ONE_PLUS")
  +    {
  +        public boolean inRange(int count)
  +        {
  +            return count > 0;
  +        }
  +    };
  +
  +    public static final Occurances NONE = new Occurances("NONE")
  +    {
  +        public boolean inRange(int count)
  +        {
  +            return count == 0;
  +        }
  +    };
   
       private String _name;
   
  @@ -52,9 +84,22 @@
           _name = name;
       }
   
  +    public String getName()
  +    {
  +        return _name;
  +    }
  +
       public String toString()
       {
           return "Occurances[" + _name + "]";
       }
  +
  +    /**
  +     * Validates that an actual count is in range for the particular Occurances count.
  +     * 
  +     * @param count the number of items to check. Should be zero or greater.
  +     * @returns true if count is a valid number in accordance to the range, false otherwise
  +     */
  +    public abstract boolean inRange(int count);
   
   }
  
  
  
  1.5       +8 -0      jakarta-hivemind/framework/src/java/org/apache/hivemind/InterceptorStack.java
  
  Index: InterceptorStack.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/InterceptorStack.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- InterceptorStack.java	25 Jun 2004 20:20:01 -0000	1.4
  +++ InterceptorStack.java	18 Aug 2004 19:34:10 -0000	1.5
  @@ -14,6 +14,7 @@
   
   package org.apache.hivemind;
   
  +import org.apache.commons.logging.Log;
   import org.apache.hivemind.internal.Module;
   
   /**
  @@ -58,4 +59,11 @@
   	 */
   	
   	public void push(Object interceptor);
  +	
  +	/**
  +	 * Returns the Log instance that should be used to log any information
  +	 * about the service, or the construction of the service.
  +	 */
  +	
  +	public Log getServiceLog();
   }
  
  
  
  1.11      +0 -22     jakarta-hivemind/framework/src/java/org/apache/hivemind/HiveMind.java
  
  Index: HiveMind.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/HiveMind.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- HiveMind.java	17 Jun 2004 15:16:11 -0000	1.10
  +++ HiveMind.java	18 Aug 2004 19:34:10 -0000	1.11
  @@ -35,28 +35,6 @@
           // Prevent instantiation
       }
   
  -    /**
  -     * Checks that the number of parameters provided to a service implementation factory
  -     * matches the expected number.
  -     * 
  -     * @param extensionPointId the id of the service implementation factory (used in the error message)
  -     * @param parameters the actual parameters
  -     * @param expectedCount the expected number of parameters (usually, 1)
  -     * @throws ApplicationRuntimeException if the actual and expected counts differ.
  -     */
  -    public static void checkFactoryParameterCount(
  -        String extensionPointId,
  -        List parameters,
  -        int expectedCount)
  -    {
  -        if (parameters.size() != expectedCount)
  -            throw new ApplicationRuntimeException(
  -                HiveMindMessages.wrongFactoryParameterCount(
  -                    extensionPointId,
  -                    expectedCount,
  -                    parameters.size()));
  -    }
  -
       public static ApplicationRuntimeException createRegistryShutdownException()
       {
           return new ApplicationRuntimeException(HiveMindMessages.registryShutdown());
  
  
  
  1.3       +0 -12     jakarta-hivemind/framework/src/java/org/apache/hivemind/HiveMindMessages.java
  
  Index: HiveMindMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/HiveMindMessages.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HiveMindMessages.java	17 Jun 2004 15:16:11 -0000	1.2
  +++ HiveMindMessages.java	18 Aug 2004 19:34:10 -0000	1.3
  @@ -47,16 +47,4 @@
           return _formatter.format("null-parameter-invalid", name);
       }
   
  -    public static String wrongFactoryParameterCount(
  -        String pointId,
  -        int expectedCount,
  -        int actualCount)
  -    {
  -        return _formatter.format(
  -            "wrong-factory-parameter-count",
  -            pointId,
  -            new Integer(expectedCount),
  -            new Integer(actualCount));
  -    }
  -
   }
  
  
  
  1.2       +27 -39    jakarta-hivemind/examples/src/documentation/content/xdocs/hivemind-examples/logging.xml
  
  Index: logging.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/examples/src/documentation/content/xdocs/hivemind-examples/logging.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- logging.xml	16 Aug 2004 14:42:25 -0000	1.1
  +++ logging.xml	18 Aug 2004 19:34:11 -0000	1.2
  @@ -48,24 +48,16 @@
   
   <section>
     <title>The Interceptor Factory</title>
  -  
  -<p>
  -Interceptors are created by interceptor factories, which are themselves HiveMind services.  Interceptor factories
  -implement the &api.ServiceInterceptorFactory; interface.
  -</p>
  -
  -<p>
  -Our implementation is very simple:
  -</p>
  -
  -<source><![CDATA[package org.apache.hivemind.examples.impl;
  +  <p> Interceptors are created by interceptor factories, which are themselves HiveMind services. Interceptor factories 
  +    implement the &api.ServiceInterceptorFactory; interface. </p>
  +  <p> Our implementation is very simple: </p>
  +  <source><![CDATA[package org.apache.hivemind.examples.impl;
   
   import java.lang.reflect.InvocationHandler;
   import java.lang.reflect.Proxy;
   import java.util.List;
   
   import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
   import org.apache.hivemind.InterceptorStack;
   import org.apache.hivemind.ServiceInterceptorFactory;
   import org.apache.hivemind.internal.Module;
  @@ -75,7 +67,7 @@
   
       public void createInterceptor(InterceptorStack stack, Module invokingModule, List parameters)
       {
  -        Log log = LogFactory.getLog(stack.getServiceExtensionPointId());
  +        Log log = stack.getServiceLog();
   
           InvocationHandler handler = new ProxyLoggingInvocationHandler(log, stack.peek());
   
  @@ -88,31 +80,26 @@
           stack.push(interceptor);
       }
   }]]></source>
  -  
  -<p>
  -The <code>createInterceptor()</code> method is passed the &api.InterceptorStack;, the
  -&api.Module; of the invoking module (the module containing the service being created), and any
  -parameters passed to the interceptor (from inside the &interceptor; element). This example does not make use
  -of parameters, but the real logging interceptor uses parameters to control which methods are, and are not, logged.
  -</p>  
  -
  -<p>
  -An interceptor's job is to <code>peek()</code> at the top object on the stack and create a new object, wrapped around
  -the top object, that provides new behavior.  The top object on the stack may be the core service implementation, or
  -it may be another interceptor ... all that's known for sure is that it implements the service interface defined
  -by the &service-point;.
  -</p>
  -
  -<p>
  -The interceptor in this case is a dynamic proxy, provided by <code>Proxy.newProxyInstance()</code>. The key here
  -is the <em>invocation handler</em>, and object (described shortly) that is notified any time a method on the
  -interceptor proxy is invoked.
  -</p>
  -
  -<p>
  -Once the interceptor is created, it is pushed onto the stack.  More interceptors may build upon it, adding yet more behavior.
  -</p>
  -  
  +  <p> The <code>createInterceptor()</code> method is passed the &api.InterceptorStack;, the &api.Module; of the 
  +    invoking module (the module containing the service being created), and any parameters passed to the interceptor 
  +    (from inside the &interceptor; element). This example does not make use of parameters, but the real logging 
  +    interceptor uses parameters to control which methods are, and are not, logged. </p>
  +  <p> An interceptor's job is to <code>peek()</code> at the top object on the stack and create a new object, wrapped 
  +    around the top object, that provides new behavior. The top object on the stack may be the core service 
  +    implementation, or it may be another interceptor ... all that's known for sure is that it implements the service 
  +    interface defined by the &service-point;. </p>
  +  <p> The interceptor in this case is a dynamic proxy, provided by <code>Proxy.newProxyInstance()</code>. The key here 
  +    is the <em>invocation handler</em>, and object (described shortly) that is notified any time a method on the 
  +    interceptor proxy is invoked. </p>
  +  <p> Once the interceptor is created, it is pushed onto the stack. More interceptors may build upon it, adding yet 
  +    more behavior. </p>
  +  <p> In HiveMind, a single <code>Log</code> instance is used when constructing a service as well as by any 
  +    interceptors created for the service. In other words, by enabling logging for a particular service id, you will see 
  +    log events for every aspect of the construction of that particular service. If you add a logging interceptor, 
  +    you'll also see method invocations. To ensure that logging takes place using the single logging instance, neither 
  +    the class nor the interceptor factory is responsible for creating the logging instance ... that's the 
  +    responsibility of HiveMind. The logging instance to use is provided by the <code>getServiceLog()</code> method of 
  +    the &api.InterceptorStack; instance provided to the interceptor factory. </p>
   </section>
   
   <section>
  @@ -121,7 +108,8 @@
   <p>
   The invocation handler is where the intercepting really takes place; it is invoked every time a method of the
   proxy object is invoked and has a chance to add behavior before, and after (or even instead of!) invoking a method
  -on the next object in the stack.
  +on the next object in the stack.  What is the "next object"?  It's the next object in the interceptor stack, and may be
  +another interceptor instance, or may be the core service implementation.
   </p>
   
   <source><![CDATA[package org.apache.hivemind.examples.impl;
  
  
  
  1.2       +1 -2      jakarta-hivemind/examples/src/java/org/apache/hivemind/examples/impl/ProxyLoggingInterceptorFactory.java
  
  Index: ProxyLoggingInterceptorFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/examples/src/java/org/apache/hivemind/examples/impl/ProxyLoggingInterceptorFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProxyLoggingInterceptorFactory.java	16 Aug 2004 14:42:25 -0000	1.1
  +++ ProxyLoggingInterceptorFactory.java	18 Aug 2004 19:34:11 -0000	1.2
  @@ -19,7 +19,6 @@
   import java.util.List;
   
   import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
   import org.apache.hivemind.InterceptorStack;
   import org.apache.hivemind.ServiceInterceptorFactory;
   import org.apache.hivemind.internal.Module;
  @@ -35,7 +34,7 @@
   
       public void createInterceptor(InterceptorStack stack, Module invokingModule, List parameters)
       {
  -        Log log = LogFactory.getLog(stack.getServiceExtensionPointId());
  +        Log log = stack.getServiceLog();
   
           InvocationHandler handler = new ProxyLoggingInvocationHandler(log, stack.peek());
   
  
  
  
  1.19      +0 -17     jakarta-hivemind/framework/src/test/hivemind/test/TestMisc.java
  
  Index: TestMisc.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/TestMisc.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TestMisc.java	21 Jun 2004 14:25:44 -0000	1.18
  +++ TestMisc.java	18 Aug 2004 19:34:11 -0000	1.19
  @@ -40,23 +40,6 @@
    */
   public class TestMisc extends FrameworkTestCase
   {
  -
  -    public void testCheckFactoryParameterCountFailure()
  -    {
  -        try
  -        {
  -            HiveMind.checkFactoryParameterCount("an.extension.id", new ArrayList(), 1);
  -
  -            unreachable();
  -        }
  -        catch (ApplicationRuntimeException ex)
  -        {
  -            assertExceptionSubstring(
  -                ex,
  -                "Service implementation factory an.extension.id expects one parameter but received none.");
  -        }
  -    }
  -
       public void testApplicationRuntimeExceptionGetComponent()
       {
           ApplicationRuntimeException ex =
  
  
  
  1.5       +1 -1      jakarta-hivemind/library/src/test/org/apache/hivemind/lib/factory/TestBeanFactoryImpl.java
  
  Index: TestBeanFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/test/org/apache/hivemind/lib/factory/TestBeanFactoryImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestBeanFactoryImpl.java	3 Aug 2004 14:02:17 -0000	1.4
  +++ TestBeanFactoryImpl.java	18 Aug 2004 19:34:11 -0000	1.5
  @@ -223,7 +223,7 @@
                   "foo.bar",
                   BeanFactory.class,
                   null,
  -                Collections.singletonList(p));
  +                null, Collections.singletonList(p));
   
           Integer i = (Integer) f.get("integer,5");
   
  
  
  
  1.11      +1 -0      jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/DescriptorParser.properties
  
  Index: DescriptorParser.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/DescriptorParser.properties,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DescriptorParser.properties	11 Aug 2004 11:41:34 -0000	1.10
  +++ DescriptorParser.properties	18 Aug 2004 19:34:11 -0000	1.11
  @@ -30,6 +30,7 @@
   required.service-point.id=true
   required.service-point.interface=true
   required.service-point.parameters-schema-id=false
  +required.service-point.parameters-occurs=false
   
   required.implementation.service-id=true
   
  
  
  
  1.5       +13 -0     jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/ServicePointDescriptor.java
  
  Index: ServicePointDescriptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/ServicePointDescriptor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ServicePointDescriptor.java	25 Jun 2004 20:20:02 -0000	1.4
  +++ ServicePointDescriptor.java	18 Aug 2004 19:34:11 -0000	1.5
  @@ -14,6 +14,7 @@
   
   package org.apache.hivemind.parse;
   
  +import org.apache.hivemind.Occurances;
   import org.apache.hivemind.schema.Schema;
   import org.apache.hivemind.util.ToStringBuilder;
   
  @@ -28,6 +29,7 @@
       private String _id;
       private String _interfaceClassName;
       private Schema _parametersSchema;
  +    private Occurances _parametersCount = Occurances.REQUIRED;
   
       public String getId()
       {
  @@ -54,6 +56,7 @@
           builder.append("id", _id);
           builder.append("interfaceClassName", _interfaceClassName);
           builder.append("parametersSchema", _parametersSchema);
  +        builder.append("parametersCount", _parametersCount);
       }
   
       public Schema getParametersSchema()
  @@ -64,6 +67,16 @@
       public void setParametersSchema(Schema schema)
       {
           _parametersSchema = schema;
  +    }
  +
  +    public Occurances getParametersCount()
  +    {
  +        return _parametersCount;
  +    }
  +
  +    public void setParametersCount(Occurances occurances)
  +    {
  +        _parametersCount = occurances;
       }
   
   }
  
  
  
  1.28      +8 -2      jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/DescriptorParser.java
  
  Index: DescriptorParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/DescriptorParser.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- DescriptorParser.java	11 Aug 2004 11:41:34 -0000	1.27
  +++ DescriptorParser.java	18 Aug 2004 19:34:11 -0000	1.28
  @@ -233,6 +233,7 @@
           OCCURS_MAP.put("1", Occurances.REQUIRED);
           OCCURS_MAP.put("1..n", Occurances.ONE_PLUS);
           OCCURS_MAP.put("0..n", Occurances.UNBOUNDED);
  +        OCCURS_MAP.put("none", Occurances.NONE);
       }
   
       public DescriptorParser(ErrorHandler errorHandler, RegistryAssembly assembly)
  @@ -735,7 +736,7 @@
   
           attributeModel.setName(getAttribute("name"));
           attributeModel.setRequired(getBooleanAttribute("required", false));
  -	    attributeModel.setUnique(getBooleanAttribute("unique", false));
  +        attributeModel.setUnique(getBooleanAttribute("unique", false));
           attributeModel.setTranslator(getAttribute("translator", "smart"));
   
           elementModel.addAttributeModel(attributeModel);
  @@ -1036,6 +1037,11 @@
   
           spd.setParametersSchema(s);
   
  +        Occurances count = (Occurances) getEnumAttribute("parameters-occurs", OCCURS_MAP);
  +
  +        if (count != null)
  +            spd.setParametersCount(count);
  +
           md.addServicePoint(spd);
       }
   
  @@ -1406,7 +1412,7 @@
               throw new ApplicationRuntimeException(
                   ParseMessages.errorReadingDescriptor(resource, ex),
                   resource,
  -                null,
  +                getLocation(),
                   ex);
           }
           finally
  
  
  
  1.45      +6 -0      jakarta-hivemind/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/status.xml,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- status.xml	11 Aug 2004 18:47:56 -0000	1.44
  +++ status.xml	18 Aug 2004 19:34:11 -0000	1.45
  @@ -60,6 +60,12 @@
         <action type="fix" dev="HLS" fixes-bug="HIVEMIND-41">
           Add checks to SchemaProcessorImpl for empty stack conditions
         </action>
  +      <action type="fix" dev="HLS" fixes-bug="HIVEMIND-33">
  +        Add parameters-occurs attribute to &lt;service-point&gt; element.
  +      </action>
  +      <action type="fix" dev="HLS" fixes-bug="HIVEMIND-23">
  +        Specify location in all module deployment descriptor parse exceptions.
  +      </action>
       </release>
     
       <release version="1.0-beta-2" date="Aug 1 2004">
  
  
  
  1.1                  jakarta-hivemind/framework/src/test/org/apache/hivemind/impl/TestInvokeFactoryServiceConstructor.java
  
  Index: TestInvokeFactoryServiceConstructor.java
  ===================================================================
  //  Copyright 2004 The Apache Software Foundation
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  //     http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.
  
  package org.apache.hivemind.impl;
  
  import java.util.Collections;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.hivemind.ErrorHandler;
  import org.apache.hivemind.Occurances;
  import org.apache.hivemind.ServiceImplementationFactory;
  import org.apache.hivemind.internal.Module;
  import org.apache.hivemind.internal.ServicePoint;
  import org.apache.hivemind.test.HiveMindTestCase;
  import org.easymock.MockControl;
  
  /**
   * Tests some error conditions related to invoking a service factory.
   *
   * @author Howard Lewis Ship
   */
  public class TestInvokeFactoryServiceConstructor extends HiveMindTestCase
  {
      private static final Log LOG = LogFactory.getLog(TestInvokeFactoryServiceConstructor.class);
  
      public void testWrongNumberOfParameters()
      {
          MockControl moduleControl = newControl(Module.class);
          Module module = (Module) moduleControl.getMock();
  
          MockControl factoryPointControl = newControl(ServicePoint.class);
          ServicePoint factoryPoint = (ServicePoint) factoryPointControl.getMock();
  
          MockControl factoryControl = newControl(ServiceImplementationFactory.class);
          ServiceImplementationFactory factory =
              (ServiceImplementationFactory) factoryControl.getMock();
  
          MockControl pointControl = newControl(ServicePoint.class);
          ServicePoint point = (ServicePoint) pointControl.getMock();
  
          InvokeFactoryServiceConstructor c = new InvokeFactoryServiceConstructor();
  
          MockControl errorHandlerControl = newControl(ErrorHandler.class);
          ErrorHandler eh = (ErrorHandler) errorHandlerControl.getMock();
  
          // Training !
  
          point.getServiceLog();
          pointControl.setReturnValue(LOG);
  
          module.getServicePoint("foo.bar.Baz");
          moduleControl.setReturnValue(factoryPoint);
  
          factoryPoint.getParametersCount();
          factoryPointControl.setReturnValue(Occurances.REQUIRED);
  
          factoryPoint.getService(ServiceImplementationFactory.class);
          factoryPointControl.setReturnValue(factory);
  
          factoryPoint.getParametersSchema();
          factoryPointControl.setReturnValue(null);
  
          module.getErrorHandler();
          moduleControl.setReturnValue(eh);
  
          String message =
              ImplMessages.wrongNumberOfParameters("foo.bar.Baz", 0, Occurances.REQUIRED);
  
          eh.error(LOG, message, null, null);
  
          point.getExtensionPointId();
          pointControl.setReturnValue("bleep.Bloop");
  
          point.getServiceInterface();
          pointControl.setReturnValue(Runnable.class);
  
          factory.createCoreServiceImplementation(
              "bleep.Bloop",
              Runnable.class,
              LOG,
              module,
              Collections.EMPTY_LIST);
          factoryControl.setReturnValue("THE SERVICE");
  
          replayControls();
  
          c.setContributingModule(module);
          c.setFactoryServiceId("foo.bar.Baz");
          c.setParameters(Collections.EMPTY_LIST);
          c.setServiceExtensionPoint(point);
  
          assertEquals("THE SERVICE", c.constructCoreServiceImplementation());
  
          verifyControls();
      }
  }
  
  
  
  1.8       +9 -40     jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/LoggingInterceptorFactory.java
  
  Index: LoggingInterceptorFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/LoggingInterceptorFactory.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- LoggingInterceptorFactory.java	15 Aug 2004 15:41:57 -0000	1.7
  +++ LoggingInterceptorFactory.java	18 Aug 2004 19:34:11 -0000	1.8
  @@ -17,13 +17,10 @@
   import java.lang.reflect.Constructor;
   import java.lang.reflect.Method;
   import java.lang.reflect.Modifier;
  -import java.util.HashMap;
   import java.util.Iterator;
   import java.util.List;
  -import java.util.Map;
   
   import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
   import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.InterceptorStack;
   import org.apache.hivemind.ServiceInterceptorFactory;
  @@ -54,14 +51,13 @@
    */
   public class LoggingInterceptorFactory implements ServiceInterceptorFactory
   {
  -    private Map _cachedClasses = new HashMap();
       private ClassFactory _factory;
       private String _serviceId;
   
  -	/**
  -	 * Creates a method that delegates to the _inner object; this is used for
  -	 * methods that are not logged.
  -	 */
  +    /**
  +     * Creates a method that delegates to the _inner object; this is used for
  +     * methods that are not logged.
  +     */
       private void addPassThruMethodImplementation(ClassFab classFab, MethodSignature sig)
       {
           BodyBuilder builder = new BodyBuilder();
  @@ -230,13 +226,13 @@
           Class topClass = stack.peek().getClass();
   
           classFab.addField("_log", Log.class);
  -        
  +
           // This is very important: since we know the instance of the top object (the next
           // object in the pipeline for this service), we can build the instance variable
           // and constructor to use the exact class rather than the service interface.
           // That's more efficient at runtime, lowering the cost of using interceptors.
           // One of the reasons I prefer Javassist over JDK Proxies.
  -        
  +
           classFab.addField("_inner", topClass);
   
           classFab.addConstructor(
  @@ -257,8 +253,7 @@
           Module contributingModule,
           List parameters)
       {
  -        Class serviceInterfaceClass = stack.getServiceInterface();
  -        Class interceptorClass = getInterceptorClass(stack, parameters);
  +        Class interceptorClass = constructInterceptorClass(stack, parameters);
   
           try
           {
  @@ -278,26 +273,7 @@
           }
       }
   
  -	/**
  -	 * Returns the Class for this interceptor.  In the standard service models (primitive
  -	 * and singleton) this will only be invoked once for a particular service.  Currently (this
  -	 * may change!) for threaded and pooled, this may be called frequently, so it is necessary
  -	 * to cache the Class (and make this method synchronized).
  -	 */
  -    private synchronized Class getInterceptorClass(InterceptorStack stack, List parameters)
  -    {
  -        String id = stack.getServiceExtensionPointId();
  -        Class result = (Class) _cachedClasses.get(id);
  -
  -        if (result != null)
  -            return result;
   
  -        result = constructInterceptorClass(stack, parameters);
  -
  -        _cachedClasses.put(id, result);
  -
  -        return result;
  -    }
   
       private boolean includeMethod(MethodMatcher matcher, MethodSignature sig)
       {
  @@ -309,21 +285,14 @@
           return mc == null || mc.getInclude();
       }
   
  -    private Object instantiateInterceptor(
  -        InterceptorStack stack,
  -        Class interceptorClass)
  +    private Object instantiateInterceptor(InterceptorStack stack, Class interceptorClass)
           throws Exception
       {
           Object stackTop = stack.peek();
   
  -		// TODO: Have InterceptorStack expose a method for obtaining the logger for
  -		// the service.
  -		
  -        Log log = LogFactory.getLog(stack.getServiceExtensionPointId());
  -
           Constructor c = interceptorClass.getConstructors()[0];
   
  -        return c.newInstance(new Object[] { log, stackTop });
  +        return c.newInstance(new Object[] { stack.getServiceLog(), stackTop });
       }
   
       public void setFactory(ClassFactory factory)
  
  
  
  1.15      +3 -14     jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderFactory.java
  
  Index: BuilderFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderFactory.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- BuilderFactory.java	25 Jul 2004 22:12:51 -0000	1.14
  +++ BuilderFactory.java	18 Aug 2004 19:34:11 -0000	1.15
  @@ -16,7 +16,7 @@
   
   import java.util.List;
   
  -import org.apache.commons.logging.LogFactory;
  +import org.apache.commons.logging.Log;
   import org.apache.hivemind.HiveMind;
   import org.apache.hivemind.ServiceImplementationFactory;
   import org.apache.hivemind.internal.Module;
  @@ -39,28 +39,17 @@
    */
   public class BuilderFactory implements ServiceImplementationFactory
   {
  -    private static final String POINT_ID = "hivemind.BuilderFactory";
  -
       public Object createCoreServiceImplementation(
           String serviceId,
           Class serviceInterface,
  +        Log serviceLog,
           Module invokingModule,
           List parameters)
       {
  -        HiveMind.checkFactoryParameterCount(POINT_ID, parameters, 1);
  -
           BuilderParameter parameter = (BuilderParameter) parameters.get(0);
   
  -		// Hm. Ideally, either the ServicePoint should pass in the Log instance, or
  -		// the ServicePoint itself should be passed in --- this duplicates (trivial)
  -		// logic inside AbstractServicePoint.
  -		
           BuilderFactoryLogic logic =
  -            new BuilderFactoryLogic(
  -                invokingModule,
  -                LogFactory.getLog(serviceId),
  -                serviceId,
  -                parameter);
  +            new BuilderFactoryLogic(invokingModule, serviceLog, serviceId, parameter);
   
           return logic.createService();
       }
  
  
  
  1.12      +5 -9      jakarta-hivemind/framework/src/test/hivemind/test/services/TestThreadedModel.java
  
  Index: TestThreadedModel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/TestThreadedModel.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestThreadedModel.java	25 Jun 2004 20:19:57 -0000	1.11
  +++ TestThreadedModel.java	18 Aug 2004 19:34:11 -0000	1.12
  @@ -72,22 +72,20 @@
           assertNull(h.getValue());
   
           assertEquals(
  -            "<ThreadedProxy for hivemind.test.services.StringHolder(hivemind.test.services.StringHolder)>",
  +            "<LoggingInterceptor for hivemind.test.services.StringHolder(hivemind.test.services.StringHolder)>",
               h.toString());
   
           assertLoggedMessages(
               new String[] {
  -                "Constructing core service implementation for service hivemind.test.services.StringHolder",
  -                "Applying interceptor factory hivemind.LoggingInterceptor",
                   "BEGIN getValue()",
  +                "Constructing core service implementation for service hivemind.test.services.StringHolder",
                   "END getValue() [<null>]",
                   "BEGIN setValue(fred)",
                   "END setValue()",
                   "BEGIN getValue()",
                   "END getValue() [fred]",
  -                "Constructing core service implementation for service hivemind.test.services.StringHolder",
  -                "Applying interceptor factory hivemind.LoggingInterceptor",
                   "BEGIN getValue()",
  +                "Constructing core service implementation for service hivemind.test.services.StringHolder",
                   "END getValue() [<null>]" });
   
       }
  @@ -130,17 +128,15 @@
   
           assertLoggedMessages(
               new String[] {
  -                "Constructing core service implementation for service hivemind.test.services.StringHolder",
  -                "Applying interceptor factory hivemind.LoggingInterceptor",
                   "BEGIN getValue()",
  +                "Constructing core service implementation for service hivemind.test.services.StringHolder",
                   "END getValue() [<null>]",
                   "BEGIN setValue(fred)",
                   "END setValue()",
                   "BEGIN getValue()",
                   "END getValue() [fred]",
  -                "Constructing core service implementation for service hivemind.test.services.StringHolder",
  -                "Applying interceptor factory hivemind.LoggingInterceptor",
                   "BEGIN getValue()",
  +                "Constructing core service implementation for service hivemind.test.services.StringHolder",
                   "END getValue() [<null>]",
                   "BEGIN setValue(barney)",
                   "END setValue()",
  
  
  
  1.15      +6 -6      jakarta-hivemind/framework/src/test/hivemind/test/services/TestBuilderFactory.java
  
  Index: TestBuilderFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/TestBuilderFactory.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TestBuilderFactory.java	3 Aug 2004 14:02:11 -0000	1.14
  +++ TestBuilderFactory.java	18 Aug 2004 19:34:11 -0000	1.15
  @@ -204,8 +204,8 @@
               (AutowireTarget) factory.createCoreServiceImplementation(
                   "foo.bar.Baz",
                   Runnable.class,
  -                module,
  -                Collections.singletonList(p));
  +                LogFactory.getLog("hivemind.BuilderFactory"),
  +                module, Collections.singletonList(p));
   
           assertSame(eh, t.getErrorHandler());
           assertSame(cr, t.getClassResolver());
  @@ -238,8 +238,8 @@
               (InitializeFixture) factory.createCoreServiceImplementation(
                   "foo",
                   Object.class,
  -                module,
  -                Collections.singletonList(p));
  +                null,
  +                module, Collections.singletonList(p));
   
           assertEquals("initializeService", f.getMethod());
   
  @@ -269,8 +269,8 @@
               (InitializeFixture) factory.createCoreServiceImplementation(
                   "foo",
                   Object.class,
  -                module,
  -                Collections.singletonList(p));
  +                null,
  +                module, Collections.singletonList(p));
   
           assertEquals("initializeCustom", f.getMethod());
   
  
  
  
  1.10      +22 -6     jakarta-hivemind/src/documentation/content/xdocs/descriptor.xml
  
  Index: descriptor.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/src/documentation/content/xdocs/descriptor.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- descriptor.xml	11 Aug 2004 11:41:34 -0000	1.9
  +++ descriptor.xml	18 Aug 2004 19:34:12 -0000	1.10
  @@ -98,14 +98,14 @@
   				<tr>
   					<td>occurs</td>
   					<td>
  -						<code>unbounded | 0..1 | 1 | 1..n</code>
  +						<code>unbounded | 0..1 | 1 | 1..n | none</code>
   					</td>
   					<td>no</td>
  -					<td>The number of contributions allowed: <ul> <li><strong>unbounded</strong>
  -						(default): any number</li> <li><strong>0..1</strong>: optional</li> 
  -						<li><strong>1</strong> : required</li> <li><strong>1..n</strong>: at
  -						least one</li> </ul> </td>
  -				</tr>
  +          <td>The number of contributions allowed: <ul> <li><strong>unbounded</strong> (default): any number</li> 
  +            <li><strong>0..1</strong>: optional</li> <li><strong>1</strong> : required</li> <li><strong>1..n</strong>: 
  +            at least one</li> <li><strong>none</strong>: none allowed</li> </ul> <note> <strong>none</strong> doesn't 
  +            make sense for occurances to a configuration point, but does occasionally make sense for parameters to a 
  +            factory. </note> </td>				</tr>
   				<tr>
   					<td>schema-id</td>
   					<td>string</td>
  @@ -500,6 +500,22 @@
   						the service being defined is a &api.ServiceImplementationFactory; or
   						a &api.ServiceInterceptorFactory;.</td>
   				</tr>
  +				<tr>
  +					<td>parameters-occurs</td>
  +					<td>
  +						<code>unbounded | 0..1 | 1 | 1..n | none</code>
  +					</td>
  +					<td>no</td>
  +					<td>The number of parameter element contributions allowed: <ul> <li><strong>unbounded</strong>: any number</li> 
  +            <li><strong>0..1</strong>: optional</li> 
  +						<li><strong>1</strong> (default) : required</li> <li><strong>1..n</strong>: at
  +						least one</li> 
  +            <li><strong>none</strong>: none allowed</li>
  +            </ul>
  +            
  +
  +            </td>
  +            </tr>
   			</table>
   			<p>Contains: &create-instance;, &interceptor;, &invoke-factory;
   				, &parameters-schema; </p>
  
  
  
  1.7       +18 -13    jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/PooledServiceModel.java
  
  Index: PooledServiceModel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/PooledServiceModel.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PooledServiceModel.java	19 Jun 2004 14:19:01 -0000	1.6
  +++ PooledServiceModel.java	18 Aug 2004 19:34:12 -0000	1.7
  @@ -61,16 +61,16 @@
   
       private class PooledService implements ThreadCleanupListener
       {
  -        private Object _service;
  +        private Object _core;
           private PoolManageable _managed;
   
           /**
            * @param service the full service implementation, including any interceptors
            * @param core the core service implementation, which may optionally implement {@link PoolManageable}
            */
  -        PooledService(Object service, Object core)
  +        PooledService(Object core)
           {
  -            _service = service;
  +            _core = core;
   
               if (core instanceof PoolManageable)
                   _managed = (PoolManageable) core;
  @@ -94,11 +94,11 @@
           }
   
           /**
  -         * Returns the configured, interceptor service implementation.
  +         * Returns the configured service implementation.
            */
           public Object getService()
           {
  -            return _service;
  +            return _core;
           }
   
       }
  @@ -128,18 +128,24 @@
           return _serviceProxy;
       }
   
  +	/**
  +	 * Constructs the service proxy and returns it, wrapped in any interceptors.
  +	 */
       private Object constructServiceProxy()
       {
           if (_log.isDebugEnabled())
               _log.debug(
                   "Creating PooledProxy for service " + getServicePoint().getExtensionPointId());
   
  -        return ProxyUtils.createDelegatingProxy(
  -            "PooledProxy",
  -            this,
  -            "getServiceImplementationForCurrentThread",
  -            getServicePoint(),
  -            getServicePoint().getShutdownCoordinator());
  +        Object proxy =
  +            ProxyUtils.createDelegatingProxy(
  +                "PooledProxy",
  +                this,
  +                "getServiceImplementationForCurrentThread",
  +                getServicePoint(),
  +                getServicePoint().getShutdownCoordinator());
  +
  +        return addInterceptors(proxy);
       }
   
       public Object getServiceImplementationForCurrentThread()
  @@ -192,9 +198,8 @@
           try
           {
               Object core = constructCoreServiceImplementation();
  -            Object intercepted = addInterceptors(core);
   
  -            return new PooledService(intercepted, core);
  +            return new PooledService(core);
           }
           catch (Exception ex)
           {
  
  
  
  1.7       +21 -15    jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/ThreadedServiceModel.java
  
  Index: ThreadedServiceModel.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/servicemodel/ThreadedServiceModel.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ThreadedServiceModel.java	19 Jun 2004 14:19:01 -0000	1.6
  +++ ThreadedServiceModel.java	18 Aug 2004 19:34:12 -0000	1.7
  @@ -52,14 +52,11 @@
   
       class CleanupListener implements ThreadCleanupListener
       {
  -        // The core, wrapped by any interceptors
  -        private Object _service;
           // The core itself
           private Object _core;
   
  -        CleanupListener(Object service, Object core)
  +        CleanupListener(Object core)
           {
  -            _service = service;
               _core = core;
           }
   
  @@ -106,11 +103,18 @@
               _serviceProxy = createServiceProxy();
           }
   
  +        // The result is an interceptor stack, where the final (most deeply nested) object
  +        // is the serviceProxy.  The serviceProxy obtains the instance for the current thread
  +        // and delegates to it.  This is a little bit different than SingletonServiceModel, which
  +        // creates a pair of proxies so as to defer creation of the interceptors as well. In both
  +        // cases, the interceptors are only created once.
  +
           return _serviceProxy;
       }
   
       /**
  -     * Creates a proxy class for the service and then constructs the class itself.
  +     * Creates a proxy instance for the service, and returns it, wrapped in any
  +     * interceptors for the service.
        */
       private Object createServiceProxy()
       {
  @@ -118,12 +122,15 @@
               _log.debug(
                   "Creating ThreadedProxy for service " + getServicePoint().getExtensionPointId());
   
  -        return ProxyUtils.createDelegatingProxy(
  -            "ThreadedProxy",
  -            this,
  -            "getServiceImplementationForCurrentThread",
  -            getServicePoint(),
  -            getServicePoint().getShutdownCoordinator());
  +        Object proxy =
  +            ProxyUtils.createDelegatingProxy(
  +                "ThreadedProxy",
  +                this,
  +                "getServiceImplementationForCurrentThread",
  +                getServicePoint(),
  +                getServicePoint().getShutdownCoordinator());
  +
  +        return addInterceptors(proxy);
       }
   
       /**
  @@ -146,16 +153,15 @@
           try
           {
               Object core = constructCoreServiceImplementation();
  -            Object result = addInterceptors(core);
   
               if (core instanceof RegistryShutdownListener)
                   _log.error(ServiceModelMessages.registryCleanupIgnored(getServicePoint()));
   
  -            _notifier.addThreadCleanupListener(new CleanupListener(result, core));
  +            _notifier.addThreadCleanupListener(new CleanupListener(core));
   
  -            _activeService.set(result);
  +            _activeService.set(core);
   
  -            return result;
  +            return core;
           }
           catch (Exception ex)
           {
  
  
  
  1.6       +5 -2      jakarta-hivemind/library/src/test/org/apache/hivemind/lib/pipeline/TestPipelineAssembler.java
  
  Index: TestPipelineAssembler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/test/org/apache/hivemind/lib/pipeline/TestPipelineAssembler.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestPipelineAssembler.java	3 Aug 2004 14:02:16 -0000	1.5
  +++ TestPipelineAssembler.java	18 Aug 2004 19:34:12 -0000	1.6
  @@ -19,6 +19,7 @@
   import java.util.List;
   
   import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.hivemind.ErrorHandler;
   import org.apache.hivemind.Registry;
   import org.apache.hivemind.impl.DefaultClassResolver;
  @@ -37,6 +38,8 @@
    */
   public class TestPipelineAssembler extends HiveMindTestCase
   {
  +    private static final Log LOG = LogFactory.getLog(TestPipelineAssembler.class);
  +
       private static class StandardInner implements StandardService
       {
           private String _desciption;
  @@ -293,7 +296,6 @@
           moduleControl.setReturnValue(new DefaultClassResolver());
   
           PipelineFactory factory = new PipelineFactory();
  -        factory.setServiceId("factory-id");
           factory.setClassFactory(cf);
           factory.setDefaultImplementationBuilder(dib);
           factory.setErrorHandler(getErrorHandler());
  @@ -318,6 +320,7 @@
               (StandardService) factory.createCoreServiceImplementation(
                   "example",
                   StandardService.class,
  +                LOG,
                   module,
                   Collections.singletonList(pp));
   
  @@ -344,7 +347,6 @@
           moduleControl.setReturnValue(new DefaultClassResolver());
   
           PipelineFactory factory = new PipelineFactory();
  -        factory.setServiceId("factory-id");
           factory.setClassFactory(cf);
           factory.setDefaultImplementationBuilder(dib);
           factory.setErrorHandler(getErrorHandler());
  @@ -373,6 +375,7 @@
               (StandardService) factory.createCoreServiceImplementation(
                   "example",
                   StandardService.class,
  +                LOG,
                   module,
                   Collections.singletonList(pp));
   
  
  
  
  1.5       +7 -0      jakarta-hivemind/framework/src/java/org/apache/hivemind/internal/ServicePoint.java
  
  Index: ServicePoint.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/internal/ServicePoint.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ServicePoint.java	25 Jul 2004 22:12:51 -0000	1.4
  +++ ServicePoint.java	18 Aug 2004 19:34:12 -0000	1.5
  @@ -15,6 +15,7 @@
   package org.apache.hivemind.internal;
   
   import org.apache.commons.logging.Log;
  +import org.apache.hivemind.Occurances;
   import org.apache.hivemind.schema.Schema;
   
   /**
  @@ -63,6 +64,12 @@
        **/
   
       public Schema getParametersSchema();
  +    
  +    /**
  +     * Returns the number of parameter object expected; generally this
  +     * is the default of exactly one ({@link Occurances#REQUIRED}).
  +     */
  +    public Occurances getParametersCount();
       
       /**
        * Forces the service to be fully instantiated immediately, rather than
  
  
  
  1.3       +8 -10     jakarta-hivemind/library/src/java/org/apache/hivemind/lib/pipeline/PipelineFactory.java
  
  Index: PipelineFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/pipeline/PipelineFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PipelineFactory.java	10 Jun 2004 19:49:40 -0000	1.2
  +++ PipelineFactory.java	18 Aug 2004 19:34:12 -0000	1.3
  @@ -17,7 +17,7 @@
   import java.util.Iterator;
   import java.util.List;
   
  -import org.apache.commons.logging.LogFactory;
  +import org.apache.commons.logging.Log;
   import org.apache.hivemind.ErrorHandler;
   import org.apache.hivemind.HiveMind;
   import org.apache.hivemind.ServiceImplementationFactory;
  @@ -26,9 +26,13 @@
   import org.apache.hivemind.lib.DefaultImplementationBuilder;
   import org.apache.hivemind.service.ClassFactory;
   
  +/**
  + * Service factory that builds a pipeline of objects.
  + *
  + * @author Howard Lewis Ship
  + */
   public class PipelineFactory extends BaseLocatable implements ServiceImplementationFactory
   {
  -    private String _serviceId;
       private ClassFactory _classFactory;
       private DefaultImplementationBuilder _defaultImplementationBuilder;
       private ErrorHandler _errorHandler;
  @@ -36,16 +40,15 @@
       public Object createCoreServiceImplementation(
           String serviceId,
           Class serviceInterface,
  +        Log serviceLog,
           Module invokingModule,
           List parameters)
       {
  -        HiveMind.checkFactoryParameterCount(_serviceId, parameters, 1);
  -
           PipelineParameters pp = (PipelineParameters) parameters.get(0);
   
           PipelineAssembler pa =
               new PipelineAssembler(
  -                LogFactory.getLog(serviceId),
  +                serviceLog,
                   _errorHandler,
                   serviceId,
                   serviceInterface,
  @@ -80,11 +83,6 @@
       public void setDefaultImplementationBuilder(DefaultImplementationBuilder builder)
       {
           _defaultImplementationBuilder = builder;
  -    }
  -
  -    public void setServiceId(String string)
  -    {
  -        _serviceId = string;
       }
   
       public void setErrorHandler(ErrorHandler handler)
  
  
  
  1.3       +2 -13     jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/BeanFactoryBuilder.java
  
  Index: BeanFactoryBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/BeanFactoryBuilder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BeanFactoryBuilder.java	17 Jun 2004 15:16:12 -0000	1.2
  +++ BeanFactoryBuilder.java	18 Aug 2004 19:34:12 -0000	1.3
  @@ -17,7 +17,6 @@
   import java.util.List;
   
   import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
   import org.apache.hivemind.ErrorHandler;
   import org.apache.hivemind.HiveMind;
   import org.apache.hivemind.ServiceImplementationFactory;
  @@ -32,23 +31,19 @@
    */
   public class BeanFactoryBuilder extends BaseLocatable implements ServiceImplementationFactory
   {
  -    private String _serviceId;
       private ErrorHandler _errorHandler;
   
       public Object createCoreServiceImplementation(
           String serviceId,
           Class serviceInterface,
  +        Log serviceLog,
           Module invokingModule,
           List parameters)
       {
  -        HiveMind.checkFactoryParameterCount(_serviceId, parameters, 1);
  -
           BeanFactoryParameter p = (BeanFactoryParameter) parameters.get(0);
   
  -        Log log = LogFactory.getLog(serviceId);
  -
           return new BeanFactoryImpl(
  -            log,
  +            serviceLog,
               _errorHandler,
               p.getVendClass(),
               p.getContributions(),
  @@ -59,10 +54,4 @@
       {
           _errorHandler = handler;
       }
  -
  -    public void setServiceId(String string)
  -    {
  -        _serviceId = string;
  -    }
  -
   }
  
  
  
  1.12      +5 -3      jakarta-hivemind/library/src/descriptor/META-INF/hivemodule.xml
  
  Index: hivemodule.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/descriptor/META-INF/hivemodule.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- hivemodule.xml	9 Aug 2004 14:53:47 -0000	1.11
  +++ hivemodule.xml	18 Aug 2004 19:34:12 -0000	1.12
  @@ -74,7 +74,7 @@
       </parameters-schema>
       
       <invoke-factory>
  -      <construct class="org.apache.hivemind.lib.impl.EJBProxyFactory" service-id-property="pointId">
  +      <construct class="org.apache.hivemind.lib.impl.EJBProxyFactory">
           <set-service property="nameLookup" service-id="NameLookup"/>
           <set-service property="classFactory" service-id="hivemind.ClassFactory"/>
           <set-service property="coordinator" service-id="RemoteExceptionCoordinator"/>
  @@ -104,7 +104,7 @@
       </parameters-schema>
       <invoke-factory>
         <construct
  -        class="org.apache.hivemind.lib.impl.SpringLookupFactory" service-id-property="pointId">
  +        class="org.apache.hivemind.lib.impl.SpringLookupFactory">
           <set-service property="defaultBeanFactorySource" service-id="DefaultSpringBeanFactoryHolder"/>
         </construct>
       </invoke-factory>
  @@ -174,7 +174,9 @@
       </invoke-factory>
     </service-point>
     
  -  <service-point id="PlaceholderFactory" interface="org.apache.hivemind.ServiceImplementationFactory">
  +  <service-point id="PlaceholderFactory" 
  +    interface="org.apache.hivemind.ServiceImplementationFactory" 
  +    parameters-occurs="none">
       
       A service implementation factory that builds a default implementation of a service. 
       The service implementation is a placeholder that does nothing.
  
  
  
  1.2       +4 -5      jakarta-hivemind/library/src/test/org/apache/hivemind/lib/impl/TestServicePropertyFactory.java
  
  Index: TestServicePropertyFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/test/org/apache/hivemind/lib/impl/TestServicePropertyFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestServicePropertyFactory.java	6 Aug 2004 17:03:31 -0000	1.1
  +++ TestServicePropertyFactory.java	18 Aug 2004 19:34:12 -0000	1.2
  @@ -37,7 +37,6 @@
       {
           ServicePropertyFactory result = new ServicePropertyFactory();
   
  -        result.setServiceId("test.factory");
           result.setClassFactory(new ClassFactoryImpl());
   
           return result;
  @@ -85,7 +84,7 @@
   
           replayControls();
   
  -        Wonk proxy = (Wonk) f.createCoreServiceImplementation("foo.bar", Wonk.class, m, parameters);
  +        Wonk proxy = (Wonk) f.createCoreServiceImplementation("foo.bar", Wonk.class, null, m, parameters);
   
           proxy.wonkVoid();
           assertEquals("stripes", proxy.wonkString("zebra"));
  @@ -107,7 +106,7 @@
   
           replayControls();
   
  -        Wonk proxy = (Wonk) f.createCoreServiceImplementation("foo.bar", Wonk.class, m, parameters);
  +        Wonk proxy = (Wonk) f.createCoreServiceImplementation("foo.bar", Wonk.class, null, m, parameters);
   
           try
           {
  @@ -130,7 +129,7 @@
   
           try
           {
  -            f.createCoreServiceImplementation("foo.bar", Wonk.class, null, parameters);
  +            f.createCoreServiceImplementation("foo.bar", Wonk.class, null, null, parameters);
               unreachable();
           }
           catch (ApplicationRuntimeException ex)
  @@ -148,7 +147,7 @@
   
           try
           {
  -            f.createCoreServiceImplementation("foo.bar", Wonk.class, null, parameters);
  +            f.createCoreServiceImplementation("foo.bar", Wonk.class, null, null, parameters);
               unreachable();
           }
           catch (ApplicationRuntimeException ex)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org


Mime
View raw message