Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2530 - in development/main: depot/console depot/console/etc/bin depot/console/src/main/net/dpml/depot/console depot/station depot/station/src/main/net/dpml/depot/prefs transit/core/handler

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: r2530 - in development/main: depot/console depot/console/etc/bin depot/console/src/main/net/dpml/depot/console depot/station depot/station/src/main/net/dpml/depot/prefs transit/core/handler
  • Date: Fri, 13 May 2005 10:11:14 +0000

Author: mcconnell AT dpml.net
Date: Fri May 13 10:11:13 2005
New Revision: 2530

Added:
development/main/depot/console/etc/bin/depot
development/main/depot/console/etc/bin/depot-cygwin.sh
development/main/depot/console/etc/bin/depot-unix.sh
development/main/depot/station/src/main/net/dpml/depot/prefs/TODO.TXT
Modified:
development/main/depot/console/build.xml
development/main/depot/console/etc/bin/depot.bat

development/main/depot/console/src/main/net/dpml/depot/console/DepotClassLoader.java
development/main/depot/console/src/main/net/dpml/depot/console/Main.java
development/main/depot/station/build.xml
development/main/transit/core/handler/build.xml
Log:
Update depot scripts and classes to be independent of cache directory.
System level scripting still needs to be addressed.

Modified: development/main/depot/console/build.xml
==============================================================================
--- development/main/depot/console/build.xml (original)
+++ development/main/depot/console/build.xml Fri May 13 10:11:13 2005
@@ -7,15 +7,32 @@
<transit:import uri="artifact:template:dpml/magic/standard"/>

<target name="init" depends="standard.init">
- <property name="depot.w32.main"
value="dpml\depot\jars\dpml-depot-console-${project.version}.jar"/>
- <filter token="DEPOT-PATH-FOR-WINDOWS" value="${depot.w32.main}" />
-
+ <filter token="DEPOT-PATH"
value="dpml-depot-console-${project.version}.jar" />
+ <x:property name="transit.filename" key="dpml-transit-main"
feature="filename"/>
+ <x:property name="station.filename" key="dpml-depot-station"
feature="filename"/>
+ <echo>${station.filename}</echo>
+ <filter token="TRANSIT-MAIN-LIB" value="${transit.filename}" />
+ <filter token="DEPOT-STATION-LIB" value="${station.filename}" />
</target>

<target name="install" depends="standard.install">
<echo>

#----------------------------------------------------------------------------------
-# Updating DPML SYSTEM ${dpml.system}
+# Updating DPML DATA ${dpml.data}/lib
+#----------------------------------------------------------------------------------
+ </echo>
+ <property name="lib" location="${dpml.data}/lib"/>
+ <mkdir dir="${lib}"/>
+ <copy toDir="${lib}">
+ <fileset dir="${basedir}/target/deliverables/jars">
+ <include name="${project.filename}"/>
+ <include name="${project.filename}.md5"/>
+ <include name="${project.filename}.asc"/>
+ </fileset>
+ </copy>
+ <echo>
+#----------------------------------------------------------------------------------
+# Updating DPML SYSTEM ${dpml.system}/bin

#----------------------------------------------------------------------------------
</echo>
<copy todir="${dpml.system}" preservelastmodified="true">

