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:20:30 UTC

svn commit: r1075132 [2/18] - in /aries/tags/application-0.3: ./ 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-api...

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/ApplicationMetadata.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/ApplicationMetadata.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/ApplicationMetadata.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/ApplicationMetadata.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,97 @@
+/*
+ * 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; 
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.List;
+
+import org.osgi.framework.Version;
+
+/**
+ * A representation of an APPLICATION.MF file. 
+ *
+ */
+public interface ApplicationMetadata
+{
+  /**
+   * get the value of the Application-SymbolicName header
+   * @return the value of the Application-SymbolicName header
+   */
+  public String getApplicationSymbolicName();
+  
+  /**
+   * get the value of the Application-Version header
+   * @return the value of the Application-Version header
+   */
+  public Version getApplicationVersion();
+  
+  /**
+   * get the name of the application
+   * @return the name of the application
+   */
+  public String getApplicationName();
+  /**
+   * get the list of Application contents includes bundle name, 
+   * version, directives and attributes
+   * @return the list of the Application contents 
+   */
+  public List<Content> getApplicationContents();
+  
+  /**
+   * get the value of the Export-Service header
+   * @return the list of ServiceDeclaration
+   */
+  public List<ServiceDeclaration> getApplicationExportServices();
+  
+  /**
+   * get the value of the Import-Service header
+   * @return the list of ServiceDeclaration
+   */
+  public List<ServiceDeclaration> getApplicationImportServices();  
+  
+  /**
+   * get the value of the Application-Scope, which is 
+   * calculated from Application-SymbolicName and Application-Version
+   * @return    the value of the AppScope
+   */
+  public String getApplicationScope();
+  
+  /**
+   * get the list of use-bundle content including bundle symbolic name and version range
+   * @return
+   */
+  public Collection<Content> getUseBundles();
+  
+  /** 
+   * Persist this metadata. 
+   * @param f The file to store this metadata to
+   * @throws IOException
+   */
+  public void store(File f) throws IOException;
+  
+  /** 
+   * Persist this metadata. 
+   * @param out The output stream to store this metadata to
+   * @throws IOException
+   */
+  public void store(OutputStream out) throws IOException;
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/ApplicationMetadataFactory.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/ApplicationMetadataFactory.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/ApplicationMetadataFactory.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/ApplicationMetadataFactory.java Sun Feb 27 20:20:13 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 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;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.jar.Manifest;
+
+/**
+ * Provides various means of generating {@link org.apache.aries.application.ApplicationMetadata  
+ * ApplicationMetadata} instances.  
+ */
+public interface ApplicationMetadataFactory
+{
+
+  /**
+   * Parse from the input stream the application manifest. This method is more
+   * lenient than the normal manifest parsing routine and does not limit the
+   * manifest to 76 bytes as a line length.
+   * 
+   * @param in the inputstream of the manifest to parse.
+   * @return   the parsed application metadata.
+   * 
+   */
+  public ApplicationMetadata parseApplicationMetadata(InputStream in) throws IOException;
+    
+  /**
+   * Create the application metadata from the provided Manifest. This is provided
+   * so application metadata can be created from within the JVM. When reading
+   * from a stream the parseApplication method should be used.
+   * 
+   * @param man the manifest to read from
+   * @return    the parsed application metadata.
+   */
+  public ApplicationMetadata createApplicationMetadata(Manifest man);
+
+}
\ No newline at end of file

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/Content.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/Content.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/Content.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/Content.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,73 @@
+/*
+ * 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;
+
+import java.util.Map;
+
+
+/**
+ * A representation of content metadata such as Application-Content, Import-Package, etc
+ *
+ */
+public interface Content
+{
+  /**
+   * get the content name of the content
+   * @return    the content name of the content
+   */
+  public String getContentName();
+  
+  /**
+   * get the attributes of the content
+   * @return    the attributes of the content
+   */
+  public Map<String, String> getAttributes();
+  
+  /**
+   * get the directives of the content
+   * @return the directives of the content
+   */
+  public Map<String, String> getDirectives();
+  
+  /**
+   * get the value of the attribute with the specified key
+   * @param key  
+   * @return   value of the attribute specified by the key
+   */
+  public String getAttribute(String key);
+  
+  /**
+   * get the value of the directive with the specified key
+   * @param key
+   * @return    the value of the directive specified by the key
+   */
+  public String getDirective(String key);
+  
+  /**
+   * get the version info for the version attribute
+   * @return null if there is no version associated with this content
+   */
+  public VersionRange getVersion();
+  
+  /**
+   * get the attribute and directive info in NameValueMap
+   * @return namevalueMap that contains attribute and directive info
+   */
+  public Map<String, String> getNameValueMap();
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/DeploymentContent.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/DeploymentContent.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/DeploymentContent.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/DeploymentContent.java Sun Feb 27 20:20:13 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;
+
+import org.osgi.framework.Version;
+
+/**
+ * An entry in DEPLOYMENT.MF's Deployed-Content header
+ */
+public interface DeploymentContent extends Content {
+
+  /**
+   * get the exact version of the deployment content
+   * this cannot be null
+   * @return    the exact version
+   */
+  public Version getExactVersion();
+  
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/DeploymentMetadata.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/DeploymentMetadata.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/DeploymentMetadata.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/DeploymentMetadata.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,108 @@
+/*
+ * 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;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.osgi.framework.Filter;
+import org.osgi.framework.Version;
+
+/**
+ * Represents the parsed contents of a DEPLOYMENT.MF file
+ *
+ */
+public interface DeploymentMetadata {
+
+  /**
+   * get the value of the Application-SymbolicName header
+   * @return the value of the Application-SymbolicName header
+   */
+  public String getApplicationSymbolicName();
+  
+  /**
+   * get the value of the Application-Version header
+   * @return the value of the Application-Version header
+   */
+  public Version getApplicationVersion();
+  
+  /**
+   * get the value of the Deployed-Content header 
+   * @return the list of the deployed content 
+   */
+  public List<DeploymentContent> getApplicationDeploymentContents();
+  
+  /**
+   * get the value of the Provision-Bundle header
+   * @return
+   */
+  public List<DeploymentContent> getApplicationProvisionBundles();
+  
+  /**
+   * get the value of Deployed-UseBundle header
+   * 
+   * @return
+   */
+  public Collection<DeploymentContent> getDeployedUseBundle();
+  
+  /**
+   * get the value of Import-Package
+   * @return
+   */
+  public Collection<Content> getImportPackage();
+
+  /**
+   * Get the list of DeployedService-Import
+   * @return DeployedService-Import
+   */
+  public Collection<Filter> getDeployedServiceImport();
+  
+  /**
+   * get the contents of deployment manifest in a map
+   * @return    the required feature map
+   */
+  public Map<String, String> getHeaders();
+  /**
+   * Obtain the associated 
+   * {@link org.apache.aries.application.ApplicationMetadata ApplicationMetadata}. 
+   * @return The application metadata.
+   */
+  public ApplicationMetadata getApplicationMetadata();
+  
+  /** 
+   * Persist this metadata as Manifest-formatted text. 
+   * @param f The file to store this metadata to
+   * @throws IOException
+   */
+  public void store(File f) throws IOException;
+  
+  /** 
+   * Persist this metadata.  
+   * @param out The OutputStream to store this metadata to. 
+   * @throws IOException
+   */
+
+  public void store(OutputStream out) throws IOException;
+
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/DeploymentMetadataFactory.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/DeploymentMetadataFactory.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/DeploymentMetadataFactory.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/DeploymentMetadataFactory.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,97 @@
+/*
+ * 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;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Set;
+import java.util.jar.Manifest;
+
+import org.apache.aries.application.filesystem.IFile;
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.BundleInfo;
+import org.apache.aries.application.management.ResolverException;
+
+/**
+ * Methods for creating a DeploymentMetadata instance
+ */
+public interface DeploymentMetadataFactory {
+
+  /** 
+   * Deprecated. Use parseDeploymentManifest(IFile) to create a DeploymentMetadata from an AriesApplication and its by-value bundles. 
+   * 
+   * @param  app The AriesApplication in question
+   * @param  bundleInfo A resolved set of BundleInfo objects
+   * @throws ResolverException
+   * @return DeploymentMetadata instance
+   */
+  @Deprecated
+  public DeploymentMetadata createDeploymentMetadata (AriesApplication app, Set<BundleInfo> bundleInfo)
+    throws ResolverException;
+  
+  /**
+   * Deprecated. Use parseDeploymentMetadata.
+   * 
+   * @param src DEPLOYMENT.MF file, either in an exploded directory or within a jar file. 
+   * @throws IOException
+   * @return DeploymentMetadata instance
+   */
+  @Deprecated
+  public DeploymentMetadata createDeploymentMetadata (IFile src) throws IOException;
+
+  
+  /**
+   * Extract a DeploymentMetadata instance from an IFile
+   * 
+   * @param src DEPLOYMENT.MF file, either in an exploded directory or within a jar file. 
+   * @throws IOException
+   * @return DeploymentMetadata instance
+   */
+  public DeploymentMetadata parseDeploymentMetadata (IFile src) throws IOException;
+  
+  /**
+   * Deprecated. Use parseDeploymentMetadata.
+   * 
+   * @param in InputStream
+   * @throws IOException
+   * @return DeploymentMetadata instance
+   */
+  @Deprecated
+  public DeploymentMetadata createDeploymentMetadata (InputStream in) throws IOException;
+
+  /**
+   * Extract a DeploymentMetadata instance from InputStream.
+   * 
+   * @param in InputStream
+   * @throws IOException
+   * @return DeploymentMetadata instance
+   */
+  public DeploymentMetadata parseDeploymentMetadata (InputStream in) throws IOException;
+  
+  /**
+   * Extract a DeploymentMetadata instance from Manifest.
+   * 
+   * @param manifest Manifest
+   * @throws IOException
+   * @return DeploymentMetadata instance
+   */
+  public DeploymentMetadata createDeploymentMetadata (Manifest manifest) throws IOException;
+
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/InvalidAttributeException.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/InvalidAttributeException.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/InvalidAttributeException.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/InvalidAttributeException.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+
+
+public class InvalidAttributeException extends Exception
+{
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 4889305636433626372L;
+
+  public InvalidAttributeException (Exception e) { 
+    super(e);
+  }
+  
+  public InvalidAttributeException (String s) { 
+    super(s);
+  }
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/ServiceDeclaration.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/ServiceDeclaration.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/ServiceDeclaration.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/ServiceDeclaration.java Sun Feb 27 20:20:13 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 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;
+
+import org.osgi.framework.Filter;
+
+/**
+ * Represents a service imported or exported by an Aries application. 
+ */
+public interface ServiceDeclaration {
+
+	/**
+	 * get the interface name for the service
+	 * @return The name of the service's interface class. 
+	 */
+	public abstract String getInterfaceName();
+
+	/**
+	 * get the filter for the service
+	 * @return the filter for the service or null if there is no filter defined
+	 */
+	public abstract Filter getFilter();
+
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/VersionRange.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/VersionRange.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/VersionRange.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/VersionRange.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,88 @@
+/*
+ * 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;
+
+import org.osgi.framework.Version;
+
+/**
+ * A representation of a Version Range. @see <a href="http://www.osgi.org/Release4/HomePage">
+ * section 3.2.6</a> of the OSGi Service Platform Core Specification. 
+ */
+public interface VersionRange
+{
+  /**
+   * this method returns the exact version from the versionInfo obj.
+   * this is used for DeploymentContent only to return a valid exact version
+   * otherwise, null is returned.
+   * @return
+   */
+  public abstract Version getExactVersion();
+
+  /**
+   * get the maximum version
+   * @return    the maximum version
+   */
+  public abstract Version getMaximumVersion();
+
+  /**
+   * get the minimum version
+   * @return    the minimum version
+   */
+  public abstract Version getMinimumVersion();
+
+  /**
+   * is the maximum version exclusive
+   * @return  
+   */
+  public abstract boolean isMaximumExclusive();
+
+  /**
+   * is the maximum version unbounded
+   * @return
+   */
+  public abstract boolean isMaximumUnbounded();
+
+  /**
+   * is the minimum version exclusive
+   * @return
+   */
+  public abstract boolean isMinimumExclusive();
+
+  /**
+   * check if the versioninfo is the exact version
+   * @return
+   */
+  public abstract boolean isExactVersion();
+  /**
+   * This method tests to see if the provided version is inside this range.
+   * 
+   * @param version the version to test.
+   * @return        true if the version matches, false otherwise.
+   */
+  public boolean matches(Version version);
+  
+  /**
+   * Create a new version range that is the intersection of {@code this} and the argument.
+   * In other words, the largest version range that lies within both {@code this} and
+   * the parameter.
+   * @param range a version range to be intersected with {@code this}.
+   * @return a new version range, or {@code null} if no intersection is possible.
+   */
+  public VersionRange intersect(VersionRange range);
+}
\ No newline at end of file

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/filesystem/IDirectory.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/filesystem/IDirectory.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/filesystem/IDirectory.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/filesystem/IDirectory.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,55 @@
+/*
+ * 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.filesystem;
+
+import java.util.List;
+
+/**
+ * A virtual directory in a file system. Widely used to present a common view of regular 
+ * file sytems, jar and zip files. 
+ */
+public interface IDirectory extends Iterable<IFile>, IFile
+{
+  /**
+   * @return the list of files in this directory. Files must be in this directory
+   *         and not in sub-directories.
+   */
+  public List<IFile> listFiles();
+  
+  /**
+   * 
+   * @return the list of files in all directories (including sub-directories). This is the complete list.
+   */
+  public List<IFile> listAllFiles();
+  
+  /**
+   * Gets the requested file under this directory. The file may be located any
+   * number of levels within this directory. The name is relative to this
+   * directory. If the file cannot be found it will return null.
+   * 
+   * @param name the name of the file.
+   * @return     the IFile, or null if no such file exists.
+   */
+  public IFile getFile(String name);
+  /**
+   * @return true if this IDirectory is the root of the virtual file system.
+   */
+  public boolean isRoot();
+}
\ No newline at end of file

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/filesystem/IFile.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/filesystem/IFile.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/filesystem/IFile.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/filesystem/IFile.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,83 @@
+/*
+ * 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.filesystem;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * A virtual file on the virtual file system. This may represent a file or a
+ * directory.
+ */
+public interface IFile
+{
+  /**
+   * @return the name of the file relative to the root of the virtual FS.
+   */
+  public String getName();
+  /**
+   * @return true iff this IFile is also an IDirectory
+   */
+  public boolean isDirectory();
+  /**
+   * @return true iff this IFile is not an IDirectory
+   */
+  public boolean isFile();
+  /**
+   * @return the last modified date of the file.
+   */
+  public long getLastModified();
+  /**
+   * @return the size of the file.
+   */
+  public long getSize();
+  
+  /**
+   * @return if this is a directory return this as an IDirectory, otherwise return null.
+   */
+  public IDirectory convert();
+  
+  /**
+   * @return returns the parent directory of this IFile, or null if this is the root.
+   */
+  public IDirectory getParent();
+  
+  /**
+   * The input stream returned by this method should always be closed after use.
+   * 
+   * @return An InputStream to read the file from.
+   * 
+   * @throws IOException
+   * @throws UnsupportedOperationException If the IFile is also an IDirectory.
+   */
+  public InputStream open() throws IOException, UnsupportedOperationException;
+  
+  /**
+   * @return the root of this file system.
+   */
+  public IDirectory getRoot();
+  /**
+   * @return a URL that can be used to get at this file at a later date.
+   * @throws MalformedURLException 
+   */
+  public URL toURL() throws MalformedURLException ;
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplication.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplication.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplication.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplication.java Sun Feb 27 20:20:13 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.management;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Set;
+
+import org.apache.aries.application.ApplicationMetadata;
+import org.apache.aries.application.DeploymentMetadata;
+
+
+/**
+ * Metadata about an Aries application
+ *
+ */
+public interface AriesApplication
+{
+  /**
+   * Get the application metadata, which is stored in META-INF/APPLICATION.MF.
+   * @return ApplicationMetadata
+   */
+  public ApplicationMetadata getApplicationMetadata();
+  
+  /**
+   * Get the deployment metadata, which is stored in META-INF/DEPLOYMENT.MF.
+   * @return DeploymentMetadata
+   */
+  public DeploymentMetadata getDeploymentMetadata();
+
+  /** 
+   * @return the set of bundles included in the application by value 
+   */
+  public Set<BundleInfo> getBundleInfo();
+
+
+  /**
+   * Check if the application is resolved or not.
+   * An application is said to be resolved if it has a valid deployment metadata.
+   * During the installation process, an application will be automatically
+   * resolved if it is not already.
+   *
+   * @return if the appplication is resolved or not.
+   * @see org.apache.aries.application.management.AriesApplicationManager#install(AriesApplication)  
+   * @see org.apache.aries.application.management.AriesApplicationManager#resolve(AriesApplication, ResolveConstraint...)
+   */
+  public boolean isResolved();
+
+  /** 
+   * Persist this metadata. 
+   * @param f The file to store this metadata to
+   * @throws IOException
+   */
+  public void store(File f) throws FileNotFoundException, IOException;
+  
+  /** 
+   * Persist this metadata. 
+   * @param out The output stream to store this metadata to
+   * @throws IOException
+   */
+  public void store(OutputStream out) throws FileNotFoundException, IOException;
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationContext.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationContext.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationContext.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationContext.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,71 @@
+/*
+ * 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.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * Represents an Aries application in the runtime. See the application-runtime module for a 
+ * sample implementation. 
+ */
+public interface AriesApplicationContext
+{
+  /** 
+   * Get the state of a running application. An application is INSTALLED if all its bundles 
+   * are installed, RESOLVED if all its bundles are resolved, ACTIVE if all its bundles are 
+   * active, and so on. 
+   * @return ApplicationState. 
+   */
+  public ApplicationState getApplicationState();
+  
+  /**
+   * Obtain the associated AriesApplication metadata.  
+   * @return AriesApplication
+   */
+  public AriesApplication getApplication();
+  
+  /**
+   * Start the application by starting all its constituent bundles as per the DeploymentContent 
+   * in the associated AriesApplication's DeploymentMetadata. 
+   * @throws BundleException
+   */
+  public void start() throws BundleException, IllegalStateException;
+  
+  /**
+   * Stop the application by stopping all its constituent bundles. 
+   * @throws BundleException
+   */
+  public void stop() throws BundleException, IllegalStateException;
+  
+  /**
+   * Get the org.osgi.framework.Bundle objects representing the application's runtime
+   * constituents. 
+   * @return The application's runtime content. 
+   */
+  public Set<Bundle> getApplicationContent();
+  
+  public enum ApplicationState
+  {
+  INSTALLED, RESOLVED, STARTING, STOPPING, ACTIVE, UNINSTALLED
+  }
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationEvent.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationEvent.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationEvent.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationEvent.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+/**
+ * Objects of this type are passed to ApplicationListener clients
+ */
+public abstract class AriesApplicationEvent {
+
+  /**
+   * Get the type of the event
+   * @return
+   */
+  abstract public AriesApplicationContext.ApplicationState getType();
+  
+  /**
+   * Get the associated AriesApplication
+   * @return
+   */
+  abstract public AriesApplication getApplication();
+  
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationListener.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationListener.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationListener.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationListener.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+/**
+ * A client that wishes to receive AriesApplicationEvents should implement this interface. 
+ */
+public interface AriesApplicationListener {
+
+  /**
+   * Receives notification of an application lifecycle event
+   */
+  public void applicationChanged (AriesApplicationEvent event);
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationManager.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationManager.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationManager.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationManager.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,116 @@
+/*
+ * 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.DeploymentMetadata;
+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);
+  
+  /**
+   * Update an application's deployment and apply the changes to the runtime if the application is deployed
+   * @param app The application to change
+   * @param depMf The new deployment metadata
+   * @return {@link AriesApplicationContext} Returns a new application context if the app
+   * is currently deployed, or null if the app is not currently installed
+   * 
+   * @throws UpdateException if the deployment changes could not be effected in the runtime
+   * @throws IllegalArgumentException if the deployment metadata does not correspond to the same application
+   * (same symbolic name and same version)
+   */
+  public AriesApplicationContext update(AriesApplication app, DeploymentMetadata depMf) throws UpdateException;
+  
+  /**
+   * 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.3/application-api/src/main/java/org/apache/aries/application/management/BundleInfo.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/BundleInfo.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/BundleInfo.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/BundleInfo.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,69 @@
+/*
+ * 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 java.util.jar.Attributes;
+
+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();
+  
+  /** The Attribute object in the MANIFEST.MF file */
+  public Attributes getRawAttributes();
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/ManagementException.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/ManagementException.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/ManagementException.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/ManagementException.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,41 @@
+/*
+ * 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);
+  }
+  
+  public ManagementException(String s, Exception e)
+  {
+    super(s, e);
+  }
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/ResolveConstraint.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/ResolveConstraint.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/ResolveConstraint.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/ResolveConstraint.java Sun Feb 27 20:20:13 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.3/application-api/src/main/java/org/apache/aries/application/management/ResolverException.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/ResolverException.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/ResolverException.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/ResolverException.java Sun Feb 27 20:20:13 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.3/application-api/src/main/java/org/apache/aries/application/management/UpdateException.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/UpdateException.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/UpdateException.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/UpdateException.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,41 @@
+/*
+ * 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;
+
+public class UpdateException extends Exception {
+  private static final long serialVersionUID = -6118824314732969652L;
+
+  private Exception rollbackFailure;
+  private boolean rolledBack;
+  
+  public UpdateException(String message, Exception e, boolean rolledBack, Exception rollbackException) {
+    super(message, e);
+    
+    this.rollbackFailure = rollbackException;
+    this.rolledBack = rolledBack;    
+  }
+  
+  public boolean hasRolledBack() {
+    return rolledBack;
+  }
+  
+  public Exception getRollbackException() {
+    return rollbackFailure;
+  }
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/convert/BundleConversion.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/convert/BundleConversion.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/convert/BundleConversion.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/convert/BundleConversion.java Sun Feb 27 20:20:13 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.spi.convert;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.aries.application.management.BundleInfo;
+
+/**
+ * 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() throws IOException;
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/convert/BundleConverter.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/convert/BundleConverter.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/convert/BundleConverter.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/convert/BundleConverter.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,41 @@
+/*
+ * 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.spi.convert;
+
+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.3/application-api/src/main/java/org/apache/aries/application/management/spi/convert/ConversionException.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/convert/ConversionException.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/convert/ConversionException.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/convert/ConversionException.java Sun Feb 27 20:20:13 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.spi.convert;
+
+/**
+ * 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.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFramework.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFramework.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFramework.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFramework.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,100 @@
+/*
+ * 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.spi.framework;
+
+import java.util.List;
+
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.spi.repository.BundleRepository.BundleSuggestion;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+public interface BundleFramework
+{  
+  public static final String SHARED_BUNDLE_FRAMEWORK = "shared.bundle.framework";
+  
+  /**
+   * Initialises the framework (but does not start the framework bundle)
+   * @throws BundleException
+   */
+  public void init() throws BundleException;
+ 
+  /**
+   * Starts the framework and the framework bundle
+   * @throws BundleException
+   */
+  public void start() throws BundleException;
+
+  /**
+   * Closes the framework and any associated resource
+   * @throws BundleException
+   */
+  public void close() throws BundleException;
+  
+  /**
+   * Installs a bundle to this framework.
+   * @param suggestion The information required to install the bundle
+   * @param app The application with which this install is associated
+   * @return
+   * @throws BundleException
+   */
+  public Bundle install(BundleSuggestion suggestion, AriesApplication app) throws BundleException;
+  
+  /**
+   * Removes a bundle from this framework
+   * @param b The bundle to remove
+   * @throws BundleException
+   */
+  public void uninstall(Bundle b) throws BundleException;
+  
+  /**
+   * Start a previously installed bundle in this framework. 
+   * @param b
+   * @throws BundleException
+   */
+  public void start(Bundle b) throws BundleException;
+
+  /**
+   * Stop a previously installed bundle in this framework. 
+   * @param b
+   * @throws BundleException
+   */
+  public void stop(Bundle b) throws BundleException;
+
+  /**
+   * Returns the bundle context for the framework.
+   * @return
+   */
+  public BundleContext getIsolatedBundleContext();
+
+  /**
+   * Returns the OSGi bundle representing the framework
+   * @return
+   */
+  public Bundle getFrameworkBundle();
+  
+  /**
+   * Returns a list of bundles currently installed in this framework
+   * @return
+   */
+  public List<Bundle> getBundles();
+  
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkConfiguration.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkConfiguration.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkConfiguration.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkConfiguration.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,31 @@
+/*
+ * 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.spi.framework;
+
+import java.util.Properties;
+
+public interface BundleFrameworkConfiguration {
+
+	public String getFrameworkID();
+	
+	public Properties getFrameworkProperties();
+	
+	public Properties getFrameworkManifest();
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkConfigurationFactory.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkConfigurationFactory.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkConfigurationFactory.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkConfigurationFactory.java Sun Feb 27 20:20:13 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.spi.framework;
+
+import org.apache.aries.application.management.AriesApplication;
+import org.osgi.framework.BundleContext;
+
+public interface BundleFrameworkConfigurationFactory
+{
+  /**
+   * Create a BundleFrameworkConfiguration with basic config
+   * @param parentCtx
+   * @return
+   */
+  public BundleFrameworkConfiguration createBundleFrameworkConfig(String frameworkId,
+      BundleContext parentCtx);
+
+  /**
+   * Create a BundleFrameworkConiguration for an application framework based
+   * on a given AriesApplication.
+   * @param parentCtx
+   * @param app
+   * @return
+   */
+  public BundleFrameworkConfiguration createBundleFrameworkConfig(String frameworkId,
+      BundleContext parentCtx, AriesApplication app);
+
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkFactory.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkFactory.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkFactory.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkFactory.java Sun Feb 27 20:20:13 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.spi.framework;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+public interface BundleFrameworkFactory
+{
+  /**
+   * Creates a new isolated bundle framework with the properties provided. 
+   * @param bc The context in which to install the new framework
+   * @param config The BundleFrameworkConfiguration object used to configure the returned framework
+   * @return
+   * @throws BundleException
+   */
+  public BundleFramework createBundleFramework(BundleContext bc, BundleFrameworkConfiguration config)
+      throws BundleException;
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkManager.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkManager.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkManager.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/framework/BundleFrameworkManager.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,117 @@
+/*
+ * 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.spi.framework;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.apache.aries.application.DeploymentContent;
+import org.apache.aries.application.DeploymentMetadata;
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.UpdateException;
+import org.apache.aries.application.management.spi.repository.BundleRepository.BundleSuggestion;
+
+public interface BundleFrameworkManager
+{
+  /**
+   * All additions/removals of frameworks and bundles from the shared bundle framework are
+   * performed under this object lock. Users bypassing this api and performing operations on 
+   * the underlying OSGi frameworks should be sure to hold this lock.
+   */
+  Object SHARED_FRAMEWORK_LOCK = new Object();
+
+  /**
+   * Gets the BundleFramework object associated with the given bundle
+   * @param frameworkBundle - The bundle representing the bundle framework
+   * @return
+   */
+  public BundleFramework getBundleFramework(Bundle frameworkBundle);
+  
+  /**
+   * Gets a reference to the single shared bundle framework. The Shared Bundle 
+   * Framework contains bundle shared between applications
+   * @return
+   */
+  public BundleFramework getSharedBundleFramework();
+  
+  /**
+   * Creates a new framework inside the shared bundle framework and installs a 
+   * collection of bundles into the framework.
+   * @param bundlesToInstall The collection of bundles to be installed
+   * @param app The application associated with this install
+   * @return
+   * @throws BundleException
+   */
+  public Bundle installIsolatedBundles(
+      Collection<BundleSuggestion> bundlesToInstall, 
+      AriesApplication app)
+    throws BundleException;
+  
+  /**
+   * Installs a collection of shared bundles to the shared bundle framework
+   * @param bundlesToInstall
+   * @param app
+   * @return
+   * @throws BundleException
+   */
+  public Collection<Bundle> installSharedBundles(
+      Collection<BundleSuggestion> bundlesToInstall, 
+      AriesApplication app)
+    throws BundleException;
+  
+  public boolean allowsUpdate(DeploymentMetadata newMetadata, DeploymentMetadata oldMetadata);
+  
+  public interface BundleLocator {
+    public Map<DeploymentContent, BundleSuggestion> suggestBundle(Collection<DeploymentContent> bundles) throws BundleException;    
+  }
+  
+  public void updateBundles(
+      DeploymentMetadata newMetadata, 
+      DeploymentMetadata oldMetadata, 
+      AriesApplication app, 
+      BundleLocator locator,
+      Set<Bundle> bundles,
+      boolean startBundles) throws UpdateException;
+  
+  /**
+   * Starts a previously installed bundle 
+   * @param b
+   * @throws BundleException
+   */
+  public void startBundle(Bundle b) throws BundleException;
+  
+  /**
+   * Stops a previously installed bundle   
+   * @param b
+   * @throws BundleException
+   */
+  public void stopBundle(Bundle b) throws BundleException;
+  
+  /**
+   * Removes a bundle from the runtime
+   * @param b
+   * @throws BundleException
+   */
+  public void uninstallBundle(Bundle b) throws BundleException;
+  
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/repository/BundleRepository.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/repository/BundleRepository.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/repository/BundleRepository.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/repository/BundleRepository.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,103 @@
+/*
+ * 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.spi.repository;
+
+import java.util.Set;
+
+import org.apache.aries.application.Content;
+import org.apache.aries.application.DeploymentContent;
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.spi.framework.BundleFramework;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+
+public interface BundleRepository {
+  /**
+   * Service property denoting the scope of the bundle repository. This can 
+   * <ul>
+   *  <li>global</li>
+   *  <li>&lt;app symbolic name&gt;_&lt;app version&gt;</li>
+   * </ul>
+   */
+  public static final String REPOSITORY_SCOPE = "repositoryScope";
+  public static final String GLOBAL_SCOPE = "global";
+  
+	/**
+	   * A suggested bundle to use.
+	   */
+	  public interface BundleSuggestion
+	  {
+	    /**
+	     * Install the bundle represented by this suggestion via the given context
+	     * 
+	     * @param ctx The context of the framework where the bundle is to be install
+	     * @param app The AriesApplication being installed
+	     * @return the installed bundle
+	     * @throws BundleException
+	     */
+	    public Bundle install(BundleFramework framework, 
+	                          AriesApplication app) throws BundleException;
+	    
+	    /**
+	     * Get the imports of the bundle 
+	     * @return 
+	     */
+	    public Set<Content> getImportPackage();
+	    
+	    /**
+	     * Get the exports of the bundle
+	     * @return
+	     */
+	    public Set<Content> getExportPackage();
+	    
+	    /**
+	     * @return the version of the bundle.
+	     */
+	    public Version getVersion();
+	    /**
+	     * This method can be queried to discover the cost of using this bundle 
+	     * repository. If two repositories define the same bundle with the same version
+	     * then the cheaper one will be used.
+	     * 
+	     * @return the cost of using this repository.
+	     */
+	    public int getCost();
+	  }
+
+	  /**
+	   * This method attempts to find a bundle in the repository that matches the
+	   * specified DeploymentContent specification. If none can be found then null must
+	   * be returned.
+	   * 
+	   * @param content the content used to locate a bundle.
+	   * @return      the bundle suggestion, or null.
+	   */
+	  public BundleSuggestion suggestBundleToUse(DeploymentContent content);
+	  
+	  /**
+	   * This method can be queried to discover the cost of using this bundle 
+	   * repository. If two repositories define the same bundle with the same version
+	   * then the cheaper one will be used.
+	   * 
+	   * @return the cost of using this repository.
+	   */
+	  public int getCost();
+}

Added: aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/repository/BundleRepositoryManager.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/repository/BundleRepositoryManager.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/repository/BundleRepositoryManager.java (added)
+++ aries/tags/application-0.3/application-api/src/main/java/org/apache/aries/application/management/spi/repository/BundleRepositoryManager.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,82 @@
+/*
+ * 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.spi.repository;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.aries.application.DeploymentContent;
+import org.apache.aries.application.management.spi.repository.BundleRepository.BundleSuggestion;
+
+public interface BundleRepositoryManager
+{
+  /**
+   * Gets a collection of all bundle repositories which can provide bundles to
+   * the given application scope.
+   * @param applicationName
+   * @param applicationVersion
+   * @return
+   */
+  public Collection<BundleRepository> getBundleRepositoryCollection(
+      String applicationName, String applicationVersion);
+  
+  /**
+   * Gets all known bundle repositories
+   * @return
+   */
+  public Collection<BundleRepository> getAllBundleRepositories();
+  
+  /**
+   * Get a collection of bundle installation suggestions from repositories
+   * suitable for the given application scope
+   * @param applicationName
+   * @param applicationVersion
+   * @param content
+   * @return
+   * @throws ContextException
+   */
+  public Map<DeploymentContent, BundleSuggestion> getBundleSuggestions(
+      String applicationName,
+      String applicationVersion,
+      Collection<DeploymentContent> content) throws ContextException;
+  
+  /**
+   * Get a collection of bundle installation suggestions from all 
+   * known repositories
+   * @param content
+   * @return
+   * @throws ContextException
+   */
+  public Map<DeploymentContent, BundleSuggestion> getBundleSuggestions(
+      Collection<DeploymentContent> content) throws ContextException;
+  
+  /**
+   * Get a collection of bundle installation suggestions from the collection of
+   * given repositories
+   * @param brs
+   * @param content
+   * @return
+   * @throws ContextException
+   */
+  public Map<DeploymentContent, BundleSuggestion> getBundleSuggestions(
+      Collection<BundleRepository> brs,
+      Collection<DeploymentContent> content) throws ContextException;
+  
+}