mcconnell 2002/12/19 02:46:17 Modified: assembly/src/test/config block.xml assembly/src/test/org/apache/avalon/assembly TestCaseBase.java assembly/src/test/org/apache/avalon/assembly/engine EngineTestCase.java assembly/src/test/org/apache/avalon/assembly/profile ProfileManagerTestCase.java assembly/src/test/org/apache/avalon/assembly/service DefaultServiceManagerTestCase.java assembly/src/test/org/apache/avalon/assembly/type TypeManagerTestCase.java assembly/src/test/org/apache/avalon/playground ComplexComponent.java ComplexComponent.xinfo SimpleComponent.java SimpleComponent.xinfo TerminalComponent.java TerminalComponent.xinfo Added: assembly/src/test/org/apache/avalon/playground/basic BasicComponent.java BasicComponent.xconfig BasicComponent.xinfo BasicComponent.xprofile BasicContext.java BasicContextImp.java BasicService.java BasicService.xservice Removed: assembly/src/test/org/apache/avalon/playground BasicComponent.java BasicComponent.xconfig BasicComponent.xinfo BasicComponent.xprofile BasicContext.java BasicContextInterface.java BasicService.java BasicService.xservice Log: Putting some structure into the plaground. Revision Changes Path 1.5 +2 -2 avalon-sandbox/assembly/src/test/config/block.xml Index: block.xml =================================================================== RCS file: /home/cvs/avalon-sandbox/assembly/src/test/config/block.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- block.xml 17 Dec 2002 04:49:49 -0000 1.4 +++ block.xml 19 Dec 2002 10:46:16 -0000 1.5 @@ -16,8 +16,8 @@ </configuration> </component> - <component name="basic" class="org.apache.avalon.playground.BasicComponent" activation="startup"> - <context class="org.apache.avalon.playground.BasicContext"> + <component name="basic" class="org.apache.avalon.playground.basic.BasicComponent" activation="startup"> + <context class="org.apache.avalon.playground.basic.BasicContextImp"> <entry key="location">My Place</entry> <import name="urn:avalon:home" key="home" /> </context> 1.6 +1 -1 avalon-sandbox/assembly/src/test/org/apache/avalon/assembly/TestCaseBase.java Index: TestCaseBase.java =================================================================== RCS file: /home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/assembly/TestCaseBase.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestCaseBase.java 9 Dec 2002 03:04:55 -0000 1.5 +++ TestCaseBase.java 19 Dec 2002 10:46:16 -0000 1.6 @@ -51,7 +51,7 @@ new Category( "logging", "WARN" ) ); DefaultContext context = new DefaultContext(); - context.put( "urn:avalon:home", m_base ); + context.put( "urn:assembly:home", m_base ); context.put( "urn:assembly:logging.descriptor", logging ); context.makeReadOnly(); 1.8 +5 -4 avalon-sandbox/assembly/src/test/org/apache/avalon/assembly/engine/EngineTestCase.java Index: EngineTestCase.java =================================================================== RCS file: /home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/assembly/engine/EngineTestCase.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- EngineTestCase.java 15 Dec 2002 14:05:50 -0000 1.7 +++ EngineTestCase.java 19 Dec 2002 10:46:16 -0000 1.8 @@ -85,7 +85,7 @@ // Appliance appliance = null; - final String servicename = "org.apache.avalon.playground.BasicService"; + final String servicename = "org.apache.avalon.playground.basic.BasicService"; DependencyDescriptor dependency = new DependencyDescriptor( "test", servicename, Version.getVersion( "1.1" ) ); @@ -123,7 +123,7 @@ public void testSimpleComponent() throws Throwable { final String complex = "org.apache.avalon.playground.ComplexComponent"; - final String basic = "org.apache.avalon.playground.BasicComponent"; + final String basic = "org.apache.avalon.playground.basic.BasicComponent"; final String simple = "org.apache.avalon.playground.SimpleComponent"; final String exploiter = "org.apache.avalon.playground.ExploitationManager"; final String demo = "org.apache.avalon.playground.DemoManager"; @@ -218,9 +218,10 @@ } catch( Throwable e ) { - System.out.println("failure for create type using : " + classname ); + String error = ExceptionHelper.packException( + "failure for create type using : " + classname, e ); + getLogger().error( error ); assertTrue( false ); - e.printStackTrace(); } } } 1.7 +5 -5 avalon-sandbox/assembly/src/test/org/apache/avalon/assembly/profile/ProfileManagerTestCase.java Index: ProfileManagerTestCase.java =================================================================== RCS file: /home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/assembly/profile/ProfileManagerTestCase.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ProfileManagerTestCase.java 7 Dec 2002 09:34:29 -0000 1.6 +++ ProfileManagerTestCase.java 19 Dec 2002 10:46:16 -0000 1.7 @@ -51,7 +51,7 @@ public void testPackagedProfileImport() { - final String classname = "org.apache.avalon.playground.BasicComponent"; + final String classname = "org.apache.avalon.playground.basic.BasicComponent"; try { @@ -69,11 +69,11 @@ public void testClassicProfileRegistrationAndRetrival() throws Exception { - final String classname = "org.apache.avalon.playground.BasicComponent"; + final String classname = "org.apache.avalon.playground.basic.BasicComponent"; ReferenceDescriptor ref = new ReferenceDescriptor( - "org.apache.avalon.playground.BasicService", + "org.apache.avalon.playground.basic.BasicService", Version.getVersion( "1.1" ) ); DependencyDescriptor dep = @@ -130,11 +130,11 @@ public void testServiceProviderSelection() throws Exception { - final String classname = "org.apache.avalon.playground.BasicComponent"; + final String classname = "org.apache.avalon.playground.basic.BasicComponent"; ReferenceDescriptor ref = new ReferenceDescriptor( - "org.apache.avalon.playground.BasicService", + "org.apache.avalon.playground.basic.BasicService", Version.getVersion( "1.1" ) ); DependencyDescriptor dep = 1.4 +2 -2 avalon-sandbox/assembly/src/test/org/apache/avalon/assembly/service/DefaultServiceManagerTestCase.java Index: DefaultServiceManagerTestCase.java =================================================================== RCS file: /home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/assembly/service/DefaultServiceManagerTestCase.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DefaultServiceManagerTestCase.java 7 Dec 2002 09:34:29 -0000 1.3 +++ DefaultServiceManagerTestCase.java 19 Dec 2002 10:46:17 -0000 1.4 @@ -49,7 +49,7 @@ public void testCreateBasicService() { - final String classname = "org.apache.avalon.playground.BasicService"; + final String classname = "org.apache.avalon.playground.basic.BasicService"; try { @@ -106,7 +106,7 @@ public void testServiceRegistrationAndRetrival() throws Exception { - final String classname = "org.apache.avalon.playground.BasicService"; + final String classname = "org.apache.avalon.playground.basic.BasicService"; Service service = m_manager.createService( classname ); try 1.4 +2 -2 avalon-sandbox/assembly/src/test/org/apache/avalon/assembly/type/TypeManagerTestCase.java Index: TypeManagerTestCase.java =================================================================== RCS file: /home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/assembly/type/TypeManagerTestCase.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TypeManagerTestCase.java 7 Dec 2002 09:34:29 -0000 1.3 +++ TypeManagerTestCase.java 19 Dec 2002 10:46:17 -0000 1.4 @@ -48,7 +48,7 @@ public void testBasic() { - final String classname = "org.apache.avalon.playground.BasicComponent"; + final String classname = "org.apache.avalon.playground.basic.BasicComponent"; try { @@ -138,7 +138,7 @@ public void testTypeRegistrationAndRetrival() throws Exception { final String complex = "org.apache.avalon.playground.ComplexComponent"; - final String basic = "org.apache.avalon.playground.BasicComponent"; + final String basic = "org.apache.avalon.playground.basic.BasicComponent"; final String simple = "org.apache.avalon.playground.SimpleComponent"; Type complexType = m_manager.createType( complex ); 1.4 +1 -0 avalon-sandbox/assembly/src/test/org/apache/avalon/playground/ComplexComponent.java Index: ComplexComponent.java =================================================================== RCS file: /home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/playground/ComplexComponent.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ComplexComponent.java 17 Dec 2002 05:04:45 -0000 1.3 +++ ComplexComponent.java 19 Dec 2002 10:46:17 -0000 1.4 @@ -62,6 +62,7 @@ import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.service.ServiceManager; import org.apache.avalon.framework.service.Serviceable; +import org.apache.avalon.playground.basic.BasicService; /** * This is a demonstration component that declares no interface but 1.5 +1 -1 avalon-sandbox/assembly/src/test/org/apache/avalon/playground/ComplexComponent.xinfo Index: ComplexComponent.xinfo =================================================================== RCS file: /home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/playground/ComplexComponent.xinfo,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ComplexComponent.xinfo 17 Dec 2002 09:55:24 -0000 1.4 +++ ComplexComponent.xinfo 19 Dec 2002 10:46:17 -0000 1.5 @@ -28,7 +28,7 @@ </services> <dependencies> - <dependency type="org.apache.avalon.playground.BasicService:1.1" role="basic"/> + <dependency type="org.apache.avalon.playground.basic.BasicService:1.1" role="basic"/> <dependency type="org.apache.avalon.playground.SimpleService" role="simple"/> </dependencies> 1.3 +1 -0 avalon-sandbox/assembly/src/test/org/apache/avalon/playground/SimpleComponent.java Index: SimpleComponent.java =================================================================== RCS file: /home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/playground/SimpleComponent.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SimpleComponent.java 17 Dec 2002 05:04:45 -0000 1.2 +++ SimpleComponent.java 19 Dec 2002 10:46:17 -0000 1.3 @@ -64,6 +64,7 @@ import org.apache.avalon.framework.service.ServiceException; import org.apache.avalon.framework.service.ServiceManager; import org.apache.avalon.framework.service.Serviceable; +import org.apache.avalon.playground.basic.BasicService; /** * This is a minimal demonstration component that a dependency on 1.6 +5 -12 avalon-sandbox/assembly/src/test/org/apache/avalon/playground/SimpleComponent.xinfo Index: SimpleComponent.xinfo =================================================================== RCS file: /home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/playground/SimpleComponent.xinfo,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- SimpleComponent.xinfo 17 Dec 2002 09:55:24 -0000 1.5 +++ SimpleComponent.xinfo 19 Dec 2002 10:46:17 -0000 1.6 @@ -20,15 +20,12 @@ <attributes> <attribute key="urn:assembly:appliance.class" value="org.apache.avalon.assembly.appliance.DefaultAppliance"/> - <attribute key="urn:assembly:appliance.factory-version" - value="2.0"/> + <attribute key="urn:assembly:appliance.version" value="2.0"/> </attributes> </info> <services> - <service> - <reference type="org.apache.avalon.playground.SimpleService"/> - </service> + <service type="org.apache.avalon.playground.SimpleService"/> </services> <dependencies> @@ -37,7 +34,7 @@ Declaration of the services that this component type is dependent on. --> - <dependency type="org.apache.avalon.playground.BasicService:1.1" role="basic"/> + <dependency type="org.apache.avalon.playground.basic.BasicService:1.1" role="basic"/> </dependencies> @@ -47,12 +44,8 @@ the container has to manage. --> <stages> - <stage> - <reference type="org.apache.avalon.playground.Exploitable" version="1.0"/> - </stage> - <stage> - <reference type="org.apache.avalon.playground.Demonstratable"/> - </stage> + <stage type="org.apache.avalon.playground.Exploitable" /> + <stage type="org.apache.avalon.playground.Demonstratable"/> </stages> </type> 1.2 +1 -0 avalon-sandbox/assembly/src/test/org/apache/avalon/playground/TerminalComponent.java Index: TerminalComponent.java =================================================================== RCS file: /home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/playground/TerminalComponent.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TerminalComponent.java 24 Nov 2002 12:50:46 -0000 1.1 +++ TerminalComponent.java 19 Dec 2002 10:46:17 -0000 1.2 @@ -57,6 +57,7 @@ import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.avalon.playground.basic.BasicService; /** * This is a minimal demonstration component that provides BasicService 1.3 +1 -1 avalon-sandbox/assembly/src/test/org/apache/avalon/playground/TerminalComponent.xinfo Index: TerminalComponent.xinfo =================================================================== RCS file: /home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/playground/TerminalComponent.xinfo,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TerminalComponent.xinfo 15 Dec 2002 17:48:40 -0000 1.2 +++ TerminalComponent.xinfo 19 Dec 2002 10:46:17 -0000 1.3 @@ -11,7 +11,7 @@ <services> <service> - <reference type="org.apache.avalon.playground.BasicService" version="1.1"/> + <reference type="org.apache.avalon.playground.basic.BasicService" version="1.1"/> </service> </services> 1.1 avalon-sandbox/assembly/src/test/org/apache/avalon/playground/basic/BasicComponent.java Index: BasicComponent.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2002 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 acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software * itself, if and wherever such third-party acknowledgments * normally appear. * * 4. The names "Jakarta", "Avalon", 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 [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * 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 org.apache.avalon.playground.basic; import java.io.File; import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.activity.Startable; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.context.Context; import org.apache.avalon.framework.context.Contextualizable; import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.playground.NullService; /** * This is a minimal demonstration component that implements the * <code>BasicService</code> interface and has no dependencies. * * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a> */ public class BasicComponent extends AbstractLogEnabled implements Contextualizable, Configurable, Initializable, Startable, Disposable, BasicService, NullService { private String m_location; private String m_message; private File m_home; //======================================================================= // Contextualizable //======================================================================= /** * Supply of the the component context to the component type. * @param context the context value */ public void contextualize( Context context ) { BasicContext c = (BasicContext)context; m_location = c.getLocation(); m_home = c.getWorkingDirectory(); } //======================================================================= // Configurable //======================================================================= /** * Supply of the the component configuration to the type. * @param config the configuration value */ public void configure( Configuration config ) { getLogger().debug( "configure" ); m_message = config.getChild( "message" ).getValue( null ); } //======================================================================= // Initializable //======================================================================= /** * Initialization of the component type by its container. */ public void initialize() { getLogger().debug( "initialize" ); getLogger().debug( "location: " + m_location ); getLogger().debug( "home: " + m_home ); getLogger().debug( "message: " + m_message ); } //======================================================================= // Startable //======================================================================= /** * Start the component. */ public void start() { doPrimeObjective(); } /** * Stop the component. */ public void stop() { getLogger().debug( "stopping" ); } /** * Dispose of the component. */ public void dispose() { getLogger().debug( "dispose" ); } //======================================================================= // BasicService //======================================================================= /** * Service interface implementation. */ public void doPrimeObjective() { getLogger().info( m_message + " from '" + m_location + "'." ); } } 1.1 avalon-sandbox/assembly/src/test/org/apache/avalon/playground/basic/BasicComponent.xconfig Index: BasicComponent.xconfig =================================================================== <?xml version="1.0"?> <!-- Copyright (C) The Apache Software Foundation. All rights reserved. This software is published under the terms of the Apache Software License version 1.1, a copy of which has been included with this distribution in the LICENSE.txt file. @author Avalon Development Team @version 1.0 12/03/2001 --> <!-- The .xconfig file contains the default configuration for the component. --> <configuration> <message>Hello</message> </configuration> 1.1 avalon-sandbox/assembly/src/test/org/apache/avalon/playground/basic/BasicComponent.xinfo Index: BasicComponent.xinfo =================================================================== <?xml version="1.0"?> <!DOCTYPE type PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN" "http://jakarta.apache.org/avalon/dtds/meta/type_1_1.dtd" > <!-- Copyright (C) The Apache Software Foundation. All rights reserved. This software is published under the terms of the Apache Software License version 1.1, a copy of which has been included with this distribution in the LICENSE.txt file. @author Avalon Development Team @version 1.0 12/03/2001 --> <type> <info> <name>basic</name> </info> <context type="org.apache.avalon.playground.basic.BasicContext"> <attributes> <attribute key="urn:assembly:lifecycle.context.extension" value="org.apache.avalon.framework.context.Contextualizable:4.1"/> </attributes> <entry key="location"/> <entry key="home" type="java.io.File"/> </context> <services> <service type="org.apache.avalon.playground.basic.BasicService:1.1"/> <service type="org.apache.avalon.playground.NullService"/> </services> </type> 1.1 avalon-sandbox/assembly/src/test/org/apache/avalon/playground/basic/BasicComponent.xprofile Index: BasicComponent.xprofile =================================================================== <?xml version="1.0"?> <!-- Copyright (C) The Apache Software Foundation. All rights reserved. This software is published under the terms of the Apache Software License version 1.1, a copy of which has been included with this distribution in the LICENSE.txt file. @author Avalon Development Team @version 1.0 12/03/2001 --> <profiles> <!-- A packaged profile is equivalent to a component declaration inside a container, except that it is provided by a component type. A PACKAGED profiles take priority over an IMPLICIT profile. An EXPLICIT profile declared inside a container definition will take priority over PACKAGED profiles. --> <component name="basic"> <context class="org.apache.avalon.playground.basic.BasicContextImp"> <import name="urn:avalon:home" key="home" /> <entry key="location">Paris</entry> </context> </component> </profiles> 1.1 avalon-sandbox/assembly/src/test/org/apache/avalon/playground/basic/BasicContext.java Index: BasicContext.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2002 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 acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software * itself, if and wherever such third-party acknowledgments * normally appear. * * 4. The names "Jakarta", "Avalon", 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 [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * 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 org.apache.avalon.playground.basic; import java.io.File; import org.apache.avalon.framework.context.Context; /** * Simple non-standard Context interface to demonstration context * management at the level of different context types. * * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a> */ public interface BasicContext extends Context { /** * @return a string containing a location value */ String getLocation(); /** * @return a file representing the working directory */ File getWorkingDirectory(); } 1.1 avalon-sandbox/assembly/src/test/org/apache/avalon/playground/basic/BasicContextImp.java Index: BasicContextImp.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2002 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 acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software * itself, if and wherever such third-party acknowledgments * normally appear. * * 4. The names "Jakarta", "Avalon", 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 [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * 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 org.apache.avalon.playground.basic; import java.io.File; import java.util.Map; import org.apache.avalon.framework.context.Context; import org.apache.avalon.framework.context.DefaultContext; /** * This is example of a custom context class. It is used in the demonsteation * of a context management fraework to show how a context class can be * supplied to a component declaring a context interface criteria. * * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a> */ public class BasicContextImp extends DefaultContext implements BasicContext { /** * Creation of a new custom context instance. * @param map the context name/value map * @param parent a possibly parent context */ public BasicContextImp( Map map, Context parent ) { super( map, parent ); } /** * @return the location */ public String getLocation() { try { return (String)super.get( "location" ); } catch( Throwable e ) { return "Unknown"; } } /** * @return the working directory */ public File getWorkingDirectory() { try { return (File)super.get( "home" ); } catch( Throwable e ) { throw new RuntimeException( "context object does not provide required home entry." ); } } } 1.1 avalon-sandbox/assembly/src/test/org/apache/avalon/playground/basic/BasicService.java Index: BasicService.java =================================================================== /* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2002 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 acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software * itself, if and wherever such third-party acknowledgments * normally appear. * * 4. The names "Jakarta", "Avalon", 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 [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * 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 org.apache.avalon.playground.basic; /** * The <code>BasicService</code> executes a prime objective. * * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a> */ public interface BasicService { /** * Execute the prime objective of this services. */ void doPrimeObjective(); } 1.1 avalon-sandbox/assembly/src/test/org/apache/avalon/playground/basic/BasicService.xservice Index: BasicService.xservice =================================================================== <?xml version="1.0"?> <!DOCTYPE type PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN" "http://jakarta.apache.org/avalon/dtds/meta/type_1_1.dtd" > <!-- Copyright (C) The Apache Software Foundation. All rights reserved. This software is published under the terms of the Apache Software License version 1.1, a copy of which has been included with this distribution in the LICENSE.txt file. @author Avalon Development Team @version 1.0 12/03/2001 --> <service> <version>1.1</version> <attributes> <attribute key="urn:avalon:service.name" value="basic"/> <attribute key="urn:avalon:service.description"> A demonstration service used within the scope of the Avalon playground package for educational and unit testing purposes. </attribute> </attributes> </service>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>