hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahue...@apache.org
Subject svn commit: r473805 - 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/internal/ framework/src/test/org/apache/hivemind/impl/ xml/src/jav...
Date Sat, 11 Nov 2006 22:01:06 GMT
Author: ahuegen
Date: Sat Nov 11 14:01:04 2006
New Revision: 473805

URL: http://svn.apache.org/viewvc?view=rev&rev=473805
Log:
Moved SymbolExpander to xml module

Added:
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/SymbolExpander.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SymbolExpanderImpl.java
  (contents, props changed)
      - copied, changed from r472779, hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/SymbolExpander.java
    hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestSymbolExpander.java
  (contents, props changed)
      - copied, changed from r472779, hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestSymbolExpander.java
Removed:
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/SymbolExpander.java
    hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestSymbolExpander.java
Modified:
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/Registry.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplMessages.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplStrings.properties
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ModuleImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/Module.java
    hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/RegistryInfrastructure.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SchemaProcessorImpl.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlCoreServicesProvider.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlImplMessages.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlImplStrings.properties
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/SchemaProcessor.java
    hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/RuleUtils.java
    hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestPushAttributeRule.java
    hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestPushContentRule.java
    hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestReadAttributeRule.java
    hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestSchemaProcessor.java
    hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/servlet/TestHiveMindFilter.java

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/Registry.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/Registry.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/Registry.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/Registry.java
Sat Nov 11 14:01:04 2006
@@ -65,19 +65,6 @@
     public Object getConfiguration(String configurationId);
 
     /**
-     * Expands any substitution symbols in the input string, replacing each symbol with the
symbols
-     * value (if known). If a symbol is unknown, then the symbol is passed through unchanged
-     * (complete with the <code>${</code> and <code>}</code> delimiters)
and an error is logged.
-     * 
-     * @param input
-     *            input string to be converted, which may (or may not) contain any symbols.
-     * @param location
-     *            the location from which the string was obtained, used if an error is logged.
-     */
-
-    public String expandSymbols(String input, Location location);
-
-    /**
      * Obtains a service from the registry. Typically, what's returned is a proxy, but that's
      * irrelevant to the caller, which simply will invoke methods of the service interface.
      * 

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplMessages.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplMessages.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplMessages.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplMessages.java
Sat Nov 11 14:01:04 2006
@@ -136,11 +136,6 @@
         return _formatter.format("no-such-configuration", pointId);
     }
 
-    static String noSuchSymbol(String name)
-    {
-        return _formatter.format("no-such-symbol", name);
-    }
-
     static String symbolSourceContribution()
     {
         return _formatter.getMessage("symbol-source-contribution");

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplStrings.properties
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplStrings.properties?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplStrings.properties
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ImplStrings.properties
Sat Nov 11 14:01:04 2006
@@ -31,7 +31,6 @@
 duplicate-factory=Module {0} has contributed a instance builder to service point {1}, which
conflicts with an existing contribution by module {2}. The duplicate contribution has been
ignored.  
 
 no-such-configuration=Configuration point {0} does not exist.
-no-such-symbol=No value available for symbol ''{0}''.
 symbol-source-contribution=symbol source
 bad-interface=Unable to find interface {0} (for service {1}).
 service-wrong-interface=Service {0} does not implement the requested interface ({1}).  The
declared service interface type is {2}.

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ModuleImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ModuleImpl.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ModuleImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/ModuleImpl.java
Sat Nov 11 14:01:04 2006
@@ -22,7 +22,6 @@
 import org.apache.hivemind.ClassResolver;
 import org.apache.hivemind.ErrorHandler;
 import org.apache.hivemind.HiveMind;
-import org.apache.hivemind.Location;
 import org.apache.hivemind.Messages;
 import org.apache.hivemind.internal.MessageFinder;
 import org.apache.hivemind.internal.Module;
@@ -129,11 +128,6 @@
         }
 
         return _messages;
-    }
-
-    public String expandSymbols(String input, Location location)
-    {
-        return _registry.expandSymbols(input, location);
     }
 
     public String toString()

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryImpl.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryImpl.java
Sat Nov 11 14:01:04 2006
@@ -17,7 +17,6 @@
 import java.util.List;
 import java.util.Locale;
 
-import org.apache.hivemind.Location;
 import org.apache.hivemind.Messages;
 import org.apache.hivemind.Registry;
 import org.apache.hivemind.internal.Module;
@@ -56,11 +55,6 @@
     public Object getConfiguration(String configurationId)
     {
         return _infrastructure.getConfiguration(configurationId, null);
-    }
-
-    public String expandSymbols(String input, Location location)
-    {
-        return _infrastructure.expandSymbols(input, location);
     }
 
     public Object getService(String serviceId, Class serviceInterface)

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java
Sat Nov 11 14:01:04 2006
@@ -28,7 +28,6 @@
 import org.apache.hivemind.ErrorHandler;
 import org.apache.hivemind.HiveMind;
 import org.apache.hivemind.HiveMindMessages;
-import org.apache.hivemind.Location;
 import org.apache.hivemind.ShutdownCoordinator;
 import org.apache.hivemind.SymbolSource;
 import org.apache.hivemind.SymbolSourceContribution;
@@ -106,14 +105,10 @@
 
     private ThreadEventNotifier _threadEventNotifier;
 
-    private SymbolExpander _expander;
-
     public RegistryInfrastructureImpl(ErrorHandler errorHandler, Locale locale)
     {
         _errorHandler = errorHandler;
         _locale = locale;
-
-        _expander = new SymbolExpander(_errorHandler, this);
     }
 
     public Locale getLocale()
@@ -290,11 +285,6 @@
         builder.append("locale", _locale);
 
         return builder.toString();
-    }
-
-    public String expandSymbols(String text, Location location)
-    {
-        return _expander.expandSymbols(text, location);
     }
 
     public String valueForSymbol(String name)

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/Module.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/Module.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/Module.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/Module.java
Sat Nov 11 14:01:04 2006
@@ -20,7 +20,6 @@
 import org.apache.hivemind.ClassResolver;
 import org.apache.hivemind.ErrorHandler;
 import org.apache.hivemind.Locatable;
-import org.apache.hivemind.Location;
 import org.apache.hivemind.Messages;
 import org.apache.hivemind.SymbolSource;
 
@@ -136,11 +135,6 @@
      * @see org.apache.hivemind.Registry#getLocale()
      */
     public Locale getLocale();
