felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r939695 - in /felix/trunk/karaf: admin/core/src/main/java/org/apache/felix/karaf/admin/internal/ assembly/src/main/distribution/text/lib/ assembly/src/main/distribution/text/lib/endorsed/ assembly/src/main/distribution/text/lib/ext/ assembl...
Date Fri, 30 Apr 2010 14:49:12 GMT
Author: gnodet
Date: Fri Apr 30 14:49:11 2010
New Revision: 939695

URL: http://svn.apache.org/viewvc?rev=939695&view=rev
Log:
FELIX-2312: Support for ext and endorsed directories

Added:
    felix/trunk/karaf/assembly/src/main/distribution/text/lib/
    felix/trunk/karaf/assembly/src/main/distribution/text/lib/README
    felix/trunk/karaf/assembly/src/main/distribution/text/lib/endorsed/
    felix/trunk/karaf/assembly/src/main/distribution/text/lib/endorsed/README
    felix/trunk/karaf/assembly/src/main/distribution/text/lib/ext/
    felix/trunk/karaf/assembly/src/main/distribution/text/lib/ext/README
Modified:
    felix/trunk/karaf/admin/core/src/main/java/org/apache/felix/karaf/admin/internal/InstanceImpl.java
    felix/trunk/karaf/assembly/src/main/distribution/unix-shell/bin/karaf
    felix/trunk/karaf/assembly/src/main/distribution/windows-text/bin/karaf.bat

Modified: felix/trunk/karaf/admin/core/src/main/java/org/apache/felix/karaf/admin/internal/InstanceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/admin/core/src/main/java/org/apache/felix/karaf/admin/internal/InstanceImpl.java?rev=939695&r1=939694&r2=939695&view=diff
==============================================================================
--- felix/trunk/karaf/admin/core/src/main/java/org/apache/felix/karaf/admin/internal/InstanceImpl.java
(original)
+++ felix/trunk/karaf/admin/core/src/main/java/org/apache/felix/karaf/admin/internal/InstanceImpl.java
Fri Apr 30 14:49:11 2010
@@ -163,12 +163,14 @@ public class InstanceImpl implements Ins
         String command = new File(System.getProperty("java.home"), ScriptUtils.isWindows()
? "bin\\java.exe" : "bin/java").getCanonicalPath()
                 + " " + javaOpts
                 + " -Djava.util.logging.config.file=\"" + new File(location, "etc/java.util.logging.properties").getCanonicalPath()
+ "\""
+                + " -Djava.endorsed.dirs=\"" + new File(new File(System.getProperty("java.home"),
"lib"), "endorsed") + System.getProperty("path.separator") + new File(libDir, "endorsed").getCanonicalPath()
+ "\""
+                + " -Djava.ext.dirs=\"" + new File(new File(System.getProperty("java.home"),
"lib"), "ext") + System.getProperty("path.separator") + new File(libDir, "ext").getCanonicalPath()
+ "\""
                 + " -Dkaraf.home=\"" + System.getProperty("karaf.home") + "\""
                 + " -Dkaraf.base=\"" + new File(location).getCanonicalPath() + "\""
                 + " -Dkaraf.startLocalConsole=false"
                 + " -Dkaraf.startRemoteShell=true"
                 + " -classpath " + classpath.toString()
-                + " org.apache.felix.karaf.main.Bootstrap";
+                + " org.apache.felix.karaf.main.Main";
         LOG.debug("Starting instance " + name + " with command: " + command);
         this.process = ProcessBuilderFactory.newInstance().newBuilder()
                         .directory(new File(location))

Added: felix/trunk/karaf/assembly/src/main/distribution/text/lib/README
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/assembly/src/main/distribution/text/lib/README?rev=939695&view=auto
==============================================================================
--- felix/trunk/karaf/assembly/src/main/distribution/text/lib/README (added)
+++ felix/trunk/karaf/assembly/src/main/distribution/text/lib/README Fri Apr 30 14:49:11 2010
@@ -0,0 +1,27 @@
+################################################################################
+#
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You 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.
+#
+################################################################################
+
+This directory is the standard java classpath directory.
+Any jar in this folder will be part of the main classloader used to load Karaf.
+However, in OSGi, classes defined in this jar won't be available to other bundles
+unless one of the org.osgi.framework.system.packages.extra or
+org.osgi.framework.bootdelegation property in the etc/config.properties file
+is modified to export or delegate the packages.
+Please refer to the OSGi Core Specification for more informations on those
+properties and the OSGi classloading mechanism.
\ No newline at end of file

