KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > spice > jndikit > test > TestDataReferenceable


1 /*
2  * Copyright (C) The Spice Group. All rights reserved.
3  *
4  * This software is published under the terms of the Spice
5  * Software License version 1.1, a copy of which has been included
6  * with this distribution in the LICENSE.txt file.
7  */

8 package org.codehaus.spice.jndikit.test;
9
10 import java.io.IOException JavaDoc;
11 import javax.naming.Reference JavaDoc;
12 import javax.naming.Referenceable JavaDoc;
13 import javax.naming.StringRefAddr JavaDoc;
14
15
16 /**
17  * Implementation of {@link Referenceable}, for testing purposes.
18  *
19  * @author <a HREF="mailto:tma@netspace.net.au">Tim Anderson</a>
20  * @version $Revision: 1.1 $ $Date: 2005/06/30 04:22:16 $
21  * @see TestObjectFactory
22  */

23 public class TestDataReferenceable extends TestData implements Referenceable JavaDoc
24 {
25
26
27     /**
28      * Default ctor for serialization.
29      */

30     public TestDataReferenceable()
31     {
32     }
33
34     /**
35      * Construct a new <code>TestDataReferenceable</code>.
36      *
37      * @param value test data
38      */

39     public TestDataReferenceable( String JavaDoc value )
40     {
41         super( value );
42     }
43
44     /**
45      * Retrieves the Reference of this object.
46      *
47      * @return the non-null Reference of this object.
48      */

49     public Reference JavaDoc getReference()
50     {
51         return new Reference JavaDoc( getClass().getName(),
52                               new StringRefAddr JavaDoc( "value", getValue() ),
53                               TestObjectFactory.class.getName(),
54                               null );
55     }
56
57     private void writeObject( java.io.ObjectOutputStream JavaDoc out )
58         throws IOException JavaDoc
59     {
60         throw new IOException JavaDoc( "Cannot serialize. Use getReference() instead" );
61     }
62
63     private void readObject( java.io.ObjectInputStream JavaDoc in )
64         throws IOException JavaDoc
65     {
66         throw new IOException JavaDoc( "Cannot serialize. Use getReference() instead" );
67     }
68
69 }
70
Popular Tags