| 1 | // Copyright 2004-2007 Jean-Francois Poilpret |
| 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 net.sourceforge.hiveremoting.caucho; |
| 16 | |
| 17 | import java.io.InputStream; |
| 18 | import java.io.OutputStream; |
| 19 | |
| 20 | import org.apache.hivemind.internal.ServicePoint; |
| 21 | |
| 22 | import com.caucho.burlap.io.BurlapInput; |
| 23 | import com.caucho.burlap.io.BurlapOutput; |
| 24 | import com.caucho.burlap.server.BurlapSkeleton; |
| 25 | import com.caucho.hessian.io.SerializerFactory; |
| 26 | |
| 27 | /** |
| 28 | * @author Jean-Francois Poilpret |
| 29 | */ |
| 30 | public class BurlapRemoteServiceInvoker extends AbstractRemoteServiceInvoker |
| 31 | { |
| 32 | public BurlapRemoteServiceInvoker( PublishServiceContribution contrib, |
| 33 | SerializerFactory factory) |
| 34 | { |
| 35 | super(contrib, factory); |
| 36 | ServicePoint service = contrib.getServiceId(); |
| 37 | Class intf = service.getServiceInterface(); |
| 38 | _skeleton = new BurlapSkeleton(service.getService(intf), intf); |
| 39 | } |
| 40 | |
| 41 | //CSOFF: IllegalThrowsCheck |
| 42 | @Override protected void invoke(InputStream is, OutputStream os) |
| 43 | throws Throwable |
| 44 | { |
| 45 | // Create in/out streams from HTTP |
| 46 | BurlapInput in = new BurlapInput(is); |
| 47 | BurlapOutput out = new BurlapOutput(os); |
| 48 | // Set special Serializer Factory |
| 49 | in.setSerializerFactory(_factory); |
| 50 | out.setSerializerFactory(_factory); |
| 51 | // Proceed with invocation |
| 52 | _skeleton.invoke(in, out); |
| 53 | } |
| 54 | //CSON: IllegalThrowsCheck |
| 55 | |
| 56 | protected final BurlapSkeleton _skeleton; |
| 57 | } |