Added: development/main/depot/console/etc/bin/depot
==============================================================================
--- (empty file)
+++ development/main/depot/console/etc/bin/depot Fri May 13 10:11:13
2005
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# Copyright 2004 Niclas Hedhman
+# Copyright 2005 Stephen McConnnell
+#
+# 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.
+
+if [ ! "$DPML_HOME" ]; then
+ DPML_HOME="$HOME/.dpml"
+ export DPML_HOME
+fi
+
+if [ ! "$DPML_SYSTEM" ]; then
+ CWD=`pwd`
+ BIN_DIR=`dirname "$0"`
+ cd "$BIN_DIR"
+ ABSOLUTE_PATH=`pwd`
+ cd "$CWD"
+ DPML_SYSTEM="`dirname "$ABSOLUTE_PATH"`"
+ export DPML_SYSTEM
+fi
+
+# Checking for JAVA_HOME is required on *nix due
+# to some distributions including kaffe in /usr/bin
+#
+
+if [ "$JAVA_HOME" = "" ] ; then
+ echo "ERROR: JAVA_HOME not found in your environment."
+ echo
+ echo "Please, set the JAVA_HOME variable in your environment to match the
location"
+ echo " of the Java Virtual Machine you want to use."
+ echo
+ echo "This requirement is in place to avoid accidental execution of
pre-installed"
+ echo "Java virtual machines on your system, such as kaffe or any outdated
Sun or"
+ echo "Blackdown JVMs. Sorry for the inconvenience."
+ exit 1
+fi
+
+PLATFORM=`uname`
+export PLATFORM
+
+DEOPOT_VERSION="@DEPOT_VERSION@"
+export DEOPOT_VERSION
+
+SECURITY_POLICY=$DPML_SYSTEM/bin/security.policy
+export SECURITY_POLICY
+
+DEPOT_CLASSPATH="$DPML_HOME/data/lib/@DEPOT-PATH@
+export DEPOT_CLASSPATH
+
+if [ `echo $PLATFORM | grep "CYGWIN"` ] ; then
+ exec "$DPML_SYSTEM/bin/depot-cygwin.sh" "$@"
+elif [ `echo $PLATFORM | grep "Linux"` ] ; then
+ exec "$DPML_SYSTEM/bin/depot-unix.sh" "$@"
+else
+ echo "Starting Default Unix script"
+ exec "$DPML_SYSTEM/bin/depot-unix.sh" "$@"
+fi

