notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r1331 - in trunk/main/metro: test test/src/main/net/dpml/test test/src/test/net/dpml/test/runtime tools/src/main/net/dpml/metro/tools
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r1331 - in trunk/main/metro: test test/src/main/net/dpml/test test/src/test/net/dpml/test/runtime tools/src/main/net/dpml/metro/tools
- Date: Thu, 6 Apr 2006 20:33:20 +0200
Author: mcconnell
Date: 2006-04-06 20:33:13 +0200 (Thu, 06 Apr 2006)
New Revision: 1331
Removed:
trunk/main/metro/test/src/main/net/dpml/test/config/
trunk/main/metro/test/src/main/net/dpml/test/params/
trunk/main/metro/test/src/test/net/dpml/test/runtime/ConfigTestCase.java~
trunk/main/metro/test/src/test/net/dpml/test/runtime/ParamsTestCase.java~
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ConfigurationDataType.java
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ParametersDataType.java
Modified:
trunk/main/metro/test/build.xml
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ComponentBuilderTask.java
Log:
housekeeping
Modified: trunk/main/metro/test/build.xml
===================================================================
--- trunk/main/metro/test/build.xml 2006-04-06 18:17:15 UTC (rev 1330)
+++ trunk/main/metro/test/build.xml 2006-04-06 18:33:13 UTC (rev 1331)
@@ -226,32 +226,6 @@
</context>
</c:component>
- <!-- configuration component -->
- <!--
- <c:type class="net.dpml.test.config.ConfigurableComponent" name="config"
lifestyle="thread"/>
- <c:component dest="target/test/config.part" test="true"
activation="STARTUP"
- type="net.dpml.test.config.ConfigurableComponent" collection="hard">
- <configuration name="fred">
- <place>Cafe de'Orleans</place>
- <item name="breakfast" value="Cafe et Crossant"/>
- <item name="lunch" value="Salade de Sub-Oust"/>
- <item name="dinner" value="Margret de Canard"/>
- </configuration>
- </c:component>
- -->
-
- <!-- parameterizable component -->
- <!--
- <c:type class="net.dpml.test.params.ParameterizableComponent"
name="params" lifestyle="thread"/>
- <c:component dest="target/test/params.part" test="true"
activation="STARTUP"
- type="net.dpml.test.params.ParameterizableComponent"
collection="hard">
- <parameters>
- <param name="name" value="fred"/>
- <param name="size" value="1024"/>
- </parameters>
- </c:component>
- -->
-
<!-- composite app-->
<c:types>
Deleted:
trunk/main/metro/test/src/test/net/dpml/test/runtime/ConfigTestCase.java~
===================================================================
--- trunk/main/metro/test/src/test/net/dpml/test/runtime/ConfigTestCase.java~
2006-04-06 18:17:15 UTC (rev 1330)
+++ trunk/main/metro/test/src/test/net/dpml/test/runtime/ConfigTestCase.java~
2006-04-06 18:33:13 UTC (rev 1331)
@@ -1,79 +0,0 @@
-/*
- * Copyright 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
- *
- * 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.metro.runtime.test;
-
-import java.io.File;
-import java.net.URI;
-
-import junit.framework.TestCase;
-
-import net.dpml.part.Controller;
-import net.dpml.part.Component;
-import net.dpml.part.Provider;
-
-import net.dpml.test.config.ConfigurableComponent;
-
-/**
- * Validation of component configuration aspects.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public class ConfigTestCase extends TestCase
-{
- private static final Controller CONTROLLER = Controller.STANDARD;
-
- private URI m_uri;
-
- /**
- * Testcase setup during which the part definition 'config.part'
- * is established as a file uri.
- * @exception Exception if an unexpected error occurs
- */
- public void setUp() throws Exception
- {
- final String path = "config.part";
- final File test = new File( System.getProperty( "project.test.dir" )
);
- m_uri = new File( test, path ).toURI();
- }
-
- /**
- * Test the the component properly exposed the configuration
- * declared within the part defintion.
- * @exception Exception if an unexpected error occurs
- */
- public void testCategories() throws Exception
- {
- Component component = CONTROLLER.createComponent( m_uri );
- Provider instance = component.getProvider();
- ConfigurableComponent object = (ConfigurableComponent)
instance.getValue( false );
- assertEquals( "name", "fred", object.getName() );
- assertEquals( "count", 3, object.getItemCount() );
- component.deactivate();
- }
-
- static
- {
- System.setProperty(
- "java.util.logging.config.class",
- System.getProperty(
- "java.util.logging.config.class",
- "net.dpml.transit.util.ConfigurationHandler" ) );
- }
-}
Deleted:
trunk/main/metro/test/src/test/net/dpml/test/runtime/ParamsTestCase.java~
===================================================================
--- trunk/main/metro/test/src/test/net/dpml/test/runtime/ParamsTestCase.java~
2006-04-06 18:17:15 UTC (rev 1330)
+++ trunk/main/metro/test/src/test/net/dpml/test/runtime/ParamsTestCase.java~
2006-04-06 18:33:13 UTC (rev 1331)
@@ -1,77 +0,0 @@
-/*
- * Copyright 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
- *
- * 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.metro.runtime.test;
-
-import java.io.File;
-import java.net.URI;
-
-import junit.framework.TestCase;
-
-import net.dpml.part.Controller;
-import net.dpml.part.Component;
-import net.dpml.part.Provider;
-
-import net.dpml.test.params.ParameterizableComponent;
-
-/**
- * Contains a series of tests dealing with dynamic component lifecycles.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public class ParamsTestCase extends TestCase
-{
- private static final Controller CONTROLLER = Controller.STANDARD;
-
- private URI m_uri;
-
- /**
- * Test case setup.
- * @exception Exception if an error occurs
- */
- public void setUp() throws Exception
- {
- final String path = "params.part";
- final File test = new File( System.getProperty( "project.test.dir" )
);
- m_uri = new File( test, path ).toURI();
- }
-
- /**
- * Test that the component initial state is inactive.
- * @exception Exception if an error occurs
- */
- public void testCategories() throws Exception
- {
- Component component = CONTROLLER.createComponent( m_uri );
- Provider instance = component.getProvider();
- ParameterizableComponent object = (ParameterizableComponent)
instance.getValue( false );
- assertEquals( "name", "fred", object.getName() );
- assertEquals( "count", ParameterizableComponent.TEST_VALUE,
object.getSize() );
- component.deactivate();
- }
-
- static
- {
- System.setProperty(
- "java.util.logging.config.class",
- System.getProperty(
- "java.util.logging.config.class",
- "net.dpml.transit.util.ConfigurationHandler" ) );
- }
-}
Modified:
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ComponentBuilderTask.java
===================================================================
---
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ComponentBuilderTask.java
2006-04-06 18:17:15 UTC (rev 1330)
+++
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ComponentBuilderTask.java
2006-04-06 18:33:13 UTC (rev 1331)
@@ -30,8 +30,6 @@
import net.dpml.component.Directive;
import net.dpml.component.ActivationPolicy;
-import net.dpml.configuration.Configuration;
-
import net.dpml.library.info.Scope;
import net.dpml.library.Resource;
@@ -46,8 +44,6 @@
import net.dpml.metro.builder.ComponentTypeDecoder;
import net.dpml.metro.runtime.DefaultComposition;
-import net.dpml.parameters.Parameters;
-
import net.dpml.lang.Classpath;
import net.dpml.lang.Part;
import net.dpml.lang.Info;
@@ -88,8 +84,6 @@
private ActivationPolicy m_activation = ActivationPolicy.SYSTEM;
private CategoriesDataType m_categories;
private ContextDataType m_context;
- private ParametersDataType m_parameters;
- private ConfigurationDataType m_configuration;
private PartsDataType m_parts;
private File m_output;
private Type m_type;
@@ -216,46 +210,6 @@
}
/**
- * Add a parameters instance to the component.
- * @return the parameters datatype
- */
- public ParametersDataType createParameters()
- {
- if( null == m_parameters )
- {
- Project project = getProject();
- m_parameters = new ParametersDataType( project );
- return m_parameters;
- }
- else
- {
- final String error =
- "Illegal attempt to create a duplicate parameters
declaration.";
- throw new BuildException( error, getLocation() );
- }
- }
-
- /**
- * Add a configuration instance to the component.
- * @return the configuration datatype
- */
- public ConfigurationDataType createConfiguration()
- {
- if( null == m_configuration )
- {
- Project project = getProject();
- m_configuration = new ConfigurationDataType( project );
- return m_configuration;
- }
- else
- {
- final String error =
- "Illegal attempt to create a duplicate configuration.";
- throw new BuildException( error, getLocation() );
- }
- }
-
- /**
* Create a new part datatype.
* @return a new part datatype
*/
@@ -550,8 +504,6 @@
ActivationPolicy activation = getActivationPolicy();
CategoriesDirective categories = getCategoriesDirective();
ContextDirective context = getContextDirective( classloader, type );
- Parameters parameters = getParameters();
- Configuration configuration = getConfiguration();
PartReference[] parts = getParts( classloader );
//
@@ -559,8 +511,7 @@
//
return new ComponentDirective(
- id, activation, collection, lifestyle, classname, categories,
context,
- parameters, configuration, parts );
+ id, activation, collection, lifestyle, classname, categories,
context, parts );
}
private Type loadType( ClassLoader classloader, String classname )
@@ -752,30 +703,6 @@
}
}
- private Parameters getParameters()
- {
- if( null == m_parameters )
- {
- return m_profile.getParameters();
- }
- else
- {
- return m_parameters.getParameters();
- }
- }
-
- private Configuration getConfiguration()
- {
- if( null == m_configuration )
- {
- return m_profile.getConfiguration();
- }
- else
- {
- return m_configuration.getConfiguration();
- }
- }
-
private PartReference[] getParts( ClassLoader classloader )
throws IntrospectionException, IOException
{
Deleted:
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ConfigurationDataType.java
===================================================================
---
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ConfigurationDataType.java
2006-04-06 18:17:15 UTC (rev 1330)
+++
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ConfigurationDataType.java
2006-04-06 18:33:13 UTC (rev 1331)
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 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
- *
- * 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.metro.tools;
-
-import java.util.Hashtable;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import net.dpml.configuration.Configuration;
-import net.dpml.configuration.impl.DefaultConfiguration;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DynamicConfiguratorNS;
-import org.apache.tools.ant.Project;
-
-
-/**
- * A configuration directive.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public class ConfigurationDataType implements DynamicConfiguratorNS
-{
- private final Project m_project;
-
- private String m_value;
- private Map m_attributes = new Hashtable();
- private List m_children = new LinkedList();
- private String m_name;
-
- /**
- * Creation of a root configuration directive.
- * @param project the current project
- */
- public ConfigurationDataType( Project project )
- {
- this( project, "configuration" );
- }
-
- /**
- * Creation of a named configuration element.
- * @param project the current project
- * @param name the element name
- */
- public ConfigurationDataType( Project project, String name )
- {
- m_name = name;
- m_project = project;
- }
-
- /**
- * Add nested text.
- * @param value the test value
- */
- public void addText( String value )
- {
- String s = value.trim();
- if( s.length() > 0 )
- {
- String parsedValue = m_project.replaceProperties( s );
- m_value = parsedValue;
- }
- }
-
- /**
- * Set a named attribute to the given value
- *
- * @param uri The namespace uri for this attribute, "" is
- * used if there is no namespace uri.
- * @param localName The localname of this attribute.
- * @param qName The qualified name for this attribute
- * @param value The value of this attribute.
- * @throws BuildException when any error occurs
- */
- public void setDynamicAttribute(
- String uri, String localName, String qName, String value )
- throws BuildException
- {
- String parsedValue = m_project.replaceProperties( value );
- m_attributes.put( qName, parsedValue );
- }
-
- /**
- * Create an element with the given name
- *
- * @param uri the element handler uri
- * @param localName the element local name
- * @param qName the element qualified name
- * @throws BuildException when any error occurs
- * @return the element created
- */
- public Object createDynamicElement(
- String uri, String localName, String qName ) throws BuildException
- {
- ConfigurationDataType conf = new ConfigurationDataType( m_project,
qName );
- m_children.add( conf );
- return conf;
- }
-
- /**
- * Return the name of the configuration element.
- * @return the node name
- */
- public String getName()
- {
- return m_name;
- }
-
- /**
- * Return a value associated with the element.
- * @return the assigned value
- */
- public String getValue()
- {
- return m_value;
- }
-
- /**
- * Return the map of the assigned attributes.
- * @return the attribute name value map
- */
- public Map getAttributes()
- {
- return m_attributes;
- }
-
- /**
- * Return he set of nest child configuration directives.
- * @return the configuration directives within this directive
- */
- public ConfigurationDataType[] getChildren()
- {
- return (ConfigurationDataType[]) m_children.toArray( new
ConfigurationDataType[m_children.size()] );
- }
-
- /**
- * Return the constructed configuration instance.
- * @return the configuration
- */
- public Configuration getConfiguration()
- {
- String name = getName();
- DefaultConfiguration config = new DefaultConfiguration( name );
- config.setValue( getValue() );
- Map attributes = getAttributes();
- String[] keys = (String[]) attributes.keySet().toArray( new
String[0] );
- for( int i=0; i<keys.length; i++ )
- {
- String key = keys[i];
- String value = (String) attributes.get( key );
- config.setAttribute( key, value );
- }
- ConfigurationDataType[] nodes = getChildren();
- Configuration[] children = new Configuration[ nodes.length ];
- for( int i=0; i<nodes.length; i++ )
- {
- ConfigurationDataType data = nodes[i];
- Configuration conf = data.getConfiguration();
- config.addChild( conf );
- }
- return config;
- }
-}
Deleted:
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ParametersDataType.java
===================================================================
---
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ParametersDataType.java
2006-04-06 18:17:15 UTC (rev 1330)
+++
trunk/main/metro/tools/src/main/net/dpml/metro/tools/ParametersDataType.java
2006-04-06 18:33:13 UTC (rev 1331)
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 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
- *
- * 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.metro.tools;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.dpml.parameters.Parameters;
-import net.dpml.parameters.impl.DefaultParameters;
-
-import org.apache.tools.ant.Project;
-
-
-/**
- * A datatype supporting the creation of a parameters instance.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public class ParametersDataType
-{
- private final List m_parameters = new ArrayList();
- private final Project m_project;
-
- /**
- * Creation of a new <tt>ParametersDataType</tt>.
- * @param project the current project
- */
- public ParametersDataType( Project project )
- {
- m_project = project;
- }
-
- /**
- * Create, allocate and return a new parameter with this set of
parameters.
- * @return a new parameter directive
- * @see #createParameter()
- */
- public ParameterDataType createParam()
- {
- return createParameter();
- }
-
- /**
- * Create, allocate and return a new parameter with this set of
parameters.
- * @return a new parameter directive
- */
- public ParameterDataType createParameter()
- {
- final ParameterDataType parameter = new ParameterDataType( m_project
);
- m_parameters.add( parameter );
- return parameter;
- }
-
- /**
- * Return the set of parameter directives declarared within this
parameters directives.
- * @return the set of parameter directives
- */
- public ParameterDataType[] getParameterDataTypes()
- {
- return (ParameterDataType[]) m_parameters.toArray( new
ParameterDataType[0] );
- }
-
- /**
- * Return the contructed parameters instance.
- * @return the parameters value
- */
- public Parameters getParameters()
- {
- DefaultParameters parameters = new DefaultParameters();
- ParameterDataType[] params = getParameterDataTypes();
- for( int i=0; i<params.length; i++ )
- {
- ParameterDataType p = params[i];
- String name = p.getName();
- String value = p.getValue();
- parameters.setParameter( name, value );
- }
- return parameters;
- }
-
- /**
- * A parameter directive.
- */
- public static class ParameterDataType
- {
- private final Project m_project;
- private String m_name;
- private String m_value;
-
- /**
- * Creation of a new parameters datatype.
- * @param project the current project
- */
- public ParameterDataType( Project project )
- {
- m_project = project;
- }
-
- /**
- * Set the parameter name.
- * @param name the parameter name
- */
- public void setName( final String name )
- {
- m_name = name;
- }
-
- /**
- * Set the value assigned to the named parameter.
- * @param value the parameter value
- */
- public void setValue( final String value )
- {
- m_value = m_project.replaceProperties( value );
- }
-
- /**
- * Return the parameter name.
- * @return the parameter name
- */
- public String getName()
- {
- return m_name;
- }
-
- /**
- * Return the value assigned to the parameter.
- * @return the parameter value
- */
- public String getValue()
- {
- return m_value;
- }
- }
-}
- r1331 - in trunk/main/metro: test test/src/main/net/dpml/test test/src/test/net/dpml/test/runtime tools/src/main/net/dpml/metro/tools, mcconnell at BerliOS, 04/06/2006
Archive powered by MHonArc 2.6.24.