You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hivemind.apache.org by hl...@apache.org on 2004/06/09 16:57:16 UTC

cvs commit: jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl ImplStrings.properties ImplMessages.java RemoteExceptionCoordinatorImpl.java EJBProxyFactory.java AbstractEJBProxy.java NameLookupImpl.java DefaultImplementationBuilderImpl.java EJBProxyParameters.java

hlship      2004/06/09 07:57:16

  Modified:    library/src/java/org/apache/hivemind/lib/impl
                        RemoteExceptionCoordinatorImpl.java
                        EJBProxyFactory.java AbstractEJBProxy.java
                        NameLookupImpl.java
                        DefaultImplementationBuilderImpl.java
                        EJBProxyParameters.java
  Added:       library/src/java/org/apache/hivemind/lib/impl
                        ImplStrings.properties ImplMessages.java
  Log:
  Add ImplMessages class to encapsulate messages about lib.impl package.
  
  Revision  Changes    Path
  1.2       +2 -5      jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/RemoteExceptionCoordinatorImpl.java
  
  Index: RemoteExceptionCoordinatorImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/RemoteExceptionCoordinatorImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RemoteExceptionCoordinatorImpl.java	26 Feb 2004 23:08:02 -0000	1.1
  +++ RemoteExceptionCoordinatorImpl.java	9 Jun 2004 14:57:15 -0000	1.2
  @@ -17,17 +17,15 @@
   import java.util.ArrayList;
   import java.util.List;
   
  +import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.lib.RemoteExceptionCoordinator;
   import org.apache.hivemind.lib.RemoteExceptionEvent;
   import org.apache.hivemind.lib.RemoteExceptionListener;
  -import org.apache.hivemind.ApplicationRuntimeException;
  -import org.apache.hivemind.HiveMind;
   
   /**
    * Core implementation of {@link org.apache.hivemind.lib.RemoteExceptionCoordinator}.
    *
    * @author Howard Lewis Ship
  - * @version $Id$
    */
   
   public class RemoteExceptionCoordinatorImpl implements RemoteExceptionCoordinator
  @@ -38,8 +36,7 @@
       private void checkLocked(String methodName)
       {
           if (_locked)
  -            throw new ApplicationRuntimeException(
  -                HiveMind.format("RemoteExceptionCoordinator.method-while-locked", methodName));
  +            throw new ApplicationRuntimeException(ImplMessages.coordinatorLocked(methodName));
       }
   
       public synchronized void addRemoteExceptionListener(RemoteExceptionListener listener)
  
  
  
  1.4       +1 -8      jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/EJBProxyFactory.java
  
  Index: EJBProxyFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/EJBProxyFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EJBProxyFactory.java	18 May 2004 15:34:01 -0000	1.3
  +++ EJBProxyFactory.java	9 Jun 2004 14:57:15 -0000	1.4
  @@ -45,7 +45,6 @@
    * 
    *
    * @author Howard Lewis Ship
  - * @version $Id$
    */
   public class EJBProxyFactory extends BaseLocatable implements ServiceImplementationFactory
   {
  @@ -235,13 +234,7 @@
       {
           ClassFabUtils.addToStringMethod(
               classFab,
  -            "<EJBProxy for "
  -                + serviceId
  -                + "("
  -                + serviceInterface.getName()
  -                + ") at "
  -                + jndiName
  -                + ">");
  +            ImplMessages.ejbProxyDescription(serviceId, serviceInterface, jndiName));
       }
   
       private void addConstructor(ClassFab classFab)
  
  
  
  1.2       +0 -1      jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/AbstractEJBProxy.java
  
  Index: AbstractEJBProxy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/AbstractEJBProxy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractEJBProxy.java	26 Feb 2004 23:08:02 -0000	1.1
  +++ AbstractEJBProxy.java	9 Jun 2004 14:57:15 -0000	1.2
  @@ -24,7 +24,6 @@
    * for a dynamic proxy.
    *
    * @author Howard Lewis Ship
  - * @version $Id$
    */
   public abstract class AbstractEJBProxy
   {
  
  
  
  1.4       +3 -6      jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/NameLookupImpl.java
  
  Index: NameLookupImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/NameLookupImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NameLookupImpl.java	13 May 2004 11:04:49 -0000	1.3
  +++ NameLookupImpl.java	9 Jun 2004 14:57:15 -0000	1.4
  @@ -32,7 +32,6 @@
    * service interface.
    *
    * @author Howard Lewis Ship
  - * @version $Id$
    */
   public class NameLookupImpl implements NameLookup, RemoteExceptionListener
   {
  @@ -63,18 +62,16 @@
                       _coordinator.fireRemoteExceptionDidOccur(this, ex);
                   else
                       throw new ApplicationRuntimeException(
  -                        HiveMind.format("NameLookup.unable-to-lookup", name, context),
  +                        ImplMessages.unableToLookup(name, context),
                           ex);
                   continue;
               }
   
               if (raw == null)
  -                throw new ApplicationRuntimeException(
  -                    HiveMind.format("NameLookup.no-object", name, expected));
  +                throw new ApplicationRuntimeException(ImplMessages.noObject(name, expected));
   
               if (!expected.isAssignableFrom(raw.getClass()))
  -                throw new ApplicationRuntimeException(
  -                    HiveMind.format("NameLookup.wrong-type", name, raw, expected));
  +                throw new ApplicationRuntimeException(ImplMessages.wrongType(name, raw, expected));
   
               return raw;
           }
  
  
  
  1.2       +4 -8      jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/DefaultImplementationBuilderImpl.java
  
  Index: DefaultImplementationBuilderImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/DefaultImplementationBuilderImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultImplementationBuilderImpl.java	6 Jun 2004 02:14:30 -0000	1.1
  +++ DefaultImplementationBuilderImpl.java	9 Jun 2004 14:57:15 -0000	1.2
  @@ -65,10 +65,7 @@
           catch (Exception ex)
           {
               throw new ApplicationRuntimeException(
  -                "Unable to create default implementation of interface "
  -                    + interfaceType.getName()
  -                    + ":"
  -                    + ex.getMessage(),
  +                ImplMessages.unableToCreateDefaultImplementation(interfaceType, ex),
                   ex);
           }
       }
  @@ -76,8 +73,7 @@
       private Class createClass(Class interfaceType, Module module)
       {
           if (!interfaceType.isInterface())
  -            throw new ApplicationRuntimeException(
  -                "Class " + interfaceType.getName() + " is not an interface.");
  +            throw new ApplicationRuntimeException(ImplMessages.notAnInterface(interfaceType));
   
           String name = ClassFabUtils.generateClassName("DefaultImpl");
   
  @@ -101,7 +97,7 @@
           if (!toString)
               ClassFabUtils.addToStringMethod(
                   cf,
  -                "<Default implementation of interface " + interfaceType.getName() + ">");
  +                ImplMessages.defaultImplementationDescription(interfaceType));
   
           return cf.createClass();
       }
  @@ -141,7 +137,7 @@
               m.getExceptionTypes(),
               body.toString());
       }
  -    
  +
       public void setClassFactory(ClassFactory factory)
       {
           _classFactory = factory;
  
  
  
  1.2       +0 -1      jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/EJBProxyParameters.java
  
  Index: EJBProxyParameters.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/EJBProxyParameters.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EJBProxyParameters.java	26 Feb 2004 23:08:02 -0000	1.1
  +++ EJBProxyParameters.java	9 Jun 2004 14:57:15 -0000	1.2
  @@ -20,7 +20,6 @@
    * Parameters for the {@link org.apache.hivemind.service.impl.EJBProxyFactory}.
    *
    * @author Howard Lewis Ship
  - * @version $Id$
    */
   public class EJBProxyParameters
   {
  
  
  
  1.1                  jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/ImplStrings.properties
  
  Index: ImplStrings.properties
  ===================================================================
  #
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in liance 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.
  
  unable-to-create-default-implementation=Unable to create default implementation of interface {0}: {1}
  
  not-an-interface=Class {0} is not an interface.
  
  default-implementation-description=<Default implementation of interface {0}>
  
  ejb-proxy-description=<EJBProxy for {0}({1}) at {2}>
  
  unable-to-lookup=Unable to lookup ''{0}'' in JNDI context {1}.
  no-object=Lookup of ''{0}'' resulted in null (expected instance of {1}).
  wrong-type=JNDI object ''{0}'' ({1}) is not assignable to {2}.
  
  coordinator-locked=RemoteExceptionCoordinator method {0} was invoked during a notification.
  
  
  
  1.1                  jakarta-hivemind/library/src/java/org/apache/hivemind/lib/impl/ImplMessages.java
  
  Index: ImplMessages.java
  ===================================================================
  //  Copyright 2004 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.lib.impl;
  
  import java.text.MessageFormat;
  import java.util.MissingResourceException;
  
  import javax.naming.Context;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.hivemind.impl.MessageFormatter;
  
  /**
   * Messages for the lib.impl package.
   *
   * @author Howard Lewis Ship
   */
  final class ImplMessages
  {
      private static final Log LOG = LogFactory.getLog(ImplMessages.class);
  
      private static final MessageFormatter _formatter =
          new MessageFormatter(LOG, ImplMessages.class, "ImplStrings");
  
      public static String unableToCreateDefaultImplementation(Class interfaceType, Throwable cause)
      {
          return _formatter.format(
              "unable-to-create-default-implementation",
              interfaceType.getName(),
              cause.getMessage());
      }
  
      public static String notAnInterface(Class interfaceType)
      {
          return _formatter.format("not-an-interface", interfaceType.getName());
      }
  
      public static String defaultImplementationDescription(Class interfaceType)
      {
          return _formatter.format("default-implementation-description", interfaceType.getName());
      }
  
      public static String ejbProxyDescription(
          String serviceId,
          Class serviceInterface,
          String jndiName)
      {
          return _formatter.format(
              "ejb-proxy-description",
              serviceId,
              serviceInterface.getName(),
              jndiName);
      }
  
      public static String unableToLookup(String name, Context context)
      {
          return _formatter.format("unable-to-lookup", name, context);
      }
  
      public static String noObject(String name, Class expectedType)
      {
          return _formatter.format("no-object", name, expectedType);
      }
  
      public static String wrongType(String name, Object object, Class expectedType)
      {
          return _formatter.format("wrong-type", name, object, expectedType);
      }
  
      public static String coordinatorLocked(String methodName)
      {
          return _formatter.format("coordinator-locked", methodName);
      }
  }
  
  

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