Added: development/main/depot/console/etc/bin/depot-cygwin.sh
==============================================================================
--- (empty file)
+++ development/main/depot/console/etc/bin/depot-cygwin.sh Fri May 13
10:11:13 2005
@@ -0,0 +1,48 @@
+#! /bin/sh
+#
+# Copyright 2004 Niclas Hedhman
+#
+# 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.
+
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+
+JAVA="$JAVA_HOME/bin/java"
+
+# switch necessary paths to Windows format before running java
+JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
+DPML_HOME=`cygpath --windows "$DPML_HOME"`
+DPML_SYSTEM=`cygpath --windows "$DPML_SYSTEM"`
+DEPOT_CLASSPATH=`cygpath --windows "$DEPOT_CLASSPATH"`
+[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+
+TITLE="Starting Depot $DEPOT_VERSION."
+echo $TITLE
+echo "$TITLE" | sed 's/./=/g'
+echo " Platform: $PLATFORM"
+echo " Java Home: $JAVA_HOME"
+echo " DPML System: $DPML_SYSTEM"
+echo " DPML Home: $DPML_HOME"
+echo " Security policy: $SECURITY_POLICY"
+echo " JVM Options: $DEPOT_JVM_OPTS"
+echo " Depot Classpath: $DEPOT_CLASSPATH"
+echo " Depot Arguments: $DEPOT_ARGS $@"
+echo ""
+
+ARGS="$DEPOT_JVM_OPTS
-Djava.system.class.loader=net.dpml.depot.console.DepotClassLoader
\"-Djava.security.policy=$SECURITY_POLICY\" -classpath \"$DEPOT_CLASSPATH\"
net.dpml.depot.console.Main $DEPOT_ARGS $@"
+
+echo $ARGS | xargs "$JAVA"

Added: development/main/depot/console/etc/bin/depot-unix.sh
==============================================================================
--- (empty file)
+++ development/main/depot/console/etc/bin/depot-unix.sh Fri May 13
10:11:13 2005
@@ -0,0 +1,37 @@
+#! /bin/sh
+#
+# Copyright 2004 Niclas Hedhman
+# 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.
+
+TITLE="Starting Depot $DEPOT_VERSION."
+echo $TITLE
+echo "$TITLE" | sed 's/./=/g'
+echo " Platform: $PLATFORM"
+echo " Java Home: $JAVA_HOME"
+echo " DPML System: $DPML_SYSTEM"
+echo " DPML Home: $DPML_HOME"
+echo " Security policy: $SECURITY_POLICY"
+echo " JVM Options: $DEPOT_JVM_OPTS"
+echo " Depot Classpath: $DEPOT_CLASSPATH"
+echo " Depot Arguments: $DEPOT_ARGS $@"
+echo ""
+
+JAVA="$JAVA_HOME/bin/java"
+
+ARGS="$DEPOT_JVM_OPTS
-Djava.system.class.loader=net.dpml.depot.console.DepotClassLoader
\"-Djava.security.policy=$SECURITY_POLICY\" -classpath \"$DEPOT_CLASSPATH\"
net.dpml.depot.console.Main $DEPOT_ARGS $@"
+
+echo $ARGS | xargs "$JAVA"

Modified: development/main/depot/console/etc/bin/depot.bat
==============================================================================
--- development/main/depot/console/etc/bin/depot.bat (original)
+++ development/main/depot/console/etc/bin/depot.bat Fri May 13 10:11:13
2005
@@ -17,16 +17,15 @@
:SET_DEPOT
if "%DPML_HOME%" == "" set DPML_HOME=%APPDATA%\DPML
if "%DPML_SYSTEM%" == "" set DPML_SYSTEM=%DPML_HOME%\Shared
-if "%DPML_DEPOT_JAR%" == "" set DPML_DEPOT_JAR=@DEPOT-PATH-FOR-WINDOWS@
+if "%DPML_DEPOT_JAR%" == "" set DPML_DEPOT_JAR=@DEPOT-PATH@

-set $CACHED="%DPML_HOME%\Data\cache\%DPML_DEPOT_JAR%"
-set $LIBRARY="%DPML_SYSTEM%\local\%DPML_DEPOT_JAR%"
+set $DEPOT_CLASSPATH="%DPML_HOME%\Data\lib\%DPML_DEPOT_JAR%"
if EXIST %$CACHED% ( set $CLASSPATH=%$CACHED% ) ELSE ( set
$CLASSPATH=%$LIBRARY% )
set $POLICY=-Djava.security.policy="%DPML_SYSTEM%\bin\security.policy"
set $ARGS=%*

:RUN_DEPOT
-%JAVA% -Djava.system.class.loader=net.dpml.depot.console.DepotClassLoader
%$POLICY% %CLASSLOADER% %DEPOT_JVM_OPTS% -classpath %$CLASSPATH%
net.dpml.depot.console.Main %DEPOT_ARGS% %$ARGS%
+%JAVA% -Djava.system.class.loader=net.dpml.depot.console.DepotClassLoader
%$POLICY% %DEPOT_JVM_OPTS% -classpath %$DEPOT_CLASSPATH%
net.dpml.depot.console.Main %DEPOT_ARGS% %$ARGS%
goto EndOfScript
:EndOfScript


Modified:
development/main/depot/console/src/main/net/dpml/depot/console/DepotClassLoader.java
==============================================================================
---
development/main/depot/console/src/main/net/dpml/depot/console/DepotClassLoader.java
(original)
+++
development/main/depot/console/src/main/net/dpml/depot/console/DepotClassLoader.java
Fri May 13 10:11:13 2005
@@ -23,6 +23,8 @@
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.prefs.Preferences;
+import java.util.prefs.BackingStoreException;
+import java.util.Properties;
import java.net.URL;
import java.net.URLClassLoader;

@@ -41,7 +43,7 @@
super( new URL[0], parent );
}

