hlship      2004/06/14 17:45:59

  Modified:    library/src/java/org/apache/hivemind/lib/factory
                        FactoryMessages.java
               library/src/descriptor/META-INF hivemodule.sdl
               src/documentation/content/xdocs site.xml
               .        status.xml
  Added:       library/src/test/org/apache/hivemind/lib/factory
                        NumberFactory.sdl TestBeanFactoryImpl.java
               library/src/java/org/apache/hivemind/lib BeanFactory.java
               library/src/java/org/apache/hivemind/lib/factory
                        BeanFactoryContribution.java
                        BeanFactoryParameter.java BeanFactoryBuilder.java
                        BeanFactoryImpl.java
               library/src/documentation/content/xdocs/hivemind-lib
                        BeanFactoryBuilder.xml
  Removed:     library/src/test/org/apache/hivemind/lib/factory
                        ObjectFactory.sdl TestObjectFactoryImpl.java
               library/src/java/org/apache/hivemind/lib ObjectFactory.java
               library/src/java/org/apache/hivemind/lib/factory
                        ObjectFactoryContribution.java
                        ObjectFactoryBuilder.java
                        ObjectFactoryBuilderParameter.java
                        ObjectFactoryImpl.java
               library/src/documentation/content/xdocs/hivemind-lib
                        ObjectFactoryBuilder.xml
  Log:
  Rename ObjectFactory to BeanFactory.
  
  Revision  Changes    Path
  1.1                  
jakarta-hivemind/library/src/test/org/apache/hivemind/lib/factory/NumberFactory.sdl
  
  Index: NumberFactory.sdl
  ===================================================================
  //  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.
  
  module (id=hivemind.lib.test version="1.0.0")
  {
    service-point (id=NumberFactory 
interface=org.apache.hivemind.lib.BeanFactory)
    {
      invoke-factory (service-id=hivemind.lib.BeanFactoryBuilder)
      {
        factory (vend-class=java.lang.Number configuration-id=NumberFactory)
      }
    }
    
    configuration-point (id=NumberFactory 
schema-id=hivemind.lib.BeanFactoryContribution)
    
    contribution (configuration-id=NumberFactory)
    {
      bean (name=double class=java.lang.Double)
      bean (name=int class=java.lang.Integer)
    }
  }
  
  
  1.1                  
