final ServiceController<?> dataSourceController = registry.getService(dataSourceServiceName);
if (dataSourceController != null) {
if (!ServiceController.State.UP.equals(dataSourceController.getState())) {
dataSourceController.setMode(ServiceController.Mode.ACTIVE);
} else {
throw new OperationFailedException(new ModelNode().set("Data-source service [" + jndiName + "] is already started"));
}
} else {
throw new OperationFailedException(new ModelNode().set("Data-source service [" + jndiName + "] is not available"));
}
final ServiceName referenceServiceName = DataSourceReferenceFactoryService.SERVICE_NAME_BASE.append(jndiName);
final ServiceController<?> referenceController = registry.getService(referenceServiceName);
if (referenceController != null && !ServiceController.State.UP.equals(referenceController.getState())) {