User: user57
Date: 01/04/17 13:33:43
Added: openjms/src/main/org/jboss/jms/openjms OpenJMSProvider.java
OpenJMSServerSessionPoolFactory.java package.html
Log:
o Migration of OpenJMS specific JBoss JMS provider classes from the
main 'jboss'.
NOTE: The migrated classes have been consolidated into one package.
Revision Changes Path
1.1
contrib/openjms/src/main/org/jboss/jms/openjms/OpenJMSProvider.java
Index: OpenJMSProvider.java
===================================================================
/**
* Copyright (c) 2000 Peter Antman Tim <[EMAIL PROTECTED]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.jboss.jms.openjms;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.jboss.logging.Logger;
import org.jboss.jms.jndi.AbstractJMSProviderAdapter;
/**
* A JMS provider adapter for <em>OpenJMS</em>.
*
* Created: Wed Nov 29 14:19:42 2000
*
* @author Peter Antman Tim ([EMAIL PROTECTED])
* @version
*/
public class OpenJMSProvider
extends AbstractJMSProviderAdapter
{
public static final String TOPIC_CONNECTION_FACTORY =
"JmsTopicConnectionFactory";
public static final String QUEUE_CONNECTION_FACTORY =
"JmsQueueConnectionFactory";
public static final String INITIAL_CONTEXT_FACTORY =
"org.exolab.jms.jndi.rmi.RmiJndiInitialContextFactory";
private static final String HOST_PROP_NAME =
"org.exolab.jms.jndi.Host";
private static final String PORT_PROP_NAME =
"org.exolab.jms.jndi.PortNumber";
private static final String SECURITY_MANAGER =
"java.naming.rmi.security.manager";
private String hasJndiSecurityManager = "yes";
public OpenJMSProvider() {
super(QUEUE_CONNECTION_FACTORY, TOPIC_CONNECTION_FACTORY);
}
public Context getInitialContext() throws NamingException {
// Have to parse url!!
Context context = null;
Hashtable props = new Hashtable();
props.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
props.put(HOST_PROP_NAME, "localhost");
Logger.debug("OpenJMSProvider: " + HOST_PROP_NAME + ":localhost");
props.put(PORT_PROP_NAME, new Integer(1199));
Logger.debug("OpenJMSProvider: " + PORT_PROP_NAME + 1199);
//props.put(Context.PROVIDER_URL, jndiProviderUrl);
props.put(SECURITY_MANAGER, hasJndiSecurityManager);
// props.put(Context.URL_PKG_PREFIXES, jndiPkgPrefixes);
return context = new InitialContext(props);
}
}
1.1
contrib/openjms/src/main/org/jboss/jms/openjms/OpenJMSServerSessionPoolFactory.java
Index: OpenJMSServerSessionPoolFactory.java
===================================================================
/*
* Copyright (c) 2000 Peter Antman Tim <[EMAIL PROTECTED]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.jboss.jms.openjms;
import java.util.Hashtable;
import javax.jms.Connection;
import javax.jms.MessageListener;
import javax.jms.ServerSessionPool;
import javax.jms.JMSException;
// Its in that package, but belongs to jboss ;-)
import org.exolab.jms.client.OpenJMSServerSessionPool;
import org.exolab.jms.client.JmsServerSessionPool;
import org.exolab.core.logger.LoggerIfc;
import org.exolab.core.logger.LogEventType;
import org.exolab.core.logger.LoggerFactory;
import org.jboss.logging.Logger;
import org.jboss.jms.asf.ServerSessionPoolFactory;
/**
* OpenJMSServerSessionPoolFactory.java
*
* Created: Wed Nov 29 16:01:04 2000
*
* @version <pre>$Id: OpenJMSServerSessionPoolFactory.java,v 1.1 2001/04/17 20:33:43
user57 Exp $</pre>
* @author Peter Antman Tim ([EMAIL PROTECTED])
*/
public class OpenJMSServerSessionPoolFactory
implements ServerSessionPoolFactory, java.io.Serializable
{
private Hashtable pools = new Hashtable();
private String name;
public OpenJMSServerSessionPoolFactory() {
// Set up their specific logging
try {
LoggerIfc logger = LoggerFactory.create(null, null);
LogEventType event = LogEventType.getLogEventType("debug");
if (event != null) {
logger.setLogLevel(event);
}
} catch(Exception ex) {
Logger.exception(ex);
throw new RuntimeException("Unable to OpenJMSServerSessionPool: "+ex);
}
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public ServerSessionPool getServerSessionPool(Connection con,
int maxSession,
boolean isTransacted,
int ack,
MessageListener listener)
throws JMSException
{
//
// This is probably basically fucked up. The ServerSessionPool in
// OpenJMS is a Singleton. Every one that uses it will end up in
// the same Connection and against the same messagelistener.
//
// We need a pool, but what should we key on, a guess the adress
// of the listener is the only really uniqe here
String key = listener.toString();// Or hash?
if (pools.containsKey(key)) {
return (ServerSessionPool)pools.get(key);
}
else {
// THis is fucking bully, have tp do it to get the classes to work
JmsServerSessionPool.init(15,listener);
ServerSessionPool pool = (ServerSessionPool)new
OpenJMSServerSessionPool(con, maxSession, isTransacted, ack, listener);
pools.put(key, pool);
return pool;
}
//JmsServerSessionPool.init(maxSession, listener);
//return JmsServerSessionPool.instance();
}
}
1.1 contrib/openjms/src/main/org/jboss/jms/openjms/package.html
Index: package.html
===================================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<!-- $Id: package.html,v 1.1 2001/04/17 20:33:43 user57 Exp $ -->
<!--
JBoss, the OpenSource EJB server.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-->
</head>
<body bgcolor="white">
<p>Provides integration support for using <em>OpenJMS</em> as a
JBoss JMS provider.</p>
<h2>Package Specification</h2>
<ul>
<li><a href="javascript: alert('not available')">Not Available</a>
</ul>
<h2>Related Documentation</h2>
<ul>
<li><a href="http://openjms.exolab.org/">OpenJMS Home Page</a>
</ul>
<h2>Package Status</h2>
<ul>
<li><font color="green"><b>STABLE</b></font>
</ul>
<h2>Todo</h2>
<ul>
<li>???
</ul>
<!-- Put @see and @since tags down here. -->
</body>
</html>
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development