Source Code Cross Referenced for NameManager.java in  » Collaboration » JacORB » org » jacorb » naming » namemanager » 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 » Collaboration » JacORB » org.jacorb.naming.namemanager 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *        JacORB - a free Java ORB
003:         *
004:         *   Copyright (C) 1997-2004 Gerald Brose.
005:         *
006:         *   This library is free software; you can redistribute it and/or
007:         *   modify it under the terms of the GNU Library General Public
008:         *   License as published by the Free Software Foundation; either
009:         *   version 2 of the License, or (at your option) any later version.
010:         *
011:         *   This library is distributed in the hope that it will be useful,
012:         *   but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         *   Library General Public License for more details.
015:         *
016:         *   You should have received a copy of the GNU Library General Public
017:         *   License along with this library; if not, write to the Free
018:         *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
019:         */
020:
021:        package org.jacorb.naming.namemanager;
022:
023:        import java.awt.*;
024:        import java.awt.event.*;
025:
026:        import javax.swing.*;
027:        import org.omg.CosNaming.*;
028:        import org.jacorb.naming.*;
029:
030:        /**
031:         * A graphical user interface for the Naming Service.
032:         * If invoked with a file name argument, the NameManager
033:         * will create and use its own root context and print its
034:         * IOR to the given file such that it complies with the
035:         * JacORB mechanism for locating the root naming context
036:         *
037:         * @author Gerald Brose
038:         * @author Wei-Ju Wu
039:         * @author Volker Siegel
040:         */
041:
042:        public class NameManager {
043:            public static void main(String args[]) {
044:                org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
045:
046:                JFrame frame = new JFrame("JacORB NameManager");
047:
048:                // set up menu bars and menu
049:                JMenuBar menubar = new JMenuBar();
050:
051:                JMenu fileMenu = new JMenu("File");
052:                JMenu editMenu = new JMenu("Edit");
053:                JMenu helpMenu = new JMenu("Help");
054:
055:                JMenuItem quit = new JMenuItem("Quit", KeyEvent.VK_Q);
056:                quit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,
057:                        ActionEvent.CTRL_MASK));
058:                fileMenu.add(quit);
059:
060:                JMenuItem options = new JMenuItem("Options");
061:
062:                JMenuItem create = new JMenuItem("BindNewContext",
063:                        KeyEvent.VK_N);
064:                create.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,
065:                        ActionEvent.CTRL_MASK));
066:
067:                JMenuItem bindObject = new JMenuItem("Bind Object",
068:                        KeyEvent.VK_B);
069:                bindObject.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B,
070:                        ActionEvent.CTRL_MASK));
071:
072:                JMenuItem unbind = new JMenuItem("Unbind name", KeyEvent.VK_U);
073:                unbind.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U,
074:                        ActionEvent.CTRL_MASK));
075:
076:                editMenu.add(options);
077:                editMenu.add(create);
078:                editMenu.add(bindObject);
079:                editMenu.add(unbind);
080:
081:                JMenuItem about = new JMenuItem("About...");
082:                helpMenu.add(about);
083:
084:                menubar.add(fileMenu);
085:                menubar.add(editMenu);
086:                menubar.add(helpMenu);
087:
088:                NamingContextExt rootContext = null;
089:                try {
090:                    rootContext = NamingContextExtHelper.narrow(orb
091:                            .resolve_initial_references("NameService"));
092:                } catch (Exception e) {
093:                    JOptionPane.showMessageDialog(frame,
094:                            "Could not find name service",
095:                            "Initialization error", JOptionPane.ERROR_MESSAGE);
096:                    usage();
097:                    System.exit(1);
098:                }
099:
100:                if (rootContext == null) {
101:                    System.err
102:                            .println("Narrow for name service failed, exiting...");
103:                    usage();
104:                    System.exit(1);
105:                }
106:
107:                // set up tree and table
108:
109:                NSTable nstable = new NSTable();
110:                JScrollPane tableScrollPane = new JScrollPane(nstable);
111:                nstable.setPreferredScrollableViewportSize(new Dimension(300,
112:                        250));
113:
114:                NSTree tree = new NSTree(300, 200, nstable, rootContext, orb);
115:                JScrollPane treeScrollPane = new JScrollPane(tree);
116:
117:                JSplitPane splitPane = new JSplitPane(
118:                        JSplitPane.HORIZONTAL_SPLIT);
119:                splitPane.setLeftComponent(treeScrollPane);
120:                splitPane.setRightComponent(tableScrollPane);
121:                splitPane.setDividerLocation(200);
122:                splitPane.setDividerSize(2);
123:                frame.getContentPane().setBackground(Color.white);
124:                frame.getContentPane().add(splitPane);
125:                tree.update();
126:
127:                Handler handler = new Handler(frame, tree);
128:                TableHandler tableHandler = new TableHandler(frame, nstable);
129:                quit.addActionListener(handler);
130:                options.addActionListener(handler);
131:                create.addActionListener(handler);
132:                bindObject.addActionListener(handler);
133:                unbind.addActionListener(handler);
134:                about.addActionListener(handler);
135:
136:                tree.addMouseListener(handler);
137:                tree.addKeyListener(handler);
138:
139:                frame.addWindowListener(handler);
140:                nstable.addMouseListener(tableHandler);
141:                nstable.addKeyListener(tableHandler);
142:
143:                frame.setJMenuBar(menubar);
144:                frame.pack();
145:                frame.show();
146:
147:                orb.run();
148:            }
149:
150:            public static void usage() {
151:                System.out.println("Usage: NameManager [orb_options]");
152:                System.out
153:                        .println("          e.g. nmg -ORBInitRef NameService=file:///c:/ns.ior");
154:            }
155:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.