Source Code Cross Referenced for IxcRegistry.java in  » 6.0-JDK-Modules » j2me » javax » microedition » xlet » ixc » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » javax.microedition.xlet.ixc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)IxcRegistry.java	1.19 06/10/10
003:         *
004:         * Copyright  1990-2006 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation. 
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt). 
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA 
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions. 
025:         *
026:         */
027:
028:        package javax.microedition.xlet.ixc;
029:
030:        import java.lang.reflect.Method;
031:        import java.rmi.*;
032:        import java.rmi.registry.Registry;
033:        import java.util.Hashtable;
034:        import javax.microedition.xlet.XletContext;
035:
036:        /**
037:         * <code>IXCRegistry</code> is the bootstrap mechanism for obtaining
038:         * references to remote objects residing in other Xlets executing on
039:         * the same machine, but in separate classloaders.
040:         * 
041:         * <p>
042:         * Instances of <code>IXCRegistry</code> are never accessible via
043:         * <code>java.rmi.Naming</code> or
044:         * <code>java.rmi.registry.LocateRegistry</code> if RMI functionality
045:         * is implemented.
046:         *
047:         * @see java.rmi.Registry
048:         */
049:
050:        public abstract class IxcRegistry implements  Registry {
051:            /**
052:             * Creates the IxcRegistry instance.
053:             */
054:            protected IxcRegistry() {
055:            }
056:
057:            static boolean isPlatformChecked = false;
058:            static Method getRegistryImplMethod = null;
059:
060:            static String svmIxcRegistryName = "com.sun.xlet.ixc.IxcRegistryImpl";
061:            static String mvmIxcRegistryName = "com.sun.jumpimpl.ixc.JUMPIxcRegistryImpl";
062:
063:            /**
064:             * Returns the Inter-Xlet Communication registry.
065:             */
066:            public static IxcRegistry getRegistry(XletContext context) {
067:
068:                if (context == null)
069:                    throw new NullPointerException("XletContext is null");
070:
071:                if (getRegistryImplMethod == null) {
072:                    Class ixcRegistryImplClass = null;
073:                    try {
074:                        ixcRegistryImplClass = Class
075:                                .forName(svmIxcRegistryName);
076:                    } catch (Exception e) { // Not found, let's try MVM.
077:                    }
078:
079:                    if (ixcRegistryImplClass == null) {
080:                        try {
081:                            ixcRegistryImplClass = Class
082:                                    .forName(mvmIxcRegistryName);
083:                        } catch (Exception e) { // Problem.  ixcRegistryImplClass remains null.
084:                        }
085:                    }
086:
087:                    if (ixcRegistryImplClass == null) {
088:                        System.out.println("Fatal error in starting IXC: ");
089:                        System.out.println("Neither " + svmIxcRegistryName
090:                                + " or " + mvmIxcRegistryName + " is found.");
091:
092:                        return null;
093:                    }
094:
095:                    try {
096:                        getRegistryImplMethod = ixcRegistryImplClass
097:                                .getMethod(
098:                                        "getIxcRegistryImpl",
099:                                        new Class[] { javax.microedition.xlet.XletContext.class });
100:                    } catch (NoSuchMethodException nsme) {
101:                        nsme.printStackTrace();
102:                    } catch (SecurityException se) {
103:                        se.printStackTrace();
104:                    }
105:                }
106:
107:                try {
108:                    if (getRegistryImplMethod != null) {
109:                        return (IxcRegistry) getRegistryImplMethod.invoke(null,
110:                                new Object[] { context });
111:                    }
112:                } catch (Exception e) {
113:                    e.printStackTrace();
114:                }
115:
116:                return null;
117:            }
118:
119:            /**
120:             * Returns a reference, a stub, for the remote object associated
121:             * with the specified <code>name</code>.
122:             *
123:             * @param name a URL-formatted name for the remote object
124:             * @return a reference for a remote object
125:             * @exception NotBoundException if name is not currently bound
126:             * @exception StubException If a stub could not be generated
127:             */
128:
129:            public abstract Remote lookup(String name) throws StubException,
130:                    NotBoundException;
131:
132:            /**
133:             * Binds the specified <code>name</code> to a remote object.
134:             *
135:             * @param name a URL-formatted name for the remote object
136:             * @param obj a reference for the remote object (usually a stub)
137:             * @exception AlreadyBoundException if name is already bound
138:             * @exception MalformedURLException if the name is not an appropriately
139:             *  formatted URL
140:             * @exception RemoteException if registry could not be contacted
141:             */
142:            public abstract void bind(String name, Remote obj)
143:                    throws StubException, AlreadyBoundException;
144:
145:            /**
146:             * Destroys the binding for the specified name that is associated
147:             * with a remote object.
148:             *
149:             * @param name a URL-formatted name associated with a remote object
150:             * @exception NotBoundException if name is not currently bound
151:             */
152:            public abstract void unbind(String name) throws NotBoundException,
153:                    AccessException;
154:
155:            /** 
156:             * Rebinds the specified name to a new remote object. Any existing
157:             * binding for the name is replaced.
158:             *
159:             * @param name a URL-formatted name associated with the remote object
160:             * @param obj new remote object to associate with the name
161:             * @exception MalformedURLException if the name is not an appropriately
162:             *  formatted URL
163:             * @exception RemoteException if registry could not be contacted
164:             * @exception AccessException if this operation is not permitted (if
165:             * originating from a non-local host, for example)
166:             */
167:            public abstract void rebind(String name, Remote obj)
168:                    throws StubException, AccessException;
169:
170:            /**
171:             * Returns an array of the names bound in the registry.  The names are
172:             * URL-formatted strings. The array contains a snapshot of the names
173:             * present in the registry at the time of the call.
174:             *
175:             * @return an array of names (in the appropriate URL format) bound
176:             *  in the registry
177:             * @exception RemoteException if registry could not be contacted
178:             * @exception AccessException if this operation is not permitted (if
179:             * originating from a non-local host, for example)
180:             */
181:            public abstract String[] list();
182:
183:            /**
184:             * Removes the bindings for all remote objects currently exported by
185:             * the calling Xlet.
186:             */
187:            public abstract void unbindAll();
188:
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.