geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r772328 - /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
Date Wed, 06 May 2009 15:52:36 GMT
Author: gawor
Date: Wed May  6 15:52:34 2009
New Revision: 772328

URL: http://svn.apache.org/viewvc?rev=772328&view=rev
Log:
hook up wait-for-dependencies directive

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java?rev=772328&r1=772327&r2=772328&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
(original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/context/BlueprintContextImpl.java
Wed May  6 15:52:34 2009
@@ -107,6 +107,8 @@
     private Map<String, List<SatisfiableRecipe>> satisfiables;
     private boolean serviceActivation;
     private Map<ServiceMetadata, TriggerService> triggerServices;
+    private long timeout = 5 * 60 * 1000; 
+    private boolean waitForDependencies = true;
 
     public BlueprintContextImpl(BundleContext bundleContext, BlueprintContextEventSender
sender, NamespaceHandlerRegistry handlers, ExecutorService executors, List<URL> urls,
boolean lazyActivation) {
         this.bundleContext = bundleContext;
@@ -143,17 +145,20 @@
         Dictionary headers = bundle.getHeaders();
         String symbolicName = (String)headers.get(Constants.BUNDLE_SYMBOLICNAME);
         List<PathElement> paths = HeaderParser.parseHeader(symbolicName);
-        String timeout = paths.get(0).getDirective(BlueprintConstants.TIMEOUT_DIRECTIVE);
-        String waitForDependencies = paths.get(0).getDirective(BlueprintConstants.WAIT_FOR_DEPENDENCIES_DIRECTIVE);
-
-        // TODO: hook this up
         
-        if (timeout != null) {
-            System.out.println("Timeout: " + timeout);
+        String timeoutDirective = paths.get(0).getDirective(BlueprintConstants.TIMEOUT_DIRECTIVE);
       
+        if (timeoutDirective != null) {
+            LOGGER.debug("Timeout directive: " + timeoutDirective);
+            timeout = Integer.parseInt(timeoutDirective);
         }
-        if (waitForDependencies != null) {
-            System.out.println("Wait-for-dependencies: " + waitForDependencies);
+        
+        String waitForDependenciesDirective = paths.get(0).getDirective(BlueprintConstants.WAIT_FOR_DEPENDENCIES_DIRECTIVE);
+        if (waitForDependenciesDirective != null) {
+            LOGGER.debug("Wait-for-dependencies directive: " + waitForDependenciesDirective);
+            waitForDependencies = Boolean.parseBoolean(waitForDependenciesDirective);
         }
+        
+        // TODO: add support for custom directive to disable schema validation?
     }
     
     public void run(boolean asynch) {
@@ -201,7 +206,7 @@
                         Repository repository = i.createRepository(componentDefinitionRegistry);
                         instantiator = new BlueprintObjectInstantiator(repository);
                         instanciateServiceReferences();
-                        if (checkAllSatisfiables()) {
+                        if (checkAllSatisfiables() || !waitForDependencies) {
                             state = State.InitialReferencesSatisfied;
                         } else {
                             // TODO: pass correct parameters
@@ -284,8 +289,11 @@
         instantiator = new BlueprintObjectInstantiator(repository);
         for (BeanMetadata bean : getBeanComponentsMetadata()) {
             Class clazz = bean.getRuntimeClass();
-            if (clazz == null) {
+            if (clazz == null && bean.getClassName() != null) {
                 clazz = loadClass(bean.getClassName());
+            } 
+            if (clazz == null) {
+                continue;
             }
             if (ComponentDefinitionRegistryProcessor.class.isAssignableFrom(clazz)) {
                 Object obj = instantiator.create(bean.getId());



Mime
View raw message