/** * Get the message endpoint factory * * @param mi the invocation * @return the message endpoint factory */ protected JBossMessageEndpointFactory getMessageEndpointFactory(Invocation mi) { if (endpointFactory == null) endpointFactory = (JBossMessageEndpointFactory) mi.getInvocationContext().getValue(MESSAGE_ENDPOINT_FACTORY); if (endpointFactory == null) throw new IllegalStateException("No message endpoint factory in " + mi.getInvocationContext().context); return endpointFactory; }
/** * Get our proxy's string value. * * @param mi the invocation * @return the string */ protected String getProxyString(Invocation mi) { if (cachedProxyString == null) cachedProxyString = mi.getInvocationContext().getCacheId().toString(); return cachedProxyString; }
/** * Get the object used in Object methods * * @param mi the invocation * @return the object */ protected Object getObject(Invocation mi) { Object cacheId = mi.getInvocationContext().getCacheId(); if (cacheId != null) return cacheId; else return mi.getInvocationContext().getInvoker(); }
/** * JBAS-6275: Validates that the server is AS5+ such that we can send the security context * over the invocation * @param invocation * @return */ private boolean validateASVersionCompatibility(Invocation invocation) { try { invocation.getInvocationContext().getValue(InvocationKey.SECURITY_DOMAIN); //So the field exists. We are in AS5+ } catch(NoSuchFieldError nsfe) { //Probably we are in 4.2.x return false; } return true; } }
/** * Whether we are in a clustered environment<p> * * NOTE: This should be future compatible under any * new design where a prior target chooser interceptor * picks a non HA target than that code being * inside a ha invoker. * * @param invocation the invocation * @return true when a clustered invoker */ public boolean isClustered(Invocation invocation) { // No clustering classes if (invokerProxyHA == null) return false; // Is the invoker a HA invoker? InvocationContext ctx = invocation.getInvocationContext(); Invoker invoker = ctx.getInvoker(); return invoker != null && invokerProxyHA.isAssignableFrom(invoker.getClass()); }
protected EJBHome getEJBHome(Invocation invocation) throws NamingException { // Look to the context for the home InvocationContext ctx = invocation.getInvocationContext(); EJBHome home = (EJBHome) ctx.getValue(InvocationKey.EJB_HOME); // If there is no home use the legacy lookup method if( home == null ) { String jndiName = (String) ctx.getValue(InvocationKey.JNDI_NAME); InitialContext iniCtx = new InitialContext(); home = (EJBHome) iniCtx.lookup(jndiName); } return home; } }
protected synchronized FamilyClusterInfo getFamilyClusterInfo(Invocation invocation) throws Exception { if (familyClusterInfo == null) { InvokerProxyHA proxy = (InvokerProxyHA)invocation.getInvocationContext().getInvoker(); familyClusterInfo = proxy.getFamilyClusterInfo(); } return familyClusterInfo; } }
/** * Invoke using invoker * * @param invocation the invocation * @return the result * @throws Exception for any error */ protected Object invokeInvoker(Invocation invocation) throws Exception { InvocationContext ctx = invocation.getInvocationContext(); Invoker invoker = ctx.getInvoker(); return invoker.invoke(invocation); }
InvokerProxyHA proxy = (InvokerProxyHA)invocation.getInvocationContext().getInvoker(); proxy.forbidTransactionFailover(tpc);
/** Handle methods locally on the client * * @param mi * @return the invocation response * @throws Throwable */ public Object invoke(Invocation mi) throws Throwable { Method m = mi.getMethod(); String methodName = m.getName(); InvokerProxyHA proxy = (InvokerProxyHA) mi.getInvocationContext().getInvoker(); // Implement local methods if( methodName.equals("toString") ) { return toString(proxy); } if( methodName.equals("equals") ) { Object[] args = mi.getArguments(); String thisString = toString(proxy); String argsString = args[0] == null ? "" : args[0].toString(); return new Boolean(thisString.equals(argsString)); } if( methodName.equals("hashCode") ) { return (Integer) mi.getObjectName(); } return getNext().invoke(mi); }
/** * Invoke using the invoker for remote invocations */ public Object invoke(Invocation invocation) throws Exception { // local interface if (isLocal(invocation)) // The payload as is is good return localInvoker.invoke(invocation); else // through the invoker return invocation.getInvocationContext().getInvoker().invoke(invocation); }
/** Handle methods locally on the client * * @param mi * @return * @throws Throwable */ public Object invoke(Invocation mi) throws Throwable { Method m = mi.getMethod(); String methodName = m.getName(); HttpInvokerProxy proxy = (HttpInvokerProxy) mi.getInvocationContext().getInvoker(); // Implement local methods if( methodName.equals("toString") ) { return toString(proxy); } if( methodName.equals("equals") ) { Object[] args = mi.getArguments(); String thisString = toString(proxy); String argsString = args[0] == null ? "" : args[0].toString(); return new Boolean(thisString.equals(argsString)); } if( methodName.equals("hashCode") ) { return (Integer) mi.getObjectName(); } return getNext().invoke(mi); }
if (invocation.getInvocationContext()!=null) copyContext = (InvocationContext)createMarshalledValueForCallByValue(invocation.getInvocationContext()).get();
throws Throwable InvocationContext ctx = invocation.getInvocationContext(); Method m = invocation.getMethod();
/** * Return loaded Security Context to be passed on the invocation * @param invocation invocation instance * @return */ private SecurityContext createSecurityContext(Invocation invocation) throws Exception { //There may be principal set on the invocation Principal p = invocation.getPrincipal(); Object cred = invocation.getCredential(); //Create a new SecurityContext String domain = (String) invocation.getInvocationContext().getValue(InvocationKey.SECURITY_DOMAIN); if(domain == null) domain = "CLIENT_PROXY"; return SecurityActions.createSecurityContext(p,cred, domain); }
InvocationContext ctx = invocation.getInvocationContext(); retry = true; int retryCount = 0;
ListCacheKey key = (ListCacheKey) invocation.getInvocationContext().getCacheId(); from = key.getIndex() + 1; to = Math.min(from + aheadResult.length, list.size());
throws Throwable InvocationContext ctx = invocation.getInvocationContext();
throws Throwable InvocationContext ctx = invocation.getInvocationContext();
throws Throwable InvocationContext ctx = invocation.getInvocationContext();