felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r906932 - in /felix/trunk/karaf/admin/core/src: main/java/org/apache/felix/karaf/admin/internal/ main/resources/org/apache/felix/karaf/admin/bin/ main/resources/org/apache/felix/karaf/admin/etc/ test/java/org/apache/felix/karaf/admin/intern...
Date Fri, 05 Feb 2010 13:34:39 GMT
Author: gnodet
Date: Fri Feb  5 13:34:38 2010
New Revision: 906932

URL: http://svn.apache.org/viewvc?rev=906932&view=rev
Log:
FELIX-2032 (and revert of FELIX-2011):  file host.key is not created or copied in the folder
etc of the new instance(s)

Removed:
    felix/trunk/karaf/admin/core/src/test/resources/etc/org.ops4j.pax.url.mvn.cfg
    felix/trunk/karaf/admin/core/src/test/resources/etc/system.properties
Modified:
    felix/trunk/karaf/admin/core/src/main/java/org/apache/felix/karaf/admin/internal/AdminServiceImpl.java
    felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/karaf
    felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/karaf.bat
    felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/start
    felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/start.bat
    felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/stop
    felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/stop.bat
    felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/org.apache.felix.karaf.shell.cfg
    felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/org.ops4j.pax.url.mvn.cfg
    felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/system.properties
    felix/trunk/karaf/admin/core/src/test/java/org/apache/felix/karaf/admin/internal/AdminServiceImplTest.java

Modified: felix/trunk/karaf/admin/core/src/main/java/org/apache/felix/karaf/admin/internal/AdminServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/admin/core/src/main/java/org/apache/felix/karaf/admin/internal/AdminServiceImpl.java?rev=906932&r1=906931&r2=906932&view=diff
==============================================================================
--- felix/trunk/karaf/admin/core/src/main/java/org/apache/felix/karaf/admin/internal/AdminServiceImpl.java
(original)
+++ felix/trunk/karaf/admin/core/src/main/java/org/apache/felix/karaf/admin/internal/AdminServiceImpl.java
Fri Feb  5 13:34:38 2010
@@ -23,7 +23,6 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintStream;
-import java.net.MalformedURLException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -152,10 +151,10 @@
         copyResourceToDir(karafBase, "etc/users.properties", true);
 
         HashMap<String, String> props = new HashMap<String, String>();
-        props.put("${karaf.name}", name);
-        props.put("${karaf.home}", System.getProperty("karaf.home"));
-        props.put("${karaf.base}", karafBase.getPath());
-        props.put("${karaf.sshPort}", Integer.toString(sshPort));
+        props.put("${SUBST-KARAF-NAME}", name);
+        props.put("${SUBST-KARAF-HOME}", System.getProperty("karaf.home"));
+        props.put("${SUBST-KARAF-BASE}", karafBase.getPath());
+        props.put("${SUBST-SSH-PORT}", Integer.toString(sshPort));
         copyFilteredResourceToDir(karafBase, "etc/system.properties", props);
         copyFilteredResourceToDir(karafBase, "etc/org.apache.felix.karaf.shell.cfg", props);
         if( System.getProperty("os.name").startsWith("Win") ) {
@@ -226,33 +225,11 @@
         saveStorage(storage, new File(storageLocation, STORAGE_FILE), "Admin Service storage");
     }
     
