Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2974 - in development/main: depot/install/src/main/net/dpml/depot/install metro

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: r2974 - in development/main: depot/install/src/main/net/dpml/depot/install metro
  • Date: Mon, 04 Jul 2005 22:48:18 -0400

Author: mcconnell AT dpml.net
Date: Mon Jul 4 22:48:18 2005
New Revision: 2974

Added:

development/main/depot/install/src/main/net/dpml/depot/install/HandledException.java

development/main/depot/install/src/main/net/dpml/depot/install/ZipInstaller.java
Modified:

development/main/depot/install/src/main/net/dpml/depot/install/PackageInstaller.java
development/main/metro/module.xml
Log:
Add support for the passing through of command line args to the installer.

Added:
development/main/depot/install/src/main/net/dpml/depot/install/HandledException.java
==============================================================================
--- (empty file)
+++
development/main/depot/install/src/main/net/dpml/depot/install/HandledException.java
Mon Jul 4 22:48:18 2005
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2005 Stephen 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.depot.install;
+
+/**
+ * A null exception thrown following the complete handing of the error
condition
+ * signalling termination of command processing.
+ */
+class HandledException extends Exception
+{
+ HandledException()
+ {
+ super();
+ }
+}

Modified:
development/main/depot/install/src/main/net/dpml/depot/install/PackageInstaller.java
==============================================================================
---
development/main/depot/install/src/main/net/dpml/depot/install/PackageInstaller.java
(original)
+++
development/main/depot/install/src/main/net/dpml/depot/install/PackageInstaller.java
Mon Jul 4 22:48:18 2005
@@ -49,6 +49,7 @@
private final Logger m_logger;
private final TransitRegistryModel m_transit;
private final DepotProfile m_depot;
+ private final String[] m_args;

private boolean m_continue = true;

@@ -70,6 +71,7 @@

m_depot = depot;
m_logger = logger;
+ m_args = args;

TransitStorageHome home = new TransitStorageHome();
m_transit = new DefaultTransitRegistryModel( logger, home );
@@ -77,6 +79,33 @@

public void run()
{
+ //System.out.println( "INSTALL> " );
+ if( m_args.length > 0 )
+ {
+ if( m_args.length == 1 )
+ {
+ m_continue = false;
+ String arg = m_args[0];
+ try
+ {
+ processCommand( arg );
+ }
+ catch( HandledException e )
+ {
+ }
+ catch( Exception e )
+ {
+ System.out.println( e.toString() );
+ }
+ }
+ else
+ {
+ final String error =
+ " ERROR: Invalid command: too many parameters.\n";
+ System.out.println( error );
+ }
+ }
+
while( m_continue )
{
try
@@ -101,6 +130,7 @@

private void processCommand( String command ) throws Exception
{
+ System.out.println( "[" + command + "]" );
if( "exit".equals( command ) )
{
m_continue = false;
@@ -114,6 +144,14 @@
String args = command.substring( "install ".length() );
processInstallCommand( args );
}
+ else if( "magic".equals( command ) )
+ {
+ processInstallCommand( "magic" );
+ }
+ else if( "metro".equals( command ) )
+ {
+ processInstallCommand( "metro" );
+ }
else if( "help".equals( command ) )
{
System.out.println( "\n Depot Installation Manager (Command
Help)" );
@@ -127,7 +165,7 @@
}
else
{
- System.out.println( " Invalid command: " + command );
+ System.out.println( " Invalid command: [" + command + "]" );
}
}

@@ -212,18 +250,8 @@

private void installZipBundle( Artifact artifact ) throws Exception
{
- try
- {
- URL url = artifact.toURL();
- System.out.println( "\n loading: " + url );
- File file = (File) url.getContent( new Class[]{ File.class } );
- System.out.println( " cached to: " + file );
- }
- catch( ArtifactNotFoundException e )
- {
- System.out.println( " Artifact not found.\n" );
- throw new HandledException();
- }
+ ZipInstaller installer = new ZipInstaller( m_logger );
+ installer.install( artifact );
}


//--------------------------------------------------------------------------
@@ -237,12 +265,4 @@
System.out.print( prompt );
return m_INPUT.readLine();
}
-
- private static class HandledException extends Exception
- {
- HandledException()
- {
- super();
- }
- }
}

