donaldp 2002/07/05 20:55:07
Modified: sourceresolve/src/java/org/apache/excalibur/source
Source.java SourceException.java SourceFactory.java
SourceNotFoundException.java SourceParameters.java
sourceresolve/src/java/org/apache/excalibur/source/impl
AbstractSource.java ResourceSource.java
ResourceSourceFactory.java SourceResolverImpl.java
URLSource.java
sourceresolve/src/java/org/apache/excalibur/source/impl/validity
AggregatedValidity.java FileTimeStampValidity.java
NOPValidity.java TimeStampValidity.java
Log:
Put in some brackets and some finals.
Revision Changes Path
1.7 +3 -4
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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Source.java 13 Jun 2002 17:24:52 -0000 1.6
+++ Source.java 6 Jul 2002 03:55:06 -0000 1.7
@@ -55,7 +55,6 @@
*/
public interface Source
{
-
/**
* Return an <code>InputStream</code> object to read from the source.
* This is the data at the point of invocation of this method,
@@ -109,14 +108,14 @@
* Using this it is possible to get custom information provided by the
* source implementation, like an expires date, HTTP headers etc.
*/
- String getParameter(String name);
+ String getParameter( String name );
/**
* Get the value of a parameter.
* Using this it is possible to get custom information provided by the
* source implementation, like an expires date, HTTP headers etc.
*/
- long getParameterAsLong(String name);
+ long getParameterAsLong( String name );
/**
* Get parameter names
1.3 +13 -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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SourceException.java 13 May 2002 12:17:40 -0000 1.2
+++ SourceException.java 6 Jul 2002 03:55:06 -0000 1.3
@@ -22,7 +22,6 @@
public class SourceException
extends CascadingException
{
-
/**
* Construct a new <code>SourceException</code> instance.
*
@@ -46,34 +45,40 @@
public String toString()
{
- StringBuffer s = new StringBuffer();
- s.append( super.toString() );
- if( getCause() != null )
+ final StringBuffer sb = new StringBuffer();
+ sb.append( super.toString() );
+ if( null != getCause() )
{
- s.append( ": " );
- s.append( getCause().toString() );
+ sb.append( ": " );
+ sb.append( getCause().toString() );
}
- return s.toString();
+ return sb.toString();
}
public void printStackTrace()
{
super.printStackTrace();
if( getCause() != null )
+ {
getCause().printStackTrace();
+ }
}
public void printStackTrace( PrintStream s )
{
super.printStackTrace( s );
if( getCause() != null )
+ {
getCause().printStackTrace( s );
+ }
}
public void printStackTrace( PrintWriter s )
{
super.printStackTrace( s );
if( getCause() != null )
+ {
getCause().printStackTrace( s );
+ }
}
}
1.4 +1 -3
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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SourceFactory.java 13 May 2002 12:17:40 -0000 1.3
+++ SourceFactory.java 6 Jul 2002 03:55:06 -0000 1.4
@@ -19,7 +19,6 @@
public interface SourceFactory
extends Component
{
-
String ROLE = SourceFactory.class.getName();
/**
@@ -28,5 +27,4 @@
*/
Source getSource( String location, Map parameters )
throws MalformedURLException, IOException, SourceException;
-
}
1.3 +1 -3
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SourceNotFoundException.java 13 May 2002 12:17:40 -0000 1.2
+++ SourceNotFoundException.java 6 Jul 2002 03:55:06 -0000 1.3
@@ -5,7 +5,6 @@
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
-
package org.apache.excalibur.source;
/**
@@ -17,7 +16,6 @@
public class SourceNotFoundException
extends SourceException
{
-
/**
* Construct a new <code>SourceNotFoundException</code> instance.
*
1.2 +1 -2
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SourceParameters.java 19 Apr 2002 09:05:37 -0000 1.1
+++ SourceParameters.java 6 Jul 2002 03:55:06 -0000 1.2
@@ -28,7 +28,6 @@
public final class SourceParameters
implements Serializable, Cloneable
{
-
/** The parameter names are the keys and the value is a List object */
private Map names = new HashMap( 5 );
1.3 +17 -19
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractSource.java 12 Jun 2002 10:03:45 -0000 1.2
+++ AbstractSource.java 6 Jul 2002 03:55:06 -0000 1.3
@@ -10,9 +10,9 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
+import java.util.Collections;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceException;
-import org.apache.excalibur.source.SourceParameters;
import org.apache.excalibur.source.SourceValidity;
/**
@@ -25,8 +25,7 @@
public abstract class AbstractSource
implements Source
{
-
- protected boolean gotInfos = false;
+ protected boolean gotInfos;
protected long lastModificationDate;
@@ -49,7 +48,7 @@
{
if( !this.gotInfos )
{
- this.getInfos();
+ getInfos();
this.gotInfos = true;
}
}
@@ -57,7 +56,7 @@
/**
* Return an <code>InputStream</code> object to read from the source.
*
- * @throws ResourceNotFoundException if file not found or
+ * @throws SourceException if file not found or
* HTTP location does not exist.
* @throws IOException if I/O error occured.
*/
@@ -67,7 +66,6 @@
return null;
}
-
/**
* Return the unique identifer for this source
*/
@@ -112,7 +110,7 @@
*/
public long getContentLength()
{
- this.checkInfos();
+ checkInfos();
return this.contentLength;
}
@@ -122,7 +120,7 @@
*/
public long getLastModified()
{
- this.checkInfos();
+ checkInfos();
return this.lastModificationDate;
}
@@ -131,8 +129,9 @@
* Using this it is possible to get custom information provided by the
* source implementation, like an expires date, HTTP headers etc.
*/
- public String getParameter(String name) {
- this.checkInfos();
+ public String getParameter( final String name )
+ {
+ checkInfos();
return null;
}
@@ -141,8 +140,9 @@
* Using this it is possible to get custom information provided by the
* source implementation, like an expires date, HTTP headers etc.
*/
- public long getParameterAsLong(String name) {
- this.checkInfos();
+ public long getParameterAsLong( final String name )
+ {
+ checkInfos();
return 0;
}
@@ -151,11 +151,9 @@
* Using this it is possible to get custom information provided by the
* source implementation, like an expires date, HTTP headers etc.
*/
- public Iterator getParameterNames() {
- this.checkInfos();
- return java.util.Collections.EMPTY_LIST.iterator();
-
+ public Iterator getParameterNames()
+ {
+ checkInfos();
+ return Collections.EMPTY_LIST.iterator();
}
-
-
}
1.5 +4 -9
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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ResourceSource.java 13 Jun 2002 12:59:10 -0000 1.4
+++ ResourceSource.java 6 Jul 2002 03:55:06 -0000 1.5
@@ -21,22 +21,18 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
* @version CVS $Revision$ $Date$
*/
-
public final class ResourceSource
extends AbstractSource
implements Source
{
/** Location of the resource */
- private String location;
+ private String m_location;
- /**
- * Constructor
- */
public ResourceSource( String systemId )
{
this.systemId = systemId;
final int pos = systemId.indexOf( "://" );
- this.location = systemId.substring( pos + 3 );
+ m_location = systemId.substring( pos + 3 );
}
/**
@@ -50,7 +46,7 @@
{
loader = getClass().getClassLoader();
}
- return loader.getResourceAsStream( this.location );
+ return loader.getResourceAsStream( m_location );
}
/**
@@ -64,5 +60,4 @@
// we are always valid
return NOPValidity.SHARED_INSTANCE;
}
-
}
1.6 +3 -3
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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ResourceSourceFactory.java 13 Jun 2002 12:59:10 -0000 1.5
+++ ResourceSourceFactory.java 6 Jul 2002 03:55:06 -0000 1.6
@@ -26,7 +26,6 @@
extends AbstractLogEnabled
implements SourceFactory, ThreadSafe
{
-
/**
* Get a <code>Source</code> object.
* @param parameters This is optional.
@@ -36,7 +35,8 @@
{
if( getLogger().isDebugEnabled() )
{
- getLogger().debug( "Creating source object for " + location );
+ final String message = "Creating source object for " + location;
+ getLogger().debug( message );
}
return new ResourceSource( location );
}
1.10 +2 -10
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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SourceResolverImpl.java 13 Jun 2002 17:24:52 -0000 1.9
+++ SourceResolverImpl.java 6 Jul 2002 03:55:06 -0000 1.10
@@ -65,7 +65,6 @@
SourceResolver,
ThreadSafe
{
-
/** The component manager */
protected ComponentManager m_manager;
@@ -130,9 +129,6 @@
m_factorySelector = (ComponentSelector)m_manager.lookup( SourceFactory.ROLE
+ "Selector" );
}
- /**
- * Dispose
- */
public void dispose()
{
if( m_manager != null )
@@ -142,9 +138,6 @@
}
}
- /**
- * Configure
- */
public void parameterize( Parameters pars )
throws ParameterException
{
@@ -372,5 +365,4 @@
( (Disposable)source ).dispose();
}
}
-
-}
+}
\ No newline at end of file
1.13 +2 -5
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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- URLSource.java 12 Jun 2002 09:24:14 -0000 1.12
+++ URLSource.java 6 Jul 2002 03:55:06 -0000 1.13
@@ -34,12 +34,10 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
* @version CVS $Revision$ $Date$
*/
-
public class URLSource
extends AbstractSource
implements Source
{
-
/** With this parameter you can specify the method to use for a http request.
* Default is GET.
*/
@@ -185,7 +183,7 @@
/**
* Return an <code>InputStream</code> object to read from the source.
*
- * @throws ResourceNotFoundException if file not found or
+ * @throws SourceException if file not found or
* HTTP location does not exist.
* @throws IOException if I/O error occured.
*/
@@ -353,5 +351,4 @@
this.connection = null;
super.discardValidity();
}
-
}
1.3 +25 -22
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AggregatedValidity.java 4 Jun 2002 08:42:13 -0000 1.2
+++ AggregatedValidity.java 6 Jul 2002 03:55:06 -0000 1.3
@@ -21,17 +21,11 @@
public final class AggregatedValidity
implements SourceValidity
{
+ private final List m_list = new ArrayList();
- private List a;
-
- public AggregatedValidity()
+ public void add( final SourceValidity validity )
{
- this.a = new ArrayList();
- }
-
- public void add( SourceValidity validity )
- {
- this.a.add( validity );
+ m_list.add( validity );
}
/**
@@ -43,27 +37,36 @@
*/
public int isValid()
{
- for( Iterator i = a.iterator(); i.hasNext(); )
+ for( final Iterator i = m_list.iterator(); i.hasNext(); )
{
- final int v = ((SourceValidity)i.next() ).isValid();
- if (v < 1) return v;
+ final int v = ( (SourceValidity)i.next() ).isValid();
+ if( v < 1 )
+ {
+ return v;
+ }
}
return 1;
}
- public boolean isValid( SourceValidity validity )
+ public boolean isValid( final SourceValidity validity )
{
if( validity instanceof AggregatedValidity )
{
- List b = ( (AggregatedValidity)validity ).a;
- if( a.size() != b.size() )
+ final AggregatedValidity other = (AggregatedValidity)validity;
+ final List otherList = other.m_list;
+ if( m_list.size() != otherList.size() )
+ {
return false;
- for( Iterator i = a.iterator(), j = b.iterator(); i.hasNext(); )
+ }
+
+ for( final Iterator i = m_list.iterator(), j = otherList.iterator();
i.hasNext(); )
{
final SourceValidity srcA = (SourceValidity)i.next();
final SourceValidity srcB = (SourceValidity)j.next();
if( srcA.isValid() < 1 && !srcA.isValid( srcB ) )
+ {
return false;
+ }
}
return true;
}
@@ -72,13 +75,13 @@
public String toString()
{
- StringBuffer b = new StringBuffer( "SourceValidity " );
- for( Iterator i = a.iterator(); i.hasNext(); )
+ final StringBuffer sb = new StringBuffer( "SourceValidity " );
+ for( final Iterator i = m_list.iterator(); i.hasNext(); )
{
- b.append( i.next() );
- if( i.hasNext() ) b.append( ':' );
+ sb.append( i.next() );
+ if( i.hasNext() ) sb.append( ':' );
}
- return b.toString();
+ return sb.toString();
}
}
1.3 +20 -20
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FileTimeStampValidity.java 4 Jun 2002 08:42:13 -0000 1.2
+++ FileTimeStampValidity.java 6 Jul 2002 03:55:06 -0000 1.3
@@ -8,7 +8,6 @@
package org.apache.excalibur.source.impl.validity;
import java.io.File;
-
import org.apache.excalibur.source.SourceValidity;
/**
@@ -20,24 +19,24 @@
public final class FileTimeStampValidity
implements SourceValidity
{
+ private long m_timeStamp;
+ private File m_file;
- private long timeStamp;
- private File file;
-
- public FileTimeStampValidity( String filename )
+ public FileTimeStampValidity( final String filename )
{
- this(new File(filename));
+ this( new File( filename ) );
}
- public FileTimeStampValidity( File file )
+ public FileTimeStampValidity( final File file )
{
- this(file, file.lastModified());
+ this( file, file.lastModified() );
}
- public FileTimeStampValidity( File file, long timeStamp )
+ public FileTimeStampValidity( final File file,
+ final long timeStamp )
{
- this.file = file;
- this.timeStamp = timeStamp;
+ m_file = file;
+ m_timeStamp = timeStamp;
}
/**
@@ -49,31 +48,32 @@
*/
public int isValid()
{
- return (file.lastModified() == this.timeStamp ? 1 : -1);
+ return ( m_file.lastModified() == m_timeStamp ? 1 : -1 );
}
- public boolean isValid( SourceValidity newValidity )
+ public boolean isValid( final SourceValidity newValidity )
{
- if( newValidity instanceof FileTimeStampValidity)
+ if( newValidity instanceof FileTimeStampValidity )
{
- return this.timeStamp == ( (FileTimeStampValidity)newValidity
).getTimeStamp();
+ final long timeStamp =
+ ( (FileTimeStampValidity)newValidity ).getTimeStamp();
+ return ( m_timeStamp == timeStamp );
}
return false;
}
public File getFile()
{
- return this.file;
+ return this.m_file;
}
public long getTimeStamp()
{
- return this.timeStamp;
+ return this.m_timeStamp;
}
public String toString()
{
- return "FileTimeStampValidity: " + file.getPath() + ": " + this.timeStamp;
+ return "FileTimeStampValidity: " + m_file.getPath() + ": " +
this.m_timeStamp;
}
-
}
1.3 +2 -4
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NOPValidity.java 4 Jun 2002 08:42:13 -0000 1.2
+++ NOPValidity.java 6 Jul 2002 03:55:06 -0000 1.3
@@ -18,7 +18,6 @@
public final class NOPValidity
implements SourceValidity
{
-
public static final SourceValidity SHARED_INSTANCE = new NOPValidity();
/**
@@ -33,7 +32,7 @@
return 1;
}
- public boolean isValid( SourceValidity newValidity )
+ public boolean isValid( final SourceValidity newValidity )
{
return newValidity instanceof NOPValidity;
}
@@ -42,5 +41,4 @@
{
return "NOPValidity";
}
-
}
1.3 +9 -9
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TimeStampValidity.java 4 Jun 2002 08:42:13 -0000 1.2
+++ TimeStampValidity.java 6 Jul 2002 03:55:06 -0000 1.3
@@ -18,12 +18,11 @@
public final class TimeStampValidity
implements SourceValidity
{
+ private long m_timeStamp;
- private long timeStamp;
-
- public TimeStampValidity( long timeStamp )
+ public TimeStampValidity( final long timeStamp )
{
- this.timeStamp = timeStamp;
+ m_timeStamp = timeStamp;
}
/**
@@ -42,19 +41,20 @@
{
if( newValidity instanceof TimeStampValidity )
{
- return this.timeStamp == ( (TimeStampValidity)newValidity
).getTimeStamp();
+ final long timeStamp =
+ ( (TimeStampValidity)newValidity ).getTimeStamp();
+ return m_timeStamp == timeStamp;
}
return false;
}
public long getTimeStamp()
{
- return this.timeStamp;
+ return m_timeStamp;
}
public String toString()
{
- return "TimeStampValidity: " + this.timeStamp;
+ return "TimeStampValidity: " + m_timeStamp;
}
-
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>