use of org.jboss.as.controller.OperationFailedException in project wildfly by wildfly.
the class JMSBridgeRemove method recoverServices.
protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
final String bridgeName = address.getLastElement().getValue();
final ServiceRegistry registry = context.getServiceRegistry(true);
final ServiceName jmsBridgeServiceName = MessagingServices.getJMSBridgeServiceName(bridgeName);
final ServiceController<?> jmsBridgeServiceController = registry.getService(jmsBridgeServiceName);
if (jmsBridgeServiceController != null && jmsBridgeServiceController.getState() == ServiceController.State.UP) {
JMSBridgeService jmsBridgeService = (JMSBridgeService) jmsBridgeServiceController.getService();
try {
jmsBridgeService.startBridge();
} catch (Exception e) {
throw MessagingLogger.ROOT_LOGGER.failedToRecover(e, bridgeName);
}
}
}
use of org.jboss.as.controller.OperationFailedException in project wildfly by wildfly.
the class SecurityDomainAdd method createJSSESecurityDomain.
private JSSESecurityDomain createJSSESecurityDomain(OperationContext context, String securityDomain, ModelNode node) throws OperationFailedException {
node = peek(node, JSSE, CLASSIC);
if (node == null) {
return null;
}
final JBossJSSESecurityDomain jsseSecurityDomain = new JBossJSSESecurityDomain(securityDomain);
processKeyStore(context, node, KEYSTORE, new KeyStoreConfig() {
public void setKeyStorePassword(String value) throws Exception {
jsseSecurityDomain.setKeyStorePassword(value);
}
public void setKeyStoreType(String value) {
jsseSecurityDomain.setKeyStoreType(value);
}
public void setKeyStoreURL(String value) throws IOException {
jsseSecurityDomain.setKeyStoreURL(value);
}
public void setKeyStoreProvider(String value) {
jsseSecurityDomain.setKeyStoreProvider(value);
}
public void setKeyStoreProviderArgument(String value) {
jsseSecurityDomain.setKeyStoreProviderArgument(value);
}
});
processKeyStore(context, node, Constants.TRUSTSTORE, new KeyStoreConfig() {
public void setKeyStorePassword(String value) throws Exception {
jsseSecurityDomain.setTrustStorePassword(value);
}
public void setKeyStoreType(String value) {
jsseSecurityDomain.setTrustStoreType(value);
}
public void setKeyStoreURL(String value) throws IOException {
jsseSecurityDomain.setTrustStoreURL(value);
}
public void setKeyStoreProvider(String value) {
jsseSecurityDomain.setTrustStoreProvider(value);
}
public void setKeyStoreProviderArgument(String value) {
jsseSecurityDomain.setTrustStoreProviderArgument(value);
}
});
processKeyManager(context, node, Constants.KEY_MANAGER, new KeyManagerConfig() {
public void setKeyManagerFactoryAlgorithm(String value) {
jsseSecurityDomain.setKeyManagerFactoryAlgorithm(value);
}
public void setKeyManagerFactoryProvider(String value) {
jsseSecurityDomain.setKeyManagerFactoryProvider(value);
}
});
processKeyManager(context, node, Constants.TRUST_MANAGER, new KeyManagerConfig() {
public void setKeyManagerFactoryAlgorithm(String value) {
jsseSecurityDomain.setTrustManagerFactoryAlgorithm(value);
}
public void setKeyManagerFactoryProvider(String value) {
jsseSecurityDomain.setTrustManagerFactoryProvider(value);
}
});
String value;
if (node.hasDefined(CLIENT_ALIAS)) {
value = JSSEResourceDefinition.CLIENT_ALIAS.resolveModelAttribute(context, node).asString();
jsseSecurityDomain.setClientAlias(value);
}
if (node.hasDefined(SERVER_ALIAS)) {
value = JSSEResourceDefinition.SERVER_ALIAS.resolveModelAttribute(context, node).asString();
jsseSecurityDomain.setServerAlias(value);
}
if (node.hasDefined(CLIENT_AUTH)) {
boolean clientAuth = JSSEResourceDefinition.CLIENT_AUTH.resolveModelAttribute(context, node).asBoolean();
jsseSecurityDomain.setClientAuth(clientAuth);
}
if (node.hasDefined(SERVICE_AUTH_TOKEN)) {
value = JSSEResourceDefinition.SERVICE_AUTH_TOKEN.resolveModelAttribute(context, node).asString();
try {
jsseSecurityDomain.setServiceAuthToken(value);
} catch (Exception e) {
throw SecurityLogger.ROOT_LOGGER.runtimeException(e);
}
}
if (node.hasDefined(CIPHER_SUITES)) {
value = JSSEResourceDefinition.CIPHER_SUITES.resolveModelAttribute(context, node).asString();
jsseSecurityDomain.setCipherSuites(value);
}
if (node.hasDefined(PROTOCOLS)) {
value = JSSEResourceDefinition.PROTOCOLS.resolveModelAttribute(context, node).asString();
jsseSecurityDomain.setProtocols(value);
}
if (node.hasDefined(ADDITIONAL_PROPERTIES)) {
Properties properties = new Properties();
properties.putAll(JSSEResourceDefinition.ADDITIONAL_PROPERTIES.unwrap(context, node));
jsseSecurityDomain.setAdditionalProperties(properties);
}
return jsseSecurityDomain;
}
use of org.jboss.as.controller.OperationFailedException in project wildfly by wildfly.
the class SecurityDomainAdd method performRuntime.
@Override
protected void performRuntime(OperationContext context, ModelNode operation, final ModelNode model) {
PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR));
final String securityDomain = address.getLastElement().getValue();
// This needs to run after all child resources so that they can detect a fresh state
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
final Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS);
launchServices(context, securityDomain, Resource.Tools.readModel(resource));
// Rollback handled by the parent step
context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER);
}
}, OperationContext.Stage.RUNTIME);
}
use of org.jboss.as.controller.OperationFailedException in project wildfly by wildfly.
the class AbstractTimerManagementTestCase method cancelTimer.
protected void cancelTimer() throws Exception {
final PathAddress address = getTimerAddress();
final ModelNode operation = Util.createOperation("cancel", address);
final ModelNode outcome = this.managementClient.getControllerClient().execute(operation);
if (!Operations.isSuccessfulOutcome(outcome)) {
throw new OperationFailedException(operation);
}
}
use of org.jboss.as.controller.OperationFailedException in project wildfly by wildfly.
the class AbstractTimerManagementTestCase method suspendTimer.
protected void suspendTimer() throws Exception {
final PathAddress address = getTimerAddress();
final ModelNode operation = Util.createOperation("suspend", address);
final ModelNode outcome = this.managementClient.getControllerClient().execute(operation);
if (!Operations.isSuccessfulOutcome(outcome)) {
throw new OperationFailedException(operation);
}
}
Aggregations