Skip to Content.
Sympa Menu

notify-dpml - r1311 - in trunk/main: central/src/docs/transit/concepts transit/core/src/main/net/dpml/part transit/core/src/main/net/dpml/transit transit/core/src/test/net/dpml/part

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: r1311 - in trunk/main: central/src/docs/transit/concepts transit/core/src/main/net/dpml/part transit/core/src/main/net/dpml/transit transit/core/src/test/net/dpml/part
  • Date: Tue, 4 Apr 2006 21:50:43 +0200

Author: mcconnell
Date: 2006-04-04 21:50:39 +0200 (Tue, 04 Apr 2006)
New Revision: 1311

Modified:
trunk/main/central/src/docs/transit/concepts/plugins.xml
trunk/main/transit/core/src/main/net/dpml/part/PartDecoder.java
trunk/main/transit/core/src/main/net/dpml/part/Resource.java
trunk/main/transit/core/src/main/net/dpml/part/StandardClassLoader.java
trunk/main/transit/core/src/main/net/dpml/transit/Repository.java
trunk/main/transit/core/src/main/net/dpml/transit/StandardLoader.java
trunk/main/transit/core/src/test/net/dpml/part/PartTestCase.java
Log:
checkstyle

Modified: trunk/main/central/src/docs/transit/concepts/plugins.xml
===================================================================
--- trunk/main/central/src/docs/transit/concepts/plugins.xml 2006-04-04
19:26:00 UTC (rev 1310)
+++ trunk/main/central/src/docs/transit/concepts/plugins.xml 2006-04-04
19:50:39 UTC (rev 1311)
@@ -98,11 +98,10 @@
</p>

<source>
- Repository repository = Transit.getInstance().getRepository();
- ClassLoader parent = getClass().getClassLoader();
URI uri = new URI( "artifact:part:mycompany/thisproject/hello-impl#1.4.1"
);
Object[] args = new Object[] { "Hello, World!" };
- Object plugin = repository.getPlugin( parent, uri, args );
+ Part part = Part.load( uri );
+ Object plugin = part.instantiate( args );
if( plugin instanceof Hello )
{
m_hello = (Hello) plugin;
@@ -123,8 +122,7 @@
would need a simple descriptor like this;
</p>

-<pre><![CDATA[
-<?xml version="1.0"?>
+<pre><![CDATA[<?xml version="1.0"?>

<part xmlns="artifact:xsd:dpml/lang/dpml-part#1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
@@ -144,9 +142,7 @@
</private>
</classpath>

-</part>
-
-]]></pre>
+</part>]]></pre>
<p>
Now, the beauty of Transit is that IF the hello-api artifact is
present
in the parent classloader (or higher), the API classloader will NOT

Modified: trunk/main/transit/core/src/main/net/dpml/part/PartDecoder.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/PartDecoder.java
2006-04-04 19:26:00 UTC (rev 1310)
+++ trunk/main/transit/core/src/main/net/dpml/part/PartDecoder.java
2006-04-04 19:50:39 UTC (rev 1311)
@@ -22,12 +22,9 @@
import java.net.URI;
import java.util.Map;
import java.util.Hashtable;
-import java.util.WeakHashMap;
import java.lang.ref.WeakReference;

import net.dpml.lang.Classpath;
-import net.dpml.part.Decoder;
-import net.dpml.part.DecodingException;
import net.dpml.lang.Logger;
import net.dpml.lang.DefaultLogger;
import net.dpml.lang.Value;
@@ -44,6 +41,9 @@
*/
public final class PartDecoder implements Decoder
{
+ /**
+ * Part ZSD uri.
+ */
public static final String PART_XSD_URI = "@PART-XSD-URI@";

private static final DOM3DocumentBuilder DOCUMENT_BUILDER =
@@ -53,6 +53,10 @@

private static final PartDecoder DECODER = new PartDecoder();

+ /**
+ * Get the singleton instance of the part decoder.
+ * @return the decoder instance.
+ */
public static PartDecoder getInstance()
{
return DECODER;
@@ -134,7 +138,7 @@
* Resolve a object from a DOM element.
* @param element the dom element
* @return the resolved object
- * @exception DecodingException if an error occurs during element
evaluation
+ * @exception IOException if an error occurs during element evaluation
*/
public Object decode( Element element ) throws IOException
{
@@ -143,9 +147,9 @@

/**
* Resolve a part from a DOM element.
- * @param element the dom element
- * @return the part definition
- * @exception DecodingException if an error occurs during element
evaluation
+ * @param uri the part uri
+ * @return element part definition
+ * @exception IOException if an error occurs during element evaluation
*/
public Part decodePart( URI uri, Element element ) throws IOException
{
@@ -169,6 +173,13 @@
}
}

+ /**
+ * Resolve a part plugin or resource strategy.
+ * @param information the part info definition
+ * @param classpath the part classpath definition
+ * @return element part deployment definition
+ * @exception IOException if an error occurs during element evaluation
+ */
public Part build( Info information, Classpath classpath, Element
strategy ) throws IOException
{
TypeInfo info = strategy.getSchemaTypeInfo();
@@ -176,6 +187,7 @@
if( PART_XSD_URI.equals( namespace ) )
{
// this is either a plugin or a resource
+
Logger logger = getLogger();
String name = info.getTypeName();
if( "plugin".equals( name ) )
@@ -221,6 +233,10 @@
}
}

+ /**
+ * Get the assigned logging channel.
+ * @return the logging channel
+ */
protected Logger getLogger()
{
return m_logger;
@@ -313,7 +329,7 @@
/**
* Construct the classpath defintion.
* @param root the element containing a 'classpath' element.
- * @return the classpath defintion
+ * @return the classpath definition
* @exception DecodingException if an error occurs during element
evaluation
*/
protected Classpath getClasspath( Element root ) throws DecodingException

Modified: trunk/main/transit/core/src/main/net/dpml/part/Resource.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/Resource.java
2006-04-04 19:26:00 UTC (rev 1310)
+++ trunk/main/transit/core/src/main/net/dpml/part/Resource.java
2006-04-04 19:50:39 UTC (rev 1311)
@@ -36,8 +36,12 @@

/**
* Creation of resource datatype.
+ * @param logger the assigned logging channel
+ * @param info the part info descriptor
+ * @param classpath the part classpath descriptor
* @param urn the resource urn
* @param path the resource path
+ * @exception IOException if an I/O error occurs
*/
public Resource( Logger logger, Info info, Classpath classpath, String
urn, String path )
throws IOException
@@ -84,6 +88,12 @@
throw new UnsupportedOperationException( "instantiate/1" );
}

+ /**
+ * Encode the resource strategy to XML.
+ * @param writer the output stream writer
+ * @param pad the character offset
+ * @exception IOException if an I/O error occurs
+ */
protected void encodeStrategy( Writer writer, String pad ) throws
IOException
{
String urn = getURN();
@@ -94,6 +104,11 @@
writer.write( "\"/>" );
}

+ /**
+ * Test if this instance is equal to the supplied instance.
+ * @param other the supplied instance
+ * @return the equality status
+ */
public boolean equals( Object other )
{
if( super.equals( other ) )
@@ -121,5 +136,15 @@
}
}

-
+ /**
+ * Get the hashcode for this instance.
+ * @return the hash value
+ */
+ public int hashCode()
+ {
+ int hash = super.hashCode();
+ hash ^= m_path.hashCode();
+ hash ^= m_urn.hashCode();
+ return hash;
+ }
}

Modified:
trunk/main/transit/core/src/main/net/dpml/part/StandardClassLoader.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/part/StandardClassLoader.java
2006-04-04 19:26:00 UTC (rev 1310)
+++ trunk/main/transit/core/src/main/net/dpml/part/StandardClassLoader.java
2006-04-04 19:50:39 UTC (rev 1311)
@@ -20,7 +20,6 @@

import java.io.IOException;
import java.util.ArrayList;
-import java.util.Stack;
import java.net.URL;
import java.net.URI;
import java.net.URLClassLoader;
@@ -50,6 +49,7 @@
* @param parent the parent classloader
* @param uris the uris to assign as classloader content
* @return the classloader
+ * @exception IOException if an I/O error occurs
*/
public static ClassLoader buildClassLoader( URI uri, Category category,
ClassLoader parent, URI[] uris )
throws IOException
@@ -340,6 +340,13 @@
buffer.append( "\n" );
}

