本文整理汇总了Java中org.jboss.as.controller.ModelController类的典型用法代码示例。如果您正苦于以下问题:Java ModelController类的具体用法?Java ModelController怎么用?Java ModelController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelController类属于org.jboss.as.controller包,在下文中一共展示了ModelController类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: activate
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException {
ServiceTarget target = serviceActivatorContext.getServiceTarget();
MetricsService service = new MetricsService();
ServiceBuilder<MetricsService> metricsServiceBuilder = target.addService(MetricsService.SERVICE_NAME, service);
RegistryFactory factory = new RegistryFactoryImpl();
ServiceBuilder<MetricsService> serviceBuilder = metricsServiceBuilder
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.getServerEnvironmentInjector())
.addDependency(ServiceName.parse("jboss.eclipse.microprofile.config.config-provider"))
.addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.getModelControllerInjector());
serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
BinderService binderService = new BinderService(SWARM_MP_METRICS, null, true);
target.addService(ContextNames.buildServiceName(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, SWARM_MP_METRICS), binderService)
.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, binderService.getNamingStoreInjector())
.addInjection(binderService.getManagedObjectInjector(), new ImmediateManagedReferenceFactory(factory))
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:27,代码来源:MetricsServiceActivator.java
示例2: addService
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
public static ServiceController<?> addService(final OperationContext context, final String resolvedDomainName, final String expressionsDomainName, final boolean legacyWithProperPropertyFormat,
final boolean coreMBeanSensitivity,
final ManagedAuditLogger auditLoggerInfo,
final JmxAuthorizer authorizer,
final Supplier<SecurityIdentity> securityIdentitySupplier,
final JmxEffect jmxEffect,
final ProcessType processType, final boolean isMasterHc) {
final MBeanServerService service = new MBeanServerService(resolvedDomainName, expressionsDomainName, legacyWithProperPropertyFormat,
coreMBeanSensitivity, auditLoggerInfo, authorizer, securityIdentitySupplier, jmxEffect, processType, isMasterHc);
final ServiceName modelControllerName = processType.isHostController() ?
DOMAIN_CONTROLLER_NAME : Services.JBOSS_SERVER_CONTROLLER;
return context.getServiceTarget().addService(MBeanServerService.SERVICE_NAME, service)
.setInitialMode(ServiceController.Mode.ACTIVE)
.addDependency(modelControllerName, ModelController.class, service.modelControllerValue)
.addDependency(context.getCapabilityServiceName("org.wildfly.management.notification-handler-registry", null), NotificationHandlerRegistry.class, service.notificationRegistryValue)
.addDependency(ManagementModelIntegration.SERVICE_NAME, ManagementModelIntegration.ManagementModelProvider.class, service.managementModelProviderValue)
.addAliases(LEGACY_MBEAN_SERVER_NAME)
.install();
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:20,代码来源:MBeanServerService.java
示例3: registerHost
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
/**
* Once the "read-domain-mode" operation is in operationPrepared, send the model back to registering HC.
* When the model was applied successfully on the client, we process registering the proxy in the domain,
* otherwise we rollback.
*
* @param transaction the model controller tx
* @param result the prepared result (domain model)
* @throws SlaveRegistrationException
*/
void registerHost(final ModelController.OperationTransaction transaction, final ModelNode result) throws SlaveRegistrationException {
//
if (sendResultToHost(transaction, result)) return;
synchronized (this) {
Long pingPongId = hostInfo.getRemoteConnectionId();
// Register the slave
domainController.registerRemoteHost(hostName, handler, transformers, pingPongId, registerProxyController);
// Complete registration
if(! failed) {
transaction.commit();
} else {
transaction.rollback();
return;
}
}
if (registerProxyController) {
DOMAIN_LOGGER.registeredRemoteSlaveHost(hostName, hostInfo.getPrettyProductName());
}
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:29,代码来源:HostControllerRegistrationHandler.java
示例4: setupController
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
@Before
public void setupController() throws InterruptedException {
container = ServiceContainer.Factory.create("test");
ServiceTarget target = container.subTarget();
if (useDelegateRootResourceDefinition) {
initializer = createInitializer();
controllerService = new ModelControllerService(getAuditLogger(), rootResourceDefinition);
} else {
controllerService = new ModelControllerService(getAuditLogger());
}
ServiceBuilder<ModelController> builder = target.addService(ServiceName.of("ModelController"), controllerService);
builder.install();
controllerService.awaitStartup(30, TimeUnit.SECONDS);
controller = controllerService.getValue();
//ModelNode setup = Util.getEmptyOperation("setup", new ModelNode());
//controller.execute(setup, null, null, null);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:18,代码来源:AbstractControllerTestBase.java
示例5: installManagementChannelServices
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
/**
* Set up the services to create a channel listener and operation handler service.
* @param serviceTarget the service target to install the services into
* @param endpointName the endpoint name to install the services into
* @param channelName the name of the channel
* @param executorServiceName service name of the executor service to use in the operation handler service
* @param scheduledExecutorServiceName service name of the scheduled executor service to use in the operation handler service
*/
public static void installManagementChannelServices(
final ServiceTarget serviceTarget,
final ServiceName endpointName,
final AbstractModelControllerOperationHandlerFactoryService operationHandlerService,
final ServiceName modelControllerName,
final String channelName,
final ServiceName executorServiceName,
final ServiceName scheduledExecutorServiceName) {
final OptionMap options = OptionMap.EMPTY;
final ServiceName operationHandlerName = endpointName.append(channelName).append(ModelControllerClientOperationHandlerFactoryService.OPERATION_HANDLER_NAME_SUFFIX);
serviceTarget.addService(operationHandlerName, operationHandlerService)
.addDependency(modelControllerName, ModelController.class, operationHandlerService.getModelControllerInjector())
.addDependency(executorServiceName, ExecutorService.class, operationHandlerService.getExecutorInjector())
.addDependency(scheduledExecutorServiceName, ScheduledExecutorService.class, operationHandlerService.getScheduledExecutorInjector())
.setInitialMode(ACTIVE)
.install();
installManagementChannelOpenListenerService(serviceTarget, endpointName, channelName, operationHandlerName, options, false);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:30,代码来源:ManagementRemotingServices.java
示例6: execute
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
@Override
public void execute(ModelNode operation, OperationMessageHandler handler, final ProxyOperationControl control, OperationAttachments attachments, BlockingTimeout blockingTimeout) {
final ModelNode response = new ModelNode();
response.get("outcome").set("success");
response.get("result", "attr").set(true);
control.operationPrepared(new ModelController.OperationTransaction() {
@Override
public void commit() {
control.operationCompleted(OperationResponse.Factory.createSimple(response));
}
@Override
public void rollback() {
control.operationCompleted(OperationResponse.Factory.createSimple(response));
}
}, response);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:19,代码来源:ReadResourceWithRuntimeResourceTestCase.java
示例7: openConnection
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
/**
* Connect to the HC and retrieve the current model updates.
*
* @param controller the server controller
* @param callback the operation completed callback
*
* @throws IOException for any error
*/
synchronized void openConnection(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception {
boolean ok = false;
final Connection connection = connectionManager.connect();
try {
channelHandler.executeRequest(new ServerRegisterRequest(), null, callback);
// HC is the same version, so it will support sending the subject
channelHandler.getAttachments().attach(TransactionalProtocolClient.SEND_IDENTITY, Boolean.TRUE);
channelHandler.addHandlerFactory(new TransactionalProtocolOperationHandler(controller, channelHandler, responseAttachmentSupport));
ok = true;
} finally {
if(!ok) {
connection.close();
}
}
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:24,代码来源:HostControllerConnection.java
示例8: operationPrepared
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
@Override
public void operationPrepared(OperationTransaction transaction, ModelNode result) {
Class<?> mainClass = mainTransactionControl.getClass();
ClassLoader mainCl = mainClass.getClassLoader();
try {
Method method = mainClass.getMethod("operationPrepared",
mainCl.loadClass(ModelController.OperationTransaction.class.getName()),
mainCl.loadClass(ModelNode.class.getName()));
method.setAccessible(true);
Class<?> mainOpTxClass = mainCl.loadClass(OperationTransactionProxy.class.getName());
Constructor<?> ctor = mainOpTxClass.getConstructors()[0];
Object mainOpTxProxy = ctor.newInstance(transaction);
method.invoke(mainTransactionControl, mainOpTxProxy, convertModelNodeToMainCl(result));
} catch (Exception e) {
unwrapInvocationTargetRuntimeException(e);
throw new RuntimeException(e);
}
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:OperationTransactionControlProxy.java
示例9: executeOperation
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
public ModelNode executeOperation(ModelNode operation, OperationTransactionControl txControl) {
try {
if (executeOperation2 == null) {
executeOperation2 = childFirstClassLoaderServices.getClass().getMethod("executeOperation",
childFirstClassLoader.loadClass(ModelNode.class.getName()),
childFirstClassLoader.loadClass(ModelController.OperationTransactionControl.class.getName()));
}
Class<?> opTxControlProxyClass = childFirstClassLoader.loadClass(getOperationTransactionProxyClassName());
Object opTxControl = opTxControlProxyClass.getConstructors()[0].newInstance(txControl);
return convertModelNodeFromChildCl(
executeOperation2.invoke(childFirstClassLoaderServices,
convertModelNodeToChildCl(operation),
opTxControl));
} catch (Exception e) {
unwrapInvocationTargetRuntimeException(e);
throw new RuntimeException(e);
}
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:20,代码来源:ModelTestLegacyControllerKernelServicesProxy.java
示例10: createService
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
public static ServiceController<RhqMetricsService> createService(final ServiceTarget target,
final ServiceVerificationHandler verificationHandler,
ModelNode config) {
RhqMetricsService service = new RhqMetricsService(config);
return target.addService(SERVICE_NAME, service)
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class,
service.serverEnvironmentValue)
.addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class,
service.modelControllerValue)
.addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class,
service.processStateValue)
.addListener(verificationHandler)
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
开发者ID:hawkular,项目名称:wildfly-monitor,代码行数:18,代码来源:RhqMetricsService.java
示例11: activate
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
Optional<String> securityRealm = Optional.empty();
if (!healthFractionInstance.isUnsatisfied()) {
securityRealm = healthFractionInstance.get().securityRealm();
}
ServiceTarget target = context.getServiceTarget();
MonitorService service = new MonitorService(securityRealm);
ServiceBuilder<MonitorService> monitorServiceServiceBuilder = target.addService(MonitorService.SERVICE_NAME, service);
ServiceBuilder<MonitorService> serviceBuilder = monitorServiceServiceBuilder
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.getServerEnvironmentInjector())
.addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.getModelControllerInjector());
if (securityRealm.isPresent()) { // configured through the fraction interface
serviceBuilder.addDependency(
createRealmName(securityRealm.get()),
SecurityRealm.class,
service.getSecurityRealmInjector()
);
}
serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
BinderService binderService = new BinderService(Monitor.JNDI_NAME, null, true);
target.addService(ContextNames.buildServiceName(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, Monitor.JNDI_NAME), binderService)
.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, binderService.getNamingStoreInjector())
.addInjection(binderService.getManagedObjectInjector(), new ImmediateManagedReferenceFactory(service))
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:39,代码来源:MonitorServiceActivator.java
示例12: activate
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
Optional<String> securityRealm = Optional.empty();
if (!monitorFractionInstance.isUnsatisfied()) {
securityRealm = monitorFractionInstance.get().securityRealm();
}
ServiceTarget target = context.getServiceTarget();
MonitorService service = new MonitorService(securityRealm);
ServiceBuilder<MonitorService> monitorServiceServiceBuilder = target.addService(MonitorService.SERVICE_NAME, service);
ServiceBuilder<MonitorService> serviceBuilder = monitorServiceServiceBuilder
.addDependency(ServerEnvironmentService.SERVICE_NAME, ServerEnvironment.class, service.getServerEnvironmentInjector())
.addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.getModelControllerInjector());
if (securityRealm.isPresent()) { // configured through the fraction interface
serviceBuilder.addDependency(
createRealmName(securityRealm.get()),
SecurityRealm.class,
service.getSecurityRealmInjector()
);
}
serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
BinderService binderService = new BinderService(Monitor.JNDI_NAME, null, true);
target.addService(ContextNames.buildServiceName(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, Monitor.JNDI_NAME), binderService)
.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, binderService.getNamingStoreInjector())
.addInjection(binderService.getManagedObjectInjector(), new ImmediateManagedReferenceFactory(service))
.setInitialMode(ServiceController.Mode.ACTIVE)
.install();
}
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:39,代码来源:MonitorServiceActivator.java
示例13: ResteasyEnabler
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
public ResteasyEnabler(String vdbName, int version, ModelController deployer, Executor executor, ContainerLifeCycleListener shutdownListener) {
this.admin = AdminFactory.getInstance().createAdmin(deployer.createClient(executor));
this.executor = executor;
this.vdbName = vdbName;
this.vdbVersion = version;
this.shutdownListener = shutdownListener;
}
开发者ID:kenweezy,项目名称:teiid,代码行数:8,代码来源:ResteasyEnabler.java
示例14: testOtherModels
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
@Test public void testOtherModels() throws VirtualDatabaseException {
ResteasyEnabler resteasyEnabler = new ResteasyEnabler("x", 1, Mockito.mock(ModelController.class), ExecutorUtils.getDirectExecutor(), Mockito.mock(ContainerLifeCycleListener.class));
MetadataStore ms = new MetadataStore();
CompositeVDB vdb = TestCompositeVDB.createCompositeVDB(ms, "x");
vdb.getVDB().addProperty("{http://teiid.org/rest}auto-generate", "true");
ModelMetaData model = new ModelMetaData();
model.setName("other");
model.setModelType(Type.OTHER);
vdb.getVDB().addModel(model);
resteasyEnabler.finishedDeployment("x", 1, vdb, false);
}
开发者ID:kenweezy,项目名称:teiid,代码行数:15,代码来源:TestResteasyEnabler.java
示例15: LocalModelControllerClientFactory
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
public LocalModelControllerClientFactory(ModelController modelController) {
super();
this.modelController = modelController;
final ThreadFactory threadFactory = ThreadFactoryGenerator.generateFactory(true,
"Hawkular-Agent-Local-DMR-Client");
this.executor = Executors.newCachedThreadPool(threadFactory);
}
开发者ID:hawkular,项目名称:hawkular-agent,代码行数:8,代码来源:ModelControllerClientFactory.java
示例16: activate
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
@Override
public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
final GetModelControllerService service = new GetModelControllerService();
LOG.info(i18n.format("RTGovUIServiceActivator.Activating")); //$NON-NLS-1$
context
.getServiceTarget()
.addService(ServiceName.of("management", "client", "getter"), service) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
.addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.modelControllerValue)
.install();
}
开发者ID:Governance,项目名称:rtgov-ui,代码行数:11,代码来源:RTGovUIServiceActivator.java
示例17: ModelControllerMBeanServerPlugin
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
public ModelControllerMBeanServerPlugin(final MBeanServer mbeanServer,
final ConfiguredDomains configuredDomains, ModelController controller, NotificationHandlerRegistry notificationHandlerRegistry, final MBeanServerDelegate delegate,
boolean legacyWithProperPropertyFormat, ProcessType processType,
ManagementModelIntegration.ManagementModelProvider managementModelProvider, boolean isMasterHc) {
assert configuredDomains != null;
this.mbeanServer = mbeanServer;
this.configuredDomains = configuredDomains;
this.notificationRegistry = notificationHandlerRegistry;
MutabilityChecker mutabilityChecker = MutabilityChecker.create(processType, isMasterHc);
legacyHelper = configuredDomains.getLegacyDomain() != null ?
new ModelControllerMBeanHelper(TypeConverters.createLegacyTypeConverters(legacyWithProperPropertyFormat),
configuredDomains, configuredDomains.getLegacyDomain(), controller, mutabilityChecker, managementModelProvider) : null;
exprHelper = configuredDomains.getExprDomain() != null ?
new ModelControllerMBeanHelper(TypeConverters.createExpressionTypeConverters(), configuredDomains,
configuredDomains.getExprDomain(), controller, mutabilityChecker, managementModelProvider) : null;
// JMX notifications for MBean registration/unregistration are emitted by the MBeanServerDelegate and not by the
// MBeans itself. If we have a reference on the delegate, we add a listener for any WildFly resource address
// that converts the resource-added and resource-removed notifications to MBeanServerNotification and send them
// through the delegate.
if (delegate != null) {
for (String domain : configuredDomains.getDomains()) {
ResourceRegistrationNotificationHandler handler = new ResourceRegistrationNotificationHandler(delegate, domain);
notificationRegistry.registerNotificationHandler(NotificationHandlerRegistration.ANY_ADDRESS, handler, handler);
}
}
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:29,代码来源:ModelControllerMBeanServerPlugin.java
示例18: getResourceAccess
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
ResourceAccessControl getResourceAccess(PathAddress address, boolean operations) {
ModelNode op = Util.createOperation(READ_RESOURCE_DESCRIPTION_OPERATION, address);
op.get(ACCESS_CONTROL).set(ReadResourceDescriptionHandler.AccessControl.TRIM_DESCRIPTONS.toModelNode());
if (operations) {
op.get(OPERATIONS).set(true);
op.get(INHERITED).set(false);
}
ModelNode result = controller.execute(op, null, ModelController.OperationTransactionControl.COMMIT, null);
if (!result.get(OUTCOME).asString().equals(SUCCESS)) {
return NOT_ADDRESSABLE;
} else {
final ModelNode accessControl = result.get(RESULT, ACCESS_CONTROL);
ModelNode useAccessControl = null;
if (accessControl.hasDefined(EXCEPTIONS) && accessControl.get(EXCEPTIONS).keys().size() > 0) {
String key = address.toModelNode().asString();
ModelNode exception = accessControl.get(EXCEPTIONS, key);
if (exception.isDefined()) {
useAccessControl = exception;
}
}
if (useAccessControl == null) {
useAccessControl = accessControl.get(DEFAULT);
}
return new ResourceAccessControl(useAccessControl);
}
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:28,代码来源:ResourceAccessControlUtil.java
示例19: ModelControllerMBeanHelper
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
ModelControllerMBeanHelper(TypeConverters converters, ConfiguredDomains configuredDomains, String domain,
ModelController controller, MutabilityChecker mutabilityChecker,
ManagementModelIntegration.ManagementModelProvider managementModelProvider) {
this.converters = converters;
this.configuredDomains = configuredDomains;
this.domain = domain;
this.controller = controller;
this.accessControlUtil = new ResourceAccessControlUtil(controller);
this.mutabilityChecker = mutabilityChecker;
this.managementModelProvider = managementModelProvider;
this.rootObjectInstance = ModelControllerMBeanHelper.createRootObjectInstance(domain);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:13,代码来源:ModelControllerMBeanHelper.java
示例20: setupController
import org.jboss.as.controller.ModelController; //导入依赖的package包/类
@Before
public void setupController() throws InterruptedException {
container = ServiceContainer.Factory.create("test");
ServiceTarget target = container.subTarget();
ModelControllerService svc = new ModelControllerService(processType, getAuditLogger(), getAuthorizer());
ServiceBuilder<ModelController> builder = target.addService(Services.JBOSS_SERVER_CONTROLLER, svc);
builder.install();
svc.awaitStartup(30, TimeUnit.SECONDS);
controller = svc.getValue();
//ModelNode setup = Util.getEmptyOperation("setup", new ModelNode());
//controller.execute(setup, null, null, null);
}
开发者ID:wildfly,项目名称:wildfly-core,代码行数:13,代码来源:AbstractControllerTestBase.java
注:本文中的org.jboss.as.controller.ModelController类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论