- void setBootstrapClasspath( String classpath ) throws IOException
+ void setProfileClasspathNode( Preferences prefs ) throws
BackingStoreException, IOException
{
if( m_sealed )
{
@@ -49,25 +51,31 @@
"Illegal attempt to modify the bootstrap classpath.";
throw new IllegalStateException( error );
}
- StringTokenizer tokenizer = new StringTokenizer( classpath, ";" );
- while( tokenizer.hasMoreElements() )
+ Properties properties = System.getProperties();
+ String[] keys = prefs.keys();
+ for( int i=0; i<keys.length; i++ )
{
- String path = (String) tokenizer.nextElement();
- URL url = resolveURL( path );
- addURL( url );
+ String key = keys[i];
+ String value = prefs.get( key, null );
+ if( null != value )
+ {
+ URL url = resolveURL( properties, value );
+ addURL( url );
+ }
}
m_sealed = true;
}

- private URL resolveURL( String value ) throws IOException
+ private URL resolveURL( Properties properties, String value ) throws
IOException
{
- if( value.startsWith( "file:" ) || value.startsWith( "http:" ) ||
value.startsWith( "ftp:" ) )
+ String path = PropertyResolver.resolve( properties, value );
+ if( path.startsWith( "file:" ) || path.startsWith( "http:" ) ||
path.startsWith( "ftp:" ) )
{
- return new URL( value );
+ return new URL( path );
}
else
{
- File file = new File( value );
+ File file = new File( path );
return file.toURL();
}
}

