1 package hero.util; 2 3 31 32 import java.util.List ; 33 34 import javax.management.MBeanServer ; 35 import javax.management.MBeanServerFactory ; 36 import javax.management.ObjectName ; 37 38 public class BonitaConfig { 39 40 private ObjectName config; 41 private MBeanServer server; 42 private static BonitaConfig bc = null; 44 public BonitaConfig() throws HeroException{ 45 try{ 46 config = new ObjectName ("jonas:type=service,name=BonitaConfigService"); 47 List list = MBeanServerFactory.findMBeanServer(null); 48 server = (MBeanServer ) list.iterator().next(); 49 } catch (Exception e) {e.printStackTrace(); 50 throw new HeroException(e.getMessage()); 51 } 52 } 53 54 public static BonitaConfig getInstance() throws HeroException{ 55 if ( bc == null) { 56 bc = new BonitaConfig(); 57 } 58 return bc; 59 } 60 61 public boolean getProcessJMS(String projectName) throws HeroException 62 { 63 70 return true; 71 } 72 73 public boolean getProcessLog(String projectName) throws HeroException 74 { 75 82 return true; 83 } 84 85 public boolean getProcessTrace(String projectName) throws HeroException 86 { 87 94 return true; 95 } 96 97 public String getPocessLogLevel(String projectName) throws HeroException 98 { 99 106 return hero.interfaces.Constants.DEBUG; 107 } 108 109 public String getPocessTraceLevel(String projectName) throws HeroException 110 { 111 118 return hero.interfaces.Constants.DEBUG; 119 } 120 121 public String getPocessHistoric(String projectName) throws HeroException 122 { 123 130 return hero.interfaces.Constants.TRANSFER; 131 } 132 133 public void updateJMS(boolean jms) throws HeroException 134 { 135 try { 136 server.invoke(config, "updateJMS", new Object [] {new Boolean (jms)},new String [] {"boolean"}); 137 } catch (Exception e) { 138 throw new HeroException(e.getMessage()); 139 } 140 } 141 142 } | Popular Tags |