You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by mn...@apache.org on 2010/08/26 12:10:59 UTC

svn commit: r989583 - in /incubator/aries/trunk/application/application-api: ./ src/main/java/org/apache/aries/application/ src/main/java/org/apache/aries/application/filesystem/ src/main/java/org/apache/aries/application/management/ src/main/java/org/...

Author: mnuttall
Date: Thu Aug 26 10:10:58 2010
New Revision: 989583

URL: http://svn.apache.org/viewvc?rev=989583&view=rev
Log:
ARIES-361: Provisioning changes required to support application isolation. From a patch submitted by Emily Jiang.

Added:
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/PostResolveTransformer.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/DeploymentManifestManager.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/InvalidAttributeException.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/PlatformRepository.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/RepositoryGenerator.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/Consumer.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/DeploymentMFElement.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedBundle.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedPackage.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedService.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedBundle.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedPackage.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedService.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModelledResource.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModelledResourceManager.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModellerException.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ParsedServiceElements.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ParserProxy.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/Provider.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ResourceType.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/WrappedReferenceMetadata.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/WrappedServiceMetadata.java
Modified:
    incubator/aries/trunk/application/application-api/pom.xml
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/ApplicationMetadata.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/Content.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadata.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadataFactory.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/filesystem/IDirectory.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationResolver.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/BundleInfo.java

Modified: incubator/aries/trunk/application/application-api/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/pom.xml?rev=989583&r1=989582&r2=989583&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/pom.xml (original)
+++ incubator/aries/trunk/application/application-api/pom.xml Thu Aug 26 10:10:58 2010
@@ -35,7 +35,8 @@
         <aries.osgi.export.pkg>
             org.apache.aries.application;
             org.apache.aries.application.filesystem;
