Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1518 - in development/main: magic/bootstrap/src/main/net/dpml/magic/bootstrap magic/core/src/main/net/dpml/magic magic/core/src/main/net/dpml/magic/builder magic/core/src/main/net/dpml/magic/model magic/core/src/main/net/dpml/magic/project magic/core/src/main/net/dpml/magic/tasks metro/activation/impl/src/main/net/dpml/activation/impl metro/activation/providers/avalon/src/main/net/dpml/activation/avalon metro/activation/providers/metro/src/main/net/dpml/activation/metro metro/composition/api/src/main/net/dpml/composition/data metro/composition/api/src/test/net/dpml/composition/data/test metro/composition/impl/src/main/net/dpml/composition/model/impl metro/extension/api/src/main/net/dpml/extension metro/extension/api/src/main/net/dpml/extension/manager metro/extension/impl/src/main/net/dpml/extension/manager/impl metro/logging/providers/log4j/impl/src/main/net/dpml/logging/log4j metro/logging/providers/logkit/api/src/main/net/dpml/logging/logkit metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io metro/main/src/main/net/dpml/metro metro/meta/api/src/main/net/dpml/meta/info metro/meta/api/src/test/net/dpml/meta/info/test metro/meta/impl/src/main/net/dpml/meta/info/builder/impl metro/meta/impl/src/main/net/dpml/meta/info/impl metro/parameters/impl/src/main/net/dpml/parameters/impl metro/system/api/src/main/net/dpml/system metro/system/impl/src/main/net/dpml/system/impl metro/testing/testa/src/main/net/dpml/test/testa metro/util/defaults/src/main/net/dpml/defaults

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: niclas AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1518 - in development/main: magic/bootstrap/src/main/net/dpml/magic/bootstrap magic/core/src/main/net/dpml/magic magic/core/src/main/net/dpml/magic/builder magic/core/src/main/net/dpml/magic/model magic/core/src/main/net/dpml/magic/project magic/core/src/main/net/dpml/magic/tasks metro/activation/impl/src/main/net/dpml/activation/impl metro/activation/providers/avalon/src/main/net/dpml/activation/avalon metro/activation/providers/metro/src/main/net/dpml/activation/metro metro/composition/api/src/main/net/dpml/composition/data metro/composition/api/src/test/net/dpml/composition/data/test metro/composition/impl/src/main/net/dpml/composition/model/impl metro/extension/api/src/main/net/dpml/extension metro/extension/api/src/main/net/dpml/extension/manager metro/extension/impl/src/main/net/dpml/extension/manager/impl metro/logging/providers/log4j/impl/src/main/net/dpml/logging/log4j metro/logging/providers/logkit/api/src/main/net/dpml/logging/logkit metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io metro/main/src/main/net/dpml/metro metro/meta/api/src/main/net/dpml/meta/info metro/meta/api/src/test/net/dpml/meta/info/test metro/meta/impl/src/main/net/dpml/meta/info/builder/impl metro/meta/impl/src/main/net/dpml/meta/info/impl metro/parameters/impl/src/main/net/dpml/parameters/impl metro/system/api/src/main/net/dpml/system metro/system/impl/src/main/net/dpml/system/impl metro/testing/testa/src/main/net/dpml/test/testa metro/util/defaults/src/main/net/dpml/defaults
  • Date: Mon, 17 Jan 2005 18:13:05 +0100

Author: niclas
Date: Mon Jan 17 18:13:05 2005
New Revision: 1518

Modified:

development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/PluginTask.java
development/main/magic/core/src/main/net/dpml/magic/Index.java

development/main/magic/core/src/main/net/dpml/magic/builder/IndexBuilder.java
development/main/magic/core/src/main/net/dpml/magic/model/Definition.java
development/main/magic/core/src/main/net/dpml/magic/model/Info.java
development/main/magic/core/src/main/net/dpml/magic/model/Resource.java
development/main/magic/core/src/main/net/dpml/magic/project/Context.java

development/main/magic/core/src/main/net/dpml/magic/tasks/InitializeTask.java

development/main/metro/activation/impl/src/main/net/dpml/activation/impl/AbstractAppliance.java

development/main/metro/activation/impl/src/main/net/dpml/activation/impl/BlockInvocationHandler.java

development/main/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultRuntime.java

development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/AbstractAppliance.java

development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/ApplianceInvocationHandler.java

development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/DefaultComponentFactory.java

development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/DefaultServiceManager.java

development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/AbstractAppliance.java

development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/ApplianceInvocationHandler.java

development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultComponentFactory.java

development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultServiceManager.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/BlockCompositionDirective.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/BlockIncludeDirective.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/ConstructorDirective.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/EntryDirective.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/ImportDirective.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/LibraryDirective.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/Parameter.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/PermissionDirective.java

development/main/metro/composition/api/src/main/net/dpml/composition/data/SecurityProfile.java

development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ConstructorDirectiveTestCase.java

development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ImportDirectiveTestCase.java

development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ParameterTestCase.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/Commissioner.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentContext.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionContext.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionCriteria.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionFactory.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultConstructorModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentContext.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelComponentHelper.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextMap.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDependencyModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDependent.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentContext.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultEntryModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultImportModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultSecurityModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultServiceRepository.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultStageModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/OverrideEntryModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/Scanner.java

development/main/metro/extension/api/src/main/net/dpml/extension/Extension.java

development/main/metro/extension/api/src/main/net/dpml/extension/Specification.java

development/main/metro/extension/api/src/main/net/dpml/extension/manager/OptionalPackage.java

development/main/metro/extension/api/src/main/net/dpml/extension/manager/PackageManager.java

development/main/metro/extension/api/src/main/net/dpml/extension/manager/UnsatisfiedExtensionException.java

development/main/metro/extension/impl/src/main/net/dpml/extension/manager/impl/DefaultExtensionManager.java

development/main/metro/extension/impl/src/main/net/dpml/extension/manager/impl/OptionalPackageComparator.java

development/main/metro/logging/providers/log4j/impl/src/main/net/dpml/logging/log4j/Log4JLoggingFactory.java

development/main/metro/logging/providers/logkit/api/src/main/net/dpml/logging/logkit/Logger.java

development/main/metro/logging/providers/logkit/api/src/main/net/dpml/logging/logkit/Priority.java

development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/DefaultLoggingFactory.java

development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/Hierarchy.java

development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/AbstractTarget.java

development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io/FileTarget.java

development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io/StreamTarget.java

development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io/WriterTarget.java
development/main/metro/main/src/main/net/dpml/metro/Metro.java

development/main/metro/meta/api/src/main/net/dpml/meta/info/CategoryDescriptor.java

development/main/metro/meta/api/src/main/net/dpml/meta/info/ContextDescriptor.java

development/main/metro/meta/api/src/main/net/dpml/meta/info/DependencyDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/Descriptor.java

development/main/metro/meta/api/src/main/net/dpml/meta/info/EntryDescriptor.java

development/main/metro/meta/api/src/main/net/dpml/meta/info/ExtensionDescriptor.java

development/main/metro/meta/api/src/main/net/dpml/meta/info/InfoDescriptor.java

development/main/metro/meta/api/src/main/net/dpml/meta/info/PermissionDescriptor.java

development/main/metro/meta/api/src/main/net/dpml/meta/info/ReferenceDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/Service.java

development/main/metro/meta/api/src/main/net/dpml/meta/info/ServiceDescriptor.java

development/main/metro/meta/api/src/main/net/dpml/meta/info/StageDescriptor.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
development/main/metro/meta/api/src/main/net/dpml/meta/info/Version.java

development/main/metro/meta/api/src/test/net/dpml/meta/info/test/EntryDescriptorTestCase.java

development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ExtensionDescriptorTestCase.java

development/main/metro/meta/api/src/test/net/dpml/meta/info/test/InfoDescriptorTestCase.java

development/main/metro/meta/api/src/test/net/dpml/meta/info/test/PermissionDescriptorTestCase.java

development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ReferenceDescriptorTestCase.java

development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ServiceDescriptorTestCase.java

development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ServiceTestCase.java

development/main/metro/meta/api/src/test/net/dpml/meta/info/test/StageDescriptorTestCase.java

development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/TypeBuilder.java

development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLLegacyCreator.java

development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLServiceCreator.java

development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java

development/main/metro/meta/impl/src/main/net/dpml/meta/info/impl/ConfigurationBuilder.java

development/main/metro/parameters/impl/src/main/net/dpml/parameters/impl/DefaultParameters.java

development/main/metro/system/api/src/main/net/dpml/system/SystemException.java

development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContext.java

development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java

development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemCriteria.java

development/main/metro/testing/testa/src/main/net/dpml/test/testa/DefaultFacade.java

development/main/metro/util/defaults/src/main/net/dpml/defaults/DefaultsBuilder.java
Log:
Changed all NullPointerException to NullArgumentException in Metro, and some
formatting along the way.

Modified:
development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/PluginTask.java
==============================================================================
---
development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/PluginTask.java
(original)
+++
development/main/magic/bootstrap/src/main/net/dpml/magic/bootstrap/PluginTask.java
Mon Jan 17 18:13:05 2005
@@ -18,14 +18,20 @@
package net.dpml.magic.bootstrap;

import java.io.InputStream;
+
import java.net.URI;
+
import java.util.List;
import java.util.ArrayList;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.transit.TransitException;
+
import net.dpml.transit.repository.Repository;
import net.dpml.transit.repository.StandardLoader;
import net.dpml.transit.repository.Plugin;
+
import net.dpml.transit.util.ElementHelper;

