protected void checkFailoverNeed (Invocation mi) throws GenericClusteringException { Object data = mi.getValue ("DO_FAIL_DURING_NEXT_CALL"); if (data != null && data instanceof java.lang.Boolean && data.equals (java.lang.Boolean.TRUE)) { // we now determine if we have already failed // Object alreadyDone = mi.getValue ("FAILOVER_COUNTER"); if (alreadyDone != null && alreadyDone instanceof java.lang.Integer && ((java.lang.Integer)alreadyDone).intValue () == 0) { // we do fail // this.log.debug ("WE FAILOVER IN SERVER INTERCEPTOR (explicit failover asked by client interceptor)!"); throw new GenericClusteringException (GenericClusteringException.COMPLETED_NO, "Test failover from server interceptor", false); } } }
public Object invoke(final Object proxy, final Method m, Object[] args) throws Throwable { // Normalize args to always be an array // Isn't this a bug in the proxy call?? if (args == null) args = EMPTY_ARGS; // Create the invocation object Invocation invocation = new Invocation(); // Contextual information for the interceptors invocation.setInvocationContext(context); invocation.setId(context.getCacheId()); invocation.setObjectName(context.getObjectName()); invocation.setMethod(m); invocation.setArguments(args); invocation.setValue(InvocationKey.INVOKER_PROXY_BINDING, context.getInvokerProxyBinding(), PayloadKey.AS_IS); // send the invocation down the client interceptor chain Object obj = next.invoke(invocation); return obj; }
/** * Get a value from the stores. */ public Object getValue(Object key) { // find where it is Object rtn = getPayloadValue(key); if (rtn != null) return rtn; rtn = getAsIsValue(key); if (rtn != null) return rtn; rtn = getTransientValue(key); return rtn; }
public Invocation( Object id, Method m, Object[] args, Transaction tx, Principal identity, Object credential ) { setId(id); setMethod(m); setArguments(args); setTransaction(tx); setPrincipal(identity); setCredential(credential); }
public MarshalledInvocation(Invocation invocation) { this.payload = invocation.payload; this.as_is_payload = invocation.as_is_payload; this.method = invocation.getMethod(); this.objectName = invocation.getObjectName(); this.args = invocation.getArguments(); this.invocationType = invocation.getType(); this.transient_payload = invocation.transient_payload; this.invocationContext = invocation.invocationContext; }
.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT); if (msgContext == null) final Invocation wsInvocation = (Invocation) jbossInvocation.getValue(Invocation.class.getName()); final HandlerCallback callback = (HandlerCallback) jbossInvocation.getValue(HandlerCallback.class.getName()); jbossInvocation.setArguments(reqParams); final Object resObj = this.getNext().invoke(jbossInvocation);
private org.jboss.invocation.Invocation getMBeanInvocation(Invocation inv) { // EJB2.1 endpoints will only get an JAXRPC context MessageContext msgContext = inv.getInvocationContext().getAttachment(MessageContext.class); if (msgContext == null) throw new IllegalStateException("Cannot obtain MessageContext"); SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider(); SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter(); Principal principal = securityAdaptor.getPrincipal(); Object credential = securityAdaptor.getCredential(); Method method = inv.getJavaMethod(); Object[] args = inv.getArgs(); org.jboss.invocation.Invocation jbInv = new org.jboss.invocation.Invocation(null, method, args, null, principal, credential); HandlerCallback callback = inv.getInvocationContext().getAttachment(HandlerCallback.class); if (callback == null) throw new IllegalStateException("Cannot obtain HandlerCallback"); jbInv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext); jbInv.setValue(InvocationKey.SOAP_MESSAGE, ((SOAPMessageContext)msgContext).getMessage()); jbInv.setType(InvocationType.SERVICE_ENDPOINT); jbInv.setValue(HandlerCallback.class.getName(), callback, PayloadKey.TRANSIENT); jbInv.setValue(Invocation.class.getName(), inv, PayloadKey.TRANSIENT); return jbInv; } }
Invocation invocation = new Invocation( null, GET_EJB_OBJECT, sa.getCredential()); invocation.setObjectName(new Integer(objectName)); invocation.setValue(InvocationKey.INVOKER_PROXY_BINDING, invokerProxyBinding, PayloadKey.AS_IS); invocation.setType(InvocationType.HOME); invocation.setInvocationContext(ctx);
public Object internalInvokeHome(Invocation mi) throws Exception { Method method = mi.getMethod(); if (method != null && method.getName().equals("remove")) { // Map to EJBHome.remove(Object) to EJBObject.remove() InvocationType type = mi.getType(); if (type == InvocationType.HOME) mi.setType(InvocationType.REMOTE); else if (type == InvocationType.LOCALHOME) mi.setType(InvocationType.LOCAL); mi.setMethod(EJBOBJECT_REMOVE); // Handle or primary key? Object arg = mi.getArguments()[0]; if (arg instanceof Handle) { if (arg == null) throw new RemoteException("Null handle"); Handle handle = (Handle) arg; EJBObject ejbObject = handle.getEJBObject(); mi.setId(ejbObject.getPrimaryKey()); } else mi.setId(arg); mi.setArguments(new Object[0]); return getInterceptor().invoke(mi); } // Invoke through interceptors return getInterceptor().invokeHome(mi); }
mi.setValue(InvocationKey.JACC_CONTEXT_ID, contextID); contextID = SecurityActions.setContextID(contextID); if (mi.getType() != InvocationType.SERVICE_ENDPOINT) EJBArgsPolicyContextHandler.setArgs(mi.getArguments()); SOAPMessage msg = (SOAPMessage)mi.getValue(InvocationKey.SOAP_MESSAGE); SOAPMsgPolicyContextHandler.setMessage(msg); type = mi.getType(); log.trace("METHOD REMOTE INVOKE " + mi.getObjectName() + "||" + mi.getMethod().getName() + "||"); m = mi.getMethod(); log.trace("METHOD HOME INVOKE " + mi.getObjectName() + "||" + mi.getMethod().getName() + "||" + mi.getArguments().toString()); m = mi.getMethod(); InvocationType calltype = mi.getType(); boolean isLocal = calltype == InvocationType.LOCAL || calltype == InvocationType.LOCALHOME; if (mi.getType() == InvocationType.SERVICE_ENDPOINT)
throws Throwable InvocationContext ctx = invocation.getInvocationContext(); Method m = invocation.getMethod(); Object[] args = invocation.getArguments(); String argsString = args[0] != null ? args[0].toString() : ""; String thisString = ctx.getValue(InvocationKey.JNDI_NAME).toString() + "Home"; ((Handle) invocation.getArguments()[0]).getEJBObject(); Object id = invocation.getArguments()[0]; invocation.setId(id); invocation.setType(InvocationType.REMOTE); invocation.setMethod(REMOVE_OBJECT); invocation.setArguments(EMPTY_ARGS); return getNext().invoke(invocation); invocation.setType(InvocationType.HOME);
throws Throwable InvocationContext ctx = invocation.getInvocationContext(); Method m = invocation.getMethod(); Object[] args = invocation.getArguments(); String argsString = args[0] != null ? args[0].toString() : ""; String thisString = toString(ctx); Object[] args = invocation.getArguments(); String argsString = args[0].toString(); String thisString = toString(ctx); invocation.setType(InvocationType.REMOTE);
public Object invoke(Invocation mi) throws Exception Method miMethod = mi.getMethod(); Method m = (Method) beanMapping.get(miMethod); if( m == null ) return mi.performCall(EntityContainer.this, m, new Object[]{ mi }); EnterpriseContext ctx = (EnterpriseContext) mi.getEnterpriseContext(); Object instance = ctx.getInstance(); return mi.performCall(instance, m, mi.getArguments());
public Object invoke (Invocation mi) throws Throwable { Object data = mi.getValue ("DO_FAIL_DURING_NEXT_CALL"); if (data != null && data instanceof java.lang.Boolean && data.equals (java.lang.Boolean.TRUE)) { // Clear the instruction mi.setValue ("DO_FAIL_DURING_NEXT_CALL", Boolean.FALSE, PayloadKey.AS_IS); if (proxyFamilyName == null) { proxyFamilyName = getProxyFamilyName(mi); } // Clear the targets to simulate exhausting them all FamilyClusterInfo info = ClusteringTargetsRepository.getFamilyClusterInfo(proxyFamilyName); for (Object target: info.getTargets()) info.removeDeadTarget(target); throw new ServiceUnavailableException("Service unavailable", new Exception("Test")); } return getNext().invoke(mi); }
InvocationType type = mi.getType(); boolean isLocal = (type == InvocationType.LOCAL || type == InvocationType.LOCALHOME); if (isLocal) ctx.setPrincipal(mi.getPrincipal()); mi.setEnterpriseContext(ctx); Object msgContext = mi.getValue(InvocationKey.SOAP_MESSAGE_CONTEXT); if (ejbTimeout.equals(mi.getMethod())) mi.setEnterpriseContext(null); throw e; mi.setEnterpriseContext(null); throw e; mi.setEnterpriseContext(null); throw e; if (mi.getEnterpriseContext() != null) pool.free(((EnterpriseContext) mi.getEnterpriseContext()));
/** * The generic store of variables. * * <p> * The generic getter and setter is really all that one needs to talk * to this object. We introduce typed getters and setters for * convenience and code readability in the codeba */ public void setValue(Object key, Object value) { setValue(key, value, PayloadKey.PAYLOAD); }
ObjectName objectName = (ObjectName) invocation.getValue("JMX_OBJECT_NAME"); if (objectName != null) Method method = invocation.getMethod(); Object[] args = invocation.getArguments(); Principal principal = invocation.getPrincipal(); Object credential = invocation.getCredential(); Object value = null; SecurityContext sc = SecurityActions.createSecurityContext(SecurityConstants.DEFAULT_APPLICATION_POLICY);
/** * Delegates to the persistence manager postCreateEntityMethod. */ public void postCreateHome(Invocation mi) throws Exception { // The persistence manager takes care of the post create step getPersistenceManager().postCreateEntity(mi.getMethod(),mi.getArguments(), (EntityEnterpriseContext) mi.getEnterpriseContext()); }
ObjectName mbean = (ObjectName) Registry.lookup(invocation.getObjectName()); long clientViewId = ((Long)invocation.getValue("CLUSTER_VIEW_ID")).longValue(); HATarget target = targetMap.get(invocation.getObjectName()); if (target == null)
public Object invoke(Invocation mi) throws Exception { final boolean remoteInvocation = mi instanceof MarshalledInvocation; if(remoteInvocation) { ((MarshalledInvocation)mi).setMethodMap(methodMap); } final Object result; if(invokeTargetMethod) { String signature[] = (String[])signatureMap.get(mi.getMethod()); result = server.invoke(targetName, mi.getMethod().getName(), mi.getArguments(), signature); } else { result = server.invoke(targetName, "invoke", new Object[]{mi}, Invocation.INVOKE_SIGNATURE); } return result; }