-
-    /**
-     * @see org.apache.hivemind.internal.RegistryInfrastructure#expandSymbols(String, Location)
-     */
-    public String expandSymbols(String input, Location location);
 
     /**
      * Returns the {@link org.apache.hivemind.ErrorHandler} for this Registry.

Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/RegistryInfrastructure.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/RegistryInfrastructure.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/RegistryInfrastructure.java
(original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/internal/RegistryInfrastructure.java
Sat Nov 11 14:01:04 2006
@@ -18,7 +18,6 @@
 import java.util.Locale;
 
 import org.apache.hivemind.ErrorHandler;
-import org.apache.hivemind.Location;
 import org.apache.hivemind.SymbolSource;
 
 /**
@@ -105,19 +104,6 @@
      */
 
     public ServicePoint getServicePoint(String serviceId, Module module);
-
-    /**
-     * Expands any substitution symbols in the input string, replacing each symbol with the
symbols
-     * value (if known). If a symbol is unknown, then the symbol is passed through unchanged
-     * (complete with the <code>${</code> and <code>}</code> delimiters)
and an error is logged.
-     * 
-     * @param input
-     *            input string to be converted, which may (or may not) contain any symbols.
-     * @param location
-     *            the location from which the string was obtained, used if an error is logged.
-     */
-
-    public String expandSymbols(String input, Location location);
 
     /**
      * Returns a named service-model factory

Added: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/SymbolExpander.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/SymbolExpander.java?view=auto&rev=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/SymbolExpander.java
(added)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/SymbolExpander.java
Sat Nov 11 14:01:04 2006
@@ -0,0 +1,24 @@
+package org.apache.hivemind;
+
+import org.apache.hivemind.Location;
+
+/**
+ * A simple parser used to identify symbols in a string and expand them via a
+ * {@link org.apache.hivemind.SymbolSource}.
+ * 
+ * @author Howard Lewis Ship
+ */
+public interface SymbolExpander
+{
+    /**
+     * <p>
+     * Identifies symbols in the text and expands them, using the {@link SymbolSource}. Returns
the
+     * modified text. May return text if text does not contain any symbols.
+     * 
+     * @param text
+     *            the text to scan
+     * @param location
+     *            the location to report errors (undefined symbols)
+     */
+    public String expandSymbols(String text, Location location);
+}
\ No newline at end of file

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SchemaProcessorImpl.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SchemaProcessorImpl.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SchemaProcessorImpl.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SchemaProcessorImpl.java
Sat Nov 11 14:01:04 2006
@@ -23,6 +23,7 @@
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.Element;
 import org.apache.hivemind.ErrorLog;
