Source Code Cross Referenced for ApplyDatasourcePropertiesAction.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » webapp » jonasadmin » resource » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.webapp.jonasadmin.resource 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or 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:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: ApplyDatasourcePropertiesAction.java 9680 2006-10-06 12:08:33Z danesa $
023:         * --------------------------------------------------------------------------
024:         */
025:
026:        package org.objectweb.jonas.webapp.jonasadmin.resource;
027:
028:        import java.io.IOException;
029:        import java.util.Properties;
030:
031:        import javax.servlet.ServletException;
032:        import javax.servlet.http.HttpServletRequest;
033:        import javax.servlet.http.HttpServletResponse;
034:
035:        import org.apache.struts.action.ActionForm;
036:        import org.apache.struts.action.ActionForward;
037:        import org.apache.struts.action.ActionMapping;
038:        import org.objectweb.jonas.jmx.JonasManagementRepr;
039:        import org.objectweb.jonas.jmx.JonasObjectName;
040:        import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
041:        import org.objectweb.jonas.webapp.jonasadmin.deploy.BaseDeployAction;
042:
043:        /**
044:         * @author Michel-Ange ANTON
045:         */
046:
047:        public class ApplyDatasourcePropertiesAction extends BaseDeployAction {
048:
049:            // --------------------------------------------------------- Public Methods
050:
051:            public ActionForward executeAction(ActionMapping p_Mapping,
052:                    ActionForm p_Form, HttpServletRequest p_Request,
053:                    HttpServletResponse p_Response) throws IOException,
054:                    ServletException {
055:
056:                // Current server
057:                String serverName = m_WhereAreYou.getCurrentJonasServerName();
058:
059:                // Form used
060:                DatasourcePropertiesForm oForm = (DatasourcePropertiesForm) p_Form;
061:                try {
062:                    // populate and deploy (load resource)
063:                    populate(oForm, serverName);
064:                    // refresh tree
065:                    m_WhereAreYou
066:                            .setCurrentJonasDeploymentType(WhereAreYou.DEPLOYMENT_DATASOURCE);
067:                    refreshTree(p_Request);
068:                } catch (Throwable t) {
069:                    addGlobalError(t);
070:                    saveErrors(p_Request, m_Errors);
071:                    return (p_Mapping.findForward("Global Error"));
072:                }
073:                // Remove form
074:                m_Session.removeAttribute("datasourcePropertiesForm");
075:                // Forward to the jsp.
076:                return (p_Mapping.findForward("ActionListDatasources"));
077:            }
078:
079:            // --------------------------------------------------------- Protected Methods
080:
081:            private static final String DEF_CLASSNAME = "no class name";
082:            private static final String DEF_URL = "no url";
083:            private static final String DEF_DESCRIPTION = "no desc";
084:            private static final String DEF_USERNAME = "";
085:            private static final String DEF_PASSWORD = "";
086:            private static final String DEF_FACTORY = "none";
087:            private static final String DEF_MAPPERNAME = "rdb";
088:
089:            protected void populate(DatasourcePropertiesForm p_Form,
090:                    String serverName) throws Exception {
091:                Properties oProps = new Properties();
092:                setStringAttribute(oProps, "datasource.name", p_Form
093:                        .getDatasourceName());
094:                setStringAttribute(oProps, "datasource.description", p_Form
095:                        .getDatasourceDescription(), DEF_DESCRIPTION);
096:                setStringAttribute(oProps, "datasource.url", p_Form
097:                        .getDatasourceUrl(), DEF_URL);
098:                setStringAttribute(oProps, "datasource.classname", p_Form
099:                        .getDatasourceClassname(), DEF_CLASSNAME);
100:                setStringAttribute(oProps, "datasource.username", p_Form
101:                        .getDatasourceUsername(), DEF_USERNAME);
102:                setStringAttribute(oProps, "datasource.password", p_Form
103:                        .getDatasourcePassword(), DEF_PASSWORD);
104:                setStringAttribute(oProps, "datasource.mapper", p_Form
105:                        .getDatasourceMapper(), DEF_MAPPERNAME);
106:                setStringAttribute(oProps, "jdbc.connmaxage", p_Form
107:                        .getJdbcConnmaxage());
108:                setStringAttribute(oProps, "jdbc.maxopentime", p_Form
109:                        .getJdbcMaxopentime());
110:                setStringAttribute(oProps, "jdbc.connchecklevel", p_Form
111:                        .getJdbcConnchecklevel());
112:                setStringAttribute(oProps, "jdbc.connteststmt", p_Form
113:                        .getJdbcConnteststmt());
114:                setStringAttribute(oProps, "jdbc.minconpool", p_Form
115:                        .getJdbcMinconpool());
116:                setStringAttribute(oProps, "jdbc.maxconpool", p_Form
117:                        .getJdbcMaxconpool());
118:                setStringAttribute(oProps, "jdbc.maxwaittime", p_Form
119:                        .getJdbcMaxwaittime());
120:                setStringAttribute(oProps, "jdbc.maxwaiters", p_Form
121:                        .getJdbcMaxwaiters());
122:                setStringAttribute(oProps, "jdbc.samplingperiod", p_Form
123:                        .getJdbcSamplingperiod());
124:
125:                // Load Datasource
126:                Object[] aoParam = { p_Form.getName(), oProps,
127:                        new Boolean(false) };
128:                String[] asSign_3 = { "java.lang.String",
129:                        "java.util.Properties", "java.lang.Boolean" };
130:                JonasManagementRepr.invoke(JonasObjectName.databaseService(),
131:                        "loadDataSource", aoParam, asSign_3, serverName);
132:
133:            }
134:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.