com/scalagent/kjoram/ConnectionFactory.java

00001 /*
00002  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
00003  * Copyright (C) 2001 - ScalAgent Distributed Technologies
00004  * Copyright (C) 1996 - Dyade
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or any later version.
00010  * 
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00019  * USA.
00020  *
00021  * Initial developer(s): Frederic Maistre (INRIA)
00022  * Contributor(s): Nicolas Tachker (ScalAgent)
00023  */
00024 package com.scalagent.kjoram;
00025 
00026 import java.util.Vector;
00027 import java.util.Hashtable;
00028 
00029 import com.scalagent.kjoram.excepts.JMSException;
00030 
00031 
00032 public abstract class ConnectionFactory
00033   extends com.scalagent.kjoram.admin.AdministeredObject
00034 {
00036   protected FactoryParameters params;
00037 
00038 
00045   public ConnectionFactory(String host, int port)
00046   {
00047     super(host + ":" + port);
00048     params = new FactoryParameters(host, port);
00049 
00050     if (JoramTracing.dbgClient)
00051       JoramTracing.log(JoramTracing.DEBUG, this + ": created.");
00052   }
00053 
00057   public ConnectionFactory()
00058   {}
00059 
00060 
00062   public String toString()
00063   {
00064     return "CF:" + params.getHost() + "-" + params.getPort();
00065   }
00066 
00067 
00074   public abstract Connection
00075                   createConnection(String name, String password)
00076                   throws JMSException;
00077 
00085   public Connection createConnection() throws JMSException
00086   {
00087     return createConnection("anonymous", "anonymous");
00088   }
00089 
00093   public FactoryParameters getParameters()
00094   {
00095     return params;
00096   } 
00097 
00098   public void setParameters(FactoryParameters params) {
00099     this.params = params;
00100   }
00101 
00106   public Hashtable code() {
00107     Hashtable h = super.code();
00108     h.put("host",params.getHost());
00109     h.put("port",new Integer(params.getPort()));
00110     h.put("connectingTimer",new Integer(params.connectingTimer));
00111     h.put("txPendingTimer",new Integer(params.txPendingTimer));
00112     h.put("cnxPendingTimer",new Integer(params.soapCnxPendingTimer));
00113     return h;
00114   }
00115 
00116   public static Object decode(Hashtable h) {
00117     return null;
00118   }
00119 }

Generated on Tue Sep 16 16:14:23 2008 for joram by  doxygen 1.5.0