mx4j/src/tools/mx4j/tools/remote/caucho/burlap BurlapCauchoInput.java,NONE,1.1 BurlapCauchoOutput.java,NONE,1.1 BurlapClientInvoker.java,NONE,1.1 BurlapConnector.java,NONE,1.1 BurlapConnectorServer.java,NONE,1.1 BurlapServlet.java,NONE,1.1

Simone Bordet <[email protected]>
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Update of /cvsroot/mx4j/mx4j/src/tools/mx4j/tools/remote/caucho/burlap
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24799/src/tools/mx4j/tools/remote/caucho/burlap

Added Files:
	BurlapCauchoInput.java BurlapCauchoOutput.java 
	BurlapClientInvoker.java BurlapConnector.java 
	BurlapConnectorServer.java BurlapServlet.java 
Log Message:
Implementation of the JSR 160 JMXConnector and JMXConnectorServer over Caucho's Hessian and Burlap protocols

--- NEW FILE: BurlapCauchoInput.java ---
/*
 * Copyright (C) MX4J.
 * All rights reserved.
 *
 * This software is distributed under the terms of the MX4J License version 1.0.
 * See the terms of the MX4J License in the documentation provided with this software.
 */

package mx4j.tools.remote.caucho.burlap;

import java.io.IOException;
import java.io.InputStream;

import com.caucho.burlap.io.BurlapInput;
import mx4j.tools.remote.caucho.CauchoInput;
import mx4j.tools.remote.caucho.serialization.JMXSerializerFactory;

/**
 * @author <a href="mailto:[email protected]">Simone Bordet</a>
 * @version $Revision: 1.1 $
 */
class BurlapCauchoInput implements CauchoInput
{
   private final BurlapInput input;

   BurlapCauchoInput(InputStream stream)
   {
      this.input = new BurlapInput();
      input.setSerializerFactory(new JMXSerializerFactory());
      input.init(stream);
   }

   public void startCall() throws IOException
   {
      input.readCall();
   }

   public void completeCall() throws IOException
   {
      input.completeCall();
   }

   public void startReply() throws Exception
   {
      try
      {
         input.startReply();
      }
      catch (Throwable x)
      {
         if (x instanceof Exception) throw (Exception)x;
         throw (Error)x;
      }
   }

   public void completeReply() throws IOException
   {
      input.completeReply();
   }

   public String readHeader() throws IOException
   {
      return input.readHeader();
   }

   public String readMethod() throws IOException
   {
      return input.readMethod();
   }

   public Object readObject(Class cls) throws IOException
   {
      return cls == null ? input.readObject() : input.readObject(cls);
   }
}

--- NEW FILE: BurlapConnector.java ---
/*
 * Copyright (C) MX4J.
 * All rights reserved.
 *
 * This software is distributed under the terms of the MX4J License version 1.0.
 * See the terms of the MX4J License in the documentation provided with this software.
 */

package mx4j.tools.remote.caucho.burlap;

import java.io.IOException;
import java.util.Map;
import javax.management.MBeanServerConnection;
import javax.management.remote.JMXServiceURL;
import javax.security.auth.Subject;

import mx4j.tools.remote.http.HTTPConnectionMBeanServerConnection;
import mx4j.tools.remote.http.HTTPConnector;

/**
 * @author <a href="mailto:[email protected]">Simone Bordet</a>
 * @version $Revision: 1.1 $
 */
public class BurlapConnector extends HTTPConnector
{
   public BurlapConnector(JMXServiceURL address, Map environment) throws IOException
   {
      super(address);
   }

   protected MBeanServerConnection doGetMBeanServerConnection(Subject delegate) throws IOException
   {
      return new HTTPConnectionMBeanServerConnection(getHTTPConnection(), delegate, getRemoteNotificationClientHandler());
   }
}

--- NEW FILE: BurlapClientInvoker.java ---
/*
 * Copyright (C) MX4J.
 * All rights reserved.
 *
 * This software is distributed under the terms of the MX4J License version 1.0.
 * See the terms of the MX4J License in the documentation provided with this software.
 */

package mx4j.tools.remote.caucho.burlap;

import java.io.InputStream;
import java.io.OutputStream;

import mx4j.tools.remote.caucho.CauchoClientInvoker;
import mx4j.tools.remote.caucho.CauchoInput;
import mx4j.tools.remote.caucho.CauchoOutput;

/**
 * @author <a href="mailto:[email protected]">Simone Bordet</a>
 * @version $Revision: 1.1 $
 */