jakarta-hivemind/library/src/test/org/apache/hivemind/lib/factory/TestBeanFactoryImpl.java
  
  Index: TestBeanFactoryImpl.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.lib.factory;
  
  import java.io.Serializable;
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.Collections;
  import java.util.LinkedList;
  import java.util.List;
  import java.util.Map;
  
  import org.apache.hivemind.ApplicationRuntimeException;
  import org.apache.hivemind.ErrorHandler;
  import org.apache.hivemind.internal.RegistryInfrastructure;
  import org.apache.hivemind.lib.BeanFactory;
  import org.apache.hivemind.test.HiveMindTestCase;
  import org.easymock.MockControl;
  
  /**
   * Tests for [EMAIL PROTECTED] 
org.apache.hivemind.lib.factory.BeanFactoryImpl}
   * and [EMAIL PROTECTED] org.apache.hivemind.lib.factory.BeanFactoryBuilder}.
   *
   * @author Howard Lewis Ship
   */
  public class TestBeanFactoryImpl extends HiveMindTestCase
  {
      private BeanFactoryContribution build(String name, Class objectClass)
      {
          return build(name, objectClass, null);
      }
  
      private BeanFactoryContribution build(String name, Class objectClass, 
Boolean cacheable)
      {
          BeanFactoryContribution result = new BeanFactoryContribution();
          result.setName(name);
          result.setBeanClass(objectClass);
          result.setCacheable(cacheable);
  
          return result;
      }
  
      private void executeNonClassContribution(String name, Class objectClass, 
String message)
      {
          List l = Collections.singletonList(build(name, objectClass));
  
          MockControl c = MockControl.createStrictControl(ErrorHandler.class);
          ErrorHandler eh = (ErrorHandler) c.getMock();
  
          eh.error(null, message, null, null);
  
          c.replay();
  
          BeanFactoryImpl f = new BeanFactoryImpl(null, eh, Object.class, l, 
true);
  
          try
          {
              f.get(name);
              unreachable();
          }
          catch (ApplicationRuntimeException ex)
          {
              assertEquals(FactoryMessages.unknownContribution(name), 
ex.getMessage());
          }
  
          c.verify();
      }
  
      public void testInterfaceContribution()
      {
          executeNonClassContribution(
              "serializable",
              Serializable.class,
              "Contribution 'serializable' is for java.io.Serializable which is 
inappropriate for an object factory. The contribution has been ignored.");
      }
  
      public void testArrayContribution()
      {
          executeNonClassContribution(
              "array",
              String[].class,
              "Contribution 'array' is for java.lang.String[] which is 
inappropriate for an object factory. The contribution has been ignored.");
      }
  
      public void testPrimitiveContribution()
      {
          executeNonClassContribution(
              "primitive",
              double.class,
              "Contribution 'primitive' is for double which is inappropriate 
for an object factory. The contribution has been ignored.");
      }
  
      public void testIncorrectType()
      {
          List l = Collections.singletonList(build("array-list", 
ArrayList.class));
  
          MockControl c = MockControl.createStrictControl(ErrorHandler.class);
          ErrorHandler eh = (ErrorHandler) c.getMock();
  
          eh.error(
              null,
              "Contribution 'array-list' (class java.util.ArrayList) is not 
assignable to interface java.util.Map and has been ignored.",
              null,
              null);
  
          c.replay();
  
          BeanFactoryImpl f = new BeanFactoryImpl(null, eh, Map.class, l, true);
  
          try
          {
              f.get("array-list");
              unreachable();
          }
          catch (ApplicationRuntimeException ex)
          {
              assertEquals(FactoryMessages.unknownContribution("array-list"), 
ex.getMessage());
          }
  
          c.verify();
      }
  
      public void testDupeName()
      {
          List l = new ArrayList();
          l.add(build("list", ArrayList.class));
          l.add(build("list", LinkedList.class));
  
          MockControl c = MockControl.createStrictControl(ErrorHandler.class);
          ErrorHandler eh = (ErrorHandler) c.getMock();
  
          eh.error(
              null,
              "Contribution 'list' duplicates a previous contribution (at 
unknown location) and has been ignored.",
              null,
              null);
  
          c.replay();
  
          BeanFactoryImpl f = new BeanFactoryImpl(null, eh, Collection.class, 
l, true);
  
          Object o = f.get("list");
  
          assertTrue(o instanceof ArrayList);
  
          c.verify();
      }
  
      public void testTranslator()
      {
          List l = Collections.singletonList(build("string", String.class));
  
          BeanFactoryImpl f = new BeanFactoryImpl(null, null, Object.class, l, 
true);
  
          String s = (String) f.get("string,locator");
  
          assertEquals("locator", s);
      }
  
      public void testPlain()
      {
          List l = Collections.singletonList(build("string", String.class));
  
          BeanFactoryImpl f = new BeanFactoryImpl(null, null, Object.class, l, 
true);
  
          String s1 = (String) f.get("string");
          String s2 = (String) f.get("string");
  
          assertSame(s1, s2);
      }
  
      public void testNonCache()
      {
          List l = Collections.singletonList(build("buffer", 
StringBuffer.class, Boolean.FALSE));
  
          BeanFactoryImpl f = new BeanFactoryImpl(null, null, Object.class, l, 
true);
  
          StringBuffer s1 = (StringBuffer) f.get("buffer");
          StringBuffer s2 = (StringBuffer) f.get("buffer");
  
          assertNotSame(s1, s2);
      }
  
      public void testConstructFailure()
      {
          List l = Collections.singletonList(build("integer", Integer.class));
  
          BeanFactoryImpl f = new BeanFactoryImpl(null, null, Number.class, l, 
true);
  
          try
          {
              f.get("integer");
              unreachable();
          }
          catch (ApplicationRuntimeException ex)
          {
              assertEquals(
                  "Unable to instantiate instance of class java.lang.Integer: 
java.lang.Integer",
                  ex.getMessage());
          }
  
      }
  
      public void testBuilder()
      {
          List l = Collections.singletonList(build("integer", Integer.class));
  
          BeanFactoryParameter p = new BeanFactoryParameter();
          p.setContributions(l);
  
          BeanFactoryBuilder b = new BeanFactoryBuilder();
  
          BeanFactory f =
              (BeanFactory) b.createCoreServiceImplementation(
                  "foo.bar",
                  BeanFactory.class,
                  null,
                  Collections.singletonList(p));
  
          Integer i = (Integer) f.get("integer,5");
  
          assertEquals(new Integer(5), i);
      }
  
      /**
       * Test integration; i.e., a service and configuration in a descriptor.
       */
      public void testIntegration() throws Exception
      {
          RegistryInfrastructure r = 
buildFrameworkRegistry("NumberFactory.sdl");
  
          BeanFactory f =
              (BeanFactory) r.getService("hivemind.lib.test.NumberFactory", 
BeanFactory.class);
  
          assertEquals(new Integer(27), f.get("int,27"));
          assertEquals(new Double(-22.5), f.get("double,-22.5"));
      }
  }
  
  
  
  1.1                  
jakarta-hivemind/library/src/java/org/apache/hivemind/lib/BeanFactory.java
  
  Index: BeanFactory.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.lib;
  
  /**
   * Service interface for a source of beans of a particular type.
   * Bean instances are retrieved using a <em>locator string</em> which is of 
the form:
   * <code><em>name</em>[,<em>initializer</em>]</code>.  That is, an optional 
initializer is
   * may be specified, separated by a comma.
   * 
   * <p>
   * Beans may be cached or not.
   * 
   * <p>
   * The <code>hivemind.lib.ObjectFactoryBuilder</code> service is used to 
create services
   * implementing this interface (driven from a configuration).
   *
   * @author Howard Lewis Ship
   */
  public interface BeanFactory
  {
      /**
       * Gets a bean via its locator (it's name plus, optionally, an 
initializer).
       * 
       * @param locator the name or name and initializer
       * @return a bean instance
       * @throws org.apache.hivemind.ApplicationRuntimeException if no bean 
matching the provided 
       * name has been defined.
       */
      public Object get(String locator);
  }
  
  
  
  1.2       +3 -3      
jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/FactoryMessages.java
  
  Index: FactoryMessages.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/FactoryMessages.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FactoryMessages.java      15 Jun 2004 00:33:59 -0000      1.1
  +++ FactoryMessages.java      15 Jun 2004 00:45:59 -0000      1.2
  @@ -26,7 +26,7 @@
       private static final MessageFormatter _formatter =
           new MessageFormatter(LOG, FactoryMessages.class, "FactoryStrings");
   
  -    public static String wrongContributionType(ObjectFactoryContribution c, 
Class vendType)
  +    public static String wrongContributionType(BeanFactoryContribution c, 
Class vendType)
       {
           return _formatter.format(
               "wrong-contribution-type",
  @@ -35,7 +35,7 @@
               vendType);
       }
   
  -    public static String invalidContributionClass(ObjectFactoryContribution 
c)
  +    public static String invalidContributionClass(BeanFactoryContribution c)
       {
           return _formatter.format(
               "invalid-contribution-class",
  @@ -43,7 +43,7 @@
               ClassFabUtils.getJavaClassName(c.getBeanClass()));
       }
   
  -    public static String dupeContribution(ObjectFactoryContribution existing)
  +    public static String dupeContribution(BeanFactoryContribution existing)
       {
           return _formatter.format(
               "dupe-contribution",
  
  
  
  1.1                  
jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/BeanFactoryContribution.java
  
  Index: BeanFactoryContribution.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.lib.factory;
  
  import org.apache.hivemind.impl.BaseLocatable;
  
  /**
   * A contribution used with an [EMAIL PROTECTED] 
org.apache.hivemind.lib.ObjectFactory}
   * to define one class of objects that may be returned from the factory.
   *
   * @author Howard Lewis Ship
   */
  public class BeanFactoryContribution extends BaseLocatable
  {
      private String _name;
      private Class _beanClass;
      
      // Stored as a boolean, so that null means 'as defined by the factory'
      private Boolean _cacheable;
  
      public Boolean getCacheable()
      {
          return _cacheable;
      }
  
      public String getName()
      {
          return _name;
      }
  
      public Class getBeanClass()
      {
          return _beanClass;
      }
  
      public void setCacheable(Boolean cacheable)
      {
          _cacheable = cacheable;
      }
  
      public void setName(String string)
      {
          _name = string;
      }
  
      public void setBeanClass(Class objectClass)
      {
          _beanClass = objectClass;
      }
  
      public boolean getStoreResultInCache(boolean defaultCacheable)
      {
          return _cacheable == null ? defaultCacheable : 
_cacheable.booleanValue();
      }
  }
  
  
  
  1.1                  
jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/BeanFactoryParameter.java
  
  Index: BeanFactoryParameter.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.lib.factory;
  
  import java.util.List;
  
  /**
   * Parameter object passed to [EMAIL PROTECTED] 
javax.naming.spi.ObjectFactoryBuilder}.
   *
   * @author Howard Lewis Ship
   */
  public class BeanFactoryParameter
  {
      private Class _vendClass = Object.class;
      private boolean _defaultCacheable = true;
      private List _contributions;
  
      /**
       * The contributions to the list (assigned from the companion
       * configuration point).
       */
      public List getContributions()
      {
          return _contributions;
      }
  
      /**
       * Default value for cacheable in contributions that do not explicitly
       * set a value.  Default is <code>true</code>.
       */
  
      public boolean getDefaultCacheable()
      {
          return _defaultCacheable;
      }
  
      /**
       * The class or interface to be vended by the factory (all contributed
       * classes must be assigneble). Defaults to <code>Object</code>. 
       */
      public Class getVendClass()
      {
          return _vendClass;
      }
  
      public void setContributions(List list)
      {
          _contributions = list;
      }
  
      public void setDefaultCacheable(boolean b)
      {
          _defaultCacheable = b;
      }
  
      public void setVendClass(Class class1)
      {
          _vendClass = class1;
      }
  
  }
  
  
  
  1.1                  
jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/BeanFactoryBuilder.java
  
  Index: BeanFactoryBuilder.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.lib.factory;
  
  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;
  import org.apache.hivemind.impl.BaseLocatable;
  import org.apache.hivemind.internal.Module;
  
  /**
   * Service implementation factory that builds [EMAIL PROTECTED] 
org.apache.hivemind.lib.ObjectFactory}
   * instances.
   *
   * @author Howard Lewis Ship
   */
  public class BeanFactoryBuilder extends BaseLocatable implements 
ServiceImplementationFactory
  {
      private String _serviceId;
      private ErrorHandler _errorHandler;
  
      public Object createCoreServiceImplementation(
          String serviceId,
          Class serviceInterface,
          Module invokingModule,
          List parameters)
      {
          HiveMind.checkFactoryParameterCount(_serviceId, parameters, 1);
  
          BeanFactoryParameter p = (BeanFactoryParameter) parameters.get(0);
  
          Log log = LogFactory.getLog(serviceId);
  
          return new BeanFactoryImpl(
              log,
              _errorHandler,
              p.getVendClass(),
              p.getContributions(),
              p.getDefaultCacheable());
      }
  
      public void setErrorHandler(ErrorHandler handler)
      {
          _errorHandler = handler;
      }
  
      public void setServiceId(String string)
      {
          _serviceId = string;
      }
  
  }
  
  
  
  1.1                  
jakarta-hivemind/library/src/java/org/apache/hivemind/lib/factory/BeanFactoryImpl.java
  
  Index: BeanFactoryImpl.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.lib.factory;
  
  import java.lang.reflect.Constructor;
  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.hivemind.ApplicationRuntimeException;
  import org.apache.hivemind.ErrorHandler;
  import org.apache.hivemind.HiveMind;
  import org.apache.hivemind.impl.BaseLocatable;
  import org.apache.hivemind.lib.BeanFactory;
  
  /**
   * Implementation of [EMAIL PROTECTED] org.apache.hivemind.lib.ObjectFactory}.
   *
   * @author Howard Lewis Ship
   */
  public class BeanFactoryImpl extends BaseLocatable implements BeanFactory
  {
      private Log _log;
      private ErrorHandler _errorHandler;
      private Class _vendType;
      private Map _contributions = new HashMap();
      private Map _cache = new HashMap();
      private boolean _defaultCacheable;
  
      public BeanFactoryImpl(
          Log log,
          ErrorHandler errorHandler,
          Class vendType,
          List contributions,
          boolean defaultCacheable)
      {
          _log = log;
          _errorHandler = errorHandler;
          _vendType = vendType;
          _defaultCacheable = defaultCacheable;
  
          processContributions(contributions);
      }
  
      private void processContributions(List list)
      {
          Iterator i = list.iterator();
  
          while (i.hasNext())
          {
              BeanFactoryContribution c = (BeanFactoryContribution) i.next();
  
              Class beanClass = c.getBeanClass();
  
              if (beanClass.isInterface() || beanClass.isArray() || 
beanClass.isPrimitive())
              {
                  _errorHandler.error(
                      _log,
                      FactoryMessages.invalidContributionClass(c),
                      c.getLocation(),
                      null);
                  continue;
              }
  
              if (!_vendType.isAssignableFrom(beanClass))
              {
                  _errorHandler.error(
                      _log,
                      FactoryMessages.wrongContributionType(c, _vendType),
                      c.getLocation(),
                      null);
                  continue;
              }
  
              String name = c.getName();
  
              BeanFactoryContribution existing =
                  (BeanFactoryContribution) _contributions.get(name);
  
              if (existing != null)
              {
                  _errorHandler.error(
                      _log,
                      FactoryMessages.dupeContribution(existing),
                      existing.getLocation(),
                      null);
                  continue;
              }
  
              // Passed the checks, good to go.
  
              _contributions.put(name, c);
          }
      }
  
      public synchronized Object get(String locator)
      {
          Object result = _cache.get(locator);
  
          if (result == null)
              result = create(locator);
  
          return result;
      }
  
      // Implicitly synchronized by get()
  
      private Object create(String locator)
      {
          int commax = locator.indexOf(',');
  
          String name = commax < 0 ? locator.trim() : locator.substring(0, 
commax);
          String initializer = commax < 0 ? null : locator.substring(commax + 
1).trim();
  
          BeanFactoryContribution c = (BeanFactoryContribution) 
_contributions.get(name);
  
          if (c == null)
              throw new 
ApplicationRuntimeException(FactoryMessages.unknownContribution(name));
  
          Object result = construct(c, initializer);
  
          if (c.getStoreResultInCache(_defaultCacheable))
              _cache.put(locator, result);
  
          return result;
      }
  
      private Object construct(BeanFactoryContribution contribution, String 
initializer)
      {
          Class beanClass = contribution.getBeanClass();
  
          try
          {
              if (HiveMind.isBlank(initializer))
                  return beanClass.newInstance();
  
              Constructor c = beanClass.getConstructor(new Class[] { 
String.class });
  
              return c.newInstance(new Object[] { initializer });
          }
          catch (Exception ex)
          {
              throw new ApplicationRuntimeException(
                  FactoryMessages.unableToInstantiate(beanClass, ex),
                  contribution.getLocation(),
                  ex);
  
          }
      }
  
  }
  
  
  
  1.10      +9 -9      
jakarta-hivemind/library/src/descriptor/META-INF/hivemodule.sdl
  
  Index: hivemodule.sdl
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/library/src/descriptor/META-INF/hivemodule.sdl,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- hivemodule.sdl    15 Jun 2004 00:33:59 -0000      1.9
  +++ hivemodule.sdl    15 Jun 2004 00:45:59 -0000      1.10
  @@ -167,12 +167,12 @@
          create-instance 
(class=org.apache.hivemind.lib.impl.SpringBeanFactoryHolderImpl)
        }
        
  -     schema (id=ObjectFactoryContribution)
  +     schema (id=BeanFactoryContribution)
        {
          description
          {
  -         "Schema used with the hivemind.lib.ObjectFactoryBuilder service, to 
define configuration that accepts "
  -         "definitions of classes that may be vended by the generated 
ObjectFactory."
  +         "Schema used with the hivemind.lib.BeanFactoryBuilder service, to 
define configuration that accepts "
  +         "definitions of classes that may be vended by the generated 
BeanFactory."
          }
          
          element (name=bean)
  @@ -198,19 +198,19 @@
              description { "Defines whether instances of the bean may be 
cached; the default is specified by the factory." }
            }
            
  -         conversion 
(class=org.apache.hivemind.lib.factory.ObjectFactoryContribution)
  +         conversion 
(class=org.apache.hivemind.lib.factory.BeanFactoryContribution)
            {
              map (attribute=class property=beanClass)
            }
          }
        }
        
  -     service-point (id=ObjectFactoryBuilder 
interface=org.apache.hivemind.ServiceImplementationFactory)
  +     service-point (id=BeanFactoryBuilder 
interface=org.apache.hivemind.ServiceImplementationFactory)
        {
          description
          {
            "A service which builds Object Factories.  Factories are driven by 
a configuration that conforms to the "
  -         "hivemind.lib.ObjectFactoryContribution schema."
  +         "hivemind.lib.BeanFactoryContribution schema."
          }
          
          parameters-schema
  @@ -239,11 +239,11 @@
                description
                {
                  "The configuration containing the contributions that define 
what classes are actually vended. The configuration must use the "
  -               "hivemind.lib.ObjectFactoryContribution schema."
  +               "hivemind.lib.BeanFactoryContribution schema."
                }
              }
              
  -           conversion 
(class=org.apache.hivemind.lib.factory.ObjectFactoryBuilderParameter)
  +           conversion 
(class=org.apache.hivemind.lib.factory.BeanFactoryParameter)
              {
                 map (attribute=configuration-id property=contributions)
              }
  @@ -252,7 +252,7 @@
          
          invoke-factory (service-id=hivemind.BuilderFactory)
          {
  -         construct 
(class=org.apache.hivemind.lib.factory.ObjectFactoryBuilder 
service-id-property=serviceId error-handler-property=errorHandler)
  +         construct (class=org.apache.hivemind.lib.factory.BeanFactoryBuilder 
service-id-property=serviceId error-handler-property=errorHandler)
          }
        }
        
  
  
  
  1.1                  
jakarta-hivemind/library/src/documentation/content/xdocs/hivemind-lib/BeanFactoryBuilder.xml
  
  Index: BeanFactoryBuilder.xml
  ===================================================================
  <?xml version="1.0"?>
  <!-- 
     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.
  -->
  <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.2//EN" 
    "./dtd/document-v12.dtd" [
    <!ENTITY projectroot '../'>
    <!ENTITY % common-links SYSTEM "../links.ent">
    %common-links;
    ]>
  <document>
    <header>
      <title>hivemind.lib.BeanFactoryBuilder Service</title>
    </header>
    <body>
      <p>The <link 
        href="&hivedoc;/service/hivemind.lib.BeanFactoryBuilder.html"> 
        BeanFactoryBuilder</link> services is used to construct an <link 
        href="&apiroot-lib;/BeanFactory.html">BeanFactory</link> instance. An 
        BeanFactory will <em>vend out</em> instances of classes. A logical name 
        is mapped to a particular Java class to be instantiated. </p>
      <p> Client code can retrieve beans via the factory's <code>get()</code> 
        method. Beans may be retrieved simply by name, or the name and an 
        initializer may be specified, seperated by commas. The initializer is 
        provided to the bean via an alternate constructor that takes a single 
        string parameter. Initializers are used, typically, to initialize 
        properties of the bean, but the actual implementation is internal to 
the 
        bean class. </p>
      <section>
        <title>Usage</title>
        <p> The general usage is as follows: </p>
        <source><![CDATA[
  invoke-factory (service-id=hivemind.lib.BeanFactoryBuilder)
  {
    factory (vend-class=... configuration-id=... default-cacheable=...)
  }
  ]]></source>
        <p> The <code>vend-class</code> attribute is the name of a class all 
          vended objects must be assignable to (as a class or interface). This 
is 
          used to validate contributed bean definitions. By default it is 
          <code>java.lang.Object</code>.</p>
        <p>The <code>configuration-id</code> is the id of the companion 
          configuration (used to define object classes).</p>
        <p>The optional <code>default-cacheable</code> attribute sets the 
default 
          for whether instantiated beans should be cached for reuse. By default 
          this is true, which is appropriate for most use cases where the 
vended 
          objects are immutable.</p>
      </section>
      <section>
        <title>Configuration</title>
        <p>Each BeanFactory service must have a configuration, into which beans 
          are contributed:</p>
        <source><![CDATA[
  configuration-point (id=... schema-id=hivemind.lib.BeanFactoryContribution)]]>
           </source>
        <p>Contributions into the configuration are used to specify the bean 
          classes to instantiate, as:</p>
        <source><![CDATA[
  bean (name=... class=... cacheable=...) 
  ]]> </source>
        <p> <code>name</code> is a unique name used to reference an instance of 
          the class. </p>
        <p><code>class</code> is the Java class to instantiate.</p>
        <p><code>cacheable</code> determines whether instances of the class are 
          cacheable (that is, have immutable internal state and should be 
          reused), or non-cacheable (presumably, because of mutable internal 
          state).</p>
      </section>
    </body>
  </document>
  
  
  1.16      +1 -1      jakarta-hivemind/src/documentation/content/xdocs/site.xml
  
  Index: site.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-hivemind/src/documentation/content/xdocs/site.xml,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- site.xml  15 Jun 2004 00:33:59 -0000      1.15
  +++ site.xml  15 Jun 2004 00:45:59 -0000      1.16
  @@ -105,10 +105,10 @@
                <index href="index.html"/>
                
                <services label="Services">
  +      <hivemind.lib.BeanFactoryBuilder label="BeanFactoryBuilder" 
href="BeanFactoryBuilder.html"/>
         <hivemind.lib.DefaultImplementationBuilder 
label="DefaultImplementationBuilder" href="DefaultImplementationBuilder.html"/>
                        <hivemind.lib.EJBProxyFactory label="EJBProxyFactory" 
href="EJBProxyFactory.html"/>
                        <hivemind.lib.NameLookup label="NameLookup" 
href="NameLookup.html"/>
  -      <hivemind.lib.ObjectFactoryBuilder label="ObjectFactoryBuilder" 
href="ObjectFactoryBuilder.html"/>
         <hivemind.lib.PlaceholderFactory label="PlaceholderFactory" 
href="PlaceholderFactory.html"/> 
         <hivemind.lib.PipelineFactory label="PipelineFactory" 
href="PipelineFactory.html"/>     
                        <hivemind.lib.RemoteExceptionCoordinator 
label="RemoteExceptionCoordinator" href="RemoteExceptionCoordinator.html"/>
  
  
  
  1.7       +1 -1      jakarta-hivemind/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/status.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- status.xml        15 Jun 2004 00:33:59 -0000      1.6
  +++ status.xml        15 Jun 2004 00:45:59 -0000      1.7
  @@ -54,7 +54,7 @@
           Enhance logging of exceptions when setting a service property to a 
contribution
         </action>
         <action type="add" dev="HLS">
  -        Added service <link 
href="site:hivemind.lib.ObjectFactoryBuilder">hivemind.lib.ObjectFactoryBuilder</link>.
     
  +        Added service <link 
href="site:hivemind.lib.BeanFactoryBuilder">hivemind.lib.BeanFactoryBuilder</link>.
     
         </action>
       </release>
        </changes>
  
  
  

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

Reply via email to