Source Code Cross Referenced for ConfigureNewDataAccess.java in  » ESB » open-esb » charting » configure » 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 » ESB » open esb » charting.configure 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BEGIN_HEADER - DO NOT EDIT
003:         *
004:         * The contents of this file are subject to the terms
005:         * of the Common Development and Distribution License
006:         * (the "License").  You may not use this file except
007:         * in compliance with the License.
008:         *
009:         * You can obtain a copy of the license at
010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011:         * See the License for the specific language governing
012:         * permissions and limitations under the License.
013:         *
014:         * When distributing Covered Code, include this CDDL
015:         * HEADER in each file and include the License file at
016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017:         * If applicable add the following below this CDDL HEADER,
018:         * with the fields enclosed by brackets "[]" replaced with
019:         * your own identifying information: Portions Copyright
020:         * [year] [name of copyright owner]
021:         */
022:
023:        /*
024:         * @(#)ConfigureNewDataAccess.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        package charting.configure;
030:
031:        import org.openesb.tools.charting.persist.ChartApplicationBeansContainer;
032:        import org.openesb.tools.charting.persist.DataBean;
033:        import org.openesb.tools.extchart.jfchart.data.SampleDemoDataAccess;
034:        import org.openesb.tools.extchart.property.JFChartConstants;
035:        import com.sun.rave.web.ui.appbase.AbstractPageBean;
036:        import com.sun.web.ui.component.Body;
037:        import com.sun.web.ui.component.Button;
038:        import com.sun.web.ui.component.DropDown;
039:        import com.sun.web.ui.component.Form;
040:        import com.sun.web.ui.component.Head;
041:        import com.sun.web.ui.component.HiddenField;
042:        import com.sun.web.ui.component.Html;
043:        import com.sun.web.ui.component.Label;
044:        import com.sun.web.ui.component.Link;
045:        import com.sun.web.ui.component.Page;
046:        import com.sun.web.ui.component.TextArea;
047:        import com.sun.web.ui.component.TextField;
048:        import com.sun.web.ui.model.Option;
049:        import com.sun.web.ui.model.SingleSelectOptionsList;
050:        import java.util.ArrayList;
051:        import java.util.Iterator;
052:        import java.util.Map;
053:        import java.util.logging.Logger;
054:        import javax.faces.FacesException;
055:
056:        /**
057:         * <p>Page bean that corresponds to a similarly named JSP page.  This
058:         * class contains component definitions (and initialization code) for
059:         * all components that you have defined on this page, as well as
060:         * lifecycle methods and event handlers where you may add behavior
061:         * to respond to incoming events.</p>
062:         */
063:        public class ConfigureNewDataAccess extends AbstractPageBean {
064:            private static Logger mLogger = Logger
065:                    .getLogger("/configure/ConfigureNewDataAccess.jsp");
066:            // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">
067:            private int __placeholder;
068:
069:            /**
070:             * <p>Automatically managed component initialization.  <strong>WARNING:</strong>
071:             * This method is automatically generated, so any user-specified code inserted
072:             * here is subject to being replaced.</p>
073:             */
074:            private void _init() throws Exception {
075:            }
076:
077:            private Page page1 = new Page();
078:
079:            public Page getPage1() {
080:                return page1;
081:            }
082:
083:            public void setPage1(Page p) {
084:                this .page1 = p;
085:            }
086:
087:            private Html html1 = new Html();
088:
089:            public Html getHtml1() {
090:                return html1;
091:            }
092:
093:            public void setHtml1(Html h) {
094:                this .html1 = h;
095:            }
096:
097:            private Head head1 = new Head();
098:
099:            public Head getHead1() {
100:                return head1;
101:            }
102:
103:            public void setHead1(Head h) {
104:                this .head1 = h;
105:            }
106:
107:            private Link link1 = new Link();
108:
109:            public Link getLink1() {
110:                return link1;
111:            }
112:
113:            public void setLink1(Link l) {
114:                this .link1 = l;
115:            }
116:
117:            private Body body1 = new Body();
118:
119:            public Body getBody1() {
120:                return body1;
121:            }
122:
123:            public void setBody1(Body b) {
124:                this .body1 = b;
125:            }
126:
127:            private Form form1 = new Form();
128:
129:            public Form getForm1() {
130:                return form1;
131:            }
132:
133:            public void setForm1(Form f) {
134:                this .form1 = f;
135:            }
136:
137:            private Label label1 = new Label();
138:
139:            public Label getLabel1() {
140:                return label1;
141:            }
142:
143:            public void setLabel1(Label l) {
144:                this .label1 = l;
145:            }
146:
147:            private TextField textField1 = new TextField();
148:
149:            public TextField getTextField1() {
150:                return textField1;
151:            }
152:
153:            public void setTextField1(TextField tf) {
154:                this .textField1 = tf;
155:            }
156:
157:            private Label label2 = new Label();
158:
159:            public Label getLabel2() {
160:                return label2;
161:            }
162:
163:            public void setLabel2(Label l) {
164:                this .label2 = l;
165:            }
166:
167:            private DropDown dropDown1 = new DropDown();
168:
169:            public DropDown getDropDown1() {
170:                return dropDown1;
171:            }
172:
173:            public void setDropDown1(DropDown dd) {
174:                this .dropDown1 = dd;
175:            }
176:
177:            private SingleSelectOptionsList dropDown1DefaultOptions = new SingleSelectOptionsList();
178:
179:            public SingleSelectOptionsList getDropDown1DefaultOptions() {
180:                return dropDown1DefaultOptions;
181:            }
182:
183:            public void setDropDown1DefaultOptions(SingleSelectOptionsList ssol) {
184:                this .dropDown1DefaultOptions = ssol;
185:            }
186:
187:            private Label label3 = new Label();
188:
189:            public Label getLabel3() {
190:                return label3;
191:            }
192:
193:            public void setLabel3(Label l) {
194:                this .label3 = l;
195:            }
196:
197:            private TextArea textArea1 = new TextArea();
198:
199:            public TextArea getTextArea1() {
200:                return textArea1;
201:            }
202:
203:            public void setTextArea1(TextArea ta) {
204:                this .textArea1 = ta;
205:            }
206:
207:            private Button button1 = new Button();
208:
209:            public Button getButton1() {
210:                return button1;
211:            }
212:
213:            public void setButton1(Button b) {
214:                this .button1 = b;
215:            }
216:
217:            private HiddenField hiddenField1 = new HiddenField();
218:
219:            public HiddenField getHiddenField1() {
220:                return hiddenField1;
221:            }
222:
223:            public void setHiddenField1(HiddenField hf) {
224:                this .hiddenField1 = hf;
225:            }
226:
227:            // </editor-fold>
228:
229:            /**
230:             * <p>Construct a new Page bean instance.</p>
231:             */
232:            public ConfigureNewDataAccess() {
233:            }
234:
235:            /**
236:             * <p>Callback method that is called whenever a page is navigated to,
237:             * either directly via a URL, or indirectly via page navigation.
238:             * Customize this method to acquire resources that will be needed
239:             * for event handlers and lifecycle methods, whether or not this
240:             * page is performing post back processing.</p>
241:             * 
242:             * <p>Note that, if the current request is a postback, the property
243:             * values of the components do <strong>not</strong> represent any
244:             * values submitted with this request.  Instead, they represent the
245:             * property values that were saved for this view when it was rendered.</p>
246:             */
247:            public void init() {
248:                // Perform initializations inherited from our superclass
249:                super .init();
250:                // Perform application initialization that must complete
251:                // *before* managed components are initialized
252:                // TODO - add your own initialiation code here
253:                /* mLogger.info("The request map is " + getRequestMap());
254:                 Map m =  getRequestMap();
255:                 Iterator iter = m.keySet().iterator();
256:                 while (iter.hasNext()) {
257:                     String k = (String)iter.next();
258:                     mLogger.info("Key = " + k + "value= "+ m.get(k)) ;
259:                 }
260:                 */
261:                String id = getChartApplicationBeansContainer()
262:                        .getCurrentDBABeanOnEditorID();
263:
264:                DataBean dBean = getChartApplicationBeansContainer()
265:                        .getDataBeanByID(id);
266:                //mLogger.info("init is called. The id = " + id +" and DB Bean is " + dBean);
267:                if (dBean != null) {
268:                    String jndi = dBean.getJNDIName();
269:                    getTextField1().setText(jndi);
270:                    String q = dBean.getQuery();
271:                    getTextArea1().setText(q);
272:                    String dsType = dBean.getDataSetType();
273:                    getDropDown1().setSelected(dsType);
274:
275:                }
276:
277:                // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
278:                // Initialize automatically managed components
279:                // *Note* - this logic should NOT be modified
280:                try {
281:                    _init();
282:                } catch (Exception e) {
283:                    log("ConfigureNewDataAccess Initialization Failure", e);
284:                    throw e instanceof  FacesException ? (FacesException) e
285:                            : new FacesException(e);
286:                }
287:
288:                // </editor-fold>
289:                // Perform application initialization that must complete
290:                // *after* managed components are initialized
291:                // TODO - add your own initialization code here
292:            }
293:
294:            /**
295:             * <p>Callback method that is called after the component tree has been
296:             * restored, but before any event processing takes place.  This method
297:             * will <strong>only</strong> be called on a postback request that
298:             * is processing a form submit.  Customize this method to allocate
299:             * resources that will be required in your event handlers.</p>
300:             */
301:            public void preprocess() {
302:            }
303:
304:            /**
305:             * <p>Callback method that is called just before rendering takes place.
306:             * This method will <strong>only</strong> be called for the page that
307:             * will actually be rendered (and not, for example, on a page that
308:             * handled a postback and then navigated to a different page).  Customize
309:             * this method to allocate resources that will be required for rendering
310:             * this page.</p>
311:             */
312:            public void prerender() {
313:
314:            }
315:
316:            /**
317:             * <p>Callback method that is called after rendering is completed for
318:             * this request, if <code>init()</code> was called (regardless of whether
319:             * or not this was the page that was actually rendered).  Customize this
320:             * method to release resources acquired in the <code>init()</code>,
321:             * <code>preprocess()</code>, or <code>prerender()</code> methods (or
322:             * acquired during execution of an event handler).</p>
323:             */
324:            public void destroy() {
325:            }
326:
327:            private SingleSelectOptionsList l = new SingleSelectOptionsList();
328:
329:            public SingleSelectOptionsList getOptions() {
330:                ArrayList al = new ArrayList();
331:                //l = new SingleSelectOptionsList();
332:                Option[] options = new Option[4];
333:                Option opt1 = new Option();
334:                opt1.setLabel("Category Based");
335:                opt1.setValue(JFChartConstants.CATEGORY_DATASET);
336:                options[0] = opt1;
337:
338:                Option opt2 = new Option();
339:                opt2.setLabel("XYSeries Based");
340:                opt2.setValue(JFChartConstants.XY_DATASET);
341:                options[1] = opt2;
342:
343:                Option opt3 = new Option();
344:                opt3.setLabel("Pie Based");
345:                opt3.setValue(JFChartConstants.PIE_DATASET);
346:                options[2] = opt3;
347:
348:                Option opt4 = new Option();
349:                opt4.setLabel("Single Value Based");
350:                opt4.setValue(JFChartConstants.VALUE_DATASET);
351:                options[3] = opt4;
352:
353:                l.setOptions(options);
354:                //getDropDown1().setSelected(opt4.getValue());
355:                return l;
356:
357:            }
358:
359:            private ChartApplicationBeansContainer getChartApplicationBeansContainer() {
360:                return (ChartApplicationBeansContainer) getBean("ChartApplicationBeansContainer");
361:
362:            }
363:
364:            private Object getRequestParameter(String key) {
365:                return getRequestMap().get(key);
366:            }
367:
368:            public String button1_action() {
369:                // TODO: Process the button click action. Return value is a navigation
370:                // case name where null will return to the same page.
371:                String dsType = (String) this .getDropDown1().getSelected();
372:                String jndiName = (String) getTextField1().getText();
373:                String q = (String) this .getTextArea1().getText();
374:                String id = getChartApplicationBeansContainer()
375:                        .getCurrentDBABeanOnEditorID();
376:                //SQLDataAccess sqlDA = new SQLDataAccess(dsType,q);
377:                mLogger.info("The ds is = " + dsType);
378:                mLogger.info("The id = " + id);
379:                DataBean dBean = getChartApplicationBeansContainer()
380:                        .getDataBeanByID(id);
381:                mLogger.info("The bean is = " + dBean);
382:                dBean.setQuery(q);
383:                dBean.setJNDIName(jndiName);
384:                dBean.setDataSetType(dsType);
385:                try {
386:                    getChartApplicationBeansContainer().persistDataBean(id);
387:                } catch (Exception e) {
388:                    mLogger.severe("Error while saving data bean. "
389:                            + e.getMessage());
390:                    e.printStackTrace();
391:                    return "error";
392:                }
393:                return "finished";
394:
395:            }
396:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.