You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hivemind.apache.org by jc...@apache.org on 2005/05/04 06:00:52 UTC

cvs commit: jakarta-hivemind/framework/src/java/org/apache/hivemind Registry.java

jcarman     2005/05/03 21:00:52

  Modified:    framework/src/java/org/apache/hivemind/internal
                        RegistryInfrastructure.java
               .        status.xml
               framework/src/java/org/apache/hivemind/impl
                        RegistryInfrastructureImpl.java RegistryImpl.java
               framework/src/java/org/apache/hivemind Registry.java
  Added:       framework/src/test/org/apache/hivemind/impl
                        TestRegistryImpl.java Privates.properties
  Log:
  Add getModuleMessages() to Registry.
  PR: HIVEMIND-91
  
  Revision  Changes    Path
  1.15      +7 -0      jakarta-hivemind/framework/src/java/org/apache/hivemind/internal/RegistryInfrastructure.java
  
  Index: RegistryInfrastructure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/internal/RegistryInfrastructure.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- RegistryInfrastructure.java	29 Apr 2005 07:40:56 -0000	1.14
  +++ RegistryInfrastructure.java	4 May 2005 04:00:52 -0000	1.15
  @@ -238,4 +238,11 @@
        * @param serviceInterface
        */
       public List getServiceIds(Class serviceInterface);
  +    
  +    /**
  +     * Returns the module with the corresponding module id.
  +     * @param moduleId
  +     * @return the module with the corresponding module id
  +     */
  +    public Module getModule( String moduleId );
   }
  \ No newline at end of file
  
  
  
  1.132     +1 -0      jakarta-hivemind/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/status.xml,v
  retrieving revision 1.131
  retrieving revision 1.132
  diff -u -r1.131 -r1.132
  --- status.xml	4 May 2005 03:35:20 -0000	1.131
  +++ status.xml	4 May 2005 04:00:52 -0000	1.132
  @@ -31,6 +31,7 @@
     </todo>
     <changes>
       <release version="1.1-beta-2" date="unreleased">
  +      <action type="add" dev="JC" fixes-bug="HIVEMIND-91" >Add getModuleMessages() to Registry.</action>
         <action type="fix" dev="JC" fixes-bug="HIVEMIND-105" >ServiceImplementationFactoryParameters.getFirstParameter should cope better with zero parameters.</action>
         <action type="fix" dev="JC" fixes-bug="HIVEMIND-101" >OrdererMessages.exception uses wrong message key.</action>
         <action type="add" dev="JC" fixes-bug="HIVEMIND-112" >Add getServiceIds() Method to Registry Interface.</action>
  
  
  
  1.1                  jakarta-hivemind/framework/src/test/org/apache/hivemind/impl/TestRegistryImpl.java
  
  Index: TestRegistryImpl.java
  ===================================================================
  //Copyright 2004, 2005 The Apache Software Foundation
  //
  // Licensed 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.hivemind.impl;
  
  import org.apache.hivemind.Messages;
  import org.apache.hivemind.Registry;
  import org.apache.hivemind.test.HiveMindTestCase;
  
  /**
   * @author James Carman
   * @since 1.1
   */
  public class TestRegistryImpl extends HiveMindTestCase
  {
      public void testGetModuleMessages() throws Exception
      {
          final Registry reg = buildFrameworkRegistry( "Privates.xml" );
          final Messages msgs = reg.getModuleMessages( "hivemind.test.privates" );
          assertEquals( "Test Message", msgs.getMessage( "test.message" ) );
      }
  }
  
  
  
  1.1                  jakarta-hivemind/framework/src/test/org/apache/hivemind/impl/Privates.properties
  
  Index: Privates.properties
  ===================================================================
  # Copyright 2005 The Apache Software Foundation
  #
  # Licensed 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.
  test.message=Test Message
  
  
  1.15      +14 -0     jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java
  
  Index: RegistryInfrastructureImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryInfrastructureImpl.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- RegistryInfrastructureImpl.java	29 Apr 2005 07:40:54 -0000	1.14
  +++ RegistryInfrastructureImpl.java	4 May 2005 04:00:52 -0000	1.15
  @@ -564,6 +564,20 @@
           ServiceSerializationHelper.setServiceSerializationSupport(this);
       }
   
  +    public Module getModule( String moduleId )
  +    {
  +        for( Iterator i = _servicePoints.values().iterator(); i.hasNext(); )
  +        {
  +            final ServicePoint servicePoint = ( ServicePoint )i.next();
  +            
  +            if( servicePoint.getModule().getModuleId().equals( moduleId ) )
  +            {
  +                return servicePoint.getModule();
  +            }
  +        }
  +        return null;
  +    }
  +    
       /* (non-Javadoc)
        * @see org.apache.hivemind.internal.RegistryInfrastructure#getServiceIds(java.lang.Class)
        */
  
  
  
  1.26      +11 -0     jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryImpl.java
  
  Index: RegistryImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/RegistryImpl.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- RegistryImpl.java	29 Apr 2005 07:40:54 -0000	1.25
  +++ RegistryImpl.java	4 May 2005 04:00:52 -0000	1.26
  @@ -18,7 +18,9 @@
   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;
   import org.apache.hivemind.internal.RegistryInfrastructure;
   
   /**
  @@ -104,4 +106,13 @@
       {
           return _infrastructure.getServiceIds( serviceInterface );
       }
  +    
  +    /**
  +     * @since 1.1
  +     */
  +    public Messages getModuleMessages( String moduleId )
  +    {
  +        final Module module = _infrastructure.getModule( moduleId );
  +        return module == null ? null : module.getMessages();
  +    }
   }
  \ No newline at end of file
  
  
  
  1.13      +7 -0      jakarta-hivemind/framework/src/java/org/apache/hivemind/Registry.java
  
  Index: Registry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/Registry.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Registry.java	29 Apr 2005 07:40:53 -0000	1.12
  +++ Registry.java	4 May 2005 04:00:52 -0000	1.13
  @@ -151,4 +151,11 @@
        * @since 1.1
        */
       public List getServiceIds( Class serviceInterface );
  +    
  +    /**
  +     * Returns the Messages object for the specified module.
  +     * @param moduleId the module id
  +     * @return the Messages object for the specified module.
  +     */
  +    public Messages getModuleMessages( String moduleId );
   }
  \ No newline at end of file
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org