conor 2003/07/09 04:24:31
Modified: src/main/org/apache/tools/ant/taskdefs/optional/extension
Compatability.java Compatibility.java
DeweyDecimal.java ExtensionAdapter.java
ExtensionResolver.java ExtensionSet.java
ExtensionUtil.java ExtraAttribute.java
LibFileSet.java LibraryDisplayer.java
Log:
Checkstyle
Revision Changes Path
1.5 +7 -10
ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/Compatability.java
Index: Compatability.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/Compatability.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- Compatability.java 10 Feb 2003 14:14:03 -0000 1.4
+++ Compatability.java 9 Jul 2003 11:24:31 -0000 1.5
@@ -69,21 +69,19 @@
* @version $Revision$ $Date$
* @see Extension
*/
-public final class Compatability
-{
+public final class Compatability {
/**
* A string representaiton of compatability level.
*/
- private final String m_name;
+ private final String name;
/**
* Create a compatability enum with specified name.
*
* @param name the name of compatability level
*/
- Compatability( final String name )
- {
- m_name = name;
+ Compatability(final String name) {
+ this.name = name;
}
/**
@@ -91,8 +89,7 @@
*
* @return the name of compatability level
*/
- public String toString()
- {
- return m_name;
+ public String toString() {
+ return name;
}
}
1.4 +7 -10
ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/Compatibility.java
Index: Compatibility.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/Compatibility.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- Compatibility.java 10 Feb 2003 14:14:03 -0000 1.3
+++ Compatibility.java 9 Jul 2003 11:24:31 -0000 1.4
@@ -69,21 +69,19 @@
* @version $Revision$ $Date$
* @see Extension
*/
-public final class Compatibility
-{
+public final class Compatibility {
/**
* A string representaiton of compatibility level.
*/
- private final String m_name;
+ private final String name;
/**
* Create a compatibility enum with specified name.
*
* @param name the name of compatibility level
*/
- Compatibility( final String name )
- {
- m_name = name;
+ Compatibility(final String name) {
+ this.name = name;
}
/**
@@ -91,8 +89,7 @@
*
* @return the name of compatibility level
*/
- public String toString()
- {
- return m_name;
+ public String toString() {
+ return name;
}
}
1.4 +56 -89
ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/DeweyDecimal.java
Index: DeweyDecimal.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/DeweyDecimal.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- DeweyDecimal.java 10 Feb 2003 14:14:03 -0000 1.3
+++ DeweyDecimal.java 9 Jul 2003 11:24:31 -0000 1.4
@@ -63,33 +63,23 @@
* represent major, minor, micro, etc versions. The version number
* must begin with a number.
*
- * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
- * This file is from excalibur.extension package. Dont edit this file
- * directly as there is no unit tests to make sure it is operational
- * in ant. Edit file in excalibur and run tests there before changing
- * ants file.
- * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
- *
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
* @version $Revision$ $Date$
*/
-public final class DeweyDecimal
-{
- ///Array of components that make up DeweyDecimal
- private int[] m_components;
+public final class DeweyDecimal {
+ /** Array of components that make up DeweyDecimal */
+ private int[] components;
/**
* Construct a DeweyDecimal from an array of integer components.
*
* @param components an array of integer components.
*/
- public DeweyDecimal( final int[] components )
- {
- m_components = new int[ components.length ];
-
- for( int i = 0; i < m_components.length; i++ )
- {
- m_components[ i ] = components[ i ];
+ public DeweyDecimal(final int[] components) {
+ this.components = new int[components.length];
+
+ for (int i = 0; i < components.length; i++) {
+ this.components[i] = components[i];
}
}
@@ -100,31 +90,26 @@
* @exception NumberFormatException if string is malformed
*/
public DeweyDecimal( final String string )
- throws NumberFormatException
- {
+ throws NumberFormatException {
final StringTokenizer tokenizer = new StringTokenizer( string, ".",
true );
final int size = tokenizer.countTokens();
- m_components = new int[ ( size + 1 ) / 2 ];
+ components = new int[ (size + 1) / 2 ];
- for( int i = 0; i < m_components.length; i++ )
- {
+ for (int i = 0; i < components.length; i++) {
final String component = tokenizer.nextToken();
- if( component.equals( "" ) )
- {
+ if (component.equals("")) {
throw new NumberFormatException( "Empty component in string"
);
}
- m_components[ i ] = Integer.parseInt( component );
+ components[ i ] = Integer.parseInt(component);
//Strip '.' token
- if( tokenizer.hasMoreTokens() )
- {
+ if (tokenizer.hasMoreTokens()) {
tokenizer.nextToken();
//If it ended in a dot, throw an exception
- if( !tokenizer.hasMoreTokens() )
- {
+ if (!tokenizer.hasMoreTokens()) {
throw new NumberFormatException( "DeweyDecimal ended in
a '.'" );
}
}
@@ -136,9 +121,8 @@
*
* @return the number of components in dewey decimal
*/
- public int getSize()
- {
- return m_components.length;
+ public int getSize() {
+ return components.length;
}
/**
@@ -147,9 +131,8 @@
* @param index the index of components
* @return the value of component at index
*/
- public int get( final int index )
- {
- return m_components[ index ];
+ public int get(final int index) {
+ return components[ index ];
}
/**
@@ -159,17 +142,14 @@
* @param other the other DeweyDecimal
* @return true if equal to other DeweyDecimal, false otherwise
*/
- public boolean isEqual( final DeweyDecimal other )
- {
- final int max = Math.max( other.m_components.length,
m_components.length );
-
- for( int i = 0; i < max; i++ )
- {
- final int component1 = ( i < m_components.length ) ?
m_components[ i ] : 0;
- final int component2 = ( i < other.m_components.length ) ?
other.m_components[ i ] : 0;
+ public boolean isEqual(final DeweyDecimal other) {
+ final int max = Math.max(other.components.length, components.length);
+
+ for (int i = 0; i < max; i++) {
+ final int component1 = (i < components.length) ? components[ i ]
: 0;
+ final int component2 = (i < other.components.length) ?
other.components[ i ] : 0;
- if( component2 != component1 )
- {
+ if (component2 != component1) {
return false;
}
}
@@ -184,8 +164,7 @@
* @param other the other DeweyDecimal
* @return true if less than other DeweyDecimal, false otherwise
*/
- public boolean isLessThan( final DeweyDecimal other )
- {
+ public boolean isLessThan(final DeweyDecimal other) {
return !isGreaterThanOrEqual( other );
}
@@ -196,8 +175,7 @@
* @param other the other DeweyDecimal
* @return true if less than or equal to other DeweyDecimal, false
otherwise
*/
- public boolean isLessThanOrEqual( final DeweyDecimal other )
- {
+ public boolean isLessThanOrEqual(final DeweyDecimal other) {
return !isGreaterThan( other );
}
@@ -208,21 +186,17 @@
* @param other the other DeweyDecimal
* @return true if greater than other DeweyDecimal, false otherwise
*/
- public boolean isGreaterThan( final DeweyDecimal other )
- {
- final int max = Math.max( other.m_components.length,
m_components.length );
-
- for( int i = 0; i < max; i++ )
- {
- final int component1 = ( i < m_components.length ) ?
m_components[ i ] : 0;
- final int component2 = ( i < other.m_components.length ) ?
other.m_components[ i ] : 0;
+ public boolean isGreaterThan(final DeweyDecimal other) {
+ final int max = Math.max(other.components.length, components.length);
- if( component2 > component1 )
- {
+ for (int i = 0; i < max; i++) {
+ final int component1 = (i < components.length) ? components[ i ]
: 0;
+ final int component2 = (i < other.components.length) ?
other.components[ i ] : 0;
+
+ if (component2 > component1) {
return false;
}
- if( component2 < component1 )
- {
+ if (component2 < component1) {
return true;
}
}
@@ -237,21 +211,17 @@
* @param other the other DeweyDecimal
* @return true if greater than or equal to other DeweyDecimal, false
otherwise
*/
- public boolean isGreaterThanOrEqual( final DeweyDecimal other )
- {
- final int max = Math.max( other.m_components.length,
m_components.length );
-
- for( int i = 0; i < max; i++ )
- {
- final int component1 = ( i < m_components.length ) ?
m_components[ i ] : 0;
- final int component2 = ( i < other.m_components.length ) ?
other.m_components[ i ] : 0;
+ public boolean isGreaterThanOrEqual(final DeweyDecimal other) {
+ final int max = Math.max(other.components.length, components.length);
+
+ for (int i = 0; i < max; i++) {
+ final int component1 = (i < components.length) ? components[ i ]
: 0;
+ final int component2 = (i < other.components.length) ?
other.components[ i ] : 0;
- if( component2 > component1 )
- {
+ if (component2 > component1) {
return false;
}
- if( component2 < component1 )
- {
+ if (component2 < component1) {
return true;
}
}
@@ -264,17 +234,14 @@
*
* @return the string representation of DeweyDecimal.
*/
- public String toString()
- {
+ public String toString() {
final StringBuffer sb = new StringBuffer();
- for( int i = 0; i < m_components.length; i++ )
- {
- if( i != 0 )
- {
+ for (int i = 0; i < components.length; i++) {
+ if (i != 0) {
sb.append( '.' );
}
- sb.append( m_components[ i ] );
+ sb.append(components[ i ]);
}
return sb.toString();
1.6 +69 -87
ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionAdapter.java
Index: ExtensionAdapter.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionAdapter.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -u -r1.5 -r1.6
--- ExtensionAdapter.java 26 Feb 2003 14:22:45 -0000 1.5
+++ ExtensionAdapter.java 9 Jul 2003 11:24:31 -0000 1.6
@@ -65,59 +65,56 @@
* @version $Revision$ $Date$
* @ant.data-type name="extension"
*/
-public class ExtensionAdapter
- extends DataType
-{
+public class ExtensionAdapter extends DataType {
/**
* The name of the optional package being made available, or required.
*/
- private String m_extensionName;
+ private String extensionName;
/**
* The version number (dotted decimal notation) of the specification
* to which this optional package conforms.
*/
- private DeweyDecimal m_specificationVersion;
+ private DeweyDecimal specificationVersion;
/**
* The name of the company or organization that originated the
* specification to which this optional package conforms.
*/
- private String m_specificationVendor;
+ private String specificationVendor;
/**
* The unique identifier of the company that produced the optional
* package contained in this JAR file.
*/
- private String m_implementationVendorID;
+ private String implementationVendorID;
/**
* The name of the company or organization that produced this
* implementation of this optional package.
*/
- private String m_implementationVendor;
+ private String implementationVendor;
/**
* The version number (dotted decimal notation) for this implementation
* of the optional package.
*/
- private DeweyDecimal m_implementationVersion;
+ private DeweyDecimal implementationVersion;
/**
* The URL from which the most recent version of this optional package
* can be obtained if it is not already installed.
*/
- private String m_implementationURL;
+ private String implementationVendor;
/**
* Set the name of extension.
*
* @param extensionName the name of extension
*/
- public void setExtensionName( final String extensionName )
- {
+ public void setExtensionName(final String extensionName) {
verifyNotAReference();
- m_extensionName = extensionName;
+ this.extensionName = extensionName;
}
/**
@@ -125,10 +122,9 @@
*
* @param specificationVersion the specificationVersion of extension
*/
- public void setSpecificationVersion( final String specificationVersion )
- {
+ public void setSpecificationVersion(final String specificationVersion) {
verifyNotAReference();
- m_specificationVersion = new DeweyDecimal( specificationVersion );
+ this.specificationVersion = new DeweyDecimal(specificationVersion);
}
/**
@@ -136,10 +132,9 @@
*
* @param specificationVendor the specificationVendor of extension
*/
- public void setSpecificationVendor( final String specificationVendor )
- {
+ public void setSpecificationVendor(final String specificationVendor) {
verifyNotAReference();
- m_specificationVendor = specificationVendor;
+ this.specificationVendor = specificationVendor;
}
/**
@@ -147,10 +142,9 @@
*
* @param implementationVendorID the implementationVendorID of extension
*/
- public void setImplementationVendorId( final String
implementationVendorID )
- {
+ public void setImplementationVendorId(final String
implementationVendorID) {
verifyNotAReference();
- m_implementationVendorID = implementationVendorID;
+ this.implementationVendorID = implementationVendorID;
}
/**
@@ -158,10 +152,9 @@
*
* @param implementationVendor the implementationVendor of extension
*/
- public void setImplementationVendor( final String implementationVendor )
- {
+ public void setImplementationVendor(final String implementationVendor) {
verifyNotAReference();
- m_implementationVendor = implementationVendor;
+ this.implementationVendor = implementationVendor;
}
/**
@@ -169,10 +162,9 @@
*
* @param implementationVersion the implementationVersion of extension
*/
- public void setImplementationVersion( final String implementationVersion
)
- {
+ public void setImplementationVersion(final String implementationVersion)
{
verifyNotAReference();
- m_implementationVersion = new DeweyDecimal( implementationVersion );
+ this.implementationVersion = new DeweyDecimal(implementationVersion);
}
/**
@@ -180,10 +172,9 @@
*
* @param implementationURL the implementationURL of extension
*/
- public void setImplementationUrl( final String implementationURL )
- {
+ public void setImplementationUrl(final String implementationURL) {
verifyNotAReference();
- m_implementationURL = implementationURL;
+ this.implementationVendor = implementationURL;
}
/**
@@ -197,33 +188,28 @@
* @exception BuildException if this instance already has been
configured.
*/
public void setRefid( final Reference reference )
- throws BuildException
- {
- if( null != m_extensionName ||
- null != m_specificationVersion ||
- null != m_specificationVendor ||
- null != m_implementationVersion ||
- null != m_implementationVendorID ||
- null != m_implementationVendor ||
- null != m_implementationURL )
- {
+ throws BuildException {
+ if (null != extensionName
+ || null != specificationVersion
+ || null != specificationVendor
+ || null != implementationVersion
+ || null != implementationVendorID
+ || null != implementationVendor
+ || null != implementationVendor) {
throw tooManyAttributes();
}
// change this to get the objects from the other reference
Object o = reference.getReferencedObject( getProject() );
- if( o instanceof ExtensionAdapter )
- {
+ if (o instanceof ExtensionAdapter) {
final ExtensionAdapter other = (ExtensionAdapter)o;
- m_extensionName = other.m_extensionName;
- m_specificationVersion = other.m_specificationVersion;
- m_specificationVendor = other.m_specificationVendor;
- m_implementationVersion = other.m_implementationVersion;
- m_implementationVendorID = other.m_implementationVendorID;
- m_implementationVendor = other.m_implementationVendor;
- m_implementationURL = other.m_implementationURL;
- }
- else
- {
+ extensionName = other.extensionName;
+ specificationVersion = other.specificationVersion;
+ specificationVendor = other.specificationVendor;
+ implementationVersion = other.implementationVersion;
+ implementationVendorID = other.implementationVendorID;
+ implementationVendor = other.implementationVendor;
+ implementationVendor = other.implementationVendor;
+ } else {
final String message =
reference.getRefId() + " doesn\'t refer to a Extension";
throw new BuildException( message );
@@ -233,10 +219,8 @@
}
private void verifyNotAReference()
- throws BuildException
- {
- if( isReference() )
- {
+ throws BuildException {
+ if (isReference()) {
throw tooManyAttributes();
}
}
@@ -247,35 +231,33 @@
* @return the extension object
*/
Extension toExtension()
- throws BuildException
- {
- if( null == m_extensionName )
- {
+ throws BuildException {
+ if (null == extensionName) {
final String message = "Extension is missing name.";
throw new BuildException( message );
}
- String specificationVersion = null;
- if( null != m_specificationVersion )
- {
- specificationVersion = m_specificationVersion.toString();
- }
- String implementationVersion = null;
- if( null != m_implementationVersion )
- {
- implementationVersion = m_implementationVersion.toString();
- }
- return new Extension( m_extensionName,
- specificationVersion,
- m_specificationVendor,
- implementationVersion,
- m_implementationVendor,
- m_implementationVendorID,
- m_implementationURL );
+ String specificationVersionString = null;
+ if (null != specificationVersion) {
+ specificationVersionString = specificationVersion.toString();
+ }
+ String implementationVersionString = null;
+ if (null != implementationVersion) {
+ implementationVersionString = implementationVersion.toString();
+ }
+ return new Extension(extensionName,
+ specificationVersionString,
+ specificationVendor,
+ implementationVersionString,
+ implementationVendor,
+ implementationVendorID,
+ implementationVendor);
}
- public String toString()
- {
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
return "{" + toExtension().toString() + "}";
}
}
1.5 +4 -4
ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionResolver.java
Index: ExtensionResolver.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionResolver.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- ExtensionResolver.java 10 Feb 2003 14:14:03 -0000 1.4
+++ ExtensionResolver.java 9 Jul 2003 11:24:31 -0000 1.5
@@ -64,13 +64,13 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jeff Turner</>
* @version $Revision$ $Date$
*/
-public interface ExtensionResolver
-{
+public interface ExtensionResolver {
/**
* Attempt to locate File that satisfies
* extension via resolver.
*
* @param extension the extension
+ * @param project the Ant project instance
* @return the File satisfying extension, null
* if can not resolve extension
* @throws BuildException if error occurs attempting to
1.4 +33 -40
ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionSet.java
Index: ExtensionSet.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionSet.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- ExtensionSet.java 10 Feb 2003 14:14:03 -0000 1.3
+++ ExtensionSet.java 9 Jul 2003 11:24:31 -0000 1.4
@@ -70,26 +70,24 @@
* @ant.data-type name="extension-set"
*/
public class ExtensionSet
- extends DataType
-{
+ extends DataType {
/**
* ExtensionAdapter objects representing extensions.
*/
- private final ArrayList m_extensions = new ArrayList();
+ private final ArrayList extensions = new ArrayList();
/**
* Filesets specifying all the extensions wanted.
*/
- private final ArrayList m_extensionsFilesets = new ArrayList();
+ private final ArrayList extensionsFilesets = new ArrayList();
/**
* Adds an extension that this library requires.
*
* @param extensionAdapter an extension that this library requires.
*/
- public void addExtension( final ExtensionAdapter extensionAdapter )
- {
- m_extensions.add( extensionAdapter );
+ public void addExtension(final ExtensionAdapter extensionAdapter) {
+ extensions.add(extensionAdapter);
}
/**
@@ -97,9 +95,8 @@
*
* @param fileSet a set of files about which extensions data will be
extracted.
*/
- public void addLibfileset( final LibFileSet fileSet )
- {
- m_extensionsFilesets.add( fileSet );
+ public void addLibfileset(final LibFileSet fileSet) {
+ extensionsFilesets.add(fileSet);
}
/**
@@ -107,22 +104,22 @@
*
* @param fileSet a set of files about which extensions data will be
extracted.
*/
- public void addFileset( final FileSet fileSet )
- {
- m_extensionsFilesets.add( fileSet );
+ public void addFileset(final FileSet fileSet) {
+ extensionsFilesets.add(fileSet);
}
/**
* Extract a set of Extension objects from the ExtensionSet.
*
+ * @param project the project instance.
+ * @return an array containing the Extensions from this set
* @throws BuildException if an error occurs
*/
public Extension[] toExtensions( final Project project )
- throws BuildException
- {
- final ArrayList extensions = ExtensionUtil.toExtensions(
m_extensions );
- ExtensionUtil.extractExtensions( project, extensions,
m_extensionsFilesets );
- return (Extension[])extensions.toArray( new Extension[
extensions.size() ] );
+ throws BuildException {
+ final ArrayList extensionsList =
ExtensionUtil.toExtensions(extensions);
+ ExtensionUtil.extractExtensions(project, extensionsList,
extensionsFilesets);
+ return (Extension[]) extensionsList.toArray(new
Extension[extensionsList.size()]);
}
/**
@@ -136,24 +133,18 @@
* @exception BuildException if this instance already has been
configured.
*/
public void setRefid( final Reference reference )
- throws BuildException
- {
- if( !m_extensions.isEmpty() ||
- !m_extensionsFilesets.isEmpty() )
- {
+ throws BuildException {
+ if (!extensions.isEmpty() || !extensionsFilesets.isEmpty()) {
throw tooManyAttributes();
}
// change this to get the objects from the other reference
final Object object =
reference.getReferencedObject( getProject() );
- if( object instanceof ExtensionSet )
- {
+ if (object instanceof ExtensionSet) {
final ExtensionSet other = (ExtensionSet)object;
- m_extensions.addAll( other.m_extensions );
- m_extensionsFilesets.addAll( other.m_extensionsFilesets );
- }
- else
- {
+ extensions.addAll(other.extensions);
+ extensionsFilesets.addAll(other.extensionsFilesets);
+ } else {
final String message =
reference.getRefId() + " doesn\'t refer to a ExtensionSet";
throw new BuildException( message );
@@ -162,8 +153,10 @@
super.setRefid( reference );
}
- public String toString()
- {
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
return "ExtensionSet" + Arrays.asList( toExtensions( getProject() )
);
}
}
1.4 +63 -79
ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionUtil.java
Index: ExtensionUtil.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionUtil.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- ExtensionUtil.java 10 Feb 2003 14:14:03 -0000 1.3
+++ ExtensionUtil.java 9 Jul 2003 11:24:31 -0000 1.4
@@ -70,8 +70,13 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
* @version $Revision$ $Date$
*/
-public class ExtensionUtil
-{
+public class ExtensionUtil {
+ /**
+ * Class is not meant to be instantiated.
+ */
+ private ExtensionUtil() {
+ }
+
/**
* Convert a list of extensionAdapter objects to extensions.
*
@@ -79,13 +84,11 @@
* @throws BuildException if an error occurs
*/
static ArrayList toExtensions( final ArrayList adapters )
- throws BuildException
- {
+ throws BuildException {
final ArrayList results = new ArrayList();
final int size = adapters.size();
- for( int i = 0; i < size; i++ )
- {
+ for (int i = 0; i < size; i++) {
final ExtensionAdapter adapter =
(ExtensionAdapter)adapters.get( i );
final Extension extension = adapter.toExtension();
@@ -105,14 +108,11 @@
static void extractExtensions( final Project project,
final ArrayList librarys,
final ArrayList fileset )
- throws BuildException
- {
- if( !fileset.isEmpty() )
- {
+ throws BuildException {
+ if (!fileset.isEmpty()) {
final Extension[] extensions = getExtensions( project,
fileset );
- for( int i = 0; i < extensions.length; i++ )
- {
+ for (int i = 0; i < extensions.length; i++) {
librarys.add( extensions[ i ] );
}
}
@@ -127,19 +127,16 @@
*/
private static Extension[] getExtensions( final Project project,
final ArrayList librarys )
- throws BuildException
- {
+ throws BuildException {
final ArrayList extensions = new ArrayList();
final Iterator iterator = librarys.iterator();
- while( iterator.hasNext() )
- {
+ while (iterator.hasNext()) {
final FileSet fileSet = (FileSet)iterator.next();
boolean includeImpl = true;
boolean includeURL = true;
- if( fileSet instanceof LibFileSet )
- {
+ if (fileSet instanceof LibFileSet) {
LibFileSet libFileSet = (LibFileSet)fileSet;
includeImpl = libFileSet.isIncludeImpl();
includeURL = libFileSet.isIncludeURL();
@@ -148,8 +145,7 @@
final DirectoryScanner scanner = fileSet.getDirectoryScanner(
project );
final File basedir = scanner.getBasedir();
final String[] files = scanner.getIncludedFiles();
- for( int i = 0; i < files.length; i++ )
- {
+ for (int i = 0; i < files.length; i++) {
final File file = new File( basedir, files[ i ] );
loadExtensions( file, extensions, includeImpl, includeURL );
}
@@ -168,21 +164,16 @@
final ArrayList extensionList,
final boolean includeImpl,
final boolean includeURL )
- throws BuildException
- {
- try
- {
+ throws BuildException {
+ try {
final JarFile jarFile = new JarFile( file );
final Extension[] extensions =
Extension.getAvailable( jarFile.getManifest() );
- for( int i = 0; i < extensions.length; i++ )
- {
+ for (int i = 0; i < extensions.length; i++) {
final Extension extension = extensions[ i ];
addExtension( extensionList, extension, includeImpl,
includeURL );
}
- }
- catch( final Exception e )
- {
+ } catch (final Exception e) {
throw new BuildException( e.getMessage(), e );
}
}
@@ -201,12 +192,10 @@
private static void addExtension( final ArrayList extensionList,
final Extension originalExtension,
final boolean includeImpl,
- final boolean includeURL )
- {
+ final boolean includeURL) {
Extension extension = originalExtension;
- if( !includeURL &&
- null != extension.getImplementationURL() )
- {
+ if (!includeURL
+ && null != extension.getImplementationURL()) {
extension =
new Extension( extension.getExtensionName(),
extension.getSpecificationVersion().toString(),
@@ -218,13 +207,12 @@
}
final boolean hasImplAttributes =
- null != extension.getImplementationURL() ||
- null != extension.getImplementationVersion() ||
- null != extension.getImplementationVendorID() ||
- null != extension.getImplementationVendor();
+ null != extension.getImplementationURL()
+ || null != extension.getImplementationVersion()
+ || null != extension.getImplementationVendorID()
+ || null != extension.getImplementationVendor();
- if( !includeImpl && hasImplAttributes )
- {
+ if (!includeImpl && hasImplAttributes) {
extension =
new Extension( extension.getExtensionName(),
extension.getSpecificationVersion().toString(),
@@ -247,15 +235,11 @@
* file not a jar, manifest not exist in file)
*/
static Manifest getManifest( final File file )
- throws BuildException
- {
- try
- {
+ throws BuildException {
+ try {
final JarFile jarFile = new JarFile( file );
return jarFile.getManifest();
- }
- catch( final IOException ioe )
- {
+ } catch (final IOException ioe) {
throw new BuildException( ioe.getMessage(), ioe );
}
}
1.3 +20 -28
ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtraAttribute.java
Index: ExtraAttribute.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtraAttribute.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- ExtraAttribute.java 10 Feb 2003 14:14:03 -0000 1.2
+++ ExtraAttribute.java 9 Jul 2003 11:24:31 -0000 1.3
@@ -63,19 +63,17 @@
* @todo Refactor this and all the other parameter, sysproperty,
* property etc into a single class in framework
*/
-public class ExtraAttribute
-{
- private String m_name;
- private String m_value;
+public class ExtraAttribute {
+ private String name;
+ private String value;
/**
* Set the name of the parameter.
*
* @param name the name of parameter
*/
- public void setName( final String name )
- {
- m_name = name;
+ public void setName(final String name) {
+ this.name = name;
}
/**
@@ -83,9 +81,8 @@
*
* @param value the parameter value
*/
- public void setValue( final String value )
- {
- m_value = value;
+ public void setValue(final String value) {
+ this.value = value;
}
/**
@@ -93,9 +90,8 @@
*
* @return the name of parameter.
*/
- String getName()
- {
- return m_name;
+ String getName() {
+ return name;
}
/**
@@ -103,26 +99,22 @@
*
* @return the value of parameter.
*/
- String getValue()
- {
- return m_value;
+ String getValue() {
+ return value;
}
/**
* Make sure that neither the name or the value
* is null.
+ *
+ * @throws BuildException if the attribute is invalid.
*/
- public void validate()
- throws BuildException
- {
- if( null == m_name )
- {
+ public void validate() throws BuildException {
+ if (null == name) {
final String message = "Missing name from parameter.";
throw new BuildException( message );
- }
- else if( null == m_value )
- {
- final String message = "Missing value from parameter " + m_name
+ ".";
+ } else if (null == value) {
+ final String message = "Missing value from parameter " + name +
".";
throw new BuildException( message );
}
}
1.3 +20 -27
ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/LibFileSet.java
Index: LibFileSet.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/LibFileSet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- LibFileSet.java 10 Feb 2003 14:14:03 -0000 1.2
+++ LibFileSet.java 9 Jul 2003 11:24:31 -0000 1.3
@@ -64,21 +64,20 @@
* @version $Revision$ $Date$
*/
public class LibFileSet
- extends FileSet
-{
+ extends FileSet {
/**
* Flag indicating whether should include the
* "Implementation-URL" attribute in manifest.
* Defaults to false.
*/
- private boolean m_includeURL;
+ private boolean includeURL;
/**
* Flag indicating whether should include the
* "Implementation-*" attributes in manifest.
* Defaults to false.
*/
- private boolean m_includeImpl;
+ private boolean includeImpl;
/**
* String that is the base URL for the librarys
@@ -94,7 +93,7 @@
*
* Note that this also implies includeURL=true
*/
- private String m_urlBase;
+ private String urlBase;
/**
* Flag indicating whether should include the
@@ -102,11 +101,10 @@
* Defaults to false.
*
* @param includeURL the flag
- * @see #m_includeURL
+ * @see #includeURL
*/
- public void setIncludeUrl( boolean includeURL )
- {
- m_includeURL = includeURL;
+ public void setIncludeUrl(boolean includeURL) {
+ this.includeURL = includeURL;
}
/**
@@ -115,22 +113,20 @@
* Defaults to false.
*
* @param includeImpl the flag
- * @see #m_includeImpl
+ * @see #includeImpl
*/
- public void setIncludeImpl( boolean includeImpl )
- {
- m_includeImpl = includeImpl;
+ public void setIncludeImpl(boolean includeImpl) {
+ this.includeImpl = includeImpl;
}
/**
* Set the url base for fileset.
*
* @param urlBase the base url
- * @see #m_urlBase
+ * @see #urlBase
*/
- public void setUrlBase( String urlBase )
- {
- m_urlBase = urlBase;
+ public void setUrlBase(String urlBase) {
+ this.urlBase = urlBase;
}
/**
@@ -138,9 +134,8 @@
*
* @return the includeURL flag.
*/
- boolean isIncludeURL()
- {
- return m_includeURL;
+ boolean isIncludeURL() {
+ return includeURL;
}
/**
@@ -148,9 +143,8 @@
*
* @return the includeImpl flag.
*/
- boolean isIncludeImpl()
- {
- return m_includeImpl;
+ boolean isIncludeImpl() {
+ return includeImpl;
}
/**
@@ -158,8 +152,7 @@
*
* @return the urlbase.
*/
- String getUrlBase()
- {
- return m_urlBase;
+ String getUrlBase() {
+ return urlBase;
}
}
1.4 +52 -75
ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/LibraryDisplayer.java
Index: LibraryDisplayer.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/LibraryDisplayer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- LibraryDisplayer.java 10 Feb 2003 14:14:03 -0000 1.3
+++ LibraryDisplayer.java 9 Jul 2003 11:24:31 -0000 1.4
@@ -66,8 +66,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
* @version $Revision$ $Date$
*/
-class LibraryDisplayer
-{
+class LibraryDisplayer {
/**
* Display the extensions and specifications contained
* within specified file.
@@ -76,8 +75,7 @@
* @throws BuildException if fail to read file
*/
void displayLibrary( final File file )
- throws BuildException
- {
+ throws BuildException {
final Manifest manifest = ExtensionUtil.getManifest( file );
displayLibrary( file, manifest );
}
@@ -92,18 +90,14 @@
*/
void displayLibrary( final File file,
final Manifest manifest )
- throws BuildException
- {
+ throws BuildException {
final Extension[] available = Extension.getAvailable( manifest );
final Extension[] required = Extension.getRequired( manifest );
final Extension[] options = Extension.getOptions( manifest );
final Specification[] specifications = getSpecifications( manifest );
- if( 0 == available.length &&
- 0 == required.length &&
- 0 == options.length &&
- 0 == specifications.length )
- {
+ if (0 == available.length && 0 == required.length && 0 ==
options.length
+ && 0 == specifications.length) {
return;
}
@@ -112,41 +106,33 @@
printLine( size );
System.out.println( message );
printLine( size );
- if( 0 != available.length )
- {
+ if (0 != available.length) {
System.out.println( "Extensions Supported By Library:" );
- for( int i = 0; i < available.length; i++ )
- {
+ for (int i = 0; i < available.length; i++) {
final Extension extension = available[ i ];
System.out.println( extension.toString() );
}
}
- if( 0 != required.length )
- {
+ if (0 != required.length) {
System.out.println( "Extensions Required By Library:" );
- for( int i = 0; i < required.length; i++ )
- {
+ for (int i = 0; i < required.length; i++) {
final Extension extension = required[ i ];
System.out.println( extension.toString() );
}
}
- if( 0 != options.length )
- {
+ if (0 != options.length) {
System.out.println( "Extensions that will be used by Library if
present:" );
- for( int i = 0; i < options.length; i++ )
- {
+ for (int i = 0; i < options.length; i++) {
final Extension extension = options[ i ];
System.out.println( extension.toString() );
}
}
- if( 0 != specifications.length )
- {
+ if (0 != specifications.length) {
System.out.println( "Specifications Supported By Library:" );
- for( int i = 0; i < specifications.length; i++ )
- {
+ for (int i = 0; i < specifications.length; i++) {
final Specification specification = specifications[ i ];
displaySpecification( specification );
}
@@ -158,10 +144,8 @@
*
* @param size the number of dashes to printout
*/
- private void printLine( final int size )
- {
- for( int i = 0; i < size; i++ )
- {
+ private void printLine(final int size) {
+ for (int i = 0; i < size; i++) {
System.out.print( "-" );
}
System.out.println();
@@ -175,14 +159,10 @@
* @throws BuildException if malformed specification sections
*/
private Specification[] getSpecifications( final Manifest manifest )
- throws BuildException
- {
- try
- {
+ throws BuildException {
+ try {
return Specification.getSpecifications( manifest );
- }
- catch( final ParseException pe )
- {
+ } catch (final ParseException pe) {
throw new BuildException( pe.getMessage(), pe );
}
}
@@ -192,14 +172,11 @@
*
* @param specification the specification
*/
- private void displaySpecification( final Specification specification )
- {
+ private void displaySpecification(final Specification specification) {
final String[] sections = specification.getSections();
- if( null != sections )
- {
+ if (null != sections) {
final StringBuffer sb = new StringBuffer( "Sections: " );
- for( int i = 0; i < sections.length; i++ )
- {
+ for (int i = 0; i < sections.length; i++) {
sb.append( " " );
sb.append( sections[ i ] );
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]