hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahue...@apache.org
Subject svn commit: r439475 - in /hivemind/branches/branch-2-0-annot: ./ framework/src/java/org/apache/hivemind/ framework/src/java/org/apache/hivemind/impl/ framework/src/java/org/apache/hivemind/impl/servicemodel/ framework/src/test/org/apache/hivemind/servl...
Date Fri, 01 Sep 2006 20:56:21 GMT
Author: ahuegen
Date: Fri Sep  1 13:56:21 2006
New Revision: 439475

URL: http://svn.apache.org/viewvc?rev=439475&view=rev
Log:
Moved symbol sources from hivemodule.xml to CoreServicesProvider

Added:
    hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/servlet/webinf-hivemodule.xml
  (contents, props changed)
      - copied, changed from r438605, hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/servlet/webinf-hivemodule.xml
Removed:
    hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/servlet/webinf-hivemodule.xml
Modified:
    hivemind/branches/branch-2-0-annot/   (props changed)
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/SymbolSourceContribution.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/CoreServicesProvider.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/servicemodel/AbstractServiceModelImpl.java
    hivemind/branches/branch-2-0-annot/xml/src/descriptor/META-INF/hivemodule.xml
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java

Propchange: hivemind/branches/branch-2-0-annot/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Sep  1 13:56:21 2006
@@ -5,3 +5,4 @@
 ext-package
 .clover
 build
+annotations.doc

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/SymbolSourceContribution.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/SymbolSourceContribution.java?rev=439475&r1=439474&r2=439475&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/SymbolSourceContribution.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/SymbolSourceContribution.java
Fri Sep  1 13:56:21 2006
@@ -31,6 +31,18 @@
 
     private SymbolSource _source;
 
