public static void addMetadata(Invocation invocation, Object key, Object value) { invocation.getMetaData().addMetaData(CLIENT_METADATA, key, value); }
public static Object getMetadata(Invocation invocation, Object key) { return invocation.getMetaData().getMetaData(CLIENT_METADATA, key); }
public static void addMetadata(Invocation invocation, Object key, Object value, PayloadKey payload) { invocation.getMetaData().addMetaData(CLIENT_METADATA, key, value, payload); }
/** * Obtains the current {@link AsyncInvocationId}, first looking in the * current Thread, then examining the specified invocation metadata. * If the current invocation is not asynchronous, null is returned. */ public static AsyncInvocationId getCurrentAsyncInvocationId(final Invocation invocation) { // Precondition checks assert invocation != null : "Invocation must be specified"; // Attempt to get from the Thread (local) AsyncInvocationId current = CurrentAsyncInvocation.getCurrentAsyncInvocationId(); // Attempt to get from the invocation if (current == null) { current = (AsyncInvocationId) invocation.getMetaData(AsyncInvocation.METADATA_GROUP_ASYNC, AsyncInvocation.METADATA_KEY_ID); } // Return return current; }
public static void markCurrentInvocation(final AsyncInvocationId uuid, final Invocation invocation) { // Precondition checks assert invocation != null : "Invocation must be specified"; CurrentAsyncInvocation.markCurrentInvocationOnThread(uuid); invocation.getMetaData().addMetaData(AsyncInvocation.METADATA_GROUP_ASYNC, AsyncInvocation.METADATA_KEY_ID, uuid); }
public static AsyncInvocationId unmarkCurrentInvocation(final Invocation invocation) { // Pop off final AsyncInvocationId current = CurrentAsyncInvocation.unmarkCurrentInvocationFromThread(); // Remove metadata from the invocation invocation.getMetaData().removeMetaData(AsyncInvocation.METADATA_GROUP_ASYNC, AsyncInvocation.METADATA_KEY_ID); return current; } }
static Map getClientMetadataMap(Invocation invocation) { Map map = invocation.getMetaData().tag(CLIENT_METADATA); if (map != null) { return new ClientValueMap(map); } return null; }
final String beenHere = (String) invocation.getMetaData().getMetaData(INVOCATION_METADATA_TAG, INVOCATION_METADATA_ATTR); if (beenHere != null && beenHere.equals(INVOCATION_METADATA_VALUE))
private Container findLocalContainer(Invocation invocation) String guid = (String)invocation.getMetaData(IS_LOCAL, GUID); String partitionName = (String) invocation.getMetaData(ClusterConstants.CLUSTERED_REMOTING, ClusterConstants.PARTITION_NAME); if (container == null) String oid = (String)invocation.getMetaData(Dispatcher.DISPATCHER, Dispatcher.OID); container = Ejb3Registry.getClusterContainer(Ejb3Registry.clusterUid(oid, partitionName));
@Override public Object invoke(Invocation invocation) throws Throwable { Object response = invocation.invokeNext(); String clientFamily = (String) invocation.getMetaData(CLUSTERED_REMOTING, CLUSTER_FAMILY); HATarget target = families.get(clientFamily); if (target == null) { return response; } Long clientViewId = (Long) invocation.getMetaData(CLUSTERED_REMOTING, CLUSTER_VIEW_ID); if (clientViewId == null) { // Maybe we're being invoked upon by a non-clustered proxy return response; } if (clientViewId.longValue() != target.getCurrentViewId()) { invocation.addResponseAttachment("replicants", new ArrayList<Object>(target.getReplicantList())); invocation.addResponseAttachment("viewId", new Long(target.getCurrentViewId())); } return response; } }
public Object invoke(Invocation invocation) throws Throwable Object message = invocation.getMetaData().getMetaData(ConsumerContainer.CONSUMER_MESSAGE, ConsumerContainer.CONSUMER_MESSAGE); if (fields != null)
final InvokerLocator locator = (InvokerLocator) invocation.getMetaData(InvokeRemoteInterceptor.REMOTING, InvokeRemoteInterceptor.INVOKER_LOCATOR); final Object oid = invocation.getMetaData().getMetaData(Dispatcher.DISPATCHER, Dispatcher.OID); final PojiProxy proxy = new PojiProxyHack(oid, locator, new Interceptor[] {});
VersionedObject manager = (VersionedObject)invocation.getMetaData(Versioned.VERSIONED, Versioned.VERSIONED_OBJECT); if (invocation instanceof MethodInvocation) String readonly = (String)invocation.getMetaData(Versioned.VERSIONED, Versioned.READONLY); if (readonly != null)
public Object invoke(Invocation invocation) throws Throwable { if (isLocal()) { String guid = (String)invocation.getMetaData(IS_LOCAL, GUID); Container container = Ejb3Registry.getContainer(guid); return invokeLocal(invocation, container); } return invocation.invokeNext(); }
public InvocationResponse invoke(Invocation invocation) throws NotFoundInDispatcherException, Throwable Object oid = invocation.getMetaData(DISPATCHER, OID);
protected Object invokeLocal(Invocation invocation, Container container) throws Throwable { Invocation copy = marshallOrPass(invocation, Invocation.class); copy.getMetaData().addMetaData(IS_LOCAL, IS_LOCAL, Boolean.TRUE, PayloadKey.AS_IS); try { // Invoke upon the container SessionContainer sc = (SessionContainer) container; InvocationResponse response = sc.dynamicInvoke(copy); // it could really have been a copy invocation.setResponseContextInfo(response.getContextInfo()); return marshallOrPass(response.getResponse(), Object.class); } // TODO: Either Throwable (as it used to be) or Exception (which is better) catch(Throwable t) { throw marshallOrPass(t, Throwable.class); } finally { copy.getMetaData().removeMetaData(IS_LOCAL, IS_LOCAL); } }
nextInvocation.getMetaData().addMetaData(INVOCATION_METADATA_TAG, INVOCATION_METADATA_ATTR, INVOCATION_METADATA_VALUE);
public Object invoke(Invocation invocation) throws Throwable { if (isLocal()) { Object oid = invocation.getMetaData(Dispatcher.DISPATCHER, Dispatcher.OID); if (Dispatcher.singleton.isRegistered(oid)) { InvocationResponse response = Dispatcher.singleton.invoke(invocation); invocation.setResponseContextInfo(response.getContextInfo()); return response.getResponse(); } } return invocation.invokeNext(); }
public Object invoke(Invocation invocation) throws Throwable { SecurityContext sc = (SecurityContext) invocation.getMetaData("security", "context"); logger.trace("Retrieved SecurityContext from invocation:" + sc); if (sc != null) { newSC.getUtil().createSubjectInfo(principal, new SamlCredential(assertion), subject); invocation.getMetaData().addMetaData("security", "context", newSC);
nextInvocation.setMetaData(invocation.getMetaData()); nextInvocation.setTargetObject(target); nextInvocation.setArguments(methodInvocation.getArguments());