Clover coverage report - Code Coverage for hivemind release 1.1-alpha-1
Coverage timestamp: Tue Jan 18 2005 07:55:08 EST
file stats: LOC: 69   Methods: 6
NCLOC: 34   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ServiceToken.java - 100% 100% 100%
coverage
 1   
 // Copyright 2005 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.hivemind.internal.ser;
 16   
 
 17   
 import java.io.Externalizable;
 18   
 import java.io.IOException;
 19   
 import java.io.ObjectInput;
 20   
 import java.io.ObjectOutput;
 21   
 
 22   
 import org.apache.hivemind.util.Defense;
 23   
 
 24   
 /**
 25   
  * Instance used to replace actual service (proxies) during serialization. Note that this represents
 26   
  * a back-door into HiveMind's {@link org.apache.hivemind.internal.RegistryInfrastructure}, which
 27   
  * is less than ideal, and should not be used by end-user code!
 28   
  * 
 29   
  * @author Howard M. Lewis Ship
 30   
  * @since 1.1
 31   
  */
 32   
 public class ServiceToken implements Externalizable
 33   
 {
 34   
     private String _serviceId;
 35   
 
 36   
     // Needed for Externalizable.
 37   
 
 38  1
     public ServiceToken()
 39   
     {
 40   
     }
 41   
 
 42  1
     public ServiceToken(String serviceId)
 43   
     {
 44  1
         Defense.notNull(serviceId, "serviceId");
 45   
 
 46  1
         _serviceId = serviceId;
 47   
     }
 48   
 
 49  1
     public String getServiceId()
 50   
     {
 51  1
         return _serviceId;
 52   
     }
 53   
 
 54  1
     public void writeExternal(ObjectOutput out) throws IOException
 55   
     {
 56  1
         out.writeUTF(_serviceId);
 57   
     }
 58   
 
 59  1
     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
 60   
     {
 61  1
         _serviceId = in.readUTF();
 62   
     }
 63   
 
 64  1
     Object readResolve()
 65   
     {
 66  1
         return ServiceSerializationHelper.getServiceSerializationSupport()
 67   
                 .getServiceFromToken(this);
 68   
     }
 69   
 }