cziegeler 2002/12/15 03:56:48 Modified: sourceresolve/src/java/org/apache/excalibur/source SourceValidity.java Source.java SourceNotFoundException.java SourceUtil.java SourceResolver.java SourceParameters.java SourceFactory.java SourceException.java sourceresolve/src/java/org/apache/excalibur/source/impl ResourceSource.java ResourceSourceFactory.java URLSource.java AbstractSource.java SourceResolverImpl.java sourceresolve/src/java/org/apache/excalibur/source/impl/validity TimeStampValidity.java FileTimeStampValidity.java AggregatedValidity.java NOPValidity.java sourceresolve/src/xdocs index.xml Removed: sourceresolve/src/java/org/apache/excalibur/source Recyclable.java Log: SourceFactories now also control the release of a source. This removes all the ugly component handling stuff for source objects. Updated documentation a little bit. Revision Changes Path 1.5 +53 -6 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceValidity.java Index: SourceValidity.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceValidity.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- SourceValidity.java 7 Nov 2002 07:30:57 -0000 1.4 +++ SourceValidity.java 15 Dec 2002 11:56:48 -0000 1.5 @@ -1,9 +1,56 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source; 1.8 +59 -7 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/Source.java Index: Source.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/Source.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Source.java 6 Jul 2002 03:55:06 -0000 1.7 +++ Source.java 15 Dec 2002 11:56:48 -0000 1.8 @@ -1,9 +1,56 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source; @@ -65,10 +112,15 @@ throws IOException, SourceException; /** - * Return the unique identifer for this source + * Return the unique identifier for this source */ String getSystemId(); + /** + * Return the protocol identifier. + */ + String getProtocol(); + /** * Get the Validity object. This can either wrap the last modification * date or the expires information or... 1.4 +53 -6 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceNotFoundException.java Index: SourceNotFoundException.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceNotFoundException.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- SourceNotFoundException.java 6 Jul 2002 03:55:06 -0000 1.3 +++ SourceNotFoundException.java 15 Dec 2002 11:56:48 -0000 1.4 @@ -1,9 +1,56 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source; 1.3 +54 -6 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceUtil.java Index: SourceUtil.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceUtil.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SourceUtil.java 7 Nov 2002 07:30:40 -0000 1.2 +++ SourceUtil.java 15 Dec 2002 11:56:48 -0000 1.3 @@ -1,9 +1,56 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source; @@ -13,6 +60,7 @@ import java.io.OutputStreamWriter; import java.util.BitSet; import java.util.Iterator; + import org.apache.avalon.framework.parameters.Parameters; /** 1.6 +54 -6 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceResolver.java Index: SourceResolver.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceResolver.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- SourceResolver.java 13 Jun 2002 17:24:52 -0000 1.5 +++ SourceResolver.java 15 Dec 2002 11:56:48 -0000 1.6 @@ -1,15 +1,63 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source; import java.io.IOException; import java.net.MalformedURLException; import java.util.Map; + import org.apache.avalon.framework.component.Component; /** 1.4 +54 -6 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceParameters.java Index: SourceParameters.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceParameters.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- SourceParameters.java 7 Nov 2002 07:30:10 -0000 1.3 +++ SourceParameters.java 15 Dec 2002 11:56:48 -0000 1.4 @@ -1,9 +1,56 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source; @@ -13,6 +60,7 @@ import java.util.Iterator; import java.util.Map; import java.util.StringTokenizer; + import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.parameters.Parameters; 1.5 +74 -7 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceFactory.java Index: SourceFactory.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- SourceFactory.java 6 Jul 2002 03:55:06 -0000 1.4 +++ SourceFactory.java 15 Dec 2002 11:56:48 -0000 1.5 @@ -1,18 +1,74 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source; import java.io.IOException; import java.net.MalformedURLException; import java.util.Map; + import org.apache.avalon.framework.component.Component; /** + * A source factory creates new source objects. + * + * Source factories are used to extend the source resolving mechanism + * with a new protocol. A new source factory is added in order to + * handle a specific prototol. The [EMAIL PROTECTED] SourceResolver} delegates + * the handling of a URI containing this new protocol to the factory + * and the factory can created a coresponding [EMAIL PROTECTED] Source} object. + * * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> * @version $Id$ */ @@ -22,9 +78,20 @@ String ROLE = SourceFactory.class.getName(); /** - * Get a <code>Source</code> object. + * Get a [EMAIL PROTECTED] Source} object. + * The factory creates a new [EMAIL PROTECTED] Source} object that can be used + * by the application. However, when this source object is not needed + * anymore it has to be released again using the [EMAIL PROTECTED] #release(Source)} + * method. + * + * @param location The URI to resolve - this URI includes the protocol. * @param parameters This is optional. */ Source getSource( String location, Map parameters ) throws MalformedURLException, IOException, SourceException; + + /** + * Release a [EMAIL PROTECTED] Source} object. + */ + void release( Source source ); } 1.5 +54 -8 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceException.java Index: SourceException.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceException.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- SourceException.java 7 Nov 2002 07:29:26 -0000 1.4 +++ SourceException.java 15 Dec 2002 11:56:48 -0000 1.5 @@ -1,12 +1,58 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source; + package org.apache.excalibur.source; import org.apache.avalon.framework.CascadingException; 1.6 +55 -6 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/ResourceSource.java Index: ResourceSource.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/ResourceSource.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ResourceSource.java 6 Jul 2002 03:55:06 -0000 1.5 +++ ResourceSource.java 15 Dec 2002 11:56:48 -0000 1.6 @@ -1,14 +1,62 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source.impl; import java.io.IOException; import java.io.InputStream; + import org.apache.excalibur.source.Source; import org.apache.excalibur.source.SourceValidity; import org.apache.excalibur.source.impl.validity.NOPValidity; @@ -33,6 +81,7 @@ this.systemId = systemId; final int pos = systemId.indexOf( "://" ); m_location = systemId.substring( pos + 3 ); + this.protocol = systemId.substring(0, pos); } /** 1.8 +70 -7 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/ResourceSourceFactory.java Index: ResourceSourceFactory.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/ResourceSourceFactory.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- ResourceSourceFactory.java 7 Nov 2002 04:59:07 -0000 1.7 +++ ResourceSourceFactory.java 15 Dec 2002 11:56:48 -0000 1.8 @@ -1,15 +1,63 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source.impl; import java.io.IOException; import java.net.MalformedURLException; import java.util.Map; + import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.excalibur.source.Source; @@ -27,7 +75,13 @@ implements SourceFactory, ThreadSafe { /** - * Get a <code>Source</code> object. + * Get a [EMAIL PROTECTED] Source} object. + * The factory creates a new [EMAIL PROTECTED] Source} object that can be used + * by the application. However, when this source object is not needed + * anymore it has to be released again using the [EMAIL PROTECTED] #release(Source)} + * method. + * + * @param location The URI to resolve - this URI includes the protocol. * @param parameters This is optional. */ public Source getSource( String location, Map parameters ) @@ -40,4 +94,13 @@ } return new ResourceSource( location ); } + + /** + * Release a [EMAIL PROTECTED] Source} object. + */ + public void release( Source source ) + { + // do nothing here + } + } 1.14 +57 -12 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/URLSource.java Index: URLSource.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/URLSource.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- URLSource.java 6 Jul 2002 03:55:06 -0000 1.13 +++ URLSource.java 15 Dec 2002 11:56:48 -0000 1.14 @@ -1,9 +1,56 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source.impl; @@ -18,12 +65,8 @@ import java.net.URLConnection; import java.util.Iterator; import java.util.Map; -import org.apache.excalibur.source.Source; -import org.apache.excalibur.source.SourceException; -import org.apache.excalibur.source.SourceNotFoundException; -import org.apache.excalibur.source.SourceParameters; -import org.apache.excalibur.source.SourceUtil; -import org.apache.excalibur.source.SourceValidity; + +import org.apache.excalibur.source.*; import org.apache.excalibur.source.impl.validity.FileTimeStampValidity; import org.apache.excalibur.source.impl.validity.TimeStampValidity; @@ -88,6 +131,8 @@ throws IOException { this.systemId = url.toExternalForm(); + int pos = systemId.indexOf(':'); + this.protocol = systemId.substring(0, pos); if (systemId.startsWith( FILE )) { this.file = new File( this.systemId.substring( FILE.length() ) ); 1.5 +65 -7 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/AbstractSource.java Index: AbstractSource.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/AbstractSource.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- AbstractSource.java 7 Nov 2002 09:09:46 -0000 1.4 +++ AbstractSource.java 15 Dec 2002 11:56:48 -0000 1.5 @@ -1,16 +1,64 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source.impl; import java.io.IOException; import java.io.InputStream; -import java.util.Iterator; import java.util.Collections; +import java.util.Iterator; + import org.apache.excalibur.source.Source; import org.apache.excalibur.source.SourceException; import org.apache.excalibur.source.SourceValidity; @@ -30,6 +78,8 @@ protected long contentLength; protected String systemId; + protected String protocol; + /** * Get the last modification date and content length of the source. * Any exceptions are ignored. @@ -69,6 +119,14 @@ public String getSystemId() { return this.systemId; + } + + /** + * Return the protocol identifier. + */ + public String getProtocol() + { + return this.protocol; } /** 1.17 +74 -33 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/SourceResolverImpl.java Index: SourceResolverImpl.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/SourceResolverImpl.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- SourceResolverImpl.java 28 Nov 2002 21:27:53 -0000 1.16 +++ SourceResolverImpl.java 15 Dec 2002 11:56:48 -0000 1.17 @@ -1,9 +1,56 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source.impl; @@ -12,8 +59,9 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.Map; + +import org.apache.avalon.framework.CascadingRuntimeException; import org.apache.avalon.framework.activity.Disposable; -import org.apache.avalon.framework.container.ContainerUtil; import org.apache.avalon.framework.context.Context; import org.apache.avalon.framework.context.ContextException; import org.apache.avalon.framework.context.Contextualizable; @@ -26,12 +74,9 @@ import org.apache.avalon.framework.service.ServiceSelector; import org.apache.avalon.framework.service.Serviceable; import org.apache.avalon.framework.thread.ThreadSafe; -import org.apache.avalon.framework.component.WrapperComponentManager; -import org.apache.excalibur.source.Recyclable; import org.apache.excalibur.source.Source; import org.apache.excalibur.source.SourceException; import org.apache.excalibur.source.SourceFactory; -import org.apache.excalibur.source.SourceNotFoundException; import org.apache.excalibur.source.SourceResolver; /** @@ -267,7 +312,7 @@ } catch( final ServiceException ce ) { - throw new SourceException( "ComponentException.", ce ); + throw new SourceException( "Unable to select source factory for protocol " + protocol, ce ); } finally { @@ -323,26 +368,7 @@ } } } - ContainerUtil.enableLogging( source, getLogger() ); - - try - { - ContainerUtil.contextualize( source, m_context ); - } - catch( ContextException ce ) - { - throw new SourceException( "ContextException occured during source resolving.", ce ); - } - try - { - ContainerUtil.compose( source, new WrapperComponentManager( m_manager ) ); - ContainerUtil.service( source, m_manager ); - } - catch( Exception ce ) - { - throw new SourceException( "ComponentException occured during source resolving.", ce ); - } return source; } @@ -352,10 +378,25 @@ public void release( final Source source ) { if( source == null ) return; - if( source instanceof Recyclable ) + + // search for a SourceFactory implementing the protocol + final String protocol = source.getProtocol(); + if( m_factorySelector.isSelectable( protocol ) ) { - ( (Recyclable)source ).recycle(); + SourceFactory factory = null; + try + { + factory = (SourceFactory)m_factorySelector.select( protocol ); + factory.release( source ); + } + catch( final ServiceException ce ) + { + throw new CascadingRuntimeException( "Unable to select source factory for protocol " + protocol, ce ); + } + finally + { + m_factorySelector.release( factory ); + } } - ContainerUtil.dispose(source ); } } 1.4 +53 -6 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/TimeStampValidity.java Index: TimeStampValidity.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/TimeStampValidity.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TimeStampValidity.java 6 Jul 2002 03:55:06 -0000 1.3 +++ TimeStampValidity.java 15 Dec 2002 11:56:48 -0000 1.4 @@ -1,9 +1,56 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source.impl.validity; 1.4 +54 -6 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/FileTimeStampValidity.java Index: FileTimeStampValidity.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/FileTimeStampValidity.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- FileTimeStampValidity.java 6 Jul 2002 03:55:06 -0000 1.3 +++ FileTimeStampValidity.java 15 Dec 2002 11:56:48 -0000 1.4 @@ -1,13 +1,61 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source.impl.validity; import java.io.File; + import org.apache.excalibur.source.SourceValidity; /** 1.4 +54 -6 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/AggregatedValidity.java Index: AggregatedValidity.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/AggregatedValidity.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- AggregatedValidity.java 6 Jul 2002 03:55:06 -0000 1.3 +++ AggregatedValidity.java 15 Dec 2002 11:56:48 -0000 1.4 @@ -1,15 +1,63 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source.impl.validity; import java.util.ArrayList; import java.util.Iterator; import java.util.List; + import org.apache.excalibur.source.SourceValidity; /** 1.4 +53 -6 jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/NOPValidity.java Index: NOPValidity.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/impl/validity/NOPValidity.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NOPValidity.java 6 Jul 2002 03:55:06 -0000 1.3 +++ NOPValidity.java 15 Dec 2002 11:56:48 -0000 1.4 @@ -1,9 +1,56 @@ -/* - * Copyright (C) The Apache Software Foundation. All rights reserved. +/* ==================================================================== + * The Apache Software License, Version 1.1 * - * 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. + * 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.excalibur.source.impl.validity; 1.3 +18 -8 jakarta-avalon-excalibur/sourceresolve/src/xdocs/index.xml Index: index.xml =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/sourceresolve/src/xdocs/index.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- index.xml 5 Jun 2002 13:56:44 -0000 1.2 +++ index.xml 15 Dec 2002 11:56:48 -0000 1.3 @@ -16,8 +16,19 @@ <p> The source resolver of Avalon Excalibur is a component helping you in this task. It resolves sources from a given - URI. The URI can use all available protocols of the JVM. - In addition own protocols can be plugged-in. + URI. The URI can use all available protocols of the JRE. + In addition own protocols can be plugged-in. So using + the standard protocols like HTTP, FTP or file can be handled + in the same way, like dealing with custom, self-build + protocols such as myxmldatabase://root/documents/test.xml. + </p> + <p> + The main advantage in comparisson to the mechanisms provided + by the JRE is that the source resolver can be used without + any problems with web application servers. Each web + application can use it's own configured version of this + component avoiding any possible conflicts between these + applications. </p> <p> The architecture of this package is simple but powerful. @@ -29,18 +40,17 @@ </p> <p> Own protocols can be configured using the SourceFactory interface. - Whenever the SourceResolver finds a protocol which it can't handle + Whenever the SourceResolver finds a protocol that it can't handle by itself, it gets a role selector for a SourceFactory and tries to get a component with the role name of the protocol. If such a factory exists, the source creation is passed on to this factory. </p> <p> - The Source object is handled similar to any other Avalon component. + The Source object is handled similar to Avalon components. After it has been used it must be released using the SourceResolver. - In addition the implementation of the Source object can implement - any of the lifecycle interfaces of usual components and it gets - all the information from the SourceResolver. + The SourceResolver in turn passed on the release of the + object to the SourceFactory that created it. </p> <p> The Source object is a lightwight object which can be extended with
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>