You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by zo...@apache.org on 2011/02/27 21:02:56 UTC
svn commit: r1075127 [2/7] - in /aries/tags/application-0.2.1: ./
application-api/ application-api/src/ application-api/src/main/
application-api/src/main/java/ application-api/src/main/java/org/
application-api/src/main/java/org/apache/ application-ap...
Added: aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationManager.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationManager.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationManager.java (added)
+++ aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationManager.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,102 @@
+/*
+ * 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.management;
+
+import java.net.URL;
+
+import org.apache.aries.application.filesystem.IDirectory;
+import org.osgi.framework.BundleException;
+
+/**
+ * An AriesApplicationManager service is used to create, install and uninstall Aries
+ * applications.
+ */
+public interface AriesApplicationManager
+{
+ /**
+ * Create an AriesApplication from a local resource.
+ * The application won't be automatically resolved if the
+ * archive does not contain a deployment manifest.
+ *
+ * @param source .eba file, or exploded directory
+ * @return AriesApplication
+ * @throws ManagementException
+ */
+ public AriesApplication createApplication(IDirectory source) throws ManagementException;
+
+ /**
+ * Create an AriesApplication from a remote resource.
+ * The application won't be automatically resolved if the
+ * archive does not contain a deployment manifest.
+ *
+ * @param url
+ * @return
+ * @throws ManagementException
+ */
+ public AriesApplication createApplication(URL url) throws ManagementException;
+
+ /**
+ * Install an AriesApplication - i.e. load its bundles into the runtime, but do
+ * not start them.
+ * If the application is not resolved, a call to {@link #resolve(AriesApplication, ResolveConstraint...)}
+ * will be performed and the resolved application will be installed. In such a case the resolved
+ * application can be obtained by calling {@link org.apache.aries.application.management.AriesApplicationContext#getApplication()}
+ * on the returned ApplicationContext.
+ *
+ * @param app Application to install
+ * @return AriesApplicationContext, a handle to an application in the runtime
+ * @throws BundleException
+ * @throws ManagementException
+ */
+ public AriesApplicationContext install(AriesApplication app) throws BundleException, ManagementException, ResolverException;
+
+ /**
+ * Uninstall an AriesApplication - i.e. unload its bundles from the runtime.
+ * @param app The installed application to uninstall
+ * @throws BundleException
+ */
+ public void uninstall(AriesApplicationContext app) throws BundleException;
+
+ /**
+ * Add an AriesApplicationListener
+ * @param l
+ */
+ public void addApplicationListener(AriesApplicationListener l);
+
+ /**
+ * Remove an AriesApplicationListener
+ * @param l
+ */
+ public void removeApplicationListener(AriesApplicationListener l);
+
+ /**
+ * Resolve an AriesApplication against a set of constraints. Each ResolveConstraint
+ * represents a single proposed change to the content of an application.
+ * If no constraints are given, a default resolution will be performed.
+ *
+ * @param originalApp Original application
+ * @param constraints Constraints
+ * @throws ResolverException
+ * @return New AriesApplication
+ */
+ AriesApplication resolve (AriesApplication originalApp, ResolveConstraint ... constraints)
+ throws ResolverException;
+}
Added: aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationResolver.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationResolver.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationResolver.java (added)
+++ aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationResolver.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,72 @@
+/*
+ * 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.management;
+
+import java.util.Set;
+
+import org.apache.aries.application.ApplicationMetadata;
+import org.osgi.framework.Version;
+
+/**
+ * An {@code AriesApplicationResolver} is a service used by the {@link AriesApplicationManager} when one of the
+ * {@code createApplication} methods are called. It is used to "deploy" the application. The "deploy" process
+ * generates an Aries Deployment manifest <a href="http://incubator.apache.org/aries/applications.html"/>See
+ * the design documentation</a>.
+ *
+ * <p>The {@code AriesApplicationManager} calls the resolve method in order to determine which bundles are required.
+ * </p>
+ */
+public interface AriesApplicationResolver {
+
+ /**
+ * Resolve an AriesApplication. The implementation of this method is expected to do the following:
+ *
+ * <ol>
+ * <li>Extract from the {@link AriesApplication}'s the application's content. This is performed
+ * using the {@link AriesApplication#getApplicationMetadata()} method following by calling
+ * {@link ApplicationMetadata#getApplicationContents()}.
+ * </li>
+ * <li>Resolve the application content using any configured repositories for bundles, and the
+ * bundles that are contained by value inside the application. These bundles can be obtained
+ * by calling {@link AriesApplication#getBundleInfo()}.
+ * </li>
+ * </ol>
+ *
+ * The method returns the set of bundle info objects that should be used.
+ *
+ * @param app The application to resolve
+ * @return The additional bundles required to ensure that the application resolves. This
+ * set will not include those provided by value within the application.
+ * @throws ResolverException if the application cannot be resolved.
+ */
+ Set<BundleInfo> resolve (AriesApplication app, ResolveConstraint... constraints) throws ResolverException ;
+
+ /**
+ * Return the info for the requested bundle. This method is called when installing
+ * an application to determine where the bundle is located in order to install it.
+ *
+ * <p>If no matching bundle exists in the resolver runtime then null is returned.</p>
+ *
+ * @param bundleSymbolicName the bundle symbolic name.
+ * @param bundleVersion the version of the bundle
+ * @return the BundleInfo for the requested bundle, or null if none could be found.
+ */
+ BundleInfo getBundleInfo(String bundleSymbolicName, Version bundleVersion);
+}
Added: aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/BundleConversion.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/BundleConversion.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/BundleConversion.java (added)
+++ aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/BundleConversion.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,45 @@
+/*
+ * 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.management;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.aries.application.ApplicationMetadataFactory;
+
+/**
+ * A BundleConversion represents a .JAR file which has been converted in to
+ * an well-formed OSGi bundle, or a .WAR file which has been converted into a .WAB
+ * file
+ */
+public interface BundleConversion {
+
+ /**
+ * @return The InputStream to the converted bundle.
+ */
+ public InputStream getInputStream() throws IOException;
+
+ /**
+ * @param The ApplicationMetadataFactory used to parse the content of
+ * the converted bundle into a BundleInfo object
+ * @return The bundle information for the converted bundle.
+ */
+ public BundleInfo getBundleInfo(ApplicationMetadataFactory amf) throws IOException;
+}
Added: aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/BundleConverter.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/BundleConverter.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/BundleConverter.java (added)
+++ aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/BundleConverter.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,43 @@
+/*
+ * 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.management;
+
+import java.io.InputStream;
+
+import org.apache.aries.application.filesystem.IDirectory;
+import org.apache.aries.application.filesystem.IFile;
+
+/**
+ * A BundleConverter turns a .jar that is not an OSGi bundle into a well formed OSGi bundle,
+ * or a .war that is not a WAB into a WAB. The first converter to return a non-null result is
+ * taken as having fully converted the bundle.
+ */
+public interface BundleConverter {
+ /**
+ * @param parentEba The root of the eba containing the artifact being converted -
+ * a zip format file with .eba suffix, or an exploded directory.
+ * @param fileInEba The object within the eba to convert
+ * @throws ConversionException if conversion was attempted but failed
+ * @return valid input stream or null if this converter does not support conversion of
+ * this artifact type.
+ */
+ public BundleConversion convert (IDirectory parentEba, IFile fileInEba) throws ConversionException;
+
+}
Added: aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/BundleInfo.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/BundleInfo.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/BundleInfo.java (added)
+++ aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/BundleInfo.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,65 @@
+/*
+ * 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.management;
+
+import java.util.Map;
+import java.util.Set;
+import org.osgi.framework.Version;
+import org.apache.aries.application.Content;
+
+/**
+ * Information about a bundle
+ */
+public interface BundleInfo
+{
+ /** Bundle-SymbolicName */
+ public String getSymbolicName();
+
+ /** Returns the directives specified on the symbolic name */
+ public Map<String, String> getBundleDirectives();
+
+ /** Returns the attributes specified on the symbolic name */
+ public Map<String, String> getBundleAttributes();
+
+ /** Bundle-Version: */
+ public Version getVersion();
+
+ /** Returns a String which can be turned into a URL to the bundle binary */
+ public String getLocation();
+
+ /** Import-Package */
+ public Set<Content> getImportPackage();
+
+ /** Require-Bundle */
+ public Set<Content> getRequireBundle();
+
+ /** Export-Package */
+ public Set<Content> getExportPackage();
+
+ /** Import-Service */
+ public Set<Content> getImportService();
+
+ /** Export-Service */
+ public Set<Content> getExportService();
+
+ /** All the headers in the MANIFEST.MF file */
+ public Map<String, String> getHeaders();
+
+}
Added: aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ConversionException.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ConversionException.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ConversionException.java (added)
+++ aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ConversionException.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,36 @@
+/*
+ * 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.management;
+
+/**
+ * An Exception thrown by a BundleConverter
+ */
+public class ConversionException extends Exception {
+
+ private static final long serialVersionUID = -5921912484821992252L;
+
+ public ConversionException (Exception e) {
+ super(e);
+ }
+
+ public ConversionException (String s) {
+ super(s);
+ }
+}
Added: aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/LocalPlatform.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/LocalPlatform.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/LocalPlatform.java (added)
+++ aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/LocalPlatform.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,44 @@
+/*
+ * 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.management;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * This is a difficult interface to name properly. It holds methods that need to
+ * be implemented on a per-application server platform basis.
+ */
+public interface LocalPlatform {
+
+ /**
+ * Obtain a temporary directory
+ * @return Temporary directory
+ * @throws IOException
+ */
+ public File getTemporaryDirectory() throws IOException;
+
+ /**
+ * Obtain a temporary file
+ * @return Temporary directory
+ * @throws IOException
+ */
+ public File getTemporaryFile() throws IOException;
+}
Added: aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ManagementException.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ManagementException.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ManagementException.java (added)
+++ aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ManagementException.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,36 @@
+/*
+ * 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.management;
+
+/**
+ * An exception thrown by various methods within this package.
+ */
+public class ManagementException extends Exception {
+
+ private static final long serialVersionUID = 6472726820228618243L;
+
+ public ManagementException (Exception e) {
+ super(e);
+ }
+
+ public ManagementException (String s) {
+ super(s);
+ }
+}
Added: aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ResolveConstraint.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ResolveConstraint.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ResolveConstraint.java (added)
+++ aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ResolveConstraint.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,43 @@
+/*
+ * 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.management;
+
+import org.apache.aries.application.VersionRange;
+import org.osgi.framework.Version;
+
+/**
+ * An administrator may wish to change the content of an installed application.
+ * A ResolveConstraint records one of the desired elements of the newly re-resolved
+ * application.
+ */
+public interface ResolveConstraint {
+ /**
+ * The name of the newly required bundle
+ * @return Bundle name
+ */
+ public String getBundleName();
+
+ /**
+ * The version range of the newly required bundle
+ * @return allowed range
+ */
+ public VersionRange getVersionRange();
+
+}
Added: aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ResolverException.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ResolverException.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ResolverException.java (added)
+++ aries/tags/application-0.2.1/application-api/src/main/java/org/apache/aries/application/management/ResolverException.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+package org.apache.aries.application.management;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * Exception thrown by the AriesApplicationResolver interface
+ */
+public class ResolverException extends Exception {
+
+ private static final long serialVersionUID = 8176120468577397671L;
+ private List<String> _unsatisfiedRequirementMessages = new ArrayList<String>();
+
+ /**
+ * Construct from an Exception
+ * @param e
+ */
+ public ResolverException (Exception e) {
+ super(e);
+ }
+ /**
+ * Construct from a String
+ * @param s
+ */
+ public ResolverException (String s) {
+ super(s);
+ }
+
+ public void setUnsatisfiedRequirements (List<String> reqts) {
+ _unsatisfiedRequirementMessages = reqts;
+ }
+ public List<String> getUnsatisfiedRequirements() {
+ return _unsatisfiedRequirementMessages;
+ }
+}
Added: aries/tags/application-0.2.1/application-bundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-bundle/pom.xml?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-bundle/pom.xml (added)
+++ aries/tags/application-0.2.1/application-bundle/pom.xml Sun Feb 27 20:02:48 2011
@@ -0,0 +1,221 @@
+<!--
+ 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 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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>application</artifactId>
+ <version>0.2.1</version>
+ </parent>
+
+ <artifactId>org.apache.aries.application</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Aries Application Bundle</name>
+ <description>
+ This bundle is a standalone bundle to support
+ Aries applications.
+ </description>
+
+ <properties>
+ <aries.osgi.symbolic.name>
+ ${project.artifactId};blueprint.graceperiod:=false
+ </aries.osgi.symbolic.name>
+ <aries.osgi.import>
+ org.osgi.framework;version="[1.5,2)",
+ org.slf4j;version="[1.5,2)",
+ org.apache.aries.application*;version="[0.1,0.2)",
+ *
+ </aries.osgi.import>
+ <aries.osgi.export.pkg>
+ org.apache.aries.application;
+ org.apache.aries.application.filesystem;
+ org.apache.aries.application.management;
+ org.apache.aries.application.utils;
+ org.apache.aries.application.utils.filesystem;
+ org.apache.aries.application.utils.manifest;
+ org.apache.aries.application.utils.management;
+ </aries.osgi.export.pkg>
+ <aries.osgi.private.pkg>
+ org.apache.aries.application*,
+ META-INF*,
+ OSGI-INF*
+ </aries.osgi.private.pkg>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.management</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.runtime</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.utils</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <!-- Use the shade plugin with the dependency plugin to unjar the three jars (api, core and cm)
+ so that the associated sources and javadocs jars are complete.
+ To build the main jar, the maven-bundle-plugin is used, that's why everything is exluded -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <artifactSet>
+ <includes>
+ <include>org.apache.aries.application:org.apache.aries.application.api</include>
+ <include>org.apache.aries.application:org.apache.aries.application.managment</include>
+ <include>org.apache.aries.application:org.apache.aries.application.runtime</include>
+ <include>org.apache.aries.application:org.apache.aries.application.utils</include>
+ </includes>
+ </artifactSet>
+ <filters>
+ <filter>
+ <artifact>org.apache.aries.application:org.apache.aries.application.api</artifact>
+ <excludes>
+ <exclude>org/**</exclude>
+ </excludes>
+ </filter>
+ <filter>
+ <artifact>org.apache.aries.application:org.apache.aries.application.management</artifact>
+ <excludes>
+ <exclude>org/**</exclude>
+ </excludes>
+ </filter>
+ <filter>
+ <artifact>org.apache.aries.application:org.apache.aries.application.runtime</artifact>
+ <excludes>
+ <exclude>org/**</exclude>
+ </excludes>
+ </filter>
+ <filter>
+ <artifact>org.apache.aries.application:org.apache.aries.application.utils</artifact>
+ <excludes>
+ <exclude>org/**</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ <createSourcesJar>${createSourcesJar}</createSourcesJar>
+ <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+ <createDependencyReducedPom>true</createDependencyReducedPom>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>deploy</id>
+ <properties>
+ <createSourcesJar>true</createSourcesJar>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.api</artifactId>
+ <classifier>sources</classifier>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.management</artifactId>
+ <classifier>sources</classifier>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.runtime</artifactId>
+ <classifier>sources</classifier>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.utils</artifactId>
+ <classifier>sources</classifier>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/sources</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <minmemory>128m</minmemory>
+ <maxmemory>512m</maxmemory>
+ <sourcepath>${project.build.directory}/sources</sourcepath>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
Added: aries/tags/application-0.2.1/application-converters/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-converters/pom.xml?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-converters/pom.xml (added)
+++ aries/tags/application-0.2.1/application-converters/pom.xml Sun Feb 27 20:02:48 2011
@@ -0,0 +1,77 @@
+<!--
+ 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 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">
+ <parent>
+ <artifactId>application</artifactId>
+ <groupId>org.apache.aries.application</groupId>
+ <version>0.2.1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>org.apache.aries.application.converters</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Aries Application Converters</name>
+
+ <properties>
+ <aries.osgi.export.pkg />
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-all</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.testsupport</groupId>
+ <artifactId>org.apache.aries.testsupport.unit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.web</groupId>
+ <artifactId>org.apache.aries.web.urlhandler</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.utils</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added: aries/tags/application-0.2.1/application-converters/src/main/java/org/apache/aries/application/converters/WabConverterService.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-converters/src/main/java/org/apache/aries/application/converters/WabConverterService.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-converters/src/main/java/org/apache/aries/application/converters/WabConverterService.java (added)
+++ aries/tags/application-0.2.1/application-converters/src/main/java/org/apache/aries/application/converters/WabConverterService.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,81 @@
+/*
+ * 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.converters;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.aries.application.ApplicationMetadataFactory;
+import org.apache.aries.application.filesystem.IDirectory;
+import org.apache.aries.application.filesystem.IFile;
+import org.apache.aries.application.management.BundleConversion;
+import org.apache.aries.application.management.BundleConverter;
+import org.apache.aries.application.management.BundleInfo;
+import org.apache.aries.application.utils.management.SimpleBundleInfo;
+import org.apache.aries.application.utils.manifest.BundleManifest;
+import org.apache.aries.web.converter.WabConversion;
+import org.apache.aries.web.converter.WarToWabConverter;
+import org.apache.aries.web.converter.WarToWabConverter.InputStreamProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WabConverterService implements BundleConverter {
+ private static final String WAR_FILE_EXTENSION = ".war";
+ private static final Logger LOGGER = LoggerFactory.getLogger(WabConverterService.class);
+
+ private WarToWabConverter wabConverter;
+
+ public WarToWabConverter getWabConverter() {
+ return wabConverter;
+ }
+
+ public void setWabConverter(WarToWabConverter wabConverter) {
+ this.wabConverter = wabConverter;
+ }
+
+ public BundleConversion convert(IDirectory parentEba, final IFile toBeConverted) {
+ if (toBeConverted.getName().endsWith(WAR_FILE_EXTENSION)) {
+ try {
+ final WabConversion conversion = wabConverter.convert(new InputStreamProvider() {
+ public InputStream getInputStream() throws IOException {
+ return toBeConverted.open();
+ }
+ }, toBeConverted.getName(), new Properties());
+
+ return new BundleConversion() {
+
+ public BundleInfo getBundleInfo(ApplicationMetadataFactory amf) throws IOException {
+ return new SimpleBundleInfo(amf, BundleManifest.fromBundle(conversion.getWAB()), toBeConverted.toString());
+ }
+
+ public InputStream getInputStream() throws IOException {
+ return conversion.getWAB();
+ }
+
+ };
+ } catch (IOException e) {
+ LOGGER.error("Encountered an exception while converting " + toBeConverted.getName()
+ + " in " + parentEba.getName(), e);
+ }
+ }
+
+ return null;
+ }
+}
Added: aries/tags/application-0.2.1/application-converters/src/main/resources/OSGI-INF/blueprint/aries.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-converters/src/main/resources/OSGI-INF/blueprint/aries.xml?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-converters/src/main/resources/OSGI-INF/blueprint/aries.xml (added)
+++ aries/tags/application-0.2.1/application-converters/src/main/resources/OSGI-INF/blueprint/aries.xml Sun Feb 27 20:02:48 2011
@@ -0,0 +1,34 @@
+<?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="converterService" interface="org.apache.aries.web.converter.WarToWabConverter" />
+
+ <bean id="bundleConverter" class="org.apache.aries.application.converters.WabConverterService">
+ <property name="wabConverter" value="converterService" />
+ </bean>
+
+ <service interface="org.apache.aries.application.management.BundleConverter" ref="bundleConverter">
+ <service-properties>
+ <entry key="convert-type" value="war" />
+ </service-properties>
+ </service>
+
+</blueprint>
\ No newline at end of file
Added: aries/tags/application-0.2.1/application-install/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-install/pom.xml?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-install/pom.xml (added)
+++ aries/tags/application-0.2.1/application-install/pom.xml Sun Feb 27 20:02:48 2011
@@ -0,0 +1,80 @@
+<?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 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">
+ <parent>
+ <artifactId>application</artifactId>
+ <groupId>org.apache.aries.application</groupId>
+ <version>0.2.1</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.apache.aries.application.install</artifactId>
+ <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>
+ </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>
+ <scope>provided</scope>
+ </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>
+
+</project>
Added: aries/tags/application-0.2.1/application-install/src/main/java/org/apache/aries/application/install/EBAInstaller.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-install/src/main/java/org/apache/aries/application/install/EBAInstaller.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-install/src/main/java/org/apache/aries/application/install/EBAInstaller.java (added)
+++ aries/tags/application-0.2.1/application-install/src/main/java/org/apache/aries/application/install/EBAInstaller.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,114 @@
+/*
+ * 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.AriesApplication;
+import org.apache.aries.application.management.AriesApplicationContext;
+import org.apache.aries.application.management.AriesApplicationManager;
+import org.apache.aries.application.utils.filesystem.FileSystem;
+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, AriesApplicationContext> appContexts = new HashMap<File, AriesApplicationContext>();
+
+ 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(FileSystem.getFSRoot(applicationLocation));
+
+ 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() });
+
+ AriesApplicationContext 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
+ {
+ AriesApplicationContext 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: aries/tags/application-0.2.1/application-install/src/main/resources/OSGI-INF/blueprint/app-install.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-install/src/main/resources/OSGI-INF/blueprint/app-install.xml?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-install/src/main/resources/OSGI-INF/blueprint/app-install.xml (added)
+++ aries/tags/application-0.2.1/application-install/src/main/resources/OSGI-INF/blueprint/app-install.xml Sun Feb 27 20:02:48 2011
@@ -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>
Added: aries/tags/application-0.2.1/application-itest-interface/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-itest-interface/pom.xml?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-itest-interface/pom.xml (added)
+++ aries/tags/application-0.2.1/application-itest-interface/pom.xml Sun Feb 27 20:02:48 2011
@@ -0,0 +1,40 @@
+<!--
+ 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 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">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>application</artifactId>
+ <version>0.2.1</version>
+ </parent>
+
+ <artifactId>org.apache.aries.application.runtime.itest.interfaces</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Aries Application itests sample application interface</name>
+ <description>
+ Interface class(es) for aplication runtime itests.
+ </description>
+
+ <properties>
+ <aries.osgi.export.pkg>
+ org.apache.aries.sample
+ </aries.osgi.export.pkg>
+ </properties>
+
+</project>
Added: aries/tags/application-0.2.1/application-itest-interface/src/main/java/org/apache/aries/sample/HelloWorld.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-itest-interface/src/main/java/org/apache/aries/sample/HelloWorld.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-itest-interface/src/main/java/org/apache/aries/sample/HelloWorld.java (added)
+++ aries/tags/application-0.2.1/application-itest-interface/src/main/java/org/apache/aries/sample/HelloWorld.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+package org.apache.aries.sample;
+
+public interface HelloWorld {
+
+ public String getMessage();
+}
Added: aries/tags/application-0.2.1/application-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-itests/pom.xml?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-itests/pom.xml (added)
+++ aries/tags/application-0.2.1/application-itests/pom.xml Sun Feb 27 20:02:48 2011
@@ -0,0 +1,194 @@
+<?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 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">
+ <parent>
+ <artifactId>application</artifactId>
+ <groupId>org.apache.aries.application</groupId>
+ <version>0.2.1</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.apache.aries.application.runtime.itests</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Aries Application integration tests</name>
+ <description>
+ Integration tests for the Application runtime
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries</groupId>
+ <artifactId>org.apache.aries.util</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.logging</groupId>
+ <artifactId>pax-logging-service</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-default</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-mvn</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.bundlerepository</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.runtime.itest.interfaces</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.utils</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.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.management</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.runtime</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.aries.application</groupId>
+ <artifactId>org.apache.aries.application.resolver.obr</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ <version>1.2</version>
+ <executions>
+ <execution>
+ <id>generate-depends-file</id>
+ <goals>
+ <goal>generate-depends-file</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ <excludes>
+ <exclude>**/*$*</exclude>
+ <exclude>**/Abstract*.java</exclude>
+ </excludes>
+ <includes>
+ <include>**/Test*.java</include>
+ <include>**/*Test.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>ci-build-profile</id>
+ <activation>
+ <property>
+ <name>maven.repo.local</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!--
+ when the local repo location has been specified, we need to pass
+ on this information to PAX mvn url
+ -->
+ <argLine>-Dorg.ops4j.pax.url.mvn.localRepository=${maven.repo.local}</argLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
Added: aries/tags/application-0.2.1/application-itests/src/test/java/org/apache/aries/application/runtime/itests/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-itests/src/test/java/org/apache/aries/application/runtime/itests/AbstractIntegrationTest.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-itests/src/test/java/org/apache/aries/application/runtime/itests/AbstractIntegrationTest.java (added)
+++ aries/tags/application-0.2.1/application-itests/src/test/java/org/apache/aries/application/runtime/itests/AbstractIntegrationTest.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,178 @@
+/**
+ * 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.
+ */
+package org.apache.aries.application.runtime.itests;
+
+import static org.junit.Assert.assertNotNull;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
+import static org.ops4j.pax.exam.OptionUtils.combine;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.aries.application.management.AriesApplicationResolver;
+import org.apache.aries.blueprint.BlueprintConstants;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Inject;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.Version;
+import org.osgi.util.tracker.ServiceTracker;
+
+@RunWith(JUnit4TestRunner.class)
+public class AbstractIntegrationTest {
+
+ public static final long DEFAULT_TIMEOUT = 30000;
+
+ @Inject
+ protected BundleContext bundleContext;
+
+ private List<ServiceTracker> srs;
+
+ @Before
+ public void setUp() {
+ srs = new ArrayList<ServiceTracker>();
+ }
+
+ @After
+ public void tearDown() throws Exception{
+ for (ServiceTracker st : srs) {
+ if (st != null) {
+ st.close();
+ }
+ }
+ }
+
+ protected Bundle getBundle(String symbolicName) {
+ return getBundle(symbolicName, null);
+ }
+
+ protected Bundle getBundle(String bundleSymbolicName, String version) {
+ Bundle result = null;
+ for (Bundle b : bundleContext.getBundles()) {
+ if (b.getSymbolicName().equals(bundleSymbolicName)) {
+ if (version == null
+ || b.getVersion().equals(Version.parseVersion(version))) {
+ result = b;
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ public static MavenArtifactProvisionOption mavenBundle(String groupId,
+ String artifactId) {
+ return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId)
+ .versionAsInProject();
+ }
+
+ protected static Option[] updateOptions(Option[] options) {
+ // We need to add pax-exam-junit here when running with the ibm
+ // jdk to avoid the following exception during the test run:
+ // ClassNotFoundException: org.ops4j.pax.exam.junit.Configuration
+ if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
+ Option[] ibmOptions = options(wrappedBundle(mavenBundle(
+ "org.ops4j.pax.exam", "pax-exam-junit")));
+ options = combine(ibmOptions, options);
+ }
+
+ return options;
+ }
+
+ protected <T> T getOsgiService(Class<T> type, long timeout) {
+ return getOsgiService(type, null, timeout);
+ }
+
+ protected <T> T getOsgiService(Class<T> type) {
+ return getOsgiService(type, null, DEFAULT_TIMEOUT);
+ }
+
+ protected <T> T getOsgiService(Class<T> type, String filter, long timeout) {
+ return getOsgiService(null, type, filter, timeout);
+ }
+
+ protected <T> T getOsgiService(BundleContext bc, Class<T> type,
+ String filter, long timeout) {
+ ServiceTracker tracker = null;
+ try {
+ String flt;
+ if (filter != null) {
+ if (filter.startsWith("(")) {
+ flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")"
+ + filter + ")";
+ } else {
+ flt = "(&(" + Constants.OBJECTCLASS + "=" + type.getName() + ")("
+ + filter + "))";
+ }
+ } else {
+ flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")";
+ }
+ Filter osgiFilter = FrameworkUtil.createFilter(flt);
+ tracker = new ServiceTracker(bc == null ? bundleContext : bc, osgiFilter,
+ null);
+ tracker.open();
+
+ // add tracker to the list of trackers we close at tear down
+ srs.add(tracker);
+
+ Object x = tracker.waitForService(timeout);
+ Object svc = type.cast(x);
+ if (svc == null) {
+ throw new RuntimeException("Gave up waiting for service " + flt);
+ }
+ return type.cast(svc);
+ } catch (InvalidSyntaxException e) {
+ throw new IllegalArgumentException("Invalid filter", e);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Checks if the OBR Resolver is available. If this test succeeds, it starts
+ * the 'org.apache.aries.application.runtime' bundle. Of course this method
+ * can only work properly if org.apache.aries.application.runtime was added
+ * to Pax Exam configuration with 'noStart()'.
+ * @throws BundleException
+ */
+ protected void startApplicationRuntimeBundle() throws BundleException{
+ // Need to make sure that the OBR resolver was made available. This
+ // resolver is registered by the org.apache.aries.application.resolver.obr
+ // bundle with osgi.service.blueprint.compname=obr-resolver.
+ getOsgiService(AriesApplicationResolver.class, "(" +
+ BlueprintConstants.COMPONENT_NAME_PROPERTY + "=obr-resolver)",
+ DEFAULT_TIMEOUT);
+ // If we reached this point, initialization of the OBR resolver has been
+ // finished. Let's start the org.apache.aries.application.runtime bundle.
+ Bundle appRuntimeBundle = getBundle("org.apache.aries.application.runtime");
+ assertNotNull(appRuntimeBundle);
+ appRuntimeBundle.start();
+ }
+
+}
\ No newline at end of file
Added: aries/tags/application-0.2.1/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.2.1/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java?rev=1075127&view=auto
==============================================================================
--- aries/tags/application-0.2.1/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java (added)
+++ aries/tags/application-0.2.1/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java Sun Feb 27 20:02:48 2011
@@ -0,0 +1,157 @@
+/*
+ * 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.
+ */
+package org.apache.aries.application.runtime.itests;
+
+import static org.junit.Assert.assertEquals;
+import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+
+import java.io.File;
+import java.io.FileOutputStream;
+
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.AriesApplicationContext;
+import org.apache.aries.application.management.AriesApplicationManager;
+import org.apache.aries.application.utils.filesystem.FileSystem;
+import org.apache.aries.sample.HelloWorld;
+import org.apache.aries.unittest.fixture.ArchiveFixture;
+import org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+
+@RunWith(JUnit4TestRunner.class)
+public class BasicAppManagerTest extends AbstractIntegrationTest {
+
+ /* Use @Before not @BeforeClass so as to ensure that these resources
+ * are created in the paxweb temp directory, and not in the svn tree
+ */
+ static boolean createdApplications = false;
+ @Before
+ public static void createApplications() throws Exception {
+ if (createdApplications) {
+ return;
+ }
+ ZipFixture testEba = ArchiveFixture.newZip()
+ .jar("sample.jar")
+ .manifest().symbolicName("org.apache.aries.sample")
+ .attribute("Bundle-Version", "1.0.0")
+ .attribute("Import-Package", "org.apache.aries.sample")
+ .end()
+ .binary("org/apache/aries/sample/impl/HelloWorldImpl.class",
+ BasicAppManagerTest.class.getClassLoader().getResourceAsStream("org/apache/aries/sample/impl/HelloWorldImpl.class"))
+ .binary("OSGI-INF/blueprint/sample-blueprint.xml",
+ BasicAppManagerTest.class.getClassLoader().getResourceAsStream("basic/sample-blueprint.xml"))
+ .end();
+
+ FileOutputStream fout = new FileOutputStream("test.eba");
+ testEba.writeOut(fout);
+ fout.close();
+
+ ZipFixture testEba2 = testEba.binary("META-INF/APPLICATION.MF",
+ BasicAppManagerTest.class.getClassLoader().getResourceAsStream("basic/APPLICATION.MF"))
+ .end();
+ fout = new FileOutputStream("test2.eba");
+ testEba2.writeOut(fout);
+ fout.close();
+ createdApplications = true;
+ }
+
+ @Test
+ public void testAppWithoutApplicationManifest() throws Exception {
+
+ AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
+ AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test.eba")));
+
+ // application name should be equal to eba name since application.mf is not provided
+ assertEquals("test.eba", app.getApplicationMetadata().getApplicationName());
+ AriesApplicationContext ctx = manager.install(app);
+ ctx.start();
+
+ HelloWorld hw = getOsgiService(HelloWorld.class);
+ String result = hw.getMessage();
+ assertEquals (result, "hello world");
+
+ ctx.stop();
+ manager.uninstall(ctx);
+ }
+
+ @Test
+ public void testAppWithApplicationManifest() throws Exception {
+ AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
+ AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
+
+ // application name should equal to whatever Application name provided in the application.mf
+ assertEquals("test application 2", app.getApplicationMetadata().getApplicationName());
+
+ AriesApplicationContext ctx = manager.install(app);
+ ctx.start();
+
+ HelloWorld hw = getOsgiService(HelloWorld.class);
+ String result = hw.getMessage();
+ assertEquals (result, "hello world");
+
+ ctx.stop();
+ manager.uninstall(ctx);
+ }
+
+
+ @org.ops4j.pax.exam.junit.Configuration
+ public static Option[] configuration() {
+ Option[] options = options(
+ // Log
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
+ // Felix Config Admin
+ mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
+ // Felix mvn url handler
+ mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
+
+ // this is how you set the default log level when using pax
+ // logging (logProfile)
+ systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
+
+ // Bundles
+ mavenBundle("org.apache.aries.application", "org.apache.aries.application.api"),
+ mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils"),
+ mavenBundle("org.apache.aries.application", "org.apache.aries.application.management"),
+ mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime"),
+ mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.itest.interfaces"),
+ mavenBundle("org.apache.aries", "org.apache.aries.util"),
+ mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint"),
+ mavenBundle("org.osgi", "org.osgi.compendium"),
+ mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit"),
+
+ /* For debugging, uncomment the next two lines
+ vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"),
+ waitForFrameworkStartup(),
+
+ and add these imports:
+ import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup;
+ import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
+ */
+
+ equinox().version("3.5.0"));
+ options = updateOptions(options);
+ return options;
+ }
+}