Added:
development/main/depot/install/src/main/net/dpml/depot/install/ZipInstaller.java
==============================================================================
--- (empty file)
+++
development/main/depot/install/src/main/net/dpml/depot/install/ZipInstaller.java
Mon Jul 4 22:48:18 2005
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2005 Stephen 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.depot.install;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.File;
+import java.net.URL;
+import java.net.URISyntaxException;
+import java.rmi.RemoteException;
+
+import net.dpml.depot.profile.DepotProfile;
+import net.dpml.depot.profile.ApplicationProfile;
+
+import net.dpml.transit.Transit;
+import net.dpml.transit.artifact.Artifact;
+import net.dpml.transit.artifact.ArtifactNotFoundException;
+import net.dpml.transit.artifact.UnsupportedSchemeException;
+import net.dpml.transit.artifact.MissingGroupException;
+import net.dpml.transit.model.TransitRegistryModel;
+import net.dpml.transit.model.Logger;
+import net.dpml.transit.unit.TransitStorageHome;
+import net.dpml.transit.model.DefaultTransitRegistryModel;
+
+/**
+ * Table model that maps table rows to child nodes of a supplied preferences
node.
+ */
+public class ZipInstaller
+{
+
//--------------------------------------------------------------------------
+ // state
+
//--------------------------------------------------------------------------
+
+ private final Logger m_logger;
+
+
//--------------------------------------------------------------------------
+ // constructor
+
//--------------------------------------------------------------------------
+
+ /**
+ * The PackageInstaller class is a plugin that handles the installation
+ * of a target package via commandline instructions.
+ *
+ * @param logger the assigned logging channel
+ * @param artifact the installable artifact
+ */
+ public ZipInstaller( Logger logger ) throws Exception
+ {
+ m_logger = logger;
+ }
+
+ public void install( Artifact artifact ) throws Exception
+ {
+ try
+ {
+ URL url = artifact.toURL();
+ System.out.println( "\n loading: " + url );
+ File file = (File) url.getContent( new Class[]{ File.class } );
+ System.out.println( " cached to: " + file );
+ }
+ catch( ArtifactNotFoundException e )
+ {
+ System.out.println( " Artifact not found.\n" );
+ throw new HandledException();
+ }
+ }
+}

Modified: development/main/metro/module.xml
==============================================================================
--- development/main/metro/module.xml (original)
+++ development/main/metro/module.xml Mon Jul 4 22:48:18 2005
@@ -62,27 +62,29 @@
<copy todir="${local}/${project.group}">
<fileset dir="target/deliverables"/>
</copy>
- <!--
- Add the non-version bin files to the bin directory.
- -->
- <!--
- <copy todir="${share}/bin">
- <fileset dir="${basedir}/main/target/bin"/>
- </copy>
- <chmod file="${share}/bin/metro" perm="755"/>
- -->
- <!--
- Add the javadoc to the dist.
- -->
+
+ <!-- add the javadoc -->
+
<property name="docs.src" location="${basedir}/target/api"/>
<property name="docs.dest"
location="${share}/docs/api/${project.group}/${project.version}"/>
<mkdir dir="${docs.dest}"/>
<copy todir="${docs.dest}">
<fileset dir="${docs.src}"/>
</copy>
- <!--
- Package the bundle into a compressed archive.
- -->
+
+ <!-- zip up a copy of the platform independent bundle for use by depot
-->
+
+ <property name="zip.filename"
+
value="${basedir}/target/deliverables/zips/${project.name}-${project.version}.zip"/>
+ <mkdir dir="target/deliverables/zips"/>
+ <zip destfile="${zip.filename}" whenempty="create">
+ <zipfileset dir="${bundle}">
+ <include name="**/*"/>
+ </zipfileset>
+ </zip>
+
+ <!-- create the standalone distribution -->
+
<x:dist compression="gzip">
<fileset dir="${bundle}">
<include name="*.TXT"/>
@@ -100,9 +102,11 @@
<include name="**/metro"/>
</tarfileset>
</x:dist>
+
</target>

<target name="install" depends="docs,standard.install">
+
<echo>

#----------------------------------------------------------------------------------
# Updating DPML PREFS ${dpml.prefs}
@@ -129,6 +133,7 @@
<copy todir="${export}">
<fileset dir="target/dist"/>
</copy>
+
</target>

<target name="docs" depends="javadocs,junit-report"/>



  • svn commit: r2974 - in development/main: depot/install/src/main/net/dpml/depot/install metro, mcconnell, 07/04/2005

Archive powered by MHonArc 2.6.24.

Top of Page