+    public SymbolSourceContribution()
+    {
+    }
+    
+    public SymbolSourceContribution(SymbolSource source, String name, String precedingNames,
String followingNames)
+    {
+        _source = source;
+        _name = name;
+        _precedingNames = precedingNames;
+        _followingNames = followingNames;
+    }
+
     public SymbolSource getSource()
     {
         return _source;

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/CoreServicesProvider.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/CoreServicesProvider.java?rev=439475&r1=439474&r2=439475&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/CoreServicesProvider.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/CoreServicesProvider.java
Fri Sep  1 13:56:21 2006
@@ -9,6 +9,8 @@
 import org.apache.hivemind.ErrorHandler;
 import org.apache.hivemind.HiveMind;
 import org.apache.hivemind.ShutdownCoordinator;
+import org.apache.hivemind.SymbolSource;
+import org.apache.hivemind.SymbolSourceContribution;
 import org.apache.hivemind.definition.ConfigurationPointDefinition;
 import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.ModuleDefinitionHelper;
@@ -31,6 +33,7 @@
 import org.apache.hivemind.service.ThreadLocalStorage;
 import org.apache.hivemind.service.ThreadLocale;
 import org.apache.hivemind.service.impl.ClassFactoryImpl;
+import org.apache.hivemind.service.impl.DefaultsSymbolSource;
 import org.apache.hivemind.service.impl.EagerLoader;
 import org.apache.hivemind.service.impl.InterfaceSynthesizerImpl;
 import org.apache.hivemind.service.impl.ThreadEventNotifierImpl;
@@ -66,6 +69,14 @@
 
         helper = new ModuleDefinitionHelper(md);
         
+        addSymbolSourcesConfiguration(md);
+        
+        // SymbolSource implementation driven by the FactoryDefaults configuration point.
+        addSymbolSource(md, "FactoryDefaultsSymbolSource", "FactoryDefaults");
+        
+        // SymbolSource implementation driven by the ApplicationDefaults configuration point.
+        addSymbolSource(md, "ApplicationDefaultsSymbolSource", "ApplicationDefaults");
+
         addClassFactory(md);
 
         addThreadEventNotifier(md);
@@ -83,6 +94,66 @@
         addInterfaceSynthesizer(md);
         
         addServiceModuleConfiguration();
+    }
+
+    /**
+     * Provides a list of sources (SymbolSource) for values of substitution symbols.
+     */
+    private void addSymbolSourcesConfiguration(ModuleDefinition md)
+    {
+        ConfigurationPointDefinition cpd = helper.addConfigurationPoint("SymbolSources",
+                new CreateClassConfigurationConstructor(md.getLocation(), ArrayList.class.getName()),
List.class
+                        .getName());
+
+        helper.addContributionDefinition(cpd, new Contribution()
+        {
+
+            public void contribute(ConfigurationPoint configurationPoint, Object container)
+            {
+                // Add the default symbol sources FactoryDefaults and
+                // ApplicationDefaults
+                SymbolSource factoryDefaults = (SymbolSource) configurationPoint.getModule().getService(
+                        "FactoryDefaultsSymbolSource", SymbolSource.class);
+                SymbolSourceContribution factoryDefaultsContrib = new SymbolSourceContribution(factoryDefaults,
+                        "hivemind.FactoryDefaults", null, null);
+                ((List) container).add(factoryDefaultsContrib);
+
+                SymbolSource applicationDefaults = (SymbolSource) configurationPoint.getModule().getService(
+                        "ApplicationDefaultsSymbolSource", SymbolSource.class);
+                SymbolSourceContribution applicationDefaultsContrib = new SymbolSourceContribution(applicationDefaults,
+                        "hivemind.ApplicationDefaults", null, "hivemind.FactoryDefaults");
+                ((List) container).add(applicationDefaultsContrib);
+            }
+        });
+    }
+    
+    /**
+     * Adds a service that implements the symbol source interface and a
+     * corresponding configuration point that holds the symbol values.
+     */
+    private void addSymbolSource(ModuleDefinition md, final String servicePointId, final
String configurationId)
+    {
+        ServicePointDefinition spd = helper.addServicePoint(servicePointId, SymbolSource.class.getName());
+
+        // Define inline implementation constructor, that wires the corresponding configuration
+        ServiceImplementationConstructor constructor = new AbstractServiceImplementationConstructor(md.getLocation())
+        {
+            public Object constructCoreServiceImplementation(ServicePoint servicePoint,
+                    Module contributingModule)
+            {
+                DefaultsSymbolSource result = new DefaultsSymbolSource();
+                result.setDefaults((List) contributingModule.getConfiguration(configurationId));
+                result.initializeService();
+                return result;
+            }
+        };
+        helper.addServiceImplementation(spd, constructor, ServiceModel.SINGLETON);
+        
+        // Configuration point for setting defaults for symbol values.
+
+        helper.addConfigurationPoint(configurationId, 
+                new CreateClassConfigurationConstructor(md.getLocation(), ArrayList.class.getName()),

+                List.class.getName());
     }
 
     /**

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/servicemodel/AbstractServiceModelImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/servicemodel/AbstractServiceModelImpl.java?rev=439475&r1=439474&r2=439475&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/servicemodel/AbstractServiceModelImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/servicemodel/AbstractServiceModelImpl.java
Fri Sep  1 13:56:21 2006
@@ -29,7 +29,6 @@
 import org.apache.hivemind.impl.ProxyBuilder;
 import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.internal.ServiceImplementationConstructor;
-import org.apache.hivemind.internal.ServiceInterceptorConstructor;
 import org.apache.hivemind.internal.ServiceModel;
 import org.apache.hivemind.service.ClassFab;
 import org.apache.hivemind.util.ConstructorUtils;

Modified: hivemind/branches/branch-2-0-annot/xml/src/descriptor/META-INF/hivemodule.xml
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/descriptor/META-INF/hivemodule.xml?rev=439475&r1=439474&r2=439475&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/descriptor/META-INF/hivemodule.xml (original)
+++ hivemind/branches/branch-2-0-annot/xml/src/descriptor/META-INF/hivemodule.xml Fri Sep
 1 13:56:21 2006
@@ -19,10 +19,8 @@
     
   The master module for HiveMind, defining core, universal functionality.
 
-  <configuration-point id="SymbolSources">
-    Provides a list of sources for values of substitution symbols.
-        
-    <schema>
+  <schema-assignment configuration-id="hivemind.SymbolSources" schema-id="SymbolSources"
/>
+  <schema id="SymbolSources">
       <element name="source">
         
         Describes a single source of symbol values.
@@ -58,14 +56,7 @@
           <map attribute="after" property="precedingNames"/> 
         </conversion> 
       </element>
-    </schema>
-  </configuration-point>
-  
-  <contribution configuration-id="SymbolSources">
-    <source before="hivemind.FactoryDefaults"
-      name="hivemind.ApplicationDefaults" service-id="ApplicationDefaultsSymbolSource"/>
-    <source name="hivemind.FactoryDefaults" service-id="FactoryDefaultsSymbolSource"/>
-  </contribution>
+  </schema>
   
   <schema id="Defaults">
     <element name="default">
@@ -82,36 +73,9 @@
     </element>
   </schema>
   
-  <configuration-point id="FactoryDefaults" schema-id="Defaults">
-    Extension point for setting "factory defaults" for symbol values.
-  </configuration-point>
-  
-  <service-point id="FactoryDefaultsSymbolSource" interface="SymbolSource" visibility="private">
-    
-    SymbolSource implementation driven by the FactoryDefaults configuration point.
-        
-    <invoke-factory>
-      <construct class="service.impl.DefaultsSymbolSource">
-        <set-configuration configuration-id="FactoryDefaults" property="defaults"/>
-      </construct>
-    </invoke-factory>
-  </service-point>
-  
-  <configuration-point id="ApplicationDefaults" schema-id="Defaults">
-    Extension point for setting application defaults; these defaults will override factory
defaults specified in the FactoryDefaults configuration point.
-  </configuration-point>
-  
-  <service-point id="ApplicationDefaultsSymbolSource" interface="SymbolSource" visibility="private">
-    
-    SymbolSource implementation driven by the ApplicationDefaults configuration point.
-      
-    <invoke-factory>
-      <construct class="service.impl.DefaultsSymbolSource">
-        <set-configuration
-          configuration-id="ApplicationDefaults" property="defaults"/>
-      </construct>
-    </invoke-factory>
-  </service-point>
+  <schema-assignment configuration-id="FactoryDefaults" schema-id="Defaults" />
+
+  <schema-assignment configuration-id="ApplicationDefaults" schema-id="Defaults" />
   
   <schema id="MethodFilter">
     Used primarily as parameters to interceptor factories (such as LoggingInterceptor) to
define which methods of service interface are to be included and which excluded.

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java?rev=439475&r1=439474&r2=439475&view=diff
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlModuleDescriptorProcessor.java
Fri Sep  1 13:56:21 2006
@@ -408,7 +408,8 @@
         {
             SchemaAssignmentDescriptor schemaAssignment = (SchemaAssignmentDescriptor) schemaAssignments.get(i);
 
-            ConfigurationPointDefinition cpd = _registryDefinition.getConfigurationPoint(schemaAssignment.getConfigurationId());
+            String configurationPointId = IdUtils.qualify(md.getModuleId(), schemaAssignment.getConfigurationId());
+            ConfigurationPointDefinition cpd = _registryDefinition.getConfigurationPoint(configurationPointId);
             if (cpd == null) {
                 // TODO annotations: Exception handling
                 throw new ApplicationRuntimeException("Unknown configuration point");

Copied: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/servlet/webinf-hivemodule.xml
(from r438605, hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/servlet/webinf-hivemodule.xml)
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/servlet/webinf-hivemodule.xml?p2=hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/servlet/webinf-hivemodule.xml&p1=hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/servlet/webinf-hivemodule.xml&r1=438605&r2=439475&rev=439475&view=diff
==============================================================================
    (empty)

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/servlet/webinf-hivemodule.xml
------------------------------------------------------------------------------
    cvs2svn:cvs-rev = 1.2

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/servlet/webinf-hivemodule.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/servlet/webinf-hivemodule.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message