+import org.apache.hivemind.SymbolExpander;
 import org.apache.hivemind.TranslatorManager;
 import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.schema.AttributeModel;
@@ -51,6 +52,8 @@
     
     private TranslatorManager _translatorManager;
     
+    private SymbolExpander _symbolExpander;
+    
     /**
      * Map on element name to {@link SchemaElement}.
      */
@@ -112,7 +115,7 @@
                 }
             }
 
-            String expandedKey = getContributingModule().expandSymbols(
+            String expandedKey = getSymbolExpander().expandSymbols(
                     currentElement.getAttributeValue(keyAttribute),
                     currentElement.getLocation());
 
@@ -324,5 +327,13 @@
         }
         
         return _translatorManager.getTranslator(translator);
+    }
+
+    public SymbolExpander getSymbolExpander()
+    {
+        if (_symbolExpander == null) {
+            _symbolExpander = (SymbolExpander) _contributingModule.getService(SymbolExpander.class);
+        }
+       return _symbolExpander;
     }
 }

Copied: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SymbolExpanderImpl.java
(from r472779, hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/SymbolExpander.java)
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SymbolExpanderImpl.java?view=diff&rev=473805&p1=hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/SymbolExpander.java&r1=472779&p2=hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SymbolExpanderImpl.java&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/SymbolExpander.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SymbolExpanderImpl.java
Sat Nov 11 14:01:04 2006
@@ -18,6 +18,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.hivemind.ErrorHandler;
 import org.apache.hivemind.Location;
+import org.apache.hivemind.SymbolExpander;
 import org.apache.hivemind.SymbolSource;
 
 /**
@@ -26,19 +27,19 @@
  * 
  * @author Howard Lewis Ship
  */
-public class SymbolExpander
+public class SymbolExpanderImpl implements SymbolExpander
 {
     private ErrorHandler _errorHandler;
 
     private SymbolSource _source;
 
-    public SymbolExpander(ErrorHandler handler, SymbolSource source)
+    public SymbolExpanderImpl(ErrorHandler handler, SymbolSource source)
     {
         _errorHandler = handler;
         _source = source;
     }
 
-    private static final Log LOG = LogFactory.getLog(SymbolExpander.class);
+    private static final Log LOG = LogFactory.getLog(SymbolExpanderImpl.class);
 
     private static final int STATE_START = 0;
 
@@ -47,14 +48,7 @@
     private static final int STATE_COLLECT_SYMBOL_NAME = 2;
 
     /**
-     * <p>
-     * Identifies symbols in the text and expands them, using the {@link SymbolSource}. Returns
the
-     * modified text. May return text if text does not contain any symbols.
-     * 
-     * @param text
-     *            the text to scan
-     * @param location
-     *            the location to report errors (undefined symbols)
+     * @see org.apache.hivemind.SymbolExpander#expandSymbols(java.lang.String, org.apache.hivemind.Location)
      */
     public String expandSymbols(String text, Location location)
     {
@@ -219,7 +213,7 @@
         if (value != null)
             return value;
 
-        _errorHandler.error(LOG, ImplMessages.noSuchSymbol(name), location, null);
+        _errorHandler.error(LOG, XmlImplMessages.noSuchSymbol(name), location, null);
 
         return "${" + name + "}";
     }

Propchange: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SymbolExpanderImpl.java
------------------------------------------------------------------------------
    cvs2svn:cvs-rev = 1.3

Propchange: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SymbolExpanderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/SymbolExpanderImpl.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlCoreServicesProvider.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlCoreServicesProvider.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlCoreServicesProvider.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlCoreServicesProvider.java
Sat Nov 11 14:01:04 2006
@@ -6,6 +6,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.ErrorHandler;
+import org.apache.hivemind.SymbolExpander;
 import org.apache.hivemind.TranslatorManager;
 import org.apache.hivemind.definition.ModuleDefinition;
 import org.apache.hivemind.definition.ModuleDefinitionHelper;
@@ -38,6 +39,7 @@
             throw new ApplicationRuntimeException("Module 'hivemind' not found.");
         }
         addTranslatorManager(moduleDefinition, errorHandler);
