/** * 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); }
public Object invoke (Invocation mi) throws Throwable { Object failover = System.getProperty ("JBossCluster-DoFail"); boolean doFail = false; if (failover != null && failover instanceof java.lang.String) { String strFailover = (java.lang.String)failover; if (strFailover.equalsIgnoreCase ("true")) { doFail = true; } else if (strFailover.equalsIgnoreCase ("once")) { doFail = true; System.setProperty ("JBossCluster-DoFail", "false"); } } if (doFail) { mi.setValue ("DO_FAIL_DURING_NEXT_CALL", Boolean.TRUE, PayloadKey.AS_IS); System.out.println("SYSTEM : We fail during next call!!!"); } else mi.setValue ("DO_FAIL_DURING_NEXT_CALL", Boolean.FALSE, PayloadKey.AS_IS); return getNext().invoke(mi); }
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; } }
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; } }
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; } }
jbossInvocation.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext); jbossInvocation.setValue(InvocationKey.SOAP_MESSAGE, ((SOAPMessageContext) msgContext).getMessage()); jbossInvocation.setType(InvocationType.SERVICE_ENDPOINT); jbossInvocation.setValue(HandlerCallback.class.getName(), callback, PayloadKey.TRANSIENT); jbossInvocation.setValue(Invocation.class.getName(), wsInvocation, PayloadKey.TRANSIENT);
jbossInvocation.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext); jbossInvocation.setValue(InvocationKey.SOAP_MESSAGE, ((SOAPMessageContext) msgContext).getMessage()); jbossInvocation.setType(InvocationType.SERVICE_ENDPOINT); jbossInvocation.setValue(HandlerCallback.class.getName(), callback, PayloadKey.TRANSIENT); jbossInvocation.setValue(Invocation.class.getName(), wsInvocation, PayloadKey.TRANSIENT);
jbossInvocation.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext); jbossInvocation.setValue(InvocationKey.SOAP_MESSAGE, ((SOAPMessageContext) msgContext).getMessage()); jbossInvocation.setType(InvocationType.SERVICE_ENDPOINT); jbossInvocation.setValue(HandlerCallback.class.getName(), callback, PayloadKey.TRANSIENT); jbossInvocation.setValue(Invocation.class.getName(), wsInvocation, PayloadKey.TRANSIENT);
/** * Invoke using the invoker for remote invocations */ public Object invoke(Invocation invocation) throws Throwable { // Retrieve any relevent object name for this invocation ObjectName objectName = getObjectNameFromArguments(invocation); if (objectName != null) invocation.setValue("JMX_OBJECT_NAME", objectName, PayloadKey.AS_IS); try { return getNext().invoke(invocation); } catch (InvokerAdaptorException e) { throw e.getWrapped(); } }
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); }
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(); SecurityContext sc = SecurityContextAssociation.getSecurityContext(); Principal principal = securityAdaptor.getPrincipal(); Object credential = securityAdaptor.getCredential(); if (principal == null && sc != null) principal = sc.getUtil().getUserPrincipal(); if (credential == null && sc != null) credential = sc.getUtil().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; }
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(); SecurityContext sc = SecurityContextAssociation.getSecurityContext(); Principal principal = securityAdaptor.getPrincipal(); Object credential = securityAdaptor.getCredential(); if (principal == null && sc != null) principal = sc.getUtil().getUserPrincipal(); if (credential == null && sc != null) credential = sc.getUtil().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; }
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);
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(); SecurityContext sc = SecurityContextAssociation.getSecurityContext(); Principal principal = securityAdaptor.getPrincipal(); Object credential = securityAdaptor.getCredential(); if (principal == null && sc != null) principal = sc.getUtil().getUserPrincipal(); if (credential == null && sc != null) credential = sc.getUtil().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; }
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(); SecurityContext sc = SecurityContextAssociation.getSecurityContext(); Principal principal = securityAdaptor.getPrincipal(); Object credential = securityAdaptor.getCredential(); if (principal == null && sc != null) principal = sc.getUtil().getUserPrincipal(); if (credential == null && sc != null) credential = sc.getUtil().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.setValue(InvocationKey.INVOKER_PROXY_BINDING, invokerProxyBinding, PayloadKey.AS_IS);
invocation.setValue("FAILOVER_COUNTER", new Integer(failoverCounter), PayloadKey.AS_IS); try
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; }
mi.setValue(InvocationKey.JACC_CONTEXT_ID, contextID); contextID = SecurityActions.setContextID(contextID);
inv.setValue(InvocationKey.INVOKER_PROXY_BINDING, null, PayloadKey.AS_IS); inv.setType(InvocationType.LOCAL);