+ /**
+ * Return a string representing a report fo the common classloader chain
+ * following by the primary annd seciondarty classloaders.
+ * @param primary the primary classloader
+ * @param secondary the secondary classloader
+ * @return the report
+ */
public static String toString( ClassLoader primary, ClassLoader
secondary )
{
StringBuffer buffer = new StringBuffer();

Modified: trunk/main/transit/core/src/main/net/dpml/transit/Repository.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/Repository.java
2006-04-04 19:26:00 UTC (rev 1310)
+++ trunk/main/transit/core/src/main/net/dpml/transit/Repository.java
2006-04-04 19:50:39 UTC (rev 1311)
@@ -19,14 +19,10 @@
package net.dpml.transit;

import java.io.IOException;
-import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

import java.net.URI;

-//import net.dpml.lang.Plugin;
-import net.dpml.lang.Classpath;
-
import net.dpml.part.Part;

/**

Modified:
trunk/main/transit/core/src/main/net/dpml/transit/StandardLoader.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/StandardLoader.java
2006-04-04 19:26:00 UTC (rev 1310)
+++ trunk/main/transit/core/src/main/net/dpml/transit/StandardLoader.java
2006-04-04 19:50:39 UTC (rev 1311)
@@ -20,25 +20,16 @@
package net.dpml.transit;

import java.io.IOException;
-import java.beans.Expression;
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Iterator;

-import net.dpml.transit.monitor.RepositoryMonitorRouter;
-
-import net.dpml.lang.Classpath;
-import net.dpml.lang.Category;
import net.dpml.lang.Logger;

import net.dpml.part.Part;
import net.dpml.part.Plugin;

+import net.dpml.transit.monitor.RepositoryMonitorRouter;
+
/**
* Utility class supporting downloading of resources based on
* artifact references.

Modified: trunk/main/transit/core/src/test/net/dpml/part/PartTestCase.java
===================================================================
--- trunk/main/transit/core/src/test/net/dpml/part/PartTestCase.java
2006-04-04 19:26:00 UTC (rev 1310)
+++ trunk/main/transit/core/src/test/net/dpml/part/PartTestCase.java
2006-04-04 19:50:39 UTC (rev 1311)
@@ -23,8 +23,6 @@

import junit.framework.TestCase;

-import net.dpml.transit.monitor.LoggingAdapter;
-
/**
* Plugin test case.
*




  • r1311 - in trunk/main: central/src/docs/transit/concepts transit/core/src/main/net/dpml/part transit/core/src/main/net/dpml/transit transit/core/src/test/net/dpml/part, mcconnell at BerliOS, 04/04/2006

Archive powered by MHonArc 2.6.24.

Top of Page