+        addSymbolExpander(moduleDefinition, errorHandler);
     }
     
     /**
@@ -59,7 +61,27 @@
             }
         };
         helper.addServiceImplementation(spd, constructor, ServiceModel.PRIMITIVE);
-        
     }
     
+    /**
+     * @see SymbolExpander
+     */
+    private void addSymbolExpander(ModuleDefinition md, final ErrorHandler errorHandler)
+    {
+        ModuleDefinitionHelper helper = new ModuleDefinitionHelper(md);
+        ServicePointDefinition spd = helper.addServicePoint("SymbolExpander", SymbolExpander.class.getName());
+
+        // Define inline implementation constructor, that wires ErrorHandler and SymbolSource
+        ImplementationConstructor constructor = new AbstractServiceImplementationConstructor(md.getLocation())
+        {
+            public Object constructCoreServiceImplementation(ImplementationConstructionContext
context)
+            {
+                SymbolExpander result = new SymbolExpanderImpl(errorHandler, context.getRegistry());
+                return result;
+            }
+        };
+        helper.addServiceImplementation(spd, constructor, ServiceModel.PRIMITIVE);
+        
+    }
+
 }

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlImplMessages.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlImplMessages.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlImplMessages.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlImplMessages.java
Sat Nov 11 14:01:04 2006
@@ -135,4 +135,10 @@
     {
         return _formatter.format("unable-to-find-module-resource", resource);
     }
+
+    static String noSuchSymbol(String name)
+    {
+        return _formatter.format("no-such-symbol", name);
+    }
+
 }

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlImplStrings.properties
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlImplStrings.properties?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlImplStrings.properties
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/impl/XmlImplStrings.properties
Sat Nov 11 14:01:04 2006
@@ -39,3 +39,7 @@
 sub-module-does-not-exist=Sub-module {0} does not exist.
 unable-to-find-modules-error=Unable to locate HiveMind module deployment descriptors in {0}:
{1}
 unable-to-find-module-resource=Unable to locate HiveMind module deployment descriptors in
{0}
+
+no-such-symbol=No value available for symbol ''{0}''.
+
+

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/SchemaProcessor.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/SchemaProcessor.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/SchemaProcessor.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/SchemaProcessor.java
Sat Nov 11 14:01:04 2006
@@ -14,6 +14,7 @@
 
 package org.apache.hivemind.schema;
 
+import org.apache.hivemind.SymbolExpander;
 import org.apache.hivemind.internal.Module;
 
 /**
@@ -102,5 +103,10 @@
      *               The elements are placed in a map to maintain backward compatibility

      */
     public boolean isInBackwardCompatibilityModeForMaps();
+    
+    /**
+     * @return  the {@link SymbolExpander} used by the processor
+     */
+    public SymbolExpander getSymbolExpander();
 
 }

Modified: hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/RuleUtils.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/RuleUtils.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/RuleUtils.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/java/org/apache/hivemind/schema/rules/RuleUtils.java
Sat Nov 11 14:01:04 2006
@@ -107,7 +107,7 @@
             return contributingModule.getMessages().getMessage(key);
         }
 
