private void createConfigElement(final String configElement) { try { ConfigSupport.apply(new SingleConfigCode<MonitoringService>() { public Object run(MonitoringService param) throws PropertyVetoException, TransactionFailure { ContainerMonitoring newItem = param.createChild(ContainerMonitoring.class); newItem.setName(configElement); param.getContainerMonitoring().add(newItem); return newItem; } }, monitoringService); } catch (TransactionFailure tf) { String msg = localStrings.getLocalString(cannotCreateConfigElement, "Unable to create container-monitoring for", configElement); logger.log(Level.SEVERE, msg, tf); } }
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); } }
private void createConfig(ActionReport report) { Services services = serviceUtil.getServices(); try { if (ConfigSupport.apply(new SingleConfigCode<Services>() { public Object run(Services param) throws PropertyVetoException, TransactionFailure { SharedService sharedService = param.createChild(SharedService.class); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage("Unable to create shared service"); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage("Unable to create shared service [" + serviceName + "] due to : " + e.getMessage()); report.setFailureCause(e);
if (v==null) { try { v = (Virtualizations) ConfigSupport.apply(new SingleConfigCode<Domain>() { @Override public Object run(Domain wDomain) throws PropertyVetoException, TransactionFailure { if (virtualization.getName().equals("Native")) { context.getActionReport().setActionExitCode(ActionReport.ExitCode.WARNING); context.getActionReport().setActionDescription("Configuration already present in the domain.xml"); return;
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); } }
if (proxy==null) { try { proxy = type.cast(ConfigSupport.apply(new SingleConfigCode<Domain>() { @Override public Object run(Domain writeableDomain) throws PropertyVetoException, TransactionFailure { String msg = localStrings.getLocalString(TypeResolver.class, "TypeResolver.target_object_not_found", "Cannot find a single component instance of type {0}", type.getSimpleName());
if (managedJobConfig == null ) { logger.warning(KernelLoggerInfo.getFailManagedJobConfig); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(KernelLoggerInfo.getLogger().getResourceBundle().getString(KernelLoggerInfo.getFailManagedJobConfig)); return; ConfigSupport.apply(new SingleConfigCode<ManagedJobConfig>() { report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(e.getMessage());
found=true; try { if (ConfigSupport.apply(new SingleConfigCode<ServiceProvisioningEngines>() { public Object run(ServiceProvisioningEngines param) throws PropertyVetoException, TransactionFailure { param.getServiceProvisioningEngines().remove(serviceProvisioningEngine); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setFailureCause(new RuntimeException("No service-provisioning-engine by name [" + classname + "] is available")); return;
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); } }
if (proxy==null) { try { proxy = type.cast(ConfigSupport.apply(new SingleConfigCode<Domain>() { @Override public Object run(Domain writeableDomain) throws PropertyVetoException, TransactionFailure { String msg = localStrings.getLocalString(TypeResolver.class, "TypeResolver.target_object_not_found", "Cannot find a single component instance of type {0}", type.getSimpleName());
actionReport.setMessage("Either dataSourceLookupName or executorServiceLookupName must be specified."); actionReport.setActionExitCode(ActionReport.ExitCode.FAILURE); return; ConfigSupport.apply(new SingleConfigCode<BatchRuntimeConfiguration>() { @Override public Object run(final BatchRuntimeConfiguration batchRuntimeConfigurationProxy) actionReport.setMessage(txfEx.getCause().getMessage()); actionReport.setActionExitCode(ActionReport.ExitCode.FAILURE); return;
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); } }
ZipEntry domEnt = templatezip.getEntry("config/domain.xml"); if (domEnt == null) { throw new RuntimeException(localStrings.getLocalString( "DefaultConfigUpgrade.cannotGetDomainXmlTemplate", "DefaultConfigUpgrade failed. Cannot get default domain.xml from {0)", ConfigSupport.apply(new MinDefaultConfigCode(), configs); defaultConfig = configs.getConfigByName(DEFAULT_CONFIG); Level.SEVERE, defaultConfigUpgradeFailure, ex); } catch (IOException ex) { throw new RuntimeException(localStrings.getLocalString( "DefaultConfigUpgrade.cannotGetDomainXmlTemplate", "DefaultConfigUpgrade failed. Cannot get default domain.xml from {0)",
serviceUtil.getApplicationsUsingService(service.getServiceName()); if(applicationsUsingService.size() > 0){ report.setMessage("The external service [" + serviceName + "] is " + "used by an application [" + applicationsUsingService.get(0) + "]."); report.setActionExitCode(ActionReport.ExitCode.FAILURE); return; if (ConfigSupport.apply(new SingleConfigCode<Services>() { public Object run(Services param) throws PropertyVetoException, TransactionFailure { param.getServices().remove(service); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage("Deleting external-service [" + serviceName + "] failed : " + e.getMessage()); report.setFailureCause(e); return; report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage("No external-service by name [" + serviceName + "] is available");
report.setMessage(localStrings.getLocalString( "delete.audit.module.notfound", "Specified Audit Module {0} not found", auditModuleName)); report.setActionExitCode(ActionReport.ExitCode.FAILURE); return; ConfigSupport.apply(new SingleConfigCode<SecurityService>() { public Object run(SecurityService param) throws PropertyVetoException, TransactionFailure { report.setMessage(localStrings.getLocalString( "delete.audit.module.fail", "Deletion of Audit Module {0} failed", auditModuleName)); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setFailureCause(e); report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
String msg = localStrings.getLocalString(GenericDeleteCommand.class, "TypeAndNameResolver.target_object_not_found", "Cannot find a {0} with a name {1}", targetType.getSimpleName(), name); ConfigSupport.apply(new SingleConfigCode<ConfigBeanProxy>() { @Override public Object run(ConfigBeanProxy parentProxy) throws PropertyVetoException, TransactionFailure { String msg = localStrings.getLocalString(GenericCrudCommand.class, "GenericDeleteCommand.transaction_exception", "Exception while deleting the configuration {0} :{1}",
@Override public void execute(AdminCommandContext context) { ActionReport ar = context.getActionReport(); if (virtualizations==null) { ar.failure(RuntimeContext.logger, "No virtualization configuration found"); return; } for (final Virtualization v : virtualizations.getVirtualizations()) { if (v.getName().equals(name)) { try { ConfigSupport.apply(new SingleConfigCode<Virtualizations>() { @Override public Object run(Virtualizations wVirts) throws PropertyVetoException, TransactionFailure { wVirts.getVirtualizations().remove(v); return null; } }, virtualizations); } catch (TransactionFailure transactionFailure) { ar.failure(RuntimeContext.logger, "Cannot delete " + name + " virtualization config", transactionFailure); } ar.setActionExitCode(ActionReport.ExitCode.SUCCESS); ar.setMessage("Configuration deleted successfully"); return; } } ar.failure(RuntimeContext.logger, "Cannot find virtualization configuration named " + name); } }
/** * Executes the command with the command parameters passed as Properties * where the keys are the paramter names and the values the parameter values * * @param context information */ public void execute(AdminCommandContext context) { final ActionReport report = context.getActionReport(); try { ConfigSupport.apply(new SingleConfigCode<JavaConfig>() { public Object run(JavaConfig param) throws PropertyVetoException, TransactionFailure { if (param.getProfiler() != null) { param.setProfiler(null); report.setActionExitCode(ActionReport.ExitCode.SUCCESS); return param; } // not found report.setMessage(localStrings.getLocalString("delete.profiler.notfound", "delete failed, profiler not found")); report.setActionExitCode(ActionReport.ExitCode.FAILURE); return null; } }, javaConfig); } catch(TransactionFailure e) { report.setMessage(localStrings.getLocalString("delete.profiler.fail", "delete failed ")); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setFailureCause(e); } } }
String msg = localStrings.getLocalString(GenericCrudCommand.class, "GenericCreateCommand.target_object_not_found", "The CrudResolver {0} could not find the configuration object of type {1} where instances of {2} should be added", ConfigSupport.apply(new SingleConfigCode<ConfigBeanProxy> () { @Override public Object run(ConfigBeanProxy writableParent) throws PropertyVetoException, TransactionFailure { String msg = localStrings.getLocalString(GenericCrudCommand.class, "GenericCreateCommand.transaction_exception", "Exception while adding the new configuration : {0} ",
report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage("A paas-enabled application with name [ "+archive.getName()+" ] is already deployed."); return; if (ConfigSupport.apply(new SingleConfigCode<PaasApplications>() { public Object run(PaasApplications paasApplications) throws PropertyVetoException, TransactionFailure { PaasApplication paasApplication = paasApplications.createChild(PaasApplication.class);