aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mnutt...@apache.org
Subject svn commit: r1021799 - in /incubator/aries/trunk/application: application-api/src/main/java/org/apache/aries/application/modelling/ application-modeller/src/main/java/org/apache/aries/application/modelling/impl/
Date Tue, 12 Oct 2010 15:32:13 GMT
Author: mnuttall
Date: Tue Oct 12 15:32:13 2010
New Revision: 1021799

URL: http://svn.apache.org/viewvc?rev=1021799&view=rev
Log:
ARIES-361: New constructor for ModelledResource. Sometimes it's necessary to build an ExportedBundle
externally. 

Modified:
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModellingManager.java
    incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceImpl.java
    incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModellingManagerImpl.java

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModellingManager.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModellingManager.java?rev=1021799&r1=1021798&r2=1021799&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModellingManager.java
(original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/modelling/ModellingManager.java
Tue Oct 12 15:32:13 2010
@@ -65,6 +65,14 @@ public interface ModellingManager {
       Collection<ImportedService> importedServices,
       Collection<ExportedService> exportedServices)
       throws InvalidAttributeException;
+  
+  ModelledResource getModelledResource (String fileURI, 
+      Attributes bundleAttributes,
+      ExportedBundle exportedBundle, 
+      ResourceType resourceType, 
+      Collection<ImportedService> importedServices,
+      Collection<ExportedService> exportedServices)
+      throws InvalidAttributeException;
 
   ParsedServiceElements getParsedServiceElements(
       Collection<ExportedService> services,

Modified: incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceImpl.java?rev=1021799&r1=1021798&r2=1021799&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceImpl.java
(original)
+++ incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceImpl.java
Tue Oct 12 15:32:13 2010
@@ -71,8 +71,8 @@ public class ModelledResourceImpl implem
   private final Collection<ExportedPackage> _exportedPackages;
   private final Collection<ImportedPackage> _importedPackages;
   private final Collection<ImportedBundle> _requiredBundles;
-  private final ExportedBundle _exportedBundle;
-  private final ResourceType _resourceType;
+  private final ExportedBundle _exportedBundle; 
+  private final ResourceType _resourceType;     
   
   /**
    * Construct a new {@link ModelledResourceImpl} for the following manifest and services
@@ -97,11 +97,48 @@ public class ModelledResourceImpl implem
    * @throws InvalidAttributeException
    */
   @SuppressWarnings("deprecation")
+  public ModelledResourceImpl (String fileURI, Attributes bundleAttributes, ExportedBundle
exportedBundle, ResourceType resourceType,
+      Collection<ImportedService> importedServices, 
+      Collection<ExportedService> exportedServices) throws InvalidAttributeException
+  { 
+    this (fileURI, bundleAttributes, resourceType, exportedBundle, importedServices, exportedServices);
+    logger.debug(LOG_ENTRY, "ModelledResourceImpl", new Object[]{fileURI, bundleAttributes,
importedServices, exportedServices});
+    logger.debug(LOG_EXIT, "ModelledResourceImpl");
+  }
+
+  /**
+   * Construct a new {@link ModelledResourceImpl} for the following manifest and services
+   * @param fileURI The location of the bundle, may be null, which indicates a by value bundle
+   * @param bundleAttributes The bundle manifest, must not be null
+   * @param importedServices The blueprint references defined by the bundle. May be null
+   * @param exportedServices The blueprint services exported by the bundle. May be null
+   * @throws InvalidAttributeException
+   */
+  @SuppressWarnings("deprecation")
   public ModelledResourceImpl (String fileURI, Attributes bundleAttributes, 
       Collection<ImportedService> importedServices, 
       Collection<ExportedService> exportedServices) throws InvalidAttributeException
   { 
+    this (fileURI, bundleAttributes, ResourceType.BUNDLE, null, importedServices, exportedServices
);
     logger.debug(LOG_ENTRY, "ModelledResourceImpl", new Object[]{fileURI, bundleAttributes,
importedServices, exportedServices});
+    logger.debug(LOG_EXIT, "ModelledResourceImpl");
+  }
+  
+  public ModelledResourceImpl (String fileURI, Attributes bundleAttributes, 
+      ResourceType resourceType, ExportedBundle exportedBundle,
+      Collection<ImportedService> importedServices, 
+      Collection<ExportedService> exportedServices 
+      ) throws InvalidAttributeException 
+  {
+    logger.debug(LOG_ENTRY, "ModelledResourceImpl", new Object[]{fileURI, bundleAttributes,
importedServices, exportedServices, 
+        resourceType});
+
+    if (exportedBundle == null) { 
+      _exportedBundle = new ExportedBundleImpl (bundleAttributes);
+    } else { 
+      _exportedBundle = exportedBundle;
+    }
+    _resourceType = resourceType;
     _fileURI = fileURI;
     if(importedServices != null)
       _importedServices = new ArrayList<ImportedService> (importedServices);
@@ -113,12 +150,6 @@ public class ModelledResourceImpl implem
     else
       _exportedServices = new ArrayList<ExportedService>();
     
-    
-      _resourceType = ResourceType.BUNDLE;
-      _exportedBundle = new ExportedBundleImpl (bundleAttributes);
-  
-
-    
     _exportedPackages = new ArrayList<ExportedPackage>();
     String packageExports = bundleAttributes.getValue(EXPORT_PACKAGE);
     if (packageExports != null) {
@@ -130,7 +161,7 @@ public class ModelledResourceImpl implem
     
       }
     }
-
+  
     _importedPackages = new ArrayList<ImportedPackage>();
     String packageImports = bundleAttributes.getValue(IMPORT_PACKAGE);
     if (packageImports != null) {
@@ -156,7 +187,7 @@ public class ModelledResourceImpl implem
         _exportedServices.add(new ExportedServiceImpl(exportedService.getName(), exportedService.getValue()));
       }
     }
-
+  
     String serviceImports =null;
     if (_resourceType == ResourceType.BUNDLE) { 
       serviceImports = bundleAttributes.getValue(IMPORT_SERVICE);
@@ -204,7 +235,6 @@ public class ModelledResourceImpl implem
         }
       }
     }
-
     logger.debug(LOG_EXIT, "ModelledResourceImpl");
   }
 

Modified: incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModellingManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModellingManagerImpl.java?rev=1021799&r1=1021798&r2=1021799&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModellingManagerImpl.java
(original)
+++ incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModellingManagerImpl.java
Tue Oct 12 15:32:13 2010
@@ -33,6 +33,7 @@ import org.apache.aries.application.mode
 import org.apache.aries.application.modelling.ModelledResource;
 import org.apache.aries.application.modelling.ModellingManager;
 import org.apache.aries.application.modelling.ParsedServiceElements;
+import org.apache.aries.application.modelling.ResourceType;
 
 public class ModellingManagerImpl implements ModellingManager
 {
@@ -129,4 +130,10 @@ public class ModellingManagerImpl implem
       Collection<ImportedService> references) {
     return new ParsedServiceElementsImpl(services, references);
   }
+  public ModelledResource getModelledResource(String fileURI,
+      Attributes bundleAttributes, ExportedBundle exportedBundle,
+      ResourceType resourceType, Collection<ImportedService> importedServices,
+      Collection<ExportedService> exportedServices) throws InvalidAttributeException
{
+    return new ModelledResourceImpl(fileURI, bundleAttributes, exportedBundle, resourceType,
importedServices, exportedServices);
+  }
 }



Mime
View raw message