CVS update: JGroups/src/org/jgroups/stack Protocol.java

"Bela Ban" <[email protected]> Wed, 6 Oct 2010 09:47:03 +0000
Newsgroups gmane.comp.java.javagroups.cvs
Message-ID <[email protected]>
  User: belaban 
  Date: 10/10/06 09:47:03

  Modified:    src/org/jgroups/stack Protocol.java
  Log:
  first impl of programmatic API (https://jira.jboss.org/browse/JGRP-1245)
  
  Revision  Changes    Path
  1.81      +27 -2     JGroups/src/org/jgroups/stack/Protocol.java
  
  Index: Protocol.java
  ===================================================================
  RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/stack/Protocol.java,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- Protocol.java	30 Sep 2010 10:10:55 -0000	1.80
  +++ Protocol.java	6 Oct 2010 09:47:03 -0000	1.81
  @@ -38,7 +38,7 @@
    * constructor !</b>
    *
    * @author Bela Ban
  - * @version $Id: Protocol.java,v 1.80 2010/09/30 10:10:55 belaban Exp $
  + * @version $Id: Protocol.java,v 1.81 2010/10/06 09:47:03 belaban Exp $
    */
   @DeprecatedProperty(names={"down_thread","down_thread_prio","up_thread","up_thread_prio"})
   public abstract class Protocol {
  @@ -76,7 +76,6 @@
           log.setLevel(level);
       }
   
  -
       public String getLevel() {
           return log.getLevel();
       }
  @@ -120,6 +119,32 @@
           throw new UnsupportedOperationException("use a setter instead");
       }
   
  +    public Protocol setValues(Map<String,Object> values) {
  +        if(values == null)
  +            return this;
  +        for(Map.Entry<String,Object> entry: values.entrySet()) {
  +            String attrname=entry.getKey();
  +            Object value=entry.getValue();
  +            Field field=Util.getField(getClass(), attrname);
  +            if(field != null) {
  +                Configurator.setField(field, this, value);
  +            }
  +        }
  +        return this;
  +    }
  +
  +
  +    public Protocol setValue(String name, Object value) {
  +        if(name == null || value == null)
  +            return this;
  +        Field field=Util.getField(getClass(), name);
  +        if(field != null) {
  +            Configurator.setField(field, this, value);
  +        }
  +        return this;
  +    }
  +
  +
       /**
        * @return
        * @deprecated Use a getter to get the actual instance variable
  
  
  

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb