User: chirino
Date: 01/07/10 19:28:34
Added: src/main/org/jbossmq/il ClientIL.java ClientILService.java
ServerIL.java ServerILFactory.java
ServerILJMXService.java
ServerILJMXServiceMBean.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/ClientIL.java
Index: ClientIL.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jbossmq.il;
import org.jbossmq.ReceiveRequest;
import org.jbossmq.SpyDestination;
/**
* This interface defines the methods that the server can make
* asynchronouly to a client. (ie. to deliver messages)
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @author Norbert Lataille ([EMAIL PROTECTED])
*
* @version $Revision: 1.1 $
*/
public interface ClientIL
{
//One TemporaryDestination has been deleted
public void deleteTemporaryDestination(SpyDestination dest) throws Exception;
//The connection is closed
public void close() throws Exception;
//A message has arrived for the Connection
public void receive(ReceiveRequest messages[]) throws Exception;
}
1.1 jbossmq/src/main/org/jbossmq/il/ClientILService.java
Index: ClientILService.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jbossmq.il;
import org.jbossmq.Connection;
/**
* This class manages the lifecycle of an instance of the ClientIL
*
* Implementations of this class should have a default constructor.
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public interface ClientILService {
/**
* After construction, the ClientILService is initialized with
* a reference to the Connection object and the connection properties.
*
*/
public void init(Connection connection, java.util.Properties props) throws
Exception;
/**
* After initialization, this method may be called to obtain
* a reference to a ClientIL object. This object will
* eventually be serialized and sent to the server so that he
* can invoke methods on connection it was initialized with.
*
*/
public ClientIL getClientIL() throws Exception;
/**
* Once started, the ClientIL instance should process all server requests.
*
*/
public void start() throws Exception;
/**
* Once stopped, the ClientIL instance stop processing all server requests.
*
if( cr_server != null )
cr_server.close();
if (cr!=null && cr instanceof java.rmi.Remote) {
java.rmi.server.UnicastRemoteObject.unexportObject((java.rmi.Remote)cr, true);
}
*/
public void stop() throws Exception;
}
1.1 jbossmq/src/main/org/jbossmq/il/ServerIL.java
Index: ServerIL.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jbossmq.il;
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;
/**
* Defines the methods that can be called by a client on
* the server.
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @author Norbert Lataille ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public interface ServerIL {
public String getID() throws Exception;
public TemporaryTopic getTemporaryTopic(ConnectionToken dc) throws Exception;
public TemporaryQueue getTemporaryQueue(ConnectionToken dc) throws Exception;
public void connectionClosing(ConnectionToken dc) throws Exception;
public void checkID(String ID) throws Exception;
public void addMessage(ConnectionToken dc, SpyMessage message) throws
Exception;
public Queue createQueue(ConnectionToken dc, String dest) throws Exception;
public Topic createTopic(ConnectionToken dc, String dest) throws Exception;
public void deleteTemporaryDestination(ConnectionToken dc, SpyDestination
dest) throws Exception;
public void transact(ConnectionToken dc, TransactionRequest t) 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 setConnectionToken(org.jbossmq.ConnectionToken newConnectionToken)
throws java.lang.Exception;
public void subscribe(org.jbossmq.ConnectionToken dc, org.jbossmq.Subscription
s) throws java.lang.Exception;
public ServerIL cloneServerIL() throws Exception;
}
1.1 jbossmq/src/main/org/jbossmq/il/ServerILFactory.java
Index: ServerILFactory.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jbossmq.il;
import java.util.Properties;
/**
* This interface is used to define a factory to
* produce ServerIL objects. This is used by the
* client in the GenericConnectionFactory class.
*
* Implementations should provide a default constructor.
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public interface ServerILFactory {
// init is called before any calls are made to getServerIL()
public void init(Properties props) throws Exception;
// must return a instance of ServerIL or else throw an Exception.
public ServerIL getServerIL() throws Exception;
}
1.1 jbossmq/src/main/org/jbossmq/il/ServerILJMXService.java
Index: ServerILJMXService.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jbossmq.il;
import java.util.Properties;
import javax.naming.InitialContext;
import javax.management.*;
import org.jboss.util.ServiceMBeanSupport;
import org.jbossmq.SpyXAConnectionFactory;
import org.jbossmq.GenericConnectionFactory;
import org.jbossmq.SpyConnectionFactory;
import org.jbossmq.server.JMSServer;
/**
* This abstract class handles life cycle managment of the ServeIL.
* Should be extended to provide a full implementation.
*
* @author Hiram Chirino ([EMAIL PROTECTED])
*
* @version $Revision: 1.1 $
*/
abstract public class ServerILJMXService extends ServiceMBeanSupport implements
ServerILJMXServiceMBean, MBeanRegistration {
private String connectionFactoryJNDIRef;
private String xaConnectionFactoryJNDIRef;
/**
* @returns Properties contains all the parameters needed to create a
connection from the client to this IL
*/
abstract public Properties getClientConnectionProperties();
/**
* @returns ServerIL An instance of the Server IL, used for
*/
abstract public ServerIL getServerIL();
/**
* Binds the connection factories for this IL
* @throws javax.naming.NamingException it cannot be unbound
*/
public void bindJNDIReferences() throws javax.naming.NamingException {
GenericConnectionFactory gcf= new
GenericConnectionFactory(getServerIL(), getClientConnectionProperties());
SpyConnectionFactory scf= new SpyConnectionFactory(gcf);
SpyXAConnectionFactory sxacf= new SpyXAConnectionFactory(gcf);
// Get an InitialContext
InitialContext ctx= new InitialContext();
ctx.bind(connectionFactoryJNDIRef, scf);
ctx.bind(xaConnectionFactoryJNDIRef, sxacf);
}
/**
* Unbinds the connection factories for this IL
* @throws javax.naming.NamingException it cannot be unbound
*/
public void unbindJNDIReferences() throws javax.naming.NamingException {
// Get an InitialContext
InitialContext ctx= new InitialContext();
ctx.unbind(connectionFactoryJNDIRef);
ctx.unbind(xaConnectionFactoryJNDIRef);
}
/**
* @param finds the JMSServer instance via JNDI
* @throws javax.naming.NamingException if the server is not found
*/
public JMSServer lookupJMSServer() throws Exception {
return (JMSServer)getServer().invoke(new
ObjectName(org.jbossmq.server.JBossMQServiceMBean.OBJECT_NAME), "getJMSServer", new
Object[] {}, new String[] {} );
}
/**
* @return java.lang.String the JNDI reference where the connection factory
should be bound to
*/
public java.lang.String getConnectionFactoryJNDIRef() {
return connectionFactoryJNDIRef;
}
/**
* @return java.lang.String the JNDI reference where the xa connection factory
should be bound to
*/
public java.lang.String getXAConnectionFactoryJNDIRef() {
return xaConnectionFactoryJNDIRef;
}
/**
* @param newConnectionFactoryJNDIRef the JNDI reference where the connection
factory should be bound to
*/
public void setConnectionFactoryJNDIRef(java.lang.String
newConnectionFactoryJNDIRef) {
connectionFactoryJNDIRef= newConnectionFactoryJNDIRef;
}
/**
* @param newXaConnectionFactoryJNDIRef java.lang.String the JNDI reference
where the xa connection factory should be bound to
*/
public void setXAConnectionFactoryJNDIRef(java.lang.String
newXaConnectionFactoryJNDIRef) {
xaConnectionFactoryJNDIRef= newXaConnectionFactoryJNDIRef;
}
}
1.1 jbossmq/src/main/org/jbossmq/il/ServerILJMXServiceMBean.java
Index: ServerILJMXServiceMBean.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jbossmq.il;
import java.lang.Object;
/**
* This interface is used to define which methods will be exposed
* via JMX.
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public interface ServerILJMXServiceMBean extends org.jboss.util.ServiceMBean
{
/**
* @return java.lang.String the JNDI reference where the connection factory
should be bound to
*/
public java.lang.String getConnectionFactoryJNDIRef();
/**
* @param newConnectionFactoryJNDIRef the JNDI reference where the connection
factory should be bound to
*/
public void setConnectionFactoryJNDIRef(java.lang.String
newConnectionFactoryJNDIRef);
/**
* @param newXaConnectionFactoryJNDIRef java.lang.String the JNDI reference
where the xa connection factory should be bound to
*/
public void setXAConnectionFactoryJNDIRef(java.lang.String
newXaConnectionFactoryJNDIRef);
/**
* @return java.lang.String the JNDI reference where the xa connection factory
should be bound to
*/
public java.lang.String getXAConnectionFactoryJNDIRef();
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development