commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-commons-sandbox/hivemind/src/test/hivemind/test/services/impl BuilderAccessImpl.java
Date Thu, 07 Aug 2003 15:51:43 GMT
hlship      2003/08/07 08:51:43

  Modified:    hivemind/src/java/org/apache/commons/hivemind
                        HiveMindMessages.properties HiveMind.java
               hivemind/src/java/org/apache/commons/hivemind/service/impl
                        BuilderParameter.java EJBProxyFactory.java
                        BuilderFactory.java
               hivemind/src/test/hivemind/test/services TestServices.java
               hivemind/src/java/org/apache/commons/hivemind/schema/rules
                        RuleUtils.java
               hivemind/src/META-INF hivemodule.xml
  Added:       hivemind/src/test/hivemind/test/services
                        BuilderAccessFailure.xml BuilderAccess.xml
                        BuilderAccess.properties BuilderAccess.java
               hivemind/src/test/hivemind/test/services/impl
                        BuilderAccessImpl.java
  Log:
  Make use of PropertyUtils, not BeanUtils for setting properties.
  Extend BuilderFactory to help eliminate the need for using the Initializable interface.
  
  Revision  Changes    Path
  1.20      +2 -9      jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/HiveMindMessages.properties
  
  Index: HiveMindMessages.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/HiveMindMessages.properties,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- HiveMindMessages.properties	5 Aug 2003 15:41:44 -0000	1.19
  +++ HiveMindMessages.properties	7 Aug 2003 15:51:43 -0000	1.20
  @@ -5,6 +5,7 @@
   no-such-service-extension-id=Service extension point {0} does not exist.
   no-such-extension-id=Extension point {0} does not exist.
   no-such-service=Service {0} (implementing interface {1}) does not exist.
  +unable-to-set-property=Unable to set property {0} of {1} to {2}: {3}
   
   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}}.
   
  @@ -89,15 +90,7 @@
   
   # parse package
   
  -InstanceBuilderDescriptor.unable-to-set-property=Unable to set property {0} of {1} to {2}:
{3}
  -
  -ExpressionDescriptor.unable-to-evaluate=Unable to evaluate expression ''{0}'' for {1}:
{2}
  -
   InvokeFactoryDescriptor.factory-is-null=Factory service {0} is null.
  -
  -XMLDescriptor.unable-to-parse=Unable to parse {0} (referenced at {1}): {2}
  -
  -ResourceDescriptor.missing-resource=Resource {0} relative to module {1} ({2}) not found.
   
   # schema.rules package
   
  
  
  
  1.14      +12 -3     jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/HiveMind.java
  
  Index: HiveMind.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/HiveMind.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- HiveMind.java	5 Aug 2003 00:50:36 -0000	1.13
  +++ HiveMind.java	7 Aug 2003 15:51:43 -0000	1.14
  @@ -214,8 +214,17 @@
   
       }
   
  +	/**
  +	 * 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(
  -        ServiceExtensionPoint point,
  +        String extensionPointId,
           List parameters,
           int expectedCount)
       {
  @@ -223,7 +232,7 @@
               throw new ApplicationRuntimeException(
                   HiveMind.format(
                       "wrong-factory-parameter-count",
  -                    point.getExtensionPointId(),
  +                    extensionPointId,
                       new Integer(expectedCount),
                       new Integer(parameters.size())));
       }
  
  
  
  1.2       +49 -1     jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/BuilderParameter.java
  
  Index: BuilderParameter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/BuilderParameter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BuilderParameter.java	30 Jul 2003 22:34:53 -0000	1.1
  +++ BuilderParameter.java	7 Aug 2003 15:51:43 -0000	1.2
  @@ -62,6 +62,7 @@
   
   /**
    * Parameter object used with {@link org.apache.commons.hivemind.service.impl.BuilderFactory}.
  + * 
    *
    * @author Howard Lewis Ship
    * @version $Id$
  @@ -70,6 +71,9 @@
   {
   	private String _className;
   	private List _properties = new ArrayList();
  +	private String _messagesPropertyName;
  +	private String _extensionPointIdPropertyName;
  +	private String _logPropertyName;	
   	
   	public void addProperty(SetPropertyValue property)
   	{
  @@ -89,6 +93,50 @@
       public void setClassName(String string)
       {
           _className = string;
  +    }
  +
  +    public String getExtensionPointIdPropertyName()
  +    {
  +        return _extensionPointIdPropertyName;
  +    }
  +
  +    public String getLogPropertyName()
  +    {
  +        return _logPropertyName;
  +    }
  +
  +    public String getMessagesPropertyName()
  +    {
  +        return _messagesPropertyName;
  +    }
  +
  +	/**
  +	 * Sets the name of a property to which the services' extension point id
  +	 * will be set.  
  +	 */
  +    public void setExtensionPointIdPropertyName(String string)
  +    {
  +        _extensionPointIdPropertyName = string;
  +    }
  +
  +	/**
  +	 * Sets the name of a property to which a
  +	 * {@link org.apache.commons.logging.Log} instance will be set.
  +	 * The <code>Log</code> is constructed from the extension point id.
  +	 */
  +    public void setLogPropertyName(String string)
  +    {
  +        _logPropertyName = string;
  +    }
  +
  +	/**
  +	 * Sets the name of a property to which  the module's
  +	 * {@link org.apache.tapestry.IMessages messages} instance
  +	 * will be assigned.
  +	 */
  +    public void setMessagesPropertyName(String string)
  +    {
  +        _messagesPropertyName = string;
       }
   
   }
  
  
  
  1.6       +2 -2      jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/EJBProxyFactory.java
  
  Index: EJBProxyFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/EJBProxyFactory.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EJBProxyFactory.java	30 Jul 2003 22:34:53 -0000	1.5
  +++ EJBProxyFactory.java	7 Aug 2003 15:51:43 -0000	1.6
  @@ -99,7 +99,7 @@
           Module invokingModule,
           List parameters)
       {
  -        HiveMind.checkFactoryParameterCount(_point, parameters, 1);
  +        HiveMind.checkFactoryParameterCount(_point.getExtensionPointId(), parameters, 1);
   
           EJBProxyParameters proxyParameters = (EJBProxyParameters) parameters.get(0);
           String jndiName = proxyParameters.getJndiName();
  
  
  
  1.2       +62 -14    jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/BuilderFactory.java
  
  Index: BuilderFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/service/impl/BuilderFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BuilderFactory.java	30 Jul 2003 22:34:53 -0000	1.1
  +++ BuilderFactory.java	7 Aug 2003 15:51:43 -0000	1.2
  @@ -59,24 +59,42 @@
   
   import java.util.List;
   
  -import org.apache.commons.beanutils.BeanUtils;
  +import org.apache.commons.beanutils.PropertyUtils;
   import org.apache.commons.hivemind.HiveMind;
   import org.apache.commons.hivemind.Initializable;
   import org.apache.commons.hivemind.Module;
   import org.apache.commons.hivemind.ServiceExtensionPoint;
   import org.apache.commons.hivemind.ServiceImplementationFactory;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.tapestry.ApplicationRuntimeException;
   import org.apache.tapestry.IResourceResolver;
   
   /**
    * Implementation of {@link org.apache.commons.hivemind.ServiceImplementationFactory}
    * that can instantiate an object and then configure its properties.
  + * 
  + * <p>
  + * This service exists to allow the a service to be configured fully
  + * without the service having to implement {@link org.apache.commons.hivemind.Initializable},
  + * which allows for a more IoC (Inversion of Control) feel.  A service 
  + * implements <code>Initializable</code> typically to access
  + * its module's messages, or its own extension point id, but BuilderFactory
  + * is capable of providing the service with that information by setting properties.
  + * 
  + * <p>
  + * Some thought has been given to using bytecode generation to create properties
  + * for messages, extension point id, and so forth.  This is being avoided because it
  + * undermines the ability to test service implemenations as POJOs, outside the
  + * framework of HiveMind.  Implementing <code>Initializiable</code> also makes
  + * it difficult to test service implementations properly.
    *
    * @author Howard Lewis Ship
    * @version $Id$
    */
   public class BuilderFactory implements ServiceImplementationFactory, Initializable
   {
  +    private static final Log LOG = LogFactory.getLog(BuilderFactory.class);
       /**
        * SEP for BuilderFactory.
        */
  @@ -87,7 +105,7 @@
           Module invokingModule,
           List parameters)
       {
  -        HiveMind.checkFactoryParameterCount(_point, parameters, 1);
  +        HiveMind.checkFactoryParameterCount(_point.getExtensionPointId(), parameters, 1);
   
           BuilderParameter parameter = (BuilderParameter) parameters.get(0);
   
  @@ -99,17 +117,6 @@
               Class serviceClass = resolver.findClass(parameter.getClassName());
   
               result = serviceClass.newInstance();
  -
  -            List properties = parameter.getProperties();
  -            int count = properties.size();
  -
  -            for (int i = 0; i < count; i++)
  -            {
  -                SetPropertyValue property = (SetPropertyValue) properties.get(i);
  -
  -                BeanUtils.setProperty(result, property.getPropertyName(), property.getValue());
  -            }
  -
           }
           catch (Exception ex)
           {
  @@ -122,7 +129,48 @@
                   ex);
           }
   
  +        String name = parameter.getExtensionPointIdPropertyName();
  +
  +        if (name != null)
  +            set(result, name, point.getExtensionPointId());
  +
  +        name = parameter.getLogPropertyName();
  +
  +        if (name != null)
  +            set(result, name, LogFactory.getLog(point.getExtensionPointId()));
  +
  +        name = parameter.getMessagesPropertyName();
  +
  +        if (name != null)
  +            set(result, name, invokingModule.getMessages());
  +
  +        List properties = parameter.getProperties();
  +        int count = properties.size();
  +
  +        for (int i = 0; i < count; i++)
  +        {
  +            SetPropertyValue property = (SetPropertyValue) properties.get(i);
  +
  +            set(result, property.getPropertyName(), property.getValue());
  +        }
  +
           return result;
  +    }
  +
  +    private void set(Object serviceImplementation, String propertyName, Object value)
  +    {
  +        try
  +        {
  +            PropertyUtils.setProperty(serviceImplementation, propertyName, value);
  +        }
  +        catch (Exception ex)
  +        {
  +            LOG.error(
  +                HiveMind.format(
  +                    "unable-to-set-property",
  +                    new Object[] { propertyName, serviceImplementation, value, ex.getMessage()}),
  +                ex);
  +        }
       }
   
       public void initializeService(ServiceExtensionPoint point, Object service)
  
  
  
  1.17      +40 -1     jakarta-commons-sandbox/hivemind/src/test/hivemind/test/services/TestServices.java
  
  Index: TestServices.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/test/hivemind/test/services/TestServices.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- TestServices.java	6 Aug 2003 18:50:50 -0000	1.16
  +++ TestServices.java	7 Aug 2003 15:51:43 -0000	1.17
  @@ -69,6 +69,7 @@
   
   import org.apache.commons.hivemind.Registry;
   import org.apache.commons.hivemind.service.NameLookup;
  +import org.apache.commons.hivemind.service.impl.BuilderFactory;
   import org.apache.tapestry.ApplicationRuntimeException;
   
   /**
  @@ -376,5 +377,43 @@
               "END toString\\(\\) \\[ToStringImpl of toString\\(\\)\\]",
               events);
   
  +    }
  +
  +    public void testBuilderAccess() throws Exception
  +    {
  +        Registry r = buildRegistry("BuilderAccess.xml");
  +
  +        BuilderAccess s =
  +            (BuilderAccess) r.getService(
  +                "hivemind.test.services.BuilderAccess",
  +                BuilderAccess.class);
  +
  +        assertEquals("A successful test of BuilderFactory.", s.getLocalizedMessage("success"));
  +
  +        assertEquals("hivemind.test.services.BuilderAccess", s.getExtensionPointId());
  +
  +        interceptLogging("hivemind");
  +
  +        s.logMessage("This is a test.");
  +
  +        checkLoggingEvent("hivemind.test.services.BuilderAccess", "This is a test\\.");
  +    }
  +
  +    public void testBuilderAccessFailure() throws Exception
  +    {
  +        Registry r = buildRegistry("BuilderAccessFailure.xml");
  +
  +        interceptLogging();
  +
  +        BuilderAccess s =
  +            (BuilderAccess) r.getService(
  +                "hivemind.test.services.BuilderAccessFailure",
  +                BuilderAccess.class);
  +
  +        assertNotNull(s);
  +
  +        checkLoggingEvent(
  +            BuilderFactory.class.getName(),
  +            "Unable to set property EVIL of hivemind\\.test\\.services\\.impl\\.BuilderAccessImpl@.*:
Unknown property 'EVIL'");
       }
   }
  
  
  
  1.1                  jakarta-commons-sandbox/hivemind/src/test/hivemind/test/services/BuilderAccessFailure.xml
  
  Index: BuilderAccessFailure.xml
  ===================================================================
  <?xml version="1.0"?>
  <!-- $Id: BuilderAccessFailure.xml,v 1.1 2003/08/07 15:51:43 hlship Exp $ -->
  <module id="hivemind.test.services" version="1.0.0">
  
    <service id="BuilderAccessFailure" interface="hivemind.test.services.BuilderAccess">
    	<invoke-factory service-id="hivemind.BuilderFactory">
    		<construct class="hivemind.test.services.impl.BuilderAccessImpl"
    			log-property="log"
    			messages-property="messages"
    			point-id-property="EVIL"/>	
    	</invoke-factory>	
    </service>
  
  </module>
  
  
  1.1                  jakarta-commons-sandbox/hivemind/src/test/hivemind/test/services/BuilderAccess.xml
  
  Index: BuilderAccess.xml
  ===================================================================
  <?xml version="1.0"?>
  <!-- $Id: BuilderAccess.xml,v 1.1 2003/08/07 15:51:43 hlship Exp $ -->
  <module id="hivemind.test.services" version="1.0.0">
  
    <service id="BuilderAccess" interface="hivemind.test.services.BuilderAccess">
    	<invoke-factory service-id="hivemind.BuilderFactory">
    		<construct class="hivemind.test.services.impl.BuilderAccessImpl"
    			log-property="log"
    			messages-property="messages"
    			point-id-property="extensionPointId"/>	
    	</invoke-factory>	
    </service>
  
  </module>
  
  
  1.1                  jakarta-commons-sandbox/hivemind/src/test/hivemind/test/services/BuilderAccess.properties
  
  Index: BuilderAccess.properties
  ===================================================================
  # $Id: BuilderAccess.properties,v 1.1 2003/08/07 15:51:43 hlship Exp $
  
  success=A successful test of BuilderFactory.
  
  
  
  1.1                  jakarta-commons-sandbox/hivemind/src/test/hivemind/test/services/BuilderAccess.java
  
  Index: BuilderAccess.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package hivemind.test.services;
  
  
  /**
   * Used to test {@link org.apache.commons.hivemind.service.impl.BuilderFactory}.
   *
   * @author Howard Lewis Ship
   * @version $Id: BuilderAccess.java,v 1.1 2003/08/07 15:51:43 hlship Exp $
   */
  public interface BuilderAccess
  {
  	/**
  	 * Logs a message at INFO. 
  	 */
  	public void logMessage(String message);
  	
  	/**
  	 * Gets a localized message.
  	 */
  	public String getLocalizedMessage(String key);
  	
  	/**
  	 * Gets the extension point id for the service.
  	 */
  	public String getExtensionPointId();
  }
  
  
  
  1.2       +3 -3      jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/schema/rules/RuleUtils.java
  
  Index: RuleUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/java/org/apache/commons/hivemind/schema/rules/RuleUtils.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RuleUtils.java	4 Aug 2003 14:21:56 -0000	1.1
  +++ RuleUtils.java	7 Aug 2003 15:51:43 -0000	1.2
  @@ -61,7 +61,7 @@
   import java.util.HashMap;
   import java.util.Map;
   
  -import org.apache.commons.beanutils.BeanUtils;
  +import org.apache.commons.beanutils.PropertyUtils;
   import org.apache.commons.hivemind.Element;
   import org.apache.commons.hivemind.HiveMind;
   import org.apache.commons.hivemind.Registry;
  @@ -170,7 +170,7 @@
       {
           try
           {
  -            BeanUtils.setProperty(target, propertyName, value);
  +            PropertyUtils.setProperty(target, propertyName, value);
           }
           catch (Exception ex)
           {
  
  
  
  1.13      +27 -2     jakarta-commons-sandbox/hivemind/src/META-INF/hivemodule.xml
  
  Index: hivemodule.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/hivemind/src/META-INF/hivemodule.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- hivemodule.xml	6 Aug 2003 18:50:50 -0000	1.12
  +++ hivemodule.xml	7 Aug 2003 15:51:43 -0000	1.13
  @@ -83,11 +83,36 @@
   		  	<description>
   		  	A single construct element identifies the class to instantiate.	
   		  	</description>
  -		  	<attribute name="class" required="true"/>
  +		  	
  +		  	<attribute name="class" required="true">
  +		  		<description>The name of the class to instantiate.</description>	
  +		  	</attribute>
  +		  	
  +		  	<attribute name="messages-property">
  +		  		<description>
  +		  		The name of a property to assign to invoking module's messages to.	
  +		  		</description>	
  +		  	</attribute>
  +		  	
  +		  	<attribute name="log-property">
  +		  		<description>
  +		  		The name of a property to assign the Log instance for the service to.
  +		  		The Log instance is built from the service extension point id.	
  +		  		</description>	
  +		  	</attribute>
  +		  	
  +		  	<attribute name="point-id-property">
  +		  		<description>
  +		  		The name of a property to assign the extension point id of the service to.	
  +		  		</description>
  +		  	</attribute>
   		  	
   		  	<rules>
   		  		<create-object class="org.apache.commons.hivemind.service.impl.BuilderParameter"/>
   		  		<read-attribute property="className" attribute="class"/>
  +		  		<read-attribute attribute="messages-property" property="messagesPropertyName"/>
  +		  		<read-attribute attribute="log-property" property="logPropertyName"/>
  +		  		<read-attribute attribute="point-id-property" property="extensionPointIdPropertyName"/>
   		  		<invoke-parent method="addElement"/>	
   		  	</rules>	
   		  	
  
  
  
  1.1                  jakarta-commons-sandbox/hivemind/src/test/hivemind/test/services/impl/BuilderAccessImpl.java
  
  Index: BuilderAccessImpl.java
  ===================================================================
  /*
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  package hivemind.test.services.impl;
  
  import hivemind.test.services.BuilderAccess;
  
  import org.apache.commons.logging.Log;
  import org.apache.tapestry.IMessages;
  
  /**
   * Used to test {@link org.apache.commons.hivemind.service.impl.BuilderFactory}.
   *
   * @author Howard Lewis Ship
   * @version $Id: BuilderAccessImpl.java,v 1.1 2003/08/07 15:51:43 hlship Exp $
   */
  public class BuilderAccessImpl implements BuilderAccess
  {
      private String _extensionPointId;
      private IMessages _messages;
      private Log _log;
  
      public void logMessage(String message)
      {
          _log.info(message);
      }
  
      public String getLocalizedMessage(String key)
      {
          return _messages.getMessage(key);
      }
  
      public String getExtensionPointId()
      {
          return _extensionPointId;
      }
  
      public Log getLog()
      {
          return _log;
      }
  
      public IMessages getMessages()
      {
          return _messages;
      }
  
      public void setExtensionPointId(String string)
      {
          _extensionPointId = string;
      }
  
      public void setLog(Log log)
      {
          _log = log;
      }
  
      public void setMessages(IMessages messages)
      {
          _messages = messages;
      }
  
  }
  
  
  

Mime
View raw message