incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hugh...@apache.org
Subject svn commit: r910270 - in /incubator/aries/trunk: application/ application/application-install/ application/application-install/src/ application/application-install/src/main/ application/application-install/src/main/java/ application/application-install...
Date Mon, 15 Feb 2010 17:21:32 GMT
Author: hughesj
Date: Mon Feb 15 17:21:29 2010
New Revision: 910270

URL: http://svn.apache.org/viewvc?rev=910270&view=rev
Log:
ARIES-163 Simple installer for Aries applications (.eba files).

Run a "mvn install"
cd samples/blog-sample/blog-assembly/target
java org.apache.derby.tools.ij blogDB.sql
java -jar osgi-3.5.0.v20090520.jar -console -clean

Point your web browser at http://localhost:8080/org.apache.aries.samples.blog-servlet

Added:
    incubator/aries/trunk/application/application-install/
    incubator/aries/trunk/application/application-install/pom.xml
    incubator/aries/trunk/application/application-install/src/
    incubator/aries/trunk/application/application-install/src/main/
    incubator/aries/trunk/application/application-install/src/main/java/
    incubator/aries/trunk/application/application-install/src/main/java/org/
    incubator/aries/trunk/application/application-install/src/main/java/org/apache/
    incubator/aries/trunk/application/application-install/src/main/java/org/apache/aries/
    incubator/aries/trunk/application/application-install/src/main/java/org/apache/aries/application/
    incubator/aries/trunk/application/application-install/src/main/java/org/apache/aries/application/install/
    incubator/aries/trunk/application/application-install/src/main/java/org/apache/aries/application/install/EBAInstaller.java
    incubator/aries/trunk/application/application-install/src/main/resources/
    incubator/aries/trunk/application/application-install/src/main/resources/OSGI-INF/
    incubator/aries/trunk/application/application-install/src/main/resources/OSGI-INF/blueprint/
    incubator/aries/trunk/application/application-install/src/main/resources/OSGI-INF/blueprint/app-install.xml
Modified:
    incubator/aries/trunk/application/pom.xml
    incubator/aries/trunk/samples/blog-sample/blog-assembly/pom.xml
    incubator/aries/trunk/samples/blog-sample/blog-assembly/src/main/resources/configuration/config.ini

