1 23 package com.sun.enterprise.diagnostics; 24 import java.util.Iterator ; 25 import java.util.List ; 26 import java.util.ArrayList ; 27 28 29 35 public class ReportConfig { 36 37 private CLIOptions options; 39 40 private ReportTarget target; 42 43 private ExecutionContext context; 44 45 private List <ServiceConfig> configurations ; 47 48 51 public ReportConfig(CLIOptions cliOptions, ReportTarget target, 52 ExecutionContext context) throws DiagnosticException { 53 options = cliOptions; 54 this.target = target; 55 this.context = context; 56 initialize(); 57 } 58 59 63 public void addInstanceSpecificConfig(ServiceConfig config) { 64 if(config != null) { 65 configurations.add(config); 66 } 67 } 68 69 public void addInstanceConfigs(List <ServiceConfig> configs) { 70 if(configs != null) { 71 Iterator <ServiceConfig> iterator = configs.iterator(); 72 while(iterator.hasNext()) { 73 addInstanceSpecificConfig(iterator.next()); 74 } 75 } 76 } 77 78 public ServiceConfig getInstanceConfigByName(String name){ 79 ServiceConfig instanceConfig = null; 80 for(ServiceConfig config : configurations){ 81 if(config.getInstanceName().equalsIgnoreCase(name)){ 82 instanceConfig = config; 83 break; 84 } 85 } 86 return instanceConfig; 87 } 88 89 93 public ReportTarget getTarget() { 94 return target; 95 } 96 97 100 public CLIOptions getCLIOptions() { 101 return options; 102 } 103 104 107 public ExecutionContext getExecutionContext() { 108 return context; 109 } 110 115 public Iterator <ServiceConfig> getInstanceConfigurations() { 116 return configurations.iterator(); 117 } 118 119 public String toString() { 120 return options.toString() + target.toString() + 121 context.toString() + configurations; 122 } 123 private void initialize() { 124 configurations = new ArrayList (); 125 } 126 } 127 | Popular Tags |