01: /*
02: * Copyright 2002-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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;
20: import java.io.OutputStream;
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: * Create a new HessianSkeletonInvoker for the given skeleton.
48: * @param skeleton the HessianSkeleton to wrap
49: * @param serializerFactory the Hessian SerializerFactory to use, if any
50: */
51: public HessianSkeletonInvoker(HessianSkeleton skeleton,
52: SerializerFactory serializerFactory) {
53: Assert.notNull(skeleton, "HessianSkeleton must not be null");
54: this .skeleton = skeleton;
55: this .serializerFactory = serializerFactory;
56: }
57:
58: /**
59: * Invoke the given skeleton based on the given input/output streams.
60: * @param inputStream the stream containing the Hessian input
61: * @param outputStream the stream to receive the Hessian output
62: * @throws Throwable if the skeleton invocation failed
63: */
64: public abstract void invoke(InputStream inputStream,
65: OutputStream outputStream) throws Throwable;
66:
67: }
|