-            org.apache.aries.application.management
+            org.apache.aries.application.management;
+            org.apache.aries.application.modelling
         </aries.osgi.export.pkg>
     </properties>
 

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/ApplicationMetadata.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/ApplicationMetadata.java?rev=989583&r1=989582&r2=989583&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/ApplicationMetadata.java (original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/ApplicationMetadata.java Thu Aug 26 10:10:58 2010
@@ -21,6 +21,7 @@ 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;
@@ -76,6 +77,12 @@ public interface ApplicationMetadata
    */
   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

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/Content.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/Content.java?rev=989583&r1=989582&r2=989583&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/Content.java (original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/Content.java Thu Aug 26 10:10:58 2010
@@ -28,8 +28,8 @@ import java.util.Map;
 public interface Content
 {
   /**
-   * get the package name of the content
-   * @return    the package name of the content
+   * get the content name of the content
+   * @return    the content name of the content
    */
   public String getContentName();
   

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadata.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadata.java?rev=989583&r1=989582&r2=989583&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadata.java (original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadata.java Thu Aug 26 10:10:58 2010
@@ -24,8 +24,10 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.util.Collection;
 import java.util.List;
-import java.util.Set;
+import java.util.Map;
 
+import org.apache.aries.application.management.InvalidAttributeException;
+import org.osgi.framework.Filter;
 import org.osgi.framework.Version;
 
 /**
@@ -59,8 +61,8 @@ public interface DeploymentMetadata {
   public List<DeploymentContent> getApplicationProvisionBundles();
   
   /**
-   * get the value of Deployed-Use-Bundle
-   * the bundle here can contain a range
+   * get the value of Deployed-UseBundle header
+   * 
    * @return
    */
   public Collection<DeploymentContent> getDeployedUseBundle();
@@ -72,6 +74,17 @@ public interface DeploymentMetadata {
   public Collection<Content> getImportPackage();
 
   /**
+   * Get the list of DeployedService-Import
+   * @return DeployedService-Import
+   */
+  public Collection<Filter> getDeployedServiceImport() throws InvalidAttributeException;
+  
+  /**
+   * 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.

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadataFactory.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadataFactory.java?rev=989583&r1=989582&r2=989583&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadataFactory.java (original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadataFactory.java Thu Aug 26 10:10:58 2010
@@ -35,13 +35,14 @@ import org.apache.aries.application.mana
 public interface DeploymentMetadataFactory {
 
   /** 
-   * Create a DeploymentMetadata from an AriesApplication and its by-value bundles. 
+   * 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;
   

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/PostResolveTransformer.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/PostResolveTransformer.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/PostResolveTransformer.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/PostResolveTransformer.java Thu Aug 26 10:10:58 2010
@@ -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;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.ResolverException;
+import org.apache.aries.application.modelling.ModelledResource;
+
+public interface PostResolveTransformer
+{
+/**
+ *  This method is to perform any post process after the resolver returns back a collection of bundles. It returns the updated manifest map.
+ * @param app Aries application
+ * @param bundles A collection of bundles required by this application. 
+ * @param deploymentHeaders the deployment manifest map
+ * @throws ResolverException
+ */
+  void postResolveProcess(AriesApplication app, Collection<ModelledResource> bundles, Map<String, String> deploymentHeaders) throws ResolverException;
+  
+}

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/filesystem/IDirectory.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/filesystem/IDirectory.java?rev=989583&r1=989582&r2=989583&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/filesystem/IDirectory.java (original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/filesystem/IDirectory.java Thu Aug 26 10:10:58 2010
@@ -32,6 +32,13 @@ public interface IDirectory extends Iter
    *         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

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationResolver.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationResolver.java?rev=989583&r1=989582&r2=989583&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationResolver.java (original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationResolver.java Thu Aug 26 10:10:58 2010
@@ -19,9 +19,12 @@
 
 package org.apache.aries.application.management;
 
+import java.util.Collection;
 import java.util.Set;
 
 import org.apache.aries.application.ApplicationMetadata;
+import org.apache.aries.application.Content;
+import org.apache.aries.application.modelling.ModelledResource;
 import org.osgi.framework.Version;
 
 /**
@@ -36,6 +39,7 @@ import org.osgi.framework.Version;
 public interface AriesApplicationResolver {
 
   /** 
+   * Deprecated. Use the method resolve(String appName, String appVersion, Collection<ModelledResource> byValueBundles, Collection<Content> inputs) throws ResolverException;
    * Resolve an AriesApplication. The implementation of this method is expected to do the following:
    * 
    * <ol>
@@ -56,6 +60,7 @@ public interface AriesApplicationResolve
    *         set will not include those provided by value within the application.
    * @throws ResolverException if the application cannot be resolved.  
    */
+  @Deprecated
   Set<BundleInfo> resolve (AriesApplication app, ResolveConstraint... constraints) throws ResolverException ;
 
   /** 
@@ -69,4 +74,19 @@ public interface AriesApplicationResolve
    * @return the BundleInfo for the requested bundle, or null if none could be found.
    */
   BundleInfo getBundleInfo(String bundleSymbolicName, Version bundleVersion);
+  /**
+   * Resolve an AriesApplication. The resolving process will build a repository from by-value bundles. 
+   * It then scans all the required bundles and pull the dependencies required to resolve the bundles.
+   * 
+   * 
+   * Return a collect of modelled resources. This method is called when installing an application
+   * @param appName Application name
+   * @param appVersion application version
+   * @param byValueBundles by value bundles
+   * @param inputs bundle requirement
+   * @return a collection of modelled resource required by this application.
+   * @throws ResolverException
+   */
+  Collection<ModelledResource> resolve(String appName, String appVersion, Collection<ModelledResource> byValueBundles, Collection<Content> inputs) throws ResolverException;
+
 }

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/BundleInfo.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/BundleInfo.java?rev=989583&r1=989582&r2=989583&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/BundleInfo.java (original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/BundleInfo.java Thu Aug 26 10:10:58 2010
@@ -21,6 +21,8 @@ package org.apache.aries.application.man
 
 import java.util.Map;
 import java.util.Set;
+import java.util.jar.Attributes;
+
 import org.osgi.framework.Version;
 import org.apache.aries.application.Content;
 
@@ -62,4 +64,6 @@ public interface BundleInfo
   /** 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: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/DeploymentManifestManager.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/DeploymentManifestManager.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/DeploymentManifestManager.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/DeploymentManifestManager.java Thu Aug 26 10:10:58 2010
@@ -0,0 +1,56 @@
+/*
+ * 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.Collection;
+import java.util.jar.Manifest;
+
+import org.apache.aries.application.Content;
+import org.apache.aries.application.modelling.ModelledResource;
+
+public interface DeploymentManifestManager
+{
+  /**
+   * Generate the deployment manifest map for the application. The method is designed to be used when installing an application.
+   * @param app The Aries application
+   * @param constraints the constraints, used to narrow down the deployment content
+   * @return the deployment manifest 
+   * @throws ResolverException
+   */
+  Manifest generateDeploymentManifest( AriesApplication app, ResolveConstraint... constraints ) throws ResolverException;
+  
+  
+  /**
+   * Generate the deployment manifest map. The method can be used for some advanced scenarios.
+   * @param app The Aries application
+   * @param byValueBundles By value bundles
+   * @param useBundleSet Use Bundle set
+   * @param otherBundles Other bundles to be used to narrow the resolved bundles
+   * @return the deployment manifest 
+   * @throws ResolverException
+   */
+  Manifest generateDeploymentManifest( AriesApplication app, Collection<ModelledResource> byValueBundles, Collection<Content> useBundleSet, Collection<Content> otherBundles) throws ResolverException;
+
+  /**
+   * 
+   * @return the AriesApplicationResolver
+   */
+  AriesApplicationResolver getResolver();
+  
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/InvalidAttributeException.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/InvalidAttributeException.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/InvalidAttributeException.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/InvalidAttributeException.java Thu Aug 26 10:10:58 2010
@@ -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.management;
+
+
+
+public class InvalidAttributeException extends Exception
+{
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 4889305636433626372L;
+
+  public InvalidAttributeException (Exception e) { 
+    super(e);
+  }
+  
+  public InvalidAttributeException (String s) { 
+    super(s);
+  }
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/PlatformRepository.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/PlatformRepository.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/PlatformRepository.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/PlatformRepository.java Thu Aug 26 10:10:58 2010
@@ -0,0 +1,37 @@
+/*
+ * 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.URI;
+import java.util.Collection;
+
+/**
+ * This interface allows one to find out information about configured bundle repositories
+ *
+ */
+public interface PlatformRepository {
+
+  
+  /**
+   * Obtain a set of URIs to bundle repositories representing the local platform's capabilities. 
+   * These repositories do not represent any bundles but only platform capabilities.   
+   * @return URLs to bundle repositories representing the local platform 
+   */
+  Collection<URI> getPlatformRepositoryURLs();
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/RepositoryGenerator.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/RepositoryGenerator.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/RepositoryGenerator.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/RepositoryGenerator.java Thu Aug 26 10:10:58 2010
@@ -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;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collection;
+
+import org.apache.aries.application.modelling.ModelledResource;
+
+public interface RepositoryGenerator
+{
+  /**
+   * Generate repository and store the content in the output stream.
+   * @param repositoryName The repository name
+   * @param byValueBundles By value bundles
+   * @param os output stream
+   * @throws ResolverException
+   * @throws IOException
+   */
+  void generateRepository(String repositoryName, Collection<? extends ModelledResource> byValueBundles, OutputStream os) throws ResolverException, IOException;
+  
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/Consumer.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/Consumer.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/Consumer.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/Consumer.java Thu Aug 26 10:10:58 2010
@@ -0,0 +1,59 @@
+/*
+ * 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.modelling;
+
+
+/* Base interface for a model of a requirement, or need for something, such as a bundle, 
+ * package or service. 
+ */
+public interface Consumer
+{
+  /**
+   * Return the resource type
+   * @return the resource type, such as BUNDLE, PACKAGE, SERVICE, OTHER
+   */
+  ResourceType getType();
+  
+  /**
+   * This is not the same as the filter which you might get, say, by parsing a blueprint
+   * reference. It is more specific - and usable at runtime.  
+   * 
+   * @return String filter matching every property required by this consumer
+   */
+  String getAttributeFilter();
+  /**
+   * Whether the resources consumed can be multiple.
+   * @return true if multiple resources can be consumed.
+   */
+  boolean isMultiple();
+
+  /**
+   * Whether the resource consumed can be optional.
+   * @return true if optional.
+   */
+  boolean isOptional();
+
+  /**
+   * Whether the provider object satisfies the consume criteria.
+   * @param capability The provider capability
+   * @return true if the capability satisfies the consuming criteria.
+   */
+  boolean isSatisfied(Provider capability);
+  
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/DeploymentMFElement.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/DeploymentMFElement.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/DeploymentMFElement.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/DeploymentMFElement.java Thu Aug 26 10:10:58 2010
@@ -0,0 +1,28 @@
+/*
+ * 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.modelling;
+
+public interface DeploymentMFElement
+{
+  /**
+   *  @return String suitable for inclusion in DEPLOYMENT.MF
+   */
+  public String toDeploymentString();
+
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedBundle.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedBundle.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedBundle.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedBundle.java Thu Aug 26 10:10:58 2010
@@ -0,0 +1,49 @@
+/*
+ * 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.modelling;
+/**
+ * Model a bundle, required by another bundle.
+ *
+ */
+public interface ExportedBundle extends Provider, DeploymentMFElement
+{
+  /**
+   * The bundle symbolic name
+   * @return the bundle symbolic name
+   */
+  String getSymbolicName();
+  /**
+   * The bundle version
+   * @return the bundle version
+   */
+  String getVersion();
+  
+  /**
+   * Whether the bundle is fragment
+   * @return
+   */
+  boolean isFragment();
+  
+  /**
+   * Get the fragment host.
+   * @return The fragment host that the bundle attaches.
+   */
+  ImportedBundle getFragmentHost();
+
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedPackage.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedPackage.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedPackage.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedPackage.java Thu Aug 26 10:10:58 2010
@@ -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.modelling;
+
+/**
+ * Model an exported package.
+ *
+ */
+public interface ExportedPackage extends Provider, DeploymentMFElement
+{
+
+  /**
+   * The package name
+   * @return The package name
+   */
+  String getPackageName();
+  /**
+   * The package version
+   * @return The package version
+   */
+  String getVersion();
+  /**
+   * The resource that exports the package.
+   * @return The resource that exports the package.
+   */
+  ModelledResource getBundle();
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedService.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedService.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedService.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ExportedService.java Thu Aug 26 10:10:58 2010
@@ -0,0 +1,28 @@
+/*
+ * 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.modelling;
+
+/**
+ * This interface models the exported service. It has no other methods apart from the 
+ * two super interfaces Provider and WrappedServiceMetadata.
+ */
+public interface ExportedService extends Provider, WrappedServiceMetadata
+{
+
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedBundle.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedBundle.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedBundle.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedBundle.java Thu Aug 26 10:10:58 2010
@@ -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.modelling;
+
+/**
+ * Model a required bundle.
+ * 
+ */
+public interface ImportedBundle extends Consumer
+{
+
+  /**
+   * The imported bundle symbolic name
+   * @return
+   */
+  String getSymbolicName();
+  /**
+   * The version range that the imported bundle's version fall into.
+   * @return The version range as a string.
+   */
+  String getVersionRange();
+  
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedPackage.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedPackage.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedPackage.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedPackage.java Thu Aug 26 10:10:58 2010
@@ -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.modelling;
+
+import java.util.Map;
+/**
+ * Model an imported package.
+ */
+public interface ImportedPackage extends Consumer, DeploymentMFElement
+{
+
+  /**
+   * The imported package name
+   * @return the package name
+   */
+  String getPackageName();
+  /**
+   * The imported package version 
+   * @return the version range as a string.
+   */
+  String getVersionRange();
+  /**
+   * All attributes specified in the import package header
+   * @return the map containing the attributes.
+   */
+  Map<String, String> getAttributes();
+
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedService.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedService.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedService.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ImportedService.java Thu Aug 26 10:10:58 2010
@@ -0,0 +1,27 @@
+/*
+ * 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.modelling;
+/**
+ * This interface represents the imported service. It has no other methods apart from the 
+ * two super interfaces Consumer, DeploymentMFElement and WrappedReferenceMetadata.
+ */
+public interface ImportedService extends Consumer, WrappedReferenceMetadata, DeploymentMFElement
+{
+
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModelledResource.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModelledResource.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModelledResource.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModelledResource.java Thu Aug 26 10:10:58 2010
@@ -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.modelling;
+
+import java.util.Collection;
+/**
+ * Model a bundle resource.
+ *
+ */
+public interface ModelledResource extends DeploymentMFElement
+{
+  
+  /**
+   * The resource's symbolic name
+   * @return The resource symbolic name
+   */
+  String getSymbolicName();
+
+  /**
+   * The resource version
+   * @return The resource version
+   */
+  String getVersion();
+
+  /** Returns a String which can be turned into a URL to the bundle binary 
+   * @return the location of the bundle
+   */
+  public String getLocation();
+
+  /**
+   * Import-Package header modelled to be a collection of the imported packages objects.
+   * @return a collection of the imported packages.
+   */
+  Collection<? extends ImportedPackage> getImportedPackages();  
+
+  /**
+   * Import-Service header modelled to be a collection of imported service objects. 
+   * This contains the blueprint service referenced by this resource.
+   * @return a collection of the imported services.
+   */
+  Collection<? extends ImportedService> getImportedServices();
+
+  /**
+   * Export-Package header modelled to be a collection of exported package objects.
+   * @return a collection of exported package objects.
+   */
+  Collection<? extends ExportedPackage> getExportedPackages();
+
+  /**
+   * Export-Service header modelled to be a collection of exported service objects.
+   * This includes the blueprint services supported by this resource.
+   * @return a collection of exported service objects.
+   */
+  Collection<? extends ExportedService> getExportedServices();
+
+  /**
+   * Return the bundle that represents the resource object.
+   * @return
+   */
+  ExportedBundle getExportedBundle();
+
+  /**
+   * The resource type, mainly BUNDLE or other special bundle.
+   * @return The resource type.
+   */
+  ResourceType getType();
+
+  /**
+   * The required bundles modelled as a collection of ImportedBundle objects.
+   * @return a collection of ImportedBundle objects.
+   */
+  Collection<? extends ImportedBundle> getRequiredBundles();
+
+  /**
+   * Whether the resource is fragment.
+   * @return
+   */
+  boolean isFragment();
+
+  /**
+   * The fragment host.
+   * @return The fragment host.
+   */
+  public ImportedBundle getFragmentHost();
+
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModelledResourceManager.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModelledResourceManager.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModelledResourceManager.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModelledResourceManager.java Thu Aug 26 10:10:58 2010
@@ -0,0 +1,33 @@
+/*
+ * 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.modelling;
+
+import org.apache.aries.application.filesystem.IDirectory;
+
+public interface ModelledResourceManager
+{
+  /**
+   * Obtain a ModelledResource object
+   * @param uri the file uri
+   * @param bundle the bundle file
+   * @return
+   */
+  ModelledResource getModelledResource(String uri, IDirectory bundle) throws ModellerException;
+
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModellerException.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModellerException.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModellerException.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModellerException.java Thu Aug 26 10:10:58 2010
@@ -0,0 +1,32 @@
+/*
+ * 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.modelling;
+
+
+
+public class ModellerException extends Exception {
+
+  public ModellerException (String s) { 
+    super(s);
+  }
+  
+  public ModellerException (Exception e) { 
+    super (e);
+  }
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ParsedServiceElements.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ParsedServiceElements.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ParsedServiceElements.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ParsedServiceElements.java Thu Aug 26 10:10:58 2010
@@ -0,0 +1,29 @@
+package org.apache.aries.application.modelling;
+
+
+import java.util.Collection;
+
+
+
+/**
+ * A simple data structure containing two immutable Collections, 
+ * one each of ImportedServiceImpl and ExportedServiceImpl
+ */
+public interface  ParsedServiceElements 
+{
+ 
+ 
+
+
+  /**
+   * Get the ImportedServices
+   * @return imported services
+   */
+  public Collection<ImportedService> getReferences();
+
+  /**
+   * Get the exported services
+   * @return exported services
+   */
+  public Collection<ExportedService> getServices();
+}
\ No newline at end of file

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ParserProxy.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ParserProxy.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ParserProxy.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ParserProxy.java Thu Aug 26 10:10:58 2010
@@ -0,0 +1,44 @@
+package org.apache.aries.application.modelling;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+
+/** 
+ * This interface is implemented by the service which proxies the
+ * Apache Aries blueprint parser. ParserProxy services offer higher
+ * level methods built on top of the Blueprint parser. 
+ *
+ */
+public interface ParserProxy {
+
+  /**
+   * Parse blueprint xml files and extract the parsed ServiceMetadata objects
+   * @param blueprintsToParse URLs to blueprint xml files
+   * @return List of (wrapped) ServiceMetadata objects
+   */
+  public List<? extends WrappedServiceMetadata> parse (List<URL> blueprintsToParse) throws Exception;
+  
+  /**
+   * Parse a blueprint xml files and extract the parsed ServiceMetadata objects
+   * @param blueprintToParse URL to blueprint xml file
+   * @return List of (wrapped) ServiceMetadata objects
+   */
+  public List<? extends WrappedServiceMetadata> parse (URL blueprintToParse) throws Exception;
+  
+  /**
+   * Parse an InputStream containing blueprint xml and extract the parsed ServiceMetadata objects
+   * @param blueprintToParse InputStream containing blueprint xml data. The caller is responsible
+   * for closing the stream afterwards. 
+   * @return List of (wrapped) ServiceMetadata objects
+   */
+  public List<? extends WrappedServiceMetadata> parse (InputStream blueprintToParse) throws Exception;
+  
+  /**
+   * Parse an InputStream containing blueprint xml and extract Service, Reference and RefList
+   * elements.
+   * @return All parsed Service, Reference and RefList elements 
+   */
+  public ParsedServiceElements parseAllServiceElements (InputStream blueprintToParse) throws Exception;
+  
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/Provider.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/Provider.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/Provider.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/Provider.java Thu Aug 26 10:10:58 2010
@@ -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.modelling;
+
+
+
+import java.util.Map;
+
+
+/** Base interface to model a bundle, package or service
+ */
+public interface Provider
+{
+  /**
+   * Get resource type.
+   * @return The resource type.
+   */
+  ResourceType getType();
+  
+  /** ResourceType-dependent things. See Capability.getProperties() 
+   * Define constants for things like a service's list of interfaces, versions, etc */
+  Map<String, Object> getAttributes();
+  
+  
+}
\ No newline at end of file

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ResourceType.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ResourceType.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ResourceType.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ResourceType.java Thu Aug 26 10:10:58 2010
@@ -0,0 +1,13 @@
+package org.apache.aries.application.modelling;
+
+
+
+public enum ResourceType {BUNDLE, PACKAGE, SERVICE, COMPOSITE, OTHER;
+  /**
+   * An enum class to represent the resource type, such as bundle, package, service etc.
+   */
+  @Override
+  public String toString() {
+    return super.toString().toLowerCase();
+  }
+}
\ No newline at end of file

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/WrappedReferenceMetadata.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/WrappedReferenceMetadata.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/WrappedReferenceMetadata.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/WrappedReferenceMetadata.java Thu Aug 26 10:10:58 2010
@@ -0,0 +1,45 @@
+package org.apache.aries.application.modelling;
+
+
+/**
+ * Information about a parsed blueprint reference
+ */
+public interface WrappedReferenceMetadata
+{
+  /**
+   * Get the properties of the associated blueprint service
+   * @return The filter, or null for no filter
+   */
+  String getFilter();
+  
+  /**
+   * Get the interface required by the reference
+   * @return the interface, or null if unspecified
+   */
+  String getInterface();
+  
+  /**
+   * Get the component-name attribute.
+   * @return Service name
+   */
+  String getComponentName();
+ 
+  
+  /**
+   * Is this a reference list or a reference
+   * @return true if a reference list
+   */
+  boolean isList();
+
+  /**
+   * Is this an optional reference
+   * @return true if optional
+   */
+  boolean isOptional();
+
+  /**
+   * Get the reference's id as defined in the blueprint
+   * @return the blueprint reference id
+   */
+  String getId();
+}

Added: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/WrappedServiceMetadata.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/WrappedServiceMetadata.java?rev=989583&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/WrappedServiceMetadata.java (added)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/WrappedServiceMetadata.java Thu Aug 26 10:10:58 2010
@@ -0,0 +1,47 @@
+package org.apache.aries.application.modelling;
+
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * A proxy for org.osgi.service.blueprint.reflect.ServiceMetadata, which we cannot
+ * pass to clients in the outer framework. We'll just expose the methods that we 
+ * know we're going to need. 
+ *
+ */
+public interface WrappedServiceMetadata extends Comparable<WrappedServiceMetadata> {
+
+  /**
+   * Get the properties of the associated blueprint service
+   * @return Service properties. The values in the Map will be either String or String[]. 
+   */
+  Map<String, Object> getServiceProperties();
+  
+  /**
+   * Get the interfaces implemented by the service
+   * @return List of interfaces
+   */
+  Collection<String> getInterfaces();
+  
+  /**
+   * Get the service name. This we hope will be short, human-readable, and unique.
+   * @return Service name 
+   */
+  String getName();
+  
+  /**
+   * Get the service ranking
+   * @return ranking
+   */
+  int getRanking();
+  
+  /**
+   * Sometimes we want to know if two services are identical except for their names
+   * @param w A wrapped service metadata for comparison.
+   * @return true if the two services are indistinguishable (in the OSGi service registry) - 
+   * this will be true if only their names are different, and their interfaces and service 
+   * properties the same. 
+   */
+  boolean identicalOrDiffersOnlyByName (WrappedServiceMetadata w);
+}