Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2977 - in development/main/metro/central: . src/main/net/dpml/metro/central

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: r2977 - in development/main/metro/central: . src/main/net/dpml/metro/central
  • Date: Tue, 05 Jul 2005 03:40:45 -0400

Author: mcconnell AT dpml.net
Date: Tue Jul 5 03:40:45 2005
New Revision: 2977

Modified:
development/main/metro/central/build.xml

development/main/metro/central/src/main/net/dpml/metro/central/MetroInstaller.java
Log:
o add installation procedure to assign Metro as the default 'part' content
handler

Modified: development/main/metro/central/build.xml
==============================================================================
--- development/main/metro/central/build.xml (original)
+++ development/main/metro/central/build.xml Tue Jul 5 03:40:45 2005
@@ -9,6 +9,9 @@
<x:filter feature="name" token="NAME"/>
<x:filter feature="version" token="VERSION"/>
<x:filter feature="group" token="GROUP"/>
+ <x:property name="plugin.uri" feature="uri" type="plugin"/>
+ <filter token="PRODUCTION_URI" value="${plugin.uri}"/>
+ <filter token="DEVELOPMENT_URI"
value="link:plugin:${project.group}/${project.name}#LATEST"/>
</target>

<target name="build" depends="standard.build">
@@ -24,7 +27,8 @@

<target name="install" depends="standard.install">
<x:property name="plugin.uri" feature="uri" type="plugin"/>
- <transit:link target="${plugin.uri}"
uri="link:plugin:${project.group}/${project.name}#LATEST"/>
+ <property name="link"
value="${basedir}/target/deliverables/plugins/${project.name}-LATEST.plugin.link"/>
+ <echo file="${link}">${plugin.uri}</echo>
</target>

</project>

Modified:
development/main/metro/central/src/main/net/dpml/metro/central/MetroInstaller.java
==============================================================================
---
development/main/metro/central/src/main/net/dpml/metro/central/MetroInstaller.java
(original)
+++
development/main/metro/central/src/main/net/dpml/metro/central/MetroInstaller.java
Tue Jul 5 03:40:45 2005
@@ -18,21 +18,89 @@

package net.dpml.metro.central;

+import java.net.URI;
+
+import net.dpml.transit.model.ContentModel;
+import net.dpml.transit.model.ContentRegistryModel;
+import net.dpml.transit.model.TransitModel;
import net.dpml.transit.model.TransitRegistryModel;
+import net.dpml.transit.model.UnknownKeyException;

/**
*/
public class MetroInstaller
{
+ private final URI m_production;
+ private final URI m_development;
+
public MetroInstaller( TransitRegistryModel home, Boolean install )
throws Exception
{
+ m_production = new URI( PRODUCTION_PATH );
+ m_development = new URI( DEVELOPMENT_PATH );
+
if( install.booleanValue() )
{
- System.out.println( "## INSTALLING " + getClass().getName() );
+ System.out.println( " adding part content handler to available
Transit profiles" );
+ TransitModel[] models = home.getTransitModels();
+ for( int i=0; i<models.length; i++ )
+ {
+ TransitModel model = models[i];
+ ContentRegistryModel registry =
model.getContentRegistryModel();
+ synchronized( registry )
+ {
+ setContentModel( model, registry );
+ }
+ }
+ }
+ else
+ {
+ System.out.println( " removing part content handler from
Transit profiles" );
+ }
+ }
+
+ private void setContentModel( TransitModel transit, ContentRegistryModel
registry ) throws Exception
+ {
+ String id = transit.getID();
+ URI codebase = selectURI( transit );
+ try
+ {
+ ContentModel model = registry.getContentModel( PART );
+ URI uri = model.getCodeBaseURI();
+ if( codebase.equals( uri ) )
+ {
+ System.out.println( " transit profile " + transit.getID() +
" is uptodate (no change)" );
+ }
+ else
+ {
+ System.out.println( " updating transit profile " +
transit.getID() );
+ model.setCodeBaseURI( codebase );
+ }
+ }
+ catch( UnknownKeyException e )
+ {
+ System.out.println(
+ " adding 'part' content handler to transit profile "
+ + transit.getID() );
+ registry.addContentModel( PART, TITLE, codebase );
+ }
+ }
+
+ private URI selectURI( TransitModel model ) throws Exception
+ {
+ String id = model.getID();
+ if( "development".equals( id ) )
+ {
+ return m_development;
}
else
{
- System.out.println( "## DEINSTALLING " + getClass().getName() );
+ return m_production;
}
}
+
+ private static final String PART = "part";
+ private static final String TITLE = "Part Content Handler";
+ private static final String PRODUCTION_PATH = "@PRODUCTION_URI@";
+ private static final String DEVELOPMENT_PATH = "@DEVELOPMENT_URI@";
+
}



  • svn commit: r2977 - in development/main/metro/central: . src/main/net/dpml/metro/central, mcconnell, 07/05/2005

Archive powered by MHonArc 2.6.24.

Top of Page