Modified:
development/main/depot/console/src/main/net/dpml/depot/console/Main.java
==============================================================================
--- development/main/depot/console/src/main/net/dpml/depot/console/Main.java
(original)
+++ development/main/depot/console/src/main/net/dpml/depot/console/Main.java
Fri May 13 10:11:13 2005
@@ -135,17 +135,9 @@
public static void main( final String[] args )
throws Exception
{
- //
- // Setup system properties.
- //
-
Preferences profile = getProfileFromArgs( args );
-
if( null == profile )
{
- final String error =
- "Commandline argument -profile=[profile-name] was not
supplied.";
- System.err.println( error );
return;
}

@@ -153,22 +145,21 @@
String name = profile.get( "title", profile.name() );
logger.info( "loading " + name );

- String classpath = resolveClasspath( profile );
-
- if( null == classpath )
+ if( false == profile.nodeExists( "classpath" ) )
{
final String error =
- "Requested profile '" + profile + "' does not declare a
classpath.";
+ "Requested profile '" + profile + "' does not declare a
classpath node.";
System.err.println( error );
return;
}
else
{
+ Preferences classpath = profile.node( "classpath" );
ClassLoader system = ClassLoader.getSystemClassLoader();
if( system instanceof DepotClassLoader )
{
DepotClassLoader classloader = (DepotClassLoader) system;
- classloader.setBootstrapClasspath( classpath );
+ classloader.setProfileClasspathNode( classpath );
String classname = resolve( profile.get( "classname", null )
);
if( null == classname )
{
@@ -180,6 +171,7 @@
}
else
{
+
Class c = classloader.loadClass( classname );
setup( profile.node( "properties" ) );
deploy( c, args );
@@ -216,19 +208,6 @@
}
}

- private static String resolveClasspath( Preferences profile )
- {
- String classpath = resolve( profile.get( "classpath", null ) );
- if( null != classpath )
- {
- return classpath;
- }
- else
- {
- return "${dpml.system}/cache/" + DEPOT_STATION_CLASSPATH;
- }
- }
-
private static void deploy( Class c, String[] args ) throws Exception
{
try
@@ -269,19 +248,53 @@
}
}

- private static Preferences getProfileFromArgs( String[] args )
+ private static Preferences getProfileFromArgs( String[] args ) throws
BackingStoreException
{
- Preferences root = Preferences.systemNodeForPackage( Main.class );
+ Preferences root = Preferences.userNodeForPackage( Main.class );
+ Preferences profiles = root.node( "profiles" );
for( int i=0; i<args.length; i++ )
{
String arg = args[i];
- if( arg.startsWith( "-profile=" ) )
+ if( arg.equals( "-profile" ) )
{
- String profile = arg.substring( 9 );
- return root.node( profile );
+ if( i+1 < args.length )
+ {
+ String profile = args[ i+1 ];
+ if( profiles.nodeExists( profile ) )
+ {
+ return profiles.node( profile );
+ }
+ else
+ {
+ final String error =
+ "Unknown profile: " + profile;
+ System.err.println( error );
+ return null;
+ }
+ }
+ else
+ {
+ final String error =
+ "Missing profile name.";
+ System.out.println( error );
+ return null;
+ }
}
}
- return root.node( "prefs" );
+ if( profiles.nodeExists( "prefs" ) )
+ {
+ return profiles.node( "prefs" );
+ }
+ else
+ {
+ Preferences profile = profiles.node( "prefs" );
+ profile.put( "classname", "net.dpml.depot.prefs.Main" );
+ profile.put( "title", "Depot Preferences" );
+ Preferences classpath = profile.node( "classpath" );
+ classpath.put( "dpml-transit-main",
"${dpml.data}/lib/@TRANSIT-MAIN-LIB@" );
+ classpath.put( "dpml-depot-station",
"${dpml.data}/lib/@DEPOT-STATION-LIB@" );
+ return profile;
+ }
}

/**

Modified: development/main/depot/station/build.xml
==============================================================================
--- development/main/depot/station/build.xml (original)
+++ development/main/depot/station/build.xml Fri May 13 10:11:13 2005
@@ -10,4 +10,21 @@
<x:export class="net.dpml.depot.station.DepotDialog"/>
</target>

+ <target name="install" depends="standard.install">
+ <echo>
+#----------------------------------------------------------------------------------
+# Updating DPML DATA ${dpml.data}/lib
+#----------------------------------------------------------------------------------
+ </echo>
+ <property name="lib" location="${dpml.data}/lib"/>
+ <mkdir dir="${lib}"/>
+ <copy toDir="${lib}">
+ <fileset dir="${basedir}/target/deliverables/jars">
+ <include name="${project.filename}"/>
+ <include name="${project.filename}.md5"/>
+ <include name="${project.filename}.asc"/>
+ </fileset>
+ </copy>
+ </target>
+
</project>

Added: development/main/depot/station/src/main/net/dpml/depot/prefs/TODO.TXT
==============================================================================
--- (empty file)
+++ development/main/depot/station/src/main/net/dpml/depot/prefs/TODO.TXT
Fri May 13 10:11:13 2005
@@ -0,0 +1,2 @@
+
+Use the ContentHandlerPanel.java as a generic controller plugin dialog and
dump ContentHandlerControllerPanel.java.
\ No newline at end of file

Modified: development/main/transit/core/handler/build.xml
==============================================================================
--- development/main/transit/core/handler/build.xml (original)
+++ development/main/transit/core/handler/build.xml Fri May 13 10:11:13
2005
@@ -66,6 +66,16 @@
<mkdir dir="target/dist"/>
</target>

- <target name="install" depends="standard.install"/>
+ <target name="install" depends="standard.install">
+ <property name="lib" location="${dpml.data}/lib"/>
+ <mkdir dir="${lib}"/>
+ <copy toDir="${lib}">
+ <fileset dir="${target.deliverables.jars.dir}">
+ <include name="${project.filename}"/>
+ <include name="${project.filename}.md5"/>
+ <include name="${project.filename}.asc"/>
+ </fileset>
+ </copy>
+ </target>

</project>



  • svn commit: r2530 - in development/main: depot/console depot/console/etc/bin depot/console/src/main/net/dpml/depot/console depot/station depot/station/src/main/net/dpml/depot/prefs transit/core/handler, mcconnell, 05/13/2005

Archive powered by MHonArc 2.6.24.

Top of Page