Added: felix/trunk/karaf/assembly/src/main/distribution/text/lib/endorsed/README
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/assembly/src/main/distribution/text/lib/endorsed/README?rev=939695&view=auto
==============================================================================
--- felix/trunk/karaf/assembly/src/main/distribution/text/lib/endorsed/README (added)
+++ felix/trunk/karaf/assembly/src/main/distribution/text/lib/endorsed/README Fri Apr 30 14:49:11
2010
@@ -0,0 +1,23 @@
+################################################################################
+#
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You 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.
+#
+################################################################################
+
+This directory is the java endorsed directory.
+Any jar in this folder will be used to override classes defined by the JVM.
+For more informations, see:
+   http://java.sun.com/j2se/1.5.0/docs/guide/standards/
\ No newline at end of file

Added: felix/trunk/karaf/assembly/src/main/distribution/text/lib/ext/README
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/assembly/src/main/distribution/text/lib/ext/README?rev=939695&view=auto
==============================================================================
--- felix/trunk/karaf/assembly/src/main/distribution/text/lib/ext/README (added)
+++ felix/trunk/karaf/assembly/src/main/distribution/text/lib/ext/README Fri Apr 30 14:49:11
2010
@@ -0,0 +1,23 @@
+################################################################################
+#
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You 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.
+#
+################################################################################
+
+This directory is the java extension directory.
+Any jar in this folder will be used as a JVM extension.
+For more informations, see
+   http://java.sun.com/j2se/1.5.0/docs/guide/extensions/spec.html
\ No newline at end of file

Modified: felix/trunk/karaf/assembly/src/main/distribution/unix-shell/bin/karaf
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/assembly/src/main/distribution/unix-shell/bin/karaf?rev=939695&r1=939694&r2=939695&view=diff
==============================================================================
--- felix/trunk/karaf/assembly/src/main/distribution/unix-shell/bin/karaf (original)
+++ felix/trunk/karaf/assembly/src/main/distribution/unix-shell/bin/karaf Fri Apr 30 14:49:11
2010
@@ -144,6 +144,24 @@ setupNativePath() {
     export LD_LIBRARY_PATH
 }
 
