public Services getServices() { Services services = domain.getExtensionByType(Services.class); if (services == null) { try { if (ConfigSupport.apply(new SingleConfigCode<Domain>() { public Object run(Domain param) throws PropertyVetoException, TransactionFailure { Services services = param.createChild(Services.class); param.getExtensions().add(services); return services; } }, domain) == null) { System.out.println("Unable to create 'services' config"); } } catch (TransactionFailure transactionFailure) { System.out.println("Unable to create 'services' config due to : " + transactionFailure.getMessage()); throw new RuntimeException(transactionFailure.getMessage(), transactionFailure); } } services = domain.getExtensionByType(Services.class); return services; }
public void unregisterServiceReference(final String serviceName, final String appName){ Services services = getServices(); try { ConfigSupport.apply(new SingleConfigCode<Services>() { public Object run(Services param) throws PropertyVetoException, TransactionFailure { ServiceRef serviceRefToUnregister = null; for (ServiceRef serviceRef : param.getServiceRefs()) { if (serviceRef.getServiceName().equals(serviceName) && (serviceRef.getApplicationName().equals(appName))) { serviceRefToUnregister = serviceRef; break; } } if(serviceRefToUnregister != null){ param.getServiceRefs().remove(serviceRefToUnregister); }else{ throw new RuntimeException("no shared or external service by name ["+serviceName+"] is referred" + "by application ["+appName+"]"); } return param; } }, services); } catch (TransactionFailure exception) { throw new RuntimeException(exception.getMessage(), exception); } }
public ServiceProvisioningEngines getServiceProvisioningEngines() { ServiceProvisioningEngines spes = domain.getExtensionByType(ServiceProvisioningEngines.class); if (spes == null) { try { if (ConfigSupport.apply(new SingleConfigCode<Domain>() { public Object run(Domain param) throws PropertyVetoException, TransactionFailure { ServiceProvisioningEngines spes = param.createChild(ServiceProvisioningEngines.class); param.getExtensions().add(spes); return spes; } }, domain) == null) { logger.log(Level.SEVERE, "unable.tocreate.spe"); } } catch (TransactionFailure transactionFailure) { logger.log(Level.SEVERE, "unable.tocreate.spe",transactionFailure); throw new RuntimeException(transactionFailure.getMessage(), transactionFailure); } } spes = domain.getExtensionByType(ServiceProvisioningEngines.class); return spes; }
public PaasApplications getPaasApplications() { PaasApplications paasApplications = domain.getExtensionByType(PaasApplications.class); if (paasApplications == null) { try { if (ConfigSupport.apply(new SingleConfigCode<Domain>() { public Object run(Domain param) throws PropertyVetoException, TransactionFailure { PaasApplications paasApplications = param.createChild(PaasApplications.class); param.getExtensions().add(paasApplications); return paasApplications; } }, domain) == null) { logger.log(Level.SEVERE, "unable.tocreate.paasapplications"); } } catch (TransactionFailure transactionFailure) { logger.log(Level.SEVERE, "unable.tocreate.paasapplications",transactionFailure); throw new RuntimeException(transactionFailure.getMessage(), transactionFailure); } } paasApplications = domain.getExtensionByType(PaasApplications.class); return paasApplications; } }
throw new RuntimeException(transactionFailure.getMessage(), transactionFailure);
throw new RuntimeException(transactionFailure.getMessage(), transactionFailure);
public void registerServiceReference(final String serviceName, final String appName){ Services services = getServices(); boolean serviceFound = false; for (Service service : services.getServices()) { if (service.getServiceName().equals(serviceName) && (service instanceof SharedService) || (service instanceof ExternalService)) { serviceFound = true; break; } } if(serviceFound){ try { ConfigSupport.apply(new SingleConfigCode<Services>() { public Object run(Services param) throws PropertyVetoException, TransactionFailure { ServiceRef serviceRef = param.createChild(ServiceRef.class); serviceRef.setApplicationName(appName); serviceRef.setServiceName(serviceName); param.getServiceRefs().add(serviceRef); return param; } }, services); } catch (TransactionFailure exception) { throw new RuntimeException(exception.getMessage(), exception); } }else{ throw new RuntimeException("no shared or external service by name ["+serviceName+"] found."); } }
static void setDTraceEnabled(MonitoringService ms, final String enabled, final ActionReport report) { try { ConfigSupport.apply(new SingleConfigCode<MonitoringService>() { public Object run(MonitoringService param) throws PropertyVetoException, TransactionFailure { param.setDtraceEnabled(enabled); return param; } }, ms); } catch(TransactionFailure tfe) { report.setMessage(localStrings.getLocalString("disable.monitoring.exception", "Encountered exception while setting dtrace-enabled to false {0}", tfe.getMessage())); report.setActionExitCode(ActionReport.ExitCode.FAILURE); } }
static void setMBeanEnabled(MonitoringService ms, final String enabled, final ActionReport report) { try { ConfigSupport.apply(new SingleConfigCode<MonitoringService>() { public Object run(MonitoringService param) throws PropertyVetoException, TransactionFailure { param.setMbeanEnabled(enabled); return param; } }, ms); } catch(TransactionFailure tfe) { report.setMessage(localStrings.getLocalString("disable.monitoring.exception", "Encountered exception while setting mbean-enabled to false {0}", tfe.getMessage())); report.setActionExitCode(ActionReport.ExitCode.FAILURE); } }
static void setMonitoringEnabled(MonitoringService ms, final String enabled, final ActionReport report) { try { ConfigSupport.apply(new SingleConfigCode<MonitoringService>() { public Object run(MonitoringService param) throws PropertyVetoException, TransactionFailure { param.setMonitoringEnabled(enabled); return param; } }, ms); } catch(TransactionFailure tfe) { report.setMessage(localStrings.getLocalString("disable.monitoring.exception", "Encountered exception while setting monitoring-enabled to false {0}", tfe.getMessage())); report.setActionExitCode(ActionReport.ExitCode.FAILURE); } }
static void setMonitoringLevelX(MonitoringService ms, final String moduleName, final String level, final ActionReport report) { ModuleMonitoringLevels mmls = ms.getModuleMonitoringLevels(); //TODO: synchronize try { ConfigSupport.apply(new SingleConfigCode<ModuleMonitoringLevels>() { public Object run(ModuleMonitoringLevels param) throws PropertyVetoException, TransactionFailure { Dom dom = Dom.unwrap(param); String currentVal = dom.attribute(moduleName); if (currentVal == null) { valueUpdated.set(false); return null; } else { dom.attribute(moduleName, level); } return param; } }, mmls); } catch(TransactionFailure tfe) { valueUpdated.set(false); report.setMessage(localStrings.getLocalString("disable.monitoring.level", "Encountered exception {0} while setting monitoring level to OFF for {1}", tfe.getMessage(), moduleName)); report.setActionExitCode(ActionReport.ExitCode.FAILURE); } if (!valueUpdated.get()) { setContainerMonitoringLevel(ms, moduleName, level, report); } }
"GenericDeleteCommand.transaction_exception", "Exception while deleting the configuration {0} :{1}", child.getImplementation(), e.getMessage()); result.failure(logger, msg);
"Unable to create a new property for resource " + resource.getClass().getName() + ": " + x.getMessage(), new PropertyChangeEvent(resource, prop.getName(), null, prop.getValue()));
logger.warning(KernelLoggerInfo.configFailManagedJobConfig); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(e.getMessage());
static void setMonitoringLevel(MonitoringService ms, final String moduleName, final String level, final ActionReport report) { if (ms.getMonitoringLevel(moduleName) == null) { report.setMessage(localStrings.getLocalString("invalid.module", "Invalid module name {0}", moduleName)); report.setActionExitCode(ActionReport.ExitCode.FAILURE); } try { ConfigSupport.apply(new SingleConfigCode<MonitoringService>() { public Object run(MonitoringService param) throws PropertyVetoException, TransactionFailure { param.setMonitoringLevel(moduleName, level); return null; } }, ms); } catch (TransactionFailure tfe) { report.setMessage(localStrings.getLocalString("monitoring.config.exception", "Encountered exception {0} while setting monitoring level to {1} for {2}", tfe.getMessage(), level, moduleName)); report.setActionExitCode(ActionReport.ExitCode.FAILURE); } }
report.setActionExitCode(ExitCode.SUCCESS); } catch(TransactionFailure e) { String str = e.getMessage(); report.setMessage(localStrings.getLocalString("delete.threadpool" + ".failed", "Delete Thread Pool failed because of: ", str));
public ResourceStatus create(Resources resources, HashMap attributes, final Properties properties, String target) throws Exception { setAttributes(attributes); ResourceStatus validationStatus = isValid(resources); if(validationStatus.getStatus() == ResourceStatus.FAILURE){ return validationStatus; } try { ConfigSupport.apply(new SingleConfigCode<Resources>() { public Object run(Resources param) throws PropertyVetoException, TransactionFailure { return createResource(param, properties); } }, resources); } catch (TransactionFailure tfe) { String msg = localStrings.getLocalString( "create.jdbc.connection.pool.fail", "JDBC connection pool {0} create failed: {1}", jdbcconnectionpoolid, tfe.getMessage()); return new ResourceStatus(ResourceStatus.FAILURE, msg); } String msg = localStrings.getLocalString( "create.jdbc.connection.pool.success", "JDBC connection pool {0} created successfully", jdbcconnectionpoolid); return new ResourceStatus(ResourceStatus.SUCCESS, msg); }
report.setActionExitCode(ActionReport.ExitCode.SUCCESS); } catch (TransactionFailure e) { String str = e.getMessage(); String def = "Creation of: " + threadpool_id + "failed because of: " + str; String msg = localStrings.getLocalString("create.threadpool.failed", def, threadpool_id, str);
static boolean setContainerMonitoringLevel(MonitoringService ms, final String moduleName, final String level, final ActionReport report) { ContainerMonitoring cm = ms.getContainerMonitoring(moduleName); if (cm == null) { report.setActionExitCode(ActionReport.ExitCode.FAILURE); ActionReport.MessagePart part = report.getTopMessagePart().addChild(); part.setMessage(localStrings.getLocalString("invalid.module", "Invalid module name {0}", moduleName)); return false; } try { ConfigSupport.apply(new SingleConfigCode<ContainerMonitoring>() { public Object run(ContainerMonitoring param) throws PropertyVetoException, TransactionFailure { param.setLevel(level); return param; } }, cm); } catch(TransactionFailure tfe) { report.setMessage(localStrings.getLocalString("disable.monitoring.level", "Encountered exception {0} while setting monitoring level to OFF for {1}", tfe.getMessage(), moduleName)); report.setActionExitCode(ActionReport.ExitCode.FAILURE); } return true; } }
report.setActionExitCode(ExitCode.SUCCESS); } catch(TransactionFailure e) { String actual = e.getMessage(); report.setMessage(localStrings.getLocalString( "delete.iiop.listener.fail", "failed", listener_id, actual));