Source Code Cross Referenced for LinkRef.java in  » 6.0-JDK-Core » naming » javax » naming » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » naming » javax.naming 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 1999-2004 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        package javax.naming;
027
028        /**
029         * This class represents a Reference whose contents is a name, called the link name,
030         * that is bound to an atomic name in a context. 
031         *<p>
032         * The name is a URL, or a name to be resolved relative to the initial
033         * context, or if the first character of the name is ".", the name
034         * is relative to the context in which the link is bound.
035         *<p>
036         * Normal resolution of names in context operations always follow links.
037         * Resolution of the link name itself may cause resolution to pass through
038         * other  links. This gives rise to the possibility of a cycle of links whose
039         * resolution could not terminate normally. As a simple means to avoid such
040         * non-terminating resolutions, service providers may define limits on the
041         * number of links that may be involved in any single operation invoked
042         * by the caller.
043         *<p>
044         * A LinkRef contains a single StringRefAddr, whose type is "LinkAddress",
045         * and whose contents is the link name. The class name field of the
046         * Reference is that of this (LinkRef) class.
047         *<p>
048         * LinkRef is bound to a name using the normal Context.bind()/rebind(), and
049         * DirContext.bind()/rebind(). Context.lookupLink() is used to retrieve the link
050         * itself if the terminal atomic name is bound to a link.
051         *<p>
052         * Many naming systems support a native notion of link that may be used
053         * within the naming system itself. JNDI does not specify whether
054         * there is any relationship between such native links and JNDI links.
055         *<p>
056         * A LinkRef instance is not synchronized against concurrent access by multiple
057         * threads. Threads that need to access a LinkRef instance concurrently should
058         * synchronize amongst themselves and provide the necessary locking.
059         *
060         * @author Rosanna Lee
061         * @author Scott Seligman
062         * @version 1.7 03/12/19
063         *
064         * @see LinkException
065         * @see LinkLoopException
066         * @see MalformedLinkException
067         * @see Context#lookupLink
068         * @since 1.3
069         */
070
071        /*<p>
072         * The serialized form of a LinkRef object consists of the serialized
073         * fields of its Reference superclass.
074         */
075
076        public class LinkRef extends Reference {
077            /* code for link handling */
078            static final String linkClassName = LinkRef.class.getName();
079            static final String linkAddrType = "LinkAddress";
080
081            /**
082             * Constructs a LinkRef for a name.
083             * @param linkName The non-null name for which to create this link.
084             */
085            public LinkRef(Name linkName) {
086                super (linkClassName, new StringRefAddr(linkAddrType, linkName
087                        .toString()));
088            }
089
090            /**
091             * Constructs a LinkRef for a string name.
092             * @param linkName The non-null name for which to create this link.
093             */
094            public LinkRef(String linkName) {
095                super (linkClassName, new StringRefAddr(linkAddrType, linkName));
096            }
097
098            /**
099             * Retrieves the name of this link.
100             * 
101             * @return The non-null name of this link.
102             * @exception MalformedLinkException If a link name could not be extracted
103             * @exception NamingException If a naming exception was encountered.
104             */
105            public String getLinkName() throws NamingException {
106                if (className != null && className.equals(linkClassName)) {
107                    RefAddr addr = get(linkAddrType);
108                    if (addr != null && addr instanceof  StringRefAddr) {
109                        return (String) ((StringRefAddr) addr).getContent();
110                    }
111                }
112                throw new MalformedLinkException();
113            }
114
115            /**
116             * Use serialVersionUID from JNDI 1.1.1 for interoperability
117             */
118            private static final long serialVersionUID = -5386290613498931298L;
119        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.