Added: incubator/aries/trunk/application/application-install/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-install/pom.xml?rev=910270&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-install/pom.xml (added)
+++ incubator/aries/trunk/application/application-install/pom.xml Mon Feb 15 17:21:29 2010
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project>
+    <parent>
+        <artifactId>application</artifactId>
+        <groupId>org.apache.aries.application</groupId>
+        <version>1.0.0-incubating-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.apache.aries.application.install</artifactId>
+    <version>1.0.0-incubating-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+    <name>Apache Aries application installer</name>
+    <description>
+        A very basic application installer
+    </description>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.fileinstall</artifactId>
+            <version>2.0.8</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.testsupport</groupId>
+            <artifactId>org.apache.aries.testsupport.unit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.utils</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+                        <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
+                        <_removeheaders>Ignore-Package,Include-Resource,Private-Package,Bundle-DocURL</_removeheaders>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Added: incubator/aries/trunk/application/application-install/src/main/java/org/apache/aries/application/install/EBAInstaller.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-install/src/main/java/org/apache/aries/application/install/EBAInstaller.java?rev=910270&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-install/src/main/java/org/apache/aries/application/install/EBAInstaller.java
(added)
+++ incubator/aries/trunk/application/application-install/src/main/java/org/apache/aries/application/install/EBAInstaller.java
Mon Feb 15 17:21:29 2010
@@ -0,0 +1,113 @@
+/*
+ * 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 WARRANTIESOR 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.aries.application.install;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.aries.application.management.ApplicationContext;
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.AriesApplicationManager;
+import org.apache.felix.fileinstall.ArtifactInstaller;
+import org.osgi.framework.Version;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class EBAInstaller implements ArtifactInstaller
+{
+
+  private static final Logger LOGGER = LoggerFactory.getLogger(EBAInstaller.class);
+
+  private Map<File, ApplicationContext> appContexts = new HashMap<File, ApplicationContext>();
+
+  private AriesApplicationManager applicationManager;
+
+  public AriesApplicationManager getApplicationManager()
+  {
+    return applicationManager;
+  }
+
+  public void setApplicationManager(AriesApplicationManager applicationManager)
+  {
+    this.applicationManager = applicationManager;
+  }
+
+  public boolean canHandle(File fileToHandlerLocation)
+  {
+    return fileToHandlerLocation.getName().toLowerCase().endsWith(".eba");
+  }
+
+  public void install(File applicationLocation) throws Exception
+  {
+    AriesApplication app = applicationManager
+        .createApplication(applicationLocation.toURI().toURL());
+    
+    String appSymName = app.getApplicationMetadata().getApplicationSymbolicName();
+    Version appVersion = app.getApplicationMetadata().getApplicationVersion();
+
+    LOGGER.debug("created app from {} : {} {} with contents {}", new Object[] {
+        applicationLocation.getName(), appSymName, appVersion,
+        app.getApplicationMetadata().getApplicationContents() });
+
+    ApplicationContext context = applicationManager.install(app);
+
+    LOGGER.debug("installed app {} {} state: {}", new Object[] {
+        appSymName, appVersion,
+        context.getApplicationState() });
+    
+    context.start();
+
+    LOGGER.debug("started app {} {} state: {}", new Object[] {
+        appSymName, appVersion,
+        context.getApplicationState() });
+    
+    // Store the application context away because it is the application context we need
+    // to pass to the application manager if we're later asked to uninstall the application
+    appContexts.put(applicationLocation, context);
+  }
+
+  public void uninstall(File applicationLocation) throws Exception
+  {
+    ApplicationContext context = appContexts.get(applicationLocation);
+    
+    String appSymName = context.getApplication().getApplicationMetadata().getApplicationSymbolicName();
+    Version appVersion = context.getApplication().getApplicationMetadata().getApplicationVersion();
+
+    LOGGER.debug("uninstalling {} {} ", new Object[] {
+        appSymName, appVersion });
+
+    if (context != null) {
+      context.stop();
+      applicationManager.uninstall(context);
+    }
+
+    appContexts.remove(applicationLocation);
+    
+    LOGGER.debug("uninstalled {} {} state: {}", new Object[] {
+        appSymName, appVersion,
+        context.getApplicationState() });
+  }
+
+  public void update(File arg0) throws Exception
+  {
+    throw new UnsupportedOperationException("Updating .eba file is not supported");
+  }
+}

Added: incubator/aries/trunk/application/application-install/src/main/resources/OSGI-INF/blueprint/app-install.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-install/src/main/resources/OSGI-INF/blueprint/app-install.xml?rev=910270&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-install/src/main/resources/OSGI-INF/blueprint/app-install.xml
(added)
+++ incubator/aries/trunk/application/application-install/src/main/resources/OSGI-INF/blueprint/app-install.xml
Mon Feb 15 17:21:29 2010
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+  
+  <reference id="app-manager" interface="org.apache.aries.application.management.AriesApplicationManager"/>
+  
+  <bean id="app-artifact-installer" class="org.apache.aries.application.install.EBAInstaller"
scope="singleton" activation="lazy">
+    <property name="applicationManager" ref="app-manager"/>
+  </bean>
+
+  <service interface="org.apache.felix.fileinstall.ArtifactInstaller" ref="app-artifact-installer"
/>
+  
+</blueprint>

Modified: incubator/aries/trunk/application/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/pom.xml?rev=910270&r1=910269&r2=910270&view=diff
==============================================================================
--- incubator/aries/trunk/application/pom.xml (original)
+++ incubator/aries/trunk/application/pom.xml Mon Feb 15 17:21:29 2010
@@ -188,6 +188,7 @@
 		<module>application-runtime</module>
 		<module>application-itest-interface</module>
 		<module>application-itests</module>
+		<module>application-install</module>
 	</modules>
 
-</project>
\ No newline at end of file
+</project>

Modified: incubator/aries/trunk/samples/blog-sample/blog-assembly/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog-sample/blog-assembly/pom.xml?rev=910270&r1=910269&r2=910270&view=diff
==============================================================================
--- incubator/aries/trunk/samples/blog-sample/blog-assembly/pom.xml (original)
+++ incubator/aries/trunk/samples/blog-sample/blog-assembly/pom.xml Mon Feb 15 17:21:29 2010
@@ -108,7 +108,41 @@
 			<version>1.0.0-incubating-SNAPSHOT</version>
 		</dependency>
 
+		<dependency>
+			<groupId>org.apache.aries.application</groupId>
+			<artifactId>org.apache.aries.application.install</artifactId>
+			<version>1.0.0-incubating-SNAPSHOT</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.fileinstall</artifactId>
+			<version>2.0.8</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.aries.application</groupId>
+			<artifactId>org.apache.aries.application.api</artifactId>
+			<version>1.0.0-incubating-SNAPSHOT</version>
+		</dependency>
 
+		<dependency>
+			<groupId>org.apache.aries.application</groupId>
+			<artifactId>org.apache.aries.application.management</artifactId>
+			<version>1.0.0-incubating-SNAPSHOT</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.aries.application</groupId>
+			<artifactId>org.apache.aries.application.runtime</artifactId>
+			<version>1.0.0-incubating-SNAPSHOT</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.aries.application</groupId>
+			<artifactId>org.apache.aries.application.utils</artifactId>
+			<version>1.0.0-incubating-SNAPSHOT</version>
+		</dependency>
 
 		<dependency>
 			<groupId>org.apache.aries.samples</groupId>
@@ -184,15 +218,40 @@
 					</execution>
 				</executions>
 			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-antrun-plugin</artifactId>
+				<executions>
+					<execution>
+						<phase>package</phase>
+						<goals>
+							<goal>run</goal>
+						</goals>
+						<configuration>
+							<tasks>
+								<zip basedir="${project.build.directory}"
+								     destfile="${project.build.directory}/blog.eba"
+								     includes="blog*.jar"/>
+							</tasks>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+                        <plugin>
+                                <groupId>org.codehaus.mojo</groupId>
+				<artifactId>build-helper-maven-plugin</artifactId>
+                                <executions>
+					<execution>
+					<configuration>
+						<artifact>
+							<file>${project.build.directory}/blog.eba</file>
+							<type>zip</type>
+						</artifact>
+					</configuration>
+					</execution>
+				</executions>
+			</plugin>
 		</plugins>
 	</build>
 
 </project>
-
-        
-
-        
-        
-        
-        
-        

Modified: incubator/aries/trunk/samples/blog-sample/blog-assembly/src/main/resources/configuration/config.ini
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog-sample/blog-assembly/src/main/resources/configuration/config.ini?rev=910270&r1=910269&r2=910270&view=diff
==============================================================================
--- incubator/aries/trunk/samples/blog-sample/blog-assembly/src/main/resources/configuration/config.ini
(original)
+++ incubator/aries/trunk/samples/blog-sample/blog-assembly/src/main/resources/configuration/config.ini
Mon Feb 15 17:21:29 2010
@@ -1,3 +1,3 @@
-osgi.bundles=cm-3.2.0-v20070116.jar@start,services-3.1.200-v20070605.jar@start,pax-logging-api-1.4.jar@start,pax-logging-service-1.4.jar@start,derby-10.5.3.0_1.jar@start,pax-web-jetty-bundle-0.7.2.jar@start,pax-web-extender-war-0.7.2.jar@start,pax-web-jsp-0.7.2.jar@start,org.apache.aries.jndi-1.0.0-incubating-SNAPSHOT.jar@start,org.apache.aries.util-1.0.0-incubating-SNAPSHOT.jar@start,org.apache.aries.blueprint-1.0.0-incubating-SNAPSHOT.jar@start,blog-1.0.0.jar@start,blog-api-1.0.0.jar@start,blog-servlet-1.0.0.jar@start,blog-persistence-1.0.0.jar@start
+osgi.bundles=cm-3.2.0-v20070116.jar@start,services-3.1.200-v20070605.jar@start,pax-logging-api-1.4.jar@start,pax-logging-service-1.4.jar@start,derby-10.5.3.0_1.jar@start,pax-web-jetty-bundle-0.7.2.jar@start,pax-web-extender-war-0.7.2.jar@start,pax-web-jsp-0.7.2.jar@start,org.apache.aries.jndi-1.0.0-incubating-SNAPSHOT.jar@start,org.apache.aries.util-1.0.0-incubating-SNAPSHOT.jar@start,org.apache.aries.blueprint-1.0.0-incubating-SNAPSHOT.jar@start,org.apache.aries.application.install-1.0.0-incubating-SNAPSHOT.jar@start,org.apache.aries.application.management-1.0.0-incubating-SNAPSHOT.jar@start,org.apache.aries.application.api-1.0.0-incubating-SNAPSHOT.jar@start,org.apache.aries.application.utils-1.0.0-incubating-SNAPSHOT.jar@start,org.apache.felix.fileinstall-2.0.8.jar@start,org.apache.aries.application.runtime-1.0.0-incubating-SNAPSHOT.jar@start
 eclipse.ignoreApp=true
-org.ops4j.pax.logging.DefaultServiceLog.level=DEBUG
\ No newline at end of file
+org.ops4j.pax.logging.DefaultServiceLog.level=DEBUG



Mime
View raw message