1 22 package org.jboss.test.ws; 23 24 import java.net.URL ; 25 26 import javax.management.MBeanServerConnection ; 27 import javax.management.ObjectName ; 28 import javax.naming.InitialContext ; 29 import javax.naming.NamingException ; 30 31 37 public class JBossTestDeployer implements JBossWSTestDeployer 38 { 39 private static final String MAIN_DEPLOYER = "jboss.system:service=MainDeployer"; 40 41 public void deploy(URL url) throws Exception 42 { 43 MBeanServerConnection server = getServer(); 44 server.invoke(new ObjectName (MAIN_DEPLOYER), "deploy", new Object [] { url }, new String [] { "java.net.URL" }); 45 } 46 47 public void undeploy(URL url) throws Exception 48 { 49 MBeanServerConnection server = getServer(); 50 server.invoke(new ObjectName (MAIN_DEPLOYER), "undeploy", new Object [] { url }, new String [] { "java.net.URL" }); 51 } 52 53 private MBeanServerConnection getServer() throws NamingException 54 { 55 InitialContext iniCtx = new InitialContext (); 56 MBeanServerConnection server = (MBeanServerConnection )iniCtx.lookup("jmx/invoker/RMIAdaptor"); 57 return server; 58 } 59 } 60 | Popular Tags |