Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1941 - in development/main/metro: composition/impl/src/main/net/dpml/composition/data/builder parameters/impl/src/main/net/dpml/parameters/impl

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: r1941 - in development/main/metro: composition/impl/src/main/net/dpml/composition/data/builder parameters/impl/src/main/net/dpml/parameters/impl
  • Date: Fri, 04 Mar 2005 08:46:20 +0100

Author: niclas
Date: Fri Mar 4 08:46:16 2005
New Revision: 1941

Modified:

development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java

development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLTargetsCreator.java

development/main/metro/parameters/impl/src/main/net/dpml/parameters/impl/DefaultParameters.java
Log:
Changed the exception thrown in DefaultParameters.fromConfiguration() to a
ParameterException instead.

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLComponentProfileCreator.java
Fri Mar 4 08:46:16 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,7 @@

import net.dpml.logging.data.CategoriesDirective;

+import net.dpml.parameters.ParameterException;
import net.dpml.parameters.Parameters;
import net.dpml.parameters.impl.DefaultParameters;

@@ -53,7 +54,7 @@
/**
* Creation of a {@link ComponentProfile} from an XML configuration.
*
- * @param config the configuration instance describing the component
deployment scenario
+ * @param config the configuration instance describing the component
deployment scenario
* @return the deployment profile
*/
public ComponentProfile createComponentProfile( Configuration config )
@@ -63,7 +64,7 @@
if( null == classname )
{
String c = ConfigurationUtil.list( config );
- String error =
+ String error =
"Missing 'class' attribute in component declaration:\n" + c;
throw new ConfigurationException( error );
}
@@ -74,10 +75,10 @@
* Creation of a {@link ComponentProfile} from an XML configuration.
*
* @param base the default name
- * @param config the configuration describing the component deployment
scenario
+ * @param config the configuration describing the component deployment
scenario
* @return the deployment profile
*/
- public ComponentProfile createComponentProfile(
+ public ComponentProfile createComponentProfile(
String base, String classname, Configuration config )
throws Exception
{
@@ -89,42 +90,42 @@
* Creation of a {@link ComponentProfile} from an XML configuration.
*
* @param classname the name of the class identifying the underlying
component type
- * @param config the configuration describing the component deployment
scenario
+ * @param config the configuration describing the component deployment
scenario
* @return the deployment profile
*/
- public ComponentProfile createComponentProfile(
+ public ComponentProfile createComponentProfile(
String classname, Configuration config, String name )
throws Exception
{
- final int activation =
+ final int activation =
getActivationDirective( config, DeploymentProfile.DEFAULT );
final int collection = getCollectionPolicy( config );

- final CategoriesDirective categories =
+ final CategoriesDirective categories =
getCategoriesDirective( config.getChild( "categories", false ) );
- final ContextDirective context =
+ final ContextDirective context =
getContextDirective( config.getChild( "context", false ) );
- final DependencyDirective[] dependencies =
+ final DependencyDirective[] dependencies =
getDependencyDirectives( config.getChild( "dependencies" ) );
- final StageDirective[] stages =
+ final StageDirective[] stages =
getStageDirectives( config.getChild( "stages" ) );
- final Parameters params =
+ final Parameters params =
getParameters( config.getChild( "parameters", false ) );
- final Configuration configuration =
+ final Configuration configuration =
config.getChild( "configuration", true );

- return new ComponentProfile(
- name, activation, collection, classname, categories, context,
dependencies,
+ return new ComponentProfile(
+ name, activation, collection, classname, categories, context,
dependencies,
stages, params, configuration, Mode.EXPLICIT );
}

/**
* Get the collection policy from a configuration. If the collection
- * policy is not declared a null is returned indicating that the
collection
- * policy shall default to the component type collection policy.
+ * policy is not declared a null is returned indicating that the
collection
+ * policy shall default to the component type collection policy.
*
* @param config a configuration fragment holding a collection attribute
- * @return collection policy
+ * @return collection policy
*/
protected int getCollectionPolicy( Configuration config )
{
@@ -164,7 +165,7 @@
{
list.add( getSelectionDirective( children[i] ) );
}
- SelectionDirective[] features =
+ SelectionDirective[] features =
(SelectionDirective[]) list.toArray( new SelectionDirective[0]
);
return new DependencyDirective( key, features );
}
@@ -203,7 +204,7 @@
{
list.add( getSelectionDirective( children[i] ) );
}
- SelectionDirective[] features =
+ SelectionDirective[] features =
(SelectionDirective[]) list.toArray( new SelectionDirective[0]
);
return new StageDirective( key, features );
}
@@ -220,7 +221,7 @@
}

protected Parameters getParameters( Configuration config )
- throws ConfigurationException
+ throws ParameterException
{
if( config != null )
{
@@ -246,7 +247,7 @@

if( config.getChildren( "import" ).length > 0 )
{
- final String error =
+ final String error =
"The 'context' tag format has changed."
+ " Please check Merlin home for details "
+ "http://avalon.apache.org/merlin";;
@@ -295,9 +296,9 @@
String value = conf.getValue( null );
if( null != value )
{
- return new ConstructorDirective(
+ return new ConstructorDirective(
key, classname, value );
- }
+ }
else
{
Configuration[] configs = conf.getChildren( "param" );
@@ -314,7 +315,7 @@
final Configuration[] children = conf.getChildren();
if( children.length != 1 )
{
- final String error =
+ final String error =
"Entry '" + key + "' does not contain one child element.";
throw new ConfigurationException( error );
}
@@ -328,7 +329,7 @@
}
else if( name.equals( "constructor" ) )
{
- final String constructorClassname =
+ final String constructorClassname =
child.getAttribute( "class", "java.lang.String" );
Configuration[] paramsConf = child.getChildren( "param" );
if( paramsConf.length > 0 )
@@ -338,13 +339,13 @@
}
else
{
- return new ConstructorDirective(
+ return new ConstructorDirective(
key, constructorClassname, (String) child.getValue(
null ) );
}
}
else
{
- final String error =
+ final String error =
"Entry child unrecognized: " + name;
throw new ConfigurationException( error );
}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLTargetsCreator.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLTargetsCreator.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLTargetsCreator.java
Fri Mar 4 08:46:16 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.
*/
@@ -25,6 +25,7 @@
import net.dpml.configuration.Configuration;
import net.dpml.configuration.ConfigurationException;

+import net.dpml.parameters.ParameterException;
import net.dpml.parameters.Parameters;
import net.dpml.parameters.impl.DefaultParameters;

@@ -35,7 +36,7 @@
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id$
*/
-public class XMLTargetsCreator extends XMLComponentProfileCreator
+public class XMLTargetsCreator extends XMLComponentProfileCreator
{
/**
* Create a set of target directives from the configuration.
@@ -62,14 +63,14 @@
final String name = node.getName();
if( ! name.equals( "target" ) )
{
- final String error =
- "Unrecognized configuration element '"
+ final String error =
+ "Unrecognized configuration element '"
+ name + "' is declared within a targets directive. "
+ "A 'targets' directive may only contain 'target'
elements.";
throw new ConfigurationException( error );
}
}
-
+
return new Targets( targets );
}

@@ -104,8 +105,8 @@
// get the assigned categories
//

- CategoriesDirective categories =
- getCategoriesDirective(
+ CategoriesDirective categories =
+ getCategoriesDirective(
config.getChild( "categories", false ) );

//
@@ -128,9 +129,10 @@
return new TargetDirective( name, conf, params, categories, profile
);
}

- private Parameters getTargetParameters( Configuration config ) throws
ConfigurationException
+ private Parameters getTargetParameters( Configuration config )
+ throws ParameterException
{
- if( null == config )
+ if( null == config )
return null;
return DefaultParameters.fromConfiguration( config );
}

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
Fri Mar 4 08:46:16 2005
@@ -697,7 +697,7 @@
* @throws ConfigurationException if an error occurs
*/
public static Parameters fromConfiguration( final Configuration
configuration )
- throws ConfigurationException
+ throws ParameterException
{
return fromConfiguration( configuration, "parameter" );
}
@@ -715,7 +715,7 @@
*/
public static Parameters fromConfiguration( final Configuration
configuration,
final String elementName )
- throws ConfigurationException, NullArgumentException
+ throws ParameterException, NullArgumentException
{
if( null == configuration )
{
@@ -734,7 +734,7 @@
}
catch( final Exception e )
{
- throw new ConfigurationException( "Cannot process
Configurable", configuration, e );
+ throw new ParameterException( "Cannot process Configurable",
e );
}
}




  • svn commit: r1941 - in development/main/metro: composition/impl/src/main/net/dpml/composition/data/builder parameters/impl/src/main/net/dpml/parameters/impl, niclas, 03/04/2005

Archive powered by MHonArc 2.6.24.

Top of Page