-        return contributingModule.expandSymbols(inputValue, element.getLocation());
+        return processor.getSymbolExpander().expandSymbols(inputValue, element.getLocation());
     }
 
     /**

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestPushAttributeRule.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestPushAttributeRule.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestPushAttributeRule.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestPushAttributeRule.java
Sat Nov 11 14:01:04 2006
@@ -15,6 +15,7 @@
 package hivemind.test.rules;
 
 import org.apache.hivemind.Attribute;
+import org.apache.hivemind.SymbolExpander;
 import org.apache.hivemind.impl.AttributeImpl;
 import org.apache.hivemind.impl.ElementImpl;
 import org.apache.hivemind.internal.Module;
@@ -50,14 +51,20 @@
 
         control.setReturnValue(mockModule);
 
+        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
+        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();
+        
+        mockProcessor.getSymbolExpander();
+        control.setReturnValue(symbolExpander);
+
         mockProcessor.getAttributeTranslator("fred");
         control.setReturnValue(new NullTranslator());
 
         mockProcessor.getContributingModule();
         control.setReturnValue(mockModule);
 
-        mockModule.expandSymbols("${flintstone}", element.getLocation());
-        moduleControl.setReturnValue("FLINTSTONE");
+        symbolExpander.expandSymbols("${flintstone}", element.getLocation());
+        symbolExpanderControl.setReturnValue("FLINTSTONE");
 
         mockProcessor.push("FLINTSTONE");
         mockProcessor.pop();

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestPushContentRule.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestPushContentRule.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestPushContentRule.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestPushContentRule.java
Sat Nov 11 14:01:04 2006
@@ -14,6 +14,7 @@
 
 package hivemind.test.rules;
 
+import org.apache.hivemind.SymbolExpander;
 import org.apache.hivemind.impl.ElementImpl;
 import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.schema.SchemaProcessor;
@@ -45,10 +46,19 @@
         MockControl moduleControl = newControl(Module.class);
         Module mockModule = (Module) moduleControl.getMock();
 
-        control.setReturnValue(mockModule, 2);
-
-        mockModule.expandSymbols("${flintstone}", element.getLocation());
-        moduleControl.setReturnValue("FLINTSTONE");
+        control.setReturnValue(mockModule);
+        
+        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
+        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();
+        
+        mockProcessor.getSymbolExpander();
+        control.setReturnValue(symbolExpander);
+
+        symbolExpander.expandSymbols("${flintstone}", element.getLocation());
+        symbolExpanderControl.setReturnValue("FLINTSTONE");
+        
+        mockProcessor.getContributingModule();
+        control.setReturnValue(mockModule);
 
         mockProcessor.push("FLINTSTONE");
         mockProcessor.pop();

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestReadAttributeRule.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestReadAttributeRule.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestReadAttributeRule.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/hivemind/test/rules/TestReadAttributeRule.java
Sat Nov 11 14:01:04 2006
@@ -16,6 +16,7 @@
 
 import hivemind.test.services.impl.StringHolderImpl;
 
+import org.apache.hivemind.SymbolExpander;
 import org.apache.hivemind.impl.ElementImpl;
 import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.schema.SchemaProcessor;
@@ -48,6 +49,12 @@
         Module mockModule = (Module) moduleControl.getMock();
 
         control.setReturnValue(mockModule);
+        
+        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
+        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();
+        
+        mockProcessor.getSymbolExpander();
+        control.setReturnValue(symbolExpander);
 
         mockProcessor.peek();
 
@@ -60,8 +67,8 @@
         mockProcessor.getContributingModule();
         control.setReturnValue(mockModule);
 
-        mockModule.expandSymbols("${flintstone}", element.getLocation());
-        moduleControl.setReturnValue("FLINTSTONE");
+        symbolExpander.expandSymbols("${flintstone}", element.getLocation());
+        symbolExpanderControl.setReturnValue("FLINTSTONE");
 
         replayControls();
 

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestSchemaProcessor.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestSchemaProcessor.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestSchemaProcessor.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestSchemaProcessor.java
Sat Nov 11 14:01:04 2006
@@ -27,6 +27,7 @@
 import java.util.TreeSet;
 
 import org.apache.hivemind.Location;
+import org.apache.hivemind.SymbolExpander;
 import org.apache.hivemind.TranslatorManager;
 import org.apache.hivemind.internal.Module;
 import org.apache.hivemind.internal.RegistryInfrastructure;
@@ -63,6 +64,9 @@
         MockControl tmControl = newControl(TranslatorManager.class);
         TranslatorManager tm = (TranslatorManager) tmControl.getMock();
 
+        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
+        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();
+
         ElementModelImpl em = new ElementModelImpl("module");
 
         em.setElementName("fred");
@@ -97,8 +101,11 @@
         m.resolveType("hivemind.test.services.impl.StringHolderImpl");
         control.setReturnValue(StringHolderImpl.class);
 
-        m.expandSymbols("flintstone", null);
-        control.setReturnValue("flintstone");
+        m.getService(SymbolExpander.class);
+        control.setReturnValue(symbolExpander);
+
+        symbolExpander.expandSymbols("flintstone", null);
+        symbolExpanderControl.setReturnValue("flintstone");
         
         m.getService(TranslatorManager.class);
         control.setReturnValue(tm);
@@ -127,6 +134,9 @@
         MockControl registryControl = newControl(RegistryInfrastructure.class);
         RegistryInfrastructure registry = (RegistryInfrastructure) registryControl.getMock();
 
+        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
+        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();
+
         ElementModelImpl em = new ElementModelImpl("module");
 
         em.setElementName("fred");
@@ -161,8 +171,11 @@
         m.resolveType("hivemind.test.services.impl.StringHolderImpl");
         control.setReturnValue(StringHolderImpl.class);
 
-        m.expandSymbols("flintstone", null);
-        control.setReturnValue("flintstone");
+        m.getService(SymbolExpander.class);
+        control.setReturnValue(symbolExpander);
+
+        symbolExpander.expandSymbols("flintstone", null);
+        symbolExpanderControl.setReturnValue("flintstone");
 
         replayControls();
 
@@ -188,6 +201,9 @@
         MockControl tmControl = newControl(TranslatorManager.class);
         TranslatorManager tm = (TranslatorManager) tmControl.getMock();
 
+        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
+        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();
+
         ElementModelImpl em = new ElementModelImpl("module");
 
         AttributeModelImpl am = new AttributeModelImpl();
@@ -227,8 +243,11 @@
         m.resolveType("hivemind.test.services.impl.StringHolderImpl");
         control.setReturnValue(StringHolderImpl.class);
 
-        m.expandSymbols("wilma", null);
-        control.setReturnValue("wilma");
+        m.getService(SymbolExpander.class);
+        control.setReturnValue(symbolExpander);
+
+        symbolExpander.expandSymbols("wilma", null);
+        symbolExpanderControl.setReturnValue("wilma");
         
         m.getService(TranslatorManager.class);
         control.setReturnValue(tm);
@@ -287,6 +306,9 @@
         MockControl registryControl = newControl(RegistryInfrastructure.class);
         RegistryInfrastructure registry = (RegistryInfrastructure) registryControl.getMock();
 
+        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
+        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();
+
         em.setElementName("cartoon");
         em.setKeyAttribute("name");
 
@@ -328,12 +350,15 @@
 
         m.resolveType("StringHolderImpl");
         control.setReturnValue(StringHolderImpl.class);
+
+        m.getService(SymbolExpander.class);
+        control.setReturnValue(symbolExpander);
         
-        m.expandSymbols("${fred}", null);
-        control.setReturnValue("fred");
+        symbolExpander.expandSymbols("${fred}", null);
+        symbolExpanderControl.setReturnValue("fred");
 
-        m.expandSymbols("${flintstone}", null);
-        control.setReturnValue("flintstone");
+        symbolExpander.expandSymbols("${flintstone}", null);
+        symbolExpanderControl.setReturnValue("flintstone");
 
         MockControl tControl = newControl(Translator.class);
         Translator t = (Translator) tControl.getMock();
@@ -402,6 +427,9 @@
         MockControl registryControl = newControl(RegistryInfrastructure.class);
         RegistryInfrastructure registry = (RegistryInfrastructure) registryControl.getMock();
 
+        MockControl symbolExpanderControl = newControl(SymbolExpander.class);
+        SymbolExpander symbolExpander = (SymbolExpander) symbolExpanderControl.getMock();
+
         SchemaProcessorImpl p = new SchemaProcessorImpl(null, schema);
 
         Location location1 = newLocation();
@@ -440,15 +468,18 @@
         
         m1.resolveType("StringHolderImpl");
         control1.setReturnValue(StringHolderImpl.class);
+
+        m1.getService(SymbolExpander.class);
+        control1.setReturnValue(symbolExpander);
         
-        m1.expandSymbols("flintstone", location1);
-        control1.setReturnValue("flintstone");
+        symbolExpander.expandSymbols("flintstone", location1);
+        symbolExpanderControl.setReturnValue("flintstone");
         
         m1.getService(TranslatorManager.class);
         control1.setReturnValue(tm);
         
-        m1.expandSymbols("flintstone", location1);
-        control1.setReturnValue("flintstone");
+        symbolExpander.expandSymbols("flintstone", location1);
+        symbolExpanderControl.setReturnValue("flintstone");
 
         String flintstoneKeyModule1 = "m1.flintstone";
         t1.translate(m1, String.class, "flintstone", element1.getLocation());
@@ -459,12 +490,12 @@
 
         m2.resolveType("StringHolderImpl");
         control2.setReturnValue(StringHolderImpl.class);
+
+        symbolExpander.expandSymbols("flintstone", location2);
+        symbolExpanderControl.setReturnValue("flintstone");
         
-        m2.expandSymbols("flintstone", location2);
-        control2.setReturnValue("flintstone");
-        
-        m2.expandSymbols("flintstone", location2);
-        control2.setReturnValue("flintstone");
+        symbolExpander.expandSymbols("flintstone", location2);
+        symbolExpanderControl.setReturnValue("flintstone");
 
         tm.getTranslator("qualified-id");
         tmControl.setReturnValue(t1);

Copied: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestSymbolExpander.java
(from r472779, hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestSymbolExpander.java)
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestSymbolExpander.java?view=diff&rev=473805&p1=hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestSymbolExpander.java&r1=472779&p2=hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestSymbolExpander.java&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/test/org/apache/hivemind/impl/TestSymbolExpander.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestSymbolExpander.java
Sat Nov 11 14:01:04 2006
@@ -22,7 +22,7 @@
 import org.easymock.MockControl;
 
 /**
- * Tests for {@link org.apache.hivemind.impl.SymbolExpander}. 
+ * Tests for {@link org.apache.hivemind.impl.SymbolExpanderImpl}. 
  *
  * @author Howard Lewis Ship
  * @since 1.1
@@ -39,7 +39,7 @@
 
     private void attempt(String expected, String text)
     {
-        SymbolExpander e = new SymbolExpander(null, new SymbolSourceFixture());
+        SymbolExpanderImpl e = new SymbolExpanderImpl(null, new SymbolSourceFixture());
 
         String actual = e.expandSymbols(text, null);
 
@@ -95,14 +95,14 @@
         control.setReturnValue(null);
 
         eh.error(
-            LogFactory.getLog(SymbolExpander.class),
-            ImplMessages.noSuchSymbol("symbol"),
+            LogFactory.getLog(SymbolExpanderImpl.class),
+            XmlImplMessages.noSuchSymbol("symbol"),
             l,
             null);
 
         replayControls();
 
-        SymbolExpander e = new SymbolExpander(eh, source);
+        SymbolExpanderImpl e = new SymbolExpanderImpl(eh, source);
 
         String actual = e.expandSymbols("Unknown ${symbol}", l);
 

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestSymbolExpander.java
------------------------------------------------------------------------------
    cvs2svn:cvs-rev = 1.3

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestSymbolExpander.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/impl/TestSymbolExpander.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/servlet/TestHiveMindFilter.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/servlet/TestHiveMindFilter.java?view=diff&rev=473805&r1=473804&r2=473805
==============================================================================
--- hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/servlet/TestHiveMindFilter.java
(original)
+++ hivemind/branches/branch-2-0-annot/xml/src/test/org/apache/hivemind/servlet/TestHiveMindFilter.java
Sat Nov 11 14:01:04 2006
@@ -30,6 +30,7 @@
 import org.apache.hivemind.HiveMind;
 import org.apache.hivemind.Registry;
 import org.apache.hivemind.ShutdownCoordinator;
+import org.apache.hivemind.SymbolExpander;
 import org.apache.hivemind.events.RegistryShutdownListener;
 import org.apache.hivemind.service.ThreadCleanupListener;
 import org.apache.hivemind.service.ThreadEventNotifier;
@@ -127,8 +128,9 @@
         f.init(config);
 
         Registry r = f.getRegistry();
+        SymbolExpander symbolExpander = (SymbolExpander) r.getService(SymbolExpander.class);
 
-        assertEquals("was here", r.expandSymbols("${kilroy}", null));
+        assertEquals("was here", symbolExpander.expandSymbols("${kilroy}", null));
 
         verifyControls();
     }



Mime
View raw message