You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2006/06/07 13:50:34 UTC
svn commit: r412377 - in
/incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main:
assembly/ assembly/bin.xml bin/ bin/modeler.bat bin/modeler.sh
java/Launcher.java java/org/ resources/META-INF/MANIFEST.MF
Author: aadamchik
Date: Wed Jun 7 04:50:33 2006
New Revision: 412377
URL: http://svn.apache.org/viewvc?rev=412377&view=rev
Log:
script-based launcher
Added:
incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/assembly/
incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/assembly/bin.xml
incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/bin/
incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/bin/modeler.bat (with props)
incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/bin/modeler.sh
incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/java/Launcher.java
- copied, changed from r412338, incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/java/org/apache/cayenne/modeler/launcher/Launcher.java
Removed:
incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/java/org/
Modified:
incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/resources/META-INF/MANIFEST.MF
Added: incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/assembly/bin.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/assembly/bin.xml?rev=412377&view=auto
==============================================================================
--- incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/assembly/bin.xml (added)
+++ incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/assembly/bin.xml Wed Jun 7 04:50:33 2006
@@ -0,0 +1 @@
+<!--
Assembles a super-jar application that contains a plugin environment
launcher and a minimal set of Modeler plugins.
* To create a distro do "mvn package assembly:assembly"
* To create a local assembly do "mvn package assembly:directory"
-->
<assembly>
<id>core</id>
<formats>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>plugin-launcher/src/main/bin</directory>
<outputDirectory>/</outputDirectory>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
<moduleSets>
<!-- Startup Jar -->
<moduleSet>
<includes>
<include>org.apache.cayenne:plugin-launcher</include>
</includes>
<binaries>
<outputDirectory>/lib</outputDirectory>
<includeDependencies>true</includeDependencies>
<unpack>false</
unpack>
</binaries>
</moduleSet>
<!-- Core Modeler Plugins -->
<moduleSet>
<includes>
<include>org.apache.cayenne:swing-plugin</include>
<include>org.apache.cayenne:modeler-plugin</include>
</includes>
<binaries>
<outputDirectory>/plugins/${groupId}_${artifactId}_${version}</outputDirectory>
<includeDependencies>true</includeDependencies>
<unpack>false</unpack>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
\ No newline at end of file
Added: incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/bin/modeler.bat
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/bin/modeler.bat?rev=412377&view=auto
==============================================================================
--- incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/bin/modeler.bat (added)
+++ incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/bin/modeler.bat Wed Jun 7 04:50:33 2006
@@ -0,0 +1,61 @@
+@echo off
+
+rem -------------------------------------------------------------------
+rem Windows batch script to run Cayenne Modeler
+rem
+rem Certain parts are modeled after Tomcat startup scrips,
+rem Copyright Apache Software Foundation
+rem -------------------------------------------------------------------
+
+rem -------------------------------------------------------------------
+rem Variables:
+rem -------------------------------------------------------------------
+
+rem -------------------------------------------------------------------
+rem Known problems:
+rem
+rem If you get an "Out Of Environment Space" error under win9x,
+rem try replacing reference to MAIN_CLASS, JAVACMD, and DEFAULT_CLASSPATH
+rem with the literal contents of those values,
+rem or raise your default environment space from 256 characters to 4096 characters.
+rem -------------------------------------------------------------------
+
+set MAIN_CLASS=org.objectstyle.cayenne.modeler.Main
+
+set CLASSPATH=
+
+if not "%JAVA_HOME%" == "" goto check_cayenne_home
+echo Please define JAVA_HOME to point to your JSDK installation.
+goto eof
+
+
+:check_cayenne_home
+if not "%CAYENNE_HOME%" == "" goto got_home
+set CAYENNE_HOME=..
+
+:got_home
+if exist "%CAYENNE_HOME%\bin\modeler.bat" goto check_cp
+echo Please define CAYENNE_HOME to point to your Cayenne installation.
+goto eof
+
+
+:check_cp
+set JAVACMD=%JAVA_HOME%\bin\javaw
+set DEFAULT_CLASSPATH=%CAYENNE_HOME%\lib\modeler\cayenne-modeler.jar
+
+:run_modeler
+
+if "%os%" == "" goto win9x
+goto winNT
+
+:win9x
+start "%JAVACMD%" -cp "%DEFAULT_CLASSPATH%" %MAIN_CLASS% %*
+goto end
+
+:winNT
+start "CayenneModeler" "%JAVACMD%" -cp "%DEFAULT_CLASSPATH%" %MAIN_CLASS% %*
+goto end
+
+:end
+
+:eof
Propchange: incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/bin/modeler.bat
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/bin/modeler.sh
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/bin/modeler.sh?rev=412377&view=auto
==============================================================================
--- incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/bin/modeler.sh (added)
+++ incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/bin/modeler.sh Wed Jun 7 04:50:33 2006
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+# Bourne shell script to start Cayenne Modeler.
+#
+# Certain parts are modeled after Tomcat startup scrips,
+# Copyright Apache Software Foundation
+
+MAIN_CLASS=Launcher
+
+CLASSPATH=
+
+# OS specific support.
+cygwin=false
+case "`uname`" in
+CYGWIN*) cygwin=true;;
+esac
+
+PATH_SEPARATOR=:
+if [ "$cygwin" = "true" ] ; then
+ PATH_SEPARATOR=";"
+fi
+
+# Guess from startup directory
+# if [ "$CAYENNE_HOME" = "" ] ; then
+ # resolve links - $0 may be a softlink
+ PRG="$0"
+
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+ done
+
+ CAYENNE_HOME=`dirname "$PRG"`
+#fi
+
+
+if [ ! -f $CAYENNE_HOME/modeler.sh ] ; then
+ echo "Please define CAYENNE_HOME to point to your Cayenne installation."
+ exit 1
+fi
+
+# Guess Java location from PATH or from JAVA_HOME
+if [ "$JAVA_HOME" = "" ] ; then
+ JAVACMD=java
+else
+ JAVACMD=$JAVA_HOME/bin/java
+ if [ ! -f $JAVACMD ] ; then
+ JAVACMD=$JAVA_HOME/jre/bin/java
+ fi
+fi
+
+CAYENNE_MODELER_JAR_PATH="`ls $CAYENNE_HOME/lib/plugin-launcher*.jar`"
+echo $CAYENNE_MODELER_JAR_PATH
+if [ "$cygwin" = "true" ] ; then
+ CAYENNE_CLASSPATH=`cygpath -w $CAYENNE_MODELER_JAR_PATH`
+else
+ CAYENNE_CLASSPATH=$CAYENNE_MODELER_JAR_PATH
+fi
+
+OPTIONS="-classpath $CAYENNE_CLASSPATH"
+PROPERTIES="-Dplatonos.plugins.dirs=$CAYENNE_HOME/plugins"
+
+# Mac OS X Specific properties
+if [ -d /System/Library/Frameworks/JavaVM.framework ]; then
+ PROP1="-Dcom.apple.mrj.application.apple.menu.about.name=CayenneModeler"
+ PROP2="-Dapple.laf.useScreenMenuBar=true"
+ PROP3="-Xdock:name=CayenneModeler"
+ PROP4="-Xdock:icon=${CAYENNE_HOME}/bin/icon.ico"
+
+ PROPERTIES="$PROPERTIES $PROP1 $PROP2 $PROP3 $PROP4"
+fi
+
+# Start the Modeler
+CMD="$JAVACMD $OPTIONS $PROPERTIES $MAIN_CLASS $@ &"
+echo $CMD
+echo
+
+$CMD
Copied: incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/java/Launcher.java (from r412338, incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/java/org/apache/cayenne/modeler/launcher/Launcher.java)
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/java/Launcher.java?p2=incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/java/Launcher.java&p1=incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/java/org/apache/cayenne/modeler/launcher/Launcher.java&r1=412338&r2=412377&rev=412377&view=diff
==============================================================================
--- incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/java/org/apache/cayenne/modeler/launcher/Launcher.java (original)
+++ incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/java/Launcher.java Wed Jun 7 04:50:33 2006
@@ -1,25 +1,11 @@
-/*
- * Copyright 2006 The Apache Software Foundation
- *
- * 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 org.apache.cayenne.modeler.launcher;
+
+import java.io.File;
import java.util.Iterator;
-import java.util.Locale;
import java.util.StringTokenizer;
import org.platonos.pluginengine.Plugin;
+import org.platonos.pluginengine.PluginEngine;
import org.platonos.pluginengine.logging.LoggerLevel;
/**
@@ -27,55 +13,41 @@
*/
public class Launcher {
- public static final String COMMAND_LINE_ATTRIBUTE = "command.line";
-
- static final String ENGINE_NAME = "Cayenne Plugin Engine";
-
/**
* A property specifying a location of the plugins directory. It can be a comma
- * separated list of directories. If not set, current directory is used.
+ * separated list of directories. If not set, {@link #PLUGINS_DIR_DEFAULT} directory
+ * is used.
*/
- public static final String PLUGINS_DIR_PROPERTY = "cayenne.plugins.dirs";
+ public static final String PLUGINS_DIR_PROPERTY = "platonos.plugins.dirs";
+ public static final String PLUGINS_DIR_DEFAULT = "plugins";
- public static final String LOCALE_PROPERTY = "cayenne.ui.locale";
+ /**
+ * A property specifying the name of the PluginEngine (same as the name of the
+ * application). If not set, {@link #ENGINE_NAME_DEFAULT} directory is used.
+ */
+ public static final String ENGINE_NAME_PROPERTY = "platonos.engine.name";
+ public static final String ENGINE_NAME_DEFAULT = "Platonos Plugin Engine";
public static void main(String[] args) {
- CayennePluginEngine pluginEngine = new CayennePluginEngine(ENGINE_NAME);
- pluginEngine.setAttribute(COMMAND_LINE_ATTRIBUTE, args);
-
- // set default locale
- String locale = System.getProperty(LOCALE_PROPERTY);
- if (locale != null) {
-
- StringTokenizer toks = new StringTokenizer(locale, "_");
-
- if (toks.hasMoreTokens()) {
- // note that default local parts must be empty strings, not nulls...
- String language = "";
- String country = "";
- String variant = "";
-
- language = toks.nextToken();
+ String engineName = System.getProperty(ENGINE_NAME_PROPERTY);
+ if (engineName == null) {
+ engineName = ENGINE_NAME_DEFAULT;
+ }
- if (toks.hasMoreTokens()) {
- country = toks.nextToken();
+ PluginEngine pluginEngine = new PluginEngine(engineName);
+ pluginEngine.setAttribute(PluginEngine.COMMAND_LINE_ATTRIBUTE, args);
- if (toks.hasMoreTokens()) {
- variant = toks.nextToken();
- }
- }
+ // load plugins...
+ String pluginDirectories = System.getProperty(PLUGINS_DIR_PROPERTY);
- Locale.setDefault(new Locale(language, country, variant));
+ if (pluginDirectories == null) {
+ File defaultDir = new File(PLUGINS_DIR_DEFAULT);
+ if (defaultDir.isDirectory()) {
+ pluginDirectories = defaultDir.getAbsolutePath();
}
-
}
- // load plugins from ClassPath
- pluginEngine.loadBundledPlugins();
-
- // load plugins from extra directories
- String pluginDirectories = System.getProperty(PLUGINS_DIR_PROPERTY);
if (pluginDirectories != null) {
StringTokenizer toks = new StringTokenizer(pluginDirectories, ",");
while (toks.hasMoreTokens()) {
Modified: incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/resources/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/resources/META-INF/MANIFEST.MF?rev=412377&r1=412376&r2=412377&view=diff
==============================================================================
--- incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/resources/META-INF/MANIFEST.MF (original)
+++ incubator/cayenne/main/branches/PROTO-3.0/modeler/plugin-launcher/src/main/resources/META-INF/MANIFEST.MF Wed Jun 7 04:50:33 2006
@@ -1,2 +1,2 @@
-Main-Class: org.apache.cayenne.modeler.launcher.Launcher
+Main-Class: Launcher
Class-Path: plugin-engine-1.1-SNAPSHOT.jar