User: oberg
Date: 00/05/19 00:11:59
Added: src/main/org/jboss/jmx/client Deployer.java Stop.java
Log:
Prefixed deployment classes with Jaws and jBoss
Added server-side JMX RMI Adaptor
Added shorthand JMX commands for deploy and stop of server
Added read-only functionality to JAWS
Revision Changes Path
1.1 jboss/src/main/org/jboss/jmx/client/Deployer.java
Index: Deployer.java
===================================================================
/*
* jBoss, the OpenSource EJB server
*
* Distributable under GPL license.
* See terms of license at gnu.org.
*/
package org.jboss.jmx.client;
import java.io.File;
import java.net.URL;
import javax.management.ObjectName;
import javax.naming.InitialContext;
import org.jboss.jmx.interfaces.JMXAdaptor;
/**
* <description>
*
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public class Deployer
{
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
public static void main(String[] args)
throws Exception
{
System.out.println("Deploying " + args[0]);
new Deployer().deploy(args[0]);
System.out.println(args[0] + " has been deployed successfully");
}
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
public void deploy(String url)
throws Exception
{
ObjectName containerFactory = new
ObjectName("EJB:service=ContainerFactory");
URL deploymentUrl;
if (new File(url).exists())
deploymentUrl = new File(url).toURL();
else
deploymentUrl = new URL(url);
JMXAdaptor server = (JMXAdaptor)new InitialContext().lookup("jmx");
server.invoke(containerFactory,
"deploy",
new Object[] {
deploymentUrl.toString() },
new String[] { "java.lang.String" });
}
// Protected -----------------------------------------------------
}
1.1 jboss/src/main/org/jboss/jmx/client/Stop.java
Index: Stop.java
===================================================================
/*
* jBoss, the OpenSource EJB server
*
* Distributable under GPL license.
* See terms of license at gnu.org.
*/
package org.jboss.jmx.client;
import java.util.Iterator;
import javax.management.ObjectInstance;
import javax.naming.InitialContext;
import org.jboss.jmx.interfaces.JMXAdaptor;
/**
* <description>
*
* @see <related>
* @author Rickard �berg ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public class Stop
{
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
public static void main(String[] args)
throws Exception
{
System.out.println("Stopping server");
new Stop().stop();
System.out.println("Server has been successfully stopped");
}
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
public void stop()
throws Exception
{
JMXAdaptor server = (JMXAdaptor)new InitialContext().lookup("jmx");
Iterator enum = server.queryMBeans(null, null).iterator();
while (enum.hasNext())
{
ObjectInstance oi = (ObjectInstance)enum.next();
try
{
server.invoke(oi.getObjectName(), "stop", new
Object[0], new String[0]);
} catch (Exception e)
{
// Ignore
}
}
}
// Protected -----------------------------------------------------
}