// Path: src/main/java/org/jminix/console/tool/StandaloneMiniConsole.java
// public class StandaloneMiniConsole
// {
//     private Component component=null;    
//     
//     /**
//      * @param port the listening HTTP port
//      */
//     public StandaloneMiniConsole(int port) {
//     	this(port, new MiniConsoleApplication());
//     }
//     
//     /**
//      * @param port the listening HTTP port
//      * @param the application object, if you want to create it by yourself.
//      */
//     public StandaloneMiniConsole(int port, MiniConsoleApplication application) {
//         // Create a new Component.
//         component = new Component();
//         component.getClients().add(Protocol.CLAP);
//         // Add a new HTTP server
//         component.getServers().add(Protocol.HTTP, port);
// 
//         // Attach the sample application.
//         component.getDefaultHost().attach(application);
// 
//         // Start the component.
//         try
//         {
//             component.start();
//         }
//         catch (Exception e)
//         {
//             throw new RuntimeException(e);
//         }
//     }
//     
//     /**
//      * Stops the Mini Console and frees the resources.
//      */
//     public void shutdown() {
//         try {
//             component.stop();
//         } catch(Exception e) {
//             throw new RuntimeException(e);
//         }
//     }
//     
//     /**
//      * Runs as main, mostly for test purposes...
//      * 
//      * @param args if present, first args is the port. Defaults to 8181.
//      */
//     public static void main(String[] args)
//     {
//         int port=8181;
//         if(args.length>0) {
//             port=new Integer(args[0]);
//         }
//         new StandaloneMiniConsole(port);
//     }
//     
//     public MiniConsoleApplication getApplication() {
//     	return (MiniConsoleApplication)component.getApplication();
//     }
// }


import java.lang.management.ManagementFactory;
import javax.management.InstanceAlreadyExistsException;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
import org.jminix.console.tool.StandaloneMiniConsole;

/* 
 * Copyright 2009 Laurent Bovet, Swiss Post IT <lbovet@jminix.org>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */

package org.jminix.console;




public class Main
{
    public final static void main(String[] args) throws MalformedObjectNameException, 
    InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {

        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        ObjectName name = new ObjectName("org.jminix.console:type=JMiniXStuff");
        mbs.registerMBean(new JMiniXStuff(), name);


// Path: src/main/java/org/jminix/console/tool/StandaloneMiniConsole.java
// public class StandaloneMiniConsole
// {
//     private Component component=null;    
//     
//     /**
//      * @param port the listening HTTP port
//      */
//     public StandaloneMiniConsole(int port) {
//     	this(port, new MiniConsoleApplication());
//     }
//     
//     /**
//      * @param port the listening HTTP port
//      * @param the application object, if you want to create it by yourself.
//      */
//     public StandaloneMiniConsole(int port, MiniConsoleApplication application) {
//         // Create a new Component.
//         component = new Component();
//         component.getClients().add(Protocol.CLAP);
//         // Add a new HTTP server
//         component.getServers().add(Protocol.HTTP, port);
// 
//         // Attach the sample application.
//         component.getDefaultHost().attach(application);
// 
//         // Start the component.
//         try
//         {
//             component.start();
//         }
//         catch (Exception e)
//         {
//             throw new RuntimeException(e);
//         }
//     }
//     
//     /**
//      * Stops the Mini Console and frees the resources.
//      */
//     public void shutdown() {
//         try {
//             component.stop();
//         } catch(Exception e) {
//             throw new RuntimeException(e);
//         }
//     }
//     
//     /**
//      * Runs as main, mostly for test purposes...
//      * 
//      * @param args if present, first args is the port. Defaults to 8181.
//      */
//     public static void main(String[] args)
//     {
//         int port=8181;
//         if(args.length>0) {
//             port=new Integer(args[0]);
//         }
//         new StandaloneMiniConsole(port);
//     }
//     
//     public MiniConsoleApplication getApplication() {
//     	return (MiniConsoleApplication)component.getApplication();
//     }
// }


// Path: src/test/java/org/jminix/console/Main.java
import java.lang.management.ManagementFactory;
import javax.management.InstanceAlreadyExistsException;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
import org.jminix.console.tool.StandaloneMiniConsole;

/* 
 * Copyright 2009 Laurent Bovet, Swiss Post IT <lbovet@jminix.org>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */

package org.jminix.console;




public class Main
{
    public final static void main(String[] args) throws MalformedObjectNameException, 
    InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException {

        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        ObjectName name = new ObjectName("org.jminix.console:type=JMiniXStuff");
        mbs.registerMBean(new JMiniXStuff(), name);


        new StandaloneMiniConsole(8088);
