Coverage report

  %line %branch
org.apache.jcs.auxiliary.lateral.LateralCacheAttributes
26% 
94% 

 1  
 package org.apache.jcs.auxiliary.lateral;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.io.Serializable;
 23  
 
 24  
 import org.apache.jcs.auxiliary.AbstractAuxiliaryCacheAttributes;
 25  
 import org.apache.jcs.auxiliary.AuxiliaryCacheAttributes;
 26  
 import org.apache.jcs.auxiliary.lateral.behavior.ILateralCacheAttributes;
 27  
 
 28  
 /**
 29  
  * This class stores attributes for all of the available lateral cache
 30  
  * auxiliaries.
 31  
  *
 32  
  */
 33  34
 public class LateralCacheAttributes
 34  
     extends AbstractAuxiliaryCacheAttributes
 35  
     implements Serializable, ILateralCacheAttributes
 36  
 {
 37  
 
 38  
     private static final long serialVersionUID = -3408449508837393660L;
 39  
 
 40  
     private static final boolean DEFAULT_RECEIVE = true;
 41  
 
 42  34
     String transmissionTypeName = "UDP";
 43  
 
 44  34
     int transmissionType = UDP;
 45  
 
 46  
     String httpServers;
 47  
 
 48  
     // used to identify the service that this manager will be
 49  
     // operating on
 50  34
     String httpServer = "";
 51  
 
 52  34
     String httpReceiveServlet = "";
 53  
 
 54  34
     String httpDeleteServlet = "";
 55  
 
 56  34
     String udpMulticastAddr = "228.5.6.7";
 57  
 
 58  34
     int udpMulticastPort = 6789;
 59  
 
 60  34
     int httpListenerPort = 8080;
 61  
 
 62  
 
 63  
     // JAVAGROUPS -------------------------
 64  34
     private String jgChannelProperties = null;
 65  
 
 66  
     // GENERAL ------------------------------
 67  
     // disables gets from laterals
 68  34
     boolean putOnlyMode = true;
 69  
 
 70  
     // do we receive and broadcast or only broadcast
 71  
     // this is useful when you don't want to get any notifications
 72  34
     private boolean receive = DEFAULT_RECEIVE;
 73  
 
 74  
     /**
 75  
      * Sets the httpServer attribute of the LateralCacheAttributes object
 76  
      *
 77  
      * @param val
 78  
      *            The new httpServer value
 79  
      */
 80  
     public void setHttpServer( String val )
 81  
     {
 82  0
         httpServer = val;
 83  0
     }
 84  
 
 85  
     /**
 86  
      * Gets the httpServer attribute of the LateralCacheAttributes object
 87  
      *
 88  
      * @return The httpServer value
 89  
      */
 90  
     public String getHttpServer()
 91  
     {
 92  0
         return httpServer;
 93  
     }
 94  
 
 95  
 
 96  
 
 97  
     /**
 98  
      * Sets the httpServers attribute of the LateralCacheAttributes object
 99  
      *
 100  
      * @param val
 101  
      *            The new httpServers value
 102  
      */
 103  
     public void setHttpServers( String val )
 104  
     {
 105  0
         httpServers = val;
 106  0
     }
 107  
 
 108  
     /**
 109  
      * Gets the httpSrvers attribute of the LateralCacheAttributes object
 110  
      *
 111  
      * @return The httpServers value
 112  
      */
 113  
     public String getHttpServers()
 114  
     {
 115  0
         return httpServers;
 116  
     }
 117  
 
 118  
 
 119  
 
 120  
     /**
 121  
      * Sets the httpListenerPort attribute of the ILateralCacheAttributes object
 122  
      *
 123  
      * @param val
 124  
      *            The new tcpListenerPort value
 125  
      */
 126  
     public void setHttpListenerPort( int val )
 127  
     {
 128  0
         this.httpListenerPort = val;
 129  0
     }
 130  
 
 131  
     /**
 132  
      * Gets the httpListenerPort attribute of the ILateralCacheAttributes object
 133  
      *
 134  
      * @return The httpListenerPort value
 135  
      */
 136  
     public int getHttpListenerPort()
 137  
     {
 138  0
         return this.httpListenerPort;
 139  
     }
 140  
 
 141  
     /**
 142  
      * Sets the udpMulticastAddr attribute of the LateralCacheAttributes object
 143  
      *
 144  
      * @param val
 145  
      *            The new udpMulticastAddr value
 146  
      */
 147  
     public void setUdpMulticastAddr( String val )
 148  
     {
 149  0
         udpMulticastAddr = val;
 150  0
     }
 151  
 
 152  
     /**
 153  
      * Gets the udpMulticastAddr attribute of the LateralCacheAttributes object
 154  
      *
 155  
      * @return The udpMulticastAddr value
 156  
      */
 157  
     public String getUdpMulticastAddr()
 158  
     {
 159  0
         return udpMulticastAddr;
 160  
     }
 161  
 
 162  
     /**
 163  
      * Sets the udpMulticastPort attribute of the LateralCacheAttributes object
 164  
      *
 165  
      * @param val
 166  
      *            The new udpMulticastPort value
 167  
      */
 168  
     public void setUdpMulticastPort( int val )
 169  
     {
 170  0
         udpMulticastPort = val;
 171  0
     }
 172  
 
 173  
     /**
 174  
      * Gets the udpMulticastPort attribute of the LateralCacheAttributes object
 175  
      *
 176  
      * @return The udpMulticastPort value
 177  
      */
 178  
     public int getUdpMulticastPort()
 179  
     {
 180  0
         return udpMulticastPort;
 181  
     }
 182  
 
 183  
     /**
 184  
      * Sets the transmissionType attribute of the LateralCacheAttributes object
 185  
      *
 186  
      * @param val
 187  
      *            The new transmissionType value
 188  
      */
 189  
     public void setTransmissionType( int val )
 190  
     {
 191  0
         this.transmissionType = val;
 192  0
         if ( val == UDP )
 193  
         {
 194  0
             transmissionTypeName = "UDP";
 195  0
         }
 196  0
         else if ( val == HTTP )
 197  
         {
 198  0
             transmissionTypeName = "HTTP";
 199  0
         }
 200  0
         else if ( val == TCP )
 201  
         {
 202  0
             transmissionTypeName = "TCP";
 203  0
         }
 204  0
         else if ( val == XMLRPC )
 205  
         {
 206  0
             transmissionTypeName = "XMLRPC";
 207  0
         }
 208  0
         else if ( val == JAVAGROUPS )
 209  
         {
 210  0
             transmissionTypeName = "JAVAGROUPS";
 211  
         }
 212  0
     }
 213  
 
 214  
     /**
 215  
      * Gets the transmissionType attribute of the LateralCacheAttributes object
 216  
      *
 217  
      * @return The transmissionType value
 218  
      */
 219  
     public int getTransmissionType()
 220  
     {
 221  0
         return this.transmissionType;
 222  
     }
 223  
 
 224  
     /**
 225  
      * Sets the transmissionTypeName attribute of the LateralCacheAttributes
 226  
      * object
 227  
      *
 228  
      * @param val
 229  
      *            The new transmissionTypeName value
 230  
      */
 231  
     public void setTransmissionTypeName( String val )
 232  
     {
 233  20
         this.transmissionTypeName = val;
 234  20
         if ( val.equals( "UDP" ) )
 235  
         {
 236  0
             transmissionType = UDP;
 237  0
         }
 238  20
         else if ( val.equals( "HTTP" ) )
 239  
         {
 240  0
             transmissionType = HTTP;
 241  0
         }
 242  20
         else if ( val.equals( "TCP" ) )
 243  
         {
 244  20
             transmissionType = TCP;
 245  20
         }
 246  0
         else if ( val.equals( "XMLRPC" ) )
 247  
         {
 248  0
             transmissionType = XMLRPC;
 249  0
         }
 250  0
         else if ( val.equals( "JAVAGROUPS" ) )
 251  
         {
 252  0
             transmissionType = JAVAGROUPS;
 253  
         }
 254  
 
 255  20
     }
 256  
 
 257  
     /**
 258  
      * Gets the transmissionTypeName attribute of the LateralCacheAttributes
 259  
      * object
 260  
      *
 261  
      * @return The transmissionTypeName value
 262  
      */
 263  
     public String getTransmissionTypeName()
 264  
     {
 265  0
         return this.transmissionTypeName;
 266  
     }
 267  
 
 268  
     /**
 269  
      * Sets the outgoingOnlyMode attribute of the ILateralCacheAttributes. When
 270  
      * this is true the lateral cache will only issue put and remove order and
 271  
      * will not try to retrieve elements from other lateral caches.
 272  
      *
 273  
      * @param val
 274  
      *            The new transmissionTypeName value
 275  
      */
 276  
     public void setPutOnlyMode( boolean val )
 277  
     {
 278  0
         this.putOnlyMode = val;
 279  0
     }
 280  
 
 281  
     /**
 282  
      * @return The outgoingOnlyMode value. Stops gets from going remote.
 283  
      */
 284  
     public boolean getPutOnlyMode()
 285  
     {
 286  0
         return putOnlyMode;
 287  
     }
 288  
 
 289  
     public String getJGChannelProperties()
 290  
     {
 291  0
         return jgChannelProperties;
 292  
     }
 293  
 
 294  
     public void setJGChannelProperties( String channelProperties )
 295  
     {
 296  0
         this.jgChannelProperties = channelProperties;
 297  0
     }
 298  
 
 299  
     /**
 300  
      * Returns a clone of the attributes.
 301  
      *
 302  
      * @return Self
 303  
      */
 304  
     public AuxiliaryCacheAttributes copy()
 305  
     {
 306  
         try
 307  
         {
 308  0
             return (AuxiliaryCacheAttributes) this.clone();
 309  
         }
 310  0
         catch ( Exception e )
 311  
         {
 312  
             //noop
 313  
         }
 314  0
         return this;
 315  
     }
 316  
 
 317  
 
 318  
 
 319  
     /**
 320  
      * @param receive
 321  
      *            The receive to set.
 322  
      */
 323  
     public void setReceive( boolean receive )
 324  
     {
 325  0
         this.receive = receive;
 326  0
     }
 327  
 
 328  
     /**
 329  
      * @return Returns the receive.
 330  
      */
 331  
     public boolean isReceive()
 332  
     {
 333  52
         return receive;
 334  
     }
 335  
 
 336  
 
 337  
 
 338  
     /*
 339  
      * (non-Javadoc)
 340  
      *
 341  
      * @see java.lang.Object#toString()
 342  
      */
 343  
     public String toString()
 344  
     {
 345  0
         StringBuffer buf = new StringBuffer();
 346  
         //buf.append( "cacheName=" + cacheName + "\n" );
 347  
         //buf.append( "putOnlyMode=" + putOnlyMode + "\n" );
 348  
         //buf.append( "transmissionTypeName=" + transmissionTypeName + "\n" );
 349  
         //buf.append( "transmissionType=" + transmissionType + "\n" );
 350  
         //buf.append( "tcpServer=" + tcpServer + "\n" );
 351  0
         buf.append( transmissionTypeName + httpServer + udpMulticastAddr + String.valueOf( udpMulticastPort ) );
 352  0
         return buf.toString();
 353  
     }
 354  
 
 355  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.