Skip to Content.
Sympa Menu

notify-dpml - r1146 - in trunk/main/metro: . builder/src/main/net/dpml/metro/builder

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r1146 - in trunk/main/metro: . builder/src/main/net/dpml/metro/builder
  • Date: Tue, 28 Feb 2006 12:05:00 +0100

Author: mcconnell
Date: 2006-02-28 12:04:59 +0100 (Tue, 28 Feb 2006)
New Revision: 1146

Removed:

trunk/main/metro/builder/src/main/net/dpml/metro/builder/ComponentPlugin.java

trunk/main/metro/builder/src/main/net/dpml/metro/builder/ComponentPluginHelper.java
Modified:

trunk/main/metro/builder/src/main/net/dpml/metro/builder/ComponentPluginFactory.java
trunk/main/metro/module.xml
Log:
synchronizing changes from the past week in prep for changes supporting
migration to XML Schema

Deleted:
trunk/main/metro/builder/src/main/net/dpml/metro/builder/ComponentPlugin.java
===================================================================
---
trunk/main/metro/builder/src/main/net/dpml/metro/builder/ComponentPlugin.java
2006-02-28 11:03:59 UTC (rev 1145)
+++
trunk/main/metro/builder/src/main/net/dpml/metro/builder/ComponentPlugin.java
2006-02-28 11:04:59 UTC (rev 1146)
@@ -1,143 +0,0 @@
-/*
- * Copyright 2006 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.builder;
-
-import java.net.URI;
-import java.util.List;
-import java.util.Properties;
-import java.util.ArrayList;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-
-import net.dpml.library.model.Type;
-import net.dpml.library.model.Resource;
-
-import net.dpml.lang.Plugin;
-import net.dpml.lang.DefaultPlugin;
-import net.dpml.lang.Strategy;
-import net.dpml.lang.Category;
-import net.dpml.lang.Classpath;
-import net.dpml.lang.DefaultClasspath;
-import net.dpml.lang.DefaultPlugin;
-import net.dpml.lang.Version;
-
-import net.dpml.transit.Artifact;
-
-/**
- * Interface implemented by plugins that provide plugin building
functionality.
- * Implementations that load plugin factoryies must supply the target
Resource
- * as a plugin constructor argument. Factory implementation shall construct
- * plugin defintions using the supplied resource as the reference for the
- * classpath dependencies. Suppliementary properties may be aquired using
- * the Type returned from the Resource.getType( "plugin" ) operation.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public class ComponentPlugin extends DefaultPlugin
-{
- private static final String NAMESPACE =
- "link:plugin:dpml/metro/dpml-metro-builder";
-
- private static final Version VERSION = new Version( 1, 0, 0 );
-
- private static final String XML_HEADER =
- "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
-
- private static final String NAME = "plugin";
-
- private static final String PUBLIC_ID =
- "-//DPML//DTD Component 1.0//EN";
-
- private static final String SYSTEM_ID =
- "http://download.dpml.net/dtds/component_1_0.dtd";;
-
- private static final String RESOURCE =
- "net/dpml/lang/component_1_0.dtd";
-
- private static final String DOCTYPE =
- "\n<!DOCTYPE "
- + NAME
- + " PUBLIC \""
- + PUBLIC_ID
- + "\" \""
- + SYSTEM_ID
- + "\" >";
-
- /**
- * Creation of a new plugin definition.
- * @param title short title
- * @param description textual description
- * @param uri the uri from which the plugin was resolved
- * @param strategy the plugin instantiation strategy definition
- * @param classpath the classpath definition
- */
- public ComponentPlugin(
- String title, String description, URI uri, Strategy strategy,
Classpath classpath )
- {
- super( title, description, uri, strategy, classpath );
- }
-
- /**
- * Write an XML representation of the plugin to the output stream.
- * @param output the output stream
- * @exception Exception if an error ocucrs during externalization
- */
- public void write( OutputStream output ) throws Exception
- {
- final Writer writer = new OutputStreamWriter( output );
- writer.write( XML_HEADER );
- writer.write( DOCTYPE );
- writeHeader( writer, NAME, NAMESPACE, VERSION );
- writeTitle( writer, getTitle() );
- writeDescription( writer, getDescription() );
- writeStrategy( writer, getStrategy() );
- writeClasspath( writer, getClasspath() );
- writeFooter( writer, NAME );
- writer.write( "\n" );
- writer.flush();
- writer.close();
- }
-
- protected void writeStrategy( Writer writer, Strategy strategy ) throws
Exception
- {
- //
- // TODO: cast strategy to a ComponentStragety and fill in details
- //
-
- String handler = strategy.getHandlerClassname();
- Properties properties = strategy.getProperties();
- String[] keys = (String[]) properties.keySet().toArray( new
String[0] );
- writer.write( "\n <strategy class=\"" + handler + "\">" );
- for( int i=0; i<keys.length; i++ )
- {
- String key = keys[i];
- String value = properties.getProperty( key );
- writer.write(
- "\n <property name=\""
- + key
- + "\" value=\""
- + value
- + "\"/>" );
- }
- writer.write( "\n </strategy>" );
- }
-}

Modified:
trunk/main/metro/builder/src/main/net/dpml/metro/builder/ComponentPluginFactory.java
===================================================================
---
trunk/main/metro/builder/src/main/net/dpml/metro/builder/ComponentPluginFactory.java
2006-02-28 11:03:59 UTC (rev 1145)
+++
trunk/main/metro/builder/src/main/net/dpml/metro/builder/ComponentPluginFactory.java
2006-02-28 11:04:59 UTC (rev 1146)
@@ -19,33 +19,16 @@
package net.dpml.metro.builder;

