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/31 14:31:05 UTC
svn commit: r991173 - in /incubator/aries/trunk/application:
application-deployment-management/
application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/impl/
application-deployment-management/src/main/java/org...
Author: mnuttall
Date: Tue Aug 31 12:31:05 2010
New Revision: 991173
URL: http://svn.apache.org/viewvc?rev=991173&view=rev
Log:
ARIES-361: Extra tests and bug fixes from a patch by emily Jiang
Added:
incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceManagerImpl.java
incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ParserProxyImpl.java
incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/internal/BundleBlueprintParser.java
incubator/aries/trunk/application/application-modeller/src/main/resources/OSGI-INF/
incubator/aries/trunk/application/application-modeller/src/main/resources/OSGI-INF/blueprint/
incubator/aries/trunk/application/application-modeller/src/main/resources/OSGI-INF/blueprint/app-modeller.xml
incubator/aries/trunk/application/application-utils/src/test/resources/META-INF/APPLICATION4.MF
incubator/aries/trunk/application/application-utils/src/test/resources/META-INF/DEPLOYMENT.MF
Removed:
incubator/aries/trunk/application/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/impl/ModelledResourceManagerImpl.java
incubator/aries/trunk/application/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/impl/ParserProxyImpl.java
incubator/aries/trunk/application/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/internal/BundleBlueprintParser.java
Modified:
incubator/aries/trunk/application/application-deployment-management/pom.xml
incubator/aries/trunk/application/application-deployment-management/src/main/resources/OSGI-INF/blueprint/deployment-manager.xml
incubator/aries/trunk/application/application-deployment-management/src/main/resources/org/apache/aries/application/deployment/management/messages/DeploymentManagementMessages.properties
incubator/aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java
incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverAdvancedTest.java
incubator/aries/trunk/application/application-modeller/pom.xml
incubator/aries/trunk/application/application-modeller/src/main/resources/org/apache/aries/application/modelling/messages/APPModellingMessages.properties
incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java
incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/RepositoryGeneratorImpl.java
incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml
incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/impl/ApplicationMetadataImplTest.java
incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/utils/filesystem/FileSystemTest.java
incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/utils/manifest/BundleManifestTest.java
Modified: incubator/aries/trunk/application/application-deployment-management/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-deployment-management/pom.xml?rev=991173&r1=991172&r2=991173&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-deployment-management/pom.xml (original)
+++ incubator/aries/trunk/application/application-deployment-management/pom.xml Tue Aug 31 12:31:05 2010
@@ -82,16 +82,7 @@
<groupId>org.apache.aries.application</groupId>
<artifactId>org.apache.aries.application.modeller</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.aries.blueprint</groupId>
- <artifactId>org.apache.aries.blueprint.api</artifactId>
- <version>0.3-incubating-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.aries.blueprint</groupId>
- <artifactId>org.apache.aries.blueprint.core</artifactId>
- <version>0.3-incubating-SNAPSHOT</version>
- </dependency>
+
</dependencies>
Modified: incubator/aries/trunk/application/application-deployment-management/src/main/resources/OSGI-INF/blueprint/deployment-manager.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-deployment-management/src/main/resources/OSGI-INF/blueprint/deployment-manager.xml?rev=991173&r1=991172&r2=991173&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-deployment-management/src/main/resources/OSGI-INF/blueprint/deployment-manager.xml (original)
+++ incubator/aries/trunk/application/application-deployment-management/src/main/resources/OSGI-INF/blueprint/deployment-manager.xml Tue Aug 31 12:31:05 2010
@@ -19,19 +19,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
- <bean id="bluePrintParserProxy" class="org.apache.aries.application.deployment.management.impl.ParserProxyImpl">
- <property name= "parserService" ref="parser-service"/>
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </bean>
- <reference id="parser-service" interface="org.apache.aries.blueprint.ParserService"/>
-
-
- <bean id="modelledResourceManager" class="org.apache.aries.application.deployment.management.impl.ModelledResourceManagerImpl">
- <property name ="parserProxy" ref="bluePrintParserProxy"/>
- </bean>
-
- <service id = "modelledResourceManagerService" ref="modelledResourceManager" interface="org.apache.aries.application.modelling.ModelledResourceManager"/>
-
<bean id="deploymentManifestManager" class="org.apache.aries.application.deployment.management.impl.DeploymentManifestManagerImpl">
<property name="resolver" ref="resolver"/>
<property name="postResolveTransformers" ref="post-resolver-transformers"/>
@@ -39,16 +26,11 @@
<property name="localPlatform" ref="localPlatform"/>
</bean>
-
+ <reference id = "modelledResourceManager" interface="org.apache.aries.application.modelling.ModelledResourceManager"/>
<reference id="localPlatform" interface="org.apache.aries.application.management.LocalPlatform"/>
<reference id="resolver" interface="org.apache.aries.application.management.AriesApplicationResolver"/>
<reference-list id="post-resolver-transformers" interface="org.apache.aries.application.PostResolveTransformer" availability="optional"/>
<service id ="deploymentManifestManager-Service" ref="deploymentManifestManager" interface="org.apache.aries.application.management.DeploymentManifestManager"/>
-
- <service id="parserProxyService" ref="bluePrintParserProxy">
- <interfaces>
- <value>org.apache.aries.application.modelling.ParserProxy</value>
- </interfaces>
- </service>
+
</blueprint>
\ No newline at end of file
Modified: incubator/aries/trunk/application/application-deployment-management/src/main/resources/org/apache/aries/application/deployment/management/messages/DeploymentManagementMessages.properties
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-deployment-management/src/main/resources/org/apache/aries/application/deployment/management/messages/DeploymentManagementMessages.properties?rev=991173&r1=991172&r2=991173&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-deployment-management/src/main/resources/org/apache/aries/application/deployment/management/messages/DeploymentManagementMessages.properties (original)
+++ incubator/aries/trunk/application/application-deployment-management/src/main/resources/org/apache/aries/application/deployment/management/messages/DeploymentManagementMessages.properties Tue Aug 31 12:31:05 2010
@@ -21,26 +21,3 @@ SHARED_BUNDLE_IMPORTING_FROM_ISOLATED_BU
SUSPECTED_CIRCULAR_DEPENDENCIES=Resolution of asset {0} indicates invalid dependencies of shared content on isolated content: {1}
-#
-# 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.
-#
-SHARED_BUNDLE_IMPORTING_FROM_ISOLATED_BUNDLE=Shared bundle {0} has a dependency for package {1} which is exported from isolated bundle {2}
-SHARED_BUNDLE_IMPORTING_FROM_ISOLATED_BUNDLES=Shared bundle {0} has a dependency for package {1} which is exported from isolated bundles {2}
-
-
-SUSPECTED_CIRCULAR_DEPENDENCIES=Resolution of asset {0} indicates invalid dependencies of shared content on isolated content: {1}
Modified: incubator/aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java?rev=991173&r1=991172&r2=991173&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java (original)
+++ incubator/aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java Tue Aug 31 12:31:05 2010
@@ -92,12 +92,12 @@ public class DeploymentGeneratorTest
res.add(CAPABILITY_E.getBundle());
boolean addD = false;
for(Content ib : inputs) {
- if(ib.getContentName().equals("com.ibm.test.d"))
+ if(ib.getContentName().equals("aries.test.d"))
addD = true;
}
if(addD) {
try {
- res.add(createModelledResource("com.ibm.test.d", "1.0.0", new ArrayList<String>(), new ArrayList<String>()));
+ res.add(createModelledResource("aries.test.d", "1.0.0", new ArrayList<String>(), new ArrayList<String>()));
} catch (InvalidAttributeException e) {
fail("Cannot resolve import for d");
}
@@ -168,7 +168,7 @@ public class DeploymentGeneratorTest
{
appMetadata = Skeleton.newMock(ApplicationMetadata.class);
Skeleton.getSkeleton(appMetadata).setReturnValue(
- new MethodCall(ApplicationMetadata.class, "getApplicationSymbolicName"), "com.ibm.test");
+ new MethodCall(ApplicationMetadata.class, "getApplicationSymbolicName"), "aries.test");
Skeleton.getSkeleton(appMetadata).setReturnValue(
new MethodCall(ApplicationMetadata.class, "getApplicationVersion"), new Version("1.0.0"));
@@ -202,20 +202,20 @@ public class DeploymentGeneratorTest
}
static {
try {
- CAPABILITY_A = createExportedPackage ("com.ibm.test.a", "1.0.0", new String[] {"com.ibm.test.a"},
- new String[] {"com.ibm.test.c"});
+ CAPABILITY_A = createExportedPackage ("aries.test.a", "1.0.0", new String[] {"aries.test.a"},
+ new String[] {"aries.test.c"});
- CAPABILITY_B = createExportedPackage("com.ibm.test.b", "1.1.0", new String[] {"com.ibm.test.b"}, new String[] {"com.ibm.test.e"});
+ CAPABILITY_B = createExportedPackage("aries.test.b", "1.1.0", new String[] {"aries.test.b"}, new String[] {"aries.test.e"});
- BUNDLE_C = ManifestHeaderProcessor.parseContent("com.ibm.test.c","[1.0.0,1.1.0)");
+ BUNDLE_C = ManifestHeaderProcessor.parseContent("aries.test.c","[1.0.0,1.1.0)");
- CAPABILITY_C = createExportedPackage("com.ibm.test.c", "1.0.5", new String[] {"com.ibm.test.c"}, new String[] {});
+ CAPABILITY_C = createExportedPackage("aries.test.c", "1.0.5", new String[] {"aries.test.c"}, new String[] {});
- BUNDLE_D = ManifestHeaderProcessor.parseContent("com.ibm.test.d","1.0.0");
+ BUNDLE_D = ManifestHeaderProcessor.parseContent("aries.test.d","1.0.0");
- // = new ImportedBundleImpl("com.ibm.test.e", "1.0.0");
+ // = new ImportedBundleImpl("aries.test.e", "1.0.0");
- CAPABILITY_E = createExportedPackage("com.ibm.test.e", "1.0.0", new String[] {"com.ibm.test.e"}, new String[] {});
+ CAPABILITY_E = createExportedPackage("aries.test.e", "1.0.0", new String[] {"aries.test.e"}, new String[] {});
} catch (InvalidAttributeException iae) {
throw new RuntimeException(iae);
@@ -227,7 +227,7 @@ public class DeploymentGeneratorTest
public void testResolve() throws Exception
{
- Skeleton.getSkeleton(appMetadata).setReturnValue(new MethodCall(ApplicationMetadata.class, "getApplicationContents"), Arrays.asList(mockContent("com.ibm.test.a", "1.0.0"), mockContent("com.ibm.test.b", "[1.0.0, 2.0.0)" )));
+ Skeleton.getSkeleton(appMetadata).setReturnValue(new MethodCall(ApplicationMetadata.class, "getApplicationContents"), Arrays.asList(mockContent("aries.test.a", "1.0.0"), mockContent("aries.test.b", "[1.0.0, 2.0.0)" )));
app = Skeleton.newMock(AriesApplication.class);
Skeleton.getSkeleton(app).setReturnValue(new MethodCall(AriesApplication.class, "getApplicationMetadata"), appMetadata);
@@ -236,20 +236,20 @@ public class DeploymentGeneratorTest
Attributes attrs = man.getMainAttributes();
- assertEquals("com.ibm.test", attrs.getValue(AppConstants.APPLICATION_SYMBOLIC_NAME));
+ assertEquals("aries.test", attrs.getValue(AppConstants.APPLICATION_SYMBOLIC_NAME));
assertEquals("1.0.0", (String)attrs.getValue(AppConstants.APPLICATION_VERSION));
String content = (String)attrs.getValue(AppConstants.DEPLOYMENT_CONTENT);
String useBundle = (String) attrs.getValue(AppConstants.DEPLOYMENT_USE_BUNDLE);
String provisioned =(String)attrs.getValue(AppConstants.DEPLOYMENT_PROVISION_BUNDLE);
- assertTrue(content.contains("com.ibm.test.a;deployed-version=1.0.0"));
- assertTrue(content.contains("com.ibm.test.b;deployed-version=1.1.0"));
+ assertTrue(content.contains("aries.test.a;deployed-version=1.0.0"));
+ assertTrue(content.contains("aries.test.b;deployed-version=1.1.0"));
- assertTrue(useBundle.contains("com.ibm.test.c;deployed-version=1.0.5"));
- assertFalse(useBundle.contains("com.ibm.test.d"));
+ assertTrue(useBundle.contains("aries.test.c;deployed-version=1.0.5"));
+ assertFalse(useBundle.contains("aries.test.d"));
- assertTrue(provisioned.contains("com.ibm.test.e;deployed-version=1.0.0"));
+ assertTrue(provisioned.contains("aries.test.e;deployed-version=1.0.0"));
}
@Test
Modified: incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverAdvancedTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverAdvancedTest.java?rev=991173&r1=991172&r2=991173&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverAdvancedTest.java (original)
+++ incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverAdvancedTest.java Tue Aug 31 12:31:05 2010
@@ -28,13 +28,14 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
-import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import javax.xml.parsers.DocumentBuilderFactory;
+
import org.apache.aries.application.Content;
import org.apache.aries.application.DeploymentContent;
import org.apache.aries.application.DeploymentMetadata;
@@ -56,14 +57,16 @@ import org.apache.felix.bundlerepository
import org.apache.felix.bundlerepository.RepositoryAdmin;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
-
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
@RunWith(JUnit4TestRunner.class)
public class OBRResolverAdvancedTest extends AbstractIntegrationTest
{
@@ -317,38 +320,51 @@ public class OBRResolverAdvancedTest ext
}
- /* MN: This test generates a new repository.xml and compares it with one we made earlier.
- * The problem is, the one we made earlier used an IBM JRE, which results in the elements
- * of the repository.xml coming out in a completely different order to those seen on a Sun
- * JRE. The test needs rework if it is going to work correctly on both JREs.
+ /**
+ * This test just verifies whether every entry in the MANIFEST.MF was fed into the repository generator.
+ * Since the IBM JRE generates a slightly different repository file from the Sun JRE as far as the order of xml elements is concerned. It is not feasible
+ * to perform a file comparison.
+ * @throws Exception
*/
- @Ignore
@Test
public void testRepo() throws Exception {
startApplicationRuntimeBundle();
-
generateOBRRepoXML(true, REPO_BUNDLE+".jar");
-
- // compare the generated with the expected file
- BufferedReader expectedFileReader = new BufferedReader(new InputStreamReader(OBRResolverAdvancedTest.class.getClassLoader().getResourceAsStream("/obr/aries.bundle1/expectedRepository.xml")));
-
- // read out the temp file
+ //print out the repository.xml
BufferedReader reader = new BufferedReader(new FileReader(new File("repository.xml")));
-
- try {
- String tempFileline, expectedFileLine;
-
- while (((tempFileline = reader.readLine()) != null)
- && ((expectedFileLine = expectedFileReader.readLine()) != null)) {
- if (!(tempFileline.contains("lastmodified"))) {
- assertEquals("The result is not expected.", expectedFileLine, tempFileline);
- }
- }
- } finally {
- expectedFileReader.close();
- reader.close();
+ String line;
+ while (( line = reader.readLine()) != null) {
+ System.out.println(line);
+ }
+ // compare the generated with the expected file
+ Document real_doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File("repository.xml"));
+ Document expected_doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(OBRResolverAdvancedTest.class.getClassLoader().getResourceAsStream("/obr/aries.bundle1/expectedRepository.xml"));
+ // parse two documents to make sure they have the same number of elements
+ Element element_real = real_doc.getDocumentElement();
+ Element element_expected = expected_doc.getDocumentElement();
+ NodeList nodes_real = element_real.getElementsByTagName("capability");
+ NodeList nodes_expected = element_expected.getElementsByTagName("capability");
+ assertEquals("The number of capability is not expected. ", nodes_expected.getLength(), nodes_real.getLength());
+ nodes_real = element_real.getElementsByTagName("require");
+ nodes_expected = element_expected.getElementsByTagName("require");
+ assertEquals("The number of require elements is not expected. ", nodes_expected.getLength(), nodes_real.getLength());
+ nodes_real = element_real.getElementsByTagName("p");
+ nodes_expected = element_expected.getElementsByTagName("p");
+ assertEquals("The number of properties is not expected. ", nodes_expected.getLength(), nodes_real.getLength());
+ // Let's verify all p elements are shown as expected.
+ for (int index=0; index < nodes_expected.getLength(); index++) {
+ Node node = nodes_expected.item(index);
+ boolean contains = false;
+ // make sure the node exists in the real generated repository
+ for (int i=0; i<nodes_real.getLength(); i++) {
+ Node real_node = nodes_real.item(i);
+ if (node.isEqualNode(real_node)) {
+ contains = true;
+ break;
+ }
+ }
+ assertTrue("The node " + node.toString() + "should exist.", contains);
}
-
}
@Test
@@ -454,9 +470,9 @@ public class OBRResolverAdvancedTest ext
mavenBundle("org.osgi", "org.osgi.compendium"),
mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit"),
- /* For debugging, uncomment the next two lines
- vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5010"),
- waitForFrameworkStartup(), */
+ /* For debugging, uncomment the next two lines */
+ /*vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5010"),
+ waitForFrameworkStartup(), */
/* For debugging, add these imports:
import static org.ops4j.pax.exam.CoreOptions.waitForFrameworkStartup;
Modified: incubator/aries/trunk/application/application-modeller/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-modeller/pom.xml?rev=991173&r1=991172&r2=991173&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-modeller/pom.xml (original)
+++ incubator/aries/trunk/application/application-modeller/pom.xml Tue Aug 31 12:31:05 2010
@@ -82,6 +82,16 @@
<artifactId>org.apache.aries.application.utils</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.api</artifactId>
+ <version>0.3-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>org.apache.aries.blueprint.core</artifactId>
+ <version>0.3-incubating-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
Added: incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceManagerImpl.java?rev=991173&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceManagerImpl.java (added)
+++ incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceManagerImpl.java Tue Aug 31 12:31:05 2010
@@ -0,0 +1,229 @@
+/*
+ * 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.impl;
+
+import static org.apache.aries.application.utils.AppConstants.LOG_ENTRY;
+import static org.apache.aries.application.utils.AppConstants.LOG_EXIT;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.jar.Attributes;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.aries.application.modelling.internal.BundleBlueprintParser;
+import org.apache.aries.application.filesystem.IDirectory;
+import org.apache.aries.application.filesystem.IFile;
+import org.apache.aries.application.management.InvalidAttributeException;
+import org.apache.aries.application.modelling.ExportedService;
+import org.apache.aries.application.modelling.ImportedService;
+import org.apache.aries.application.modelling.ModelledResource;
+import org.apache.aries.application.modelling.ModelledResourceManager;
+import org.apache.aries.application.modelling.ModellerException;
+import org.apache.aries.application.modelling.ParsedServiceElements;
+import org.apache.aries.application.modelling.ParserProxy;
+import org.apache.aries.application.modelling.utils.ModellingManager;
+import org.apache.aries.application.utils.manifest.BundleManifest;
+import org.apache.aries.blueprint.ParserService;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class ModelledResourceManagerImpl implements ModelledResourceManager
+{
+ private Logger _logger = LoggerFactory.getLogger(ModelledResourceManagerImpl.class);
+
+ private ParserProxy parserProxy;
+
+ private ParserService _parserService;
+ private BundleContext _bundleContext;
+
+ public void setParserService (ParserService p) {
+ _parserService = p;
+ }
+
+ public void setBundleContext (BundleContext b) {
+ _bundleContext = b;
+ }
+ public ParserProxy getParserProxy()
+ {
+ if (parserProxy == null) {
+ parserProxy= new ParserProxyImpl(_parserService, _bundleContext);
+ }
+ return parserProxy;
+ }
+
+
+
+ /**
+ * For a given file, which we know to be a bundle, parse out all the
+ * service, reference and reference-list elements. This method will return
+ * all such services, including anonymous ones,
+ * but should not return indistinguishable duplicates.
+ * @param archive CommonArchive. The caller is responsible for closing this afterwards.
+ * @return ParsedServiceElementsImpl
+ * @throws OpenFailureException
+ */
+ public ParsedServiceElements getServiceElements (IDirectory archive) throws ModellerException {
+
+ _logger.debug(LOG_ENTRY,"getServiceElements", archive );
+
+ Set<ExportedService> services = new HashSet<ExportedService>();
+ Set<ImportedService> references = new HashSet<ImportedService>();
+ try {
+ Collection<IFile> blueprints = findBlueprints(archive);
+ InputStream is = null;
+ for (IFile bpFile : blueprints) {
+ URL url = bpFile.toURL();
+ URLConnection conn = url.openConnection();
+ is = conn.getInputStream();
+
+ try {
+ ParsedServiceElements pse = getParserProxy().parseAllServiceElements(is);
+ services.addAll(pse.getServices());
+ references.addAll(pse.getReferences());
+
+ } finally {
+ if (is != null) {
+ is.close();
+ }
+ }
+ }
+ } catch (URISyntaxException e) {
+ ModellerException m = new ModellerException(e);
+ _logger.debug(LOG_EXIT, "getServiceElements", m);
+ throw m;
+ } catch (IOException e) {
+ ModellerException m = new ModellerException(e);
+ _logger.debug(LOG_EXIT, "getServiceElements", m);
+ throw m;
+ } catch (Exception e) {
+ ModellerException m = new ModellerException(e);
+ _logger.debug(LOG_EXIT, "getServiceElements", m);
+ throw m;
+ }
+ ParsedServiceElements result = ModellingManager.getParsedServiceElements(services, references);
+ _logger.debug(LOG_EXIT, "getServiceElements", result);
+ return result;
+ }
+
+
+ /**
+ * Helper method to pass a single bundle into findBlueprints
+ * @param oneBundle a single bundle
+ * @return Files for all the blueprint files within the bundle
+ * @throws URISyntaxException
+ * @throws IOException
+ * @throws OpenFailureException
+ */
+ private Collection<IFile> findBlueprints (IDirectory oneBundle)
+ throws IOException
+ {
+ _logger.debug(LOG_ENTRY, "findBlueprints", oneBundle);
+ Set<IDirectory> archiveSet = new HashSet<IDirectory>();
+ archiveSet.add(oneBundle);
+ Collection<IFile> result = findBlueprints (archiveSet);
+ _logger.debug(LOG_EXIT, "findBlueprints", result);
+ return result;
+ }
+
+ /**
+ * Locate all blueprint xml files located within a set of bundles. Typically, call findApplicationBundles()
+ * first to determine which bundles within an EBA fall within the range of the Application-Content header.
+ * (See the comment on that method).
+ * @param applicationBundles
+ * @return A Collection of blue print files
+ * @throws URISyntaxException
+ * @throws IOException
+ * @throws OpenFailureException
+ */
+ private Collection<IFile> findBlueprints(Collection<IDirectory> applicationBundles)
+ throws IOException
+ {
+ _logger.debug(LOG_ENTRY, "findBlueprints", applicationBundles);
+ Collection<IFile> blueprints = new ArrayList<IFile>();
+ for (IDirectory appBundle : applicationBundles) {
+ if (appBundle != null) {
+ File bundleFile = new File(appBundle.toString());
+ BundleManifest bundleMf = BundleManifest.fromBundle(bundleFile);
+ BundleBlueprintParser bpParser = new BundleBlueprintParser(bundleMf);
+ ZipFile zipFile = new ZipFile(bundleFile);
+ Enumeration<? extends ZipEntry> entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry ze = entries.nextElement();
+
+ System.out.println(ze.getName());
+ }
+ List<IFile> files = appBundle.listAllFiles();
+ Iterator<IFile> it = files.iterator();
+ while (it.hasNext()) {
+ IFile file = (IFile) it.next();
+ String directoryFullPath = file.getName();
+ String directoryName = "";
+ String fileName = "";
+ if (directoryFullPath.lastIndexOf("/") != -1) {
+ directoryName = directoryFullPath.substring(0, directoryFullPath.lastIndexOf("/"));
+ fileName = directoryFullPath.substring(directoryFullPath.lastIndexOf("/") + 1);
+ } else {
+ if (file.isFile()) {
+ directoryName="";
+ fileName = directoryFullPath;
+ }
+
+ }
+ if (bpParser.isBPFile(directoryName, fileName)) {
+ blueprints.add(file);
+ }
+ }
+ }
+ }
+ _logger.debug(LOG_EXIT, "findBlueprints", blueprints);
+ return blueprints;
+ }
+
+ public ModelledResource getModelledResource(String uri, IDirectory bundle) throws ModellerException{
+ _logger.debug(LOG_ENTRY, "getModelledResource", new Object[]{uri, bundle});
+ ParsedServiceElements pse = getServiceElements(bundle);
+
+ BundleManifest bm = BundleManifest.fromBundle(new File(bundle.toString()));
+ Attributes attributes = bm.getRawAttributes();
+ ModelledResource mbi;
+ try {
+ mbi = ModellingManager.getModelledResource(uri, attributes, pse.getReferences(), pse.getServices());
+ } catch (InvalidAttributeException iae) {
+ throw new ModellerException(iae);
+ }
+ _logger.debug(LOG_EXIT, "getModelledResource", mbi);
+ return mbi;
+ }
+
+}
Added: incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ParserProxyImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ParserProxyImpl.java?rev=991173&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ParserProxyImpl.java (added)
+++ incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ParserProxyImpl.java Tue Aug 31 12:31:05 2010
@@ -0,0 +1,267 @@
+/*
+ * 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.impl;
+import static org.apache.aries.application.utils.AppConstants.LOG_ENTRY;
+import static org.apache.aries.application.utils.AppConstants.LOG_EXIT;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.aries.application.management.InvalidAttributeException;
+import org.apache.aries.application.modelling.ExportedService;
+import org.apache.aries.application.modelling.ImportedService;
+import org.apache.aries.application.modelling.ParsedServiceElements;
+import org.apache.aries.application.modelling.ParserProxy;
+import org.apache.aries.application.modelling.WrappedServiceMetadata;
+import org.apache.aries.application.modelling.utils.ModellingManager;
+import org.apache.aries.blueprint.ComponentDefinitionRegistry;
+import org.apache.aries.blueprint.ParserService;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.CollectionMetadata;
+import org.osgi.service.blueprint.reflect.ComponentMetadata;
+import org.osgi.service.blueprint.reflect.MapEntry;
+import org.osgi.service.blueprint.reflect.Metadata;
+import org.osgi.service.blueprint.reflect.RefMetadata;
+import org.osgi.service.blueprint.reflect.ReferenceListMetadata;
+import org.osgi.service.blueprint.reflect.ServiceMetadata;
+import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
+import org.osgi.service.blueprint.reflect.Target;
+import org.osgi.service.blueprint.reflect.ValueMetadata;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+
+public class ParserProxyImpl implements ParserProxy {
+ private Logger _logger = LoggerFactory.getLogger(ParserProxyImpl.class);
+ private ParserService _parserService;
+ private BundleContext _bundleContext;
+
+ public void setParserService (ParserService p) {
+ _parserService = p;
+ }
+
+ public void setBundleContext (BundleContext b) {
+ _bundleContext = b;
+ }
+
+ public ParserProxyImpl(ParserService p, BundleContext b) {
+ _parserService = p;
+ _bundleContext = b;
+ }
+
+ public List<? extends WrappedServiceMetadata> parse(List<URL> blueprintsToParse) throws Exception {
+ _logger.debug(LOG_ENTRY, "parse", new Object[]{blueprintsToParse});
+ ComponentDefinitionRegistry cdr = _parserService.parse (blueprintsToParse, _bundleContext.getBundle());
+ List<? extends WrappedServiceMetadata> result = parseCDRForServices (cdr, true);
+ _logger.debug(LOG_EXIT, "parse", new Object[]{result});
+ return result;
+ }
+
+ public List<? extends WrappedServiceMetadata> parse(URL blueprintToParse)
+ throws Exception {
+ _logger.debug(LOG_ENTRY, "parse", new Object[]{blueprintToParse});
+ List<URL> list = new ArrayList<URL>();
+ list.add(blueprintToParse);
+
+ List<? extends WrappedServiceMetadata> result = parse (list);
+ _logger.debug(LOG_EXIT, "parse", new Object[]{result});
+ return result;
+ }
+
+
+ public List<? extends WrappedServiceMetadata> parse(InputStream blueprintToParse)
+ throws Exception {
+ _logger.debug(LOG_ENTRY, "parse", new Object[]{blueprintToParse});
+ ComponentDefinitionRegistry cdr = _parserService.parse (blueprintToParse, _bundleContext.getBundle());
+ List<? extends WrappedServiceMetadata> result = parseCDRForServices (cdr, true);
+ _logger.debug(LOG_EXIT, "parse", new Object[]{result});
+ return result;
+ }
+
+
+ public ParsedServiceElements parseAllServiceElements(InputStream blueprintToParse) throws Exception {
+ _logger.debug(LOG_ENTRY, "parseAllServiceElements", new Object[]{blueprintToParse});
+ ComponentDefinitionRegistry cdr = _parserService.parse (blueprintToParse, _bundleContext.getBundle());
+ Collection<ExportedService> services = parseCDRForServices(cdr, false);
+ Collection<ImportedService> references = parseCDRForReferences (cdr);
+ ParsedServiceElements result = ModellingManager.getParsedServiceElements(services, references);
+ _logger.debug(LOG_EXIT, "parseAllServiceElements", new Object[]{result});
+ return result;
+ }
+
+ /**
+ * Extract Service metadata from a ComponentDefinitionRegistry. When doing SCA modelling, we
+ * need to suppress anonymous services. We don't want to do that when we're modelling for
+ * provisioning dependencies.
+ * @param cdr ComponentDefinitionRegistry
+ * @param suppressAnonymousServices Unnamed services will not be returned if this is true
+ * @return List<WrappedServiceMetadata>
+ */
+ private List<ExportedService> parseCDRForServices (ComponentDefinitionRegistry cdr,
+ boolean suppressAnonymousServices) {
+ _logger.debug(LOG_ENTRY, "parseCDRForServices", new Object[]{cdr, suppressAnonymousServices});
+ List<ExportedService> result = new ArrayList<ExportedService>();
+ Set<String> names = cdr.getComponentDefinitionNames();
+ for (String name: names) {
+ ComponentMetadata compMetadata = cdr.getComponentDefinition(name);
+ if (compMetadata instanceof ServiceMetadata) {
+ ServiceMetadata serviceMetadata = (ServiceMetadata)compMetadata;
+ String serviceName;
+ int ranking;
+ Collection<String> interfaces = new ArrayList<String>();
+ Map<String, Object> serviceProps = new HashMap<String, Object>();
+
+ ranking = serviceMetadata.getRanking();
+ for (Object i : serviceMetadata.getInterfaces()) {
+ interfaces.add((String)i);
+ }
+
+ // get the service properties
+ List<MapEntry> props = serviceMetadata.getServiceProperties();
+ for (MapEntry entry : props) {
+ String key = ((ValueMetadata)entry.getKey()).getStringValue();
+
+ Metadata value = entry.getValue();
+ if (value instanceof CollectionMetadata) {
+ List<Metadata> values = ((CollectionMetadata)value).getValues();
+ String[] theseValues = new String[values.size()];
+ for (int i=0; i < values.size(); i++) {
+ Metadata m = values.get(i);
+ theseValues[i] = ((ValueMetadata)m).getStringValue();
+ }
+ serviceProps.put(key, theseValues);
+ } else {
+ serviceProps.put(key, ((ValueMetadata)entry.getValue()).getStringValue());
+ }
+ }
+
+ // serviceName: use the service id unless that's not set,
+ // in which case we use the bean id.
+ serviceName = serviceMetadata.getId();
+
+ // If the Service references a Bean, export the bean id as a service property
+ // as per 121.6.5 p669 of the blueprint 1.0 specification
+ Target t = serviceMetadata.getServiceComponent();
+ String targetId = null;
+ if (t instanceof RefMetadata) {
+ targetId = ((RefMetadata)t).getComponentId();
+ } else if (t instanceof BeanMetadata) {
+ targetId = ((BeanMetadata)t).getId();
+ }
+
+ // Our OBR code MUST have access to targetId if it's available (i.e. not null
+ // or auto-generated for an anonymous service. This must ALWAYS be set.
+ if (targetId != null && !targetId.startsWith(".")) { // Don't set this for anonymous inner components
+ serviceProps.put("osgi.service.blueprint.compname", targetId);
+ if (serviceName == null || serviceName.equals("") || serviceName.startsWith(".")) {
+ serviceName = targetId;
+ }
+ }
+
+ if(serviceName != null && serviceName.startsWith("."))
+ serviceName = null;
+
+ // If suppressAnonymous services, do not expose services that have no name
+ if (!suppressAnonymousServices || (serviceName != null)) {
+ ExportedService wsm = ModellingManager.getExportedService(serviceName, ranking, interfaces, serviceProps);
+ result.add(wsm);
+ }
+ }
+ }
+ _logger.debug(LOG_EXIT, "parseAllServiceElements", new Object[]{result});
+ return result;
+ }
+
+ /**
+ * Extract References metadata from a ComponentDefinitionRegistry.
+ * @param cdr ComponentDefinitionRegistry
+ * @return List<WrappedReferenceMetadata>
+ * @throws InvalidAttributeException
+ */
+ private List<ImportedService> parseCDRForReferences (ComponentDefinitionRegistry cdr) throws InvalidAttributeException {
+ _logger.debug(LOG_ENTRY, "parseCDRForReferences", new Object[]{cdr});
+ List<ImportedService> result = new ArrayList<ImportedService>();
+ Set<String> names = cdr.getComponentDefinitionNames();
+ for (String name: names) {
+ ComponentMetadata compMetadata = cdr.getComponentDefinition(name);
+ if (compMetadata instanceof ServiceReferenceMetadata) {
+ ServiceReferenceMetadata referenceMetadata = (ServiceReferenceMetadata)compMetadata;
+
+ boolean optional = referenceMetadata.getAvailability() == ServiceReferenceMetadata.AVAILABILITY_OPTIONAL;
+ String iface = referenceMetadata.getInterface();
+ String compName = referenceMetadata.getComponentName();
+ String blueprintFilter = referenceMetadata.getFilter();
+ String id = referenceMetadata.getId();
+ boolean isMultiple = (referenceMetadata instanceof ReferenceListMetadata);
+
+ //The blueprint parser teams up with JPA and blueprint resource ref
+ // namespace handlers to give us service imports of the form,
+ // objectClass=javax.persistence.EntityManagerFactory, org.apache.aries.jpa.proxy.factory=*, osgi.unit.name=blabber
+ //
+ // There will be no matching service for this reference.
+ // For now we blacklist certain objectClasses and filters - this is a pretty dreadful thing to do.
+ if (isNotBlacklisted (iface, blueprintFilter)) {
+ ImportedService ref = ModellingManager.getImportedService (optional, iface, compName, blueprintFilter,
+ id, isMultiple);
+ result.add (ref);
+ }
+ }
+ }
+ _logger.debug(LOG_EXIT, "parseCDRForReferences", new Object[]{result});
+ return result;
+ }
+
+ /**
+ * Some services are injected directly into isolated frameworks by default. We do
+ * not need to model these services. They are not represented as ExportedServices
+ * (Capabilities) in the various OBR registries, and so cannot be resolved against.
+ * Since they are injected directly into each isolated framework, we do not need
+ * an entry in DEPLOYMENT.MF's Deployed-ImportService header for any of these
+ * services.
+ *
+ * @param iface The interface declared on a blueprint reference
+ * @param blueprintFilter The filter on the blueprint reference
+ * @return True if the service is not 'blacklisted' and so may be exposed
+ * in the model being generated.
+ */
+ private boolean isNotBlacklisted (String iface, String blueprintFilter) {
+ _logger.debug(LOG_ENTRY, "isNotBlacklisted", new Object[]{iface, blueprintFilter});
+ boolean blacklisted = false;
+ if (iface != null) {
+ // JPA - detect interface;
+ blacklisted |= iface.equals("javax.persistence.EntityManagerFactory");
+ blacklisted |= iface.equals("javax.persistence.EntityManager");
+
+ // JTA - detect interface
+ blacklisted |= iface.equals("javax.transaction.UserTransaction");
+ blacklisted |= iface.equals("javax.transaction.TransactionSynchronizationRegistry");
+ }
+ _logger.debug(LOG_EXIT, "isNotBlacklisted", new Object[]{!blacklisted});
+ return !blacklisted;
+ }
+
+
+}
Added: incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/internal/BundleBlueprintParser.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/internal/BundleBlueprintParser.java?rev=991173&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/internal/BundleBlueprintParser.java (added)
+++ incubator/aries/trunk/application/application-modeller/src/main/java/org/apache/aries/application/modelling/internal/BundleBlueprintParser.java Tue Aug 31 12:31:05 2010
@@ -0,0 +1,161 @@
+/*
+ * 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.internal;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.apache.aries.application.utils.manifest.BundleManifest;
+import org.apache.aries.application.utils.manifest.ManifestHeaderProcessor;
+
+/**
+ * A bundle may contain a Bundle-Blueprint: header as per p649 of the v4 spec. If present,
+ * this denotes where to look for blueprint xml files. We could use Bundle.findEntries()
+ * to deal with the wildcards that the last entry in the list may contain, but our caller
+ * is introspecting .jar files within an EBA and does not have access to Bundle objects,
+ * so we need this extra support. Our caller needs to iterate over the files
+ * within a jar in each case asking this class, 'is this a blueprint file'?
+ *
+ */
+public class BundleBlueprintParser {
+
+ public static final String DEFAULT_HEADER = "OSGI-INF/blueprint/*.xml";
+
+ String _mfHeader = null;
+ List<Path> _paths;
+
+ static class Path {
+ String directory;
+ String filename; // This will either be a simple filename or 'null', in which case filenamePattern will be set
+ Pattern filenamePattern;
+ public Path (String d, String f) {
+ directory = d;
+ if (f.contains("*")) {
+ filename = null;
+ String pattern = f.replace(".", "\\.");
+ pattern = pattern.replace("*", ".*");
+ filenamePattern = Pattern.compile(pattern);
+ } else {
+ filename = f;
+ filenamePattern = null;
+ }
+ }
+
+ /**
+ * Match this Path object against a specific directory, file pair. Case sensitive.
+ * @param dir Directory
+ * @param fil Filename - may not contain a wildcard
+ * @return true these match
+ */
+ public boolean matches (String dir, String fil) {
+ boolean match = false;
+ if (!directory.equals(dir)) {
+ match = false;
+ } else if (filename != null) {
+ match = (filename.equals(fil));
+ } else {
+ match = filenamePattern.matcher(fil).matches();
+ }
+ return match;
+ }
+ }
+
+ /**
+ * BundleBlueprintParser constructor
+ * @param bundleMf BundleManifest to construct the parser from
+ */
+ public BundleBlueprintParser (BundleManifest bundleMf) {
+ String bundleBPHeader = (String) bundleMf.getRawAttributes().getValue("Bundle-Blueprint");
+ setup (bundleBPHeader);
+ }
+
+ /**
+ * BundleBlueprintParser alternative constructor
+ * @param bundleBPHeader Bundle-Blueprint header to construct the parser from
+ */
+ public BundleBlueprintParser (String bundleBPHeader) {
+ setup (bundleBPHeader);
+ }
+
+ /**
+ * Default constructor
+ */
+ public BundleBlueprintParser () {
+ setup(null);
+ }
+
+ private void setup (String bundleBPHeader) {
+ _paths = new LinkedList <Path>();
+ if (bundleBPHeader == null) {
+ _mfHeader = DEFAULT_HEADER;
+ } else {
+ _mfHeader = bundleBPHeader;
+ }
+
+ // Break this comma separated list up
+ List<String> files = ManifestHeaderProcessor.split(_mfHeader, ",");
+ clauses: for (String fileClause : files) {
+
+ // we could be doing directives, so we split again, the clause can
+ // have multiple paths with directives at the end.
+
+ List<String> yetMoreFiles = ManifestHeaderProcessor.split(fileClause, ";");
+ for (String f : yetMoreFiles) {
+
+ // if f has an = in it then we have hit the directive, which must
+ // be at the end, we do not have any directives so we just continue
+ // onto the next clause.
+ if (f.contains("=")) continue clauses;
+
+ // we need to make sure we have zero spaces here, otherwise stuff may
+ // not be found.
+ f = f.trim();
+ if (f.startsWith("\"") && f.endsWith("\"")) {
+ f = f.substring(1,f.length()-1);
+ }
+
+ int index = f.lastIndexOf('/');
+ String path = "";
+ String file = f;
+ if (index != -1) {
+ path = f.substring(0, index);
+ file = f.substring(index + 1);
+ }
+ _paths.add(new Path(path, file));
+ }
+ }
+ }
+
+ /**
+ * Iterate through the list of valid file patterns. Return true if this matches against
+ * the header provided to the constructor. We're going to have to be case sensitive.
+ * @param directory Directory name
+ * @param filename File name
+ * @return true if this is a blueprint file according to the Bundle-Blueprint header
+ */
+ public boolean isBPFile (String directory, String filename) {
+ for (Path path: _paths) {
+ if (path.matches(directory, filename)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
Added: incubator/aries/trunk/application/application-modeller/src/main/resources/OSGI-INF/blueprint/app-modeller.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-modeller/src/main/resources/OSGI-INF/blueprint/app-modeller.xml?rev=991173&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-modeller/src/main/resources/OSGI-INF/blueprint/app-modeller.xml (added)
+++ incubator/aries/trunk/application/application-modeller/src/main/resources/OSGI-INF/blueprint/app-modeller.xml Tue Aug 31 12:31:05 2010
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+ <bean id="modelledResourceManager" class="org.apache.aries.application.modelling.impl.ModelledResourceManagerImpl">
+ <property name= "parserService" ref="parser-service"/>
+ <property name="bundleContext" ref="blueprintBundleContext"/>
+ </bean>
+ <reference id="parser-service" interface="org.apache.aries.blueprint.ParserService"/>
+ <service id = "modelledResourceManagerService" ref="modelledResourceManager" interface="org.apache.aries.application.modelling.ModelledResourceManager"/>
+
+</blueprint>
\ No newline at end of file
Modified: incubator/aries/trunk/application/application-modeller/src/main/resources/org/apache/aries/application/modelling/messages/APPModellingMessages.properties
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-modeller/src/main/resources/org/apache/aries/application/modelling/messages/APPModellingMessages.properties?rev=991173&r1=991172&r2=991173&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-modeller/src/main/resources/org/apache/aries/application/modelling/messages/APPModellingMessages.properties (original)
+++ incubator/aries/trunk/application/application-modeller/src/main/resources/org/apache/aries/application/modelling/messages/APPModellingMessages.properties Tue Aug 31 12:31:05 2010
@@ -25,30 +25,3 @@ INCORRECT_CB_MANDATORY_HEADERS=APPMODELL
TOO_MANY_FRAG_HOSTS=APPMODELLING0006W: An internal error occurred. A bundle fragment manifest must define exactly one Fragment-Host entry. The following entry was found {0}.
INCOMPATIBLE_PACKAGE_VERSION_REQUIREMENTS=APPMODELLING0007W: The asset {0} cannot be resolved. It has incompatible version requirements on the following packages: {1}.
INVALID_PACKAGE_REQUIREMENT_ATTRIBUTES=APPMODELLING0008W: The asset {0} cannot be resolved. The attribute {1} on an import for package {2} cannot be satisfied at deployment.
-#
-# 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.
-#
-
-MORE_THAN_ONE_FRAG_HOST=APPMODELLING0001W: An internal error occurred. A bundle fragment manifest must define exactly one Fragment-Host entry. The following entry was found {0}.
-TOO_MANY_SYM_NAMES=APPMODELLING0002W: An internal error occurred. A bundle manifest must contain exactly one Bundle-SymbolicName entry. The following entry was found {0}.
-INCORRECT_MANDATORY_HEADERS=APPMODELLING0003W: An internal error occurred. A bundle with symbolic name {0} and manifest version {1} was unable to be processed.
-TOO_MANY_CB_SYM_NAMES=APPMODELLING0004W: An internal error occurred. A composite bundle manifest must contain exactly one Bundle-SymbolicName entry. The following entry was found {0}.
-INCORRECT_CB_MANDATORY_HEADERS=APPMODELLING0005W: An internal error occurred. A composite bundle with symbolic name {0} and manifest version {1} was unable to be processed.
-TOO_MANY_FRAG_HOSTS=APPMODELLING0006W: An internal error occurred. A bundle fragment manifest must define exactly one Fragment-Host entry. The following entry was found {0}.
-INCOMPATIBLE_PACKAGE_VERSION_REQUIREMENTS=APPMODELLING0007W: The asset {0} cannot be resolved. It has incompatible version requirements on the following packages: {1}.
-INVALID_PACKAGE_REQUIREMENT_ATTRIBUTES=APPMODELLING0008W: The asset {0} cannot be resolved. The attribute {1} on an import for package {2} cannot be satisfied at deployment.
Modified: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java?rev=991173&r1=991172&r2=991173&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java (original)
+++ incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java Tue Aug 31 12:31:05 2010
@@ -57,6 +57,7 @@ import org.apache.aries.application.reso
import org.apache.aries.application.resolver.obr.impl.ApplicationResourceImpl;
import org.apache.aries.application.resolver.obr.impl.ModelledBundleResource;
import org.apache.aries.application.resolver.obr.impl.OBRBundleInfo;
+import org.apache.aries.application.resolver.obr.impl.RepositoryGeneratorImpl;
import org.apache.aries.application.resolver.obr.impl.ResourceWrapper;
import org.apache.aries.application.utils.manifest.ManifestHeaderProcessor;
import org.apache.aries.application.utils.manifest.ManifestHeaderProcessor.NameValueMap;
@@ -90,15 +91,7 @@ public class OBRAriesResolver implements
return platformRepository;
}
- private RepositoryGenerator repositoryGenerator;
-
- public void setRepositoryGenerator(RepositoryGenerator rg) {
- this.repositoryGenerator=rg;
- }
-
- public RepositoryGenerator getRepositoryGenerator() {
- return this.repositoryGenerator;
- }
+
public RepositoryAdmin getRepositoryAdmin() {
return this.repositoryAdmin;
@@ -151,7 +144,7 @@ public class OBRAriesResolver implements
try {
ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
- repositoryGenerator.generateRepository(appName + "_" + appVersion, toModelledResource(app.getBundleInfo()), bytesOut);
+ RepositoryGeneratorImpl.generateRepository(repositoryAdmin, appName + "_" + appVersion, toModelledResource(app.getBundleInfo()), bytesOut);
appRepo = helper.readRepository(new InputStreamReader(new ByteArrayInputStream(bytesOut.toByteArray())));
} catch (Exception e) {
@@ -548,7 +541,7 @@ public class OBRAriesResolver implements
Repository appRepo;
try {
ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
- repositoryGenerator.generateRepository(appName + "_" + appVersion, byValueBundles, bytesOut);
+ RepositoryGeneratorImpl.generateRepository(repositoryAdmin, appName + "_" + appVersion, byValueBundles, bytesOut);
appRepo = helper.readRepository(new InputStreamReader(new ByteArrayInputStream(bytesOut.toByteArray())));
} catch (Exception e) {
throw new ResolverException(e);
Modified: incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/RepositoryGeneratorImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/RepositoryGeneratorImpl.java?rev=991173&r1=991172&r2=991173&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/RepositoryGeneratorImpl.java (original)
+++ incubator/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/impl/RepositoryGeneratorImpl.java Tue Aug 31 12:31:05 2010
@@ -76,7 +76,7 @@ public final class RepositoryGeneratorIm
* buffer writer
* @throws IOException
*/
- private void writeResource(Resource r, String uri, Document doc, Element root) throws IOException
+ private static void writeResource(Resource r, String uri, Document doc, Element root) throws IOException
{
logger.debug(LOG_ENTRY, "writeResource", new Object[]{r, uri, doc, root});
Element resource = doc.createElement("resource");
@@ -106,7 +106,7 @@ public final class RepositoryGeneratorIm
* @param writer buffer writer
* @throws IOException
*/
- private void writeCapability(Capability c, Document doc, Element resource) throws IOException
+ private static void writeCapability(Capability c, Document doc, Element resource) throws IOException
{
logger.debug(LOG_ENTRY, "writeCapability", new Object[]{c, doc, resource});
Element capability = doc.createElement("capability");
@@ -158,7 +158,7 @@ public final class RepositoryGeneratorIm
* buffer writer
* @throws IOException
*/
- private void writeRequirement(Requirement req, Document doc, Element resource) throws IOException
+ private static void writeRequirement(Requirement req, Document doc, Element resource) throws IOException
{
logger.debug(LOG_ENTRY, "writeRequirement", new Object[]{req, doc, resource});
Element requirement = doc.createElement("require");
@@ -178,34 +178,41 @@ public final class RepositoryGeneratorIm
throws ResolverException, IOException
{
logger.debug(LOG_ENTRY, "generateRepository", new Object[]{repositoryName, byValueBundles, os});
- Document doc;
- try {
- doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
-
- } catch (ParserConfigurationException pce) {
- throw new ResolverException(pce);
- }
- Element root = doc.createElement("repository");
-
- root.setAttribute("name", repositoryName);
- doc.appendChild(root);
- for (ModelledResource mr : byValueBundles) {
- writeResource(new BundleResource(mr, repositoryAdmin), mr.getLocation(), doc, root);
-
- }
-
- try {
- Transformer trans = TransformerFactory.newInstance().newTransformer();
- trans.setOutputProperty(OutputKeys.INDENT, "yes");
- trans.transform(new DOMSource(doc), new StreamResult(os));
- } catch (TransformerException te) {
- logger.debug(LOG_EXIT, "generateRepository", te);
- throw new ResolverException(te);
- }
+ generateRepository(repositoryAdmin, repositoryName, byValueBundles, os);
logger.debug(LOG_EXIT, "generateRepository");
}
- private String getType(String name) {
+ public static void generateRepository (RepositoryAdmin repositoryAdmin, String repositoryName,
+ Collection<? extends ModelledResource> byValueBundles, OutputStream os)
+ throws ResolverException, IOException {
+ logger.debug(LOG_ENTRY, "generateRepository", new Object[]{repositoryAdmin, repositoryName, byValueBundles, os});
+ Document doc;
+ try {
+ doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+
+ } catch (ParserConfigurationException pce) {
+ throw new ResolverException(pce);
+ }
+ Element root = doc.createElement("repository");
+
+ root.setAttribute("name", repositoryName);
+ doc.appendChild(root);
+ for (ModelledResource mr : byValueBundles) {
+ writeResource(new BundleResource(mr, repositoryAdmin), mr.getLocation(), doc, root);
+
+ }
+
+ try {
+ Transformer trans = TransformerFactory.newInstance().newTransformer();
+ trans.setOutputProperty(OutputKeys.INDENT, "yes");
+ trans.transform(new DOMSource(doc), new StreamResult(os));
+ } catch (TransformerException te) {
+ logger.debug(LOG_EXIT, "generateRepository", te);
+ throw new ResolverException(te);
+ }
+ logger.debug(LOG_EXIT, "generateRepository");
+ }
+ private static String getType(String name) {
logger.debug(LOG_ENTRY, "getType", new Object[]{name});
String type = null;
if (Constants.VERSION_ATTRIBUTE.equals(name) || (Constants.BUNDLE_VERSION_ATTRIBUTE.equals(name))) {
Modified: incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml?rev=991173&r1=991172&r2=991173&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml (original)
+++ incubator/aries/trunk/application/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml Tue Aug 31 12:31:05 2010
@@ -25,7 +25,7 @@
<reference interface="org.apache.felix.bundlerepository.RepositoryAdmin"/>
</argument>
<property name="platformRepository" ref="platformRepository"/>
- <property name="repositoryGenerator" ref="repository-generator"/>
+
</bean>
<reference id="platformRepository" interface="org.apache.aries.application.management.PlatformRepository" availability="optional"/>
Modified: incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/impl/ApplicationMetadataImplTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/impl/ApplicationMetadataImplTest.java?rev=991173&r1=991172&r2=991173&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/impl/ApplicationMetadataImplTest.java (original)
+++ incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/impl/ApplicationMetadataImplTest.java Tue Aug 31 12:31:05 2010
@@ -18,14 +18,21 @@
*/
package org.apache.aries.application.impl;
+import static org.junit.Assert.*;
+
import java.io.IOException;
+import java.util.List;
import junit.framework.Assert;
import org.apache.aries.application.ApplicationMetadata;
import org.apache.aries.application.ApplicationMetadataFactory;
+import org.apache.aries.application.Content;
+import org.apache.aries.application.ServiceDeclaration;
import org.apache.aries.application.impl.ApplicationMetadataFactoryImpl;
+import org.apache.aries.application.utils.manifest.ManifestHeaderProcessor.NameValueMap;
import org.junit.Test;
+import org.osgi.framework.Version;
public class ApplicationMetadataImplTest
{
@@ -37,4 +44,29 @@ public class ApplicationMetadataImplTest
Assert.assertEquals("Travel Reservation", app.getApplicationName());
}
+ @Test
+ public void testMetadataCreation() throws Exception
+ {
+ ApplicationMetadataFactory manager = new ApplicationMetadataFactoryImpl();
+ ApplicationMetadata app = manager.parseApplicationMetadata(getClass().getResourceAsStream("/META-INF/APPLICATION4.MF"));
+ assertEquals("Travel Reservation", app.getApplicationName());
+ assertEquals("com.travel.reservation", app.getApplicationSymbolicName());
+ assertEquals(Version.parseVersion("1.2.0"), app.getApplicationVersion());
+ List<Content> appContents = app.getApplicationContents();
+ assertEquals(2, appContents.size());
+ Content appContent1 = new ContentImpl("com.travel.reservation.business");
+ NameValueMap<String, String> attrs = new NameValueMap<String, String>();
+ attrs.addToCollection("version", "\"[1.1.0,1.2.0)\"");
+ Content appContent2 = new ContentImpl("com.travel.reservation.web", attrs);
+ assertTrue(appContents.contains(appContent2));
+ assertTrue(appContents.contains(appContent1));
+ List<ServiceDeclaration> importedService = app.getApplicationImportServices();
+ assertEquals(2, importedService.size());
+ assertTrue(importedService.contains(new ServiceDeclarationImpl("com.travel.flight.api")));
+ assertTrue(importedService.contains(new ServiceDeclarationImpl("com.travel.rail.api")));
+ List<ServiceDeclaration> exportedService = app.getApplicationExportServices();
+ assertTrue(exportedService.contains(new ServiceDeclarationImpl("com.travel.reservation")));
+
+
+ }
}
Modified: incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/utils/filesystem/FileSystemTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/utils/filesystem/FileSystemTest.java?rev=991173&r1=991172&r2=991173&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/utils/filesystem/FileSystemTest.java (original)
+++ incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/utils/filesystem/FileSystemTest.java Tue Aug 31 12:31:05 2010
@@ -142,8 +142,7 @@ public class FileSystemTest
@AfterClass
public static void destroyZip()
{
- new File("fileSystemTest/app2.zip").delete();
- new File("fileSystemTest").delete();
+ IOUtils.deleteRecursive(new File("fileSystemTest/"));
}
/**
@@ -250,7 +249,16 @@ public class FileSystemTest
}
assertEquals(1, files.size());
+ List<IFile> allFiles = dir.listAllFiles();
+ Iterator<IFile> its = allFiles.iterator();
+ while (its.hasNext()) {
+ IFile f = its.next();
+ if (f.getName().toLowerCase().contains(".svn")) {
+ its.remove();
+ }
+ }
+ assertEquals(3, allFiles.size());
IFile metaInf = files.get(0);
assertTrue(metaInf.isDirectory());
Modified: incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/utils/manifest/BundleManifestTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/utils/manifest/BundleManifestTest.java?rev=991173&r1=991172&r2=991173&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/utils/manifest/BundleManifestTest.java (original)
+++ incubator/aries/trunk/application/application-utils/src/test/java/org/apache/aries/application/utils/manifest/BundleManifestTest.java Tue Aug 31 12:31:05 2010
@@ -67,7 +67,7 @@ public class BundleManifestTest
@AfterClass
public static void cleanup()
{
- _testfile.delete();
+ IOUtils.deleteRecursive(new File("bundleManifestTest/"));
}
@Test
Added: incubator/aries/trunk/application/application-utils/src/test/resources/META-INF/APPLICATION4.MF
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-utils/src/test/resources/META-INF/APPLICATION4.MF?rev=991173&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-utils/src/test/resources/META-INF/APPLICATION4.MF (added)
+++ incubator/aries/trunk/application/application-utils/src/test/resources/META-INF/APPLICATION4.MF Tue Aug 31 12:31:05 2010
@@ -0,0 +1,10 @@
+Manifest-Version: 1.0
+Application-ManifestVersion: 1.0
+Application-Name: Travel Reservation
+Application-SymbolicName: com.travel.reservation
+Application-Version: 1.2
+Application-Content: com.travel.reservation.web;version="[1.1.0,1.2.0)",
+ com.travel.reservation.business
+Use-Bundle: com.travel.reservation.api;version="[1.0.0,2.0.0)"
+Application-ImportService: com.travel.flight.api,com.travel.rail.api
+Application-ExportService: com.travel.reservation
Added: incubator/aries/trunk/application/application-utils/src/test/resources/META-INF/DEPLOYMENT.MF
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-utils/src/test/resources/META-INF/DEPLOYMENT.MF?rev=991173&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-utils/src/test/resources/META-INF/DEPLOYMENT.MF (added)
+++ incubator/aries/trunk/application/application-utils/src/test/resources/META-INF/DEPLOYMENT.MF Tue Aug 31 12:31:05 2010
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Application-SymbolicName: com.travel.reservation
+Application-Version: 1.2
+Deployed-Content: com.travel.reservation.web;deployed-version="1.1.0",
+ com.travel.reservation.business;deployed-version=2.0,
+ com.travel.reservation.data;deployed-version=2.1.1
+Provision-Bundle: com.travel.meal;deployed-version=1.0.0, com.ibm.travel.water;deployed-version=2.0.0
+Deployed-Use-Bundle: com.travel.insurance;deployed-version=1.0.0
+Import-Package: com.travel.insurance;version="1.0.0";bundle-symbolic-name="com.travel.insurance";bundle-version="[1.0.0,1.0.0]",org.osgi.framework;vers
+ ion="0.0.0",javax.naming;version="0.0.0",org.osgi.util.tracker;versio
+ n="1.4.0",com.travel.meal;version="[1.0.0,2.0.0)",javax.servlet;
+ version="2.5.0"
+DeployedService-Import: (&(objectClass=aries.test.filter.SimplePr
+ oxyFilter)(com=aries)), (&(objectClass=aries.test.filter2)(com=apache))
+Custom-Entry: com.travel.thirdparty
+Custom-Entry2: com.travel.meal