KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > remoting > caucho > HessianSkeletonInvoker


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.remoting.caucho;
18
19 import java.io.InputStream JavaDoc;
20 import java.io.OutputStream JavaDoc;
21
22 import com.caucho.hessian.server.HessianSkeleton;
23 import com.caucho.hessian.io.SerializerFactory;
24
25 import org.springframework.util.Assert;
26
27 /**
28  * Internal invoker strategy for a Hessian skeleton.
29  * Allows for common handling of Hessian protocol version 1 and 2.
30  *
31  * @author Juergen Hoeller
32  * @since 2.0
33  */

34 abstract class HessianSkeletonInvoker {
35
36     /**
37      * Wrapped HessianSkeleton, available to subclasses.
38      */

39     protected final HessianSkeleton skeleton;
40
41     /**
42      * Hessian SerializerFactory (if any), available to subclasses.
43      */

44     protected final SerializerFactory serializerFactory;
45
46
47     /**
48      * Create a new HessianSkeletonInvoker for the given skeleton.
49      * @param skeleton the HessianSkeleton to wrap
50      * @param serializerFactory the Hessian SerializerFactory to use, if any
51      */

52     public HessianSkeletonInvoker(HessianSkeleton skeleton, SerializerFactory serializerFactory) {
53         Assert.notNull(skeleton, "HessianSkeleton must not be null");
54         this.skeleton = skeleton;
55         this.serializerFactory = serializerFactory;
56     }
57
58
59     /**
60      * Invoke the given skeleton based on the given input/output streams.
61      * @param inputStream the stream containing the Hessian input
62      * @param outputStream the stream to receive the Hessian output
63      * @throws Throwable if the skeleton invocation failed
64      */

65     public abstract void invoke(InputStream JavaDoc inputStream, OutputStream JavaDoc outputStream) throws Throwable JavaDoc;
66
67 }
68
Popular Tags