Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2080 - in development/laboratory/plus: standard/builder/src/main/net/dpml/metro/builder/impl standard/part/src/main/net/dpml/metro/type test/example/impl test/example/part

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2080 - in development/laboratory/plus: standard/builder/src/main/net/dpml/metro/builder/impl standard/part/src/main/net/dpml/metro/type test/example/impl test/example/part
  • Date: Tue, 15 Mar 2005 04:14:46 -0500

Author: mcconnell AT dpml.net
Date: Tue Mar 15 04:14:45 2005
New Revision: 2080

Added:

development/laboratory/plus/standard/part/src/main/net/dpml/metro/type/ComponentPart.java
Modified:

development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ComponentModelBuilderTask.java
development/laboratory/plus/test/example/impl/build.xml
development/laboratory/plus/test/example/part/ (props changed)
development/laboratory/plus/test/example/part/build.xml
Log:
complete registry -> catalog switch

Modified:
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ComponentModelBuilderTask.java
==============================================================================
---
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ComponentModelBuilderTask.java
(original)
+++
development/laboratory/plus/standard/builder/src/main/net/dpml/metro/builder/impl/ComponentModelBuilderTask.java
Tue Mar 15 04:14:45 2005
@@ -80,7 +80,7 @@
//--------------------------------------------------------------------

private String m_key;
- private URI m_registry;
+ private URI m_catalog;

//--------------------------------------------------------------------
// features
@@ -105,7 +105,7 @@
*/
public void setUri( final URI uri )
{
- m_registry = uri;
+ m_catalog = uri;
}

