1 9 package org.jboss.remoting.transport.local; 10 11 import org.jboss.remoting.AbstractInvoker; 12 import org.jboss.remoting.ConnectionFailedException; 13 import org.jboss.remoting.InvocationRequest; 14 import org.jboss.remoting.InvokerLocator; 15 import org.jboss.remoting.InvokerRegistry; 16 import org.jboss.remoting.ServerInvoker; 17 import org.jboss.remoting.marshal.Marshaller; 18 import org.jboss.remoting.marshal.UnMarshaller; 19 import org.jboss.remoting.transport.ClientInvoker; 20 21 31 public class LocalClientInvoker extends AbstractInvoker implements ClientInvoker 32 { 33 private ServerInvoker serverInvoker; 34 35 public LocalClientInvoker(InvokerLocator locator) 36 { 37 super(locator); 38 } 39 40 47 public Object invoke(InvocationRequest invocation) throws Throwable 48 { 49 if(log.isTraceEnabled()) 50 { 51 log.trace("Using local client invoker for invocation."); 52 } 53 54 Object ret = null; 55 if(serverInvoker != null) 56 { 57 ret = serverInvoker.invoke(invocation); 58 } 59 else 60 { 61 throw new ConnectionFailedException("Error invoking on server because " + 62 "no local server to call upon."); 63 } 64 65 return ret; 66 } 67 68 76 public boolean isConnected() 77 { 78 return serverInvoker != null; 79 } 80 81 86 public void connect() throws ConnectionFailedException 87 { 88 } 90 91 96 public void disconnect() 97 { 98 103 InvokerRegistry.destroyClientInvoker(getLocator()); 104 serverInvoker = null; 105 } 106 107 public void setMarshaller(Marshaller marshaller) 108 { 109 } 111 112 public Marshaller getMarshaller() 113 { 114 return null; 115 } 116 117 public void setUnMarshaller(UnMarshaller unmarshaller) 118 { 119 } 121 122 public UnMarshaller getUnMarshaller() 123 { 124 return null; 125 } 126 127 133 public void setServerInvoker(ServerInvoker svrInvoker) 134 { 135 this.serverInvoker = svrInvoker; 136 } 137 } 138 | Popular Tags |