-    private InputStream openKarafHomeFiles(String resource) {
-    	 String home = System.getProperty("karaf.home");
-    	 if (home == null) {
-    		 return null;
-    	 }
-    	 File karafHome = new File(System.getProperty("karaf.home"));
-         File sourceFile = new File(karafHome, resource);
-         InputStream is = null;
-         if (sourceFile.exists()) {
-         	try {
-				is = sourceFile.toURI().toURL().openStream();
-			} catch (Exception e) {
-				// Do nothing here
-			}	
-         }
-         return is;
-    }
-
     private void copyResourceToDir(File target, String resource, boolean text) throws Exception
{
         File outFile = new File(target, resource);
         if( !outFile.exists() ) {
             println(Ansi.ansi().a("Creating file: ").a(Ansi.Attribute.INTENSITY_BOLD).a(outFile.getPath()).a(Ansi.Attribute.RESET).toString());
-            InputStream is = openKarafHomeFiles(resource);
-            if (is == null) {
-            	// copy it from the karaf bundle
-            	is = getClass().getClassLoader().getResourceAsStream("org/apache/felix/karaf/admin/"
+ resource);
-            }
+            InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/felix/karaf/admin/"
+ resource);
             try {
                 if( text ) {
                     // Read it line at a time so that we can use the platform line ending
when we write it out.
@@ -292,10 +269,7 @@
         File outFile = new File(target, resource);
         if( !outFile.exists() ) {
             println(Ansi.ansi().a("Creating file: ").a(Ansi.Attribute.INTENSITY_BOLD).a(outFile.getPath()).a(Ansi.Attribute.RESET).toString());
-            InputStream is = openKarafHomeFiles(resource);
-            if (is == null) {
-            	is = getClass().getClassLoader().getResourceAsStream("org/apache/felix/karaf/admin/"
+ resource);
-            }
+            InputStream is = getClass().getClassLoader().getResourceAsStream("org/apache/felix/karaf/admin/"
+ resource);
             try {
                 // Read it line at a time so that we can use the platform line ending when
we write it out.
                 PrintStream out = new PrintStream(new FileOutputStream(outFile));

Modified: felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/karaf
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/karaf?rev=906932&r1=906931&r2=906932&view=diff
==============================================================================
--- felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/karaf
(original)
+++ felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/karaf
Fri Feb  5 13:34:38 2010
@@ -1,4 +1,5 @@
 #!/bin/sh
+################################################################################
 #
 #    Licensed to the Apache Software Foundation (ASF) under one or more
 #    contributor license agreements.  See the NOTICE file distributed with
@@ -15,11 +16,10 @@
 #    See the License for the specific language governing permissions and
 #    limitations under the License.
 #
-# $Id: karaf 979 2005-11-30 22:50:55Z bsnyder $
-#
+################################################################################
 
-KARAF_HOME=${karaf.home}
-KARAF_BASE=${karaf.base}
+KARAF_HOME=${SUBST-KARAF-HOME}
+KARAF_BASE=${SUBST-KARAF-BASE}
 
 export KARAF_BASE
 exec ${KARAF_HOME}/bin/karaf "$*"

Modified: felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/karaf.bat
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/karaf.bat?rev=906932&r1=906931&r2=906932&view=diff
==============================================================================
--- felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/karaf.bat
(original)
+++ felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/karaf.bat
Fri Feb  5 13:34:38 2010
@@ -19,7 +19,7 @@
 REM =========================================================================
 
 SETLOCAL
-SET KARAF_BASE=${karaf.base}
-SET KARAF_HOME=${karaf.home}
+SET KARAF_HOME=${SUBST-KARAF-HOME}
+SET KARAF_BASE=${SUBST-KARAF-BASE}
 
 %KARAF_HOME%\bin\karaf.bat %*

Modified: felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/start
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/start?rev=906932&r1=906931&r2=906932&view=diff
==============================================================================
--- felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/start
(original)
+++ felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/start
Fri Feb  5 13:34:38 2010
@@ -18,7 +18,8 @@
 #
 ################################################################################
 
-KARAF_HOME=${karaf.home}
+KARAF_HOME=${SUBST-KARAF-HOME}
+KARAF_NAME=${SUBST-KARAF-NAME}
 
-exec ${KARAF_HOME}/bin/admin start ${karaf.name} "$@"
+exec ${KARAF_HOME}/bin/admin start ${KARAF_NAME} "$@"
 

Modified: felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/start.bat
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/start.bat?rev=906932&r1=906931&r2=906932&view=diff
==============================================================================
--- felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/start.bat
(original)
+++ felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/start.bat
Fri Feb  5 13:34:38 2010
@@ -18,6 +18,7 @@
 REM 
 REM =========================================================================
 
-SET KARAF_HOME=${karaf.home}
+SET KARAF_HOME=${SUBST-KARAF-HOME}
+SET KARAF_NAME=${SUBST-KARAF-NAME}
 
-%KARAF_HOME%\bin\admin.bat start ${karaf.name}
+%KARAF_HOME%\bin\admin.bat start %KARAF_NAME%

Modified: felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/stop
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/stop?rev=906932&r1=906931&r2=906932&view=diff
==============================================================================
--- felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/stop
(original)
+++ felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/stop
Fri Feb  5 13:34:38 2010
@@ -18,7 +18,8 @@
 #
 ################################################################################
 
-KARAF_HOME=${karaf.home}
+KARAF_HOME=${SUBST-KARAF-HOME}
+KARAF_NAME=${SUBST-KARAF-NAME}
 
-exec ${KARAF_HOME}/bin/admin stop ${karaf.name} "$@"
+exec ${KARAF_HOME}/bin/admin stop ${KARAF_NAME} "$@"
 

Modified: felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/stop.bat
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/stop.bat?rev=906932&r1=906931&r2=906932&view=diff
==============================================================================
--- felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/stop.bat
(original)
+++ felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/bin/stop.bat
Fri Feb  5 13:34:38 2010
@@ -18,6 +18,7 @@
 REM 
 REM =========================================================================
 
-SET KARAF_HOME=${karaf.home}
+SET KARAF_HOME=${SUBST-KARAF-HOME}
+SET KARAF_NAME=${SUBST-KARAF-NAME}
 
-%KARAF_HOME%\bin\admin.bat stop ${karaf.name}
+%KARAF_HOME%\bin\admin.bat stop %KARAF_NAME%

Modified: felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/org.apache.felix.karaf.shell.cfg
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/org.apache.felix.karaf.shell.cfg?rev=906932&r1=906931&r2=906932&view=diff
==============================================================================
--- felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/org.apache.felix.karaf.shell.cfg
(original)
+++ felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/org.apache.felix.karaf.shell.cfg
Fri Feb  5 13:34:38 2010
@@ -18,6 +18,6 @@
 ################################################################################
 
 #
-startLocalConsole=${karaf.startLocalConsole}
-startRemoteShell=${karaf.startRemoteShell}
-sshPort=${karaf.sshPort}
+sshPort=${SUBST-SSH-PORT}
+sshRealm=karaf
+hostKey=${karaf.base}/etc/host.key

Modified: felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/org.ops4j.pax.url.mvn.cfg
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/org.ops4j.pax.url.mvn.cfg?rev=906932&r1=906931&r2=906932&view=diff
==============================================================================
--- felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/org.ops4j.pax.url.mvn.cfg
(original)
+++ felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/org.ops4j.pax.url.mvn.cfg
Fri Feb  5 13:34:38 2010
@@ -55,8 +55,8 @@
 #
 # The following property value will add the system folder as a repo.
 #
-org.ops4j.pax.url.mvn.defaultRepositories=file:${karaf.home}/system@snapshots, \
-    file:${karaf.base}/system@snapshots
+org.ops4j.pax.url.mvn.defaultRepositories=file:${karaf.home}/${karaf.default.repository}@snapshots,
\
+    file:${karaf.base}/${karaf.default.repository}@snapshots
 
 #
 # Comma separated list of repositories scanned when resolving an artifact.

Modified: felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/system.properties
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/system.properties?rev=906932&r1=906931&r2=906932&view=diff
==============================================================================
--- felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/system.properties
(original)
+++ felix/trunk/karaf/admin/core/src/main/resources/org/apache/felix/karaf/admin/etc/system.properties
Fri Feb  5 13:34:38 2010
@@ -17,7 +17,45 @@
 #
 ################################################################################
 
+#
+# The properties defined in this file will be made available through system
+# properties at the very beginning of the Karaf's boot process.
+#
+
+
+# Log level when the pax-logging service is not available
+# This level will only be used while the pax-logging service bundle
+# is not fully available.
+# To change log levels, please refer to the org.ops4j.pax.logging.cfg file
+# instead.
 org.ops4j.pax.logging.DefaultServiceLog.level=ERROR
-karaf.name=${karaf.name}
+
+#
+# Name of this karaf instance.
+#
+karaf.name=${SUBST-KARAF-NAME}
+
+#
+# Default repository where bundles will be loaded from before using
+# other maven repositories.  For the full maven configuration, see
+# the org.ops4j.pax.url.mvn.cfg file.
+#
 karaf.default.repository=system
+
+#
+# Location of a shell script that will be run when starting a shell
+# session.  This script can be used to create aliases and define
+# additional commands.
+#
+karaf.shell.init.script=${karaf.home}/etc/shell.init.script
+
+#
+# Set this empty property to avoid errors when validating xml documents.
+#
 xml.catalog.files=
+
+#
+# Suppress the bell in the console when hitting backspace to many times
+# for example
+#
+jline.nobell=true

Modified: felix/trunk/karaf/admin/core/src/test/java/org/apache/felix/karaf/admin/internal/AdminServiceImplTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/admin/core/src/test/java/org/apache/felix/karaf/admin/internal/AdminServiceImplTest.java?rev=906932&r1=906931&r2=906932&view=diff
==============================================================================
--- felix/trunk/karaf/admin/core/src/test/java/org/apache/felix/karaf/admin/internal/AdminServiceImplTest.java
(original)
+++ felix/trunk/karaf/admin/core/src/test/java/org/apache/felix/karaf/admin/internal/AdminServiceImplTest.java
Fri Feb  5 13:34:38 2010
@@ -69,11 +69,8 @@
      * //TODO: fix this test so it can run in an IDE
      */
     public void testConfigurationFiles() throws Exception {
-    	try {
         AdminServiceImpl service = new AdminServiceImpl();
         service.setStorageLocation(new File("target/instances/" + System.currentTimeMillis()));
-        File karafHome = new File("target/test-classes");
-        System.setProperty("karaf.home", karafHome.getAbsolutePath());
 
         InstanceSettings settings = new InstanceSettings(8122, getName(), null, null);
         Instance instance = service.createInstance(getName(), settings);
@@ -89,9 +86,6 @@
         assertFileExists(instance.getLocation(), "etc/org.apache.felix.karaf.management.cfg");
         assertFileExists(instance.getLocation(), "etc/org.ops4j.pax.logging.cfg");
         assertFileExists(instance.getLocation(), "etc/org.ops4j.pax.url.mvn.cfg");
-    	} finally {
-    		System.clearProperty("karaf.home");
-    	}
     }
 
     private void assertFileExists(String path, String name) throws IOException {



Mime
View raw message