Source Code Cross Referenced for AdminServerEditor.java in  » Web-Server » Jigsaw » org » w3c » jigadmin » editors » 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 » Web Server » Jigsaw » org.w3c.jigadmin.editors 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // AdminServerEditor.java
002:        // $Id: AdminServerEditor.java,v 1.11 2000/08/16 21:37:30 ylafon Exp $
003:        // (c) COPYRIGHT MIT and INRIA, 1998.
004:        // Please first read the full copyright statement in file COPYRIGHT.html
005:
006:        package org.w3c.jigadmin.editors;
007:
008:        import java.awt.GridLayout;
009:        import java.awt.Font;
010:        import java.awt.Component;
011:
012:        import javax.swing.JPanel;
013:        import javax.swing.JLabel;
014:        import javax.swing.BorderFactory;
015:        import javax.swing.border.TitledBorder;
016:
017:        import java.util.Properties;
018:        import java.util.Vector;
019:
020:        import org.w3c.jigadmin.RemoteResourceWrapper;
021:        import org.w3c.jigadmin.gui.Message;
022:        import org.w3c.jigadmin.events.ResourceActionListener;
023:        import org.w3c.jigadmin.events.ResourceActionEvent;
024:
025:        import org.w3c.jigsaw.admin.RemoteAccessException;
026:        import org.w3c.jigsaw.admin.RemoteResource;
027:
028:        import org.w3c.tools.widgets.Utilities;
029:
030:        /**
031:         * The admin server editor
032:         * @version $Revision: 1.11 $
033:         * @author  Benoît Mahé (bmahe@w3.org)
034:         */
035:        public class AdminServerEditor extends ServerEditor implements 
036:                ServerEditorInterface, ResourceActionListener {
037:
038:            protected final static String CONTROL_NAME = "control";
039:            protected final static String REALMS_NAME = "realms";
040:
041:            private RemoteResource[] controls = null;
042:
043:            /**
044:             * initialize the server helpers. There is only one helper for the
045:             * Admin server, the ControlServerHelper
046:             * @exception RemoteAccessException if a remote error occurs
047:             */
048:            protected void initializeServerHelpers()
049:                    throws RemoteAccessException {
050:                shelpers = new ServerHelperInterface[2]; //control + realms
051:                //control
052:                RemoteResourceWrapper rrw = server
053:                        .getChildResource(CONTROL_NAME);
054:                shelpers[0] = ServerHelperFactory.getServerHelper(CONTROL_NAME,
055:                        rrw);
056:                ControlServerHelper control = (ControlServerHelper) shelpers[0];
057:                control.setResOpEnabled(false);
058:                control.setSaveToolTipText("Save all servers configuration");
059:                control.setStopToolTipText("Stop all servers");
060:                control.addResourceActionListener(this );
061:                //realms
062:                rrw = server.getChildResource(REALMS_NAME);
063:                shelpers[1] = ServerHelperFactory.getServerHelper(REALMS_NAME,
064:                        rrw);
065:            }
066:
067:            /**
068:             * Get the control resource of all administrated servers.
069:             * @return a RemoteResource Array
070:             * @exception RemoteAccessException if a remote error occurs
071:             */
072:            protected RemoteResource[] getControls()
073:                    throws RemoteAccessException {
074:                if (controls == null) {
075:                    RemoteResource admin = server.getResource();
076:                    String names[] = admin.enumerateResourceIdentifiers();
077:                    Vector vcontrols = new Vector(2);
078:                    for (int i = 0; i < names.length; i++) {
079:                        if ((!names[i].equals("control"))
080:                                && (!names[i].equals("realms"))) {
081:                            RemoteResource srr = admin.loadResource(names[i]);
082:                            //load the control node
083:                            RemoteResource control = srr
084:                                    .loadResource("control");
085:                            vcontrols.addElement(control);
086:                        }
087:                    }
088:                    controls = new RemoteResource[vcontrols.size()];
089:                    vcontrols.copyInto(controls);
090:                }
091:                return controls;
092:            }
093:
094:            /**
095:             * A resource action occured.
096:             * @param e the ResourceActionEvent
097:             */
098:            public void resourceActionPerformed(ResourceActionEvent e) {
099:                switch (e.getResourceActionCommand()) {
100:                case ResourceActionEvent.SAVE_EVENT:
101:                    try {
102:                        RemoteResource ctrls[] = getControls();
103:                        for (int i = 0; i < ctrls.length; i++)
104:                            ctrls[i].loadResource("save");
105:                    } catch (RemoteAccessException ex) {
106:                        Message.showErrorMessage(server, ex);
107:                    }
108:                    break;
109:                case ResourceActionEvent.STOP_EVENT:
110:                    try {
111:                        RemoteResource ctrls[] = getControls();
112:                        for (int i = 0; i < ctrls.length; i++)
113:                            ctrls[i].loadResource("stop");
114:                    } catch (RemoteAccessException ex) {
115:                        Message.showErrorMessage(server, ex);
116:                    }
117:                    break;
118:                default:
119:                    //nothing to do
120:                }
121:            }
122:
123:            /**
124:             * Initialize this editor.
125:             * @param name the editor name
126:             * @param rrw the RemoteResourceWrapper wrapping the editor node.
127:             * @param p the editor properties
128:             */
129:            public void initialize(String name, RemoteResourceWrapper rrw,
130:                    Properties p) {
131:                super .initialize(name, rrw, p);
132:                //must be built at init time
133:                setServer(rrw);
134:            }
135:
136:            /**
137:             * Constructor.
138:             */
139:            public AdminServerEditor() {
140:                //for newInstance
141:            }
142:
143:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.