User: chirino
Date: 01/07/10 19:28:34
Added: src/main/org/jbossmq/il/rmi RMIClientIL.java
RMIClientILRemote.java RMIClientILService.java
RMIServerIL.java RMIServerILRemote.java
RMIServerILService.java
RMIServerILServiceMBean.java
Log:
This is the il package which now holds interfaces that are more straitfoward to
understand
and implement. Under this package we place the other ils that have been implemented.
All the ILs are now MBeans and are managed though JMX.
Revision Changes Path
1.1 jbossmq/src/main/org/jbossmq/il/rmi/RMIClientIL.java
Index: RMIClientIL.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jbossmq.il.rmi;
import javax.jms.Destination;
import javax.jms.JMSException;
import org.jbossmq.ReceiveRequest;
import org.jbossmq.SpyDestination;
import org.jbossmq.Connection;
import org.jbossmq.il.ClientIL;
/**
* The RMI implementation of the ConnectionReceiver object
*
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
* @version $Revision: 1.1 $
*/
public class RMIClientIL extends java.rmi.server.UnicastRemoteObject implements
RMIClientILRemote {
// A reference to the connection
Connection connection;
// Are we running
boolean stopped= true;
RMIClientIL(Connection c) throws java.rmi.RemoteException {
connection= c;
}
public void close() throws Exception {
if (stopped)
throw new IllegalStateException("The client IL is stopped");
connection.asynchClose();
}
//One TemporaryDestination has been deleted
public void deleteTemporaryDestination(SpyDestination dest) throws
JMSException {
if (stopped)
throw new IllegalStateException("The client IL is stopped");
connection.asynchDeleteTemporaryDestination(dest);
}
public void receive(ReceiveRequest messages[]) throws Exception {
if (stopped)
throw new IllegalStateException("The client IL is stopped");
connection.asynchDeliver(messages);
}
}
1.1 jbossmq/src/main/org/jbossmq/il/rmi/RMIClientILRemote.java
Index: RMIClientILRemote.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jbossmq.il.rmi;
import javax.jms.Destination;
import javax.jms.JMSException;
import org.jbossmq.ReceiveRequest;
import org.jbossmq.SpyDestination;
import org.jbossmq.Connection;
import org.jbossmq.il.ClientIL;
/**
* The RMI implementation of the ConnectionReceiver object
*
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
* @version $Revision: 1.1 $
*/
public interface RMIClientILRemote extends ClientIL, java.rmi.Remote {
public void close() throws Exception;
//One TemporaryDestination has been deleted
public void deleteTemporaryDestination(SpyDestination dest) throws Exception;
public void receive(ReceiveRequest messages[]) throws Exception;
}
1.1 jbossmq/src/main/org/jbossmq/il/rmi/RMIClientILService.java
Index: RMIClientILService.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jbossmq.il.rmi;
import javax.jms.Destination;
import javax.jms.JMSException;
import org.jbossmq.ReceiveRequest;
import org.jbossmq.SpyDestination;
import org.jbossmq.Connection;
import org.jbossmq.il.ClientIL;
import org.jbossmq.il.ClientILService;
/**
* The RMI implementation of the ConnectionReceiver object
*
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
*
* @version $Revision: 1.1 $
*/
public class RMIClientILService implements org.jbossmq.il.ClientILService {
//the client IL
RMIClientIL clientIL;
/**
* getClientIL method comment.
*/
public org.jbossmq.il.ClientIL getClientIL() throws java.lang.Exception {
return clientIL;
}
/**
* init method comment.
*/
public void init(org.jbossmq.Connection connection, java.util.Properties
props) throws java.lang.Exception {
clientIL= new RMIClientIL(connection);
}
/**
* start method comment.
*/
public void start() throws java.lang.Exception {
clientIL.stopped= false;
}
/**
*
*/
public void stop() throws java.lang.Exception {
clientIL.stopped= false;
}
}
1.1 jbossmq/src/main/org/jbossmq/il/rmi/RMIServerIL.java
Index: RMIServerIL.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jbossmq.il.rmi;
import javax.jms.JMSException;
import javax.jms.Destination;
import javax.jms.Topic;
import javax.jms.Queue;
import javax.jms.TemporaryTopic;
import javax.jms.TemporaryQueue;
import org.jbossmq.TransactionRequest;
import org.jbossmq.SpyMessage;
import org.jbossmq.AcknowledgementRequest;
import org.jbossmq.SpyDestination;
import org.jbossmq.ConnectionToken;
import org.jbossmq.il.ServerIL;
import org.jbossmq.server.JMSServer;
/**
* The JVM implementation of the ServerIL object
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @author Norbert Lataille ([EMAIL PROTECTED])
*
* @version $Revision: 1.1 $
*/
public class RMIServerIL extends java.rmi.server.UnicastRemoteObject implements
RMIServerILRemote {
//The server implementation
transient private JMSServer server;
public RMIServerIL(JMSServer s) throws java.rmi.RemoteException {
server= s;
}
/**
* No need to clone because there are no instance variables tha can get
* clobbered. All Multiple connections can share the same JVMServerIL object
*/
public ServerIL cloneServerIL() {
return this;
}
public void setConnectionToken(ConnectionToken newConnectionToken) {
// We cannot try to cache the token since this IL is stateless
}
public String getID() throws JMSException {
return server.getID();
}
public void addMessage(ConnectionToken dc, SpyMessage val) throws JMSException
{
server.addMessage(dc, val);
}
public Topic createTopic(ConnectionToken dc, String dest) throws JMSException {
return server.createTopic(dc, dest);
}
public Queue createQueue(ConnectionToken dc, String dest) throws JMSException {
return server.createQueue(dc, dest);
}
public void deleteTemporaryDestination(ConnectionToken dc, SpyDestination
dest) throws JMSException {
server.deleteTemporaryDestination(dc, dest);
}
public void checkID(String ID) throws JMSException {
server.checkID(ID);
}
public void connectionClosing(ConnectionToken dc) throws JMSException {
server.connectionClosing(dc);
}
public TemporaryQueue getTemporaryQueue(ConnectionToken dc) throws
JMSException {
return server.getTemporaryQueue(dc);
}
public TemporaryTopic getTemporaryTopic(ConnectionToken dc) throws
JMSException {
return server.getTemporaryTopic(dc);
}
public void acknowledge(ConnectionToken dc, AcknowledgementRequest item)
throws Exception, java.rmi.RemoteException {
server.acknowledge(dc, item);
}
public SpyMessage[] browse(ConnectionToken dc, Destination dest, String
selector) throws Exception {
return server.browse(dc, dest, selector);
}
public void listenerChange(ConnectionToken dc, int subscriberId, boolean
state) throws Exception {
server.listenerChange(dc, subscriberId, state);
}
public SpyMessage receive(ConnectionToken dc, int subscriberId, long wait)
throws Exception {
return server.receive(dc, subscriberId, wait);
}
public void setEnabled(ConnectionToken dc, boolean enabled) throws Exception {
server.setEnabled(dc, enabled);
}
public void unsubscribe(ConnectionToken dc, int subscriptionId) throws
Exception {
server.unsubscribe(dc, subscriptionId);
}
public String checkUser(String userName, String password) throws JMSException {
return server.checkUser(userName, password);
}
public void subscribe(ConnectionToken dc, org.jbossmq.Subscription s) throws
Exception {
server.subscribe(dc, s);
}
public void transact(org.jbossmq.ConnectionToken dc, TransactionRequest t)
throws JMSException {
server.transact(dc, t);
}
}
1.1 jbossmq/src/main/org/jbossmq/il/rmi/RMIServerILRemote.java
Index: RMIServerILRemote.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jbossmq.il.rmi;
import javax.jms.JMSException;
import javax.jms.Destination;
import javax.jms.Topic;
import javax.jms.Queue;
import javax.jms.TemporaryTopic;
import javax.jms.TemporaryQueue;
import org.jbossmq.TransactionRequest;
import org.jbossmq.SpyMessage;
import org.jbossmq.AcknowledgementRequest;
import org.jbossmq.SpyDestination;
import org.jbossmq.ConnectionToken;
import org.jbossmq.il.ServerIL;
import org.jbossmq.server.JMSServer;
/**
* The JVM implementation of the ServerIL object
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @author Norbert Lataille ([EMAIL PROTECTED])
*
* @version $Revision: 1.1 $
*/
public interface RMIServerILRemote extends ServerIL, java.rmi.Remote {
public ServerIL cloneServerIL() throws Exception;
public void setConnectionToken(ConnectionToken newConnectionToken) throws
Exception;
public String getID() throws Exception;
public void addMessage(ConnectionToken dc, SpyMessage val) throws Exception;
public Topic createTopic(ConnectionToken dc, String dest) throws Exception;
public Queue createQueue(ConnectionToken dc, String dest) throws Exception;
public void deleteTemporaryDestination(ConnectionToken dc, SpyDestination
dest) throws Exception;
public void checkID(String ID) throws Exception;
public void connectionClosing(ConnectionToken dc) throws Exception;
public TemporaryQueue getTemporaryQueue(ConnectionToken dc) throws Exception;
public TemporaryTopic getTemporaryTopic(ConnectionToken dc) throws Exception;
public void acknowledge(ConnectionToken dc, AcknowledgementRequest item)
throws Exception;
public SpyMessage[] browse(ConnectionToken dc, Destination dest, String
selector) throws Exception;
public void listenerChange(ConnectionToken dc, int subscriberId, boolean
state) throws Exception;
public SpyMessage receive(ConnectionToken dc, int subscriberId, long wait)
throws Exception;
public void setEnabled(ConnectionToken dc, boolean enabled) throws Exception;
public void unsubscribe(ConnectionToken dc, int subscriptionId) throws
Exception;
public String checkUser(String userName, String password) throws Exception;
public void subscribe(ConnectionToken dc, org.jbossmq.Subscription s) throws
Exception;
public void transact(org.jbossmq.ConnectionToken dc, TransactionRequest t)
throws Exception;
}
1.1 jbossmq/src/main/org/jbossmq/il/rmi/RMIServerILService.java
Index: RMIServerILService.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jbossmq.il.rmi;
import java.util.Properties;
import javax.naming.InitialContext;
import javax.management.*;
import org.jboss.util.ServiceMBeanSupport;
import org.jbossmq.GenericConnectionFactory;
import org.jbossmq.il.ServerILJMXService;
import org.jbossmq.il.ServerIL;
import org.jbossmq.server.JMSServer;
/**
* Implements the ServerILJMXService which is used to
* manage the JVM IL.
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public class RMIServerILService extends ServerILJMXService implements
RMIServerILServiceMBean {
RMIServerIL serverIL;
/**
* Gives this JMX service a name.
*/
public String getName() {
return "JBossMQ-JVMServerIL";
}
/**
* Used to construct the GenericConnectionFactory (bindJNDIReferences() builds
it)
* @returns ServerIL the instance of this IL
*/
public ServerIL getServerIL() {
return serverIL;
}
/**
* Starts this IL, and binds it to JNDI
*/
public void startService() throws Exception {
serverIL= new RMIServerIL(lookupJMSServer());
bindJNDIReferences();
}
/**
* Stops this IL, and unbinds it from JNDI
*/
public void stopService() {
try {
unbindJNDIReferences();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Used to construct the GenericConnectionFactory (bindJNDIReferences() builds
it)
* Sets up the connection properties need by a client to use this
* IL
*/
public java.util.Properties getClientConnectionProperties() {
Properties rc= new Properties();
rc.setProperty(GenericConnectionFactory.CLIENT_IL_SERVICE_KEY,
"org.jbossmq.il.rmi.RMIClientILService");
return rc;
}
}
1.1 jbossmq/src/main/org/jbossmq/il/rmi/RMIServerILServiceMBean.java
Index: RMIServerILServiceMBean.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jbossmq.il.rmi;
import java.lang.Object;
/**
* This interface is used to define which methods will be exposed
* via JMX.
*/
public interface RMIServerILServiceMBean extends
org.jbossmq.il.ServerILJMXServiceMBean
{
public static final String OBJECT_NAME = "JBossMQ:service=RMIServerIL";
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development