KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jaxr > JAXRConnection


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Initial developer(s): Guillaume Sauthier
22  * --------------------------------------------------------------------------
23  * $Id: JAXRConnection.java,v 1.1 2004/07/29 11:05:21 sauthieg Exp $
24  * --------------------------------------------------------------------------
25  */

26 package org.objectweb.jonas.jaxr;
27
28 import java.io.Serializable JavaDoc;
29 import java.util.Properties JavaDoc;
30
31 import javax.naming.BinaryRefAddr JavaDoc;
32 import javax.naming.NamingException JavaDoc;
33 import javax.naming.Reference JavaDoc;
34 import javax.naming.Referenceable JavaDoc;
35
36 import org.objectweb.jonas.common.JNDIUtils;
37 import org.objectweb.jonas.jaxr.factory.JAXRFactory;
38
39
40 /**
41  * Represents a JAXR Connectionfactory bound in Registry.
42  * @author Guillaume Sauthier
43  */

44 public class JAXRConnection implements Referenceable JavaDoc, Serializable JavaDoc {
45
46     /**
47      * Internal properties
48      */

49     private Properties JavaDoc p;
50
51     /**
52      * Constructs a JAXRConnection instance.
53      * @param p properties used to configure connection
54      */

55     public JAXRConnection(Properties JavaDoc p) {
56         this.p = p;
57     }
58
59     /**
60      * @see javax.naming.Referenceable#getReference()
61      */

62     public Reference JavaDoc getReference() throws NamingException JavaDoc {
63
64         // create new Reference using javax.xml.registry.ConnectionFactory Type
65
// and our own Factory
66
Reference JavaDoc ref = new Reference JavaDoc(JAXRFactory.FACTORY_TYPE, JAXRFactory.class.getName(), null);
67
68         // store configuration properties
69
ref.add(new BinaryRefAddr JavaDoc(JAXRFactory.PROPS_NAME, JNDIUtils.getBytesFromObject(p)));
70
71         // return the instance
72
return ref;
73     }
74
75 }
76
Popular Tags