KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > copyobject > FallbackObjectCopierImpl


1 /*
2  * @(#)FallbackObjectCopierImpl.java 1.7 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.impl.copyobject ;
9
10 import com.sun.corba.se.spi.copyobject.ObjectCopier ;
11 import com.sun.corba.se.spi.copyobject.ReflectiveCopyException ;
12
13 /** Trys a first ObjectCopier. If the first throws a ReflectiveCopyException,
14  * falls back and tries a second ObjectCopier.
15  */

16 public class FallbackObjectCopierImpl implements ObjectCopier
17 {
18     private ObjectCopier first ;
19     private ObjectCopier second ;
20
21     public FallbackObjectCopierImpl( ObjectCopier first,
22     ObjectCopier second )
23     {
24     this.first = first ;
25     this.second = second ;
26     }
27
28     public Object JavaDoc copy( Object JavaDoc src ) throws ReflectiveCopyException
29     {
30     try {
31         return first.copy( src ) ;
32     } catch (ReflectiveCopyException rce ) {
33         // XXX log this fallback at a low level
34
return second.copy( src ) ;
35     }
36     }
37 }
38
Popular Tags