本文整理匯總了Java中org.terracotta.management.model.context.Context.contains方法的典型用法代碼示例。如果您正苦於以下問題:Java Context.contains方法的具體用法?Java Context.contains怎麽用?Java Context.contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.terracotta.management.model.context.Context
的用法示例。
在下文中一共展示了Context.contains方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: sendManagementCallRequest
import org.terracotta.management.model.context.Context; //導入方法依賴的package包/類
@Override
public String sendManagementCallRequest(ClientDescriptor caller, final Context context, String capabilityName, String methodName, Class<?> returnType, Parameter... parameters) {
LOGGER.trace("[{}] sendManagementCallRequest({}, {}, {})", consumerId, context, capabilityName, methodName);
String managementCallIdentifier = UUID.randomUUID().toString();
Context fullContext = null;
if (context.contains(Client.KEY)) {
// handle client call
ClientIdentifier to = ClientIdentifier.valueOf(context.get(Client.KEY));
fullContext = context.with(topologyService.getManageableClientContext(to)
.orElseThrow(() -> new IllegalArgumentException("Client " + to + " is either not found or not manageable")));
}
if ((context.contains(Server.NAME_KEY) || context.contains(Server.KEY))
&& (context.contains(ServerEntity.CONSUMER_ID) || context.contains(ServerEntity.TYPE_KEY) && context.contains(ServerEntity.NAME_KEY))) {
// handle entity call
String serverName = context.getOrDefault(Server.NAME_KEY, context.get(Server.KEY));
Context entityCtx = (context.contains(ServerEntity.CONSUMER_ID) ?
topologyService.getManageableEntityContext(serverName, Long.parseLong(context.get(ServerEntity.CONSUMER_ID))) :
topologyService.getManageableEntityContext(serverName, context.get(ServerEntity.NAME_KEY), context.get(ServerEntity.TYPE_KEY)))
.orElseThrow(() -> new IllegalArgumentException("Server Entity " + context + " is either not found or not manageable"));
fullContext = context.with(entityCtx);
}
if (fullContext == null) {
// this method is called from an entity invoke, so throwing is OK
throw new IllegalArgumentException(context.toString());
}
track(caller, managementCallIdentifier);
firingService.fireManagementCallRequest(managementCallIdentifier, new ContextualCall<>(fullContext, capabilityName, methodName, returnType, parameters));
return managementCallIdentifier;
}
示例2: findExposedObject
import org.terracotta.management.model.context.Context; //導入方法依賴的package包/類
protected ExposedObject<T> findExposedObject(Context context) {
if (!contextValid(context)) {
return null;
}
for (ExposedObject<T> exposedObject : exposedObjects) {
if (context.contains(exposedObject.getContext())) {
return exposedObject;
}
}
return null;
}
示例3: call
import org.terracotta.management.model.context.Context; //導入方法依賴的package包/類
@Override
public Future<String> call(@ClientId Object callerDescriptor, Context context, String capabilityName, String methodName, Class<?> returnType, Parameter... parameters) {
if (context.contains(Stripe.KEY)) {
context = context.with(Stripe.KEY, "SINGLE");
}
return CompletableFuture.completedFuture(managementService.sendManagementCallRequest((ClientDescriptor) callerDescriptor, context, capabilityName, methodName, returnType, parameters));
}