@Override public T getValue() { return this.service.getValue(); } }
@Override public T getValue() { return this.service.getValue(); }
@Override public T getValue() { return this.service.getValue(); } }
public class ServiceCaller { private String url; private Service service; public A { url = System.getProperty("url); Hashtable env = ...; Context ctx = new InitialContext(...) service = ctx.lookup(...) } public String getValue() { return service.getValue(); } ...
@Override public T getValue() { return this.service.getValue(); }
@Override public T getValue() { return this.service.getValue(); }
public S getValue() throws IllegalStateException { if (!(service instanceof Service)) { throw new UnsupportedOperationException(); } return ((Service<S>) service).getValue(); }
public S getValue() throws IllegalStateException { if (!(service instanceof Service)) { throw new UnsupportedOperationException(); } return ((Service<S>) service).getValue(); }
@Override public AtomicReference<T> getValueRef() { return this.master.get() ? new AtomicReference<T>(this.service.getValue()) : null; }
public S awaitValue() throws IllegalStateException, InterruptedException { assert !holdsLock(this); if (!(service instanceof Service)) { throw new UnsupportedOperationException(); } synchronized (this) { for (;;) switch (state.getState()) { case UP: { return ((Service<S>) service).getValue(); } case START_FAILED: { throw new IllegalStateException("Failed to start service", startException); } case REMOVED: { throw new IllegalStateException("Service was removed"); } default: { wait(); } } } }
@Override public ManagedReference getReference() { return new ValueManagedReference(new ImmediateValue<Object>(service.getValue())); } }
@Override public ManagedReference getReference() { return new ValueManagedReference(new ImmediateValue<Object>(service.getValue())); } }
@Override protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { ServiceController<?> service = context.getServiceRegistry(false).getService(RequestController.SERVICE_NAME); if(service != null) { RequestController requestController = (RequestController) service.getService().getValue(); context.getResult().set(requestController.getActiveRequestCount()); } else { context.getResult().set(-1); } } }
@Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final ModelNode applications = context.getResult(); final ServiceController<?> controller = context.getServiceRegistry(false).getRequiredService( SwitchYardAdminService.SERVICE_NAME); SwitchYard switchYard = SwitchYard.class.cast(controller.getService().getValue()); for (Application application : switchYard.getApplications()) { applications.add(application.getName().toString()); } context.stepCompleted(); } }, OperationContext.Stage.RUNTIME);
@Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final ModelNode applications = context.getResult(); final ServiceController<?> controller = context.getServiceRegistry(false).getRequiredService( SwitchYardAdminService.SERVICE_NAME); SwitchYard switchYard = SwitchYard.class.cast(controller.getService().getValue()); for (Application application : switchYard.getApplications()) { applications.add(application.getName().toString()); } context.stepCompleted(); } }, OperationContext.Stage.RUNTIME);
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { ServiceController<KeytabService> serviceController = ManagementUtil.getKeytabService(context, operation); KeytabService keytabService = serviceController.getService().getValue(); SubjectIdentity si = null; try { si = keytabService.createSubjectIdentity(false); ModelNode result = context.getResult(); result.get(SUBJECT).set(si.getSubject().toString()); } catch (LoginException e) { throw SECURITY_LOGGER.unableToObtainTGT(e); } finally { if (si != null) { si.logout(); } } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); } }, Stage.RUNTIME);
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { ServiceController<KeytabService> serviceController = ManagementUtil.getKeytabService(context, operation); KeytabService keytabService = serviceController.getService().getValue(); SubjectIdentity si = null; try { si = keytabService.createSubjectIdentity(false); ModelNode result = context.getResult(); result.get(SUBJECT).set(si.getSubject().toString()); } catch (LoginException e) { throw SECURITY_LOGGER.unableToObtainTGT(e); } finally { if (si != null) { si.logout(); } } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); } }, Stage.RUNTIME);
private static AcmeAccount getAcmeAccount(OperationContext context, String certificateAuthorityAccountName, boolean staging) throws OperationFailedException { ServiceRegistry serviceRegistry = context.getServiceRegistry(true); RuntimeCapability<Void> runtimeCapability = CERTIFICATE_AUTHORITY_ACCOUNT_RUNTIME_CAPABILITY.fromBaseCapability(certificateAuthorityAccountName); ServiceName serviceName = runtimeCapability.getCapabilityServiceName(); ServiceController<AcmeAccount> serviceContainer = getRequiredService(serviceRegistry, serviceName, AcmeAccount.class); ServiceController.State serviceState = serviceContainer.getState(); if (serviceState != ServiceController.State.UP) { throw ROOT_LOGGER.requiredServiceNotUp(serviceName, serviceState); } AcmeAccount acmeAccount = serviceContainer.getService().getValue(); return resetAcmeAccount(acmeAccount, staging); }
private void apply(final OperationContext context, final ModelNode model) throws OperationFailedException { ServiceController<?> serviceController = context.getServiceRegistry(false).getService(RequestController.SERVICE_NAME); if(serviceController == null) { return; } RequestController requestController = (RequestController) serviceController.getService().getValue(); final ModelNode modelNode = this.attributeDefinition.resolveModelAttribute(context, model); if(!modelNode.isDefined()) { requestController.setMaxRequestCount(-1); } else { requestController.setMaxRequestCount(modelNode.asInt()); } }
@Override protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { ServiceName serviceName = getSSLContextServiceUtil().serviceName(operation); ServiceController<SSLContext> serviceController = getRequiredService(context.getServiceRegistry(false), serviceName, SSLContext.class); State serviceState; if ((serviceState = serviceController.getState()) != State.UP) { throw ROOT_LOGGER.requiredServiceNotUp(serviceName, serviceState); } performRuntime(context.getResult(), operation, serviceController.getService().getValue()); }