public Object invoke(InvocationRequest invocation) throws Throwable { return invocation.getParameter(); }
private boolean isServerSideOneway(InvocationRequest invocationRequest) { return invocationRequest.getParameter() instanceof OnewayInvocation; }
/** * called by the remoting server to handle the invocation from client. * * @param invocation * @return * @throws Throwable */ public Object invoke(InvocationRequest invocation) throws Throwable { // Print out the invocation request System.out.println("Invocation request is: " + invocation.getParameter()); // Return invocation parameter return invocation.getParameter(); }
/** * called to handle a specific invocation * * @param invocation * @return * @throws Throwable */ public Object invoke(InvocationRequest invocation) throws Throwable { // Print out the invocation request System.out.println("Invocation request is: " + invocation.getParameter()); return null; }
/** * called by the remoting server to handle the invocation from client. * * @param invocation * @return * @throws Throwable */ public Object invoke(InvocationRequest invocation) throws Throwable { // Print out the invocation request System.out.println("Invocation request is: " + invocation.getParameter()); // Just going to return static string as this is just simple example code. return RESPONSE_VALUE; }
/** * called to handle a specific invocation * * @param invocation * @return * @throws Throwable */ public Object invoke(InvocationRequest invocation) throws Throwable { // Print out the invocation request System.out.println("Invocation request is: " + invocation.getParameter()); // Return the size of the file already streamed to the server (and written to disk). return new Long(streamSize); }
/** * called to handle a specific invocation * * @param invocation * @return * @throws Throwable */ public Object invoke(InvocationRequest invocation) throws Throwable { // Print out the invocation request System.out.println("Invocation request is: " + invocation.getParameter()); System.out.println("Returning response of: " + RESPONSE_VALUE); // Just going to return static string as this is just simple example code. return RESPONSE_VALUE; }
/** * called to handle a specific invocation * * @param invocation * @return * @throws Throwable */ public Object invoke(InvocationRequest invocation) throws Throwable { // Print out the invocation request System.out.println("Invocation request is: " + invocation.getParameter()); System.out.println("Returning response of: " + RESPONSE_VALUE); // Just going to return static string as this is just simple example code. return RESPONSE_VALUE; }
private StreamHandler getStreamHandler(InvocationRequest invocation) throws Exception { InternalInvocation inv = (InternalInvocation)invocation.getParameter(); String locator = (String)inv.getParameters()[0]; return new StreamHandler(locator); }
/** * This is the method that is called when a new message comes in from a client. * * @param invocation the incoming client invocation, encapsulates the message object * @return the response object we send back to the client. * @throws Throwable */ public Object invoke(InvocationRequest invocation) throws Throwable { // Print out the invocation request String msg = invocation.getParameter().toString(); println("RECEIVED A CLIENT MESSAGE: " + msg); String response = "Server received your message that said [" + msg + "]"; if(msg.indexOf("Welcome") > -1) { response = "Received your welcome message. Thank you!"; } println("Returning the following message back to the client: " + response); return response; }
/** * This is the method that is called when a new message comes in from a client. * * @param invocation the incoming client invocation, encapsulates the message object * @return the response object we send back to the client. * @throws Throwable */ public Object invoke(InvocationRequest invocation) throws Throwable { // Print out the invocation request String msg = invocation.getParameter().toString(); println("RECEIVED A CLIENT MESSAGE: " + msg); String response = "Server received your message that said [" + msg + "]"; if(msg.indexOf("Welcome") > -1) { response = "Received your welcome message. Thank you!"; } println("Returning the following message back to the client: " + response); return response; }
public Object invoke(InvocationRequest invocation) throws Throwable { String command = (String) invocation.getParameter(); System.out.println("command: " + command); Callback cb = new Callback("callback " + ++counter); // Register as listener and pass callback id. HashMap returnPayload = new HashMap(); returnPayload.put(ServerInvokerCallbackHandler.CALLBACK_LISTENER, this); returnPayload.put(ServerInvokerCallbackHandler.CALLBACK_ID, new GUID()); cb.setReturnPayload(returnPayload); if (REMOTING_ACKNOWLDEGEMENTS.equals(command)) { returnPayload.put(ServerInvokerCallbackHandler.REMOTING_ACKNOWLEDGES_PUSH_CALLBACKS, "true"); } callbackHandler.handleCallback(cb); return null; }
public Object invoke(InvocationRequest invocation) throws Throwable { if (!(invocation.getParameter() instanceof RemoteInvocation)) throw new Exception("invalid request format: expecting NameBasedInvocation"); RemoteInvocation request = (RemoteInvocation) invocation.getParameter(); String methodName = request.getMethodName(); Object[] args = request.getParameters(); if (methodName.equals("getBackChat")) return getBackChat(args); if (methodName.equals("getChatInfo")) return getChatInfo(args); if (methodName.equals("leave")) { leave(args); return null; } if (methodName.equals("send")) { send(args); return null; } log.error("unrecognized method name: " + methodName); throw new Exception("unrecognized method name: " + methodName); }
public Object invoke(InvocationRequest invocation) throws Throwable { if (!(invocation.getParameter() instanceof RemoteInvocation)) throw new Exception("invalid request format: expecting RemoteInvocation"); RemoteInvocation request = (RemoteInvocation) invocation.getParameter(); String methodName = request.getMethodName(); Object[] args = request.getParameters(); if (methodName.equals("createChat")) return createChat(args); else if (methodName.equals("join")) { join(args); return null; } else if (methodName.equals("leave")) { leave(args); return null; } else if (methodName.equals("list")) return list(args); else throw new Exception("unrecognized method name: " + methodName); }
public void sendObject(ObjectOutputStream oos, Object dataObject) throws IOException { if(dataObject instanceof InvocationRequest) { InvocationRequest ir = (InvocationRequest)dataObject; Object obj = ir.getParameter(); if(obj instanceof Serializable) { try { ir.setParameter(EncryptionUtil.sealObject((Serializable)obj)); } catch (Exception e) { e.printStackTrace(); } } } super.sendObject(oos, dataObject); } }
/** * Handle a DeploymentManager distribute invocation for copyContent == true * * @see DeploymentManager#distribute(String, java.net.URL, boolean) * @param request - the remoting invocation */ public InvocationResponse handleStream(InputStream contentIS, InvocationRequest request) throws Throwable { // Get the deployment repository for this deploymentID SerializableDeploymentID deploymentTarget = (SerializableDeploymentID) request.getParameter(); String[] names = delegate.distribute(deploymentTarget, contentIS); deploymentTarget.setRepositoryNames(names); return new InvocationResponse(names[0]); }
protected InvocationRequest marshallInvocation(InvocationRequest localInvocation) throws IOException, ClassNotFoundException { Object param = localInvocation.getParameter(); Object newParam = SerializationStreamFactory.getManagerInstance(getSerializationType()).createMarshalledValueForClone(param).get(); localInvocation.setParameter(newParam); return localInvocation; }
public Object removeDecoration(Object obj) throws IOException { if(obj instanceof InvocationRequest) { InvocationRequest remoteInv = (InvocationRequest) obj; Object param = remoteInv.getParameter(); if(param instanceof MarshalledInvocation) { MarshalledInvocation mi = (MarshalledInvocation) param; Object txCxt = mi.getTransactionPropagationContext(); if(txCxt != null) { TransactionPropagationContextImporter tpcImporter = TransactionPropagationContextUtil.getTPCImporter(); mi.setTransaction(tpcImporter.importTransactionPropagationContext(txCxt)); } } } return obj; }
public Object read(InputStream inputStream, Map metadata, int version) throws IOException, ClassNotFoundException { Object ret = super.read(inputStream, metadata, version); if(ret instanceof InvocationRequest) { InvocationRequest remoteInv = (InvocationRequest) ret; Object param = remoteInv.getParameter(); if(param instanceof MarshalledInvocation) { MarshalledInvocation mi = (MarshalledInvocation) param; Object txCxt = mi.getTransactionPropagationContext(); if(txCxt != null) { TransactionPropagationContextImporter tpcImporter = TransactionPropagationContextUtil.getTPCImporter(); mi.setTransaction(tpcImporter.importTransactionPropagationContext(txCxt)); } } } return ret; }
public Object invoke(InvocationRequest invocation) throws Throwable { // Create a security context for the invocation establishSecurityContext(invocation); org.jboss.aop.joinpoint.Invocation inv =(org.jboss.aop.joinpoint.Invocation)invocation.getParameter(); SecurityContainer.setInvocation(inv); InvocationResponse value = (InvocationResponse) super.invoke(invocation); if( value.getResponse() instanceof ManagementView ) { // Replace the ManagementView with its proxy value.setResponse(mgtViewProxy); } if( value.getResponse() instanceof DeploymentManager ) { // Replace the DeploymentManager with its proxy value.setResponse(deployMgrProxy); } return value; }