Source Code Cross Referenced for DevelopmentServerConfigOptions.java in  » Content-Management-System » harmonise » org » openharmonise » him » serverconfig » 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 » Content Management System » harmonise » org.openharmonise.him.serverconfig 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.him.serverconfig;
020:
021:        import java.awt.*;
022:        import java.awt.event.*;
023:        import java.net.*;
024:        import java.rmi.*;
025:
026:        import javax.swing.*;
027:        import javax.xml.rpc.*;
028:
029:        import org.openharmonise.him.*;
030:        import org.openharmonise.him.configuration.*;
031:        import org.openharmonise.him.harmonise.*;
032:        import org.openharmonise.vfs.servers.ServerList;
033:
034:        /**
035:         * Panel for configuring the development options of a Harmonise Information
036:         * Server.
037:         * 
038:         * @author Matthew Large
039:         * @version $Revision: 1.1 $
040:         *
041:         */
042:        public class DevelopmentServerConfigOptions extends
043:                AbstractServerConfigOptions implements  LayoutManager,
044:                ActionListener, ApplyChangesListener, KeyListener {
045:
046:            /**
047:             * Description.
048:             */
049:            private JTextArea m_descriptionTextArea = null;
050:
051:            /**
052:             * Show XML option label.
053:             */
054:            private JLabel m_showXMLLabel = null;
055:
056:            /**
057:             * Show XML option drop down.
058:             */
059:            private JComboBox m_showXMLCombo = null;
060:
061:            /**
062:             * true if the show XML option has changed.
063:             */
064:            private boolean m_bShowXMLChanged = false;
065:
066:            /**
067:             * Admin utils username option label.
068:             */
069:            private JLabel m_adminUtilsUsernameLabel = null;
070:
071:            /**
072:             * Admin utils username option text field.
073:             */
074:            private JTextField m_adminUtilsUsernameTextField = null;
075:
076:            /**
077:             * Admin utils password option label.
078:             */
079:            private JLabel m_adminUtilsPasswordLabel = null;
080:
081:            /**
082:             * Admin utils password option text field.
083:             */
084:            private JPasswordField m_adminUtilsPasswordField = null;
085:
086:            /**
087:             * true if either the admin utils username or password option has changed.
088:             */
089:            private boolean m_badminUtilsPasswordChanged = false;
090:
091:            /**
092:             * Username for the current user.
093:             */
094:            private String m_sUsername = null;
095:
096:            /**
097:             * Password for the current user.
098:             */
099:            private String m_sPassword = null;
100:
101:            public DevelopmentServerConfigOptions() {
102:                super (null);
103:                this .setup();
104:            }
105:
106:            /**
107:             * Constructs a new development server configuration options panel.
108:             * 
109:             * @param dialog configuration dialog that this panel will be in.
110:             */
111:            public DevelopmentServerConfigOptions(ServerConfigDialog dialog) {
112:                super (dialog);
113:                dialog.addApplyChangesListener(this );
114:                this .setup();
115:            }
116:
117:            /**
118:             * Initialises this component.
119:             *
120:             */
121:            private void setup() {
122:                this .setLayout(this );
123:
124:                this .m_sUsername = ServerList.getInstance()
125:                        .getHarmoniseServer().getVFS().getAuthentication()
126:                        .getUsername();
127:                this .m_sPassword = ServerList.getInstance()
128:                        .getHarmoniseServer().getVFS().getAuthentication()
129:                        .getPassword();
130:
131:                String fontName = "Dialog";
132:                int fontSize = 11;
133:                Font font = new Font(fontName, Font.PLAIN, fontSize);
134:
135:                this .m_descriptionTextArea = new JTextArea(
136:                        "Set up access to the development utilities.");
137:                this .m_descriptionTextArea.setEditable(false);
138:                this .m_descriptionTextArea.setBorder(BorderFactory
139:                        .createEmptyBorder());
140:                this .m_descriptionTextArea.setWrapStyleWord(true);
141:                this .m_descriptionTextArea.setLineWrap(true);
142:                this .m_descriptionTextArea.setOpaque(false);
143:                this .add(m_descriptionTextArea);
144:
145:                ConfigSettingsClient service = new ConfigSettingsClient();
146:                URL url = null;
147:                try {
148:                    URI uri = ServerList.getInstance().getHarmoniseServer()
149:                            .getURI();
150:                    String sURL = uri.getScheme() + "://" + uri.getHost() + ":"
151:                            + uri.getPort() + "/webdav/services/ConfigService";
152:                    url = new URL(sURL);
153:
154:                } catch (MalformedURLException e) {
155:                    e.printStackTrace();
156:                }
157:
158:                ConfigProperty configProp = null;
159:
160:                try {
161:                    configProp = service.getProperty(url, this .m_sUsername,
162:                            this .m_sPassword, "ALLOW_SHOWXML");
163:                } catch (RemoteException e) {
164:                    e.printStackTrace();
165:                } catch (ServiceException e) {
166:                    e.printStackTrace();
167:                }
168:
169:                this .m_showXMLLabel = new JLabel("Allow \"Show XML\"?");
170:                this .m_showXMLLabel.setFont(font);
171:                this .add(m_showXMLLabel);
172:
173:                this .m_showXMLCombo = new JComboBox(new String[] { "TRUE",
174:                        "FALSE" });
175:                this .m_showXMLCombo.setFont(font);
176:                this .m_showXMLCombo.setActionCommand("SHOWXML");
177:                if (configProp.getValue() != null
178:                        && configProp.getValue().equalsIgnoreCase("TRUE")) {
179:                    this .m_showXMLCombo.setSelectedItem("TRUE");
180:                } else {
181:                    this .m_showXMLCombo.setSelectedItem("FALSE");
182:                }
183:                this .add(m_showXMLCombo);
184:                this .m_showXMLCombo.addActionListener(this );
185:
186:                try {
187:                    configProp = service.getProperty(url, this .m_sUsername,
188:                            this .m_sPassword, "UTIL_USERS_PWD");
189:                } catch (RemoteException e) {
190:
191:                } catch (ServiceException e) {
192:                    e.printStackTrace();
193:                }
194:
195:                String sName = "";
196:                String sPassword = "";
197:                if (configProp.getValue() != null
198:                        && configProp.getValue().indexOf(":") > -1) {
199:                    sName = configProp.getValue().substring(0,
200:                            configProp.getValue().indexOf(":"));
201:                    sPassword = configProp.getValue().substring(
202:                            configProp.getValue().indexOf(":") + 1);
203:                } else {
204:                    sName = "admin";
205:                    sPassword = "admin";
206:                }
207:
208:                m_adminUtilsUsernameLabel = new JLabel(
209:                        "Utilities login (username)");
210:                this .m_adminUtilsUsernameLabel.setFont(font);
211:                this .add(this .m_adminUtilsUsernameLabel);
212:                m_adminUtilsUsernameTextField = new JTextField(sName);
213:                this .m_adminUtilsUsernameTextField.addKeyListener(this );
214:                this .m_adminUtilsUsernameTextField.setFont(font);
215:                this .add(this .m_adminUtilsUsernameTextField);
216:
217:                m_adminUtilsPasswordLabel = new JLabel(
218:                        "Utilities login (password)");
219:                this .m_adminUtilsPasswordLabel.setFont(font);
220:                this .add(this .m_adminUtilsPasswordLabel);
221:                m_adminUtilsPasswordField = new JPasswordField(sPassword);
222:                this .m_adminUtilsPasswordField.addKeyListener(this );
223:                this .m_adminUtilsPasswordField.setFont(font);
224:                this .add(this .m_adminUtilsPasswordField);
225:
226:            }
227:
228:            /* (non-Javadoc)
229:             * @see java.awt.Component#getPreferredSize()
230:             */
231:            public Dimension getPreferredSize() {
232:                return new Dimension(this .getParent().getSize().width - 50, 100);
233:            }
234:
235:            /* (non-Javadoc)
236:             * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
237:             */
238:            public void layoutContainer(Container arg0) {
239:
240:                int nHeight = 20;
241:
242:                this .m_descriptionTextArea.setSize(350, 20);
243:                this .m_descriptionTextArea.setLocation(20, nHeight);
244:                nHeight = nHeight + this .m_descriptionTextArea.getSize().height
245:                        + 20;
246:
247:                this .m_showXMLLabel.setSize(this .m_showXMLLabel
248:                        .getPreferredSize());
249:                this .m_showXMLLabel.setLocation(20, nHeight);
250:                this .m_showXMLCombo.setSize(100, 20);
251:                this .m_showXMLCombo.setLocation(250, nHeight);
252:                nHeight = nHeight + this .m_showXMLLabel.getSize().height + 20;
253:
254:                this .m_adminUtilsUsernameLabel
255:                        .setSize(this .m_adminUtilsUsernameLabel
256:                                .getPreferredSize());
257:                this .m_adminUtilsUsernameLabel.setLocation(20, nHeight);
258:                this .m_adminUtilsUsernameTextField.setSize(100, 20);
259:                this .m_adminUtilsUsernameTextField.setLocation(250, nHeight);
260:                nHeight = nHeight
261:                        + this .m_adminUtilsUsernameLabel.getSize().height + 20;
262:
263:                this .m_adminUtilsPasswordLabel
264:                        .setSize(this .m_adminUtilsPasswordLabel
265:                                .getPreferredSize());
266:                this .m_adminUtilsPasswordLabel.setLocation(20, nHeight);
267:                this .m_adminUtilsPasswordField.setSize(100, 20);
268:                this .m_adminUtilsPasswordField.setLocation(250, nHeight);
269:                nHeight = nHeight
270:                        + this .m_adminUtilsPasswordLabel.getSize().height + 20;
271:            }
272:
273:            /* (non-Javadoc)
274:             * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
275:             */
276:            public Dimension minimumLayoutSize(Container arg0) {
277:                return null;
278:            }
279:
280:            /* (non-Javadoc)
281:             * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
282:             */
283:            public Dimension preferredLayoutSize(Container arg0) {
284:                return null;
285:            }
286:
287:            /* (non-Javadoc)
288:             * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
289:             */
290:            public void actionPerformed(ActionEvent ae) {
291:                if (ae.getActionCommand().equals("SHOWXML")) {
292:                    this .m_bShowXMLChanged = true;
293:                }
294:                this .fireChangesMade();
295:            }
296:
297:            /* (non-Javadoc)
298:             * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
299:             */
300:            public void keyReleased(KeyEvent ke) {
301:                if (ke.getSource() == this .m_adminUtilsUsernameTextField) {
302:                    this .m_badminUtilsPasswordChanged = true;
303:                } else if (ke.getSource() == this .m_adminUtilsPasswordField) {
304:                    this .m_badminUtilsPasswordChanged = true;
305:                }
306:                this .fireChangesMade();
307:            }
308:
309:            /* (non-Javadoc)
310:             * @see com.simulacramedia.contentmanager.configuration.ApplyChangesListener#applyChanges()
311:             */
312:            public boolean applyChanges() {
313:                boolean bOk = true;
314:                ConfigSettingsClient service = new ConfigSettingsClient();
315:                URL url = null;
316:                try {
317:                    URI uri = ServerList.getInstance().getHarmoniseServer()
318:                            .getURI();
319:                    String sURL = uri.getScheme() + "://" + uri.getHost() + ":"
320:                            + uri.getPort() + "/webdav/services/ConfigService";
321:                    url = new URL(sURL);
322:
323:                } catch (MalformedURLException e) {
324:                    e.printStackTrace();
325:                }
326:
327:                try {
328:                    if (this .m_bShowXMLChanged) {
329:                        ConfigProperty configProp = new ConfigProperty(
330:                                "ALLOW_SHOWXML", (String) this .m_showXMLCombo
331:                                        .getSelectedItem());
332:                        service.setProperty(url, m_sUsername, m_sPassword,
333:                                configProp);
334:                        this .m_bShowXMLChanged = false;
335:                    }
336:                    if (this .m_badminUtilsPasswordChanged) {
337:                        String sValue = this .m_adminUtilsUsernameTextField
338:                                .getText()
339:                                + ":"
340:                                + new String(this .m_adminUtilsPasswordField
341:                                        .getPassword());
342:                        ConfigProperty configProp = new ConfigProperty(
343:                                "UTIL_USER_PWD", sValue);
344:                        service.setProperty(url, m_sUsername, m_sPassword,
345:                                configProp);
346:                        this .m_badminUtilsPasswordChanged = false;
347:                    }
348:                } catch (RemoteException e) {
349:                    e.printStackTrace();
350:                    bOk = false;
351:                } catch (ServiceException e) {
352:                    e.printStackTrace();
353:                    bOk = false;
354:                }
355:                return bOk;
356:            }
357:
358:            /* (non-Javadoc)
359:             * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
360:             */
361:            public void removeLayoutComponent(Component arg0) {
362:            }
363:
364:            /* (non-Javadoc)
365:             * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
366:             */
367:            public void addLayoutComponent(String arg0, Component arg1) {
368:            }
369:
370:            /* (non-Javadoc)
371:             * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
372:             */
373:            public void keyPressed(KeyEvent arg0) {
374:            }
375:
376:            /* (non-Javadoc)
377:             * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent)
378:             */
379:            public void keyTyped(KeyEvent arg0) {
380:            }
381:
382:            /* (non-Javadoc)
383:             * @see com.simulacramedia.contentmanager.configuration.ApplyChangesListener#discardChanges()
384:             */
385:            public void discardChanges() {
386:            }
387:
388:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.