public class BurlapClientInvoker extends CauchoClientInvoker
{
   public BurlapClientInvoker(String endpoint)
   {
      super(endpoint);
   }

   protected CauchoInput createCauchoInput(InputStream stream)
   {
      return new BurlapCauchoInput(stream);
   }

   protected CauchoOutput createCauchoOutput(OutputStream stream)
   {
      return new BurlapCauchoOutput(stream);
   }
}

--- NEW FILE: BurlapConnectorServer.java ---
/*
 * Copyright (C) MX4J.
 * All rights reserved.
 *
 * This software is distributed under the terms of the MX4J License version 1.0.
 * See the terms of the MX4J License in the documentation provided with this software.
 */

package mx4j.tools.remote.caucho.burlap;

import java.util.Map;
import javax.management.MBeanServer;
import javax.management.remote.JMXServiceURL;

import mx4j.tools.remote.AbstractJMXConnectorServer;
import mx4j.tools.remote.ConnectionManager;
import mx4j.tools.remote.http.HTTPConnectionManager;
import mx4j.tools.remote.http.HTTPConnectorServer;

/**
 * @author <a href="mailto:[email protected]">Simone Bordet</a>
 * @version $Revision: 1.1 $
 */
public class BurlapConnectorServer extends HTTPConnectorServer
{
   public BurlapConnectorServer(JMXServiceURL url, Map environment, MBeanServer server)
   {
      super(url, environment, server);
   }

   protected ConnectionManager createConnectionManager(AbstractJMXConnectorServer server, Map environment)
   {
      return new HTTPConnectionManager(server, "burlap", environment);
   }
}

--- NEW FILE: BurlapServlet.java ---
/*
 * Copyright (C) MX4J.
 * All rights reserved.
 *
 * This software is distributed under the terms of the MX4J License version 1.0.
 * See the terms of the MX4J License in the documentation provided with this software.
 */

package mx4j.tools.remote.caucho.burlap;

import java.io.InputStream;
import java.io.OutputStream;
import javax.servlet.ServletException;

import mx4j.tools.remote.caucho.CauchoInput;
import mx4j.tools.remote.caucho.CauchoOutput;
import mx4j.tools.remote.caucho.CauchoService;
import mx4j.tools.remote.caucho.CauchoServlet;

/**
 * @author <a href="mailto:[email protected]">Simone Bordet</a>
 * @version $
 */
public class BurlapServlet extends CauchoServlet
{
   private CauchoService service;

   public void init() throws ServletException
   {
      super.init();
      service = new CauchoService("burlap");
   }

   public void destroy()
   {
      this.service = null;
   }

   protected Object getService()
   {
      return service;
   }

   protected CauchoInput createCauchoInput(InputStream stream)
   {
      return new BurlapCauchoInput(stream);
   }

   protected CauchoOutput createCauchoOutput(OutputStream stream)
   {
      return new BurlapCauchoOutput(stream);
   }
}

--- NEW FILE: BurlapCauchoOutput.java ---
/*
 * Copyright (C) MX4J.
 * All rights reserved.
 *
 * This software is distributed under the terms of the MX4J License version 1.0.
 * See the terms of the MX4J License in the documentation provided with this software.
 */

package mx4j.tools.remote.caucho.burlap;

import java.io.IOException;
import java.io.OutputStream;

import com.caucho.burlap.io.BurlapOutput;
import mx4j.tools.remote.caucho.CauchoOutput;
import mx4j.tools.remote.caucho.serialization.JMXSerializerFactory;

/**
 * @author <a href="mailto:[email protected]">Simone Bordet</a>
 * @version $Revision: 1.1 $
 */
class BurlapCauchoOutput implements CauchoOutput
{
   private final BurlapOutput output;

   BurlapCauchoOutput(OutputStream stream)
   {
      this.output = new BurlapOutput();
      output.setSerializerFactory(new JMXSerializerFactory());
      output.init(stream);
   }

   public void startReply() throws IOException
   {
      output.startReply();
   }

   public void completeReply() throws IOException
   {
      output.completeReply();
   }

   public void startCall() throws IOException
   {
      output.startCall();
   }

   public void completeCall() throws IOException
   {
      output.completeCall();
   }

   public void writeHeader(String header) throws IOException
   {
      output.writeHeader(header);
   }

   public void writeMethod(String methodName) throws IOException
   {
      output.writeMethod(methodName);
   }

   public void writeObject(Object object) throws IOException
   {
      output.writeObject(object);
   }

   public void writeFault(Throwable fault) throws IOException
   {
      output.writeFault(fault.getClass().getName(), fault.getMessage(), fault);
   }
}



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.