You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2010/02/08 09:38:07 UTC

svn commit: r907582 - in /geronimo/server/trunk/framework/modules: ./ geronimo-blueprint/ geronimo-blueprint/src/ geronimo-blueprint/src/main/ geronimo-blueprint/src/main/java/ geronimo-blueprint/src/main/java/org/ geronimo-blueprint/src/main/java/org/...

Author: djencks
Date: Mon Feb  8 08:38:05 2010
New Revision: 907582

URL: http://svn.apache.org/viewvc?rev=907582&view=rev
Log:
GERONIMO-5135 WaitForBlueprintGBean to synchronize blueprint and gbean startup concepts

Added:
    geronimo/server/trunk/framework/modules/geronimo-blueprint/
    geronimo/server/trunk/framework/modules/geronimo-blueprint/pom.xml   (with props)
    geronimo/server/trunk/framework/modules/geronimo-blueprint/src/
    geronimo/server/trunk/framework/modules/geronimo-blueprint/src/main/
    geronimo/server/trunk/framework/modules/geronimo-blueprint/src/main/java/
    geronimo/server/trunk/framework/modules/geronimo-blueprint/src/main/java/org/
    geronimo/server/trunk/framework/modules/geronimo-blueprint/src/main/java/org/apache/
    geronimo/server/trunk/framework/modules/geronimo-blueprint/src/main/java/org/apache/geronimo/
    geronimo/server/trunk/framework/modules/geronimo-blueprint/src/main/java/org/apache/geronimo/blueprint/
    geronimo/server/trunk/framework/modules/geronimo-blueprint/src/main/java/org/apache/geronimo/blueprint/WaitForBlueprintGBean.java   (with props)
Modified:
    geronimo/server/trunk/framework/modules/pom.xml

Added: geronimo/server/trunk/framework/modules/geronimo-blueprint/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-blueprint/pom.xml?rev=907582&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-blueprint/pom.xml (added)
+++ geronimo/server/trunk/framework/modules/geronimo-blueprint/pom.xml Mon Feb  8 08:38:05 2010
@@ -0,0 +1,47 @@
+<?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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.framework</groupId>
+        <artifactId>modules</artifactId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>geronimo-blueprint</artifactId>
+    <name>Geronimo Framework, Modules :: blueprint</name>
+    <packaging>bundle</packaging>
+    <description>Classes to adapt blueprint to geronimo</description>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.aries.blueprint</groupId>
+            <artifactId>org.apache.aries.blueprint.api</artifactId>
+            <version>1.0.0-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.framework</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+            <version>${version}</version>
+        </dependency>
+    </dependencies>
+</project>

Propchange: geronimo/server/trunk/framework/modules/geronimo-blueprint/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-blueprint/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-blueprint/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/server/trunk/framework/modules/geronimo-blueprint/src/main/java/org/apache/geronimo/blueprint/WaitForBlueprintGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-blueprint/src/main/java/org/apache/geronimo/blueprint/WaitForBlueprintGBean.java?rev=907582&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-blueprint/src/main/java/org/apache/geronimo/blueprint/WaitForBlueprintGBean.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-blueprint/src/main/java/org/apache/geronimo/blueprint/WaitForBlueprintGBean.java Mon Feb  8 08:38:05 2010
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.geronimo.blueprint;
+
+import java.util.Hashtable;
+import java.util.concurrent.CountDownLatch;
+
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.blueprint.container.BlueprintEvent;
+import org.osgi.service.blueprint.container.BlueprintListener;
+
+/**
+ * Blueprint starts beans asynchornously whereas geronimo starts configurations in a single thread.
+ * This bean waits for the blueprint activity to complete before returning.
+ *
+ * @version $Rev$ $Date$
+ */
+
+@GBean
+public class WaitForBlueprintGBean {
+    private volatile BlueprintEvent event;
+    private CountDownLatch latch = new CountDownLatch(1);
+
+    public WaitForBlueprintGBean(@ParamSpecial(type= SpecialAttributeType.bundleContext)BundleContext bundleContext) throws Exception {
+        final Bundle bundle = bundleContext.getBundle();
+        BlueprintListener listener = new BlueprintListener() {
+
+            @Override
+            public void blueprintEvent(BlueprintEvent event) {
+                if (event.getBundle() == bundle) {
+                    if (event.getType() == BlueprintEvent.CREATED || event.getType() == BlueprintEvent.FAILURE) {
+                        WaitForBlueprintGBean.this.event = event;
+                        latch.countDown();
+                    }
+                }
+            }
+        };
+        ServiceRegistration registration = bundleContext.registerService(BlueprintListener.class.getName(), listener, new Hashtable());
+        latch.await();
+        registration.unregister();
+        if (event.getType() == BlueprintEvent.FAILURE) {
+            throw new Exception("Could not start blueprint plan", event.getCause());
+        }
+    }
+
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-blueprint/src/main/java/org/apache/geronimo/blueprint/WaitForBlueprintGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-blueprint/src/main/java/org/apache/geronimo/blueprint/WaitForBlueprintGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-blueprint/src/main/java/org/apache/geronimo/blueprint/WaitForBlueprintGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/framework/modules/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/pom.xml?rev=907582&r1=907581&r2=907582&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/pom.xml (original)
+++ geronimo/server/trunk/framework/modules/pom.xml Mon Feb  8 08:38:05 2010
@@ -14,7 +14,9 @@
     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.
---><!-- $Rev$ $Date$ --><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+--><!-- $Rev$ $Date$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     
     <modelVersion>4.0.0</modelVersion>
     
@@ -47,7 +49,8 @@
         <module>geronimo-plugin</module>
         <module>geronimo-deploy-tool</module>
         <module>geronimo-shell-base</module>
-    </modules>
+        <module>geronimo-blueprint</module>
+  </modules>
 
     <profiles>
         <profile>
@@ -149,4 +152,4 @@
         </plugins>
     </build>
 
-</project>
+</project>
\ No newline at end of file