import org.apache.tools.ant.BuildException;
@@ -44,7 +50,7 @@
*/
public class PluginTask extends org.apache.tools.ant.Task
{
- private static final Repository REPOSITORY = setupRepository();
+ private static final Repository REPOSITORY;

/**
* The uri of the plugin to load.
@@ -76,6 +82,12 @@
*/
private boolean m_flag = false;

+ /** Static initialization sets up the Repository. */
+ static
+ {
+ REPOSITORY = setupRepository();
+ }
+
/**
* Create and associate a new antlib urn entry with the plugin.
* @return the new antlib entry
@@ -134,9 +146,9 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Cound not convert the supplied uri spec ["
- + m_uri
+ + m_uri
+ "] to a formal URI.";
throw new BuildException( error, e );
}
@@ -252,23 +264,23 @@
* @param antlib the antlib to load
* @exception Exception if it doesn't work out
*/
- private void loadAntlib(
+ private void loadAntlib(
URI uri, ClassLoader classloader, ComponentHelper helper, Antlib
antlib ) throws Exception
{
Plugin descriptor = getRepository().getPluginDescriptor( uri );
- String resource = antlib.getPath();
+ String resource = antlib.getPath();
if( null == resource )
{
resource = descriptor.getResource();
}
if( null == resource )
{
- final String error =
+ final String error =
"Resource path for the antlib is not declared in the plugin
descriptor "
+ "or antlib directive ["
- + uri
+ + uri
+ "]";
- throw new BuildException( error );
+ throw new BuildException( error );
}

String urn = antlib.getURN();
@@ -278,12 +290,12 @@
}
if( null == urn )
{
- final String error =
+ final String error =
"URN for the antlib is not declared in the plugin descriptor "
+ "or antlib directive ["
- + uri
+ + uri
+ "]";
- throw new BuildException( error );
+ throw new BuildException( error );
}

InputStream input = classloader.getResourceAsStream( resource );
@@ -317,7 +329,7 @@
* @exception BuildException if an error occurs while attempting to load
the task
*/
private void loadTaskDef( ClassLoader loader, ComponentHelper helper,
String classname, String name )
- throws BuildException
+ throws BuildException
{
if( getProject().getTaskDefinitions().get( name ) != null )
{
@@ -349,7 +361,7 @@
* @exception BuildException if an error occurs while attempting to load
the task
*/
private void loadTypeDef( ClassLoader loader, ComponentHelper helper,
String classname, String name )
- throws BuildException
+ throws BuildException
{
if( getProject().getDataTypeDefinitions().get( name ) != null )
{
@@ -523,7 +535,7 @@

/**
* Return the antlib resource path.
- * @return the path (possibly null in which case the resource
reference
+ * @return the path (possibly null in which case the resource
reference
* must exist in the polugin descriptor)
*/
public String getPath() throws BuildException
@@ -534,10 +546,6 @@

private static Repository getRepository()
{
- if( null == REPOSITORY )
- {
- throw new NullPointerException( "REPOSITORY" );
- }
return REPOSITORY;
}


Modified: development/main/magic/core/src/main/net/dpml/magic/Index.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/Index.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/Index.java Mon
Jan 17 18:13:05 2005
@@ -26,9 +26,12 @@
import java.util.ArrayList;
import java.util.Hashtable;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.magic.builder.ElementHelper;
import net.dpml.magic.builder.IndexBuilder;
import net.dpml.magic.builder.XMLDefinitionBuilder;
+
import net.dpml.magic.model.Definition;
import net.dpml.magic.model.Resource;
import net.dpml.magic.model.ResourceRef;
@@ -36,7 +39,9 @@

import net.dpml.transit.Transit;
import net.dpml.transit.TransitException;
+
import net.dpml.transit.artifact.Handler;
+
import net.dpml.transit.repository.Repository;
import net.dpml.transit.repository.StandardLoader;

@@ -91,17 +96,28 @@
* @param project the ant project establishing the home
* @param system the magic system instance
* @param index the magic project index
+ * @exception NullArgumentException if any of the supplied arguments are
null.
*/
public Index( Project project, IndexBuilder system, File index )
- throws TransitException
+ throws TransitException, NullArgumentException
{
- setProject( project );
+ if( null == project )
+ {
+ throw new NullArgumentException( "project" );
+ }
+
+ if( null == system )
+ {
+ throw new NullArgumentException( "system" );
+ }

if( null == index )
{
- throw new NullPointerException( "index" );
+ throw new NullArgumentException( "index" );
}

+ setProject( project );
+
if( !index.exists() )
{
throw new BuildException(
@@ -477,7 +493,7 @@
throw new BuildException( e, new Location( source.toString() ) );
}
}
-
+
private void buildIndex( Element root, File source, String uri )
{
//
@@ -488,7 +504,7 @@
final File anchor = source.getParentFile();
buildLocalList( anchor, elements, uri );
}
-
+
private void buildModule( Element root, File source, String uri )
{
//
@@ -499,11 +515,11 @@
final String moduleUri = ElementHelper.getAttribute( root, "uri" );
if( "".equals( moduleUri ) )
{
- String mess =
+ String mess =
"Modules must contain a \"uri\" attribute in the root module
element: " + source;
throw new BuildException( mess );
}
-
+
Info info = Info.create( moduleUri );
String key = info.getName();
Resource resource = new Resource( this, key, info, new
ResourceRef[0], null );

Modified:
development/main/magic/core/src/main/net/dpml/magic/builder/IndexBuilder.java
==============================================================================
---
development/main/magic/core/src/main/net/dpml/magic/builder/IndexBuilder.java
(original)
+++
development/main/magic/core/src/main/net/dpml/magic/builder/IndexBuilder.java
Mon Jan 17 18:13:05 2005
@@ -17,7 +17,10 @@

package net.dpml.magic.builder;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.magic.Index;
+
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.DataType;
@@ -185,7 +188,7 @@
return traverse( parent );
return null;
}
-
+
/* Niclas: Never used.
private static String getTemplatePath( File system )
{
@@ -218,18 +221,26 @@
* @param path the absolute or relative file path
* @param create flag to indicate creation policy if the file does not
exists
* @return the file instance
+ * @throws NullArgumentException if the path argument is null, or if the
path
+ * argument is not an absolute path and the root argument is null.
*/
public static File getFile( final File root, final String path, boolean
create )
+ throws NullArgumentException
{
if( null == path )
{
- throw new NullPointerException( "path" );
+ throw new NullArgumentException( "path" );
}
final File file = new File( path );
- if( file.isAbsolute() ) return getCanonicalFile( file, create );
+
+ if( file.isAbsolute() )
+ {
+ return getCanonicalFile( file, create );
+ }
+
if( null == root )
{
- throw new NullPointerException( "root" );
+ throw new NullArgumentException( "root" );
}
return getCanonicalFile( new File( root, path ), create );
}

Modified:
development/main/magic/core/src/main/net/dpml/magic/model/Definition.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/model/Definition.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/model/Definition.java
Mon Jan 17 18:13:05 2005
@@ -17,7 +17,10 @@

package net.dpml.magic.model;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.magic.Index;
+
import org.apache.tools.ant.Location;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Path;
@@ -124,12 +127,14 @@
* the path corresponds to external resource reference path entries.
*
* @return the classpath
+ * @exception NullArgumentException if the supplied project argument is
null.
*/
public Path getClassPath( Project project )
+ throws NullArgumentException
{
if( null == project )
{
- throw new NullPointerException( "project" );
+ throw new NullArgumentException( "project" );
}

Path path = getPath( project, Policy.BUILD );

Modified: development/main/magic/core/src/main/net/dpml/magic/model/Info.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/model/Info.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/model/Info.java Mon
Jan 17 18:13:05 2005
@@ -17,6 +17,8 @@

package net.dpml.magic.model;

+import net.dpml.lang.NullArgumentException;
+
import org.apache.tools.ant.BuildException;

/**
@@ -377,8 +379,9 @@
//-------------------------------------------------------------------

private void assertNotNull( final String key, final Object object )
+ throws NullArgumentException
{
- if( null == object ) throw new NullPointerException( key );
+ if( null == object ) throw new NullArgumentException( key );
}

private static int getGroupIndex( final String id )

Modified:
development/main/magic/core/src/main/net/dpml/magic/model/Resource.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/model/Resource.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/model/Resource.java
Mon Jan 17 18:13:05 2005
@@ -17,9 +17,12 @@

package net.dpml.magic.model;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.magic.Index;
import net.dpml.magic.UnknownResourceException;
import net.dpml.transit.artifact.Handler;
+
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Path;
@@ -157,12 +160,14 @@
/**
* Returns a path of artifact filenames relative to the supplied scope.
* The mode may be one of ANY, BUILD, TEST or RUNTIME.
+ * @exception NullArgumentException if the supplied project argument is
null.
*/
public Path getPath( final Project project, final int mode, String
filter )
+ throws NullArgumentException
{
if( null == project )
{
- throw new NullPointerException( "project" );
+ throw new NullArgumentException( "project" );
}

final Path path = new Path( project );
@@ -176,7 +181,7 @@
final Resource resource = getResource( project, ref );
Info info = resource.getInfo();
String type = info.getType();
- if( ( "*".equals( filter ) || filter.equals( type ) )
+ if( ( "*".equals( filter ) || filter.equals( type ) )
&& !"".equals( type ) & !"theme".equals( type ) )
{
final File file = resource.getArtifact( project );
@@ -320,7 +325,7 @@

final ResourceRef[] refs = getResourceRefs();
final ResourceRef[] references = def.getResourceRefs();
-
+
if( refs.length != references.length )
{
return false;

Modified:
development/main/magic/core/src/main/net/dpml/magic/project/Context.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/project/Context.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/project/Context.java
Mon Jan 17 18:13:05 2005
@@ -18,10 +18,13 @@

package net.dpml.magic.project;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.magic.Index;
import net.dpml.magic.UnknownResourceException;
import net.dpml.magic.builder.IndexBuilder;
import net.dpml.magic.model.Definition;
+
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Property;
@@ -272,10 +275,11 @@
}

public File getDeliverablesDirectory( String type )
+ throws NullArgumentException
{
if( null == type )
{
- throw new NullPointerException( "type" );
+ throw new NullArgumentException( "type" );
}
else
{

Modified:
development/main/magic/core/src/main/net/dpml/magic/tasks/InitializeTask.java
==============================================================================
---
development/main/magic/core/src/main/net/dpml/magic/tasks/InitializeTask.java
(original)
+++
development/main/magic/core/src/main/net/dpml/magic/tasks/InitializeTask.java
Mon Jan 17 18:13:05 2005
@@ -18,7 +18,8 @@
package net.dpml.magic.tasks;

import java.net.URI;
-import java.net.*;
+
+import net.dpml.lang.NullArgumentException;

import net.dpml.magic.model.Definition;
import net.dpml.magic.model.Resource;
@@ -57,11 +58,12 @@
}
}

- private void loadPlugin( String spec ) throws BuildException
+ private void loadPlugin( String spec )
+ throws BuildException, NullArgumentException
{
if( null == spec )
{
- throw new NullPointerException( "spec" );
+ throw new NullArgumentException( "spec" );
}
log( "loading: " + spec );
try

Modified:
development/main/metro/activation/impl/src/main/net/dpml/activation/impl/AbstractAppliance.java
==============================================================================
---
development/main/metro/activation/impl/src/main/net/dpml/activation/impl/AbstractAppliance.java
(original)
+++
development/main/metro/activation/impl/src/main/net/dpml/activation/impl/AbstractAppliance.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -22,6 +22,8 @@

import net.dpml.composition.model.DeploymentModel;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;

/**
@@ -44,10 +46,11 @@
//-------------------------------------------------------------------

public AbstractAppliance( DeploymentModel model )
+ throws NullArgumentException
{
- if( null == model )
+ if( null == model )
{
- throw new NullPointerException( "model" );
+ throw new NullArgumentException( "model" );
}

m_model = model;
@@ -59,14 +62,14 @@
//-------------------------------------------------------------------

/**
- * Commission the appliance.
+ * Commission the appliance.
*
* @exception Exception if a commissioning error occurs
*/
public abstract void commission() throws Exception;

/**
- * Decommission the appliance. Once an appliance is
+ * Decommission the appliance. Once an appliance is
* decommissioned it may be re-commissioned.
*/
public abstract void decommission();
@@ -85,8 +88,8 @@

/**
* Request resolution of an object from the runtime.
- * @param proxy if TRUE the return value will be proxied if the
- * underlying component typoe suppports proxy representation
+ * @param proxy if TRUE the return value will be proxied if the
+ * underlying component typoe suppports proxy representation
* @exception Exception if a deployment error occurs
*/
public abstract Object resolve( boolean proxy ) throws Exception;

Modified:
development/main/metro/activation/impl/src/main/net/dpml/activation/impl/BlockInvocationHandler.java
==============================================================================
---
development/main/metro/activation/impl/src/main/net/dpml/activation/impl/BlockInvocationHandler.java
(original)
+++
development/main/metro/activation/impl/src/main/net/dpml/activation/impl/BlockInvocationHandler.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -33,6 +33,8 @@
import net.dpml.composition.model.ServiceModel;
import net.dpml.composition.model.Reclaimer;

+import net.dpml.lang.NullArgumentException;
+
/**
* This makes a dynamic proxy for an object. The object can be represented
* by one, some or all of it's interfaces.
@@ -46,14 +48,13 @@
* Create a proxy invocation handler.
*
* @param block the underlying block implementation
- * @exception Exception if an invocation handler establishment error
occurs
*/
protected BlockInvocationHandler( final DefaultBlock block )
- throws Exception
+ throws Exception, NullArgumentException
{
if( block == null )
{
- throw new NullPointerException( "block" );
+ throw new NullArgumentException( "block" );
}

m_block = block;
@@ -67,15 +68,19 @@
* @param method the method invoked on proxy object
* @param args the arguments supplied to method
* @return the return value of method
- * @throws Throwable if an error occurs
*/
- public Object invoke( final Object proxy,
- final Method method,
- final Object[] args )
- throws Throwable
+ public Object invoke( final Object proxy, final Method method, Object[]
args )
+ throws Throwable, NullArgumentException
{
- if( proxy == null ) throw new NullPointerException( "proxy" );
- if( method == null ) throw new NullPointerException( "method" );
+ if( proxy == null )
+ {
+ throw new NullArgumentException( "proxy" );
+ }
+
+ if( method == null )
+ {
+ throw new NullArgumentException( "method" );
+ }

final ContainmentModel model = m_block.getContainmentModel();
Class source = method.getDeclaringClass();
@@ -83,13 +88,13 @@
ServiceModel service = model.getServiceModel( source );
if( null == service )
{
- final String error =
- "Unable to resolve an provider for the class ["
- + source.getName()
- + "].";
+ final String error =
+ "Unable to resolve an provider for the class ["
+ + source.getName()
+ + "].";
throw new IllegalStateException( error );
}
-
+
DeploymentModel provider = service.getServiceProvider();

//
@@ -107,7 +112,7 @@
{
Throwable cause = e.getUndeclaredThrowable();
if( cause != null ) throw cause;
- final String error =
+ final String error =
"Delegation error raised by: " + m_block;
throw new ApplianceException( error, e );
}
@@ -115,14 +120,14 @@
{
Throwable cause = e.getTargetException();
if( cause != null ) throw cause;
- final String error =
+ final String error =
"Delegation error raised by: " + m_block;
throw new ApplianceException( error, e );
}
catch( Throwable e )
{
final String error =
- "Composite service resolution failure for the class: '"
+ "Composite service resolution failure for the class: '"
+ method.getDeclaringClass()
+ "' for operation: '" + method.getName()
+ "' in appliance: " + m_block;
@@ -131,10 +136,10 @@
}

/**
- * Locate a service reference and cache it locally for the
+ * Locate a service reference and cache it locally for the
* lifetime of the invocation handler.
- *
- * @param provider the deployment model
+ *
+ * @param provider the deployment model
* @return a cached service reference
* @exception Exception if something unexpected happens
*/
@@ -150,7 +155,7 @@
/**
* Finalization of the invocation handler during which
* we release any cached service references.
- *
+ *
* @exception Throwable if an error occurs
*/
protected void finalize() throws Throwable
@@ -161,10 +166,10 @@
Object instance = objects[i];
if( Proxy.isProxyClass( instance.getClass() ) )
{
- InvocationHandler handler =
+ InvocationHandler handler =
Proxy.getInvocationHandler( instance );
if( handler instanceof Reclaimer )
- {
+ {
Reclaimer source = (Reclaimer) handler;
source.release();
}

Modified:
development/main/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultRuntime.java
==============================================================================
---
development/main/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultRuntime.java
(original)
+++
development/main/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultRuntime.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -32,7 +32,10 @@
import net.dpml.composition.model.DeploymentModel;
import net.dpml.composition.provider.Runtime;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.transit.artifact.Artifact;
+
import net.dpml.system.SystemContext;

/**
@@ -50,7 +53,7 @@
private static final String METRO_RUNTIME =
"@METRO-RUNTIME-PROVIDER-SPEC@";

- private static final String AVALON_RUNTIME =
+ private static final String AVALON_RUNTIME =
"@AVALON-RUNTIME-PROVIDER-SPEC@";

//--------------------------------------------------------------
@@ -75,12 +78,14 @@
* Creation of a new system context.
*
* @param system the system context
+ * @exception NullArgumentException if the system argument is null.
*/
public DefaultRuntime( SystemContext system )
+ throws NullArgumentException
{
if( system == null )
{
- throw new NullPointerException( "system" );
+ throw new NullArgumentException( "system" );
}
m_system = system;
m_factory = new BlockFactory();
@@ -91,20 +96,21 @@
//--------------------------------------------------------------

/**
- * Request the commissioning of a runtime for a supplied deployment
+ * Request the commissioning of a runtime for a supplied deployment
* model.
- * @param model the deployment model
+ * @param model the deployment model
* @exception Exception of a commissioning error occurs
*/
- public void commission( DeploymentModel model ) throws Exception
+ public void commission( DeploymentModel model )
+ throws Exception
{
getRuntimeFactory( model ).getRuntime( model ).commission();
}

/**
- * Request the decommissioning of a runtime for a supplied deployment
+ * Request the decommissioning of a runtime for a supplied deployment
* model.
- * @param model the deployment model
+ * @param model the deployment model
*/
public void decommission( DeploymentModel model )
{
@@ -116,7 +122,8 @@
* @param model the deployment model
* @exception Exception if a deployment error occurs
*/
- public Object resolve( DeploymentModel model ) throws Exception
+ public Object resolve( DeploymentModel model )
+ throws Exception
{
return getRuntimeFactory( model ).getRuntime( model ).resolve();
}
@@ -124,11 +131,12 @@
/**
* Request resolution of an object from the runtime.
* @param model the deployment model
- * @param proxy if TRUE the return value will be proxied if the
- * underlying component typoe suppports proxy representation
+ * @param proxy if TRUE the return value will be proxied if the
+ * underlying component typoe suppports proxy representation
* @exception Exception if a deployment error occurs
*/
- public Object resolve( DeploymentModel model, boolean proxy ) throws
Exception
+ public Object resolve( DeploymentModel model, boolean proxy )
+ throws Exception
{
return getRuntimeFactory( model ).getRuntime( model ).resolve( proxy
);
}
@@ -172,7 +180,7 @@
}
}

- private RuntimeFactory getMetroRuntimeFactory()
+ private RuntimeFactory getMetroRuntimeFactory()
{
if( null != m_metro )
{
@@ -190,7 +198,7 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Bugger, bugger, bugger";
throw new LifestyleRuntimeException( error, e );
}
@@ -215,7 +223,7 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Bugger, bugger, bugger";
throw new LifestyleRuntimeException( error, e );
}

Modified:
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/AbstractAppliance.java
==============================================================================
---
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/AbstractAppliance.java
(original)
+++
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/AbstractAppliance.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -22,6 +22,8 @@

import net.dpml.composition.model.DeploymentModel;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;

/**
@@ -44,10 +46,11 @@
//-------------------------------------------------------------------

public AbstractAppliance( DeploymentModel model )
+ throws NullArgumentException
{
- if( null == model )
+ if( null == model )
{
- throw new NullPointerException( "model" );
+ throw new NullArgumentException( "model" );
}

m_model = model;
@@ -59,14 +62,14 @@
//-------------------------------------------------------------------

/**
- * Commission the appliance.
+ * Commission the appliance.
*
* @exception Exception if a commissioning error occurs
*/
public abstract void commission() throws Exception;

/**
- * Decommission the appliance. Once an appliance is
+ * Decommission the appliance. Once an appliance is
* decommissioned it may be re-commissioned.
*/
public abstract void decommission();
@@ -85,8 +88,8 @@

/**
* Request resolution of an object from the runtime.
- * @param proxy if TRUE the return value will be proxied if the
- * underlying component typoe suppports proxy representation
+ * @param proxy if TRUE the return value will be proxied if the
+ * underlying component typoe suppports proxy representation
* @exception Exception if a deployment error occurs
*/
public abstract Object resolve( boolean proxy ) throws Exception;

Modified:
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/ApplianceInvocationHandler.java
==============================================================================
---
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/ApplianceInvocationHandler.java
(original)
+++
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/ApplianceInvocationHandler.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -33,6 +33,8 @@
import net.dpml.composition.model.TransientRuntimeException;
import net.dpml.composition.model.Reclaimer;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;

/**
@@ -42,7 +44,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id$
*/
-public final class ApplianceInvocationHandler
+public final class ApplianceInvocationHandler
implements InvocationHandler, Reclaimer
{
//-------------------------------------------------------------------
@@ -69,14 +71,15 @@
* Create a proxy invocation handler.
*
* @param appliance the runtime appliance
- * @param logger the assigned logging channel
+ * @param logger the assigned logging channel
*/
- ApplianceInvocationHandler(
- DefaultAppliance appliance, Logger logger, boolean secure )
+ ApplianceInvocationHandler(
+ DefaultAppliance appliance, Logger logger, boolean secure )
+ throws NullArgumentException
{
- assertNotNull( appliance, "appliance" );
- assertNotNull( logger, "logger" );
-
+ assertNotNull( appliance, "appliance" );
+ assertNotNull( logger, "logger" );
+
m_appliance = appliance;
m_logger = logger;
m_secure = secure;
@@ -95,35 +98,42 @@
* @param method the method invoked on proxy object
* @param args the arguments supplied to method
* @return the return value of method
- * @throws Throwable if an error occurs
*/
- public Object invoke( final Object proxy,
- final Method method,
- final Object[] args )
- throws Throwable
- {
- if( proxy == null )
- throw new NullPointerException( "proxy" );
- if( method == null )
- throw new NullPointerException( "method" );
- if( m_destroyed )
- throw new IllegalStateException( "destroyed" );
+ public Object invoke( final Object proxy, final Method method, final
Object[] args )
+ throws Throwable, NullArgumentException
+ {
+ if( proxy == null )
+ {
+ throw new NullArgumentException( "proxy" );
+ }
+
+ if( method == null )
+ {
+ throw new NullPointerException( "method" );
+ }
+
+ if( m_destroyed )
+ {
+ throw new IllegalStateException( "destroyed" );
+ }

try
{
final Object instance = getInstance();
-
+
if( m_secure )
{
- return AccessController.doPrivileged(
- new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return method.invoke( instance, args );
- }
- },
- m_model.getAccessControlContext() );
+ return AccessController.doPrivileged
+ (
+ new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return method.invoke( instance, args );
+ }
+ },
+ m_model.getAccessControlContext()
+ );
}
else
{
@@ -145,9 +155,9 @@
if( !m_destroyed )
{
m_destroyed = true;
- final String message =
- "Releasing component ["
- + System.identityHashCode( m_instance ) + "] ("
+ final String message =
+ "Releasing component ["
+ + System.identityHashCode( m_instance ) + "] ("
+ m_appliance.toString()
+ ").";
getLogger().debug( message );
@@ -163,9 +173,9 @@
{
if( !m_destroyed && ( null != m_instance ) )
{
- final String message =
- "Finalizing proxy ["
- + System.identityHashCode( m_instance ) + "] ("
+ final String message =
+ "Finalizing proxy ["
+ + System.identityHashCode( m_instance ) + "] ("
+ m_appliance.toString()
+ ").";
getLogger().debug( message );
@@ -187,21 +197,21 @@

private Throwable handleInvocationThrowable( Throwable e )
{
- final String error =
- "Delegation error raised by component: "
+ final String error =
+ "Delegation error raised by component: "
+ m_appliance.toString();
while( true )
{
if( e instanceof TransientApplianceException )
{
- TransientApplianceException t =
+ TransientApplianceException t =
(TransientApplianceException) e;
- return new TransientRuntimeException(
+ return new TransientRuntimeException(
t.getMessage(), t.getDelay() );
}
else if( e instanceof UndeclaredThrowableException )
{
- Throwable cause =
+ Throwable cause =
((UndeclaredThrowableException)
e).getUndeclaredThrowable();
if( cause == null )
return new ApplianceException( error, e );
@@ -209,7 +219,7 @@
}
else if( e instanceof InvocationTargetException )
{
- Throwable cause =
+ Throwable cause =
((InvocationTargetException) e).getTargetException();
if( cause == null )
return new ApplianceException( error, e );
@@ -217,7 +227,7 @@
}
else if( e instanceof PrivilegedActionException )
{
- Throwable cause =
+ Throwable cause =
((PrivilegedActionException) e).getException();
if( cause == null )
return new ApplianceException( error, e );
@@ -232,10 +242,11 @@
}

private void assertNotNull( Object object, String key )
+ throws NullArgumentException
{
if( null == object )
{
- throw new NullPointerException( key );
+ throw new NullArgumentException( key );
}
}
}

Modified:
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/DefaultComponentFactory.java
==============================================================================
---
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/DefaultComponentFactory.java
(original)
+++
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/DefaultComponentFactory.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -23,20 +23,30 @@

import net.dpml.activation.ComponentFactory;
import net.dpml.activation.LifecycleException;
+
import net.dpml.composition.model.ComponentModel;
import net.dpml.composition.model.ContextModel;
import net.dpml.composition.model.DeploymentModel;
import net.dpml.composition.model.LifecycleCreateExtension;
import net.dpml.composition.model.LifecycleDestroyExtension;
import net.dpml.composition.model.StageModel;
+
import net.dpml.configuration.Configuration;
+
import net.dpml.context.Context;
import net.dpml.context.impl.DefaultContext;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.meta.info.StageDescriptor;
+
import net.dpml.parameters.Parameters;
+
import net.dpml.service.ServiceManager;

import org.apache.avalon.lifecycle.Creator;
@@ -48,7 +58,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id$
*/
-public class DefaultComponentFactory
+public class DefaultComponentFactory
implements ComponentFactory
{
//-------------------------------------------------------------------
@@ -56,7 +66,7 @@
//-------------------------------------------------------------------

private static final Resources REZ =
- ResourceManager.getPackageResources(
+ ResourceManager.getPackageResources(
DefaultComponentFactory.class );

//-------------------------------------------------------------------
@@ -81,7 +91,7 @@

if( model.isCodeSecurityEnabled() )
{
- final String error =
+ final String error =
"Code security is not supported under the avalon runtime.";
throw new IllegalArgumentException( error );
}
@@ -100,7 +110,7 @@
public Object incarnate() throws LifecycleException
{
ClassLoader current = Thread.currentThread().getContextClassLoader();
- ClassLoader classloader =
+ ClassLoader classloader =
m_model.getDeploymentClass().getClassLoader();
Thread.currentThread().setContextClassLoader( classloader );

@@ -108,7 +118,7 @@
{
return incarnation();
}
- finally
+ finally
{
Thread.currentThread().setContextClassLoader( current );
}
@@ -122,7 +132,7 @@
{
if( getLogger().isDebugEnabled() )
{
- final String message =
+ final String message =
"etherialization";
getLogger().debug( message );
}
@@ -148,7 +158,7 @@
{
if( getLogger().isWarnEnabled() )
{
- final String warning =
+ final String warning =
"Ignoring component source shutdown error.";
getLogger().warn( warning, e );
}
@@ -166,7 +176,7 @@
{
if( getLogger().isWarnEnabled() )
{
- final String warning =
+ final String warning =
"Ignoring component source disposal error.";
getLogger().warn( warning, e );
}
@@ -196,7 +206,7 @@
{
if( getLogger().isDebugEnabled() )
{
- final String message =
+ final String message =
"incarnation";
getLogger().debug( message );
}
@@ -209,8 +219,8 @@
final Object context = getTargetContext();
final Class contextClass = getContextCastingClass();

- final Object instance =
- instantiate(
+ final Object instance =
+ instantiate(
clazz, logger, config, params, context, contextClass, manager );

try
@@ -276,9 +286,9 @@
}
catch( Throwable e )
{
- final String error =
- REZ.getString(
- "lifestyle.error.new",
+ final String error =
+ REZ.getString(
+ "lifestyle.error.new",
m_model.getQualifiedName() );
throw new LifecycleException( error, e );
}
@@ -304,9 +314,9 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Could not load the custom context casting class ["
- + casting
+ + casting
+ "].";
throw new LifecycleException( error, e );
}
@@ -349,9 +359,9 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Could not load the custom context implementation class ["
- + classname
+ + classname
+ "].";
throw new LifecycleException( error, e );
}
@@ -384,7 +394,7 @@

/**
* Creates a component context instance.
- *
+ *
* @param clazz the type of context to be created.
* @param map the configuration of the context.
*
@@ -397,12 +407,12 @@
throws LifecycleException
{
Context c = new DefaultContext( map );
- org.apache.avalon.framework.context.Context context =
+ org.apache.avalon.framework.context.Context context =
new AvalonContext( c );

//
- // its a custom context object so we need to create it
- // using the classic context object as the constructor
+ // its a custom context object so we need to create it
+ // using the classic context object as the constructor
// argument
//

@@ -429,7 +439,7 @@

/**
* Creates a component context instance.
- *
+ *
* @param clazz the type of context to be created.
* @param map the configuration of the context.
* @return the context object compliant with the context casting
@@ -441,8 +451,8 @@
throws LifecycleException
{
//
- // its a custom context object so we need to create it
- // using the classic context object as the constructor
+ // its a custom context object so we need to create it
+ // using the classic context object as the constructor
// argument
//

@@ -467,10 +477,10 @@
}


- private Object instantiate(
- Class clazz, Logger logger, Configuration config, Parameters params,
- Object context, Class contextClass, ServiceManager manager )
- throws LifecycleException
+ private Object instantiate(
+ Class clazz, Logger logger, Configuration config, Parameters
params,
+ Object context, Class contextClass, ServiceManager manager )
+ throws LifecycleException, NullArgumentException
{
Constructor constructor = getConstructor( clazz );

@@ -483,7 +493,7 @@
{
if( null == logger )
{
- throw new NullPointerException( "logger" );
+ throw new NullArgumentException( "logger" );
}
args[i] = new AvalonLogger( logger );
}
@@ -491,7 +501,7 @@
{
if( null == context )
{
- throw new NullPointerException( "context" );
+ throw new NullArgumentException( "context" );
}
args[i] = context;
}
@@ -499,7 +509,7 @@
{
if( null == config )
{
- throw new NullPointerException( "config" );
+ throw new NullArgumentException( "config" );
}
args[i] = new AvalonConfiguration( config );
}
@@ -507,23 +517,23 @@
{
if( null == params )
{
- throw new NullPointerException( "params" );
+ throw new NullArgumentException( "params" );
}
- args[i] = new AvalonParameters( params );
+ args[i] = new AvalonParameters( params );
}
else if(
org.apache.avalon.framework.service.ServiceManager.class.isAssignableFrom( c
) )
{
if( null == manager )
{
- throw new NullPointerException( "manager" );
+ throw new NullArgumentException( "manager" );
}
args[i] = new AvalonServiceManager( manager );
}
else
{
- final String error =
- REZ.getString(
- "lifecycle.error.unrecognized-parameter",
+ final String error =
+ REZ.getString(
+ "lifecycle.error.unrecognized-parameter",
c.getName(),
clazz.getName() );
throw new LifecycleException( error );
@@ -540,11 +550,11 @@
private Constructor getConstructor( Class clazz ) throws
LifecycleException
{
Constructor[] constructors = clazz.getConstructors();
- if( constructors.length < 1 )
+ if( constructors.length < 1 )
{
- final String error =
- REZ.getString(
- "lifecycle.error.no-constructor",
+ final String error =
+ REZ.getString(
+ "lifecycle.error.no-constructor",
clazz.getName() );
throw new LifecycleException( error );
}
@@ -552,9 +562,9 @@
if( constructors.length > 1 )
{
//
- // we risk conflicting with an object designed for 4.1.2 or
+ // we risk conflicting with an object designed for 4.1.2 or
// earlier that has a null arg constructor - so if this class
- // has a null arg constructor then invoke it, otherwise we
+ // has a null arg constructor then invoke it, otherwise we
// we are dealing with an ambigouse object
//

@@ -567,7 +577,7 @@
final String error =
"Multiple constructor ambiguity in the component model "
+ m_model
- + ". The component class [" + clazz.getName()
+ + ". The component class [" + clazz.getName()
+ "] declares "
+ constructors.length
+ " public constructors.";
@@ -581,30 +591,30 @@
}

/**
- * Instantiation of a component instance using a supplied constructor
+ * Instantiation of a component instance using a supplied constructor
* and arguments.
- *
+ *
* @param constructor the component constructor
* @param args the constructor arguments
* @return the component instance
* @exception LifecycleException if an instantiation error occurs
*/
- private Object instantiateComponent(
- final Constructor constructor, final Object[] args )
+ private Object instantiateComponent(
+ final Constructor constructor, final Object[] args )
throws LifecycleException
{
try
{
if( args.length == 0 )
{
- getLogger().debug(
+ getLogger().debug(
"instantiating component with a null constructor" );
}
else
{
int n = args.length;
- getLogger().debug(
- "instantiating component with "
+ getLogger().debug(
+ "instantiating component with "
+ n + " arguments." );
}

@@ -613,15 +623,15 @@
catch( Throwable e )
{
Class clazz = constructor.getDeclaringClass();
- final String error =
- REZ.getString(
- "lifecycle.error.instantiation",
+ final String error =
+ REZ.getString(
+ "lifecycle.error.instantiation",
clazz.getName() );
throw new LifecycleException( error, e );
}
}

- private void applyCreateStage( Object instance, boolean flag )
+ private void applyCreateStage( Object instance, boolean flag )
throws LifecycleException
{
StageDescriptor[] stages = m_model.getType().getStages();
@@ -642,7 +652,7 @@
getLogger().debug( "processing create: " + c.getName() );

Creator handler = getCreator( provider );
- org.apache.avalon.framework.context.Context context =
+ org.apache.avalon.framework.context.Context context =
(org.apache.avalon.framework.context.Context)
getTargetContext();

try
@@ -677,8 +687,8 @@
}
catch( Throwable e )
{
- final String error =
- REZ.getString(
+ final String error =
+ REZ.getString(
"lifecycle.error.stage.creator", stage.getKey() );
if( flag )
{
@@ -697,7 +707,7 @@

if( flag && LifecycleCreateExtension.class.isAssignableFrom( c )
)
{
- LifecycleCreateExtension handler =
+ LifecycleCreateExtension handler =
getLifecycleCreateExtension( provider );

try
@@ -722,7 +732,7 @@
}
else if( !flag &&
LifecycleDestroyExtension.class.isAssignableFrom( c ) )
{
- LifecycleDestroyExtension handler =
+ LifecycleDestroyExtension handler =
getLifecycleDestroyExtension( provider );

try
@@ -738,7 +748,7 @@
{
if( getLogger().isWarnEnabled() )
{
- final String error =
+ final String error =
"Ignoring destroy stage error";
getLogger().warn( error, e );
}
@@ -751,7 +761,7 @@
}
}

- private org.apache.avalon.lifecycle.Creator getCreator( DeploymentModel
provider )
+ private org.apache.avalon.lifecycle.Creator getCreator( DeploymentModel
provider )
throws LifecycleException
{
try
@@ -760,13 +770,13 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Unable to resolve creation stage provider.";
throw new LifecycleException( error, e );
}
}

- private LifecycleCreateExtension getLifecycleCreateExtension(
+ private LifecycleCreateExtension getLifecycleCreateExtension(
DeploymentModel provider ) throws LifecycleException
{
try
@@ -775,13 +785,13 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Unable to resolve lifecycle creation extension provider.";
throw new LifecycleException( error, e );
}
}

- private LifecycleDestroyExtension getLifecycleDestroyExtension(
+ private LifecycleDestroyExtension getLifecycleDestroyExtension(
DeploymentModel provider ) throws LifecycleException
{
try
@@ -790,13 +800,13 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Unable to resolve lifecycle destroy extension provider.";
throw new LifecycleException( error, e );
}
}

- private ComponentModel getStageProvider( StageDescriptor stage )
+ private ComponentModel getStageProvider( StageDescriptor stage )
throws IllegalStateException
{
final String key = stage.getKey();
@@ -808,16 +818,16 @@
}
else
{
- final String error =
- REZ.getString(
- "lifecycle.error.invalid-stage-provider",
+ final String error =
+ REZ.getString(
+ "lifecycle.error.invalid-stage-provider",
key );
throw new IllegalStateException( error );
}
}
/* Never used
- private void applyContext(
- final Object instance, DeliveryDescriptor delivery, final Object
context )
+ private void applyContext(
+ final Object instance, DeliveryDescriptor delivery, final Object
context )
throws LifecycleException
{
if( null == context ) return;
@@ -837,9 +847,9 @@
}
catch( Throwable e )
{
- final String error =
- REZ.getString(
- "lifecycle.error.avalon-contextualization",
+ final String error =
+ REZ.getString(
+ "lifecycle.error.avalon-contextualization",
m_model.getQualifiedName() );
throw new LifecycleException( error, e );
}
@@ -856,9 +866,9 @@
}
catch( Throwable e )
{
- final String error =
- REZ.getString(
- "lifecycle.error.custom-contextualization",
+ final String error =
+ REZ.getString(
+ "lifecycle.error.custom-contextualization",
m_model.getQualifiedName(),
provider.toString() );
throw new LifecycleException( error, e );
@@ -866,9 +876,9 @@
}
else
{
- final String error =
+ final String error =
"Unrecognized delivery strategy: ["
- + delivery.getClass().getName()
+ + delivery.getClass().getName()
+ "].";
throw new IllegalStateException( error );
}
@@ -882,7 +892,7 @@
URL[] urls = ((URLClassLoader)loader).getURLs();
for( int i=0; i<urls.length; i++ )
{
- System.out.println( " (" + i + ") " + m_system.toString(
urls[i] ) );
+ System.out.println( " (" + i + ") " + m_system.toString(
urls[i] ) );
}
}
ClassLoader parent = loader.getParent();

Modified:
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/DefaultServiceManager.java
==============================================================================
---
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/DefaultServiceManager.java
(original)
+++
development/main/metro/activation/providers/avalon/src/main/net/dpml/activation/avalon/DefaultServiceManager.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -27,6 +27,8 @@
import net.dpml.composition.model.DeploymentModel;
import net.dpml.composition.model.DependencyModel;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;

import net.dpml.service.ServiceException;
@@ -47,7 +49,7 @@
//-------------------------------------------------------------------

private static final Resources REZ =
- ResourceManager.getPackageResources(
+ ResourceManager.getPackageResources(
DefaultServiceManager.class );

//-------------------------------------------------------------------
@@ -57,9 +59,9 @@
private final Logger m_logger;

/**
- * A table of identity hashcode integers of established objects
+ * A table of identity hashcode integers of established objects
* that map to the lookup key that was uased to establish the object.
- * Used to track which model is providing an object when we
+ * Used to track which model is providing an object when we
* handle release of objects.
*/
private final Hashtable m_table = new Hashtable();
@@ -75,14 +77,16 @@

/**
* Construct a new ServiceManager.
- * @param model component model of the component that is
+ * @param model component model of the component that is
* to be serviced.
+ * @exception NullArgumentException if the model argument is null.
*/
public DefaultServiceManager( ComponentModel model )
+ throws NullArgumentException
{
if( model == null )
{
- throw new NullPointerException( "model" );
+ throw new NullArgumentException( "model" );
}
m_logger = model.getLogger();

@@ -91,7 +95,7 @@
for( int i=0; i < dependencies.length; i++ )
{
final DependencyModel dependency = dependencies[i];
-
+
DeploymentModel provider = dependency.getProvider();
if( provider != null )
{
@@ -136,18 +140,19 @@
* @param key the role
* @return the Object or null if the Object doesn't exist
* @throws ServiceException if an error occurs
- * @throws NullPointerException if the supplied key is null
+ * @throws NullArgumentException if the supplied key is null
*/
- public Object lookup( String key, long timeout ) throws ServiceException
+ public Object lookup( String key, long timeout )
+ throws ServiceException
{
if( key == null )
{
- throw new NullPointerException( "key" );
+ throw new NullArgumentException( "key" );
}

if( !hasService( key ) )
{
- final String error =
+ final String error =
"Unknown key: " + key;
throw new ServiceException( key, error );
}
@@ -159,10 +164,10 @@

DependencyModel dependency = (DependencyModel) m_map.get( key );
final DeploymentModel provider = dependency.getProvider();
-
+
if( null == provider )
{
- final String error =
+ final String error =
REZ.getString( "service.error.null-provider", key );
throw new IllegalStateException( error );
}
@@ -170,7 +175,7 @@
//
// get a proxy to the service from the provider
// (note that it is up to a provider to determine if
- // a proxy if generated based on its service export
+ // a proxy if generated based on its service export
// parameters)
//

@@ -183,7 +188,7 @@
}

//
- // otherwise we need to hold a reference linking the
+ // otherwise we need to hold a reference linking the
// object with the source provider
//

@@ -191,11 +196,11 @@
m_table.put( id, key );
if( getLogger().isDebugEnabled() )
{
- final String message =
- "resolved service ["
- + id
- + "] for the key ["
- + key
+ final String message =
+ "resolved service ["
+ + id
+ + "] for the key ["
+ + key
+ "].";
getLogger().debug( message );
}
@@ -220,7 +225,7 @@
}
else
{
- final String error =
+ final String error =
"Requested service is not responding.";
throw new TransientServiceException( key, error, delay );
}
@@ -230,14 +235,14 @@
{
//
// TODO: framework states that ServiceException is thrown
- // if the service is not found - and in this case that isn't
+ // if the service is not found - and in this case that isn't
// the issue - in effect we have a good key, but we simply
// have not been able to go from key to instance -
- // should look into some more concrete subtypes of
+ // should look into some more concrete subtypes of
// ServiceException

- final String error =
- "Unexpected runtime error while attempting to resolve service
for key: "
+ final String error =
+ "Unexpected runtime error while attempting to resolve service
for key: "
+ key;
throw new FatalServiceException( key, error, e );
}
@@ -253,11 +258,11 @@

if( Proxy.isProxyClass( instance.getClass() ) )
{
- InvocationHandler handler =
+ InvocationHandler handler =
Proxy.getInvocationHandler( instance );
if( handler instanceof ApplianceInvocationHandler )
- {
- ApplianceInvocationHandler aic =
+ {
+ ApplianceInvocationHandler aic =
(ApplianceInvocationHandler) handler;
aic.release();
return;
@@ -275,9 +280,9 @@
{
if( getLogger().isWarnEnabled() )
{
- final String warning =
- "Unrecognized object identity ["
- + id
+ final String warning =
+ "Unrecognized object identity ["
+ + id
+ "]. "
+ "Either this object was not provided by this service
manager "
+ "or it has already been released.";
@@ -292,7 +297,7 @@
{
if( getLogger().isErrorEnabled() )
{
- final String error =
+ final String error =
"Unable to release component as no provider could be found
for the key ["
+ key
+ "].";
@@ -304,11 +309,11 @@
provider.release( instance );
if( getLogger().isDebugEnabled() )
{
- final String message =
- "released service ["
- + id
- + "] from the key ["
- + key
+ final String message =
+ "released service ["
+ + id
+ + "] from the key ["
+ + key
+ "].";
getLogger().debug( message );
}

Modified:
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/AbstractAppliance.java
==============================================================================
---
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/AbstractAppliance.java
(original)
+++
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/AbstractAppliance.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -22,6 +22,8 @@

import net.dpml.composition.model.DeploymentModel;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;

/**
@@ -44,10 +46,11 @@
//-------------------------------------------------------------------

public AbstractAppliance( DeploymentModel model )
+ throws NullArgumentException
{
- if( null == model )
+ if( null == model )
{
- throw new NullPointerException( "model" );
+ throw new NullArgumentException( "model" );
}

m_model = model;
@@ -59,14 +62,14 @@
//-------------------------------------------------------------------

/**
- * Commission the appliance.
+ * Commission the appliance.
*
* @exception Exception if a commissioning error occurs
*/
public abstract void commission() throws Exception;

/**
- * Decommission the appliance. Once an appliance is
+ * Decommission the appliance. Once an appliance is
* decommissioned it may be re-commissioned.
*/
public abstract void decommission();
@@ -85,8 +88,8 @@

/**
* Request resolution of an object from the runtime.
- * @param proxy if TRUE the return value will be proxied if the
- * underlying component typoe suppports proxy representation
+ * @param proxy if TRUE the return value will be proxied if the
+ * underlying component typoe suppports proxy representation
* @exception Exception if a deployment error occurs
*/
public abstract Object resolve( boolean proxy ) throws Exception;

Modified:
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/ApplianceInvocationHandler.java
==============================================================================
---
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/ApplianceInvocationHandler.java
(original)
+++
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/ApplianceInvocationHandler.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -22,6 +22,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.UndeclaredThrowableException;
import java.lang.reflect.Method;
+
import java.security.PrivilegedActionException;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
@@ -33,6 +34,8 @@
import net.dpml.composition.model.TransientRuntimeException;
import net.dpml.composition.model.Reclaimer;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;

/**
@@ -42,7 +45,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id$
*/
-public final class ApplianceInvocationHandler
+public final class ApplianceInvocationHandler
implements InvocationHandler, Reclaimer
{
//-------------------------------------------------------------------
@@ -69,14 +72,15 @@
* Create a proxy invocation handler.
*
* @param appliance the runtime appliance
- * @param logger the assigned logging channel
+ * @param logger the assigned logging channel
*/
- ApplianceInvocationHandler(
- DefaultAppliance appliance, Logger logger, boolean secure )
+ ApplianceInvocationHandler(
+ DefaultAppliance appliance, Logger logger, boolean secure )
+ throws NullArgumentException
{
- assertNotNull( appliance, "appliance" );
- assertNotNull( logger, "logger" );
-
+ assertNotNull( appliance, "appliance" );
+ assertNotNull( logger, "logger" );
+
m_appliance = appliance;
m_logger = logger;
m_secure = secure;
@@ -96,34 +100,36 @@
* @param args the arguments supplied to method
* @return the return value of method
* @throws Throwable if an error occurs
+ * @exception NullArgumentException if any one of the proxy or method
arguments
+ 8 is null, or if the object instance has been destroyed
earlier.
*/
- public Object invoke( final Object proxy,
- final Method method,
- final Object[] args )
- throws Throwable
- {
- if( proxy == null )
- throw new NullPointerException( "proxy" );
- if( method == null )
- throw new NullPointerException( "method" );
- if( m_destroyed )
- throw new IllegalStateException( "destroyed" );
+ public Object invoke( final Object proxy, final Method method, final
Object[] args )
+ throws Throwable, NullArgumentException
+ {
+ if( proxy == null )
+ throw new NullArgumentException( "proxy" );
+ if( method == null )
+ throw new NullArgumentException( "method" );
+ if( m_destroyed )
+ throw new NullArgumentException( "destroyed" );

try
{
final Object instance = getInstance();
-
+
if( m_secure )
{
- return AccessController.doPrivileged(
- new PrivilegedExceptionAction()
- {
- public Object run() throws Exception
- {
- return method.invoke( instance, args );
- }
- },
- m_model.getAccessControlContext() );
+ return AccessController.doPrivileged
+ (
+ new PrivilegedExceptionAction()
+ {
+ public Object run() throws Exception
+ {
+ return method.invoke( instance, args );
+ }
+ },
+ m_model.getAccessControlContext()
+ );
}
else
{
@@ -145,11 +151,11 @@
if( !m_destroyed )
{
m_destroyed = true;
- final String message =
- "Releasing component ["
- + System.identityHashCode( m_instance ) + "] ("
- + m_appliance.toString()
- + ").";
+ final String message =
+ "Releasing component ["
+ + System.identityHashCode( m_instance ) + "] ("
+ + m_appliance.toString()
+ + ").";
getLogger().debug( message );
m_appliance.release( m_instance );
}
@@ -163,11 +169,11 @@
{
if( !m_destroyed && ( null != m_instance ) )
{
- final String message =
- "Finalizing proxy ["
- + System.identityHashCode( m_instance ) + "] ("
- + m_appliance.toString()
- + ").";
+ final String message =
+ "Finalizing proxy ["
+ + System.identityHashCode( m_instance ) + "] ("
+ + m_appliance.toString()
+ + ").";
getLogger().debug( message );
release();
}
@@ -187,21 +193,20 @@

private Throwable handleInvocationThrowable( Throwable e )
{
- final String error =
- "Delegation error raised by component: "
- + m_appliance.toString();
+ final String error =
+ "Delegation error raised by component: " +
m_appliance.toString();
while( true )
{
if( e instanceof TransientApplianceException )
{
- TransientApplianceException t =
+ TransientApplianceException t =
(TransientApplianceException) e;
- return new TransientRuntimeException(
+ return new TransientRuntimeException(
t.getMessage(), t.getDelay() );
}
else if( e instanceof UndeclaredThrowableException )
{
- Throwable cause =
+ Throwable cause =
((UndeclaredThrowableException)
e).getUndeclaredThrowable();
if( cause == null )
return new ApplianceException( error, e );
@@ -209,7 +214,7 @@
}
else if( e instanceof InvocationTargetException )
{
- Throwable cause =
+ Throwable cause =
((InvocationTargetException) e).getTargetException();
if( cause == null )
return new ApplianceException( error, e );
@@ -217,7 +222,7 @@
}
else if( e instanceof PrivilegedActionException )
{
- Throwable cause =
+ Throwable cause =
((PrivilegedActionException) e).getException();
if( cause == null )
return new ApplianceException( error, e );
@@ -232,10 +237,11 @@
}

private void assertNotNull( Object object, String key )
+ throws NullArgumentException
{
if( null == object )
{
- throw new NullPointerException( key );
+ throw new NullArgumentException( key );
}
}
}

Modified:
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultComponentFactory.java
==============================================================================
---
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultComponentFactory.java
(original)
+++
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultComponentFactory.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -26,13 +26,16 @@

import net.dpml.activation.ComponentFactory;
import net.dpml.activation.LifecycleException;
+
import net.dpml.activity.Disposable;
import net.dpml.activity.Executable;
import net.dpml.activity.Initializable;
import net.dpml.activity.Startable;
+
import net.dpml.composition.info.DeliveryDescriptor;
import net.dpml.composition.info.NativeDeliveryDescriptor;
import net.dpml.composition.info.StagedDeliveryDescriptor;
+
import net.dpml.composition.model.ComponentModel;
import net.dpml.composition.model.ContextModel;
import net.dpml.composition.model.ContextualizationHandler;
@@ -41,18 +44,28 @@
import net.dpml.composition.model.LifecycleDestroyExtension;
import net.dpml.composition.model.ModelException;
import net.dpml.composition.model.StageModel;
+
import net.dpml.configuration.Configurable;
import net.dpml.configuration.Configuration;
+
import net.dpml.context.Context;
import net.dpml.context.Contextualizable;
+
import net.dpml.context.impl.DefaultContext;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.LogEnabled;
import net.dpml.logging.Logger;
+
import net.dpml.meta.info.StageDescriptor;
+
import net.dpml.parameters.Parameterizable;
import net.dpml.parameters.Parameters;
+
import net.dpml.service.ServiceManager;
import net.dpml.service.Serviceable;

@@ -64,7 +77,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id$
*/
-public class DefaultComponentFactory
+public class DefaultComponentFactory
implements ComponentFactory
{
//-------------------------------------------------------------------
@@ -72,7 +85,7 @@
//-------------------------------------------------------------------

private static final Resources REZ =
- ResourceManager.getPackageResources(
+ ResourceManager.getPackageResources(
DefaultComponentFactory.class );

//-------------------------------------------------------------------
@@ -113,13 +126,13 @@
{
if( getLogger().isDebugEnabled() )
{
- final String message =
+ final String message =
"incarnation";
getLogger().debug( message );
}

ClassLoader current = Thread.currentThread().getContextClassLoader();
- ClassLoader classloader =
+ ClassLoader classloader =
m_model.getDeploymentClass().getClassLoader();
Thread.currentThread().setContextClassLoader( classloader );

@@ -128,13 +141,13 @@
Object instance = incarnation();
if( getLogger().isDebugEnabled() )
{
- final String message =
+ final String message =
"incarnation complete";
getLogger().debug( message );
}
return instance;
}
- finally
+ finally
{
Thread.currentThread().setContextClassLoader( current );
}
@@ -148,7 +161,7 @@
{
if( getLogger().isDebugEnabled() )
{
- final String message =
+ final String message =
"etherialization";
getLogger().debug( message );
}
@@ -170,7 +183,7 @@
{
if( m_secure )
{
- AccessController.doPrivileged(
+ AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run() throws Exception
@@ -178,7 +191,7 @@
((Startable)instance).stop();
return null;
}
- },
+ },
m_model.getAccessControlContext() );
}
else
@@ -190,7 +203,7 @@
{
if( getLogger().isWarnEnabled() )
{
- final String warning =
+ final String warning =
"Ignoring component source shutdown error.";
getLogger().warn( warning, e );
}
@@ -202,9 +215,9 @@
getLogger().debug( "applying disposal" );
try
{
- if( m_secure )
+ if( m_secure )
{
- AccessController.doPrivileged(
+ AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run() throws Exception
@@ -212,7 +225,7 @@
((Disposable)instance).dispose();
return null;
}
- },
+ },
m_model.getAccessControlContext() );
}
else
@@ -224,7 +237,7 @@
{
if( getLogger().isWarnEnabled() )
{
- final String warning =
+ final String warning =
"Ignoring component source disposal error.";
getLogger().warn( warning, e );
}
@@ -260,8 +273,8 @@
final Object context = getTargetContext();
final Class contextClass = getContextCastingClass();

- final Object instance =
- instantiate(
+ final Object instance =
+ instantiate(
clazz, logger, config, params, context, contextClass, manager );

try
@@ -269,9 +282,9 @@
if( instance instanceof LogEnabled )
{
getLogger().debug( "applying logger" );
- if( m_secure )
- {
- AccessController.doPrivileged(
+ if( m_secure )
+ {
+ AccessController.doPrivileged(
new PrivilegedAction()
{
public Object run()
@@ -279,7 +292,7 @@
((LogEnabled)instance).enableLogging( logger );
return null;
}
- },
+ },
m_model.getAccessControlContext() );
}
else
@@ -291,9 +304,9 @@
if( instance instanceof Contextualizable )
{
getLogger().debug( "applying context" );
- if( m_secure )
- {
- AccessController.doPrivileged(
+ if( m_secure )
+ {
+ AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run() throws Exception
@@ -301,7 +314,7 @@
((Contextualizable)instance).contextualize(
(Context) context );
return null;
}
- },
+ },
m_model.getAccessControlContext() );
}
else
@@ -315,7 +328,7 @@
getLogger().debug( "applying service manager" );
if( m_secure )
{
- AccessController.doPrivileged(
+ AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run() throws Exception
@@ -323,7 +336,7 @@
((Serviceable)instance).service( manager );
return null;
}
- },
+ },
m_model.getAccessControlContext() );
}
else
@@ -337,7 +350,7 @@
getLogger().debug( "applying configuration" );
if( m_secure )
{
- AccessController.doPrivileged(
+ AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run() throws Exception
@@ -345,7 +358,7 @@
((Configurable)instance).configure( config );
return null;
}
- },
+ },
m_model.getAccessControlContext() );
}
else
@@ -359,7 +372,7 @@
getLogger().debug( "applying parameters" );
if( m_secure )
{
- AccessController.doPrivileged(
+ AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run() throws Exception
@@ -367,7 +380,7 @@
((Parameterizable)instance).parameterize(
params );
return null;
}
- },
+ },
m_model.getAccessControlContext() );
}
else
@@ -391,7 +404,7 @@
getLogger().debug( "applying initialization" );
if( m_secure )
{
- AccessController.doPrivileged(
+ AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run() throws Exception
@@ -399,7 +412,7 @@
((Initializable)instance).initialize();
return null;
}
- },
+ },
m_model.getAccessControlContext() );
}
else
@@ -413,7 +426,7 @@
getLogger().debug( "applying startup" );
if( m_secure )
{
- AccessController.doPrivileged(
+ AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run() throws Exception
@@ -421,7 +434,7 @@
((Startable)instance).start();
return null;
}
- },
+ },
m_model.getAccessControlContext() );
}
else
@@ -435,7 +448,7 @@
getLogger().debug( "applying execution" );
if( m_secure )
{
- AccessController.doPrivileged(
+ AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run() throws Exception
@@ -443,7 +456,7 @@
((Executable)instance).execute();
return null;
}
- },
+ },
m_model.getAccessControlContext() );
}
else
@@ -455,9 +468,9 @@
}
catch( Throwable e )
{
- final String error =
- REZ.getString(
- "lifestyle.error.new",
+ final String error =
+ REZ.getString(
+ "lifestyle.error.new",
m_model.getQualifiedName() );
throw new LifecycleException( error, e );
}
@@ -482,9 +495,9 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Could not load the custom context casting class ["
- + casting
+ + casting
+ "].";
throw new LifecycleException( error, e );
}
@@ -515,9 +528,9 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Could not load the custom context implementation class ["
- + classname
+ + classname
+ "].";
throw new LifecycleException( error, e );
}
@@ -526,7 +539,7 @@

/**
* Creates a component context instance.
- *
+ *
* @return the context object compliant with the context casting
* constraints declared by the component type
* @exception LifecycleException if an error occurs while attempting to
@@ -536,8 +549,8 @@
throws LifecycleException
{
//
- // its a custom context object so we need to create it
- // using the classic context object as the constructor
+ // its a custom context object so we need to create it
+ // using the classic context object as the constructor
// argument
//

@@ -562,10 +575,10 @@
}


- private Object instantiate(
- Class clazz, Logger logger, Configuration config, Parameters params,
- Object context, Class contextClass, ServiceManager manager )
- throws LifecycleException
+ private Object instantiate(
+ Class clazz, Logger logger, Configuration config, Parameters
params,
+ Object context, Class contextClass, ServiceManager manager )
+ throws LifecycleException, NullArgumentException
{
Constructor constructor = getConstructor( clazz );

@@ -578,7 +591,7 @@
{
if( null == logger )
{
- throw new NullPointerException( "logger" );
+ throw new NullArgumentException( "logger" );
}
args[i] = logger;
}
@@ -586,7 +599,7 @@
{
if( null == context )
{
- throw new NullPointerException( "context" );
+ throw new NullArgumentException( "context" );
}
args[i] = context;
}
@@ -594,7 +607,7 @@
{
if( null == config )
{
- throw new NullPointerException( "config" );
+ throw new NullArgumentException( "config" );
}
args[i] = config;
}
@@ -602,7 +615,7 @@
{
if( null == params )
{
- throw new NullPointerException( "params" );
+ throw new NullArgumentException( "params" );
}
args[i] = params;
}
@@ -610,15 +623,15 @@
{
if( null == manager )
{
- throw new NullPointerException( "manager" );
+ throw new NullArgumentException( "manager" );
}
args[i] = manager;
}
else
{
- final String error =
- REZ.getString(
- "lifecycle.error.unrecognized-parameter",
+ final String error =
+ REZ.getString(
+ "lifecycle.error.unrecognized-parameter",
c.getName(),
clazz.getName() );
throw new LifecycleException( error );
@@ -635,11 +648,11 @@
private Constructor getConstructor( Class clazz ) throws
LifecycleException
{
Constructor[] constructors = clazz.getConstructors();
- if( constructors.length < 1 )
+ if( constructors.length < 1 )
{
- final String error =
- REZ.getString(
- "lifecycle.error.no-constructor",
+ final String error =
+ REZ.getString(
+ "lifecycle.error.no-constructor",
clazz.getName() );
throw new LifecycleException( error );
}
@@ -649,7 +662,7 @@
final String error =
"Multiple constructor ambiguity in the component model "
+ m_model
- + ". The component class [" + clazz.getName()
+ + ". The component class [" + clazz.getName()
+ "] declares "
+ constructors.length
+ " public constructors.";
@@ -662,43 +675,43 @@
}

/**
- * Instantiation of a component instance using a supplied constructor
+ * Instantiation of a component instance using a supplied constructor
* and arguments.
- *
+ *
* @param constructor the component constructor
* @param args the constructor arguments
* @return the component instance
* @exception LifecycleException if an instantiation error occurs
*/
- private Object instantiateComponent(
- final Constructor constructor, final Object[] args )
+ private Object instantiateComponent(
+ final Constructor constructor, final Object[] args )
throws LifecycleException
{
try
{
if( args.length == 0 )
{
- getLogger().debug(
+ getLogger().debug(
"instantiating component with a null constructor" );
}
else
{
int n = args.length;
- getLogger().debug(
- "instantiating component with "
+ getLogger().debug(
+ "instantiating component with "
+ n + " arguments." );
}

if( m_secure )
{
- return AccessController.doPrivileged(
+ return AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run() throws Exception
{
return constructor.newInstance( args );
}
- },
+ },
m_model.getAccessControlContext() );
}
else
@@ -709,15 +722,15 @@
catch( Throwable e )
{
Class clazz = constructor.getDeclaringClass();
- final String error =
- REZ.getString(
- "lifecycle.error.instantiation",
+ final String error =
+ REZ.getString(
+ "lifecycle.error.instantiation",
clazz.getName() );
throw new LifecycleException( error, e );
}
}

- private void applyCreateStage( Object instance, boolean flag )
+ private void applyCreateStage( Object instance, boolean flag )
throws LifecycleException
{
StageDescriptor[] stages = m_model.getType().getStages();
@@ -734,7 +747,7 @@

if( flag && LifecycleCreateExtension.class.isAssignableFrom( c )
)
{
- LifecycleCreateExtension handler =
+ LifecycleCreateExtension handler =
getLifecycleCreateExtension( provider );

try
@@ -759,7 +772,7 @@
}
else if( !flag &&
LifecycleDestroyExtension.class.isAssignableFrom( c ) )
{
- LifecycleDestroyExtension handler =
+ LifecycleDestroyExtension handler =
getLifecycleDestroyExtension( provider );

try
@@ -775,7 +788,7 @@
{
if( getLogger().isWarnEnabled() )
{
- final String error =
+ final String error =
"Ignoring destroy stage error";
getLogger().warn( error, e );
}
@@ -788,7 +801,7 @@
}
}

- private LifecycleCreateExtension getLifecycleCreateExtension(
+ private LifecycleCreateExtension getLifecycleCreateExtension(
DeploymentModel provider ) throws LifecycleException
{
try
@@ -797,13 +810,13 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Unable to resolve lifecycle creation extension provider.";
throw new LifecycleException( error, e );
}
}

- private LifecycleDestroyExtension getLifecycleDestroyExtension(
+ private LifecycleDestroyExtension getLifecycleDestroyExtension(
DeploymentModel provider ) throws LifecycleException
{
try
@@ -812,13 +825,13 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Unable to resolve lifecycle destroy extension provider.";
throw new LifecycleException( error, e );
}
}

- private ComponentModel getStageProvider( StageDescriptor stage )
+ private ComponentModel getStageProvider( StageDescriptor stage )
throws IllegalStateException
{
final String key = stage.getKey();
@@ -830,16 +843,16 @@
}
else
{
- final String error =
- REZ.getString(
- "lifecycle.error.invalid-stage-provider",
+ final String error =
+ REZ.getString(
+ "lifecycle.error.invalid-stage-provider",
key );
throw new IllegalStateException( error );
}
}

- private void applyContext(
- final Object instance, DeliveryDescriptor delivery, final Object
context )
+ private void applyContext(
+ final Object instance, DeliveryDescriptor delivery, final Object
context )
throws LifecycleException
{
if( null == context ) return;
@@ -860,16 +873,16 @@
{
if( m_secure )
{
- AccessController.doPrivileged(
+ AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run() throws Exception
{
-
((Contextualizable)instance).contextualize(
- (Context) context );
- return null;
+ ((Contextualizable)instance).contextualize(
+ (Context) context );
+ return null;
}
- },
+ },
m_model.getAccessControlContext() );
}
else
@@ -879,9 +892,9 @@
}
catch( Throwable e )
{
- final String error =
- REZ.getString(
- "lifecycle.error.avalon-contextualization",
+ final String error =
+ REZ.getString(
+ "lifecycle.error.avalon-contextualization",
m_model.getQualifiedName() );
throw new LifecycleException( error, e );
}
@@ -889,8 +902,8 @@
else
{
final String error =
- "Supplied context class ["
- + context.getClass().getName()
+ "Supplied context class ["
+ + context.getClass().getName()
+ "] does not implement the Avalon Context interface.";
throw new LifecycleException( error );
}
@@ -907,9 +920,9 @@
}
catch( Throwable e )
{
- final String error =
- REZ.getString(
- "lifecycle.error.custom-contextualization",
+ final String error =
+ REZ.getString(
+ "lifecycle.error.custom-contextualization",
m_model.getQualifiedName(),
provider.toString() );
throw new LifecycleException( error, e );
@@ -917,9 +930,9 @@
}
else
{
- final String error =
+ final String error =
"Unrecognized delivery strategy: ["
- + delivery.getClass().getName()
+ + delivery.getClass().getName()
+ "].";
throw new IllegalStateException( error );
}

Modified:
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultServiceManager.java
==============================================================================
---
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultServiceManager.java
(original)
+++
development/main/metro/activation/providers/metro/src/main/net/dpml/activation/metro/DefaultServiceManager.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -27,6 +27,8 @@
import net.dpml.composition.model.DeploymentModel;
import net.dpml.composition.model.DependencyModel;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;

import net.dpml.service.ServiceException;
@@ -47,7 +49,7 @@
//-------------------------------------------------------------------

private static final Resources REZ =
- ResourceManager.getPackageResources(
+ ResourceManager.getPackageResources(
DefaultServiceManager.class );

//-------------------------------------------------------------------
@@ -57,9 +59,9 @@
private final Logger m_logger;

/**
- * A table of identity hashcode integers of established objects
+ * A table of identity hashcode integers of established objects
* that map to the lookup key that was uased to establish the object.
- * Used to track which model is providing an object when we
+ * Used to track which model is providing an object when we
* handle release of objects.
*/
private final Hashtable m_table = new Hashtable();
@@ -75,14 +77,15 @@

/**
* Construct a new ServiceManager.
- * @param model component model of the component that is
+ * @param model component model of the component that is
* to be serviced.
*/
public DefaultServiceManager( ComponentModel model )
+ throws NullArgumentException
{
if( model == null )
{
- throw new NullPointerException( "model" );
+ throw new NullArgumentException( "model" );
}

m_logger = model.getLogger();
@@ -92,7 +95,7 @@
for( int i=0; i < dependencies.length; i++ )
{
final DependencyModel dependency = dependencies[i];
-
+
DeploymentModel provider = dependency.getProvider();
if( provider != null )
{
@@ -139,17 +142,17 @@
* @throws ServiceException if an error occurs
* @throws NullPointerException if the supplied key is null
*/
- public Object lookup( String key, long timeout ) throws ServiceException
+ public Object lookup( String key, long timeout )
+ throws ServiceException, NullArgumentException
{
if( key == null )
{
- throw new NullPointerException( "key" );
+ throw new NullArgumentException( "key" );
}

if( !hasService( key ) )
{
- final String error =
- "Unknown key: " + key;
+ final String error = "Unknown key: " + key;
throw new ServiceException( key, error );
}

@@ -160,10 +163,10 @@

DependencyModel dependency = (DependencyModel) m_map.get( key );
final DeploymentModel provider = dependency.getProvider();
-
+
if( null == provider )
{
- final String error =
+ final String error =
REZ.getString( "service.error.null-provider", key );
throw new IllegalStateException( error );
}
@@ -171,7 +174,7 @@
//
// get a proxy to the service from the provider
// (note that it is up to a provider to determine if
- // a proxy if generated based on its service export
+ // a proxy if generated based on its service export
// parameters)
//

@@ -184,7 +187,7 @@
}

//
- // otherwise we need to hold a reference linking the
+ // otherwise we need to hold a reference linking the
// object with the source provider
//

@@ -192,11 +195,11 @@
m_table.put( id, key );
if( getLogger().isDebugEnabled() )
{
- final String message =
- "resolved service ["
- + id
- + "] for the key ["
- + key
+ final String message =
+ "resolved service ["
+ + id
+ + "] for the key ["
+ + key
+ "].";
getLogger().debug( message );
}
@@ -221,7 +224,7 @@
}
else
{
- final String error =
+ final String error =
"Requested service is not responding.";
throw new TransientServiceException( key, error, delay );
}
@@ -231,14 +234,14 @@
{
//
// TODO: framework states that ServiceException is thrown
- // if the service is not found - and in this case that isn't
+ // if the service is not found - and in this case that isn't
// the issue - in effect we have a good key, but we simply
// have not been able to go from key to instance -
- // should look into some more concrete subtypes of
+ // should look into some more concrete subtypes of
// ServiceException

- final String error =
- "Unexpected runtime error while attempting to resolve service
for key: "
+ final String error =
+ "Unexpected runtime error while attempting to resolve service
for key: "
+ key;
throw new FatalServiceException( key, error, e );
}
@@ -254,11 +257,11 @@

if( Proxy.isProxyClass( instance.getClass() ) )
{
- InvocationHandler handler =
+ InvocationHandler handler =
Proxy.getInvocationHandler( instance );
if( handler instanceof ApplianceInvocationHandler )
- {
- ApplianceInvocationHandler aic =
+ {
+ ApplianceInvocationHandler aic =
(ApplianceInvocationHandler) handler;
aic.release();
return;
@@ -276,9 +279,9 @@
{
if( getLogger().isWarnEnabled() )
{
- final String warning =
- "Unrecognized object identity ["
- + id
+ final String warning =
+ "Unrecognized object identity ["
+ + id
+ "]. "
+ "Either this object was not provided by this service
manager "
+ "or it has already been released.";
@@ -293,7 +296,7 @@
{
if( getLogger().isErrorEnabled() )
{
- final String error =
+ final String error =
"Unable to release component as no provider could be found
for the key ["
+ key
+ "].";
@@ -305,11 +308,11 @@
provider.release( instance );
if( getLogger().isDebugEnabled() )
{
- final String message =
- "released service ["
- + id
- + "] from the key ["
- + key
+ final String message =
+ "released service ["
+ + id
+ + "] from the key ["
+ + key
+ "].";
getLogger().debug( message );
}

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/BlockCompositionDirective.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/BlockCompositionDirective.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/BlockCompositionDirective.java
Mon Jan 17 18:13:05 2005
@@ -1,28 +1,30 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.composition.data;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.transit.artifact.Artifact;

/**
- * A block reference directive contains an identifier and verion of
- * a local resource to be included by reference into
+ * A block reference directive contains an identifier and verion of
+ * a local resource to be included by reference into
* a container.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
@@ -42,12 +44,12 @@

/**
* Creation of a new resource directive.
- * @param name the name to assign to the container
+ * @param name the name to assign to the container
* established by the composition directive
- * @param artifact an artifact from which a block
+ * @param artifact an artifact from which a block
* description can be resolved
*/
- public BlockCompositionDirective(
+ public BlockCompositionDirective(
final String name, Artifact artifact )
{
this( name, artifact, new TargetDirective[0] );
@@ -55,18 +57,19 @@

/**
* Creation of a new resource directive.
- * @param name the name to assign to the container
+ * @param name the name to assign to the container
* established by the composition directive
- * @param artifact an artifact from which a block
+ * @param artifact an artifact from which a block
* description can be resolved
*/
- public BlockCompositionDirective(
- final String name, Artifact artifact, TargetDirective[] targets )
+ public BlockCompositionDirective(
+ final String name, Artifact artifact, TargetDirective[] targets )
+ throws NullArgumentException
{
super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT, null );
if( artifact == null )
{
- throw new NullPointerException( "artifact" );
+ throw new NullArgumentException( "artifact" );
}
m_artifact = artifact;
m_targets = targets;

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/BlockIncludeDirective.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/BlockIncludeDirective.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/BlockIncludeDirective.java
Mon Jan 17 18:13:05 2005
@@ -1,23 +1,25 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.composition.data;

+import net.dpml.lang.NullArgumentException;
+
/**
* A block include directive that references a source file describing a
block.
*
@@ -37,11 +39,12 @@
* @param path a relative path to the block descriptor
*/
public BlockIncludeDirective( final String name, final String path )
+ throws NullArgumentException
{
super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT, null );
if( path == null )
{
- throw new NullPointerException( "path" );
+ throw new NullArgumentException( "path" );
}
m_path = path;
}

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -22,6 +22,8 @@
import net.dpml.parameters.Parameters;
import net.dpml.meta.info.InfoDescriptor;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.data.CategoriesDirective;


@@ -154,9 +156,10 @@
* @param classname the classname of the component type
*/
public ComponentProfile( final String name, final String classname )
+ throws NullArgumentException
{
- this(
- name, DeploymentProfile.DEFAULT, InfoDescriptor.UNDEFINED,
classname, null, null, null, null,
+ this(
+ name, DeploymentProfile.DEFAULT, InfoDescriptor.UNDEFINED,
classname, null, null, null, null,
null, null, Mode.IMPLICIT );
}

@@ -166,9 +169,10 @@
* @param template the template deployment profile
*/
public ComponentProfile( String name, ComponentProfile template )
+ throws NullArgumentException
{
- this(
- name,
+ this(
+ name,
template.getActivationDirective(),
template.getCollectionPolicy(),
template.m_classname,
@@ -181,24 +185,25 @@
Mode.EXPLICIT );
}

- public ComponentProfile(
- final String name,
- final int activation,
- final int collection,
- final String classname,
- final CategoriesDirective categories,
- final ContextDirective context,
+ public ComponentProfile(
+ final String name,
+ final int activation,
+ final int collection,
+ final String classname,
+ final CategoriesDirective categories,
+ final ContextDirective context,
final DependencyDirective[] dependencies,
final StageDirective[] stages,
- final Parameters parameters,
+ final Parameters parameters,
final Configuration config,
final Mode mode )
+ throws NullArgumentException
{
super( name, activation, mode, categories );

if( null == classname )
{
- throw new NullPointerException( "classname" );
+ throw new NullArgumentException( "classname" );
}

m_collection = collection;
@@ -275,7 +280,7 @@
/**
* Return the dependency directive for a supplied key.
*
- * @return the matching DependencyDirective (possibly null if
+ * @return the matching DependencyDirective (possibly null if
* no directive is declared for the given key)
*/
public DependencyDirective getDependencyDirective( final String key )
@@ -305,7 +310,7 @@
/**
* Return the dependency directive for a supplied key.
*
- * @return the matching DependencyDirective (possibly null if
+ * @return the matching DependencyDirective (possibly null if
* no directive is declared for the given key)
*/
public StageDirective getStageDirective( final String key )

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/ConstructorDirective.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/ConstructorDirective.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/ConstructorDirective.java
Mon Jan 17 18:13:05 2005
@@ -1,23 +1,25 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.composition.data;

+import net.dpml.lang.NullArgumentException;
+

/**
* A entry descriptor declares the context entry import or creation criteria
for
@@ -73,7 +75,7 @@
* @param key the entry key
* @param value the single argument value
*/
- public ConstructorDirective(
+ public ConstructorDirective(
final String key, final String value )
{
this( key, "java.lang.String", value );
@@ -85,15 +87,18 @@
* @param key the entry key
* @param classname the classname of the entry implementation
* @param value the single argument value
+ * @exception NullArgumentException if either the classname argument or
the key
+ * argument is null.
*/
- public ConstructorDirective(
- final String key, final String classname, final String value )
+ public ConstructorDirective(
+ final String key, final String classname, final String value )
+ throws NullArgumentException
{
super( key );

if( null == classname )
{
- throw new NullPointerException( "classname" );
+ throw new NullArgumentException( "classname" );
}

m_params = new Parameter[0];
@@ -105,8 +110,12 @@
* Creation of a new entry directive using a parameter.
* @param key the entry key
* @param parameters implementation class constructor parameter
directives
+ * @exception NullArgumentException if either the key argument or the
parameters
+ * argument is null, or any of the elements in the parameters
array
+ * is null.
*/
public ConstructorDirective( final String key, final Parameter[]
parameters )
+ throws NullArgumentException
{
this( key, "java.lang.String", parameters );
}
@@ -116,23 +125,34 @@
* @param key the entry key
* @param classname the classname of the entry implementation
* @param params implementation class constructor parameter directives
- */
- public ConstructorDirective(
- final String key, final String classname, final Parameter[] params )
+ * @exception NullArgumentException if either the key argument or the
classname
+ * argument is null, or if any of the elements in the
parameters
+ * array is null.
+ */
+ public ConstructorDirective(
+ final String key, final String classname, final Parameter[]
parameters )
+ throws NullArgumentException
{
super( key );

- if( null == params )
+ if( null == parameters )
{
- throw new NullPointerException( "parameters" );
+ throw new NullArgumentException( "parameters" );
}
if( null == classname )
{
- throw new NullPointerException( "classname" );
+ throw new NullArgumentException( "classname" );
+ }
+ for( int i = 0; i < parameters.length; i++ )
+ {
+ if( parameters[ i ] == null )
+ {
+ throw new NullArgumentException( "parameters[" + i + "]" );
+ }
}

m_classname = classname;
- m_params = params;
+ m_params = parameters;
m_argument = null;
}


Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/EntryDirective.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/EntryDirective.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/EntryDirective.java
Mon Jan 17 18:13:05 2005
@@ -1,25 +1,29 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.composition.data;

+import net.dpml.lang. NullArgumentException;
+
import java.io.Serializable;

+import net.dpml.lang.NullArgumentException;
+
/**
* A entry descriptor declares the context entry import or creation criteria
for
* a single context entry instance.
@@ -61,12 +65,14 @@
/**
* Creation of a new entry directive using a import directive.
* @param key the entry key
+ * @exception NullArgumentException if the key argument is null.
*/
public EntryDirective( final String key )
+ throws NullArgumentException
{
if( null == key )
{
- throw new NullPointerException( "key" );
+ throw new NullArgumentException( "key" );
}
m_key = key;
}

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/ImportDirective.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/ImportDirective.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/ImportDirective.java
Mon Jan 17 18:13:05 2005
@@ -1,23 +1,25 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.composition.data;

+import net.dpml.lang.NullArgumentException;
+
/**
* An inport directive used within a context directive to request a
container scoped values.
*
@@ -57,13 +59,15 @@
* Creation of a new entry directive.
* @param key the context entry key
* @param containerKey the container scoped key value to import
+ * @exception NullArgumentException if the containerKey argument is null.
*/
public ImportDirective( final String key, final String containerKey )
+ throws NullArgumentException
{
super( key );
if( null == containerKey )
{
- throw new NullPointerException( "containerKey" );
+ throw new NullArgumentException( "containerKey" );
}
m_import = containerKey;
}

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/LibraryDirective.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/LibraryDirective.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/LibraryDirective.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,13 +21,16 @@
import java.io.Serializable;
import java.io.File;
import java.io.IOException;
+
import java.util.ArrayList;

+import net.dpml.lang.NullArgumentException;
+
/**
* <p>An library directive.</p>
* <p><b>XML</b></p>
* <p>An library element is normally contained within a scoping structure
such as a
- * classloader directive. The library element may contain any number of
"include"
+ * classloader directive. The library element may contain any number of
"include"
* or "group" elements.</p>
* <pre>
* <font color="gray">&lt;library&gt;</font>
@@ -39,7 +42,8 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id$
*/
-public class LibraryDirective implements Serializable
+public class LibraryDirective
+ implements Serializable
{
private static final String[] EMPTY_SET = new String[0];

@@ -118,18 +122,20 @@
}

/**
- * Return the set of optional extension locations as a File[]
+ * Return the set of optional extension locations as a File[]
* relative to a supplied base directory.
*
- * @param base a base directory against which relatve references shall
be resolved
+ * @param base a base directory against which relatve references shall
be resolved
* @return an array of extension library locations
* @exception IOException if a path cannot be resolved to a directory
+ * @exception NullArgumentException if the base argument is null.
*/
- public File[] getOptionalExtensionDirectories( File base ) throws
IOException
+ public File[] getOptionalExtensionDirectories( File base )
+ throws IOException, NullArgumentException
{
if( base == null )
{
- throw new NullPointerException( "base" );
+ throw new NullArgumentException( "base" );
}
String[] includes = getIncludes();
ArrayList list = new ArrayList();
@@ -141,7 +147,8 @@
return (File[]) list.toArray( new File[0] );
}

- private File getDirectory( File base, String path ) throws IOException
+ private File getDirectory( File base, String path )
+ throws IOException
{
File file = new File( path );
if( file.isAbsolute() )
@@ -158,7 +165,7 @@
return dir.getCanonicalFile();
}

- final String error =
+ final String error =
"Path does not correspond to a directory: " + dir;
throw new IOException( error );
}

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/Parameter.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/Parameter.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/Parameter.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -20,6 +20,8 @@

import java.io.Serializable;

+import net.dpml.lang.NullArgumentException;
+
/**
* A <code>Parameter</code> represents a single constructor typed argument
value. A parameter
* container a classname (default value of <code>java.lang.String</code>)
and possible sub-parameters.
@@ -49,7 +51,7 @@
* &lt;/param&gt;
* </pre>
*
- * <p>TODO: Fix usage of basic type (int, float, long, etc.) - how do we
return
+ * <p>TODO: Fix usage of basic type (int, float, long, etc.) - how do we
return
* basic types - can't use getValue() becuase it returns an Object unless
* have some way of packing the basic type into a carrier</p>
*
@@ -98,12 +100,14 @@
* Creation of a new entry directive using a supplied classname and
value.
* @param classname the classname of the parameter
* @param value the parameter constructor value
+ * @exception NullArgumentException if the classname argument is null.
*/
public Parameter( final String classname, final String value )
+ throws NullArgumentException
{
if( null == classname )
{
- throw new NullPointerException( "classname" );
+ throw new NullArgumentException( "classname" );
}

m_classname = classname;
@@ -115,18 +119,28 @@
* Creation of a new entry directive.
* @param classname the classname of the entry implementation
* @param parameters implementation class constructor parameter
directives
+ * @exception NullArgumentException if either the classname argument or
the
+ * parameters argument is null, or any of the elements in the
+ * parameters array is null.
*/
public Parameter( final String classname, final Parameter[] parameters )
+ throws NullArgumentException
{
if( null == classname )
{
- throw new NullPointerException( "classname" );
+ throw new NullArgumentException( "classname" );
}
if( null == parameters )
{
- throw new NullPointerException( "parameters" );
+ throw new NullArgumentException( "parameters" );
+ }
+ for( int i = 0; i < parameters.length; i++ )
+ {
+ if( parameters[ i ] == null )
+ {
+ throw new NullArgumentException( "parameters[" + i + "]" );
+ }
}
-
m_classname = classname;
m_parameters = parameters;
}

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/PermissionDirective.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/PermissionDirective.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/PermissionDirective.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 2004 Niclas Hedman.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -20,10 +20,14 @@
package net.dpml.composition.data;

import java.io.Serializable;
+
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+
import java.security.Permission;

+import net.dpml.lang.NullArgumentException;
+
/**
* Description of classpath.
*
@@ -34,7 +38,7 @@
{
/** The Permission object **/
private Permission m_permission;
-
+
/**
* Create a PermissionDirective instance.
*
@@ -51,30 +55,25 @@
* java.security.Permission
* @throws InvocationTargetException if the constructor in the Permission
* class throws an exception.
+ * @exception NullArgumentException if the classname argument is null.
*/
- public PermissionDirective(
- final String classname,
- final String name,
- final String action
- )
- throws
- InstantiationException,
- IllegalAccessException,
- ClassNotFoundException,
- ClassCastException,
- InvocationTargetException
+ public PermissionDirective(
+ final String classname, final String name, final String action )
+ throws InstantiationException, IllegalAccessException,
+ ClassNotFoundException, ClassCastException,
+ InvocationTargetException, NullArgumentException
{
if( classname == null )
{
- throw new NullPointerException( "classname" );
+ throw new NullArgumentException( "classname" );
}
ClassLoader trustedClassloader = this.getClass().getClassLoader();
-
+
Class clazz = trustedClassloader.loadClass( classname );
Constructor[] constructors = clazz.getConstructors();
if( name == null )
{
- m_permission = (Permission) clazz.newInstance();
+ m_permission = (Permission) clazz.newInstance();
}
else if( action == null )
{
@@ -99,7 +98,7 @@
{
return m_permission;
}
-
+
private Constructor getConstructor( Constructor[] constructors, int
noOfParameters )
{
for ( int i=0 ; i < constructors.length ; i++ )

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/SecurityProfile.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/SecurityProfile.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/SecurityProfile.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 2004 Niclas Hedhman.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -23,6 +23,8 @@

import net.dpml.meta.info.PermissionDescriptor;

+import net.dpml.lang.NullArgumentException;
+
/**
* A security profile descriptor. The descriptor declares an immutable
* set of permissions that are associated under a named profile.
@@ -51,22 +53,32 @@
//----------------------------------------------------------------------

/**
- * Creation of a new security profile using an asupplied name and set of
+ * Creation of a new security profile using an asupplied name and set of
* permissions.
* @param name the profile name
* @param permissions the assigned permissions
+ * @exception NullArgumentException if either the name argument or the
+ * permissions argument is null, or if any of the elements in
+ * the permissions array is null.
*/
public SecurityProfile( final String name, PermissionDescriptor[]
permissions )
+ throws NullArgumentException
{
if( name == null )
{
- throw new NullPointerException( "name" );
+ throw new NullArgumentException( "name" );
}
if( permissions == null )
{
- throw new NullPointerException( "permissions" );
+ throw new NullArgumentException( "permissions" );
+ }
+ for( int i = 0; i < permissions.length; i++ )
+ {
+ if( permissions[i] == null )
+ {
+ throw new NullArgumentException( "permissions[" + i + "]" );
+ }
}
-
m_name = name;
m_permissions = permissions;
}

Modified:
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ConstructorDirectiveTestCase.java
==============================================================================
---
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ConstructorDirectiveTestCase.java
(original)
+++
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ConstructorDirectiveTestCase.java
Mon Jan 17 18:13:05 2005
@@ -1,16 +1,16 @@
-/*
+/*
* Copyright 2004 Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -19,6 +19,8 @@

import junit.framework.TestCase;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.composition.data.MetaDataException;
import net.dpml.composition.data.Parameter;
import net.dpml.composition.data.ConstructorDirective;
@@ -48,9 +50,9 @@
try
{
new ConstructorDirective( null, (String) null );
- fail( "Did not throw expected NullPointerException" );
+ fail( "Did not throw expected NullArgumentException" );
}
- catch ( NullPointerException npe )
+ catch ( NullArgumentException npe )
{
// Success!!
}
@@ -58,9 +60,9 @@
try
{
new ConstructorDirective( null, (Parameter[]) null );
- fail( "Did not throw expected NullPointerException" );
+ fail( "Did not throw expected NullArgumentException" );
}
- catch ( NullPointerException npe )
+ catch ( NullArgumentException npe )
{
// Success!!
}
@@ -68,9 +70,9 @@
try
{
new ConstructorDirective( null, (String)null, (Parameter[]) null
);
- fail( "Did not throw expected NullPointerException" );
+ fail( "Did not throw expected NullArgumentException" );
}
- catch ( NullPointerException npe )
+ catch ( NullArgumentException npe )
{
// Success!!
}
@@ -79,9 +81,9 @@
try
{
new ConstructorDirective( null, params );
- fail( "Did not throw expected NullPointerException" );
+ fail( "Did not throw expected NullArgumentException" );
}
- catch ( NullPointerException npe )
+ catch ( NullArgumentException npe )
{
// Success!!
}
@@ -99,9 +101,9 @@
try
{
new ConstructorDirective( key, (Parameter[]) null );
- fail( "Did not throw expected NullPointerException" );
+ fail( "Did not throw expected NullArgumentException" );
}
- catch ( NullPointerException npe )
+ catch ( NullArgumentException npe )
{
// Success!!
}

Modified:
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ImportDirectiveTestCase.java
==============================================================================
---
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ImportDirectiveTestCase.java
(original)
+++
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ImportDirectiveTestCase.java
Mon Jan 17 18:13:05 2005
@@ -1,22 +1,24 @@
-/*
+/*
* Copyright 2004 Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.composition.data.test;

+import net.dpml.lang.NullArgumentException;
+
import junit.framework.TestCase;

import net.dpml.composition.data.MetaDataException;
@@ -43,9 +45,9 @@
try
{
new ImportDirective( null, null );
- fail( "Did not throw expected NullPointerException" );
+ fail( "Did not throw expected NullArgumentException" );
}
- catch ( NullPointerException npe )
+ catch ( NullArgumentException npe )
{
// Success!!
}
@@ -53,9 +55,9 @@
try
{
new ImportDirective( null, imp );
- fail( "Did not throw expected NullPointerException" );
+ fail( "Did not throw expected NullArgumentException" );
}
- catch ( NullPointerException npe )
+ catch ( NullArgumentException npe )
{
// Success!!
}
@@ -63,9 +65,9 @@
try
{
new ImportDirective( key, null );
- fail( "Did not throw expected NullPointerException" );
+ fail( "Did not throw expected NullArgumentException" );
}
- catch ( NullPointerException npe )
+ catch ( NullArgumentException npe )
{
// Success!!
}

Modified:
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ParameterTestCase.java
==============================================================================
---
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ParameterTestCase.java
(original)
+++
development/main/metro/composition/api/src/test/net/dpml/composition/data/test/ParameterTestCase.java
Mon Jan 17 18:13:05 2005
@@ -1,22 +1,24 @@
-/*
+/*
* Copyright 2004 Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.composition.data.test;

+import net.dpml.lang.NullArgumentException;
+
import junit.framework.TestCase;

import net.dpml.composition.data.Parameter;
@@ -49,7 +51,7 @@
new Parameter(null);
// Success!!
}
- catch (NullPointerException npe)
+ catch (NullArgumentException npe)
{
fail("Null signifes a null argument.");
}
@@ -57,9 +59,9 @@
try
{
new Parameter( null, value );
- fail( "Null classname must throw a NullPointerException" );
+ fail( "Null classname must throw a NullArgumentException" );
}
- catch ( NullPointerException npe )
+ catch ( NullArgumentException npe )
{
// Success!!
}
@@ -69,7 +71,7 @@
new Parameter( className, (String)null );
// Success!!
}
- catch ( NullPointerException npe )
+ catch ( NullArgumentException npe )
{
fail( "Null argument is a valid argument." );
}
@@ -77,9 +79,9 @@
try
{
new Parameter( null, params );
- fail( "NullPointerException must be thrown for a null
classname." );
+ fail( "NullArgumentException must be thrown for a null
classname." );
}
- catch ( NullPointerException npe )
+ catch ( NullArgumentException npe )
{
// Success!!
}
@@ -87,9 +89,9 @@
try
{
new Parameter( className, (Parameter[]) null );
- fail( "NullPointerException must be thorwn for null parameters."
);
+ fail( "NullArgumentException must be thorwn for null
parameters." );
}
- catch ( NullPointerException npe )
+ catch ( NullArgumentException npe )
{
// Success!!
}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/Commissioner.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/Commissioner.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/Commissioner.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Niclas Hedhman.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -20,26 +20,30 @@

import net.dpml.composition.model.DeploymentModel;
import net.dpml.composition.model.ContainmentModel;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;

/**
- * Runnable deployment thread that handles the commissioning of an
- * arbitary number of commissionable instances. The commissioner maintains
a
- * list of commissioning requests which are queued on a first come first
+ * Runnable deployment thread that handles the commissioning of an
+ * arbitary number of commissionable instances. The commissioner maintains a
+ * list of commissioning requests which are queued on a first come first
* serve basis.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id$
* @see CommissionRequest
*/
-class Commissioner implements Runnable
+class Commissioner
+ implements Runnable
{
//------------------------------------------------------------
// static
//------------------------------------------------------------

static private int m_ThreadCounter = 0;
-
+
//------------------------------------------------------------
// immutable state
//------------------------------------------------------------
@@ -51,7 +55,7 @@
private final String m_message;

private final boolean m_flag;
-
+
//------------------------------------------------------------
// mutable static
//------------------------------------------------------------
@@ -71,10 +75,9 @@
{
m_logger = logger;
m_ThreadCounter++;
- final String name =
- "Commissioner [" + tag + ", " + m_ThreadCounter + "]";
+ final String name = "Commissioner [" + tag + ", " + m_ThreadCounter
+ "]";
m_flag = flag;
- if( flag )
+ if( flag )
{
m_message = "commissioning";
}
@@ -90,29 +93,30 @@
// implementation
//------------------------------------------------------------

- /**
+ /**
* Commissions the given Commissonable, and allows a maximum time
* for commissioning/decommissioning to complete.
*
* @param model the deployment model
*
- * @throws CommissioningException if the deployment was not
+ * @throws CommissioningException if the deployment was not
* completed within the timeout deadline and interuption
* of the deployment was successful
- * @throws FatalCommissioningException if the deployment was not
+ * @throws FatalCommissioningException if the deployment was not
* completed within the timeout deadline and interuption
* of the deployment was not successful
* @throws Exception any Exception or Error thrown within the
* deployment of the component is forwarded to the caller.
* @throws InvocationTargetException if the deployment throws a
* Throwable subclass that is NOT of type Exception or Error.
+ * @exception NullArgumentException if the model argument is null.
**/
void commission( DeploymentModel model )
- throws Exception
+ throws Exception, NullArgumentException
{
if( null == model )
{
- throw new NullPointerException( "model" );
+ throw new NullArgumentException( "model" );
}

if( null != m_thread )
@@ -121,48 +125,48 @@
{
if( model instanceof ContainmentModel )
{
- m_logger.debug(
- m_message
- + " container ["
- + model.getName()
+ m_logger.debug(
+ m_message
+ + " container ["
+ + model.getName()
+ "]" );
}
else
{
- m_logger.debug(
- m_message
- + " component ["
- + model.getName()
+ m_logger.debug(
+ m_message
+ + " component ["
+ + model.getName()
+ "]" );
}
}
-
- CommissionRequest request =
+
+ CommissionRequest request =
new CommissionRequest( model, m_thread );
m_queue.put( request );
long t = request.waitForCompletion();
if( m_logger.isDebugEnabled() )
{
- m_logger.debug(
- m_message
- + " of ["
- + model.getName()
- + "] completed in "
- + t
+ m_logger.debug(
+ m_message
+ + " of ["
+ + model.getName()
+ + "] completed in "
+ + t
+ " milliseconds" );
}
}
else
{
- final String warning =
- "Ignoring "
- + m_message
+ final String warning =
+ "Ignoring "
+ + m_message
+ " request on a disposed commissioner.";
m_logger.warn( warning );
}
}

- /**
+ /**
* Disposal of the Commissioner.
* The Commissioner allocates a deployment thread, which needs to be
* disposed of before releasing the Commissioner reference.
@@ -170,11 +174,11 @@
void dispose()
{
if( null != m_thread )
- {
+ {
m_thread.interrupt();
}
}
-
+
public void run()
{
try
@@ -194,7 +198,7 @@
model.decommission();
}
request.done();
- }
+ }
catch( InterruptedException e )
{
request.interrupted();
@@ -204,9 +208,9 @@
request.exception( e );
}
}
- }
+ }
catch( InterruptedException e )
- {
+ {
// ignore, part of dispose;
}
m_thread = null;

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -19,19 +19,30 @@
package net.dpml.composition.model.impl;

import java.io.File;
+
import java.net.URL;

import net.dpml.composition.data.ClassLoaderDirective;
+
import net.dpml.composition.model.ServiceRepository;
import net.dpml.composition.model.TypeRepository;
+
import net.dpml.composition.provider.ClassLoaderContext;
+
import net.dpml.context.impl.DefaultContext;
+
import net.dpml.extension.manager.ExtensionManager;
import net.dpml.extension.manager.OptionalPackage;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.system.SystemContext;
+
import net.dpml.transit.repository.Repository;


@@ -66,13 +77,13 @@
private final ClassLoader m_parent;

/**
- * Option packages established through the chain of parent
+ * Option packages established through the chain of parent
* models.
*/
private final OptionalPackage[] m_packages;

/**
- * The base directory for resolution of extension directories and
+ * The base directory for resolution of extension directories and
* fileset directories.
*/
private final File m_base;
@@ -124,11 +135,11 @@
* @param parent the parent classloader
* @param directive the classloader directive
*/
- public DefaultClassLoaderContext(
- Logger logger, SystemContext system,
+ public DefaultClassLoaderContext(
+ Logger logger, SystemContext system,
ClassLoader parent, ClassLoaderDirective directive )
{
- this( logger, system, parent,
+ this( logger, system, parent,
new OptionalPackage[0], null, null, null, directive, null );
}

@@ -138,43 +149,46 @@
* @param logger the logging channel to assign to the classloader model
* @param system the system context
* @param parent the parent classloader
- * @param packages the set of optional packages established under
+ * @param packages the set of optional packages established under
* current classloader chain
- * @param manager the optional extions package manager established
+ * @param manager the optional extions package manager established
* by the parent classloader
* @param types the parent type manager
* @param services the parent service manager
* @param directive the classloader directive
* @param implied url array added though implication
+ * @exception NullArgumentException if any one of the logger, parent,
packages,
+ * directive or system arguments is null.
*/
- public DefaultClassLoaderContext(
- Logger logger, SystemContext system,
- ClassLoader parent, OptionalPackage[] packages,
- ExtensionManager manager, TypeRepository types,
- ServiceRepository services,
- ClassLoaderDirective directive,
- URL[] implied )
+ public DefaultClassLoaderContext(
+ Logger logger, SystemContext system,
+ ClassLoader parent, OptionalPackage[] packages,
+ ExtensionManager manager, TypeRepository types,
+ ServiceRepository services,
+ ClassLoaderDirective directive,
+ URL[] implied )
+ throws NullArgumentException
{
super();
if( logger == null )
{
- throw new NullPointerException( "logger" );
+ throw new NullArgumentException( "logger" );
}
if( parent == null )
{
- throw new NullPointerException( "parent" );
+ throw new NullArgumentException( "parent" );
}
if( packages == null )
{
- throw new NullPointerException( "packages" );
+ throw new NullArgumentException( "packages" );
}
if( directive == null )
{
- throw new NullPointerException( "directive" );
+ throw new NullArgumentException( "directive" );
}
if( system == null )
{
- throw new NullPointerException( "system" );
+ throw new NullArgumentException( "system" );
}

m_logger = logger;
@@ -259,7 +273,7 @@
}

/**
- * Return the extension manager established by the parent
+ * Return the extension manager established by the parent
* classloader model.
*
* @return the extension manager
@@ -290,7 +304,7 @@
}

/**
- * Return the classloader directive to be applied to the
+ * Return the classloader directive to be applied to the
* classloader model.
*
* @return the classloader directive

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
Mon Jan 17 18:13:05 2005
@@ -20,15 +20,19 @@

import java.io.File;
import java.io.IOException;
+
import java.net.JarURLConnection;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLStreamHandler;
import java.net.URLStreamHandlerFactory;
+
import java.security.CodeSource;
import java.security.cert.Certificate;
+
import java.util.ArrayList;
import java.util.List;
+
import java.util.jar.Manifest;

import net.dpml.composition.data.ClassLoaderDirective;
@@ -36,21 +40,32 @@
import net.dpml.composition.data.ExcludeDirective;
import net.dpml.composition.data.FilesetDirective;
import net.dpml.composition.data.IncludeDirective;
+
import net.dpml.composition.model.ClassLoaderModel;
import net.dpml.composition.model.ModelException;
import net.dpml.composition.model.ServiceRepository;
import net.dpml.composition.model.TypeRepository;
+
import net.dpml.composition.provider.ClassLoaderContext;
+
import net.dpml.extension.Extension;
+
import net.dpml.extension.manager.ExtensionManager;
import net.dpml.extension.manager.OptionalPackage;
import net.dpml.extension.manager.PackageManager;
+
import net.dpml.extension.manager.impl.DefaultExtensionManager;
import net.dpml.extension.manager.impl.DelegatingExtensionManager;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.system.SystemContext;
+
import net.dpml.transit.artifact.Artifact;
import net.dpml.transit.artifact.Handler;

@@ -131,13 +146,14 @@
* enabling the creation of a fully populated classpath.
*
* @param context the classloader context
+ * @exception NullArgumentException if the context argument is null.
*/
public DefaultClassLoaderModel( ClassLoaderContext context )
- throws ModelException
+ throws ModelException, NullArgumentException
{
if( context == null )
{
- throw new NullPointerException( "context" );
+ throw new NullArgumentException( "context" );
}

m_context = context;

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentContext.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentContext.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentContext.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,12 +21,14 @@
import java.io.File;

import net.dpml.composition.data.ComponentProfile;
+
import net.dpml.composition.model.ContainmentModel;
import net.dpml.composition.model.DependencyGraph;
+
import net.dpml.composition.provider.ComponentContext;
import net.dpml.composition.provider.Runtime;

-import net.dpml.system.SystemContext;
+import net.dpml.lang.NullArgumentException;

import net.dpml.logging.Logger;

@@ -35,6 +37,8 @@
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;

+import net.dpml.system.SystemContext;
+

/**
* Default implementation of a deployment context that is used
@@ -44,7 +48,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id$
*/
-public class DefaultComponentContext extends DefaultDeploymentContext
+public class DefaultComponentContext extends DefaultDeploymentContext
implements ComponentContext
{
//==============================================================
@@ -89,55 +93,58 @@
* @param type the underlying component type
* @param clazz the component deployment class
* @param dir the home working directory
- * @param temp a temporary directory
- * @param partition the partition name
+ * @param temp a temporary directory
+ * @param partition the partition name
* @param runtime the runtime provider
* @param timeout the default deployment timeout
+ * @exception NullArgumentException if any one of the partition,
classloader,
+ * clazz, profile or model argument is null.
*/
- public DefaultComponentContext(
- Logger logger, String name, SystemContext system, ClassLoader
classloader,
- DependencyGraph graph, ContainmentModel model, ComponentProfile
profile,
- Type type, Class clazz, File dir, File temp,
- String partition, Runtime runtime, long timeout )
+ public DefaultComponentContext(
+ Logger logger, String name, SystemContext system, ClassLoader
classloader,
+ DependencyGraph graph, ContainmentModel model, ComponentProfile
profile,
+ Type type, Class clazz, File dir, File temp,
+ String partition, Runtime runtime, long timeout )
+ throws NullArgumentException
{
- super(
- logger, system, partition, name, profile.getMode(),
+ super(
+ logger, system, partition, name, profile.getMode(),
profile, graph, runtime, timeout );

if( partition == null )
{
- throw new NullPointerException( "partition" );
+ throw new NullArgumentException( "partition" );
}
if( classloader == null )
{
- throw new NullPointerException( "classloader" );
+ throw new NullArgumentException( "classloader" );
}
if( clazz == null )
{
- throw new NullPointerException( "clazz" );
+ throw new NullArgumentException( "clazz" );
}
if( type == null )
{
- throw new NullPointerException( "type" );
+ throw new NullArgumentException( "type" );
}
if( profile == null )
{
- throw new NullPointerException( "profile" );
+ throw new NullArgumentException( "profile" );
}
if( model == null )
{
- throw new NullPointerException( "model" );
+ throw new NullArgumentException( "model" );
}

if( dir.exists() && !dir.isDirectory() )
{
- final String error =
+ final String error =
REZ.getString(
"deployment.context.home.not-a-directory.error", dir );
throw new IllegalArgumentException( error );
}
if( temp.exists() && !temp.isDirectory() )
{
- final String error =
+ final String error =
REZ.getString(
"deployment.context.temp.not-a-directory.error", temp );
throw new IllegalArgumentException( error );
}
@@ -159,7 +166,7 @@
* Return the enclosing containment model.
* @return the containment model that component is within
*/
- public ContainmentModel getContainmentModel()
+ public ContainmentModel getContainmentModel()
{
return m_model;
}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004-2005 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -19,7 +19,9 @@
package net.dpml.composition.model.impl;

import java.io.InputStream;
+
import java.lang.reflect.Constructor;
+
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Properties;
@@ -29,6 +31,7 @@
import net.dpml.composition.data.DeploymentProfile;
import net.dpml.composition.data.Mode;
import net.dpml.composition.data.StageDirective;
+
import net.dpml.composition.model.ComponentModel;
import net.dpml.composition.model.ContextModel;
import net.dpml.composition.model.DependencyModel;
@@ -36,16 +39,25 @@
import net.dpml.composition.model.ModelException;
import net.dpml.composition.model.ModelRuntimeException;
import net.dpml.composition.model.StageModel;
+
import net.dpml.composition.provider.ComponentContext;
import net.dpml.composition.provider.SecurityModel;
+
import net.dpml.composition.util.XercesSchemaValidator;
+
import net.dpml.configuration.Configurable;
import net.dpml.configuration.Configuration;
+
import net.dpml.configuration.impl.CascadingConfiguration;
import net.dpml.configuration.impl.DefaultConfiguration;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.meta.info.ContextDescriptor;
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.InfoDescriptor;
@@ -53,13 +65,14 @@
import net.dpml.meta.info.ServiceDescriptor;
import net.dpml.meta.info.StageDescriptor;
import net.dpml.meta.info.Type;
+
import net.dpml.parameters.Parameterizable;
import net.dpml.parameters.Parameters;
import net.dpml.parameters.impl.DefaultParameters;

/**
* Deployment model defintion.
- *
+ *
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta
* Library </a>
* @version $Id$
@@ -121,7 +134,7 @@

/**
* Creation of a new deployment model.
- *
+ *
* @param context
* the deployment context
*/
@@ -275,7 +288,7 @@

/**
* Commission the model.
- *
+ *
* @exception Exception
* if a commissioning error occurs
*/
@@ -299,7 +312,7 @@

/**
* Returns the assembled state of the model.
- *
+ *
* @return true if this model is assembled
*/
public boolean isAssembled()
@@ -336,7 +349,7 @@

/**
* Return the set of models assigned as providers.
- *
+ *
* @return the providers consumed by the model
* @exception IllegalStateException
* if the model is not in an assembled state
@@ -376,7 +389,7 @@

/**
* Return the set of services produced by the model.
- *
+ *
* @return the service descriptors
*/
public ServiceDescriptor[] getServices()
@@ -387,7 +400,7 @@
/**
* Return TRUE is this model is capable of supporting a supplied
* depedendency.
- *
+ *
* @param dependency
* the dependency descriptor
* @return true if this model can fulfill the dependency
@@ -400,7 +413,7 @@
/**
* Return TRUE is this model is capable of supporting a supplied stage
* dependency.
- *
+ *
* @param stage
* the stage descriptor
* @return TRUE if this model can fulfill the stage dependency
@@ -412,7 +425,7 @@

/**
* Return TRUE is this model is capable of supporting a supplied service.
- *
+ *
* @param reference
* the service reference descriptor
* @return true if this model can fulfill the service
@@ -430,7 +443,7 @@
* Return the collection policy for the model. If a profile does not
declare
* a collection policy, then the collection policy declared by the
* underlying component type will be used.
- *
+ *
* @return the collection policy
* @see InfoDescriptor#WEAK
* @see InfoDescriptor#SOFT
@@ -451,7 +464,7 @@

/**
* Set the collection policy for the model.
- *
+ *
* @param policy
* the collection policy
* @see InfoDescriptor#WEAK
@@ -492,7 +505,7 @@
* enabled is disabled the operation will return false otherwise the
value
* returned is true unless overriden by the "urn:composition:proxy"
* attribute.
- *
+ *
* @return the proxy policy
*/
public boolean getProxyPolicy()
@@ -517,7 +530,7 @@

/**
* Return the activation policy for the model.
- *
+ *
* @return the activaltion policy
*/
public boolean getActivationPolicy()
@@ -527,7 +540,7 @@

/**
* Set the activation policy for the model.
- *
+ *
* @param policy
* the activaltion policy
*/
@@ -538,7 +551,7 @@

/**
* Return the component type descriptor.
- *
+ *
* @return the type descriptor
*/
public Type getType()
@@ -548,7 +561,7 @@

/**
* Return the class for the deployable target.
- *
+ *
* @return the class
*/
public Class getDeploymentClass()
@@ -558,7 +571,7 @@

/**
* Rest if the component type backing the model is parameterizable.
- *
+ *
* @return TRUE if the compoent type is parameterizable otherwise FALSE
*/
public boolean isParameterizable()
@@ -594,7 +607,7 @@
/**
* Set the parameters to the supplied value. The supplied parameters
value
* will replace the existing parameters value.
- *
+ *
* @param parameters
* the supplied parameters value
*/
@@ -606,7 +619,7 @@
/**
* Set the parameters to the supplied value. The supplied parameters
value
* may suppliment or replace the existing parameters value.
- *
+ *
* @param parameters
* the supplied parameters
* @param merge
@@ -616,9 +629,10 @@
* @exception IllegalStateException
* if the component type backing the model does not
implement
* the parameteriazable interface
+ * @exception NullArgumentException if the parameters argument is null.
*/
public void setParameters( Parameters parameters, boolean merge )
- throws IllegalStateException
+ throws IllegalStateException, NullArgumentException
{
if ( !isParameterizable() )
{
@@ -630,7 +644,7 @@

if ( parameters == null )
{
- throw new NullPointerException( "parameters" );
+ throw new NullArgumentException( "parameters" );
}

if ( merge )
@@ -661,7 +675,7 @@

/**
* Return the parameters to be applied to the component.
- *
+ *
* @return the assigned parameters
*/
public Parameters getParameters()
@@ -677,7 +691,7 @@

/**
* Test if the component type backing the model is configurable.
- *
+ *
* @return TRUE if the component type is configurable otherwise FALSE
*/
public boolean isConfigurable()
@@ -711,7 +725,7 @@
/**
* Set the configuration to the supplied value. The supplied
configuration
* will replace the existing configuration.
- *
+ *
* @param config
* the supplied configuration
* @exception IllegalStateException
@@ -730,7 +744,7 @@
/**
* Set the configuration to the supplied value. The supplied
configuration
* may suppliment or replace the existing configuration.
- *
+ *
* @param iConfig
* the supplied configuration
* @param policy
@@ -807,7 +821,7 @@
* implementation returns the current configuration state. If the the
* component type does not implementation the Configurable interface, the
* implementation returns null.
- *
+ *
* @return the qualified configuration
*/
public Configuration getConfiguration()
@@ -817,7 +831,7 @@

/**
* Return the context model for this deployment model.
- *
+ *
* @return the context model if this model is context dependent, else the
* return value is null
*/
@@ -828,7 +842,7 @@

/**
* Return the dependency models for this component type.
- *
+ *
* @return the dependency models
*/
public DependencyModel[] getDependencyModels()
@@ -839,7 +853,7 @@
/**
* Return a dependency model matching the supplied descriptor. If no
model
* matches the supplied descriptor the implementation will return null.
- *
+ *
* @param dependency
* the dependency descriptor
* @return the matching stage model
@@ -860,7 +874,7 @@

/**
* Return the stage models for this component type.
- *
+ *
* @return the stage models
*/
public StageModel[] getStageModels()
@@ -871,7 +885,7 @@
/**
* Return a stage model matching the supplied descriptor. If no stage
model
* matches the supplied descriptor the implementation will return null.
- *
+ *
* @param stage
* the stage descriptor
* @return the matching stage model
@@ -892,7 +906,7 @@

/**
* Return the set of services produced by the model as a array of
classes.
- *
+ *
* @return the service classes
*/
public Class[] getInterfaces()
@@ -931,7 +945,7 @@

/**
* Return the deployment timeout value for the component.
- *
+ *
* @return the default deployment timeout value
*/
public long getDeploymentTimeout()
@@ -964,7 +978,7 @@
/**
* Test to determin if the first constructor supports the context base
class
* as a parameter type.
- *
+ *
* @return TRUE or FALSE
*/
private boolean isaConstructorArg( Class base )

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionContext.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionContext.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionContext.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -20,9 +20,14 @@

import net.dpml.composition.provider.CompositionContext;
import net.dpml.composition.provider.CompositionException;
+
import net.dpml.context.impl.DefaultContext;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.system.SystemContext;

/**
@@ -32,7 +37,7 @@
* @version $Id$
*/
public class DefaultCompositionContext extends DefaultContext
- implements CompositionContext
+ implements CompositionContext
{
//--------------------------------------------------------------
// static
@@ -75,13 +80,10 @@
* @param secure the security enablement flag
* @param name the logging category name
*/
- DefaultCompositionContext(
- SystemContext system,
- ClassLoader api,
- ClassLoader spi,
- long timeout,
- boolean secure,
- boolean audit ) throws CompositionException
+ DefaultCompositionContext(
+ SystemContext system, ClassLoader api, ClassLoader spi,
+ long timeout, boolean secure, boolean audit )
+ throws CompositionException, NullArgumentException
{
super();

@@ -146,7 +148,7 @@
}

/**
- * Return the SPI classloader.
+ * Return the SPI classloader.
*
* @return the system classloader
*/
@@ -169,10 +171,11 @@
//------------------------------------------------------------------

private void assertNotNull( String name, Object object )
+ throws NullArgumentException
{
- if( null == object )
+ if( null == object )
{
- throw new NullPointerException( name );
- }
+ throw new NullArgumentException( name );
+ }
}
}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionCriteria.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionCriteria.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionCriteria.java
Mon Jan 17 18:13:05 2005
@@ -20,17 +20,24 @@

import java.io.File;
import java.io.FileNotFoundException;
+
import java.net.MalformedURLException;
import java.net.URL;
+
import java.util.ArrayList;
import java.util.Properties;

import net.dpml.composition.provider.CompositionCriteria;
import net.dpml.composition.provider.CompositionRuntimeException;
+
import net.dpml.criteria.Criteria;
import net.dpml.criteria.PackedParameter;
import net.dpml.criteria.Parameter;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.system.SystemContext;
+
import net.dpml.transit.artifact.Handler;

/**
@@ -283,10 +290,11 @@


private URL resolveURL( File base, String value )
+ throws NullArgumentException
{
if( null == base )
{
- throw new NullPointerException( "base" );
+ throw new NullArgumentException( "base" );
}
if( value.startsWith( "block:" ) )
{
@@ -336,8 +344,9 @@
}

private URL toURL( File file )
+ throws NullArgumentException
{
- if( null == file ) throw new NullPointerException( "file" );
+ if( null == file ) throw new NullArgumentException( "file" );
try
{
return file.getCanonicalFile().toURL();
@@ -353,8 +362,9 @@
}

private URL artifactSpecToURL( String spec )
+ throws NullArgumentException
{
- if( null == spec ) throw new NullPointerException( "spec" );
+ if( null == spec ) throw new NullArgumentException( "spec" );
try
{
return new URL( null, spec, new Handler() );
@@ -370,8 +380,9 @@
}
/* Never used. TODO Remove.
private URL toURL( String spec )
+ throws NullArgumentException
{
- if( null == spec ) throw new NullPointerException( "spec" );
+ if( null == spec ) throw new NullArgumentException( "spec" );

try
{

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionFactory.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionFactory.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionFactory.java
Mon Jan 17 18:13:05 2005
@@ -20,27 +20,37 @@

import java.io.File;
import java.io.IOException;
+
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
+
import java.util.Map;

import net.dpml.composition.data.builder.CompositionContentHandlerFactory;
+
import net.dpml.composition.model.ContainmentModel;
import net.dpml.composition.model.DeploymentModel;
import net.dpml.composition.model.ModelException;
+
import net.dpml.composition.provider.CompositionContext;
import net.dpml.composition.provider.CompositionCriteria;
import net.dpml.composition.provider.CompositionException;
import net.dpml.composition.provider.CompositionFactory;
import net.dpml.composition.provider.CompositionRuntimeException;
import net.dpml.composition.provider.ModelFactory;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.system.Factory;
import net.dpml.system.SystemContext;
+
import net.dpml.transit.artifact.Artifact;

import org.apache.commons.cli.CommandLine;
@@ -518,7 +528,7 @@
private URL getTargetOverrideURL( File dir, String path )
throws CompositionException, IOException
{
- if( null == path )
+ if( null == path )
return null;

if( !isaURL( path ) )
@@ -555,12 +565,13 @@
}

private URL resolveURL( File base, String path, boolean fail )
+ throws NullArgumentException
{
if( null == path )
{
if( fail )
{
- throw new NullPointerException( "path" );
+ throw new NullArgumentException( "path" );
}
else
{
@@ -596,7 +607,7 @@
}
}

- private File resolveFile( File base, String path )
+ private File resolveFile( File base, String path )
throws IOException
{
if( null == path )

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultConstructorModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultConstructorModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultConstructorModel.java
Mon Jan 17 18:13:05 2005
@@ -19,12 +19,15 @@
package net.dpml.composition.model.impl;

import java.lang.reflect.Constructor;
+
import java.util.Map;

import net.dpml.composition.data.ConstructorDirective;
import net.dpml.composition.data.Parameter;
+
import net.dpml.composition.model.EntryModel;
import net.dpml.composition.model.ModelException;
+
import net.dpml.composition.provider.ComponentContext;

import net.dpml.meta.info.EntryDescriptor;
@@ -32,6 +35,8 @@
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;

+import net.dpml.lang.NullArgumentException;
+

/**
* Default implementation of a the context entry constructor model.
@@ -77,20 +82,23 @@
* @param directive the context entry directive
* @param context the containment context
* @param map a map of available context entries
+ * @exception NullArgumentException if either the directive argument or
the
+ * context argument is null.
*/
public DefaultConstructorModel(
- EntryDescriptor descriptor, ConstructorDirective directive,
- ComponentContext context, Map map ) throws ModelException
+ EntryDescriptor descriptor, ConstructorDirective directive,
+ ComponentContext context, Map map )
+ throws ModelException, NullArgumentException
{
super( descriptor );

if( directive == null )
{
- throw new NullPointerException( "directive" );
+ throw new NullArgumentException( "directive" );
}
if( context == null )
{
- throw new NullPointerException( "context" );
+ throw new NullArgumentException( "context" );
}
m_descriptor = descriptor;
m_directive = directive;
@@ -100,7 +108,8 @@
validate();
}

- private void validate() throws ModelException
+ private void validate()
+ throws ModelException
{
final String descriptorClassName = m_descriptor.getClassname();
final String directiveClassName = m_directive.getClassname();
@@ -116,7 +125,7 @@
}

private void validatePair( String descriptorClass, String directiveClass
)
- throws ModelException
+ throws ModelException
{
final String key = m_descriptor.getKey();
ClassLoader loader = m_context.getClassLoader();
@@ -177,7 +186,8 @@
*
* @return the context entry value
*/
- public Object getValue() throws ModelException
+ public Object getValue()
+ throws ModelException
{
if( m_value != null )
{
@@ -216,7 +226,8 @@
*
* @return the context entry value
*/
- public Object getValue( Parameter p ) throws ModelException
+ public Object getValue( Parameter p )
+ throws ModelException
{
ClassLoader loader = m_context.getClassLoader();
String classname = p.getClassname();
@@ -236,8 +247,9 @@
* @exception ModelException if the parameter value cannot be resolved
*/
public Object getValue(
- ClassLoader loader, Class clazz, String argument,
- Parameter[] parameters ) throws ModelException
+ ClassLoader loader, Class clazz, String argument,
+ Parameter[] parameters )
+ throws ModelException
{
//
// if the parameter contains a text argument then check if its a
reference

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentContext.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentContext.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentContext.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,16 +21,20 @@
import java.io.File;

import net.dpml.composition.data.ContainmentProfile;
+
import net.dpml.composition.model.DependencyGraph;
import net.dpml.composition.model.ContainmentModel;
import net.dpml.composition.model.ClassLoaderModel;
import net.dpml.composition.model.ModelRepository;
+
import net.dpml.composition.provider.ContainmentContext;
import net.dpml.composition.provider.ModelFactory;
import net.dpml.composition.provider.Runtime;

import net.dpml.system.SystemContext;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;

import net.dpml.i18n.ResourceManager;
@@ -43,7 +47,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id$
*/
-public class DefaultContainmentContext extends DefaultDeploymentContext
+public class DefaultContainmentContext extends DefaultDeploymentContext
implements ContainmentContext
{
//---------------------------------------------------------
@@ -87,14 +91,14 @@
* @param factory the model factory
* @param runtime the runtime provider
*/
- public DefaultContainmentContext(
- Logger logger, SystemContext system, ClassLoaderModel model,
- ModelRepository repository, DependencyGraph graph,
+ public DefaultContainmentContext(
+ Logger logger, SystemContext system, ClassLoaderModel model,
+ ModelRepository repository, DependencyGraph graph,
ContainmentProfile profile, ModelFactory factory, Runtime runtime,
long timeout )
{
this( logger, system, model, repository, graph,
- new File( system.getWorkingDirectory(), "home" ),
- new File( system.getTempDirectory(), "root" ),
+ new File( system.getWorkingDirectory(), "home" ),
+ new File( system.getTempDirectory(), "root" ),
null, profile, null, "", factory, runtime, timeout );
}

@@ -114,52 +118,55 @@
* @param name the assigned containment context name
* @param factory the model factory
* @param runtime the runtime provider
+ * @exception NullArgumentException if either one of the system, factory,
model,
+ * dir, temp or profile arguments is null.
*/
- public DefaultContainmentContext(
- Logger logger, SystemContext system, ClassLoaderModel model,
- ModelRepository repository, DependencyGraph graph,
- File dir, File temp, ContainmentModel parent,
- ContainmentProfile profile, String partition, String name,
ModelFactory factory,
- Runtime runtime, long timeout )
+ public DefaultContainmentContext(
+ Logger logger, SystemContext system, ClassLoaderModel model,
+ ModelRepository repository, DependencyGraph graph,
+ File dir, File temp, ContainmentModel parent,
+ ContainmentProfile profile, String partition, String name,
+ ModelFactory factory, Runtime runtime, long timeout )
+ throws NullArgumentException
{
super( logger, system, partition, name, profile.getMode(), profile,
graph, runtime, timeout );

if( system == null )
{
- throw new NullPointerException( "system" );
+ throw new NullArgumentException( "system" );
}
if( factory == null )
{
- throw new NullPointerException( "factory" );
+ throw new NullArgumentException( "factory" );
}
if( model == null )
{
- throw new NullPointerException( "model" );
+ throw new NullArgumentException( "model" );
}
if( dir == null )
{
- throw new NullPointerException( "dir" );
+ throw new NullArgumentException( "dir" );
}
if( temp == null )
{
- throw new NullPointerException( "temp" );
+ throw new NullArgumentException( "temp" );
}
if( profile == null )
{
- throw new NullPointerException( "profile" );
+ throw new NullArgumentException( "profile" );
}

if( dir.exists() && !dir.isDirectory() )
{
- final String error =
- REZ.getString(
+ final String error =
+ REZ.getString(
"containment.context.home.not-a-directory.error",
dir.toString() );
throw new IllegalArgumentException( error );
}
if( temp.exists() && !temp.isDirectory() )
{
- final String error =
- REZ.getString(
+ final String error =
+ REZ.getString(
"containment.context.temp.not-a-directory.error",
temp.toString() );
throw new IllegalArgumentException( error );
}
@@ -190,7 +197,7 @@


/**
- * Return the working directory from which containers may
+ * Return the working directory from which containers may
* establish persistent content.
*
* @return the working directory
@@ -201,8 +208,8 @@
}

/**
- * Return the temporary directory from which a container
- * may use to establish a transient content directory.
+ * Return the temporary directory from which a container
+ * may use to establish a transient content directory.
*
* @return the temporary directory
*/
@@ -242,9 +249,9 @@
}

/**
- * Return the containment classloader. This method is a
- * convinience operation equivalent to
- * getClassLoaderModel().getClassLoader();
+ * Return the containment classloader. This method is a
+ * convinience operation equivalent to
+ * getClassLoaderModel().getClassLoader();
*
* @return the classloader
*/

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
Mon Jan 17 18:13:05 2005
@@ -21,9 +21,11 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
+
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
@@ -36,11 +38,14 @@
import net.dpml.composition.data.DeploymentProfile;
import net.dpml.composition.data.NamedComponentProfile;
import net.dpml.composition.data.TargetDirective;
+
import net.dpml.composition.data.builder.ContainmentProfileBuilder;
import net.dpml.composition.data.builder.XMLContainmentProfileCreator;
import net.dpml.composition.data.builder.XMLTargetsCreator;
+
import net.dpml.composition.event.CompositionEvent;
import net.dpml.composition.event.CompositionListener;
+
import net.dpml.composition.model.AssemblyException;
import net.dpml.composition.model.ClassLoaderModel;
import net.dpml.composition.model.ComponentModel;
@@ -54,23 +59,34 @@
import net.dpml.composition.model.ServiceModel;
import net.dpml.composition.model.StageModel;
import net.dpml.composition.model.TypeRepository;
+
import net.dpml.composition.provider.ComponentContext;
import net.dpml.composition.provider.ContainmentContext;
import net.dpml.composition.provider.ModelFactory;
import net.dpml.composition.provider.SecurityModel;
+
import net.dpml.configuration.Configuration;
import net.dpml.configuration.impl.DefaultConfigurationBuilder;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.logging.provider.LoggingManager;
+
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.ServiceDescriptor;
import net.dpml.meta.info.StageDescriptor;
import net.dpml.meta.info.Type;
+
import net.dpml.parameters.Parameters;
+
import net.dpml.system.SystemContext;
+
import net.dpml.transit.artifact.Artifact;


@@ -616,11 +632,15 @@
* @param profile a containment or deployment profile
* @return the model based on the supplied profile
* @exception ModelException if an error occurs during model establishment
+ * @exception NullArgumentException if the profile argument is null.
*/
- DeploymentModel createDeploymentModel( String name, DeploymentProfile
profile ) throws ModelException
+ DeploymentModel createDeploymentModel( String name, DeploymentProfile
profile )
+ throws ModelException, NullArgumentException
{
if( null == profile )
- throw new NullPointerException( "profile" );
+ {
+ throw new NullArgumentException( "profile" );
+ }

DeploymentModel model;
if( profile instanceof ContainmentProfile )

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -22,6 +22,7 @@
import java.util.List;

import net.dpml.composition.data.DeploymentProfile;
+
import net.dpml.composition.model.AssemblyException;
import net.dpml.composition.model.ComponentModel;
import net.dpml.composition.model.ContainmentModel;
@@ -36,9 +37,14 @@
import net.dpml.composition.model.StageModel;
import net.dpml.composition.model.TypeRepository;
import net.dpml.composition.model.TypeUnknownException;
+
import net.dpml.composition.provider.ContainmentContext;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.StageDescriptor;
@@ -157,22 +163,22 @@
/**
* Assemble a target model during which all deployment and runtime
* dependencies are assigned a provider model.
- *
- * @param model
- * the target model to be assembled
- * @param subject
- * the model requesting the assembly
+ *
+ * @param model the target model to be assembled
+ * @param subject the model requesting the assembly
+ * @exception NullArgumentException if either the model argument or the
+ * subjects argument is null.
*/
public void assembleModel( DeploymentModel model, List subjects )
- throws AssemblyException
+ throws AssemblyException, NullArgumentException
{
if( null == model )
{
- throw new NullPointerException( "model" );
+ throw new NullArgumentException( "model" );
}
if( null == subjects )
{
- throw new NullPointerException( "subjects" );
+ throw new NullArgumentException( "subjects" );
}
if( subjects.contains( model ) )
{
@@ -306,9 +312,9 @@
DeploymentModel model = m_model.getModel( path );
if( null == model )
{
- final String error =
+ final String error =
"The supplied dependency path ["
- + path
+ + path
+ "] does not reference a known component.";
throw new AssemblyException( error );
}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelComponentHelper.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelComponentHelper.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelComponentHelper.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,22 +21,28 @@
import java.io.File;

import net.dpml.composition.data.ComponentProfile;
+
import net.dpml.composition.model.ContainmentModel;
import net.dpml.composition.model.ModelException;
import net.dpml.composition.model.DependencyGraph;
-import net.dpml.system.SystemContext;
+
import net.dpml.composition.provider.ContainmentContext;
import net.dpml.composition.provider.ComponentContext;

-import net.dpml.logging.provider.LoggingManager;
-import net.dpml.logging.data.CategoriesDirective;
+import net.dpml.i18n.ResourceManager;
+import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;

import net.dpml.logging.Logger;

+import net.dpml.logging.data.CategoriesDirective;
+
+import net.dpml.logging.provider.LoggingManager;
+
import net.dpml.meta.info.Type;

-import net.dpml.i18n.ResourceManager;
-import net.dpml.i18n.Resources;
+import net.dpml.system.SystemContext;

/**
* A utility class that handles creation of a component model context.
@@ -51,7 +57,7 @@
//-------------------------------------------------------------------

private static final Resources REZ =
- ResourceManager.getPackageResources(
+ ResourceManager.getPackageResources(
DefaultContainmentModelComponentHelper.class );

//-------------------------------------------------------------------
@@ -69,17 +75,19 @@
* Creation of a component context creation helper.
* @param context the containment model context
* @param model the containment model
+ * @exception NullArgumentException if either the context argument or the
model
+ * argument is null.
*/
- public DefaultContainmentModelComponentHelper(
- ContainmentContext context, ContainmentModel model )
+ public DefaultContainmentModelComponentHelper(
+ ContainmentContext context, ContainmentModel model )
{
if( context == null )
{
- throw new NullPointerException( "context" );
+ throw new NullArgumentException( "context" );
}
if( model == null )
{
- throw new NullPointerException( "model" );
+ throw new NullArgumentException( "model" );
}
m_context = context;
m_model = model;
@@ -94,13 +102,14 @@
*
* @param profile the component profile
* @return the component model context
+ * @exception NullArgumentException if the profile argument is null.
*/
public ComponentContext createComponentContext( final ComponentProfile
profile )
- throws ModelException
+ throws ModelException, NullArgumentException
{
if( null == profile )
{
- throw new NullPointerException( "profile" );
+ throw new NullArgumentException( "profile" );
}

SystemContext system = m_context.getSystemContext();
@@ -113,8 +122,7 @@
logging.addCategories( partition, categories );
}

- Logger logger =
- logging.getLoggerForCategory( partition + name );
+ Logger logger = logging.getLoggerForCategory( partition + name );
DependencyGraph graph = m_context.getDependencyGraph();
ClassLoader classloader = m_context.getClassLoader();
final File dir = new File( m_context.getWorkingDirectory(), name );
@@ -123,21 +131,21 @@
try
{
Class base = classloader.loadClass( profile.getClassname() );
- Type type =
+ Type type =
m_model.getClassLoaderModel().getTypeRepository().getType(
base );

- return new DefaultComponentContext(
- logger,
- name,
- system,
- classloader,
- graph,
- m_model,
- profile,
- type,
- base,
- dir,
- temp,
+ return new DefaultComponentContext(
+ logger,
+ name,
+ system,
+ classloader,
+ graph,
+ m_model,
+ profile,
+ type,
+ base,
+ dir,
+ temp,
partition,
m_context.getRuntime(),
m_context.getDefaultDeploymentTimeout() );
@@ -145,10 +153,10 @@
}
catch( Throwable e )
{
- final String error =
- REZ.getString(
- "containment.deployment.create.error",
- m_model.getPath(),
+ final String error =
+ REZ.getString(
+ "containment.deployment.create.error",
+ m_model.getPath(),
name );
throw new ModelException( error, e );
}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextMap.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextMap.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextMap.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -23,9 +23,12 @@

import net.dpml.composition.model.EntryModel;
import net.dpml.composition.model.ModelRuntimeException;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;

+import net.dpml.lang.NullArgumentException;
+
/**
* <p>Default implementation of a context object. The implementation
* maintains a mapping between context keys and context entry models.
@@ -63,33 +66,35 @@
{
m_map = map;
}
-
+
//==============================================================
// Context
//==============================================================

/**
* Return a context value relative to a key. If the context entry
- * is unknown a {@link IllegalArgumentException} containing the key as
- * as the exception message and a null cause will be thrown. If
- * the contrext entry is recognized and a error occurs during
- * value resolution a {@link ModelRuntimeException} will be thrown
+ * is unknown a {@link IllegalArgumentException} containing the key as
+ * as the exception message and a null cause will be thrown. If
+ * the contrext entry is recognized and a error occurs during
+ * value resolution a {@link ModelRuntimeException} will be thrown
* containing the causal exception.
- *
+ *
* @param key the context entry key
* @return the context entry value
* @exception IllegalArgumentException if the key is unknown
* @exception ModelRuntimeException if the key is unresolvable
+ * @exception NullArgumentException if the key argument is null.
*/
public Object get( final Object key )
+ throws NullArgumentException, IllegalArgumentException,
ModelRuntimeException
{
if( null == key )
{
- throw new NullPointerException( "key" );
+ throw new NullArgumentException( "key" );
}

EntryModel model = (EntryModel) m_map.get( key.toString() );
- if( null == model )
+ if( null == model )
{
throw new IllegalArgumentException( key.toString() );
}
@@ -100,7 +105,7 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
REZ.getString( "context.entry.model.error", key.toString() );
throw new ModelRuntimeException( error, e );
}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextModel.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -25,20 +25,27 @@
import net.dpml.composition.data.ContextDirective;
import net.dpml.composition.data.EntryDirective;
import net.dpml.composition.data.ImportDirective;
+
import net.dpml.composition.model.ContextModel;
import net.dpml.composition.model.EntryModel;
import net.dpml.composition.model.ModelException;
import net.dpml.composition.model.ModelRuntimeException;
+
import net.dpml.composition.provider.ComponentContext;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.meta.info.ContextDescriptor;
import net.dpml.meta.info.EntryDescriptor;


/**
- * <p>Specification of a context model from which a
+ * <p>Specification of a context model from which a
* a fully qualifed context can be established.</p>
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
@@ -55,8 +62,8 @@

public static boolean isaStandardKey( String key )
{
- return (
- key.startsWith( "urn:avalon:" )
+ return (
+ key.startsWith( "urn:avalon:" )
|| key.startsWith( "urn:composition:" )
|| key.startsWith( "urn:metro:" ) );
}
@@ -83,31 +90,33 @@

/**
* <p>Default implementation of the context model. The implementation
- * takes an inital system context as the base for context value
+ * takes an inital system context as the base for context value
* establishment and uses this to set standard context entries.</p>
*
* @param logger the logging channel
* @param descriptor the contextualization stage descriptor that describes
* the set of context entries that the component type is requesting
- * @param directive the contextualization directive that describes a set
+ * @param directive the contextualization directive that describes a set
* of context entry creation strategies
* @param context the component model context argument
+ * @exception NullArgumentException if either the logger, the descriptor
or the
+ * context argument is null.
*/
- public DefaultContextModel(
- Logger logger, ContextDescriptor descriptor,
- ContextDirective directive, ComponentContext context )
- throws ModelException
+ public DefaultContextModel(
+ Logger logger, ContextDescriptor descriptor,
+ ContextDirective directive, ComponentContext context )
+ throws ModelException, NullArgumentException
{
super( logger );

if( null == descriptor )
{
- throw new NullPointerException( "descriptor" );
+ throw new NullArgumentException( "descriptor" );
}

if( null == context )
{
- throw new NullPointerException( "context" );
+ throw new NullArgumentException( "context" );
}

m_descriptor = descriptor;
@@ -116,7 +125,7 @@

//
// get the set of context entries declared by the component type
- // and for for each entry determine the context entry model to
+ // and for for each entry determine the context entry model to
// use for context entry value resolution
//

@@ -128,26 +137,26 @@
final String key = entry.getKey();
if( isaStandardKey( key ) )
{
- DefaultImportModel model =
+ DefaultImportModel model =
new DefaultImportModel( entry, key, m_context );
setEntryModel( alias, model );
}
else
{
//
- // its a non standard context entry so check for a
+ // its a non standard context entry so check for a
// entry directive with a matching key to define
// the mechanism for building the context entry
//

- EntryDirective entryDirective =
+ EntryDirective entryDirective =
directive.getEntryDirective( key );
if( null == entryDirective )
{
if( entry.isRequired() )
{
- final String error =
- REZ.getString(
+ final String error =
+ REZ.getString(
"context.missing-directive.error", key );
throw new ModelException( error );
}
@@ -166,32 +175,32 @@
// importing under an alias of a container scoped key
//

- ImportDirective importDirective =
+ ImportDirective importDirective =
(ImportDirective) entryDirective;
String ref = importDirective.getImportKey();
- DefaultImportModel model =
+ DefaultImportModel model =
new DefaultImportModel( entry, ref, m_context );
setEntryModel( alias, model );
}
else if( entryDirective instanceof ConstructorDirective )
{
- ConstructorDirective constructor =
+ ConstructorDirective constructor =
(ConstructorDirective) entryDirective;
- DefaultConstructorModel model =
- new DefaultConstructorModel(
- entry,
- constructor,
- context,
+ DefaultConstructorModel model =
+ new DefaultConstructorModel(
+ entry,
+ constructor,
+ context,
m_map );
setEntryModel( alias, model );
}
else
{
- String modelClass =
+ String modelClass =
entryDirective.getClass().getName();
- final String error =
- REZ.getString(
- "context.unsupported-directive.error",
+ final String error =
+ REZ.getString(
+ "context.unsupported-directive.error",
key, modelClass );
throw new ModelException( error );
}
@@ -202,7 +211,7 @@

/**
* Return the classname of a custom casting class.
- *
+ *
* @return the custom context casting class (possibly null)
*/
public String getCastingClassname()
@@ -212,12 +221,12 @@

/**
* Return the context implementation classname.
- *
+ *
* @return the context implementation class (possibly null)
*/
public String getImplementationClassname()
{
- if( null == m_directive )
+ if( null == m_directive )
{
return null;
}
@@ -233,7 +242,7 @@

/**
* Return the set of entry models associated with this context model.
- *
+ *
* @return the entry models
*/
public EntryModel[] getEntryModels()
@@ -243,28 +252,28 @@

/**
* Return an entry model matching the supplied key.
- *
+ *
* @return the entry model or null if tyhe key is unknown
*/
public EntryModel getEntryModel( String key )
{
- return (EntryModel) m_map.get( key );
+ return (EntryModel) m_map.get( key );
}

/**
* Set the entry model relative to a supplied key.
- *
+ *
* @param key the entry key
* @param model the entry model
*/
public void setEntryModel( String key, EntryModel model )
{
- m_map.put( key, model );
+ m_map.put( key, model );
}

/**
* Set the entry to a suplied value.
- *
+ *
* @param key the entry key
* @param value the entry value
*/
@@ -273,20 +282,20 @@
EntryDescriptor descriptor = m_descriptor.getEntry( key );
if( null == descriptor )
{
- final String error =
+ final String error =
"Invalid context entry key ["
- + key
+ + key
+ "].";
throw new ModelRuntimeException( error );
}
- OverrideEntryModel model =
+ OverrideEntryModel model =
new OverrideEntryModel( descriptor, value );
setEntryModel( key, model );
}

/**
* Return the context map established for the component.
- *
+ *
* @return the context map
*/
public Map getContextMap()

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDependencyModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDependencyModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDependencyModel.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -22,17 +22,20 @@

import net.dpml.composition.model.DependencyModel;
import net.dpml.composition.model.ModelException;
+
import net.dpml.composition.data.DependencyDirective;
import net.dpml.composition.data.SelectionDirective;

+import net.dpml.i18n.ResourceManager;
+import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;

import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ServiceDescriptor;

-import net.dpml.i18n.ResourceManager;
-import net.dpml.i18n.Resources;
-
/**
* Default implementation of the deplendency model.
*
@@ -74,15 +77,20 @@
* @param name the name
* @param descriptor the dependency descriptor
* @param directive the dependency directive (possibly null)
+ * @exception NullArgumentException if either the logger argument or the
+ * descriptor argument is null.
*/
- public DefaultDependencyModel(
- final Logger logger, final String partition, final String name,
- final DependencyDescriptor descriptor, DependencyDirective directive )
- throws ModelException
+ public DefaultDependencyModel(
+ final Logger logger, final String partition, final String name,
+ final DependencyDescriptor descriptor, DependencyDirective
directive )
+ throws ModelException, NullArgumentException
{
super( logger );

- if( descriptor == null ) throw new NullPointerException(
"descriptor" );
+ if( descriptor == null )
+ {
+ throw new NullArgumentException( "descriptor" );
+ }

m_descriptor = descriptor;
m_directive = directive;
@@ -91,8 +99,8 @@

//
// a dependency directive is either declaring an explicitly
- // identified provider, or, it is delcaring 0 or more selection
- // constraints - if its a an absolute source declaration then
+ // identified provider, or, it is delcaring 0 or more selection
+ // constraints - if its a an absolute source declaration then
// add it to the table to paths keyed by depedency key names
//

@@ -131,10 +139,10 @@
}

/**
- * Return an explicit path to a supplier component.
+ * Return an explicit path to a supplier component.
* If a dependency directive has been declared
- * and the directive contains a source declaration, the value
- * returned is the result of parsing the source value relative
+ * and the directive contains a source declaration, the value
+ * returned is the result of parsing the source value relative
* to the absolute address of the implementing component.
*
* @return the explicit path
@@ -145,7 +153,7 @@
}

/**
- * Filter a set of candidate service descriptors and return the
+ * Filter a set of candidate service descriptors and return the
* set of acceptable service as a ordered sequence.
*
* @param candidates the set of candidate services for the dependency
@@ -153,7 +161,7 @@
* @return the accepted candidates in ranked order
* @exception IllegalArgumentException if the key is unknown
*/
- public ServiceDescriptor[] filter( ServiceDescriptor[] candidates )
+ public ServiceDescriptor[] filter( ServiceDescriptor[] candidates )
{
if( m_directive != null )
{
@@ -166,15 +174,15 @@
}

/**
- * Filter a set of candidate service descriptors and return the
+ * Filter a set of candidate service descriptors and return the
* set of acceptable service as a ordered sequence.
*
* @param directive the dependency directive
* @param services the set of candidate services for the dependency
* @return the accepted candidates in ranked order
*/
- private ServiceDescriptor[] filter(
- DependencyDirective directive, ServiceDescriptor[] services )
+ private ServiceDescriptor[] filter(
+ DependencyDirective directive, ServiceDescriptor[] services )
{
SelectionDirective[] filters = getFilters( directive );
ArrayList list = new ArrayList();
@@ -188,7 +196,7 @@
}
}

- ServiceDescriptor[] candidates =
+ ServiceDescriptor[] candidates =
(ServiceDescriptor[]) list.toArray( new ServiceDescriptor[0] );

//
@@ -198,7 +206,7 @@
return candidates;
}

- private boolean isaCandidate(
+ private boolean isaCandidate(
ServiceDescriptor service, SelectionDirective[] filters )
{
for( int i=0; i<filters.length; i++ )
@@ -212,7 +220,7 @@
return true;
}

- private boolean isaCandidate(
+ private boolean isaCandidate(
ServiceDescriptor service, SelectionDirective filter )
{
final String feature = filter.getFeature();
@@ -241,7 +249,7 @@
}
else
{
- final String error =
+ final String error =
REZ.getString( "dependency.invalid-criteria.error", criteria,
feature );
throw new IllegalArgumentException( error );
}
@@ -285,7 +293,7 @@
}
else
{
- final String error =
+ final String error =
"Illegal attempt to reference a containment context above the
root context.";
throw new IllegalArgumentException( error );
}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDependent.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDependent.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDependent.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,6 +21,8 @@
import net.dpml.composition.model.DeploymentModel;
import net.dpml.composition.model.Dependent;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;

/**
@@ -46,12 +48,14 @@
* Creation of a new stage model.
*
* @param logger the logging channel
+ * @exception NullArgumentException if the logger argument is null.
*/
public DefaultDependent( final Logger logger )
+ throws NullArgumentException
{
if( logger == null )
{
- throw new NullPointerException( "logger" );
+ throw new NullArgumentException( "logger" );
}
m_logger = logger;
}
@@ -62,7 +66,7 @@

/**
* Set the provider model.
- *
+ *
* @param model the provider model
*/
public void setProvider( DeploymentModel model )
@@ -72,7 +76,7 @@

/**
* Return the assigned provider model.
- *
+ *
* @return the stage provider model
*/
public DeploymentModel getProvider()

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentContext.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentContext.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentContext.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -20,15 +20,19 @@

import net.dpml.context.impl.DefaultContext;

+import net.dpml.composition.data.DeploymentProfile;
+import net.dpml.composition.data.Mode;
+
import net.dpml.composition.model.DependencyGraph;
+
import net.dpml.composition.provider.DeploymentContext;
import net.dpml.composition.provider.Runtime;
-import net.dpml.composition.data.DeploymentProfile;

-import net.dpml.system.SystemContext;
+import net.dpml.lang.NullArgumentException;

import net.dpml.logging.Logger;
-import net.dpml.composition.data.Mode;
+
+import net.dpml.system.SystemContext;

/**
* Default implementation of a deployment context.
@@ -66,35 +70,39 @@
* @param mode the deployment mode
* @param graph the parent deployment assembly graph
* @param timeout the default deployment timeout
+ * @exception NullArgumentException if any one of the runtime, logger,
name, mode
+ * profile or system argument is null.
*/
- public DefaultDeploymentContext(
- Logger logger, SystemContext system, String partition, String name,
- Mode mode, DeploymentProfile profile, DependencyGraph graph, Runtime
runtime, long timeout )
+ public DefaultDeploymentContext(
+ Logger logger, SystemContext system, String partition, String
name,
+ Mode mode, DeploymentProfile profile, DependencyGraph graph,
+ Runtime runtime, long timeout )
+ throws NullArgumentException
{
super();
if( runtime == null )
{
- throw new NullPointerException( "runtime" );
+ throw new NullArgumentException( "runtime" );
}
if( logger == null )
{
- throw new NullPointerException( "logger" );
+ throw new NullArgumentException( "logger" );
}
if( name == null )
{
- throw new NullPointerException( "name" );
+ throw new NullArgumentException( "name" );
}
if( profile == null )
{
- throw new NullPointerException( "mode" );
+ throw new NullArgumentException( "mode" );
}
if( profile == null )
{
- throw new NullPointerException( "profile" );
+ throw new NullArgumentException( "profile" );
}
if( system == null )
{
- throw new NullPointerException( "system" );
+ throw new NullArgumentException( "system" );
}

m_profile = profile;
@@ -201,7 +209,7 @@
}

/**
- * Return the dependency graph used to construct
+ * Return the dependency graph used to construct
* deployment and decommissioning sequences.
*
* @return the dependency graph

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentModel.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -23,14 +23,22 @@
import java.security.ProtectionDomain;

import net.dpml.composition.data.Mode;
+
import net.dpml.composition.model.Commissionable;
import net.dpml.composition.model.DeploymentModel;
+
import net.dpml.composition.provider.DeploymentContext;
import net.dpml.composition.provider.SecurityModel;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.logging.data.CategoriesDirective;
+
import net.dpml.logging.provider.LoggingManager;


@@ -75,21 +83,23 @@
//--------------------------------------------------------------

/**
- * Creation of an abstract model. The model associated a
+ * Creation of an abstract model. The model associated a
* name and a partition.
*
* @param context the deployment context
+ * @exception NullArgumentException if either the context argument or the
security
+ * argument is null.
*/
- public DefaultDeploymentModel(
- DeploymentContext context, SecurityModel security )
- {
+ public DefaultDeploymentModel( DeploymentContext context, SecurityModel
security )
+ throws NullArgumentException
+ {
if( null == context )
{
- throw new NullPointerException( "context" );
+ throw new NullArgumentException( "context" );
}
if( null == security )
{
- throw new NullPointerException( "security" );
+ throw new NullArgumentException( "security" );
}

m_context = context;
@@ -99,7 +109,7 @@
m_categories = m_context.getProfile().getCategories();

Permissions permissions = security.getPermissions();
- ProtectionDomain domain =
+ ProtectionDomain domain =
new ProtectionDomain( null, permissions );
ProtectionDomain[] domains = new ProtectionDomain[]{ domain };
m_access = new AccessControlContext( domains );
@@ -110,7 +120,7 @@
//--------------------------------------------------------------

/**
- * Commission the model.
+ * Commission the model.
*
* @exception Exception if a commissioning error occurs
*/
@@ -120,7 +130,7 @@
}

/**
- * Decommission the model. Once an model is
+ * Decommission the model. Once an model is
* decommissioned it may be re-commissioned.
*/
public void decommission()
@@ -275,12 +285,12 @@

public boolean equals( Object other )
{
- boolean equal = super.equals( other );
+ boolean equal = super.equals( other );
return equal;
}

- /**
- * Return the default deployment timeout value declared in the
+ /**
+ * Return the default deployment timeout value declared in the
* kernel configuration. The implementation looks for a value
* assigned under the property key "urn:composition:deployment.timeout"
* and defaults to 1000 msec if undefined.
@@ -293,25 +303,25 @@
}

/**
- * Return the logging categories.
+ * Return the logging categories.
* @return the logging categories
*/
public CategoriesDirective getCategories()
{
- if( m_categories == null )
+ if( m_categories == null )
return m_context.getProfile().getCategories();
return m_categories;
}

/**
- * Set categories.
+ * Set categories.
* @param categories the logging categories
*/
public void setCategories( CategoriesDirective categories )
{
m_categories = categories;
-
- LoggingManager logging =
+
+ LoggingManager logging =
m_context.getSystemContext().getLoggingManager();
final String path = getQualifiedName();
logging.addCategories( path, categories );

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultEntryModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultEntryModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultEntryModel.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,6 +21,8 @@
import net.dpml.composition.model.EntryModel;
import net.dpml.composition.model.ModelException;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.EntryDescriptor;

/**
@@ -45,12 +47,14 @@
* Creation of a new context entry import model.
*
* @param descriptor the context entry descriptor
+ * @exception NullArgumentException is the descriptor argument is null.
*/
public DefaultEntryModel( EntryDescriptor descriptor )
+ throws NullArgumentException
{
if( descriptor == null )
{
- throw new NullPointerException( "descriptor" );
+ throw new NullArgumentException( "descriptor" );
}
m_descriptor = descriptor;
}
@@ -61,7 +65,7 @@

/**
* Return the context entry key.
- *
+ *
* @return the key
*/
public String getKey()
@@ -71,7 +75,7 @@

/**
* Return the context entry value.
- *
+ *
* @return the context entry value
*/
public abstract Object getValue() throws ModelException;

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultImportModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultImportModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultImportModel.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -22,10 +22,12 @@
import net.dpml.composition.model.ContainmentModel;
import net.dpml.composition.provider.ComponentContext;

+import net.dpml.context.ContextException;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;

-import net.dpml.context.ContextException;
+import net.dpml.lang.NullArgumentException;

import net.dpml.meta.info.EntryDescriptor;

@@ -72,19 +74,20 @@
* @param descriptor the context entry descriptor
* @param key the container scoped key
* @param context the containment context
+ * @exception NullArgumentException is any one of the arguments is null.
*/
- public DefaultImportModel(
- EntryDescriptor descriptor, String key,
- ComponentContext context ) throws ModelException
+ public DefaultImportModel( EntryDescriptor descriptor, String key,
+ ComponentContext context )
+ throws ModelException, NullArgumentException
{
super( descriptor );
if( key == null )
{
- throw new NullPointerException( "key" );
+ throw new NullArgumentException( "key" );
}
if( context == null )
{
- throw new NullPointerException( "context" );
+ throw new NullArgumentException( "context" );
}

m_key = key;
@@ -93,8 +96,8 @@

if( !DefaultContextModel.isaStandardKey( key ) )
{
- final String error =
- REZ.getString(
+ final String error =
+ REZ.getString(
"context.non-standard-key.error", key );
throw new ModelException( error );
}
@@ -111,7 +114,7 @@

/**
* Return the context entry value.
- *
+ *
* @return the context entry value
*/
public Object getValue() throws ModelException
@@ -137,7 +140,7 @@
}
else
{
- final String error =
+ final String error =
"Unknown key [" + key + "]";
throw new IllegalArgumentException( error );
}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -19,9 +19,11 @@
package net.dpml.composition.model.impl;

import java.io.InputStream;
+
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
+
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
@@ -31,15 +33,18 @@
import net.dpml.composition.data.ClassLoaderDirective;
import net.dpml.composition.data.ContainmentProfile;
import net.dpml.composition.data.SecurityProfile;
+
import net.dpml.composition.data.builder.ContainmentProfileBuilder;
import net.dpml.composition.data.builder.XMLContainmentProfileCreator;
import net.dpml.composition.data.builder.XMLSecurityProfileBuilder;
+
import net.dpml.composition.model.ClassLoaderModel;
import net.dpml.composition.model.ComponentModel;
import net.dpml.composition.model.ContainmentModel;
import net.dpml.composition.model.DeploymentModel;
import net.dpml.composition.model.ModelException;
import net.dpml.composition.model.ModelRuntimeException;
+
import net.dpml.composition.provider.ClassLoaderContext;
import net.dpml.composition.provider.ComponentContext;
import net.dpml.composition.provider.CompositionContext;
@@ -48,14 +53,22 @@
import net.dpml.composition.provider.ModelFactory;
import net.dpml.composition.provider.Runtime;
import net.dpml.composition.provider.SecurityModel;
+
import net.dpml.configuration.Configuration;
+
import net.dpml.configuration.impl.ConfigurationUtil;
import net.dpml.configuration.impl.DefaultConfigurationBuilder;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.system.Factory;
import net.dpml.system.SystemContext;
+
import net.dpml.transit.repository.Repository;

import org.xml.sax.InputSource;
@@ -73,16 +86,16 @@
// static
//-------------------------------------------------------------------

- private static final XMLContainmentProfileCreator CREATOR =
+ private static final XMLContainmentProfileCreator CREATOR =
new XMLContainmentProfileCreator();

- private static final ContainmentProfileBuilder BUILDER =
+ private static final ContainmentProfileBuilder BUILDER =
new ContainmentProfileBuilder();

private static final Resources REZ =
ResourceManager.getPackageResources( DefaultModelFactory.class );

- private static final SecurityModel NULL_SECURITY =
+ private static final SecurityModel NULL_SECURITY =
new DefaultSecurityModel();

private static final String DEFAULT_PROFILE_NAME = "default";
@@ -90,9 +103,9 @@
private static final XMLSecurityProfileBuilder SECURITY_BUILDER =
new XMLSecurityProfileBuilder();

- private static final String AVALON_API =
+ private static final String AVALON_API =
"artifact:jar:avalon-framework/avalon-framework-api#4.2.0";
- private static final String AVALON_LIFECYCLE_API =
+ private static final String AVALON_LIFECYCLE_API =
"artifact:jar:avalon/util/avalon-util-lifecycle#1.1.1";

//-------------------------------------------------------------------
@@ -124,7 +137,7 @@
//-------------------------------------------------------------------

/**
- * The root containment model against which refresh actions are
+ * The root containment model against which refresh actions are
* resolved.
*/
private final ContainmentModel m_root;
@@ -143,21 +156,21 @@
*
* @param context the composition context
* @param profiles the set of initial security profiles
- * @param grants the set of initial address to permission
+ * @param grants the set of initial address to permission
* profile assignments
* @param artifact the runtime artifact
*/
- DefaultModelFactory(
- final CompositionContext context, URI uri,
- URL kernel, URL[] deployment, URL overrides ) throws ModelException
+ DefaultModelFactory( final CompositionContext context, URI uri,
+ URL kernel, URL[] deployment, URL overrides )
+ throws ModelException, NullArgumentException
{
if( context == null )
{
- throw new NullPointerException( "context" );
+ throw new NullArgumentException( "context" );
}
if( deployment == null )
{
- throw new NullPointerException( "deployment" );
+ throw new NullArgumentException( "deployment" );
}

m_context = context;
@@ -179,7 +192,7 @@
final String name = profile.getName();
if( m_logger.isDebugEnabled() )
{
- m_logger.debug(
+ m_logger.debug(
"adding security profile [" + name + "]." );
}
try
@@ -189,7 +202,7 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Cannot include initial security model [" + name +
"].";
throw new ModelRuntimeException( error, e );
}
@@ -201,7 +214,7 @@

if( null == m_security.get( DEFAULT_PROFILE_NAME ) )
{
- final String error =
+ final String error =
"Security enabled without a \""
+ DEFAULT_PROFILE_NAME
+ "\" profile.";
@@ -209,7 +222,7 @@
}

//
- // check that the initial set of grant bindings actually
+ // check that the initial set of grant bindings actually
// refer to known security profiles
//

@@ -244,8 +257,8 @@
URL url = deployment[i];
if( getLogger().isInfoEnabled() )
{
- getLogger().debug(
- "installing: "
+ getLogger().debug(
+ "installing: "
+ m_context.getSystemContext().toString( url ) );
}

@@ -255,7 +268,7 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Install failure: " + url;
throw new CompositionException( error, e );
}
@@ -265,7 +278,7 @@
// customize the model using the target overrides
//

- if( null != overrides )
+ if( null != overrides )
{
m_root.applyTargets( overrides );
}
@@ -279,7 +292,7 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Unable to construct security profiles.";
throw new CompositionException( error, e );
}
@@ -303,7 +316,7 @@

/**
* Creation of a new nested deployment model. This method is called
- * by a container implementation when constructing model instances. The
+ * by a container implementation when constructing model instances. The
* factory is identified by its implementation classname.
*
* @param context a potentially foreign deployment context
@@ -335,26 +348,26 @@
//-------------------------------------------------------------------

/**
- * Creation of a new root containment model using
+ * Creation of a new root containment model using
* a URL referring to a containment profile.
*
* @param url a composition profile source
* @return the containment model
*/
- private ContainmentModel createRootContainmentModel( URL url )
+ private ContainmentModel createRootContainmentModel( URL url )
throws ModelException
{
try
{
final URLConnection connection = url.openConnection();
final InputStream stream = connection.getInputStream();
- final ContainmentProfile profile =
+ final ContainmentProfile profile =
BUILDER.createContainmentProfile( stream );
return createRootContainmentModel( profile );
}
catch( Throwable e )
{
- final String error =
+ final String error =
REZ.getString( "factory.containment.create-url.error",
url.toString() );
throw new ModelException( error, e );
}
@@ -367,7 +380,7 @@
* @return the containment model
* @exception ModelException if an error occurs during model establishment
*/
- private ContainmentModel createRootContainmentModel( Configuration
config )
+ private ContainmentModel createRootContainmentModel( Configuration
config )
throws ModelException
{
ContainmentProfile profile = createContainmentProfile( config );
@@ -383,7 +396,7 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Internal error while build a containment profile."
+ ConfigurationUtil.list( config );
throw new ModelException( error, e );
@@ -392,27 +405,27 @@


/**
- * Creation of a new root containment model using
+ * Creation of a new root containment model using
* a supplied profile.
*
- * @param profile a containment profile
+ * @param profile a containment profile
* @return the containment model
*/
- private ContainmentModel createRootContainmentModel(
- ContainmentProfile profile )
+ private ContainmentModel createRootContainmentModel(
+ ContainmentProfile profile )
throws ModelException
{
try
{
- ContainmentContext context =
+ ContainmentContext context =
createRootContainmentContext( profile );
return createContainmentModel( context, true );
}
catch( Throwable e )
{
- final String error =
- REZ.getString(
- "factory.containment.create.error",
+ final String error =
+ REZ.getString(
+ "factory.containment.create.error",
profile.getName() );
throw new ModelException( error, e );
}
@@ -443,19 +456,18 @@
/**
* Creation of a new root containment context.
*
- * @param profile a containment profile
+ * @param profile a containment profile
* @return the containment context
*/
- private ContainmentContext createRootContainmentContext(
- ContainmentProfile profile )
- throws ModelException
+ private ContainmentContext createRootContainmentContext(
ContainmentProfile profile )
+ throws ModelException, NullArgumentException
{
if( profile == null )
{
- throw new NullPointerException( "profile" );
+ throw new NullArgumentException( "profile" );
}

- m_context.getSystemContext().getLoggingManager().addCategories(
+ m_context.getSystemContext().getLoggingManager().addCategories(
profile.getCategories() );
final Logger logger =

m_context.getSystemContext().getLoggingManager().getLoggerForCategory("");
@@ -464,34 +476,34 @@

try
{
- ClassLoaderDirective classLoaderDirective =
+ ClassLoaderDirective classLoaderDirective =
profile.getClassLoaderDirective();

ClassLoaderContext classLoaderContext =
- new DefaultClassLoaderContext(
+ new DefaultClassLoaderContext(
logger, m_context.getSystemContext(), root,
classLoaderDirective );

long now = System.currentTimeMillis();

- ClassLoaderModel classLoaderModel =
+ ClassLoaderModel classLoaderModel =
new DefaultClassLoaderModel( classLoaderContext );

- return new DefaultContainmentContext(
- logger,
- m_context.getSystemContext(),
- classLoaderModel,
- null, null,
- profile,
- this,
+ return new DefaultContainmentContext(
+ logger,
+ m_context.getSystemContext(),
+ classLoaderModel,
+ null, null,
+ profile,
+ this,
m_runtime,
m_context.getDefaultDeploymentTimeout() );
}
catch( Throwable e )
{
- final String error =
- REZ.getString(
- "factory.containment.create.error",
+ final String error =
+ REZ.getString(
+ "factory.containment.create.error",
profile.getName() );
throw new ModelException( error, e );
}
@@ -507,7 +519,7 @@
* path. The implementation will return the default security profile
* unless an explicit grant has been declared for the the supplied
* path, and the grant referes to a known security profile.
- *
+ *
* @param path the container or component path
* @return the assigned security model
*/
@@ -525,14 +537,14 @@
}

/**
- * Return a named security profile.
+ * Return a named security profile.
* @param name an existing security profile name
* @return the security model
* @exception IllegalArgumentException if the name is unknown
*/
private SecurityModel getNamedSecurityModel( String name )
{
- SecurityModel model =
+ SecurityModel model =
(SecurityModel) m_security.get( name );
if( null != model )
{
@@ -540,7 +552,7 @@
}
else
{
- final String error =
+ final String error =
"Unknown security profile [" + name + "].";
throw new IllegalArgumentException( error );
}
@@ -562,7 +574,7 @@

/**
* Return the default security model.
- *
+ *
* @return the default security model
*/
private SecurityModel getDefaultSecurityModel()
@@ -572,7 +584,7 @@

/**
* Create the kernel configuration using a supplied url. If the supplied
- * url is null the implementation will attempt to resolve a "/kernel.xml"
+ * url is null the implementation will attempt to resolve a "/kernel.xml"
* resource within the deployment unit.
*
* @param url the location of the kernel configuration
@@ -585,13 +597,13 @@
{
try
{
- DefaultConfigurationBuilder builder =
+ DefaultConfigurationBuilder builder =
new DefaultConfigurationBuilder();
return builder.build( url.toString() );
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Could not load the kernel directive: " + url;
throw new CompositionException( error, e );
}
@@ -601,16 +613,16 @@
try
{
final InputStream stream =
-
DefaultModelFactory.class.getClassLoader().getResourceAsStream(
+
DefaultModelFactory.class.getClassLoader().getResourceAsStream(
"kernel.xml" );
final InputSource source = new InputSource( stream );
- DefaultConfigurationBuilder builder =
+ DefaultConfigurationBuilder builder =
new DefaultConfigurationBuilder();
return builder.build( source );
}
catch( Throwable ee )
{
- final String error =
+ final String error =
"Internal error while attempting to build default kernel "
+ "configuration from the kernel spec: " + url;
throw new CompositionException( error, ee );
@@ -619,12 +631,12 @@
}

/**
- * Create a runtime using the supplied artifact. The implementation
+ * Create a runtime using the supplied artifact. The implementation
*/
private Runtime createRuntime( SystemContext system, URI uri )
throws CompositionException
{
- if( null == uri )
+ if( null == uri )
{
return new NullRuntime();
}
@@ -640,16 +652,16 @@
{
object = ((Factory)plugin).create();
}
- else
+ else
{
object = plugin;
}
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Unexpected error while attempting to construct runtime
plugin from ["
- + uri
+ + uri
+ "].";
throw new CompositionException( error, e );
}
@@ -660,9 +672,9 @@
}
else
{
- final String error =
+ final String error =
"Object established by ["
- + uri
+ + uri
+ "] is not a Runtime instance.";
throw new CompositionException( error );
}
@@ -680,22 +692,22 @@
//------------------------------------------------------------------
// runtime operations
//------------------------------------------------------------------
-
+
/**
- * Request the commissioning of a runtime for a supplied deployment
+ * Request the commissioning of a runtime for a supplied deployment
* model.
- * @param model the deployment model
+ * @param model the deployment model
* @exception Exception of a commissioning error occurs
*/
public void commission( DeploymentModel model ) throws Exception
{
throw new IllegalStateException( "Null runtime." );
}
-
+
/**
- * Request the decommissioning of a runtime for a supplied deployment
+ * Request the decommissioning of a runtime for a supplied deployment
* model.
- * @param model the deployment model
+ * @param model the deployment model
* @exception Exception of a commissioning error occurs
*/
public void decommission( DeploymentModel model )
@@ -716,8 +728,8 @@
/**
* Request resolution of an object from the runtime.
* @param model the deployment model
- * @param proxy if TRUE the return value will be proxied if the
- * underlying component typoe suppports proxy representation
+ * @param proxy if TRUE the return value will be proxied if the
+ * underlying component typoe suppports proxy representation
* @exception Exception if a deployment error occurs
*/
public Object resolve( DeploymentModel model, boolean proxy ) throws
Exception

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultSecurityModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultSecurityModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultSecurityModel.java
Mon Jan 17 18:13:05 2005
@@ -1,32 +1,36 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.composition.model.impl;

-import java.security.Permission;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+
+import java.security.Permission;
import java.security.Permissions;

import net.dpml.composition.data.SecurityProfile;
+
import net.dpml.composition.provider.SecurityModel;
import net.dpml.composition.provider.CompositionRuntimeException;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.PermissionDescriptor;

/**
@@ -50,7 +54,7 @@
private final Permissions m_permissions;
private final String m_name;
private final boolean m_enabled;
-
+
//-------------------------------------------------------------------
// constructor
//-------------------------------------------------------------------
@@ -67,13 +71,13 @@

/**
* Creation of a new security model.
- *
+ *
* @param profile the security profile
*/
public DefaultSecurityModel( SecurityProfile profile, boolean enabled )
{
m_name = profile.getName();
- PermissionDescriptor[] permissions =
+ PermissionDescriptor[] permissions =
profile.getPermissionDescriptors();
m_permissions = buildPermissions( permissions );
m_enabled = enabled;
@@ -94,7 +98,7 @@

/**
* Return the set of default permissions.
- *
+ *
* @return the permissions
*/
public Permissions getPermissions()
@@ -115,7 +119,7 @@
// internals
//-------------------------------------------------------------------

- private Permissions buildPermissions(
+ private Permissions buildPermissions(
PermissionDescriptor[] descriptors ) throws CompositionRuntimeException
{
Permissions permissions = new Permissions();
@@ -129,7 +133,7 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Invalid permission descriptor " + descriptor + ".";
throw new CompositionRuntimeException( error, e );
}
@@ -137,8 +141,8 @@
return permissions;
}

- private Permission createPermission(
- PermissionDescriptor descriptor )
+ private Permission createPermission(
+ PermissionDescriptor descriptor )
throws InstantiationException, IllegalAccessException,
ClassNotFoundException,
ClassCastException, InvocationTargetException
{
@@ -175,32 +179,31 @@
* @param action The action associated with the permission. Note that
some
* Permissions doesn't support actions.
* @throws InstantiationException if the class could not be instantiated.
- * @throws IllegalAccessException, if the class does not have a
+ * @throws IllegalAccessException, if the class does not have a
* public constructor
* @throws ClassNotFoundException, if the class could not be reached by
the
* classloader.
- * @throws ClassCastException, if the class is not a subclass of
+ * @throws ClassCastException, if the class is not a subclass of
* java.security.Permission
* @throws InvocationTargetException, if the constructor in the
Permission
* class throws an exception.
*/
- private static Permission createPermission(
- String classname, String name, String action )
- throws InstantiationException, IllegalAccessException,
ClassNotFoundException,
- ClassCastException, InvocationTargetException
+ private static Permission createPermission( String classname, String
name, String action )
+ throws InstantiationException, IllegalAccessException,
ClassNotFoundException,
+ ClassCastException, InvocationTargetException,
NullArgumentException
{
if( classname == null )
{
- throw new NullPointerException( "classname" );
+ throw new NullArgumentException( "classname" );
}

ClassLoader trustedClassloader =
DefaultSecurityModel.class.getClassLoader();
-
+
Class clazz = trustedClassloader.loadClass( classname );
Constructor[] constructors = clazz.getConstructors();
if( name == null )
{
- return (Permission) clazz.newInstance();
+ return (Permission) clazz.newInstance();
}
else if( action == null )
{
@@ -216,7 +219,7 @@
}
}

- private static Constructor getConstructor(
+ private static Constructor getConstructor(
Constructor[] constructors, int noOfParameters )
{
for ( int i=0 ; i < constructors.length ; i++ )

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultServiceRepository.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultServiceRepository.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultServiceRepository.java
Mon Jan 17 18:13:05 2005
@@ -23,7 +23,11 @@

import net.dpml.composition.model.ServiceRepository;
import net.dpml.composition.model.UnknownServiceException;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.Service;
import net.dpml.meta.info.Version;
@@ -77,15 +81,15 @@
* @param logger the logging channel
* @param parent the parent type manager
* @param services the list of available services
- * @exception NullPointerException if the services list is null
+ * @exception NullArgumentException if the services list is null
*/
- DefaultServiceRepository(
- final Logger logger, final ServiceRepository parent, final List
services )
- throws NullPointerException
+ DefaultServiceRepository( final Logger logger, final ServiceRepository
parent,
+ final List services )
+ throws NullArgumentException
{
if( services == null )
{
- throw new NullPointerException( "services" );
+ throw new NullArgumentException( "services" );
}
m_parent = parent;
m_services = services;

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultStageModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultStageModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultStageModel.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -22,9 +22,12 @@

import net.dpml.composition.data.StageDirective;
import net.dpml.composition.data.SelectionDirective;
+
import net.dpml.composition.model.StageModel;
import net.dpml.composition.model.ModelException;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;

import net.dpml.meta.info.StageDescriptor;
@@ -39,7 +42,8 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id$
*/
-public class DefaultStageModel extends DefaultDependent implements StageModel
+public class DefaultStageModel extends DefaultDependent
+ implements StageModel
{
//==============================================================
// static
@@ -69,23 +73,27 @@
* @param partition the partition name
* @param descriptor the stage descriptors
* @param directive the stage directive (possibly null)
+ * @exception NullArgumentException is the descriptor argument or the
logger
+ * argument is null.
*/
- public DefaultStageModel(
- final Logger logger, String partition,
- final StageDescriptor descriptor, StageDirective directive )
- throws ModelException
+ public DefaultStageModel( Logger logger, String partition,
+ StageDescriptor descriptor, StageDirective
directive )
+ throws ModelException, NullArgumentException
{
super( logger );

- if( descriptor == null ) throw new NullPointerException(
"descriptor" );
+ if( descriptor == null )
+ {
+ throw new NullArgumentException( "descriptor" );
+ }

m_descriptor = descriptor;
m_directive = directive;

//
// a stage directive is either declaring with an explicitly
- // identified provider, or, it is delcaring 0 or more selection
- // constraints - if its an absolute source declaration then
+ // identified provider, or, it is delcaring 0 or more selection
+ // constraints - if its an absolute source declaration then
// resolve it now
//

@@ -124,10 +132,10 @@
}

/**
- * Return an explicit path to a supplier component.
+ * Return an explicit path to a supplier component.
* If a stage directive has been declared
- * and the directive contains a source declaration, the value
- * returned is the result of parsing the source value relative
+ * and the directive contains a source declaration, the value
+ * returned is the result of parsing the source value relative
* to the absolute address of the dependent component.
*
* @return the explicit path
@@ -138,13 +146,13 @@
}

/**
- * Filter a set of candidate extension descriptors and return the
+ * Filter a set of candidate extension descriptors and return the
* set of acceptable extensions as a ordered sequence.
*
* @param candidates the set of candidate stage providers
* @return the accepted candidates in ranked order
*/
- public ExtensionDescriptor[] filter( ExtensionDescriptor[] candidates )
+ public ExtensionDescriptor[] filter( ExtensionDescriptor[] candidates )
{
if( m_directive != null )
{
@@ -157,15 +165,15 @@
}

/**
- * Filter a set of candidate service descriptors and return the
+ * Filter a set of candidate service descriptors and return the
* set of acceptable stage providers as a ordered sequence.
*
* @param directive the stage directive
* @param providers the set of candidate extension descriptors
* @return the accepted candidates in ranked order
*/
- private ExtensionDescriptor[] filter(
- StageDirective directive, ExtensionDescriptor[] providers )
+ private ExtensionDescriptor[] filter(
+ StageDirective directive, ExtensionDescriptor[] providers )
{
SelectionDirective[] filters = getFilters( directive );
ArrayList list = new ArrayList();
@@ -179,7 +187,7 @@
}
}

- ExtensionDescriptor[] candidates =
+ ExtensionDescriptor[] candidates =
(ExtensionDescriptor[]) list.toArray( new ExtensionDescriptor[0] );

//
@@ -189,7 +197,7 @@
return candidates;
}

- private boolean isaCandidate(
+ private boolean isaCandidate(
ExtensionDescriptor provider, SelectionDirective[] filters )
{
for( int i=0; i<filters.length; i++ )
@@ -203,7 +211,7 @@
return true;
}

- private boolean isaCandidate(
+ private boolean isaCandidate(
ExtensionDescriptor provider, SelectionDirective filter )
{
final String feature = filter.getFeature();
@@ -232,7 +240,7 @@
}
else
{
- final String error =
+ final String error =
REZ.getString( "stage.invalid-criteria.error", criteria,
feature );
throw new IllegalArgumentException( error );
}
@@ -276,7 +284,7 @@
}
else
{
- final String error =
+ final String error =
"Illegal attempt to reference a containment context above the
root context.";
throw new IllegalArgumentException( error );
}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
Mon Jan 17 18:13:05 2005
@@ -26,12 +26,19 @@
import net.dpml.composition.data.ProfilePackage;
import net.dpml.composition.data.DeploymentProfile;
import net.dpml.composition.data.ComponentProfile;
+
import net.dpml.composition.data.builder.ProfilePackageBuilder;
+
import net.dpml.composition.model.ProfileSelector;
import net.dpml.composition.model.TypeRepository;
import net.dpml.composition.model.TypeUnknownException;
import net.dpml.composition.model.ProfileUnknownException;

+import net.dpml.i18n.ResourceManager;
+import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;

import net.dpml.meta.info.DependencyDescriptor;
@@ -39,8 +46,6 @@
import net.dpml.meta.info.StageDescriptor;
import net.dpml.meta.info.Type;

-import net.dpml.i18n.ResourceManager;
-import net.dpml.i18n.Resources;

/**
* A type manager implementation provides support for the creation,
@@ -108,15 +113,15 @@
* @param classloader the classloader
* @param parent the parent type repository
* @param types the list of types local to the repository
- * @exception NullPointerException if the type list is null
+ * @exception NullArgumentException if the type list is null
*/
- public DefaultTypeRepository(
- final Logger logger, final ClassLoader classloader, final
TypeRepository parent,
- final List types ) throws Exception
+ public DefaultTypeRepository( final Logger logger, final ClassLoader
classloader,
+ final TypeRepository parent, final List
types )
+ throws Exception, NullArgumentException
{
if( types == null )
{
- throw new NullPointerException( "types" );
+ throw new NullArgumentException( "types" );
}

m_parent = parent;
@@ -142,8 +147,7 @@
final String classname = type.getInfo().getClassname();
Class clazz = m_classloader.loadClass( classname );

- ProfilePackage pack =
- PACKAGE_BUILDER.createProfilePackage( name, clazz );
+ ProfilePackage pack = PACKAGE_BUILDER.createProfilePackage(
name, clazz );
m_profiles.put( classname, pack );
int n = pack.getComponentProfiles().length;

@@ -211,12 +215,14 @@
* @param clazz the component type implementation class.
* @return the type matching the supplied implementation classname.
* @exception TypeUnknownException if a matching type cannot be found
+ * @exception NullArgumentException if the clazz argument is null.
*/
- public Type getType( Class clazz ) throws TypeUnknownException
+ public Type getType( Class clazz )
+ throws TypeUnknownException, NullArgumentException
{
if( clazz == null )
{
- throw new NullPointerException( "clazz" );
+ throw new NullArgumentException( "clazz" );
}
return getType( clazz.getName() );
}
@@ -228,12 +234,14 @@
* @param classname the component type implementation class name.
* @return the type matching the supplied implementation classname.
* @exception TypeUnknownException if a matching type cannot be found
+ * @exception NullArgumentException if the classname argument is null.
*/
- public Type getType( String classname ) throws TypeUnknownException
+ public Type getType( String classname )
+ throws TypeUnknownException, NullArgumentException
{
if( classname == null )
{
- throw new NullPointerException( "classname" );
+ throw new NullArgumentException( "classname" );
}

if( m_parent != null )
@@ -301,12 +309,14 @@
* @param reference a service reference descriptor
* @param search if TRUE then search for solution using the parent
repository
* @return a set of types capable of servicing the supplied service
reference
+ * @exception NullArgumentException if the reference argument is null.
*/
public Type[] getTypes( ReferenceDescriptor reference, boolean search )
+ throws NullArgumentException
{
if( reference == null )
{
- throw new NullPointerException( "reference" );
+ throw new NullArgumentException( "reference" );
}

ArrayList list = new ArrayList();
@@ -341,10 +351,11 @@
* @return a set of types that support the supplied stage
*/
public Type[] getTypes( StageDescriptor stage )
+ throws NullArgumentException
{
if( stage == null )
{
- throw new NullPointerException( "stage" );
+ throw new NullArgumentException( "stage" );
}

ArrayList list = new ArrayList();

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/OverrideEntryModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/OverrideEntryModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/OverrideEntryModel.java
Mon Jan 17 18:13:05 2005
@@ -1,27 +1,29 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.composition.model.impl;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.EntryDescriptor;

/**
- * Utility class that enables assignment of an absolute value to a
+ * Utility class that enables assignment of an absolute value to a
* context entry.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
@@ -44,14 +46,16 @@
*
* @param descriptor the context entry descriptor
* @param value the value to return for the entry
+ * @exception NullArgumentException if the value argument or the
descriptor
+ * argument is null.
*/
- public OverrideEntryModel(
- EntryDescriptor descriptor, Object value )
+ public OverrideEntryModel( EntryDescriptor descriptor, Object value )
+ throws NullArgumentException
{
super( descriptor );
if( value == null )
{
- throw new NullPointerException( "value" );
+ throw new NullArgumentException( "value" );
}
m_value = value;
}
@@ -62,7 +66,7 @@

/**
* Return the context entry value.
- *
+ *
* @return the context entry value
*/
public Object getValue()

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/Scanner.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/Scanner.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/Scanner.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -20,27 +20,40 @@

import java.io.File;
import java.io.InputStream;
+
import java.net.JarURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
+
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
+
import java.util.jar.JarFile;
import java.util.jar.JarInputStream;
+
import java.util.zip.ZipEntry;

import net.dpml.composition.data.builder.ProfilePackageBuilder;
+
import net.dpml.composition.model.ModelException;
+
import net.dpml.exception.ExceptionHelper;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.meta.info.Service;
import net.dpml.meta.info.ServiceDescriptor;
import net.dpml.meta.info.Type;
+
import net.dpml.meta.info.builder.impl.ServiceBuilder;
import net.dpml.meta.info.builder.impl.TypeBuilder;
+
import net.dpml.system.SystemContext;

/**
@@ -66,19 +79,19 @@
/**
* The type builder.
*/
- private static final TypeBuilder TYPE_BUILDER =
+ private static final TypeBuilder TYPE_BUILDER =
new TypeBuilder();

/**
* The service builder.
*/
- private static final ServiceBuilder SERVICE_BUILDER =
+ private static final ServiceBuilder SERVICE_BUILDER =
new ServiceBuilder();

/**
* The packaged profile builder.
*/
- private static final ProfilePackageBuilder PACKAGE_BUILDER =
+ private static final ProfilePackageBuilder PACKAGE_BUILDER =
new ProfilePackageBuilder();

//===================================================================
@@ -103,22 +116,25 @@
//===================================================================

/**
- * Creation of a new scanner using a supplied classloader.
- * The scanner is responsible for scanning suppied URLs for
+ * Creation of a new scanner using a supplied classloader.
+ * The scanner is responsible for scanning suppied URLs for
* service and types.
*
* @param logger the logging channel
* @param classloader the classloader
+ * @exception NullArgumentException if the classloader argument or the
system
+ * argument is null.
*/
public Scanner( Logger logger, SystemContext system, ClassLoader
classloader )
+ throws NullArgumentException
{
if( classloader == null )
{
- throw new NullPointerException( "classloader" );
+ throw new NullArgumentException( "classloader" );
}
if( system == null )
{
- throw new NullPointerException( "system" );
+ throw new NullArgumentException( "system" );
}
m_classloader = classloader;
m_system = system;
@@ -132,7 +148,7 @@
/**
* Scan the supplied url for Service and Type defintions.
* @param urls the URL array to scan
- * @param types the map to populate with types as keys and
+ * @param types the map to populate with types as keys and
* and packaged profiles as values
* @param services a list to be populated with service descriptors
*/
@@ -153,8 +169,8 @@
if( getLogger().isDebugEnabled() )
{
final String message =
- REZ.getString(
- "scanner.scanning",
+ REZ.getString(
+ "scanner.scanning",
m_system.toString( url.toString() ) );
getLogger().debug( message );
}
@@ -162,8 +178,8 @@
{
scanDirectory( url, types, services );
}
- else if(
- url.getProtocol().equals( "jar" )
+ else if(
+ url.getProtocol().equals( "jar" )
|| ( url.getProtocol().equals( "file" ) &&
url.toString().endsWith( ".jar" ) ) )
{
scanJarFileURL( url, types, services );
@@ -180,7 +196,7 @@
{
File directory = getDirectory( url );
scanDirectoryContent( directory, directory, types, services );
- }
+ }
catch( Throwable e )
{
final String error =
@@ -202,8 +218,8 @@
if( !uri.toString().endsWith( "!/" ) )
{
final String error =
- REZ.getString(
- "scanner.nested-jar-unsupported.error",
+ REZ.getString(
+ "scanner.nested-jar-unsupported.error",
url.toString() );
throw new ModelException( error );
}
@@ -211,10 +227,10 @@
final JarURLConnection jar = (JarURLConnection)
uri.openConnection();
final JarFile base = jar.getJarFile();
scanJarFile( base, types, services );
- }
+ }
catch( Throwable e )
{
- final String error =
+ final String error =
REZ.getString( "scanner.jar.error", url.toString() );
throw new ModelException( error, e );
}
@@ -231,7 +247,7 @@
if( name.endsWith( X_TYPE ) || name.endsWith( X_INFO ) )
{
addType( types, name );
- }
+ }
else if( name.endsWith( X_SERVICE ) )
{
addService( services, name );
@@ -249,14 +265,14 @@
JarInputStream stream = new JarInputStream( (InputStream)
object );
scanJarInputStream( stream, types, services );
return;
- }
+ }
else
{
if( getLogger().isWarnEnabled() )
{
final String warning =
- REZ.getString(
- "scanner.stream.unrecognized-content.warning",
+ REZ.getString(
+ "scanner.stream.unrecognized-content.warning",
url.toString() );
getLogger().warn( warning );
}
@@ -267,10 +283,10 @@
if( getLogger().isWarnEnabled() )
{
final String error =
- REZ.getString(
- "scanner.stream.content.error",
+ REZ.getString(
+ "scanner.stream.content.error",
url.toString() );
- final String warning = ExceptionHelper.packException(
+ final String warning = ExceptionHelper.packException(
error, e, getLogger().isDebugEnabled() );
getLogger().warn( warning );
}
@@ -283,7 +299,7 @@
try
{
entry = stream.getNextEntry();
- }
+ }
catch( Throwable e )
{
entry = null;
@@ -295,7 +311,7 @@
if( name.endsWith( X_TYPE ) || name.endsWith( X_INFO ) )
{
addType( types, name );
- }
+ }
else if( name.endsWith( X_SERVICE ) )
{
addService( services, name );
@@ -304,7 +320,7 @@
try
{
entry = stream.getNextEntry();
- }
+ }
catch( Throwable e )
{
entry = null;
@@ -323,7 +339,7 @@
if( file.isDirectory() )
{
scanDirectoryContent( base, file, types, services );
- }
+ }
else
{
scanFile( j, file, types, services );
@@ -338,7 +354,7 @@
if( name.endsWith( X_TYPE ) || name.endsWith( X_INFO ) )
{
addType( types, name );
- }
+ }
else if( name.endsWith( X_SERVICE ) )
{
addService( services, name );
@@ -365,9 +381,9 @@
{
if( getLogger().isWarnEnabled() )
{
- final String error =
- REZ.getString(
- "scanner.type.verification.ncdf.failure",
+ final String error =
+ REZ.getString(
+ "scanner.type.verification.ncdf.failure",
classname, e.getMessage() );
getLogger().warn( error );
}
@@ -376,11 +392,11 @@
{
if( getLogger().isWarnEnabled() )
{
- final String error =
- REZ.getString(
- "scanner.type.verification.failure",
+ final String error =
+ REZ.getString(
+ "scanner.type.verification.failure",
classname );
- getLogger().warn( ExceptionHelper.packException(
+ getLogger().warn( ExceptionHelper.packException(
error, e, getLogger().isDebugEnabled() ) );
}
}
@@ -389,7 +405,7 @@
private void addService( List list, String name ) throws Exception
{
String classname = parseResourceName( name );
- Service service =
+ Service service =
SERVICE_BUILDER.build( classname, m_classloader );
try
{
@@ -397,8 +413,8 @@
if( getLogger().isDebugEnabled() )
{
final String message =
- REZ.getString(
- "scanner.service.addition",
+ REZ.getString(
+ "scanner.service.addition",
classname );
getLogger().debug( message );
}
@@ -408,11 +424,11 @@
{
if( getLogger().isWarnEnabled() )
{
- final String error =
- REZ.getString(
- "scanner.service.verification.failure",
+ final String error =
+ REZ.getString(
+ "scanner.service.verification.failure",
classname );
- getLogger().warn( ExceptionHelper.packException(
+ getLogger().warn( ExceptionHelper.packException(
error, e, getLogger().isDebugEnabled() ) );
}
}
@@ -447,17 +463,17 @@
catch( NoClassDefFoundError ncdf )
{
String ref = parseResourceName( ncdf.getMessage() );
- final String error =
- REZ.getString(
- "scanner.service.bad-class.error",
+ final String error =
+ REZ.getString(
+ "scanner.service.bad-class.error",
classname, ref );
throw new ModelException( error );
}
catch( ClassNotFoundException cnfe )
{
- final String error =
- REZ.getString(
- "scanner.service.missing-class.error",
+ final String error =
+ REZ.getString(
+ "scanner.service.missing-class.error",
classname );
throw new ModelException( error );
}
@@ -472,7 +488,7 @@
* @param type the component type
* @return an array of classes represnting the type's service interfaces
*/
- private Class[] getServiceClasses( Type type )
+ private Class[] getServiceClasses( Type type )
throws ModelException
{
ArrayList list = new ArrayList();
@@ -482,7 +498,7 @@
ServiceDescriptor service = services[i];
if( (service.getAttribute(
"urn:avalon:service.protocol", "native" ).equals( "native" ))
- && ( service.getAttribute(
+ && ( service.getAttribute(
"urn:avalon:service.accessor", null ) == null) )
{
list.add( getServiceClass( services[i] ) );
@@ -496,13 +512,14 @@
* @param type the component type descriptor
* @return the class implementing the component type
* @exception ModelException if a classloader error occurs
+ * @exception NullArgumentException if the type argument is null.
*/
- private Class getComponentClass( Type type )
- throws ModelException
+ private Class getComponentClass( Type type )
+ throws ModelException, NullArgumentException
{
if( null == type )
{
- throw new NullPointerException( "type" );
+ throw new NullArgumentException( "type" );
}
return getComponentClass( type.getInfo().getClassname() );
}
@@ -512,7 +529,7 @@
* @param classname the component type implementation classname
* @exception ModelException if a classloader error occurs
*/
- private Class getComponentClass( String classname )
+ private Class getComponentClass( String classname )
throws ModelException
{
try
@@ -522,9 +539,9 @@
catch( NoClassDefFoundError ncdf )
{
String ref = parseResourceName( ncdf.getMessage() );
- final String error =
- REZ.getString(
- "scanner.type.bad-class.error",
+ final String error =
+ REZ.getString(
+ "scanner.type.bad-class.error",
classname, ref );
getLogger().error( error );
//getLogger().error( "CLASSLOADER:\n" + m_classloader );
@@ -532,8 +549,8 @@
}
catch( ClassNotFoundException cnfe )
{
- final String error =
- REZ.getString(
+ final String error =
+ REZ.getString(
"scanner.type.missing-class.error", classname );
throw new ModelException( error );
}
@@ -551,19 +568,19 @@
try
{
return m_classloader.loadClass( classname );
- }
+ }
catch( NoClassDefFoundError ncdf )
{
String ref = parseResourceName( ncdf.getMessage() );
- final String error =
- REZ.getString(
+ final String error =
+ REZ.getString(
"scanner.service.bad-class.error", classname, ref );
throw new ModelException( error );
}
catch( ClassNotFoundException cnfe )
{
- final String error =
- REZ.getString(
+ final String error =
+ REZ.getString(
"scanner.service.missing-class.error", classname );
throw new ModelException( error );
}
@@ -585,9 +602,9 @@
{
return file;
}
- final String error =
- REZ.getString(
- "scanner.url-not-a-directory.error",
+ final String error =
+ REZ.getString(
+ "scanner.url-not-a-directory.error",
url.toString() );
throw new IllegalArgumentException( error );
}
@@ -598,9 +615,9 @@
{
return new File( url.toString().substring( 5 ) );
}
- final String error =
- REZ.getString(
- "scanner.not-file-protocol.error",
+ final String error =
+ REZ.getString(
+ "scanner.not-file-protocol.error",
url.toString() );
throw new IllegalArgumentException( error );
}
@@ -616,7 +633,7 @@
if( name3.startsWith( "." ) )
{
return name3.substring( 1, name3.length() );
- }
+ }
else
{
return name3;

Modified:
development/main/metro/extension/api/src/main/net/dpml/extension/Extension.java
==============================================================================
---
development/main/metro/extension/api/src/main/net/dpml/extension/Extension.java
(original)
+++
development/main/metro/extension/api/src/main/net/dpml/extension/Extension.java
Mon Jan 17 18:13:05 2005
@@ -1,16 +1,16 @@
-/*
+/*
* Copyright 2004 Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,9 +21,12 @@
import java.util.Iterator;
import java.util.Map;
import java.util.StringTokenizer;
+
import java.util.jar.Attributes;
import java.util.jar.Manifest;

+import net.dpml.lang.NullArgumentException;
+
/**
* <p>Utility class that represents either an available "Optional Package"
* (formerly known as "Standard Extension") as described in the manifest
@@ -386,6 +389,7 @@
* @param implementationVendor the implementation Vendor of extension.
* @param implementationVendorId the implementation VendorId of
extension.
* @param implementationURL the implementation URL of extension.
+ * @exception NullArgumentException if the extensionName argument is
null.
*/
public Extension( final String extensionName,
final String specificationVersion,
@@ -394,6 +398,7 @@
final String implementationVendor,
final String implementationVendorId,
final String implementationURL )
+ throws NullArgumentException
{
m_extensionName = extensionName;
m_specificationVendor = specificationVendor;
@@ -407,11 +412,11 @@
catch( final NumberFormatException nfe )
{
//
- // don't complain because maven is generating illegal
+ // don't complain because maven is generating illegal
// spec values by default - instead we leave it as null
//

- //final String error =
+ //final String error =
// "Bad specification version format '" +
specificationVersion +
// "' in '" + extensionName + "'. (Reason: " + nfe + ")";
//throw new IllegalArgumentException( error );
@@ -425,7 +430,7 @@

if( null == m_extensionName )
{
- throw new NullPointerException( "extensionName property is null"
);
+ throw new NullArgumentException( "extensionName" );
}
}

@@ -649,7 +654,7 @@
{
if( null == manifest )
return new Extension[0];
-
+
final ArrayList results = new ArrayList();
final Attributes mainAttributes = manifest.getMainAttributes();


Modified:
development/main/metro/extension/api/src/main/net/dpml/extension/Specification.java
==============================================================================
---
development/main/metro/extension/api/src/main/net/dpml/extension/Specification.java
(original)
+++
development/main/metro/extension/api/src/main/net/dpml/extension/Specification.java
Mon Jan 17 18:13:05 2005
@@ -1,16 +1,16 @@
-/*
+/*
* Copyright 2004 Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -18,13 +18,17 @@
package net.dpml.extension;

import java.text.ParseException;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;
+
import java.util.jar.Attributes;
import java.util.jar.Manifest;

+import net.dpml.lang.NullArgumentException;
+
/**
* <p>Utility class that represents either an available "Optional Package"
* (formerly known as "Standard Extension") as described in the manifest
@@ -222,6 +226,7 @@
* @param implementationVersion the implementation Version.
* @param implementationVendor the implementation Vendor.
* @param sections the sections/packages that Specification applies to.
+ * @exception NullArgumentException if the specificationTitle argument
is null.
*/
public Specification( final String specificationTitle,
final String specificationVersion,
@@ -230,6 +235,7 @@
final String implementationVersion,
final String implementationVendor,
final String[] sections )
+ throws NullArgumentException
{
m_specificationTitle = specificationTitle;
m_specificationVendor = specificationVendor;
@@ -243,12 +249,12 @@
catch( final NumberFormatException nfe )
{
//
- // don't complain because maven is generating illegal
+ // don't complain because maven is generating illegal
// spec values by default - instead we leave it as null
//

//
- //final String error =
+ //final String error =
// "Bad specification version format '" +
specificationVersion +
// "' in '" + specificationTitle + "'. (Reason: " + nfe +
")";
//throw new IllegalArgumentException( error );
@@ -261,7 +267,7 @@

if( null == m_specificationTitle )
{
- throw new NullPointerException( "specificationTitle" );
+ throw new NullArgumentException( "specificationTitle" );
}

String[] copy = null;

Modified:
development/main/metro/extension/api/src/main/net/dpml/extension/manager/OptionalPackage.java
==============================================================================
---
development/main/metro/extension/api/src/main/net/dpml/extension/manager/OptionalPackage.java
(original)
+++
development/main/metro/extension/api/src/main/net/dpml/extension/manager/OptionalPackage.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 2004 Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -23,6 +23,8 @@

import net.dpml.extension.Extension;

+import net.dpml.lang.NullArgumentException;
+
/**
* This contains the required meta-data for an "Optional Package"
* (formerly known as "Standard Extension") as described in the manifest
@@ -61,24 +63,26 @@
* @param file absolute location of file
* @param available the list of Extensions Optional Package provides
* @param required the list of Extensions Optional Package requires
+ * @exception NullArgumentException if any one of the supplied arguments
is null.
*/
public OptionalPackage( final File file,
final Extension[] available,
final Extension[] required )
+ throws NullArgumentException
{
if( null == file )
{
- throw new NullPointerException( "file" );
+ throw new NullArgumentException( "file" );
}

if( null == available )
{
- throw new NullPointerException( "available" );
+ throw new NullArgumentException( "available" );
}

if( null == required )
{
- throw new NullPointerException( "required" );
+ throw new NullArgumentException( "required" );
}

m_file = file;

Modified:
development/main/metro/extension/api/src/main/net/dpml/extension/manager/PackageManager.java
==============================================================================
---
development/main/metro/extension/api/src/main/net/dpml/extension/manager/PackageManager.java
(original)
+++
development/main/metro/extension/api/src/main/net/dpml/extension/manager/PackageManager.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 2004 Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -24,6 +24,8 @@

import net.dpml.extension.Extension;

+import net.dpml.lang.NullArgumentException;
+
/**
* <p>Basic Implementation Of PackageManager Interface used to manage
* "Optional Packages" (formerly known as "Standard Extensions").
@@ -48,12 +50,14 @@
* Construct a PackageManager for a repositories.
*
* @param repository the repository to use in PackageManager
+ * @exception NullArgumentException if the repository argument is null.
*/
public PackageManager( final ExtensionManager repository )
+ throws NullArgumentException
{
if( null == repository )
{
- throw new NullPointerException( "repository" );
+ throw new NullArgumentException( "repository" );
}

m_repository = repository;

Modified:
development/main/metro/extension/api/src/main/net/dpml/extension/manager/UnsatisfiedExtensionException.java
==============================================================================
---
development/main/metro/extension/api/src/main/net/dpml/extension/manager/UnsatisfiedExtensionException.java
(original)
+++
development/main/metro/extension/api/src/main/net/dpml/extension/manager/UnsatisfiedExtensionException.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 2004 Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,6 +21,8 @@

import net.dpml.extension.Extension;

+import net.dpml.lang.NullArgumentException;
+
/**
* Exception indicating an extension was not found in Package Repository.
*
@@ -41,12 +43,14 @@
* for specified {@link Extension}.
*
* @param extension the extension that caused exception
+ * @exception NullArgumentException if the extension argument is null.
*/
public UnsatisfiedExtensionException( final Extension extension )
+ throws NullArgumentException
{
if( null == extension )
{
- throw new NullPointerException( "extension" );
+ throw new NullArgumentException( "extension" );
}

m_extension = extension;

Modified:
development/main/metro/extension/impl/src/main/net/dpml/extension/manager/impl/DefaultExtensionManager.java
==============================================================================
---
development/main/metro/extension/impl/src/main/net/dpml/extension/manager/impl/DefaultExtensionManager.java
(original)
+++
development/main/metro/extension/impl/src/main/net/dpml/extension/manager/impl/DefaultExtensionManager.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 2004 Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,19 +21,24 @@

import java.io.File;
import java.io.IOException;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.StringTokenizer;
+
import java.util.jar.JarFile;
import java.util.jar.Manifest;

import net.dpml.extension.Extension;
+
import net.dpml.extension.manager.ExtensionManager;
import net.dpml.extension.manager.OptionalPackage;

+import net.dpml.lang.NullArgumentException;
+
/**
* <p>Interface used to contain "Optional Packages" (formerly known as
* "Standard Extensions"). It is assumed that each "Optional Package" is
@@ -434,12 +439,22 @@
* Validate each element in path to make sure they are valid.
*
* @param path the path
+ * @exception NullArgumentException if the path argument is null, or if
any of
+ * the elements in the path array is null.
*/
private void validatePath( final File[] path )
+ throws NullArgumentException
{
if( null == path )
{
- throw new NullPointerException( "path" );
+ throw new NullArgumentException( "path" );
+ }
+ for( int i = 0; i < path.length; i++ )
+ {
+ if( null == path[i] )
+ {
+ throw new NullArgumentException( "path[" + i + "]" );
+ }
}

for( int i = 0; i < path.length; i++ )

Modified:
development/main/metro/extension/impl/src/main/net/dpml/extension/manager/impl/OptionalPackageComparator.java
==============================================================================
---
development/main/metro/extension/impl/src/main/net/dpml/extension/manager/impl/OptionalPackageComparator.java
(original)
+++
development/main/metro/extension/impl/src/main/net/dpml/extension/manager/impl/OptionalPackageComparator.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 2004 Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -23,8 +23,11 @@

import net.dpml.extension.DeweyDecimal;
import net.dpml.extension.Extension;
+
import net.dpml.extension.manager.OptionalPackage;

+import net.dpml.lang.NullArgumentException;
+
/**
* A simple class to compare two extensions and sort them
* on spec version and then on impl version. Unspecified
@@ -42,10 +45,11 @@
private final String m_name;

public OptionalPackageComparator( final String name )
+ throws NullArgumentException
{
if( null == name )
{
- throw new NullPointerException( "name" );
+ throw new NullArgumentException( "name" );
}

m_name = name;

Modified:
development/main/metro/logging/providers/log4j/impl/src/main/net/dpml/logging/log4j/Log4JLoggingFactory.java
==============================================================================
---
development/main/metro/logging/providers/log4j/impl/src/main/net/dpml/logging/log4j/Log4JLoggingFactory.java
(original)
+++
development/main/metro/logging/providers/log4j/impl/src/main/net/dpml/logging/log4j/Log4JLoggingFactory.java
Mon Jan 17 18:13:05 2005
@@ -31,13 +31,17 @@
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.criteria.DefaultLoggingCriteria;
+
import net.dpml.logging.provider.LoggingCriteria;
import net.dpml.logging.provider.LoggingFactory;
import net.dpml.logging.provider.LoggingManager;
import net.dpml.logging.provider.LoggingException;

import org.apache.log4j.PropertyConfigurator;
+
import org.apache.log4j.xml.DOMConfigurator;

/**
@@ -122,13 +126,14 @@
* Create a new instance of an application.
* @param criteriaMap the creation criteria
* @return the application instance
+ * @exception NullArgumentException if the criteriaMap argument is null.
*/
public Object create( Map criteriaMap )
- throws Exception
+ throws Exception, NullArgumentException
{
if( null == criteriaMap )
{
- throw new NullPointerException( "criteriaMap" );
+ throw new NullArgumentException( "criteriaMap" );
}
LoggingCriteria criteria = getLoggingCriteria( criteriaMap );
m_BaseDirectory = criteria.getBaseDirectory();

Modified:
development/main/metro/logging/providers/logkit/api/src/main/net/dpml/logging/logkit/Logger.java
==============================================================================
---
development/main/metro/logging/providers/logkit/api/src/main/net/dpml/logging/logkit/Logger.java
(original)
+++
development/main/metro/logging/providers/logkit/api/src/main/net/dpml/logging/logkit/Logger.java
Mon Jan 17 18:13:05 2005
@@ -1,30 +1,32 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.dpml.logging.logkit;

+import net.dpml.lang.NullArgumentException;
+
/**
* The object interacted with by client objects to perform logging.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @author Peter Donald
*/
-public class Logger
+public class Logger
{
private static final Logger[] EMPTY_SET = new Logger[ 0 ];

@@ -382,9 +384,17 @@
* Set the log targets for this logger.
*
* @param logTargets the Log Targets
+ * @exception NullArgumentException if logTargets argument is null, or
any of
+ * the elements in the logTargets array is null.
*/
public synchronized void setLogTargets( final LogTarget[] logTargets )
+ throws NullArgumentException
{
+ if( null == logTargets )
+ {
+ throw new NullArgumentException( "logTargets" );
+ }
+
if( null != logTargets )
{
//Make sure that the array passed in does not have any
@@ -394,7 +404,7 @@
if( null == logTargets[ i ] )
{
final String message = "logTargets[ " + i + " ]";
- throw new NullPointerException( message );
+ throw new NullArgumentException( message );
}
}
}

Modified:
development/main/metro/logging/providers/logkit/api/src/main/net/dpml/logging/logkit/Priority.java
==============================================================================
---
development/main/metro/logging/providers/logkit/api/src/main/net/dpml/logging/logkit/Priority.java
(original)
+++
development/main/metro/logging/providers/logkit/api/src/main/net/dpml/logging/logkit/Priority.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -20,6 +20,8 @@

import java.io.Serializable;

+import net.dpml.lang.NullArgumentException;
+
/**
* Class representing and holding constants for priority.
*
@@ -106,12 +108,14 @@
*
* @param name the string name of priority
* @param priority the numerical code of priority
+ * @exception NullArgumentException if the name argument is null.
*/
private Priority( final String name, final int priority )
+ throws NullArgumentException
{
if( null == name )
{
- throw new NullPointerException( "name" );
+ throw new NullArgumentException( "name" );
}

m_name = name;

Modified:
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/DefaultLoggingFactory.java
==============================================================================
---
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/DefaultLoggingFactory.java
(original)
+++
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/DefaultLoggingFactory.java
Mon Jan 17 18:13:05 2005
@@ -21,28 +21,36 @@

import java.io.File;
import java.io.InputStream;
+
import java.net.URL;
+
import java.util.Map;
import java.util.HashMap;
import java.util.ArrayList;

-
import net.dpml.configuration.Configuration;
import net.dpml.configuration.ConfigurationException;
+
import net.dpml.configuration.impl.DefaultConfigurationBuilder;
import net.dpml.configuration.impl.ConfigurationUtil;

import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.logging.criteria.DefaultLoggingCriteria;
+
import net.dpml.logging.data.CategoriesDirective;
import net.dpml.logging.data.CategoryDirective;
+
import net.dpml.logging.logkit.factory.FileTargetFactory;
import net.dpml.logging.logkit.factory.StreamTargetFactory;
import net.dpml.logging.logkit.factory.MulticastTargetFactory;
import net.dpml.logging.logkit.factory.PluginTargetFactory;
+
import net.dpml.logging.provider.ConsoleLogger;
import net.dpml.logging.provider.LoggingCriteria;
import net.dpml.logging.provider.LoggingFactory;
@@ -167,12 +175,14 @@
* @param map the parameters
* @return the logging manager instance
* @exception Exception if an error occurs
+ * @exception NullArgumentException if the map argument is null.
*/
- public Object create( final Map map ) throws Exception
+ public Object create( final Map map )
+ throws Exception, NullArgumentException
{
if( null == map )
{
- throw new NullPointerException( "map" );
+ throw new NullArgumentException( "map" );
}



Modified:
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/Hierarchy.java
==============================================================================
---
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/Hierarchy.java
(original)
+++
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/Hierarchy.java
Mon Jan 17 18:13:05 2005
@@ -1,25 +1,29 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.dpml.logging.logkit;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.logkit.format.PatternFormatter;
+
import net.dpml.logging.logkit.factory.io.StreamTarget;
+
import net.dpml.logging.logkit.util.DefaultErrorHandler;

/**
@@ -165,12 +169,14 @@
*
* @throws UnsupportedOperationException if no more LoggerListeners are
* permitted.
+ * @exception NullArgumentException if the loggerListener argument is
null.
*/
public synchronized void addLoggerListener( final LoggerListener
loggerListener )
+ throws NullArgumentException
{
if( null == loggerListener )
{
- throw new NullPointerException( "loggerListener" );
+ throw new NullArgumentException( "loggerListener" );
}

if( null == m_loggerListener )
@@ -189,12 +195,14 @@
* step before adding a new one if you want to change it.
*
* @param loggerListener the LoggerListener
+ * @exception NullArgumentException if the loggerListener argument is
null.
*/
public synchronized void removeLoggerListener( final LoggerListener
loggerListener )
+ throws NullArgumentException
{
if( null == loggerListener )
{
- throw new NullPointerException( "loggerListener" );
+ throw new NullArgumentException( "loggerListener" );
}

if( null != m_loggerListener && m_loggerListener == loggerListener )
;

Modified:
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/AbstractTarget.java
==============================================================================
---
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/AbstractTarget.java
(original)
+++
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/AbstractTarget.java
Mon Jan 17 18:13:05 2005
@@ -1,27 +1,30 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.dpml.logging.logkit.factory;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.logkit.ErrorAware;
import net.dpml.logging.logkit.ErrorHandler;
import net.dpml.logging.logkit.LogEvent;
import net.dpml.logging.logkit.LogTarget;
+
import net.dpml.logging.logkit.util.Closeable;
import net.dpml.logging.logkit.util.DefaultErrorHandler;

@@ -52,12 +55,14 @@
/**
* AbstractTarget constructor.
* @param errorHandler the error handler
+ * @exception NullArgumentException if the errorHandler is null.
*/
public AbstractTarget( final ErrorHandler errorHandler )
+ throws NullArgumentException
{
if( errorHandler == null )
{
- throw new NullPointerException( "errorHandler specified cannot
be null" );
+ throw new NullArgumentException( "errorHandler" );
}
setErrorHandler( errorHandler );
}

Modified:
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io/FileTarget.java
==============================================================================
---
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io/FileTarget.java
(original)
+++
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io/FileTarget.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -22,6 +22,8 @@
import java.io.FileOutputStream;
import java.io.IOException;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.logkit.Formatter;

/**
@@ -30,8 +32,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @author Peter Donald
*/
-public class FileTarget
- extends StreamTarget
+public class FileTarget extends StreamTarget
{
///File we are writing to
private File m_file;
@@ -65,13 +66,14 @@
* @param file the file to write to
* @param append true if file is to be appended to, false otherwise
* @exception IOException if directories can not be created or file can
not be opened
+ * @exception NullArgumentException if the file argument is null.
*/
protected synchronized void setFile( final File file, final boolean
append )
- throws IOException
+ throws IOException, NullArgumentException
{
if( null == file )
{
- throw new NullPointerException( "file property must not be null"
);
+ throw new NullArgumentException( "file" );
}

if( isOpen() )

Modified:
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io/StreamTarget.java
==============================================================================
---
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io/StreamTarget.java
(original)
+++
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io/StreamTarget.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,7 +21,10 @@
import java.io.IOException;
import java.io.OutputStream;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.logkit.Formatter;
+
import net.dpml.logging.logkit.factory.AbstractOutputTarget;

/**
@@ -82,12 +85,14 @@
* Close down old stream and write tail if appropriate.
*
* @param outputStream the new OutputStream
+ * @exception NullArgumentException if the outputStream argument is null.
*/
protected synchronized void setOutputStream( final OutputStream
outputStream )
+ throws NullArgumentException
{
if( null == outputStream )
{
- throw new NullPointerException( "outputStream property must not
be null" );
+ throw new NullArgumentException( "outputStream" );
}

m_outputStream = outputStream;

Modified:
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io/WriterTarget.java
==============================================================================
---
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io/WriterTarget.java
(original)
+++
development/main/metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io/WriterTarget.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,7 +21,10 @@
import java.io.IOException;
import java.io.Writer;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.logkit.Formatter;
+
import net.dpml.logging.logkit.factory.AbstractOutputTarget;

/**
@@ -56,12 +59,14 @@
* Close down writer and write tail if appropriate.
*
* @param writer the new writer
+ * @exception NullArgumentException if the writer argument is null.
*/
protected synchronized void setWriter( final Writer writer )
+ throws NullArgumentException
{
if( null == writer )
{
- throw new NullPointerException( "writer property must not be
null" );
+ throw new NullArgumentException( "writer" );
}

m_output = writer;

Modified: development/main/metro/main/src/main/net/dpml/metro/Metro.java
==============================================================================
--- development/main/metro/main/src/main/net/dpml/metro/Metro.java
(original)
+++ development/main/metro/main/src/main/net/dpml/metro/Metro.java Mon
Jan 17 18:13:05 2005
@@ -22,31 +22,43 @@
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.IOException;
+
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
+
import java.util.ArrayList;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.Map;

import net.dpml.activity.Startable;
+
import net.dpml.cli.ArgumentHandler;
+
import net.dpml.exception.ExceptionHelper;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.system.Factory;
import net.dpml.system.SystemContext;
import net.dpml.system.SystemContextFactory;
import net.dpml.system.SystemException;
-import net.dpml.transit.artifact.Artifact;

import net.dpml.transit.Transit;
+
+import net.dpml.transit.artifact.Artifact;
+
+import net.dpml.transit.monitors.Monitor;
+
import net.dpml.transit.repository.Plugin;
import net.dpml.transit.repository.Repository;
-import net.dpml.transit.monitors.Monitor;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
@@ -119,9 +131,11 @@
* @param repository the bootstrap system repository
* @param descriptor the descriptor of this plugin
* @param args command line arguments
+ * @exception NullArgumentException if either of the debug, repository,
descriptor
+ * or args argument is null.
*/
public Metro( Map map, Repository repository, Plugin descriptor,
String[] args )
- throws IOException, ParseException, Exception
+ throws IOException, ParseException, Exception, NullArgumentException
{
Boolean debug = (Boolean) map.get( "urn:transit.debug.policy" );

@@ -307,7 +321,7 @@
}
}

- private SystemContext loadSystemContext(
+ private SystemContext loadSystemContext(
Map map, Repository repository, URI uri, String[] args )
throws SystemException
{
@@ -420,10 +434,11 @@
//
------------------------------------------------------------------------

private void assertNotNull( final String key, final Object object )
+ throws NullArgumentException
{
if( null == object )
{
- throw new NullPointerException( key );
+ throw new NullArgumentException( key );
}
}

@@ -501,7 +516,7 @@
}

/**
- * Load all properties file from the standard locations. Standard
+ * Load all properties file from the standard locations. Standard
* locations in priority order include:
* <ul>
* <li>${user.dir}/dpml.properties</li>
@@ -534,13 +549,13 @@
File dir = getWorkingDirectory();
File dirPreferenceFile = new File( dir, DPML_PROPERTIES );
loadFile( properties, dirPreferenceFile );
-
+
properties.setProperty( Transit.HOME_KEY, home.toString() );
return properties;
}
catch( IOException ioe )
{
- final String error =
+ final String error =
"Unexpected error while attempting to construct initial
context.";
throw new SystemException( error, ioe );
}
@@ -550,17 +565,17 @@
* Read in a static properties resource relative to a supplied class
* and path.
*
- * @param ref a class used to establish a classloader and anchors
+ * @param ref a class used to establish a classloader and anchors
* relative path references
* @param path the resource address
* @return the static properties
* @exception IllegalStateException if the path is unresolvable
*/
- private static Properties getStaticProperties()
+ private static Properties getStaticProperties()
throws IOException
{
Properties bootstrap = new Properties();
- InputStream input =
+ InputStream input =
Metro.class.getClassLoader().getResourceAsStream( DPML_PROPERTIES
);
if( input != null )
{

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/CategoryDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/CategoryDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/CategoryDescriptor.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,6 +21,8 @@

import java.util.Properties;

+import net.dpml.lang.NullArgumentException;
+
/**
* A descriptor describing an Avalon Logger
* child instances that the component will create using the
@@ -52,16 +54,15 @@
* @param name the logging category name
* @param attributes a set of attributes associated with the declaration
*
- * @exception NullPointerException if name argument is null
+ * @exception NullArgumentException if name argument is null
*/
- public CategoryDescriptor( final String name,
- final Properties attributes )
- throws NullPointerException
+ public CategoryDescriptor( final String name, final Properties
attributes )
+ throws NullArgumentException
{
super( attributes );
if( null == name )
{
- throw new NullPointerException( "name" );
+ throw new NullArgumentException( "name" );
}

m_name = name;

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/ContextDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/ContextDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/ContextDescriptor.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -24,6 +24,8 @@
import java.util.List;
import java.util.Properties;

+import net.dpml.lang.NullArgumentException;
+
/**
* A descriptor describing the Context that the Component
* is passed to describe information about Runtime environment
@@ -91,7 +93,7 @@

/**
* Create a descriptor without attributes.
- * @param classname the classname of a castable interface
+ * @param classname the classname of a castable interface
* @param entries the set of entries required within the context
*/
public ContextDescriptor( final String classname,
@@ -102,21 +104,21 @@

/**
* Create a descriptor.
- * @param classname the classname of a castable interface
+ * @param classname the classname of a castable interface
* @param entries the set of entries required within the context
* @param attributes supplimentary attributes associated with the context
- * @exception NullPointerException if the entries argument is null
+ * @exception NullArgumentException if the entries argument is null
*/
public ContextDescriptor( final String classname,
final EntryDescriptor[] entries,
final Properties attributes )
- throws NullPointerException, IllegalArgumentException
+ throws NullArgumentException, IllegalArgumentException
{
super( attributes );

if ( null == entries )
{
- throw new NullPointerException( "entries" );
+ throw new NullArgumentException( "entries" );
}

m_classname = classname;
@@ -151,17 +153,19 @@

/**
* Return the entry with specified alias. If the entry
- * does not declare an alias the method will return an
+ * does not declare an alias the method will return an
* entry with the matching key.
*
* @param alias the context entry key to lookup
* @return the entry with specified key.
+ * @exception NullArgumentException if the alias argument is null.
*/
public EntryDescriptor getEntry( final String alias )
+ throws NullArgumentException
{
if ( null == alias )
{
- throw new NullPointerException( "alias" );
+ throw new NullArgumentException( "alias" );
}

for ( int i = 0; i < m_entries.length; i++ )

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/DependencyDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/DependencyDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/DependencyDescriptor.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,6 +21,8 @@

import java.util.Properties;

+import net.dpml.lang.NullArgumentException;
+
/**
* A descriptor that describes dependency information for
* a particular Component. This class contains information
@@ -124,23 +126,25 @@
* @param optional TRUE if this depedency is optional
* @param attributes a set of attributes to associate with the dependency
* @param position constructor position
+ * @exception NullArgumentException if the role argument or the service
argument is null.
*/
public DependencyDescriptor( final String role,
final ReferenceDescriptor service,
final boolean optional,
- final Properties attributes,
+ final Properties attributes,
final int position )
+ throws NullArgumentException
{
super( attributes );

if ( null == role )
{
- throw new NullPointerException( "role" );
+ throw new NullArgumentException( "role" );
}

if ( null == service )
{
- throw new NullPointerException( "service" );
+ throw new NullArgumentException( "service" );
}

m_key = role;
@@ -207,7 +211,7 @@
/**
* Return the constructor position.
*
- * @return -1 if not constructor else the value
+ * @return -1 if not constructor else the value
* indicates the n'th public constructor
*/
public int getPosition()

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/Descriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/Descriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/Descriptor.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -20,8 +20,11 @@
package net.dpml.meta.info;

import java.io.Serializable;
+
import java.util.Properties;

+import net.dpml.lang.NullArgumentException;
+
/**
* This is the Abstract class for all feature feature descriptors.
*
@@ -112,7 +115,7 @@
if ( other instanceof Descriptor )
{
Descriptor descriptor = (Descriptor) other;
- if ( null == m_attributes )
+ if ( null == m_attributes )
return null == descriptor.m_attributes;

return m_attributes.equals( descriptor.m_attributes );
@@ -138,9 +141,9 @@

/**
* Returns the property set.
- * TODO: check necessity for this operationi and if really needed return
+ * TODO: check necessity for this operationi and if really needed return
* a cloned equivalent (i.e. disable modification)
- *
+ *
* @return the property set.
*/
protected Properties getProperties()

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/EntryDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/EntryDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/EntryDescriptor.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,6 +21,8 @@

import java.io.Serializable;

+import net.dpml.lang.NullArgumentException;
+
/**
* A descriptor that describes a value that must be placed
* in components Context. It contains information about;
@@ -97,7 +99,7 @@
*/
public EntryDescriptor( final String key,
final String classname,
- final boolean optional,
+ final boolean optional,
final boolean isVolatile ) throws
NullPointerException
{
this( key, classname, optional, isVolatile, null );
@@ -110,21 +112,22 @@
* @param optional TRUE if this is an optional entry
* @param isVolatile TRUE if the entry is is volatile
* @param alias an alternative key used by the component to reference
the key
- * @exception NullPointerException if the key or type value are null
+ * @exception NullArgumentException if the key or type value are null
*/
public EntryDescriptor( final String key,
final String classname,
- final boolean optional,
+ final boolean optional,
final boolean isVolatile,
- final String alias ) throws NullPointerException
+ final String alias )
+ throws NullArgumentException
{
if ( null == key )
{
- throw new NullPointerException( "key" );
+ throw new NullArgumentException( "key" );
}
if ( null == classname )
{
- throw new NullPointerException( "classname" );
+ throw new NullArgumentException( "classname" );
}

m_key = key;
@@ -146,7 +149,7 @@

/**
* Return the alias that Component uses to lookup the entry.
- * If no alias is declared, the standard lookup key will be
+ * If no alias is declared, the standard lookup key will be
* returned.
*
* @return the alias to the key.
@@ -165,7 +168,7 @@

/**
* Return the key type of value that is stored in Context.
- *
+ *
* @return the key type of value that is stored in Context.
*/
public String getClassname()

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/ExtensionDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/ExtensionDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/ExtensionDescriptor.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,6 +21,8 @@

import java.util.Properties;

+import net.dpml.lang.NullArgumentException;
+
/**
* A descriptor that describes a name and inteface of a lifecycle stage.
*
@@ -49,17 +51,17 @@
* Creation of a extension descriptor with attributes.
* @param urn the extension identifier
* @param attributes a set of attributes to associate with the extension
- * @exception NullPointerException if the supplied urn is null
+ * @exception NullArgumentException if the supplied urn is null
*/
public ExtensionDescriptor( final String urn,
final Properties attributes )
- throws NullPointerException
+ throws NullArgumentException
{
super( attributes );

if ( null == urn )
{
- throw new NullPointerException( "urn" );
+ throw new NullArgumentException( "urn" );
}

m_urn = urn;

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/InfoDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/InfoDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/InfoDescriptor.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,6 +21,8 @@

import java.util.Properties;

+import net.dpml.lang.NullArgumentException;
+
/**
* This class is used to provide explicit information to assembler
* and administrator about the Component. It includes information
@@ -92,13 +94,13 @@
private final String m_schema;

/**
- * The component garbage collection policy. The value returned is either
- * WEAK, SOFT or HARD. A component implementing a WEAK policy
- * will be decommissioned if no references exist. A component declaring
a
+ * The component garbage collection policy. The value returned is either
+ * WEAK, SOFT or HARD. A component implementing a WEAK policy
+ * will be decommissioned if no references exist. A component declaring
a
* SOFT policy will exist without reference so long as memory contention
- * does not occur. A component implementing HARD policies will be
- * maintained irrespective of usage and memory constraints so long as
its
- * scope exists (the jvm for a "singleton" and Thread for "thread"
lifestyles).
+ * does not occur. A component implementing HARD policies will be
+ * maintained irrespective of usage and memory constraints so long as its
+ * scope exists (the jvm for a "singleton" and Thread for "thread"
lifestyles).
* The default policy is HARD.
*/
private final int m_collection;
@@ -126,6 +128,7 @@
* @param flag native matro flag
* @param attributes a set of attributes associated with the component
type
* @exception IllegalArgumentException if the implementation key is not
a classname
+ * @exception NullArgumentException if the classname argument is null.
* @since 1.2
*/
public InfoDescriptor( final String name,
@@ -136,13 +139,16 @@
final String schema,
final boolean flag,
final Properties attributes )
- throws IllegalArgumentException
+ throws IllegalArgumentException, NullArgumentException
{
super( attributes );

m_native = flag;

- if ( null == classname ) throw new NullPointerException( "classname"
);
+ if ( null == classname )
+ {
+ throw new NullArgumentException( "classname" );
+ }

if ( classname.indexOf( "/" ) > -1 )
{
@@ -171,7 +177,7 @@
m_collection = SOFT;
}
else
- {
+ {
m_collection = p;
}
}
@@ -202,7 +208,8 @@
* @param lifestyle the lifestyle string
* @exception IllegalArgumentException if the value is not recognized
*/
- private void validateLifestyle( String lifestyle ) throws
IllegalArgumentException
+ private void validateLifestyle( String lifestyle )
+ throws IllegalArgumentException
{
if ( lifestyle.equals( TRANSIENT )
|| lifestyle.equals( SINGLETON )
@@ -215,7 +222,7 @@
}

/**
- * Internal utility to get the name of the class without the package
name. Used
+ * Internal utility to get the name of the class without the package
name. Used
* when constructing a default component name.
* @param classname the fully qualified classname
* @return the short class name without the package name

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/PermissionDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/PermissionDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/PermissionDescriptor.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,6 +21,8 @@

import java.io.Serializable;

+import net.dpml.lang.NullArgumentException;
+
/**
* A descriptor that describes a value that must be placed
* in components Context. It contains information about;
@@ -37,7 +39,7 @@
implements Serializable
{

- private static final String[] EMPTY_ACTIONS =
+ private static final String[] EMPTY_ACTIONS =
new String[0];

/**
@@ -60,13 +62,15 @@
* @param classname the permission class name
* @param name the permission name
* @param actions the permission actions
+ * @exception NullArgumentException if the classname argument is null.
*/
- public PermissionDescriptor(
- final String classname, final String name, final String[] actions )
+ public PermissionDescriptor(
+ final String classname, final String name, final String[]
actions )
+ throws NullArgumentException
{
if ( null == classname )
{
- throw new NullPointerException( "classname" );
+ throw new NullArgumentException( "classname" );
}

m_classname = classname;
@@ -83,7 +87,7 @@

/**
* Return the classname of the permission.
- *
+ *
* @return the classname
*/
public String getClassname()
@@ -93,7 +97,7 @@

/**
* Return the permission name. The value returned is relative to
- * the permission class. If no permission name is declared a null
+ * the permission class. If no permission name is declared a null
* value will be returned.
*
* @return the name
@@ -106,7 +110,7 @@
/**
* Return the set of actions associated with the permission.
*
- * @return a string array representing the actions assigned to
+ * @return a string array representing the actions assigned to
* this permission
*/
public String[] getActions()
@@ -143,7 +147,7 @@
{
String action = m_actions[i];
if( !action.equals( permission.m_actions[i] ) ) return
false;
- }
+ }
}
}

@@ -180,8 +184,8 @@
{
list = list + ", ";
}
- }
- return "[permission class="
+ }
+ return "[permission class="
+ getClassname()
+ " name=" + getName()
+ " actions=" + list

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/ReferenceDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/ReferenceDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/ReferenceDescriptor.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,6 +21,8 @@

import java.io.Serializable;

+import net.dpml.lang.NullArgumentException;
+
/**
* This reference defines the type of interface required
* by a component. The type corresponds to the class name of the
@@ -45,8 +47,8 @@
private final Version m_version;

/**
- * Construct a service with specified type. The type argument will be
- * parsed for a classname and version in the form [classname]:[version].
+ * Construct a service with specified type. The type argument will be
+ * parsed for a classname and version in the form [classname]:[version].
* If not version is present a default 1.0.0 version will be assigned.
*
* @param type the service type spec
@@ -62,19 +64,20 @@
*
* @param classname the name of the service
* @param version the version of service
- * @exception NullPointerException if the classname or version is null
+ * @exception NullArgumentException if the classname or version is null
* @exception IllegalArgumentException if the classname string is invalid
*/
public ReferenceDescriptor( final String classname,
- final Version version ) throws
NullPointerException
+ final Version version )
+ throws NullArgumentException
{
if ( null == classname )
{
- throw new NullPointerException( "classname" );
+ throw new NullArgumentException( "classname" );
}
if( classname.equals( "" ) )
{
- throw new IllegalArgumentException( "classname" );
+ throw new NullArgumentException( "classname" );
}
if( classname.indexOf( "/" ) > -1 )
{
@@ -148,7 +151,7 @@
boolean match = false;

//
- // TODO: check validity of the following - this is
+ // TODO: check validity of the following - this is
// assuming the equality is equivalent to compliance
// which is not true
//
@@ -179,8 +182,12 @@
}

private static final String parseClassname( final String type )
+ throws NullArgumentException
{
- if( type == null ) throw new NullPointerException( "type" );
+ if( type == null )
+ {
+ throw new NullArgumentException( "type" );
+ }

int index = type.indexOf( ":" );
if( index == -1 )
@@ -189,7 +196,7 @@
}
else
{
- return type.substring( 0, index );
+ return type.substring( 0, index );
}
}

@@ -206,8 +213,13 @@
}

private static final int getColonIndex( final String type )
+ throws NullArgumentException
{
- if ( null == type ) throw new NullPointerException( "type" );
+ if ( null == type )
+ {
+ throw new NullArgumentException( "type" );
+ }
+
return Math.min( type.length(), Math.max( 0, type.indexOf( ":" ) ) );
}
}

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/Service.java
==============================================================================
--- development/main/metro/meta/api/src/main/net/dpml/meta/info/Service.java
(original)
+++ development/main/metro/meta/api/src/main/net/dpml/meta/info/Service.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,6 +21,8 @@

import java.util.Properties;

+import net.dpml.lang.NullArgumentException;
+
/**
* This class contains the meta information about a particular
* service. It contains a set of attributes qualifying the service;
@@ -94,16 +96,18 @@
* @param reference the versioned classname
* @param entries the set of optional context entries
* @param attributes the set of attributes to assign to the descriptor
+ * @exception NullArgumentException if the reference argument is null.
*/
public Service(
final ReferenceDescriptor reference,
final EntryDescriptor[] entries,
final Properties attributes )
+ throws NullArgumentException
{
super( attributes );
if ( reference == null )
{
- throw new NullPointerException( "reference" );
+ throw new NullArgumentException( "reference" );
}
m_reference = reference;
if ( entries == null )

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/ServiceDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/ServiceDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/ServiceDescriptor.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,6 +21,8 @@

import java.util.Properties;

+import net.dpml.lang.NullArgumentException;
+
/**
* This descriptor defines the type of service offerend or required
* by a component. The type corresponds to the class name of the
@@ -81,17 +83,17 @@
*
* @param designator the ReferenceDescriptor
* @param attributes the attributes of service
- * @exception NullPointerException if the designator argument is null
+ * @exception NullArgumentException if the designator argument is null
*/
public ServiceDescriptor( final ReferenceDescriptor designator,
final Properties attributes )
- throws NullPointerException
+ throws NullArgumentException
{
super( attributes );

if ( null == designator )
{
- throw new NullPointerException( "designator" );
+ throw new NullArgumentException( "designator" );
}

m_designator = designator;

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/StageDescriptor.java
==============================================================================
---
development/main/metro/meta/api/src/main/net/dpml/meta/info/StageDescriptor.java
(original)
+++
development/main/metro/meta/api/src/main/net/dpml/meta/info/StageDescriptor.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,6 +21,8 @@

import java.util.Properties;

+import net.dpml.lang.NullArgumentException;
+
/**
* A descriptor that describes a name and inteface of a lifecycle stage.
*
@@ -50,17 +52,17 @@
* Constructor a stage descriptor with attributes.
* @param urn the stage identifier
* @param attributes a set of attribute values to associated with the
stage
- * @exception NullPointerException if the reference argument is null
+ * @exception NullArgumentException if the reference argument is null
*/
public StageDescriptor( final String urn,
final Properties attributes )
- throws NullPointerException
+ throws NullArgumentException
{
super( attributes );

if ( null == urn )
{
- throw new NullPointerException( "urn" );
+ throw new NullArgumentException( "urn" );
}
m_urn = urn;
}

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
==============================================================================
--- development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
(original)
+++ development/main/metro/meta/api/src/main/net/dpml/meta/info/Type.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -22,6 +22,9 @@
import java.io.Serializable;

import net.dpml.configuration.Configuration;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.parameters.Parameters;

/**
@@ -122,8 +125,8 @@
final Configuration defaults )
throws NullPointerException
{
- this(
- descriptor, new SecurityDescriptor( null, null ), loggers,
context, services, dependencies,
+ this(
+ descriptor, new SecurityDescriptor( null, null ), loggers,
context, services, dependencies,
stages, extensions, defaults );
}

@@ -164,7 +167,7 @@
descriptor, security, loggers, context, services, dependencies,
stages, extensions, defaults, null );
}
-
+
/**
* Creation of a new Type instance using a supplied component descriptor,
* logging, cotext, services, depedencies, stages and extension
descriptors.
@@ -186,7 +189,7 @@
* suppier resolution
* @param defaults the static configuration defaults
* @param params static parameter defaults
- * @exception NullPointerException if the descriptor, loggers, context,
services,
+ * @exception NullArgumentException if the descriptor, loggers, context,
services,
* dependencies, stages, or extensions argument is null
*/
public Type( final InfoDescriptor descriptor,
@@ -199,39 +202,39 @@
final ExtensionDescriptor[] extensions,
final Configuration defaults,
final Parameters params )
- throws NullPointerException
+ throws NullArgumentException
{
if ( null == descriptor )
{
- throw new NullPointerException( "descriptor" );
+ throw new NullArgumentException( "descriptor" );
}
if ( null == security )
{
- throw new NullPointerException( "security" );
+ throw new NullArgumentException( "security" );
}
if ( null == loggers )
{
- throw new NullPointerException( "loggers" );
+ throw new NullArgumentException( "loggers" );
}
if ( null == context )
{
- throw new NullPointerException( "context" );
+ throw new NullArgumentException( "context" );
}
if ( null == services )
{
- throw new NullPointerException( "services" );
+ throw new NullArgumentException( "services" );
}
if ( null == dependencies )
{
- throw new NullPointerException( "dependencies" );
+ throw new NullArgumentException( "dependencies" );
}
if ( null == stages )
{
- throw new NullPointerException( "stages" );
+ throw new NullArgumentException( "stages" );
}
if ( null == extensions )
{
- throw new NullPointerException( "extensions" );
+ throw new NullArgumentException( "extensions" );
}

m_descriptor = descriptor;
@@ -478,13 +481,13 @@
return false;

Type t = (Type) other;
-
+
if( ! m_descriptor.equals( t.m_descriptor ) )
return false;
-
+
if( ! m_security.equals( t.m_security ) )
return false;
-
+
if( null == m_configuration )
{
if( ! ( null == t.m_configuration ) )
@@ -552,7 +555,7 @@
hash >>>= 13;

if( m_configuration != null )
- {
+ {
hash ^= m_configuration.hashCode();
hash >>>= 13;
}

Modified:
development/main/metro/meta/api/src/main/net/dpml/meta/info/Version.java
==============================================================================
--- development/main/metro/meta/api/src/main/net/dpml/meta/info/Version.java
(original)
+++ development/main/metro/meta/api/src/main/net/dpml/meta/info/Version.java
Mon Jan 17 18:13:05 2005
@@ -5,9 +5,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,8 +17,11 @@
package net.dpml.meta.info;

import java.io.Serializable;
+
import java.util.StringTokenizer;

+import net.dpml.lang.NullArgumentException;
+
/**
* This class is used to hold version information pertaining to a Component
or interface.
* <p />
@@ -67,14 +70,14 @@
* @return the new Version object
* @throws NumberFormatException if an error occurs
* @throws IllegalArgumentException if an error occurs
- * @throws NullPointerException if the provided string is
<code>null</code>
+ * @throws NullArgumentException if the version argument is
<code>null</code>.
* @since 4.1
*/
public static Version getVersion( final String version )
- throws NumberFormatException, IllegalArgumentException
+ throws NumberFormatException, IllegalArgumentException,
NullArgumentException
{
if( version == null )
- throw new NullPointerException( "version" );
+ throw new NullArgumentException( "version" );

final StringTokenizer tokenizer = new StringTokenizer( version, "."
);
final String[] levels = new String[ tokenizer.countTokens() ];
@@ -169,12 +172,12 @@
return false;

boolean isEqual = ( getMajor() == other.getMajor() );
-
+
if ( isEqual )
{
isEqual = ( getMinor() == other.getMinor() );
}
-
+
if ( isEqual )
{
isEqual = ( getMicro() == other.getMicro() );
@@ -194,7 +197,7 @@
public boolean equals( final Object other )
{
boolean isEqual = false;
-
+
if( other instanceof Version )
{
isEqual = equals( (Version)other );
@@ -202,13 +205,13 @@

return isEqual;
}
-
+
/**
* Add a hashing function to ensure the Version object is
* treated as expected in hashmaps and sets. NOTE: any
* time the equals() is overridden, hashCode() should also
* be overridden.
- *
+ *
* @return the hashCode
*/
public int hashCode()
@@ -218,7 +221,7 @@
hash += getMinor();
hash >>>= 17;
hash += getMicro();
-
+
return hash;
}

@@ -269,7 +272,7 @@
//If of major version but lower minor version then incompatible
return false;
}
- else if( m_minor == other.m_minor
+ else if( m_minor == other.m_minor
&& m_micro < other.m_micro )
{
//If same major version, same minor version but lower micro level
@@ -295,26 +298,50 @@
/**
* Compare two versions together according to the
* {@link Comparable} interface.
- *
+ *
* @return number indicating relative value (-1, 0, 1)
+ * @throws NullArgumentException if the argument is null.
*/
- public int compareTo(Object o) {
+ public int compareTo( Object o )
+ throws NullArgumentException
+ {
if( o == null )
- throw new NullPointerException( "o" );
-
+ {
+ throw new NullArgumentException( "o" );
+ }

Version other = (Version)o;
- int val = 0;

- if ( getMajor() < other.getMajor() ) val = -1;
- if ( 0 == val && getMajor() > other.getMajor() ) val = 1;
+ if( getMajor() < other.getMajor() )
+ {
+ return -1;
+ }
+
+ if( getMajor() > other.getMajor() )
+ {
+ return 1;
+ }

- if ( 0 == val && getMinor() < other.getMinor() ) val = -1;
- if ( 0 == val && getMinor() > other.getMinor() ) val = 1;
+ if( getMinor() < other.getMinor() )
+ {
+ return -1;
+ }

- if ( 0 == val && getMicro() < other.getMicro() ) val = -1;
- if ( 0 == val && getMicro() > other.getMicro() ) val = 1;
+ if( getMinor() > other.getMinor() )
+ {
+ return 1;
+ }
+
+ if( getMicro() < other.getMicro() )
+ {
+ return -1;
+ }
+
+ if( getMicro() > other.getMicro() )
+ {
+ return 1;
+ }

- return val;
+ return 0;
}
}

Modified:
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/EntryDescriptorTestCase.java
==============================================================================
---
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/EntryDescriptorTestCase.java
(original)
+++
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/EntryDescriptorTestCase.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -27,6 +27,9 @@
import java.io.ObjectOutputStream;

import junit.framework.TestCase;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.EntryDescriptor;

/**
@@ -65,9 +68,9 @@
try
{
new EntryDescriptor(null, m_type);
- fail("Did not throw expected NullPointerException");
+ fail("Did not throw expected NullArgumentException");
}
- catch(NullPointerException npe)
+ catch( NullArgumentException npe)
{
// Success!!
}
@@ -75,9 +78,9 @@
try
{
new EntryDescriptor( m_key, null );
- fail( "Did not throw expected NullPointerException" );
+ fail( "Did not throw expected NullArgumentException" );
}
- catch ( NullPointerException npe )
+ catch ( NullArgumentException npe )
{
// Success!!
}

Modified:
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ExtensionDescriptorTestCase.java
==============================================================================
---
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ExtensionDescriptorTestCase.java
(original)
+++
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ExtensionDescriptorTestCase.java
Mon Jan 17 18:13:05 2005
@@ -1,24 +1,26 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.meta.info.test;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.Descriptor;
import net.dpml.meta.info.ExtensionDescriptor;

@@ -60,9 +62,9 @@
try
{
new ExtensionDescriptor(null, getProperties());
- fail("Did not throw the expected NullPointerException");
+ fail( "Did not throw the expected NullPointerException" );
}
- catch(NullPointerException npe)
+ catch( NullArgumentException npe)
{
// Success!!
}

Modified:
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/InfoDescriptorTestCase.java
==============================================================================
---
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/InfoDescriptorTestCase.java
(original)
+++
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/InfoDescriptorTestCase.java
Mon Jan 17 18:13:05 2005
@@ -1,24 +1,26 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.meta.info.test;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.Descriptor;
import net.dpml.meta.info.InfoDescriptor;
import net.dpml.meta.info.Version;
@@ -38,7 +40,7 @@
private final String m_collection = InfoDescriptor.WEAK_KEY;
private final String m_schema = "schema";
private final boolean m_native = true;
-
+
public InfoDescriptorTestCase ( String name )
{
super( name );
@@ -66,43 +68,43 @@
{
try
{
- new InfoDescriptor(
+ new InfoDescriptor(
m_name, null, m_version, m_lifestyle, m_collection, m_schema,
m_native, getProperties() );
fail("Did not throw the proper NullPointerException");
}
- catch (NullPointerException npe)
+ catch( NullArgumentException npe )
{
// Success!
}

try
{
- new InfoDescriptor(
+ new InfoDescriptor(
m_name, "foo/fake/ClassName", m_version, m_lifestyle,
m_collection,
m_schema, m_native, getProperties());
fail("Did not throw the proper IllegalArgumentException");
}
- catch (IllegalArgumentException iae)
+ catch( IllegalArgumentException iae )
{
// Success!
}

try
{
- new InfoDescriptor(
- m_name, m_classname, m_version, InfoDescriptor.SINGLETON,
m_collection,
+ new InfoDescriptor(
+ m_name, m_classname, m_version, InfoDescriptor.SINGLETON,
m_collection,
m_schema, m_native, getProperties() );
- new InfoDescriptor(
- m_name, m_classname, m_version, InfoDescriptor.THREAD,
m_collection,
+ new InfoDescriptor(
+ m_name, m_classname, m_version, InfoDescriptor.THREAD,
m_collection,
m_schema, m_native, getProperties() );
- new InfoDescriptor(
- m_name, m_classname, m_version, InfoDescriptor.TRANSIENT,
m_collection,
+ new InfoDescriptor(
+ m_name, m_classname, m_version, InfoDescriptor.TRANSIENT,
m_collection,
m_schema, m_native, getProperties() );

// All these should pass.

- new InfoDescriptor(
- m_name, m_classname, m_version, "Fake Lifestyle",
m_collection,
+ new InfoDescriptor(
+ m_name, m_classname, m_version, "Fake Lifestyle", m_collection,
m_schema, m_native, getProperties() );

fail( "Did not throw the proper IllegalArgumentException" );

Modified:
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/PermissionDescriptorTestCase.java
==============================================================================
---
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/PermissionDescriptorTestCase.java
(original)
+++
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/PermissionDescriptorTestCase.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -30,6 +30,8 @@

import junit.framework.TestCase;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.PermissionDescriptor;

/**
@@ -56,7 +58,7 @@
PermissionDescriptor d = new PermissionDescriptor( null, null,
null );
fail( "did not throw an npe:" + d );
}
- catch( NullPointerException npe )
+ catch( NullArgumentException npe )
{
// ok
}

Modified:
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ReferenceDescriptorTestCase.java
==============================================================================
---
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ReferenceDescriptorTestCase.java
(original)
+++
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ReferenceDescriptorTestCase.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -27,6 +27,9 @@
import java.io.ObjectOutputStream;

import junit.framework.TestCase;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.Version;

@@ -54,7 +57,7 @@
new ReferenceDescriptor(null, m_version);
fail("Did not throw the expected NullPointerException");
}
- catch (NullPointerException npe)
+ catch( NullArgumentException npe )
{
// Success!
}
@@ -64,7 +67,7 @@
new ReferenceDescriptor( null );
fail( "Did not throw the expected NullPointerException" );
}
- catch ( NullPointerException npe )
+ catch( NullArgumentException npe )
{
// Success!
}

Modified:
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ServiceDescriptorTestCase.java
==============================================================================
---
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ServiceDescriptorTestCase.java
(original)
+++
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ServiceDescriptorTestCase.java
Mon Jan 17 18:13:05 2005
@@ -1,24 +1,26 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.meta.info.test;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.Descriptor;
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.ServiceDescriptor;
@@ -57,9 +59,9 @@
new ServiceDescriptor( null, getProperties() );
fail( "Did not throw the expected NullPointerException" );
}
- catch ( NullPointerException npe )
+ catch( NullArgumentException npe )
{
- // Sucess!
+ // Success!
}
}


Modified:
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ServiceTestCase.java
==============================================================================
---
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ServiceTestCase.java
(original)
+++
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/ServiceTestCase.java
Mon Jan 17 18:13:05 2005
@@ -1,24 +1,26 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.meta.info.test;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.Descriptor;
import net.dpml.meta.info.Service;
import net.dpml.meta.info.ReferenceDescriptor;
@@ -61,9 +63,9 @@
new Service(null);
fail("Did not throw the expected NullPointerException");
}
- catch(NullPointerException npe)
+ catch( NullArgumentException npe )
{
- // Sucess!
+ // Success!
}
}


Modified:
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/StageDescriptorTestCase.java
==============================================================================
---
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/StageDescriptorTestCase.java
(original)
+++
development/main/metro/meta/api/src/test/net/dpml/meta/info/test/StageDescriptorTestCase.java
Mon Jan 17 18:13:05 2005
@@ -1,24 +1,26 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.meta.info.test;

+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.Descriptor;
import net.dpml.meta.info.StageDescriptor;

@@ -56,9 +58,9 @@
new StageDescriptor( null, getProperties() );
fail( "Did not throw the expected NullPointerException" );
}
- catch ( NullPointerException npe )
+ catch( NullArgumentException npe )
{
- // Sucess!
+ // Success!
}
}


Modified:
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/TypeBuilder.java
==============================================================================
---
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/TypeBuilder.java
(original)
+++
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/TypeBuilder.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,23 +21,31 @@

import java.io.InputStream;
import java.io.IOException;
+
import java.util.Properties;

import net.dpml.configuration.Configuration;
-import net.dpml.configuration.impl.DefaultConfiguration;
import net.dpml.configuration.ConfigurationException;
-import net.dpml.parameters.Parameters;
-import net.dpml.parameters.ParameterException;
-import net.dpml.parameters.impl.DefaultParameters;
+
+import net.dpml.configuration.impl.DefaultConfiguration;
+
+import net.dpml.i18n.ResourceManager;
+import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;

import net.dpml.meta.info.Type;
+
import net.dpml.meta.info.builder.TypeCreator;
import net.dpml.meta.info.builder.TypeFactory;
import net.dpml.meta.info.builder.BuildException;
+
import net.dpml.meta.info.impl.ConfigurationBuilder;

-import net.dpml.i18n.ResourceManager;
-import net.dpml.i18n.Resources;
+import net.dpml.parameters.Parameters;
+import net.dpml.parameters.ParameterException;
+
+import net.dpml.parameters.impl.DefaultParameters;

import org.xml.sax.InputSource;

@@ -222,11 +230,11 @@
}

private Configuration resolveConfiguration( ClassLoader classloader,
Configuration config )
- throws Exception
+ throws Exception, NullArgumentException
{
if( config == null )
{
- throw new NullPointerException("config");
+ throw new NullArgumentException("config");
}
String src = config.getAttribute( "src", null );
if( src == null )

Modified:
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLLegacyCreator.java
==============================================================================
---
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLLegacyCreator.java
(original)
+++
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLLegacyCreator.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -20,13 +20,19 @@
package net.dpml.meta.info.builder.impl;

import java.io.InputStream;
+
import java.util.ArrayList;
import java.util.Properties;

import net.dpml.configuration.Configuration;
+
import net.dpml.configuration.impl.ConfigurationUtil;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.Version;
import net.dpml.meta.info.InfoDescriptor;
import net.dpml.meta.info.ContextDescriptor;
@@ -66,14 +72,15 @@
* @param inputStream the InputStream to load Type from
* @return the created Type
* @throws Exception if an error occurs
+ * @throws NullArgumentException if input argument is null.
*/
public Type createType( String implementationKey,
InputStream inputStream )
- throws Exception
+ throws Exception, NullArgumentException
{
if( inputStream == null )
{
- throw new NullPointerException( "input" );
+ throw new NullArgumentException( "input" );
}
final InputSource input = new InputSource( inputStream );
final String classname = implementationKey;
@@ -127,27 +134,27 @@

configuration = info.getChild( "loggers" );
final CategoryDescriptor[] loggers = new CategoryDescriptor[0];
- final ContextDescriptor context =
+ final ContextDescriptor context =
buildPhoenixContext();

configuration = info.getChild( "services" );
- final ServiceDescriptor[] services =
+ final ServiceDescriptor[] services =
buildBlockServices( configuration );

configuration = info.getChild( "dependencies" );
- final DependencyDescriptor[] dependencies =
+ final DependencyDescriptor[] dependencies =
buildBlockDependencies( configuration );

configuration = info.getChild( "stages" );
- final StageDescriptor[] phases =
+ final StageDescriptor[] phases =
buildStages( configuration );

configuration = info.getChild( "extensions" );
- final ExtensionDescriptor[] extensions =
+ final ExtensionDescriptor[] extensions =
buildExtensions( configuration );

return new Type(
- descriptor, loggers, context, services, dependencies,
+ descriptor, loggers, context, services, dependencies,
phases, extensions );
}

@@ -164,36 +171,36 @@
final String classname, final Configuration info )
throws BuildException
{
- final String name =
+ final String name =
info.getChild( "name" ).getValue( null );
- final String schema =
+ final String schema =
info.getChild( "schema-type" ).getValue( null );
- final Version version =
+ final Version version =
buildVersion( info.getChild( "version" ).getValue( "1.0" ) );
final Properties attributes =
buildAttributes( info.getChild( "attributes" ) );
final String lifestyle = InfoDescriptor.SINGLETON;
- return new InfoDescriptor(
+ return new InfoDescriptor(
name, classname, version, lifestyle, null, schema, false,
attributes );
}

private ContextDescriptor buildPhoenixContext()
{
- EntryDescriptor name =
- new EntryDescriptor(
- "urn:avalon:name",
+ EntryDescriptor name =
+ new EntryDescriptor(
+ "urn:avalon:name",
"java.lang.String", false, false, "block.name" );
- EntryDescriptor partition =
- new EntryDescriptor(
- "urn:avalon:partition",
+ EntryDescriptor partition =
+ new EntryDescriptor(
+ "urn:avalon:partition",
"java.lang.String", false, false, "app.name" );
- EntryDescriptor home =
- new EntryDescriptor(
- "urn:avalon:home",
+ EntryDescriptor home =
+ new EntryDescriptor(
+ "urn:avalon:home",
"java.io.File", false, false, "app.home" );

- return new ContextDescriptor(
- "org.apache.avalon.framework.context.Context",
+ return new ContextDescriptor(
+ "org.apache.avalon.framework.context.Context",
new EntryDescriptor[]{ name, partition, home } );
}

@@ -212,11 +219,11 @@
final ArrayList dependencies = new ArrayList();
for( int i = 0; i < deps.length; i++ )
{
- final DependencyDescriptor dependency =
+ final DependencyDescriptor dependency =
buildBlockDependency( deps[ i ] );
dependencies.add( dependency );
}
- return (DependencyDescriptor[])dependencies.toArray(
+ return (DependencyDescriptor[])dependencies.toArray(
new DependencyDescriptor[ 0 ] );
}


Modified:
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLServiceCreator.java
==============================================================================
---
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLServiceCreator.java
(original)
+++
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLServiceCreator.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -20,22 +20,29 @@
package net.dpml.meta.info.builder.impl;

import java.io.InputStream;
+
import java.util.Properties;
import java.util.ArrayList;

import net.dpml.configuration.Configuration;
import net.dpml.configuration.ConfigurationException;
+
import net.dpml.configuration.impl.ConfigurationUtil;
-import net.dpml.meta.info.impl.ConfigurationBuilder;
+
+import net.dpml.i18n.ResourceManager;
+import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.Version;
import net.dpml.meta.info.Service;
import net.dpml.meta.info.EntryDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
+
import net.dpml.meta.info.builder.BuildException;
import net.dpml.meta.info.builder.ServiceCreator;

-import net.dpml.i18n.ResourceManager;
-import net.dpml.i18n.Resources;
+import net.dpml.meta.info.impl.ConfigurationBuilder;

import org.xml.sax.InputSource;

@@ -191,7 +198,7 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Unable to build entry descriptor."
+ ConfigurationUtil.list( config );
throw new BuildException( error, e );
@@ -204,7 +211,7 @@
* @param version the version string
* @return the created Version object
*/
- protected Version buildVersion( final String version )
+ protected Version buildVersion( final String version )
throws BuildException
{
try
@@ -213,7 +220,7 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
REZ.getString( "builder.bad-version", version );
throw new BuildException( error, e );
}

Modified:
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java
==============================================================================
---
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java
(original)
+++
development/main/metro/meta/impl/src/main/net/dpml/meta/info/builder/impl/XMLTypeCreator.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -20,14 +20,20 @@
package net.dpml.meta.info.builder.impl;

import java.io.InputStream;
+
import java.util.ArrayList;
import java.util.Properties;

-import net.dpml.i18n.ResourceManager;
-import net.dpml.i18n.Resources;
-import net.dpml.configuration.impl.ConfigurationUtil;
import net.dpml.configuration.Configuration;
import net.dpml.configuration.ConfigurationException;
+
+import net.dpml.configuration.impl.ConfigurationUtil;
+
+import net.dpml.i18n.ResourceManager;
+import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.meta.info.Version;
import net.dpml.meta.info.InfoDescriptor;
import net.dpml.meta.info.ContextDescriptor;
@@ -41,9 +47,12 @@
import net.dpml.meta.info.SecurityDescriptor;
import net.dpml.meta.info.PermissionDescriptor;
import net.dpml.meta.info.Type;
-import net.dpml.meta.info.impl.ConfigurationBuilder;
+
import net.dpml.meta.info.builder.BuildException;
import net.dpml.meta.info.builder.TypeFactory;
+
+import net.dpml.meta.info.impl.ConfigurationBuilder;
+
import net.dpml.parameters.Parameters;

import org.xml.sax.InputSource;
@@ -69,15 +78,16 @@
* @param classname The classname of Component
* @param inputStream the InputStream to load Type from
* @return the created Type
+ * @throws NullArgumentException if the inputStream argument is null.
* @throws Exception if an error occurs
*/
public Type createType( String classname,
InputStream inputStream )
- throws Exception
+ throws Exception, NullArgumentException
{
if( inputStream == null )
{
- throw new NullPointerException( "input" );
+ throw new NullArgumentException( "input" );
}

final InputSource input = new InputSource( inputStream );
@@ -113,13 +123,13 @@
* @return the created Type
* @throws BuildException if an error occurs
*/
- public Type createType(
+ public Type createType(
final String classname, final Configuration info, final
Configuration defaults,
Parameters params )
throws BuildException
{
final String topLevelName = info.getName();
-
+
if( topLevelName.equals( "blockinfo" ) )
{
return new XMLLegacyCreator().createType( classname, info );
@@ -160,7 +170,7 @@
final ServiceDescriptor[] services = buildServices( configuration );

configuration = info.getChild( "dependencies" );
- final DependencyDescriptor[] dependencies =
+ final DependencyDescriptor[] dependencies =
buildDependencies( configuration );

configuration = info.getChild( "stages" );
@@ -170,7 +180,7 @@
final ExtensionDescriptor[] extensions = buildExtensions(
configuration );

return new Type(
- descriptor, security, loggers, context, services, dependencies,
phases,
+ descriptor, security, loggers, context, services, dependencies,
phases,
extensions, defaults, params );
}

@@ -180,7 +190,7 @@
* @return an array of phase descriptors
* @exception BuildException if a build error occurs
*/
- protected StageDescriptor[] buildStages( Configuration config )
+ protected StageDescriptor[] buildStages( Configuration config )
throws BuildException
{
ArrayList list = new ArrayList();
@@ -199,7 +209,7 @@
* @return an array of phase descriptors
* @exception BuildException if a build error occurs
*/
- protected StageDescriptor buildPhase( Configuration config )
+ protected StageDescriptor buildPhase( Configuration config )
throws BuildException
{

@@ -223,7 +233,7 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Unable to construct a stage descriptor from source fragment:"
+ ConfigurationUtil.list( config );
throw new BuildException( error, e );
@@ -259,8 +269,8 @@
final String type = service.getAttribute("type", classname );
if( type == null )
{
- final String error =
- "Missing 'type' attribute in configuration: "
+ final String error =
+ "Missing 'type' attribute in configuration: "
+ ConfigurationUtil.list( service );
throw new BuildException( error );
}
@@ -352,9 +362,9 @@
{
role = dependency.getAttribute( "key", null );
}
- ReferenceDescriptor reference =
+ ReferenceDescriptor reference =
buildReferenceDescriptor( dependency );
-
+
final boolean optional =
dependency.getAttributeAsBoolean( "optional", false );

@@ -451,22 +461,22 @@
{
final boolean isNative = info.getAttributeAsBoolean( "native", false
);

- final String name =
+ final String name =
info.getChild( "name" ).getValue( null );
- final Version version =
+ final Version version =
buildVersion( info.getChild( "version" ).getValue( "1.0" ) );
- final String schema =
+ final String schema =
info.getChild( "schema" ).getValue( null );
final Properties attributes =
buildAttributes( info.getChild( "attributes" ) );
- final String lifestyle =
+ final String lifestyle =
buildLifestyle( info, attributes );
- final String collectionLegacy =
+ final String collectionLegacy =
info.getChild( "lifestyle" ).getAttribute( "collection", null );
- final String collection =
+ final String collection =
info.getChild( "collection" ).getValue( collectionLegacy );

- return new InfoDescriptor(
+ return new InfoDescriptor(
name, classname, version, lifestyle, collection, schema, isNative,
attributes );
}

@@ -492,7 +502,7 @@
}
catch( ConfigurationException e )
{
- final String error =
+ final String error =
"Cannot build secrity descriptor.";
throw new BuildException( error, e );
}
@@ -504,13 +514,13 @@
ArrayList list = new ArrayList();
Configuration[] children = config.getChildren( "permission" );
for( int i = 0; i < children.length; i++ )
- {
+ {
list.add( buildPermission( children[i] ) );
}
return (PermissionDescriptor[])list.toArray( new
PermissionDescriptor[ 0 ] );
}

- private PermissionDescriptor buildPermission( final Configuration config
)
+ private PermissionDescriptor buildPermission( final Configuration config
)
throws ConfigurationException
{
final String classname = config.getAttribute( "class" );
@@ -528,8 +538,8 @@
}

/**
- * Handle the resolution of the component lifestyle. Normally this is
- * resolved by retrieving the &lt;lifestyle&gt; element value, however,
for
+ * Handle the resolution of the component lifestyle. Normally this is
+ * resolved by retrieving the &lt;lifestyle&gt; element value, however,
for
* backward compatability - if the lifecycle element is not present, we
will
* attempt to resolve the lifestyle using the attribute value relative to
the
* key urn:avalon:lifestyle.
@@ -557,7 +567,7 @@
* @return an array of phase descriptors
* @exception BuildException if a build error occurs
*/
- protected ExtensionDescriptor[] buildExtensions( Configuration config )
+ protected ExtensionDescriptor[] buildExtensions( Configuration config )
throws BuildException
{
ArrayList list = new ArrayList();
@@ -575,7 +585,7 @@
* @return the extension descriptor
* @exception BuildException if a build error occurs
*/
- protected ExtensionDescriptor buildExtension( Configuration config )
+ protected ExtensionDescriptor buildExtension( Configuration config )
throws BuildException
{
if( config.getAttribute( "type", null ) != null ) // legacy
@@ -596,7 +606,7 @@
}
catch( ConfigurationException e )
{
- final String error =
+ final String error =
"Missing extensions identifier 'id' attribute."
+ ConfigurationUtil.list( config );
throw new BuildException( error, e );
@@ -613,7 +623,7 @@
* @param path the classname
* @return the reference descriptor
*/
- public ReferenceDescriptor createReference( String path )
+ public ReferenceDescriptor createReference( String path )
throws BuildException
{
final String type;

Modified:
development/main/metro/meta/impl/src/main/net/dpml/meta/info/impl/ConfigurationBuilder.java
==============================================================================
---
development/main/metro/meta/impl/src/main/net/dpml/meta/info/impl/ConfigurationBuilder.java
(original)
+++
development/main/metro/meta/impl/src/main/net/dpml/meta/info/impl/ConfigurationBuilder.java
Mon Jan 17 18:13:05 2005
@@ -1,18 +1,18 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -20,6 +20,7 @@
package net.dpml.meta.info.impl;

import java.io.IOException;
+
import java.net.MalformedURLException;

import javax.xml.parsers.ParserConfigurationException;
@@ -27,8 +28,11 @@
import javax.xml.parsers.SAXParserFactory;

import net.dpml.configuration.Configuration;
+
import net.dpml.configuration.impl.SAXConfigurationHandler;

+import net.dpml.lang.NullArgumentException;
+
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
@@ -114,7 +118,7 @@
}
catch( MalformedURLException mue )
{
- final String error =
+ final String error =
"Invalid input source uri: " + uri;
throw new IOException( error );
}
@@ -127,14 +131,15 @@
* @exception SAXException is a parser exception is encountered
* @exception ParserConfigurationException if a parser configuration
failure occurs
* @exception IOException if an IO exception occurs while attempting to
read the
+ * @exception NullArgumentException if the input argument is null.
* resource associated with the input source
*/
public static Configuration build( final InputSource input )
- throws SAXException, ParserConfigurationException, IOException
+ throws SAXException, ParserConfigurationException, IOException,
NullArgumentException
{
if( input == null )
{
- throw new NullPointerException( "input" );
+ throw new NullArgumentException( "input" );
}

final XMLReader reader = createXMLReader();

Modified:
development/main/metro/parameters/impl/src/main/net/dpml/parameters/impl/DefaultParameters.java
==============================================================================
---
development/main/metro/parameters/impl/src/main/net/dpml/parameters/impl/DefaultParameters.java
(original)
+++
development/main/metro/parameters/impl/src/main/net/dpml/parameters/impl/DefaultParameters.java
Mon Jan 17 18:13:05 2005
@@ -5,9 +5,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,17 +17,21 @@
package net.dpml.parameters.impl;

import java.io.Serializable;
+
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;

-import net.dpml.parameters.Parameters;
-import net.dpml.parameters.ParameterException;
import net.dpml.configuration.Configuration;
import net.dpml.configuration.ConfigurationException;

+import net.dpml.lang.NullArgumentException;
+
+import net.dpml.parameters.Parameters;
+import net.dpml.parameters.ParameterException;
+
/**
* The <code>Parameters</code> class represents a set of key-value
* pairs.
@@ -558,7 +562,7 @@

/** Converts the Parameters instance to a java.util.Properties instance.
* <p>
- * NOTE: Changes made to the returned Properties instance will not
+ * NOTE: Changes made to the returned Properties instance will not
* affect the Parameters instance.
* </p>
* <p>
@@ -574,7 +578,7 @@
p.putAll( m_parameters );
return p;
}
-
+
/**
* Make this Parameters read-only so that it will throw a
* <code>IllegalStateException</code> if someone tries to
@@ -601,12 +605,12 @@
*/
public boolean equals( Object other )
{
- if( null == other )
+ if( null == other )
return false;
-
+
if( !( other instanceof Parameters ) )
return false;
-
+
Parameters p = (Parameters) other;

String[] names = p.getNames();
@@ -633,8 +637,8 @@
}

/**
- * Returns a hashed value of the Parameters instance.
- *
+ * Returns a hashed value of the Parameters instance.
+ *
* This method returns a semi-unique value for all instances, yet an
* identical value for instances where equals() returns true.
*
@@ -648,7 +652,7 @@
hash >>>= ( m_readOnly ) ? 7 : 13;
return hash;
}
-
+
public String toString()
{
return "Parameters[" + ( m_readOnly ? "r/o]" : "r/w]:" ) +
m_parameters;
@@ -693,15 +697,16 @@
* @param elementName the element name for the parameters
* @return This <code>Parameters</code> instance.
* @throws ConfigurationException if an error occurs
+ * @throws NullArgumentException if the configuration argument is null.
* @since 4.1
*/
public static Parameters fromConfiguration( final Configuration
configuration,
final String elementName )
- throws ConfigurationException
+ throws ConfigurationException, NullArgumentException
{
if( null == configuration )
{
- throw new NullPointerException( "configuration" );
+ throw new NullArgumentException( "configuration" );
}

final Configuration[] parameters = configuration.getChildren(
elementName );

Modified:
development/main/metro/system/api/src/main/net/dpml/system/SystemException.java
==============================================================================
---
development/main/metro/system/api/src/main/net/dpml/system/SystemException.java
(original)
+++
development/main/metro/system/api/src/main/net/dpml/system/SystemException.java
Mon Jan 17 18:13:05 2005
@@ -1,23 +1,25 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.dpml.system;

+import net.dpml.lang.NullArgumentException;
+

/**
* Exception to indicate that there was a system related error.
@@ -56,11 +58,12 @@
* @param cause the root cause of the exception
*/
public SystemException( final String message, final Throwable cause )
+ throws NullArgumentException
{
super( message );
- if( null == message )
+ if( null == message )
{
- throw new NullPointerException( "message" );
+ throw new NullArgumentException( "message" );
}
m_cause = cause;
}

Modified:
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContext.java
==============================================================================
---
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContext.java
(original)
+++
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContext.java
Mon Jan 17 18:13:05 2005
@@ -19,11 +19,17 @@
package net.dpml.system.impl;

import java.io.File;
+
import java.util.Properties;

import net.dpml.context.impl.DefaultContext;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.logging.provider.LoggingManager;
+
import net.dpml.system.SystemContext;

import net.dpml.transit.repository.Repository;
@@ -64,6 +70,7 @@
final Repository repository, final LoggingManager logging,
final Logger logger, final File home, final File work, final File
anchor, final File temp,
final boolean info, final boolean debug, final boolean isolate,
String[] remainder, Properties properties )
+ throws NullArgumentException
{
super();
assertNotNull( "repository", repository );
@@ -303,10 +310,11 @@
}

private void assertNotNull( String key, Object instance )
+ throws NullArgumentException
{
if( null == instance )
{
- throw new NullPointerException( key );
+ throw new NullArgumentException( key );
}
}
}

Modified:
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
==============================================================================
---
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
(original)
+++
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
Mon Jan 17 18:13:05 2005
@@ -22,40 +22,53 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.FileInputStream;
+
import java.net.URI;
import java.net.URL;
+
import java.util.Map;
import java.util.Properties;

import net.dpml.cli.ArgumentHandler;
+
import net.dpml.defaults.Defaults;
import net.dpml.defaults.DefaultsBuilder;
+
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.logging.Logger;
+
import net.dpml.logging.provider.LoggingCriteria;
import net.dpml.logging.provider.LoggingFactory;
import net.dpml.logging.provider.LoggingManager;
+
import net.dpml.system.Factory;
import net.dpml.system.SystemContext;
import net.dpml.system.SystemContextFactory;
import net.dpml.system.SystemCriteria;
import net.dpml.system.SystemException;
import net.dpml.system.SystemRuntimeException;
+
import net.dpml.system.monitors.CacheMonitorLoggerAdapter;
import net.dpml.system.monitors.RepositoryMonitorLoggerAdapter;
import net.dpml.system.monitors.NetworkMonitorLoggerAdapter;

import net.dpml.transit.Transit;
import net.dpml.transit.TransitException;
+
import net.dpml.transit.artifact.Artifact;
-import net.dpml.transit.repository.Repository;
-import net.dpml.transit.repository.StandardLoader;
+
import net.dpml.transit.monitors.Monitor;
import net.dpml.transit.monitors.CacheMonitor;
import net.dpml.transit.monitors.NetworkMonitor;
import net.dpml.transit.monitors.RepositoryMonitor;

+import net.dpml.transit.repository.Repository;
+import net.dpml.transit.repository.StandardLoader;
+
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
@@ -317,7 +330,7 @@

Logger repository = logger.getChildLogger( "repository" );

- transit.getRepositoryMonitorRouter().addMonitor(
+ transit.getRepositoryMonitorRouter().addMonitor(
new RepositoryMonitorLoggerAdapter( repository ) );

Monitor repositoryMonitor = (Monitor) m_params.get(
"urn:transit.repository.monitor" );
@@ -327,7 +340,7 @@
}

Logger cache = logger.getChildLogger( "cache" );
- transit.getCacheMonitorRouter().addMonitor(
+ transit.getCacheMonitorRouter().addMonitor(
new CacheMonitorLoggerAdapter( cache ) );
Monitor cacheMonitor = (Monitor) m_params.get(
"urn:transit.cache.monitor" );
if( null != cacheMonitor )
@@ -336,7 +349,7 @@
}

Logger network = logger.getChildLogger( "network" );
- transit.getNetworkMonitorRouter().addMonitor(
+ transit.getNetworkMonitorRouter().addMonitor(
new NetworkMonitorLoggerAdapter( cache ) );
Monitor netMonitor = (Monitor) m_params.get(
"urn:transit.network.monitor" );
if( null != netMonitor )
@@ -346,7 +359,7 @@
}
catch( TransitException e )
{
- final String error =
+ final String error =
"Internal error while attempt to setup transit monitors.";
throw new SystemException( error, e );
}
@@ -471,11 +484,12 @@
}
}

- private SystemCriteria getSystemCriteria( Map map ) throws
SystemException
+ private SystemCriteria getSystemCriteria( Map map )
+ throws SystemException, NullArgumentException
{
if( null == map )
{
- throw new NullPointerException( "map" );
+ throw new NullArgumentException( "map" );
}
if( map instanceof SystemCriteria )
{
@@ -505,10 +519,10 @@
}

private void assertNotNull( String key, Object object )
- throws NullPointerException
+ throws NullArgumentException
{
if( null == object )
- throw new NullPointerException( key );
+ throw new NullArgumentException( key );
}

private Options buildCommandLineOptions()

Modified:
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemCriteria.java
==============================================================================
---
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemCriteria.java
(original)
+++
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemCriteria.java
Mon Jan 17 18:13:05 2005
@@ -1,17 +1,17 @@
-/*
+/*
* Copyright 2004 Stephen J. McConnell.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -20,20 +20,25 @@

import java.io.File;
import java.io.IOException;
+
import java.net.URI;
import java.net.URL;
+
import java.util.Properties;

import net.dpml.criteria.Criteria;
import net.dpml.criteria.CriteriaRuntimeException;
import net.dpml.criteria.Parameter;
+
+import net.dpml.lang.NullArgumentException;
+
import net.dpml.system.SystemContext;
import net.dpml.system.SystemCriteria;

import net.dpml.transit.Transit;

/**
- * DefaultLoggingCriteria is a class holding the values supplied by a user
+ * DefaultLoggingCriteria is a class holding the values supplied by a user
* for application to a LoggingManager factory.
*
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
@@ -45,14 +50,14 @@
// static
//--------------------------------------------------------------

- public static final String[] KEYS =
+ public static final String[] KEYS =
new String[]{
SystemContext.LOGGING_IMPLEMENTATION_KEY,
SystemContext.LOGGING_CONFIGURATION_KEY,
SystemContext.HOME_KEY,
SystemContext.TEMP_KEY,
SystemContext.DIR_KEY,
- SystemContext.ANCHOR_KEY,
+ SystemContext.ANCHOR_KEY,
SystemContext.ISOLATE_KEY
};

@@ -63,41 +68,41 @@
private static Parameter[] buildParameters( Properties properties, File
home )
{
return new Parameter[] {
- new Parameter(
+ new Parameter(
SystemContext.LOGGING_IMPLEMENTATION_KEY,
URI.class,
- getDefaultURI(
- properties.getProperty(
SystemContext.LOGGING_IMPLEMENTATION_KEY ) )
+ getDefaultURI(
+ properties.getProperty(
SystemContext.LOGGING_IMPLEMENTATION_KEY ) )
),
- new Parameter(
+ new Parameter(
SystemContext.LOGGING_CONFIGURATION_KEY,
String.class,
- properties.getProperty(
SystemContext.LOGGING_CONFIGURATION_KEY )
+ properties.getProperty(
SystemContext.LOGGING_CONFIGURATION_KEY )
),
- new Parameter(
- SystemContext.TEMP_KEY,
+ new Parameter(
+ SystemContext.TEMP_KEY,
File.class,
- getDefaultFile(
- properties.getProperty( SystemContext.TEMP_KEY ),
- new File( System.getProperty( "java.io.tmpdir" ) ) )
+ getDefaultFile(
+ properties.getProperty( SystemContext.TEMP_KEY ),
+ new File( System.getProperty( "java.io.tmpdir" ) ) )
),
- new Parameter(
- SystemContext.DIR_KEY,
+ new Parameter(
+ SystemContext.DIR_KEY,
File.class,
- getDefaultFile(
- properties.getProperty( SystemContext.DIR_KEY ),
- new File( System.getProperty( "user.dir" ) ) )
+ getDefaultFile(
+ properties.getProperty( SystemContext.DIR_KEY ),
+ new File( System.getProperty( "user.dir" ) ) )
),
- new Parameter(
- SystemContext.ANCHOR_KEY,
+ new Parameter(
+ SystemContext.ANCHOR_KEY,
File.class,
- getDefaultFile(
- properties.getProperty( SystemContext.ANCHOR_KEY ), null )
+ getDefaultFile(
+ properties.getProperty( SystemContext.ANCHOR_KEY ), null )
),
- new Parameter(
- SystemContext.ISOLATE_KEY,
+ new Parameter(
+ SystemContext.ISOLATE_KEY,
Boolean.class,
- getDefaultBoolean(
+ getDefaultBoolean(
properties.getProperty( SystemContext.ISOLATE_KEY ), true )
)
};
@@ -115,7 +120,7 @@
}
}

- private static URI getDefaultURI( String spec )
+ private static URI getDefaultURI( String spec )
{
if( null == spec )
{
@@ -129,7 +134,7 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Bad default artifact uri: [" + spec + "] due to "
+ e.toString();
throw new IllegalArgumentException( error );
@@ -179,10 +184,11 @@
* @param dir the working directory
*/
public void setWorkingDirectory( File dir )
+ throws NullArgumentException
{
if( null == dir )
{
- throw new NullPointerException( SystemContext.DIR_KEY );
+ throw new NullArgumentException( SystemContext.DIR_KEY );
}
put( SystemContext.DIR_KEY, dir );
}
@@ -192,10 +198,11 @@
* @param dir the temp directory
*/
public void setTempDirectory( File dir )
+ throws NullArgumentException
{
if( null == dir )
{
- throw new NullPointerException( SystemContext.TEMP_KEY );
+ throw new NullArgumentException( SystemContext.TEMP_KEY );
}
put( SystemContext.TEMP_KEY, dir );
}
@@ -205,10 +212,11 @@
* @param dir the anchor directory
*/
public void setAnchorDirectory( File dir )
+ throws NullArgumentException
{
if( null == dir )
{
- throw new NullPointerException( SystemContext.ANCHOR_KEY );
+ throw new NullArgumentException( SystemContext.ANCHOR_KEY );
}
put( SystemContext.ANCHOR_KEY, dir );
}
@@ -218,10 +226,11 @@
* @param uri the configuration URI
*/
public void setLoggingConfiguration( String uri )
+ throws NullArgumentException
{
if( null == uri )
{
- throw new NullPointerException(
SystemContext.LOGGING_CONFIGURATION_KEY );
+ throw new NullArgumentException(
SystemContext.LOGGING_CONFIGURATION_KEY );
}
put( SystemContext.LOGGING_CONFIGURATION_KEY, uri );
}
@@ -231,10 +240,11 @@
* @param uri the URI of the logging system artifact spec
*/
public void setLoggingURI( URI uri )
+ throws NullArgumentException
{
if( null == uri )
{
- throw new NullPointerException(
SystemContext.LOGGING_IMPLEMENTATION_KEY );
+ throw new NullArgumentException(
SystemContext.LOGGING_IMPLEMENTATION_KEY );
}
put( SystemContext.LOGGING_IMPLEMENTATION_KEY, uri );
}
@@ -335,9 +345,9 @@
}
catch( IOException e )
{
- final String error =
+ final String error =
"Error while attempting to convert the file ["
- + file.toString()
+ + file.toString()
+ "] to a url.";
throw new CriteriaRuntimeException( error, e );
}
@@ -351,9 +361,9 @@
}
catch( Throwable e )
{
- final String error =
+ final String error =
"Error while attempting to convert the path ["
- + path
+ + path
+ "] to a uri.";
throw new CriteriaRuntimeException( error, e );
}
@@ -394,11 +404,12 @@
//----------------------------------------------------------------

private boolean getBooleanValue( String key )
+ throws NullArgumentException
{
Object object = get( key );
if( null == object )
{
- throw new NullPointerException( key );
+ throw new NullArgumentException( key );
}
if( object instanceof Boolean )
{
@@ -407,10 +418,10 @@
}
else
{
- final String error =
- "Criteria parameter for key [" + key
+ final String error =
+ "Criteria parameter for key [" + key
+ "] returned an unexpected type ["
- + object.getClass().getName()
+ + object.getClass().getName()
+ "] (expecting Boolean).";
throw new IllegalStateException( error );
}
@@ -434,64 +445,12 @@
}
else
{
- final String error =
- "Criteria parameter for key [" + key
- + "] returned an unexpected type ["
- + object.getClass().getName()
- + "] (expecting java.io.File).";
- throw new IllegalStateException( error );
- }
- }
-/* Never used. TODO: Remove
- private URL getURLValue( String key, boolean flag )
- {
- Object object = get( key );
- if( null == object )
- {
- if( flag )
- {
- return null;
- }
- else
- {
- throw new NullPointerException( key );
- }
- }
- if( object instanceof URL )
- {
- return (URL) object;
- }
- else
- {
- final String error =
- "Criteria parameter for key [" + key
- + "] returned an unexpected type ["
- + object.getClass().getName()
- + "] (expecting java.net.URL).";
- throw new IllegalStateException( error );
- }
- }
-
- private Artifact getArtifactValue( String key )
- {
- Object object = get( key );
- if( null == object )
- {
- throw new NullPointerException( key );
- }
- if( object instanceof Artifact )
- {
- return (Artifact) object;
- }
- else
- {
final String error =
"Criteria parameter for key [" + key
+ "] returned an unexpected type ["
+ object.getClass().getName()
- + "] (expecting net.dpml.transit.artifact.Artifact).";
+ + "] (expecting java.io.File).";
throw new IllegalStateException( error );
}
}
-*/
}

Modified:
development/main/metro/testing/testa/src/main/net/dpml/test/testa/DefaultFacade.java
==============================================================================
---
development/main/metro/testing/testa/src/main/net/dpml/test/testa/DefaultFacade.java
(original)
+++
development/main/metro/testing/testa/src/main/net/dpml/test/testa/DefaultFacade.java
Mon Jan 17 18:13:05 2005
@@ -1,16 +1,16 @@
-/*
+/*
* Copyright 2004 Apache Software Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+ * You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
- *
+ *
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@@ -21,6 +21,8 @@

import net.dpml.context.ContextException;

+import net.dpml.lang.NullArgumentException;
+
public class DefaultFacade implements Facade
{
private Map m_map;
@@ -34,11 +36,12 @@
// Context
//------------------------------------------------------------

- public Object get( final Object key ) throws ContextException
+ public Object get( final Object key )
+ throws ContextException, NullArgumentException
{
if( null == key )
{
- throw new NullPointerException( "key" );
+ throw new NullArgumentException( "key" );
}
Object object = m_map.get( key );
if( null == object )
@@ -54,7 +57,7 @@
//------------------------------------------------------------
// Extra
//------------------------------------------------------------
-
+
public String getName()
{
try

Modified:
development/main/metro/util/defaults/src/main/net/dpml/defaults/DefaultsBuilder.java
==============================================================================
---
development/main/metro/util/defaults/src/main/net/dpml/defaults/DefaultsBuilder.java
(original)
+++
development/main/metro/util/defaults/src/main/net/dpml/defaults/DefaultsBuilder.java
Mon Jan 17 18:13:05 2005
@@ -23,8 +23,10 @@
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;
+
import java.util.Properties;

+import net.dpml.lang.NullArgumentException;

/**
* A utility class that provides support for the establishment
@@ -142,11 +144,12 @@
* @param file the properties file
* @return the properties object
*/
- public static Properties getProperties( File file ) throws IOException
+ public static Properties getProperties( File file )
+ throws IOException, NullArgumentException
{
if( null == file )
{
- throw new NullPointerException( "file" );
+ throw new NullArgumentException( "file" );
}

Properties properties = new Properties();



  • svn commit: r1518 - in development/main: magic/bootstrap/src/main/net/dpml/magic/bootstrap magic/core/src/main/net/dpml/magic magic/core/src/main/net/dpml/magic/builder magic/core/src/main/net/dpml/magic/model magic/core/src/main/net/dpml/magic/project magic/core/src/main/net/dpml/magic/tasks metro/activation/impl/src/main/net/dpml/activation/impl metro/activation/providers/avalon/src/main/net/dpml/activation/avalon metro/activation/providers/metro/src/main/net/dpml/activation/metro metro/composition/api/src/main/net/dpml/composition/data metro/composition/api/src/test/net/dpml/composition/data/test metro/composition/impl/src/main/net/dpml/composition/model/impl metro/extension/api/src/main/net/dpml/extension metro/extension/api/src/main/net/dpml/extension/manager metro/extension/impl/src/main/net/dpml/extension/manager/impl metro/logging/providers/log4j/impl/src/main/net/dpml/logging/log4j metro/logging/providers/logkit/api/src/main/net/dpml/logging/logkit metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory metro/logging/providers/logkit/impl/src/main/net/dpml/logging/logkit/factory/io metro/main/src/main/net/dpml/metro metro/meta/api/src/main/net/dpml/meta/info metro/meta/api/src/test/net/dpml/meta/info/test metro/meta/impl/src/main/net/dpml/meta/info/builder/impl metro/meta/impl/src/main/net/dpml/meta/info/impl metro/parameters/impl/src/main/net/dpml/parameters/impl metro/system/api/src/main/net/dpml/system metro/system/impl/src/main/net/dpml/system/impl metro/testing/testa/src/main/net/dpml/test/testa metro/util/defaults/src/main/net/dpml/defaults, niclas, 01/17/2005

Archive powered by MHonArc 2.6.24.

Top of Page