+pathCanonicalSimple() {
+	local dst="${1}"
+	cd -P -- "$(dirname -- "${dst}")" &> /dev/null && echo "$(pwd -P)/$(basename
-- "${dst}")"
+}
+
+pathCanonical() {
+	local dst=`pathCanonicalSimple "${1}"`
+	while [[ -h "${dst}" ]]; do
+		local linkDst="$(ls -l "${dst}" | sed -e 's/^.*[[:space:]]*->[[:space:]]*\(.*\)[[:space:]]*$/\1/g')"
+		if [[ -z "$(echo "${linkDst}" | grep -E '^/')" ]]; then
+			# relative link destination
+			linkDst="$(dirname "${dst}")/${linkDst}"
+		fi
+		dst=`pathCanonicalSimple "${linkDst}"`
+	done
+	echo "${dst}"
+}
+
 locateJava() {
     # Setup the Java Virtual Machine
     if $cygwin ; then
@@ -151,10 +169,10 @@ locateJava() {
         [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
     fi
 
+	if [ "x$JAVA_HOME" = "x" ] && [ "$darwin" = "true" ]; then
+		JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
+	fi
     if [ "x$JAVA" = "x" ]; then
-        if [ "x$JAVA_HOME" = "x" ] && [ "$darwin" = "true" ]; then
-            JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
-        fi
         if [ "x$JAVA_HOME" != "x" ]; then
             if [ ! -d "$JAVA_HOME" ]; then
                 die "JAVA_HOME is not valid: $JAVA_HOME"
@@ -162,9 +180,15 @@ locateJava() {
             JAVA="$JAVA_HOME/bin/java"
         else
             warn "JAVA_HOME not set; results may vary"
-            JAVA="java"
+            JAVA=`which java`
+            if [ "x$JAVA" = "x" ]; then
+                die "java command not found"
+            fi
         fi
     fi
+    if [ "x$JAVA_HOME" = "x" ]; then
+        JAVA_HOME=$(dirname $(pathCanonical "$JAVA"))
+    fi
 }
 
 detectJVM() {
@@ -291,7 +315,7 @@ run() {
         CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
     fi
     cd $KARAF_BASE
-    exec $JAVA $JAVA_OPTS -Djava.endorsed.dirs="${KARAF_HOME}/lib/endorsed" -Dstorage.location="${KARAF_HOME}/instances"
-Dkaraf.home="$KARAF_HOME" -Dkaraf.base="$KARAF_BASE" -Djava.util.logging.config.file=$KARAF_BASE/etc/java.util.logging.properties
$OPTS -classpath "$CLASSPATH" $MAIN "$@"
+    exec $JAVA $JAVA_OPTS -Djava.endorsed.dirs="${JAVA_HOME}/lib/endorsed:${KARAF_HOME}/lib/endorsed"
-Djava.ext.dirs="${JAVA_HOME}/lib/ext:${KARAF_HOME}/lib/ext" -Dstorage.location="${KARAF_HOME}/instances"
-Dkaraf.home="$KARAF_HOME" -Dkaraf.base="$KARAF_BASE" -Djava.util.logging.config.file=$KARAF_BASE/etc/java.util.logging.properties
$OPTS -classpath "$CLASSPATH" $MAIN "$@"
 }
 
 main() {

Modified: felix/trunk/karaf/assembly/src/main/distribution/windows-text/bin/karaf.bat
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/assembly/src/main/distribution/windows-text/bin/karaf.bat?rev=939695&r1=939694&r2=939695&view=diff
==============================================================================
--- felix/trunk/karaf/assembly/src/main/distribution/windows-text/bin/karaf.bat (original)
+++ felix/trunk/karaf/assembly/src/main/distribution/windows-text/bin/karaf.bat Fri Apr 30
14:49:11 2010
@@ -16,9 +16,9 @@ rem    WITHOUT WARRANTIES OR CONDITIONS 
 rem    See the License for the specific language governing permissions and
 rem    limitations under the License.
 rem
-rem 
+rem
 rem $Id: karaf.bat 979 2005-11-30 22:50:55Z bsnyder $
-rem 
+rem
 
 if not "%ECHO%" == "" echo %ECHO%
 
@@ -79,13 +79,81 @@ set PATH=%PATH%;%KARAF_BASE%\lib;%KARAF_
 
 rem Setup the Java Virtual Machine
 if not "%JAVA%" == "" goto :Check_JAVA_END
-    set JAVA=java
-    if "%JAVA_HOME%" == "" call :warn JAVA_HOME not set; results may vary
-    if not "%JAVA_HOME%" == "" set JAVA=%JAVA_HOME%\bin\java
+    if not "%JAVA_HOME%" == "" goto :TryJDKEnd
+        call :warn JAVA_HOME not set; results may vary
+:TryJRE
+    start /w regedit /e __reg1.txt "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment"
+    if not exist __reg1.txt goto :TryJDK
+    type __reg1.txt | find "CurrentVersion" > __reg2.txt
+    if errorlevel 1 goto :TryJDK
+    for /f "tokens=2 delims==" %%x in (__reg2.txt) do set JavaTemp=%%~x
+    if errorlevel 1 goto :TryJDK
+    set JavaTemp=%JavaTemp%##
+    set JavaTemp=%JavaTemp:                ##=##%
+    set JavaTemp=%JavaTemp:        ##=##%
+    set JavaTemp=%JavaTemp:    ##=##%
+    set JavaTemp=%JavaTemp:  ##=##%
+    set JavaTemp=%JavaTemp: ##=##%
+    set JavaTemp=%JavaTemp:##=%
+    del __reg1.txt
+    del __reg2.txt
+    start /w regedit /e __reg1.txt "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\%JavaTemp%"
+    if not exist __reg1.txt goto :TryJDK
+    type __reg1.txt | find "JavaHome" > __reg2.txt
+    if errorlevel 1 goto :TryJDK
+    for /f "tokens=2 delims==" %%x in (__reg2.txt) do set JAVA_HOME=%%~x
+    if errorlevel 1 goto :TryJDK
+    del __reg1.txt
+    del __reg2.txt
+    goto TryJDKEnd
+:TryJDK
+    start /w regedit /e __reg1.txt "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development
Kit"
+    if not exist __reg1.txt (
+        call :warn Unable to retrieve JAVA_HOME
+        goto END
+    )
+    type __reg1.txt | find "CurrentVersion" > __reg2.txt
+    if errorlevel 1 (
+        call :warn Unable to retrieve JAVA_HOME
+        goto END
+    )
+    for /f "tokens=2 delims==" %%x in (__reg2.txt) do set JavaTemp=%%~x
+    if errorlevel 1 (
+        call :warn Unable to retrieve JAVA_HOME
+        goto END
+    )
+    set JavaTemp=%JavaTemp%##
+    set JavaTemp=%JavaTemp:                ##=##%
+    set JavaTemp=%JavaTemp:        ##=##%
+    set JavaTemp=%JavaTemp:    ##=##%
+    set JavaTemp=%JavaTemp:  ##=##%
+    set JavaTemp=%JavaTemp: ##=##%
+    set JavaTemp=%JavaTemp:##=%
+    del __reg1.txt
+    del __reg2.txt
+    start /w regedit /e __reg1.txt "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development
Kit\%JavaTemp%"
+    if not exist __reg1.txt (
+        call :warn Unable to retrieve JAVA_HOME from JDK
+        goto END
+    )
+    type __reg1.txt | find "JavaHome" > __reg2.txt
+    if errorlevel 1 (
+        call :warn Unable to retrieve JAVA_HOME
+        goto END
+    )
+    for /f "tokens=2 delims==" %%x in (__reg2.txt) do set JAVA_HOME=%%~x
+    if errorlevel 1 (
+        call :warn Unable to retrieve JAVA_HOME
+        goto END
+    )
+    del __reg1.txt
+    del __reg2.txt
+:TryJDKEnd
     if not exist "%JAVA_HOME%" (
         call :warn JAVA_HOME is not valid: "%JAVA_HOME%"
         goto END
     )
+    set JAVA=%JAVA_HOME%\bin\java
 :Check_JAVA_END
 
 if "%JAVA_OPTS%" == "" set JAVA_OPTS=%DEFAULT_JAVA_OPTS%
@@ -93,14 +161,14 @@ if "%JAVA_OPTS%" == "" set JAVA_OPTS=%DE
 if "%KARAF_DEBUG%" == "" goto :KARAF_DEBUG_END
     rem Use the defaults if JAVA_DEBUG_OPTS was not set
     if "%JAVA_DEBUG_OPTS%" == "" set JAVA_DEBUG_OPTS=%DEFAULT_JAVA_DEBUG_OPTS%
-    
+
     set "JAVA_OPTS=%JAVA_DEBUG_OPTS% %JAVA_OPTS%"
     call :warn Enabling Java debug options: %JAVA_DEBUG_OPTS%
 :KARAF_DEBUG_END
 
 if "%KARAF_PROFILER%" == "" goto :KARAF_PROFILER_END
     set KARAF_PROFILER_SCRIPT=%KARAF_HOME%\conf\profiler\%KARAF_PROFILER%.cmd
-    
+
     if exist "%KARAF_PROFILER_SCRIPT%" goto :KARAF_PROFILER_END
     call :warn Missing configuration for profiler '%KARAF_PROFILER%': %KARAF_PROFILER_SCRIPT%
     goto END
@@ -143,7 +211,7 @@ if "%KARAF_PROFILER%" == "" goto :RUN
 
 :EXECUTE_CONSOLE
     SET SHIFT=true
-    goto :EXECUTE    
+    goto :EXECUTE
 
 :EXECUTE_SERVER
     SET OPTS=-Dkaraf.startLocalConsole=false -Dkaraf.startRemoteShell=true
@@ -157,10 +225,10 @@ if "%KARAF_PROFILER%" == "" goto :RUN
 
 :EXECUTE
     if "%SHIFT%" == "true" SET ARGS=%2 %3 %4 %5 %6 %7 %8
-    if not "%SHIFT%" == "true" SET ARGS=%1 %2 %3 %4 %5 %6 %7 %8    
+    if not "%SHIFT%" == "true" SET ARGS=%1 %2 %3 %4 %5 %6 %7 %8
     rem Execute the Java Virtual Machine
-    cd %KARAF_BASE% 
-    "%JAVA%" %JAVA_OPTS% %OPTS% -classpath "%CLASSPATH%" -Dstorage.location="%KARAF_HOME%\instances"
-Dkaraf.home="%KARAF_HOME%" -Dkaraf.base="%KARAF_BASE%" -Djava.util.logging.config.file="%KARAF_BASE%\etc\java.util.logging.properties"
%MAIN% %ARGS%
+    cd %KARAF_BASE%
+    "%JAVA%" %JAVA_OPTS% %OPTS% -classpath "%CLASSPATH%" -Djava.endorsed.dirs="%JAVA_HOME%\lib\endorsed;%KARAF_HOME%\lib\endorsed"
-Djava.ext.dirs="%JAVA_HOME%\lib\ext;%KARAF_HOME%\lib\ext" -Dstorage.location="%KARAF_HOME%\instances"
-Dkaraf.home="%KARAF_HOME%" -Dkaraf.base="%KARAF_BASE%" -Djava.util.logging.config.file="%KARAF_BASE%\etc\java.util.logging.properties"
%MAIN% %ARGS%
 
 rem # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 



Mime
View raw message