You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gn...@apache.org on 2009/08/18 11:38:26 UTC
svn commit: r805333 - in /felix/trunk/karaf: ./ demos/ demos/smx4web/
demos/smx4web/src/main/java/org/apache/servicemix/smx4webex/
demos/smx4web/src/main/webapp/ demos/smx4web/src/main/webapp/WEB-INF/
demos/web/ demos/web/src/ demos/web/src/main/ demos...
Author: gnodet
Date: Tue Aug 18 09:38:26 2009
New Revision: 805333
URL: http://svn.apache.org/viewvc?rev=805333&view=rev
Log:
[karaf] Add the web demo back
Added:
felix/trunk/karaf/demos/web/
felix/trunk/karaf/demos/web/README.txt
- copied, changed from r805305, felix/trunk/karaf/demos/smx4web/README.txt
felix/trunk/karaf/demos/web/pom.xml
felix/trunk/karaf/demos/web/src/
felix/trunk/karaf/demos/web/src/main/
felix/trunk/karaf/demos/web/src/main/java/
felix/trunk/karaf/demos/web/src/main/java/org/
felix/trunk/karaf/demos/web/src/main/java/org/apache/
felix/trunk/karaf/demos/web/src/main/java/org/apache/felix/
felix/trunk/karaf/demos/web/src/main/java/org/apache/felix/karaf/
felix/trunk/karaf/demos/web/src/main/java/org/apache/felix/karaf/web/
felix/trunk/karaf/demos/web/src/main/java/org/apache/felix/karaf/web/WebAppListener.java
- copied, changed from r805305, felix/trunk/karaf/demos/smx4web/src/main/java/org/apache/servicemix/smx4webex/WebAppListener.java
felix/trunk/karaf/demos/web/src/main/webapp/
felix/trunk/karaf/demos/web/src/main/webapp/WEB-INF/
felix/trunk/karaf/demos/web/src/main/webapp/WEB-INF/web.xml
- copied, changed from r805305, felix/trunk/karaf/demos/smx4web/src/main/webapp/WEB-INF/web.xml
felix/trunk/karaf/demos/web/src/main/webapp/index.jsp
- copied, changed from r805305, felix/trunk/karaf/demos/smx4web/src/main/webapp/index.jsp
Removed:
felix/trunk/karaf/demos/smx4web/README.txt
felix/trunk/karaf/demos/smx4web/pom.xml
felix/trunk/karaf/demos/smx4web/src/main/java/org/apache/servicemix/smx4webex/WebAppListener.java
felix/trunk/karaf/demos/smx4web/src/main/webapp/WEB-INF/web.xml
felix/trunk/karaf/demos/smx4web/src/main/webapp/index.jsp
Modified:
felix/trunk/karaf/demos/pom.xml
felix/trunk/karaf/main/src/main/java/org/apache/felix/karaf/main/Bootstrap.java
felix/trunk/karaf/pom.xml
Modified: felix/trunk/karaf/demos/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/demos/pom.xml?rev=805333&r1=805332&r2=805333&view=diff
==============================================================================
--- felix/trunk/karaf/demos/pom.xml (original)
+++ felix/trunk/karaf/demos/pom.xml Tue Aug 18 09:38:26 2009
@@ -27,14 +27,14 @@
<version>1.2.0-SNAPSHOT</version>
</parent>
- <groupId>org.apache.felix.karaf</groupId>
- <artifactId>org.apache.felix.karaf.demos</artifactId>
+ <groupId>org.apache.felix.karaf.demos</groupId>
+ <artifactId>demos</artifactId>
<packaging>pom</packaging>
<version>1.2.0-SNAPSHOT</version>
<name>Apache Felix Karaf :: Demos</name>
<modules>
- <module>smx4web</module>
+ <module>web</module>
</modules>
</project>
Copied: felix/trunk/karaf/demos/web/README.txt (from r805305, felix/trunk/karaf/demos/smx4web/README.txt)
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/demos/web/README.txt?p2=felix/trunk/karaf/demos/web/README.txt&p1=felix/trunk/karaf/demos/smx4web/README.txt&r1=805305&r2=805333&rev=805333&view=diff
==============================================================================
(empty)
Added: felix/trunk/karaf/demos/web/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/demos/web/pom.xml?rev=805333&view=auto
==============================================================================
--- felix/trunk/karaf/demos/web/pom.xml (added)
+++ felix/trunk/karaf/demos/web/pom.xml Tue Aug 18 09:38:26 2009
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+<!--
+
+ 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.
+-->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.felix.karaf.demos</groupId>
+ <artifactId>demos</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.felix.karaf.demos</groupId>
+ <artifactId>web</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Felix Karaf :: Demos :: web</name>
+
+ <properties>
+ <jetty.port>8080</jetty.port>
+ <jetty.version>6.1.12rc1</jetty.version>
+ <geronimo.servlet.version>1.1.2</geronimo.servlet.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix.karaf</groupId>
+ <artifactId>org.apache.felix.karaf.main</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix.karaf.jaas</groupId>
+ <artifactId>org.apache.felix.karaf.jaas.boot</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix.karaf</groupId>
+ <artifactId>apache-felix-karaf</artifactId>
+ <type>zip</type>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1-beta-1</version>
+ <configuration>
+ <warSourceDirectory>src/main/webapp/</warSourceDirectory>
+ <webResources>
+ <resource>
+ <directory>target/karaf</directory>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>${jetty.version}</version>
+ <configuration>
+ <connectors>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>${jetty.port}</port>
+ <maxIdleTime>60000</maxIdleTime>
+ </connector>
+ </connectors>
+ <systemProperties>
+ <!-- enable easy connection to JConsole -->
+ <systemProperty>
+ <name>com.sun.management.jmxremote</name>
+ <value></value>
+ </systemProperty>
+ </systemProperties>
+ <scanIntervalSeconds>10</scanIntervalSeconds>
+ <webAppSourceDirectory>${project.build.directory}/${project.build.finalName}</webAppSourceDirectory>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.0</version>
+ <executions>
+ <execution>
+ <id>unpack-unix</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.felix.karaf</groupId>
+ <artifactId>apache-felix-karaf</artifactId>
+ <type>zip</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/karaf/WEB-INF</outputDirectory>
+ <excludes>**/lib/*,**/*.txt,**/bin/*,**/demos/**,**/lib,**/bin,**/demos</excludes>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.3</version>
+ <executions>
+ <execution>
+ <id>copy-karaf</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <move todir="${project.build.directory}/karaf/WEB-INF/karaf">
+ <fileset dir="${project.build.directory}/karaf/WEB-INF/apache-felix-karaf-${pom.version}"/>
+ </move>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Copied: felix/trunk/karaf/demos/web/src/main/java/org/apache/felix/karaf/web/WebAppListener.java (from r805305, felix/trunk/karaf/demos/smx4web/src/main/java/org/apache/servicemix/smx4webex/WebAppListener.java)
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/demos/web/src/main/java/org/apache/felix/karaf/web/WebAppListener.java?p2=felix/trunk/karaf/demos/web/src/main/java/org/apache/felix/karaf/web/WebAppListener.java&p1=felix/trunk/karaf/demos/smx4web/src/main/java/org/apache/servicemix/smx4webex/WebAppListener.java&r1=805305&r2=805333&rev=805333&view=diff
==============================================================================
--- felix/trunk/karaf/demos/smx4web/src/main/java/org/apache/servicemix/smx4webex/WebAppListener.java (original)
+++ felix/trunk/karaf/demos/web/src/main/java/org/apache/felix/karaf/web/WebAppListener.java Tue Aug 18 09:38:26 2009
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.servicemix.smx4webex;
+package org.apache.felix.karaf.web;
import java.io.File;
@@ -22,6 +22,7 @@
import javax.servlet.ServletContextListener;
import org.apache.felix.karaf.main.Main;
+import org.apache.felix.karaf.main.Bootstrap;
public class WebAppListener implements ServletContextListener {
@@ -30,14 +31,13 @@
public void contextInitialized(ServletContextEvent sce) {
try {
System.err.println("contextInitialized");
- String root = new File(sce.getServletContext().getRealPath("/") + "WEB-INF/servicemix").getAbsolutePath();
+ String root = new File(sce.getServletContext().getRealPath("/") + "WEB-INF/karaf").getAbsolutePath();
System.err.println("Root: " + root);
System.setProperty("karaf.home", root);
System.setProperty("karaf.base", root);
System.setProperty("karaf.startLocalConsole", "false");
System.setProperty("karaf.startRemoteShell", "true");
- main = new Main(new String[0]);
- main.launch();
+ main = Bootstrap.launch(new String[0]);
} catch (Exception e) {
main = null;
e.printStackTrace();
Copied: felix/trunk/karaf/demos/web/src/main/webapp/WEB-INF/web.xml (from r805305, felix/trunk/karaf/demos/smx4web/src/main/webapp/WEB-INF/web.xml)
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/demos/web/src/main/webapp/WEB-INF/web.xml?p2=felix/trunk/karaf/demos/web/src/main/webapp/WEB-INF/web.xml&p1=felix/trunk/karaf/demos/smx4web/src/main/webapp/WEB-INF/web.xml&r1=805305&r2=805333&rev=805333&view=diff
==============================================================================
--- felix/trunk/karaf/demos/smx4web/src/main/webapp/WEB-INF/web.xml (original)
+++ felix/trunk/karaf/demos/web/src/main/webapp/WEB-INF/web.xml Tue Aug 18 09:38:26 2009
@@ -22,11 +22,11 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
- <description>ServiceMix 4 Embedded Example</description>
- <display-name>ServiceMix 4 Embedded Example</display-name>
+ <description>Karaf Embedded Example</description>
+ <display-name>Karaf Embedded Example</display-name>
<listener>
- <listener-class>org.apache.servicemix.smx4webex.WebAppListener</listener-class>
+ <listener-class>org.apache.felix.karaf.web.WebAppListener</listener-class>
</listener>
<welcome-file-list>
Copied: felix/trunk/karaf/demos/web/src/main/webapp/index.jsp (from r805305, felix/trunk/karaf/demos/smx4web/src/main/webapp/index.jsp)
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/demos/web/src/main/webapp/index.jsp?p2=felix/trunk/karaf/demos/web/src/main/webapp/index.jsp&p1=felix/trunk/karaf/demos/smx4web/src/main/webapp/index.jsp&r1=805305&r2=805333&rev=805333&view=diff
==============================================================================
--- felix/trunk/karaf/demos/smx4web/src/main/webapp/index.jsp (original)
+++ felix/trunk/karaf/demos/web/src/main/webapp/index.jsp Tue Aug 18 09:38:26 2009
@@ -16,18 +16,18 @@
--%>
<html>
<head>
-<title>Apache ServiceMix Kernel</title>
+<title>Apache Felix Karaf</title>
</head>
<body>
<h2>Welcome!</h2>
<p>
-Welcome to Apache ServiceMix Kernel web application demo
+Welcome to Apache Karaf web application demo
</p>
<p>
-You can find more information about ServiceMix Kernel on the <a href="http://servicemix.apache.org/kernel">Apache ServiceMix Kernel Site</a>
+You can find more information about Karaf on the <a href="http://felix.apache.org/site/apache-felix-karaf.html">Apache Karaf Site</a>
</p>
</body>
</html>
Modified: felix/trunk/karaf/main/src/main/java/org/apache/felix/karaf/main/Bootstrap.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/main/src/main/java/org/apache/felix/karaf/main/Bootstrap.java?rev=805333&r1=805332&r2=805333&view=diff
==============================================================================
--- felix/trunk/karaf/main/src/main/java/org/apache/felix/karaf/main/Bootstrap.java (original)
+++ felix/trunk/karaf/main/src/main/java/org/apache/felix/karaf/main/Bootstrap.java Tue Aug 18 09:38:26 2009
@@ -35,39 +35,48 @@
public static void main(String[] args) {
try {
- File home = Utils.getKarafHome();
- File file = new File(new File(home, "etc"), FRAMEWORK_PROPERTIES_FILE_NAME);
- if (!file.exists()) {
- throw new FileNotFoundException(file.getAbsolutePath());
- }
- Properties props = new Properties();
- InputStream is = new FileInputStream(file);
- props.load(is);
- is.close();
-
- String framework = props.getProperty(KARAF_FRAMEWORK);
- if (framework == null) {
- throw new IllegalArgumentException("Property " + KARAF_FRAMEWORK + " must be set in the etc/" + FRAMEWORK_PROPERTIES_FILE_NAME + " configuration file");
- }
- String bundle = props.getProperty(KARAF_FRAMEWORK + "." + framework);
- if (bundle == null) {
- throw new IllegalArgumentException("Property " + KARAF_FRAMEWORK + "." + framework + " must be set in the etc/" + FRAMEWORK_PROPERTIES_FILE_NAME + " configuration file");
- }
- File bundleFile = new File(home, bundle);
- if (!bundleFile.exists()) {
- throw new FileNotFoundException(bundleFile.getAbsolutePath());
- }
-
- URLClassLoader classLoader = (URLClassLoader) Bootstrap.class.getClassLoader();
- Method mth = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
- mth.setAccessible(true);
- mth.invoke(classLoader, bundleFile.toURL());
-
+ updateClassLoader();
Main.main(args);
-
} catch (Throwable t) {
t.printStackTrace();
System.exit(-1);
}
}
+
+ public static Main launch(String[] args) throws Exception {
+ updateClassLoader();
+ Main main = new Main(args);
+ main.launch();
+ return main;
+ }
+
+ private static void updateClassLoader() throws Exception {
+ File home = Utils.getKarafHome();
+ File file = new File(new File(home, "etc"), FRAMEWORK_PROPERTIES_FILE_NAME);
+ if (!file.exists()) {
+ throw new FileNotFoundException(file.getAbsolutePath());
+ }
+ Properties props = new Properties();
+ InputStream is = new FileInputStream(file);
+ props.load(is);
+ is.close();
+
+ String framework = props.getProperty(KARAF_FRAMEWORK);
+ if (framework == null) {
+ throw new IllegalArgumentException("Property " + KARAF_FRAMEWORK + " must be set in the etc/" + FRAMEWORK_PROPERTIES_FILE_NAME + " configuration file");
+ }
+ String bundle = props.getProperty(KARAF_FRAMEWORK + "." + framework);
+ if (bundle == null) {
+ throw new IllegalArgumentException("Property " + KARAF_FRAMEWORK + "." + framework + " must be set in the etc/" + FRAMEWORK_PROPERTIES_FILE_NAME + " configuration file");
+ }
+ File bundleFile = new File(home, bundle);
+ if (!bundleFile.exists()) {
+ throw new FileNotFoundException(bundleFile.getAbsolutePath());
+ }
+
+ URLClassLoader classLoader = (URLClassLoader) Bootstrap.class.getClassLoader();
+ Method mth = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
+ mth.setAccessible(true);
+ mth.invoke(classLoader, bundleFile.toURL());
+ }
}
Modified: felix/trunk/karaf/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/pom.xml?rev=805333&r1=805332&r2=805333&view=diff
==============================================================================
--- felix/trunk/karaf/pom.xml (original)
+++ felix/trunk/karaf/pom.xml Tue Aug 18 09:38:26 2009
@@ -44,9 +44,7 @@
<module>management</module>
<module>webconsole</module>
<module>assembly</module>
- <!--
<module>demos</module>
- -->
<module>itests</module>
<module>tooling</module>
</modules>