/** * In JRMP the 2 method( per and post init have the same consequences ... * @param JInitInfo the JInit Information */ public void preInit(final JInitInfo info) { try { info.addServerRequestInterceptor(new ServerInterceptor()); } catch (Exception e) { throw new IllegalStateException("Cannot built interceptor: " + e.getMessage()); } }
/** * In JRMP the 2 method( per and post init have the same consequences ... * @param JInitInfo the JInit Information */ public void preInit(final JInitInfo info) { try { info.addClientRequestInterceptor(new ClientSecurityInterceptor()); info.addServerRequestInterceptor(new ServerSecurityInterceptor()); } catch (Exception e) { e.printStackTrace(); } }
public void receive(final byte code, final ObjectInput in) throws IOException, ClassNotFoundException { JServerRequestInfo info = new JRMPServerRequestInfoImpl(); int len = in.readShort(); for (int i = 0; i < len; i++) { info.addReplyServiceContext((JServiceContext) in.readObject()); } for (JServerRequestInterceptor si : sis) { si.receiveRequest(info); } }
/** * send client context with the request. The sendingRequest method of the * JPortableInterceptors is called prior to marshalling arguments and * contexts * @param JClientRequestInfo jri the jrmp client info * @exception IOException if an exception occur with the ObjectOutput */ public void sendRequest(final JClientRequestInfo jri) throws IOException { // Gets Current object (always existing in JOnAS Server) SecurityCurrent current = SecurityCurrent.getCurrent(); if (current != null) { // Get the Security Context SecurityContext ctx = current.getSecurityContext(); SecurityServiceContext ssc = new SecurityServiceContext(SEC_CTX_ID, ctx); jri.addRequestServiceContext(ssc); } }
/** * Receive request * @param JServerRequestInfo the jrmp server request information * @exception IOException if an exception occurs with the ObjectOutput */ public void receiveRequest(final JServerRequestInfo jri) throws IOException { // Gets SecurityCurrent object (always existing in JOnAS Server) SecurityCurrent current = SecurityCurrent.getCurrent(); if (current != null) { SecurityServiceContext sctx = (SecurityServiceContext) jri.getRequestServiceContext(SEC_CTX_ID); if (sctx != null) { // put into the the Current object (true for client side context current.setSecurityContext(sctx.getSecurityContext()); } } }
public void receiveException(JClientRequestInfo jri) throws IOException { if (TraceTm.jta.isDebugEnabled()) { TraceTm.jta.debug("JTAClientTransactionInterceptor.receiveException"); } if (current == null) { current = Current.getCurrent(); } if (current != null) { JTATransactionServiceContext jtasc = (JTATransactionServiceContext) jri.getReplyServiceContext( TX_CTX_ID); if (jtasc != null) { // put into the the Current object (true for client side context current.setPropagationContext( jtasc.getTransactionContext(), true); } } }
public void send(final byte code, final ObjectOutput out) throws IOException { JClientRequestInfo info = new JRMPClientRequestInfoImpl(); for (JClientRequestInterceptor ci : cis) { ci.sendRequest(info); } Collection<JServiceContext> c = info.getAllRequestServiceContext(); out.writeShort(c.size()); for (JServiceContext jServiceContext : c) { out.writeObject(jServiceContext); } }
public void send(final byte code, final ObjectOutput out) throws IOException { JServerRequestInfo info = new JRMPServerRequestInfoImpl(); for (JServerRequestInterceptor si : sis) { switch (code) { case METHOD_RESULT: si.sendReply(info); break; case METHOD_ERROR: case SYSTEM_ERROR: si.sendException(info); break; } } Collection<JServiceContext> c = info.getAllReplyServiceContext(); out.writeShort(c.size()); for (JServiceContext jServiceContext : c) { out.writeObject(jServiceContext); } }
private void getHAContext(final JClientRequestInfo jri) { // Get the HAContext from the received info HAServiceContext receivedCtx = (HAServiceContext) jri.getRequestServiceContext(HAServiceContext.HA_CTX_ID); if(receivedCtx == null) { return; } logger.debug("receivedCtx: " + receivedCtx); // Get the current Thread/HAContext association class HACurrent current = HACurrent.getHACurrent(); Stack<RequestId> requests = ((HAContext) receivedCtx.getContextData()).getRequests(); current.setRequests(requests); } }
/** * Initializes the HA client and server side interceptors */ public void preInit(final JInitInfo info) { try { info.addClientRequestInterceptor(new HAClientInterceptor()); info.addServerRequestInterceptor(new HAServerInterceptor()); } catch (Exception e) { logger.error("Error while adding the request interceptors", e); } }
public void sendOther(JServerRequestInfo jri) throws IOException { if (TraceTm.jta.isDebugEnabled()) { TraceTm.jta.debug("JTAServerTransactionInterceptor.sendOther"); } if (current == null) { current = Current.getCurrent(); } if (current != null) { // get the Transaction Context (null if there is no transaction) TransactionContext txCtx = current.getPropagationContext(false); if (txCtx != null) { JTATransactionServiceContext jtasc = new JTATransactionServiceContext(); jtasc.setContext(txCtx, true); jri.addReplyServiceContext(jtasc); current.setPropagationContext(null, false); } } // log.trace("<-- sent other"); } }
/** * In JRMP the 2 methods (pre and post init) have the same consequences... * @param JInitInfo the JInit Information */ public void preInit(final JInitInfo info) { try { info.addServerRequestInterceptor(new ProtocolInterceptor()); } catch (Exception e) { TraceCarol.error( "ProtocolInterceptorInitializer.pre_init(JInitInfo info) could'nt instantiate iiop Interceptor", e); } }
public void receive(final byte code, final ObjectInput in) throws IOException, ClassNotFoundException { JClientRequestInfo info = new JRMPClientRequestInfoImpl(); int len = in.readShort(); for (int i = 0; i < len; i++) { info.addRequestServiceContext((JServiceContext) in.readObject()); } for (JClientRequestInterceptor ci : cis) { switch (code) { case METHOD_RESULT: ci.receiveReply(info); break; case METHOD_ERROR: case SYSTEM_ERROR: ci.receiveException(info); break; } } }
/** * Analyzes the HAContext received and constructs the required * context on the HA current context (the thread associated class) on * the server side. */ public void receiveRequest(final JServerRequestInfo jri) throws IOException { // Get the HAContext from the received info HAServiceContext receivedCtx = (HAServiceContext) jri.getRequestServiceContext(HAServiceContext.HA_CTX_ID); if(receivedCtx == null) { return; } logger.debug(receivedCtx.toString()); // Get the current Thread/HAContext association class HACurrent current = HACurrent.getHACurrent(); HAContext haContext = (HAContext) receivedCtx.getContextData(); Stack<RequestId> requests = haContext.getRequests(); current.setRequests(requests); boolean onFailover = haContext.isOnFailover(); current.setOnFailover(onFailover); logger.debug("HACtx asocciated to Thread"); }
public void receiveOther(JClientRequestInfo jri) throws IOException { if (TraceTm.jta.isDebugEnabled()) { TraceTm.jta.debug("JTAClientTransactionInterceptor.receiveOther"); } if (current == null) { current = Current.getCurrent(); } if (current != null) { JTATransactionServiceContext jtasc = (JTATransactionServiceContext) jri.getReplyServiceContext( TX_CTX_ID); if (jtasc != null) { // put into the the Current object (true for client side context current.setPropagationContext( jtasc.getTransactionContext(), true); } } } }
/** * In JRMP the 2 method( per and post init have the same * consequences ... * @param info JInitInfo the JInit Information */ public void preInit(JInitInfo info) { if (TraceTm.jta.isDebugEnabled()) { TraceTm.jta.debug("JTAInterceptorInitializer.pre_init"); } try { info.addClientRequestInterceptor( new JTAClientTransactionInterceptor()); info.addServerRequestInterceptor( new JTAServerTransactionInterceptor()); } catch (Exception e) { e.printStackTrace(); } }
public void sendException(JServerRequestInfo jri) throws IOException { if (TraceTm.jta.isDebugEnabled()) { TraceTm.jta.debug("JTAServerTransactionInterceptor.sendException"); } if (current == null) { current = Current.getCurrent(); } if (current != null) { // get the Transaction Context (null if there is no transaction) TransactionContext txCtx = current.getPropagationContext(false); if (txCtx != null) { JTATransactionServiceContext jtasc = new JTATransactionServiceContext(); jtasc.setContext(txCtx, true); jri.addReplyServiceContext(jtasc); current.setPropagationContext(null, false); } } }
/** * Receive reply interception * @param jri JClientRequestInfo the jrmp client info * @exception IOException if an exception occur with the ObjectOutput */ public void receiveReply(JClientRequestInfo jri) throws IOException { if (TraceTm.jta.isDebugEnabled()) { TraceTm.jta.debug("JTAClientTransactionInterceptor.receiveReply"); } if (current == null) { current = Current.getCurrent(); } if (current != null) { JTATransactionServiceContext jtasc = (JTATransactionServiceContext) jri.getReplyServiceContext( TX_CTX_ID); if (jtasc != null) { // put into the the Current object (true for client side context current.setPropagationContext( jtasc.getTransactionContext(), true); } } }
/** * send reply with context * @param jri JServerRequestInfo the jrmp server request information * @exception IOException if an exception occur with the ObjectOutput */ public void sendReply(JServerRequestInfo jri) throws IOException { if (TraceTm.jta.isDebugEnabled()) { TraceTm.jta.debug("JTAServerTransactionInterceptor.send_reply"); } if (current == null) { current = Current.getCurrent(); } if (current != null) { // get the Transaction Context (null if there is no transaction) TransactionContext txCtx = current.getPropagationContext(false); if (txCtx != null) { JTATransactionServiceContext jtasc = new JTATransactionServiceContext(); jtasc.setContext(txCtx, true); jri.addReplyServiceContext(jtasc); current.setPropagationContext(null, false); } } }
private void putHAContext(final JServerRequestInfo jri) { // Get the current HA Context info associated to the thread HACurrent current = HACurrent.getHACurrent(); HAContext haContext = new HAContext(); Stack<RequestId> requests = current.getRequests(); haContext.setRequests(requests); logger.debug("newHACtx: " + haContext); // Create the new HAContext to propagate between interceptors HAServiceContext haServiceContext = new HAServiceContext(haContext); // Finally, include the new HAContext created to be propagated through // the interceptor jri.addReplyServiceContext(haServiceContext); } }