//--------------------------------------------------------------------
@@ -158,20 +158,11 @@
throws IntrospectionException, IOException, ClassNotFoundException,
CatalogNotFoundException,
BadStrategyException, TypeNotFoundException
{
- if( null != descriptor )
- {
- System.out.println( "## building part: " + descriptor );
- }
- else
- {
- System.out.println( "## building part");
- }
-
Type type = resolveType( classloader );
ServiceDescriptor[] services = type.getServiceDescriptors();
- URI registry = resolveRegistryURI();
+ URI catalog = resolveCatalogURI();
String classname = type.getInfoDescriptor().getClassname();
- TypeReference reference = new TypeReference( registry, classname );
+ TypeReference reference = new TypeReference( catalog, classname );

if( null != descriptor )
{
@@ -182,7 +173,7 @@
}

/**
- * If <component> element is nested somewhere within a <registry> tag
then
+ * If <component> element is nested somewhere within a <catalog> tag then
* construct a type instance otherwise retirieve the type instance from a
* registry identified by the component tag's uri attribute.
*/
@@ -190,36 +181,36 @@
throws IntrospectionException, IOException,
ClassNotFoundException,
CatalogNotFoundException, BadStrategyException,
TypeNotFoundException
{
- if( null == m_registry )
+ if( null == m_catalog )
{
return buildType( classloader );
}
else
{
String classname = getClassname();
- TypeReference reference = new TypeReference( m_registry,
classname );
+ TypeReference reference = new TypeReference( m_catalog,
classname );
TypeHandler handler = new ComponentTypeHandler();
return handler.loadType( reference );
}
}

- private URI resolveRegistryURI()
+ private URI resolveCatalogURI()
{
- if( null != m_registry )
+ if( null != m_catalog )
{
- return m_registry;
+ return m_catalog;
}
else
{
Definition definition = getDefinition();
- if( definition.getInfo().isa( "registry" ) )
+ if( definition.getInfo().isa( Catalog.ARTIFACT_TYPE ) )
{
- return definition.getArtifactURI( "registry" );
+ return definition.getArtifactURI( Catalog.ARTIFACT_TYPE );
}
else
{
final String error =
- "Component directive does not declare a registry uri.";
+ "Component directive does not declare a catalog uri.";
throw new BuildException( error, getLocation() );
}
}
@@ -231,8 +222,6 @@

public void execute()
{
-System.out.println( "executing component part" );
-
Project project = getProject();
Path path = getDefinition().getPath( project, Policy.RUNTIME );
File classes = getContext().getClassesDirectory();

Added:
development/laboratory/plus/standard/part/src/main/net/dpml/metro/type/ComponentPart.java
==============================================================================
--- (empty file)
+++
development/laboratory/plus/standard/part/src/main/net/dpml/metro/type/ComponentPart.java
Tue Mar 15 04:14:45 2005
@@ -0,0 +1,127 @@
+/*
+ * 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.type;
+
+import java.util.Properties;
+import java.net.URI;
+
+import net.dpml.metro.part.Part;
+import net.dpml.metro.part.ServiceDescriptor;
+import net.dpml.metro.part.Descriptor;
+import net.dpml.metro.catalog.TypeReference;
+
+/**
+ * The part directive is a directive that can be handled as a part within a
+ * component model.
+ *
+ * @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class ComponentPart extends Descriptor implements Part
+{
+ private TypeReference m_type;
+ private ServiceDescriptor[] m_services;
+ private URI m_handler;
+
+ public ComponentPart( URI handler, TypeReference type )
+ {
+ this( handler, type, EMPTY_SERVICES, null );
+ }
+
+ public ComponentPart( URI handler, TypeReference type,
ServiceDescriptor[] services )
+ {
+ this( handler, type, services, null );
+ }
+
+ public ComponentPart( URI handler, TypeReference type,
ServiceDescriptor[] services, Properties properties )
+ {
+ super( properties );
+ if( null == type )
+ {
+ throw new NullPointerException( "type" );
+ }
+ if( null == services )
+ {
+ throw new NullPointerException( "services" );
+ }
+ m_type = type;
+ m_services = services;
+ m_handler = handler;
+ }
+
+ /**
+ * Return the part handler uri.
+ * @return the uri of the part handler
+ */
+ public URI getPartHandlerURI()
+ {
+ return m_handler;
+ }
+
+ /**
+ * Return a reference to the type managed by this part.
+ * @return the type reference
+ */
+ public TypeReference getTypeReference()
+ {
+ return m_type;
+ }
+
+ /**
+ * Return an array of the services available from this part.
+ * @return the type reference
+ */
+ public ServiceDescriptor[] getServiceDescriptors()
+ {
+ return m_services;
+ }
+
+ public int hashCode()
+ {
+ int hash = m_type.hashCode();
+ return hash;
+ }
+
+ public boolean equals( Object other )
+ {
+ if( null == other )
+ {
+ return false;
+ }
+ else if( other instanceof ComponentPart )
+ {
+ ComponentPart part = (ComponentPart) other;
+ if( getTypeReference().equals( part.getTypeReference() ) ==
false )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ private static final ServiceDescriptor[] EMPTY_SERVICES = new
ServiceDescriptor[0];
+
+}

Modified: development/laboratory/plus/test/example/impl/build.xml
==============================================================================
--- development/laboratory/plus/test/example/impl/build.xml (original)
+++ development/laboratory/plus/test/example/impl/build.xml Tue Mar 15
04:14:45 2005
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>

-<!-- example of the creation of a serialized registry of component types -->
+<!-- example of the creation of a serialized catalog of component types -->

<project name="dpml-test-hello-impl" default="install" basedir="."
xmlns:transit="antlib:net.dpml.transit"
@@ -12,7 +12,7 @@

<x:property key="dpml-metro-control-impl" feature="plugin"
name="debugger.uri"/>

- <registry xmlns="plugin:dpml/metro/dpml-metro-builder-impl">
+ <catalog xmlns="plugin:dpml/metro/dpml-metro-builder-impl">
<type class="net.dpml.test.hello.impl.HelloComponent">
<controls>
<control name="debugger" uri="${debugger.uri}"/>
@@ -21,7 +21,7 @@
<component key="OutputHandler"
class="net.dpml.test.hello.impl.DefaultOutputHandler"/>
</parts>
</type>
- </registry>
+ </catalog>

</target>


Modified: development/laboratory/plus/test/example/part/build.xml
==============================================================================
--- development/laboratory/plus/test/example/part/build.xml (original)
+++ development/laboratory/plus/test/example/part/build.xml Tue Mar 15
04:14:45 2005
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>

-<!-- example of the creation of a standalone part from an external registry
-->
+<!-- example of the creation of a standalone part from an external catalog
-->

<project name="dpml-test-hello-part" default="install" basedir="."
xmlns:transit="antlib:net.dpml.transit"



  • svn commit: r2080 - in development/laboratory/plus: standard/builder/src/main/net/dpml/metro/builder/impl standard/part/src/main/net/dpml/metro/type test/example/impl test/example/part, mcconnell, 03/14/2005

Archive powered by MHonArc 2.6.24.

Top of Page