import java.net.URI;
-import java.util.List;
-import java.util.Properties;
-import java.util.ArrayList;
-import java.io.IOException;
-import java.io.File;

-import net.dpml.library.model.Type;
-import net.dpml.library.model.Resource;
-
import net.dpml.lang.Plugin;
-import net.dpml.lang.DefaultPlugin;
import net.dpml.lang.Strategy;
-import net.dpml.lang.Category;
import net.dpml.lang.Classpath;
-import net.dpml.lang.DefaultClasspath;
+import net.dpml.lang.PluginFactory;

-import net.dpml.transit.Artifact;
+import net.dpml.transit.DefaultPluginFactory;

-import net.dpml.library.util.DefaultPluginFactory;
-
/**
- * Interface implemented by plugins that provide plugin building
functionality.
- * Implementations that load plugin factoryies must supply the target
Resource
- * as a plugin constructor argument. Factory implementation shall construct
- * plugin defintions using the supplied resource as the reference for the
- * classpath dependencies. Suppliementary properties may be aquired using
- * the Type returned from the Resource.getType( "plugin" ) operation.
+ * Default plugin factory.
*
* @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
* @version @PROJECT-VERSION@
@@ -53,34 +36,18 @@
public class ComponentPluginFactory extends DefaultPluginFactory
{
/**
- * Build the plugin definition for the supplied resource.
- * @exception exception if a build related error occurs
+ * Construct a new plugin description instance using a supplied arguments
+ *
+ * @param uri the uri identifying the plugin
+ * @param element the root element definining the plugin
+ * @exception Exception if an error occurs
*/
- public Plugin build( File dir, Resource resource ) throws Exception
+ public Plugin newPlugin(
+ String title, String description, URI uri, Strategy strategy,
Classpath classpath )
+ throws Exception
{
- URI uri = getPluginURI( resource );
- String title = getTitle( resource );
- String description = getDescription( resource );
- Strategy strategy = getStrategy( dir, resource );
- Classpath classpath = getClasspath( resource );
- return new ComponentPlugin(
- title, description, uri, strategy, classpath );
+ System.out.println( "# NEW: " + getClass().getName() );
+ return super.newPlugin( title, description, uri, strategy, classpath
);
}
-
- protected Strategy getStrategy( File dir, Resource resource )
- {
- Type type = resource.getType( "plugin" );
- String source = type.getProperty( "project.plugin.srcfile",
"plugin.xml" );
- File src = new File( dir, source );
- if( src.exists() )
- {
- System.out.println( "## WE HAVE A DEFINITION: " + src );
- return super.getStrategy( dir, resource );
- }
- else
- {
- System.out.println( "## NO DEFINITION: " + src );
- return super.getStrategy( dir, resource );
- }
- }
}
+

Deleted:
trunk/main/metro/builder/src/main/net/dpml/metro/builder/ComponentPluginHelper.java
===================================================================
---
trunk/main/metro/builder/src/main/net/dpml/metro/builder/ComponentPluginHelper.java
2006-02-28 11:03:59 UTC (rev 1145)
+++
trunk/main/metro/builder/src/main/net/dpml/metro/builder/ComponentPluginHelper.java
2006-02-28 11:04:59 UTC (rev 1146)
@@ -1,83 +0,0 @@
-/*
- * Copyright 2006 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.builder;
-
-import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.io.IOException;
-import java.util.Properties;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import net.dpml.library.util.PluginFactory;
-import net.dpml.library.model.Resource;
-
-import net.dpml.lang.DefaultPluginHelper;
-import net.dpml.lang.Version;
-import net.dpml.lang.Plugin;
-
-import net.dpml.transit.util.ElementHelper;
-
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-
-/**
- * Utility class supporting the reading and writing of standard plugins
definitions.
- *
- * @author <a href="@PUBLISHER-URL@">@PUBLISHER-NAME@</a>
- * @version @PROJECT-VERSION@
- */
-public class ComponentPluginHelper extends DefaultPluginHelper implements
PluginFactory
-{
- private static final PluginFactory FACTORY = new
ComponentPluginFactory();
-
-
//------------------------------------------------------------------------------
- // PluginFactory
-
//------------------------------------------------------------------------------
-
- /**
- * Build the plugin definition.
- * @exception exception if a build related error occurs
- */
- public Plugin build( File dir, Resource resource ) throws Exception
- {
- return FACTORY.build( dir, resource );
- }
-
-
//------------------------------------------------------------------------------
- // PluginHelper
-
//------------------------------------------------------------------------------
-
- public Plugin resolve( URI uri, Element element ) throws Exception
- {
- return super.resolve( uri, element );
- }
-}

Modified: trunk/main/metro/module.xml
===================================================================
--- trunk/main/metro/module.xml 2006-02-28 11:03:59 UTC (rev 1145)
+++ trunk/main/metro/module.xml 2006-02-28 11:04:59 UTC (rev 1146)
@@ -97,7 +97,7 @@
<type id="jar"/>
<type id="plugin" alias="true">
<property name="project.plugin.class"
- value="net.dpml.metro.builder.ComponentPluginHelper"/>
+ value="net.dpml.metro.builder.ComponentPluginFactory"/>
</type>
</types>
<dependencies>




  • r1146 - in trunk/main/metro: . builder/src/main/net/dpml/metro/builder, mcconnell at BerliOS, 02/28/2006

Archive powered by MHonArc 2.6.24.

Top of Page