Source Code Cross Referenced for HttpPropertyWizardPageServerProperty.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » ui » componentflow » componentFlowEditor » diagram » wizards » 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 » cbesb 1.2 » com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.wizards 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ChainBuilder ESB
003:         *          Visual Enterprise Integration
004:         * 
005:         * Copyright (C) 2006 Bostech Corporation
006:         * 
007:         * This program is free software; you can redistribute it and/or modify it 
008:         * under the terms of the GNU General Public License as published by the 
009:         * Free Software Foundation; either version 2 of the License, or (at your option) 
010:         * any later version.
011:         *
012:         * This program is distributed in the hope that it will be useful, 
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
014:         * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
015:         * for more details.
016:         * 
017:         * You should have received a copy of the GNU General Public License along with 
018:         * this program; if not, write to the Free Software Foundation, Inc., 
019:         * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020:         *
021:         *
022:         * $Id$
023:         */
024:        package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.wizards;
025:
026:        import java.io.File;
027:        import java.io.IOException;
028:        import java.net.MalformedURLException;
029:        import java.net.URL;
030:        import java.util.HashMap;
031:        import java.util.Map;
032:
033:        import javax.wsdl.WSDLException;
034:
035:        import org.apache.xmlbeans.XmlException;
036:        import org.eclipse.core.resources.IResource;
037:        import org.eclipse.core.resources.ResourcesPlugin;
038:        import org.eclipse.core.runtime.CoreException;
039:        import org.eclipse.core.runtime.Path;
040:        import org.eclipse.jface.wizard.IWizardPage;
041:        import org.eclipse.jface.wizard.WizardDialog;
042:        import org.eclipse.swt.SWT;
043:        import org.eclipse.swt.events.ModifyEvent;
044:        import org.eclipse.swt.events.ModifyListener;
045:        import org.eclipse.swt.events.SelectionAdapter;
046:        import org.eclipse.swt.events.SelectionEvent;
047:        import org.eclipse.swt.layout.GridData;
048:        import org.eclipse.swt.layout.GridLayout;
049:        import org.eclipse.swt.widgets.Button;
050:        import org.eclipse.swt.widgets.Combo;
051:        import org.eclipse.swt.widgets.Composite;
052:        import org.eclipse.swt.widgets.Group;
053:        import org.eclipse.swt.widgets.Label;
054:        import org.eclipse.swt.widgets.Text;
055:        import org.eclipse.ui.IEditorPart;
056:        import org.eclipse.ui.PlatformUI;
057:        import org.eclipse.ui.part.FileEditorInput;
058:
059:        import com.bostechcorp.cbesb.common.i18n.I18N;
060:        import com.bostechcorp.cbesb.common.i18n.Messages;
061:        import com.bostechcorp.cbesb.common.sa.service.EndPoint;
062:        import com.bostechcorp.cbesb.common.util.FileUtil;
063:        import com.bostechcorp.cbesb.common.util.generators.wsdl.generators.HTTPPublicWsdlUpdater;
064:        import com.bostechcorp.cbesb.common.util.generators.wsdl.generators.HttpDefaultPublicWsdlGenerator;
065:        import com.bostechcorp.cbesb.common.util.project.ProjectUtil;
066:        import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.AttachmentModeType;
067:        import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.DefaultMepType;
068:        import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.HttpConsumer;
069:        import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.SSL;
070:        import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.SSLMode;
071:        import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.WSDLSource;
072:        import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.wizards.httpExtra.ImportWsdlDialog;
073:        import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.wizards.httpExtra.NewWSDLWizard;
074:        import com.bostechcorp.cbesb.ui.util.MsgUtil;
075:
076:        public class HttpPropertyWizardPageServerProperty extends
077:                PropertyWizardPage {
078:
079:            private Group wsdlResourceGroup;
080:
081:            private Text timeOutText;
082:
083:            private Combo attachmentModeCombo;
084:
085:            private Combo comboDefaultMep;
086:
087:            private Combo comboSoapEnable;
088:
089:            private Text textLocationURI;
090:
091:            private Button sslButton;
092:
093:            private Button advancedSettingButton;
094:
095:            public Map<String, String> sslMap = new HashMap<String, String>();
096:
097:            //	public Map<String, String> proxyMap = new HashMap<String, String>();
098:
099:            private boolean updateOperation = false;
100:
101:            //	private Button proxyButton;
102:
103:            //	private Button proxyAdvancedSettingsButton;
104:
105:            private Button useGeneratedWsdlButton;
106:
107:            private Button useAnExistingButton;
108:
109:            private Button buildAndUseButton;
110:
111:            private Button useExistingButton;
112:
113:            private Button createNewButton;
114:            private Button regenerateButton;
115:
116:            private IEditorPart editor = PlatformUI.getWorkbench()
117:                    .getActiveWorkbenchWindow().getActivePage()
118:                    .getActiveEditor();
119:
120:            private String path = ((FileEditorInput) editor.getEditorInput())
121:                    .getFile().getProject().getLocation().toOSString();
122:
123:            protected HttpPropertyWizardPageServerProperty(String pageName) {
124:                super (pageName);
125:                setTitle(I18N.getString(Messages.HTTP_SERVER_TITLE));// "Choose
126:                setDescription(I18N.getString(Messages.WIZARD_ENTER_TIP));
127:            }
128:
129:            public void createControl(Composite parent) {
130:                Composite topLevel = new Composite(parent, SWT.NONE);
131:                final GridLayout gridLayout_1 = new GridLayout();
132:                gridLayout_1.verticalSpacing = 10;
133:                gridLayout_1.numColumns = 2;
134:                topLevel.setLayout(gridLayout_1);
135:                topLevel.setLayoutData(new GridData(
136:                        GridData.VERTICAL_ALIGN_FILL
137:                                | GridData.HORIZONTAL_ALIGN_FILL));
138:                topLevel.setFont(parent.getFont());
139:                this .setControl(topLevel);
140:
141:                Group soapGroup;
142:
143:                Label messageExchangePatternLabel;
144:
145:                final Label labelSource = new Label(topLevel, SWT.NONE);
146:                labelSource.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
147:                        false, false));
148:                labelSource.setText(I18N.getString(Messages.HTTP_URL));
149:
150:                textLocationURI = new Text(topLevel, SWT.BORDER);
151:                textLocationURI.setLayoutData(new GridData(SWT.FILL,
152:                        SWT.CENTER, false, false));
153:                textLocationURI.addModifyListener(new ModifyListener() {
154:                    public void modifyText(ModifyEvent e) {
155:                        dialogChanged();
156:                    }
157:                });
158:                messageExchangePatternLabel = new Label(topLevel, SWT.NONE);
159:                final GridData gridData_1 = new GridData(87, SWT.DEFAULT);
160:                messageExchangePatternLabel.setLayoutData(gridData_1);
161:                messageExchangePatternLabel.setText(I18N
162:                        .getString(Messages.WIZARD_MEP));
163:
164:                comboDefaultMep = new Combo(topLevel, SWT.READ_ONLY);
165:                comboDefaultMep.setLayoutData(new GridData(SWT.FILL,
166:                        SWT.CENTER, true, false));
167:                comboDefaultMep.setItems(new String[] { "in-only", "in-out",
168:                        "reliablein" });
169:                if (!this .getWizard().isUpdateOperation())
170:                    comboDefaultMep.setText("in-only");
171:
172:                final Label timeOutLabel = new Label(topLevel, SWT.NONE);
173:                timeOutLabel.setText(I18N.getString(Messages.TIME_OUT));
174:
175:                timeOutText = new Text(topLevel, SWT.BORDER);
176:                timeOutText.setText("30000");
177:                timeOutText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
178:                        true, false));
179:                timeOutText.addModifyListener(new ModifyListener() {
180:                    public void modifyText(final ModifyEvent e) {
181:                        dialogChanged();
182:                    }
183:                });
184:                soapGroup = new Group(topLevel, SWT.NONE);
185:                soapGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false,
186:                        true, 2, 1));
187:                final GridLayout gridLayout = new GridLayout();
188:                gridLayout.numColumns = 2;
189:                soapGroup.setLayout(gridLayout);
190:                soapGroup.setText(I18N.getString(Messages.HTTP_SOAP));
191:
192:                final Label unableLabel = new Label(soapGroup, SWT.NONE);
193:                unableLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
194:                        false, false));
195:                unableLabel.setText(I18N.getString(Messages.HTTP_SOAP_ENABLE));
196:
197:                comboSoapEnable = new Combo(soapGroup, SWT.READ_ONLY);
198:                comboSoapEnable.setItems(new String[] { "true", "false" });
199:                final GridData gridData = new GridData(SWT.FILL, SWT.CENTER,
200:                        true, false);
201:                comboSoapEnable.setLayoutData(gridData);
202:                if (!this .getWizard().isUpdateOperation())
203:                    comboSoapEnable.setText("false");
204:
205:                final Label attachmentModeLabel = new Label(soapGroup, SWT.NONE);
206:                attachmentModeLabel.setLayoutData(new GridData());
207:                attachmentModeLabel.setText(I18N
208:                        .getString(Messages.ATTACHMENT_MODE));
209:
210:                attachmentModeCombo = new Combo(soapGroup, SWT.READ_ONLY);
211:                attachmentModeCombo.setItems(new String[] {
212:                        AttachmentModeType.NONE_LITERAL.getLiteral(),
213:                        AttachmentModeType.SW_A_LITERAL.getLiteral(),
214:                        AttachmentModeType.MTOM_LITERAL.getLiteral() });
215:                attachmentModeCombo.setEnabled(false);
216:                attachmentModeCombo.select(0);
217:                attachmentModeCombo.setLayoutData(new GridData(SWT.FILL,
218:                        SWT.CENTER, true, false));
219:                new Label(soapGroup, SWT.NONE);
220:
221:                wsdlResourceGroup = new Group(topLevel, SWT.NONE);
222:                wsdlResourceGroup.setText(I18N
223:                        .getString(Messages.WSDL_RESOURCE));
224:
225:                wsdlResourceGroup.setLayoutData(new GridData(SWT.FILL,
226:                        SWT.FILL, false, true, 2, 1));
227:                final GridLayout gridLayout_2 = new GridLayout();
228:                gridLayout_2.numColumns = 2;
229:                wsdlResourceGroup.setLayout(gridLayout_2);
230:                wsdlResourceGroup.setEnabled(comboSoapEnable.getText().equals(
231:                        "true"));
232:                comboSoapEnable.addModifyListener(new ModifyListener() {
233:                    public void modifyText(final ModifyEvent e) {
234:                        if (comboSoapEnable.getText().equals("true")) {
235:                            if (attachmentModeCombo != null)
236:                                attachmentModeCombo.setEnabled(true);
237:
238:                        } else if (comboSoapEnable.getText().equals("false")) {
239:                            if (attachmentModeCombo != null)
240:                                attachmentModeCombo.setEnabled(false);
241:
242:                        }
243:                        dialogChanged();
244:                    }
245:                });
246:
247:                useGeneratedWsdlButton = new Button(wsdlResourceGroup,
248:                        SWT.RADIO);
249:                useGeneratedWsdlButton
250:                        .addSelectionListener(new SelectionAdapter() {
251:                            public void widgetSelected(final SelectionEvent e) {
252:
253:                                if (useGeneratedWsdlButton.getSelection()) {
254:                                    //	askToDeleteFile();
255:                                    useExistingButton.setEnabled(false);
256:                                    createNewButton.setEnabled(false);
257:                                    regenerateButton.setEnabled(true);
258:                                    try {
259:                                        generateDefaultWsdl();
260:                                        dialogChanged();
261:                                        try {
262:                                            ProjectUtil
263:                                                    .getCurProject()
264:                                                    .refreshLocal(
265:                                                            IResource.DEPTH_INFINITE,
266:                                                            null);
267:                                        } catch (CoreException e1) {
268:
269:                                            e1.printStackTrace();
270:                                        }
271:
272:                                    } catch (WSDLException e1) {
273:                                        e1.printStackTrace();
274:                                    } catch (IOException e1) {
275:                                        e1.printStackTrace();
276:                                    }
277:                                }
278:                            }
279:                        });
280:
281:                useGeneratedWsdlButton.setLayoutData(new GridData(SWT.FILL,
282:                        SWT.CENTER, false, false));
283:                useGeneratedWsdlButton.setText(I18N
284:                        .getString(Messages.USE_DEFAULT_WSDL));
285:
286:                regenerateButton = new Button(wsdlResourceGroup, SWT.NONE);
287:                regenerateButton.setLayoutData(new GridData(SWT.FILL,
288:                        SWT.RIGHT, false, false));
289:                regenerateButton.setText(I18N.getString(Messages.REGENERATE));
290:                regenerateButton.addSelectionListener(new SelectionAdapter() {
291:
292:                    public void widgetSelected(final SelectionEvent e) {
293:
294:                        if (useGeneratedWsdlButton.getSelection()) {
295:
296:                            try {
297:                                generateDefaultWsdl();
298:                                dialogChanged();
299:                                try {
300:                                    ProjectUtil.getCurProject().refreshLocal(
301:                                            IResource.DEPTH_INFINITE, null);
302:                                } catch (CoreException e1) {
303:
304:                                    e1.printStackTrace();
305:                                }
306:
307:                            } catch (WSDLException e1) {
308:                                e1.printStackTrace();
309:                            } catch (IOException e1) {
310:                                e1.printStackTrace();
311:                            }
312:                        }
313:                    }
314:                });
315:
316:                useAnExistingButton = new Button(wsdlResourceGroup, SWT.RADIO);
317:                useAnExistingButton
318:                        .addSelectionListener(new SelectionAdapter() {
319:                            public void widgetSelected(final SelectionEvent e) {
320:                                if (useAnExistingButton.getSelection()) {
321:                                    askToDeleteFile();
322:                                    useExistingButton.setEnabled(true);
323:                                    createNewButton.setEnabled(false);
324:                                    regenerateButton.setEnabled(false);
325:                                    dialogChanged();
326:                                }
327:                            }
328:                        });
329:                useAnExistingButton.setLayoutData(new GridData(SWT.FILL,
330:                        SWT.CENTER, false, false));
331:                useAnExistingButton.setText(I18N
332:                        .getString(Messages.USE_AN_EXISTING_WSDL));
333:
334:                useExistingButton = new Button(wsdlResourceGroup, SWT.NONE);
335:                useExistingButton.setLayoutData(new GridData(SWT.FILL,
336:                        SWT.RIGHT, false, false));
337:                useExistingButton.setText(I18N
338:                        .getString(Messages.CMW_ADVANCED_LABEL_IMPORT_BUTTON));
339:                useExistingButton.addSelectionListener(new SelectionAdapter() {
340:
341:                    public void widgetSelected(final SelectionEvent e) {
342:
343:                        deleteOldWSDL();
344:
345:                        if (useAnExistingButton.getSelection()) {
346:                            String suNAmeaaa = ((HttpPropertyWizardPageMain) getWizard()
347:                                    .getPage("Main")).getTextName().getText();
348:                            ImportWsdlDialog dialog = new ImportWsdlDialog(
349:                                    getShell(), SWT.PRIMARY_MODAL, suNAmeaaa,
350:                                    path);
351:                            dialog.open();
352:                            dialogChanged();
353:                        }
354:                    }
355:                });
356:
357:                buildAndUseButton = new Button(wsdlResourceGroup, SWT.RADIO);
358:                buildAndUseButton.addSelectionListener(new SelectionAdapter() {
359:                    public void widgetSelected(final SelectionEvent e) {
360:
361:                        if (buildAndUseButton.getSelection()) {
362:                            askToDeleteFile();
363:                            useExistingButton.setEnabled(false);
364:                            createNewButton.setEnabled(true);
365:                            regenerateButton.setEnabled(false);
366:                            dialogChanged();
367:                        }
368:                    }
369:                });
370:                buildAndUseButton.setLayoutData(new GridData(SWT.FILL,
371:                        SWT.CENTER, false, false));
372:                buildAndUseButton
373:                        .setText(I18N.getString(Messages.USE_NEW_WSDL));
374:
375:                createNewButton = new Button(wsdlResourceGroup, SWT.NONE);
376:                createNewButton.setLayoutData(new GridData(SWT.FILL, SWT.RIGHT,
377:                        false, false));
378:                createNewButton.setText(I18N.getString(Messages.NEW));
379:                createNewButton.addSelectionListener(new SelectionAdapter() {
380:                    public void widgetSelected(final SelectionEvent e) {
381:
382:                        deleteOldWSDL();
383:                        if (buildAndUseButton.getSelection()) {
384:
385:                            NewWSDLWizard newWSDLWizard = null;
386:                            try {
387:                                new URL(getTextLocationURI().getText());
388:                                // getting the name from text field instead of model
389:                                String suNAmeaaa = ((HttpPropertyWizardPageMain) getWizard()
390:                                        .getPage("Main")).getTextName()
391:                                        .getText();
392:                                newWSDLWizard = new NewWSDLWizard(suNAmeaaa,
393:                                        path, getTextLocationURI().getText());
394:                                WizardDialog wizard = new WizardDialog(
395:                                        PlatformUI.getWorkbench()
396:                                                .getActiveWorkbenchWindow()
397:                                                .getShell(), newWSDLWizard);
398:                                wizard.open();
399:                            } catch (MalformedURLException e1) {
400:                                dialogChanged();
401:                            } catch (IOException e1) {
402:                                e1.printStackTrace();
403:                            } catch (XmlException e1) {
404:                                e1.printStackTrace();
405:                            }
406:                            dialogChanged();
407:                        }
408:                    }
409:                });
410:                disableWSDLGroup();
411:
412:                sslButton = new Button(topLevel, SWT.CHECK);
413:                sslButton.setLayoutData(new GridData());
414:                sslButton.addSelectionListener(new SelectionAdapter() {
415:                    public void widgetSelected(SelectionEvent e) {
416:                        if (sslButton.getSelection()) {
417:                            advancedSettingButton.setEnabled(true);
418:                        } else
419:                            advancedSettingButton.setEnabled(false);
420:                        dialogChanged();
421:                    }
422:                });
423:                sslButton.setText(I18N.getString(Messages.TCPIP_SSL));
424:
425:                advancedSettingButton = new Button(topLevel, SWT.NONE);
426:                advancedSettingButton.setLayoutData(new GridData());
427:                advancedSettingButton.setEnabled(false);
428:                advancedSettingButton.setText(I18N
429:                        .getString(Messages.TCPIP_ADVANCED_SETTINGS));
430:                advancedSettingButton
431:                        .addSelectionListener(new SelectionAdapter() {
432:                            public void widgetSelected(SelectionEvent e) {
433:                                TCPIPServerSSLSettingsWizardPage dialog = new TCPIPServerSSLSettingsWizardPage(
434:                                        PlatformUI.getWorkbench()
435:                                                .getActiveWorkbenchWindow()
436:                                                .getShell(), sslMap,
437:                                        updateOperation);
438:                                dialog.open();
439:                            }
440:                        });
441:
442:                if (this .getWizard().isUpdateOperation()) {
443:                    updateOperation = true;
444:                    modelsToControl();
445:                }
446:                dialogChanged();
447:
448:            }
449:
450:            protected void generateDefaultWsdl() throws WSDLException,
451:                    IOException {
452:                String suName = getWizard().getMainPage().getTextName()
453:                        .getText();
454:                String saName = ProjectUtil.getCurProjectName();
455:                String suType = "http";
456:                String locationUrl = this .textLocationURI.getText();
457:                String folderPath = new Path(path).append("src").append("wsdl")
458:                        .append(suName).toString();
459:                File dirFile = new File(folderPath);
460:                if (!FileUtil.buildDirectory(dirFile))
461:                    throw new IOException(folderPath + " was not Created!");
462:
463:                HttpDefaultPublicWsdlGenerator.newPublicWsdl(folderPath,
464:                        saName, suName, suType, locationUrl);
465:            }
466:
467:            protected void updateWsdlAddress() throws WSDLException,
468:                    IOException {
469:                String suName = getWizard().getMainPage().getTextName()
470:                        .getText();
471:
472:                String locationUrl = this .textLocationURI.getText();
473:                String folderPath = new Path(path).append("src").append("wsdl")
474:                        .append(suName).toString();
475:                File dirFile = new File(folderPath);
476:                if (!FileUtil.buildDirectory(dirFile))
477:                    throw new IOException(folderPath + " was not Created!");
478:
479:                try {
480:                    HTTPPublicWsdlUpdater.updateAllAdressTags(folderPath + "/"
481:                            + suName + "_Server.wsdl", locationUrl);
482:                } catch (Exception e) {
483:                    e.printStackTrace();
484:                }
485:
486:            }
487:
488:            private HttpPropertyWizard getCurrentWizard() {
489:                return (HttpPropertyWizard) this .getWizard();
490:            }
491:
492:            protected void suNameDeleteSuName() {
493:                String suName = getWizard().getMainPage().getTextName()
494:                        .getText();
495:                File file = oldWSDLExist(suName);
496:                if (file != null)
497:                    file.delete();
498:            }
499:
500:            protected void suNameDeleteNull() {
501:                File file = oldWSDLExist("null");
502:                if (file != null)
503:                    file.delete();
504:
505:            }
506:
507:            protected void dialogChanged() {
508:                if (WizardUtil.whetherUseValidation == false) {
509:                    setPageComplete(true);
510:                    return;
511:                }
512:                if (textLocationURI == null)
513:                    return;
514:                if (textLocationURI.getText().equals("")) {
515:                    updateStatus(I18N
516:                            .getString(Messages.HTTP_ERROR_LOCATIONURL_REQUIRE));
517:                    this .disableWSDLGroup();
518:                    setPageComplete(false);
519:                    return;
520:                } else {
521:                    try {
522:                        new URL(textLocationURI.getText());
523:                    } catch (MalformedURLException e) {
524:                        // updateStatus(I18N.getString(Messages.HTTP_ERROR_LOCATIONURL_REQUIRE));
525:                        updateStatus(I18N
526:                                .getString(Messages.HTTP_ERROR_LOCATIONURL_REQUIRE)
527:                                + "(" + e.getMessage() + ")");
528:                        this .disableWSDLGroup();
529:                        setPageComplete(false);
530:                        return;
531:                    }
532:                }
533:
534:                if (timeOutText.getText().equals("")) {
535:                    updateStatus(I18N.getString(Messages.TIME_OUT_REQUIRED));
536:                    setPageComplete(false);
537:                    return;
538:                } else if (!timeOutText.getText().equals("")) {
539:                    if (!WizardUtil.isNumber(timeOutText.getText())) {
540:                        updateStatus(I18N.getString(Messages.TIME_OUT_NUMBER));
541:                        setPageComplete(false);
542:                        return;
543:                    }
544:                }
545:                if (comboDefaultMep.getText().equals("")) {
546:                    updateStatus(I18N
547:                            .getString(Messages.WIZARD_ERROR_MEP_REQUIRE));
548:                    setPageComplete(false);
549:                    return;
550:                }
551:
552:                if (comboSoapEnable.getText().equals("true")) {
553:                    this .enableWSDLGroup();
554:                    if (getWsdlResourceGroup().isEnabled()) {
555:                        //check one value to be selected
556:                        if (!(getUseAnExistingButton().getSelection()
557:                                || getUseGeneratedWsdlButton().getSelection() || getBuildAndUseButton()
558:                                .getSelection())) {
559:                            updateStatus(I18N
560:                                    .getString(Messages.NO_WSDL_SOURCE_SELECTED));
561:                            setPageComplete(false);
562:                            return;
563:                        }
564:
565:                        if (!haveFile()) {
566:                            setPageComplete(false);
567:                            if (getUseGeneratedWsdlButton().getSelection()) {
568:                                updateStatus(I18N
569:                                        .getString(Messages.REGENEARTE_FILE));
570:                            } else if (getUseAnExistingButton().getSelection()) {
571:                                updateStatus(I18N
572:                                        .getString(Messages.IMPORT_FILE));
573:                            } else {
574:                                updateStatus(I18N.getString(Messages.NEW_FILE));
575:                            }
576:
577:                            return;
578:                        }
579:
580:                    }
581:
582:                } else {
583:                    this .disableWSDLGroup();
584:                }
585:
586:                setPageComplete(true);
587:                updateStatus(null);
588:            }
589:
590:            private boolean haveFile() {
591:                HttpPropertyWizard wizard = getCurrentWizard();
592:
593:                //String httpName = wizard.getModels().getName();
594:                String suName = getWizard().getMainPage().getTextName()
595:                        .getText();
596:                File file = null;
597:                /*if(httpName != null)
598:                 file = oldWSDLExist(httpName);*/
599:
600:                File file1 = oldWSDLExist("null");
601:                File file2 = oldWSDLExist(suName);
602:                if (file1 == null && file2 == null) {
603:
604:                    return false;
605:                } else
606:                    return true;
607:            }
608:
609:            private void updateStatus(String message) {
610:                setErrorMessage(message);
611:            }
612:
613:            @Override
614:            public void controlToModels() {
615:
616:                HttpPropertyWizard httpWizard = (HttpPropertyWizard) this 
617:                        .getWizard();
618:
619:                if (httpWizard.getModels() == null)
620:                    return;
621:                try {
622:                    HttpConsumer httpConsumer = httpWizard.getModels()
623:                            .getHttpConsumer();
624:                    httpConsumer.setLocationUrl(textLocationURI.getText());
625:                    if (comboSoapEnable.getText().equals("true")) {
626:                        httpConsumer.setSoapEnabled(true);
627:                        httpWizard.getModels().getConsumerCCSL()
628:                                .setUseSendMessage(true);
629:                        httpWizard.getModels().getConsumerCCSL().setAddRecord(
630:                                false);
631:                        httpWizard.getModels().getConsumerCCSL()
632:                                .setStripRecord(false);
633:                        httpConsumer.setAttachmentMode(AttachmentModeType
634:                                .get(attachmentModeCombo.getSelectionIndex()));
635:
636:                        if (useGeneratedWsdlButton.getSelection())
637:                            httpConsumer
638:                                    .setWSDLSource(WSDLSource.USE_DEFAULT_LITERAL);
639:                        else if (useAnExistingButton.getSelection()) {
640:                            httpConsumer
641:                                    .setWSDLSource(WSDLSource.USE_EXISTING_LITERAL);
642:                        } else if (buildAndUseButton.getSelection()) {
643:                            httpConsumer
644:                                    .setWSDLSource(WSDLSource.CREATE_NEW_LITERAL);
645:                        }
646:
647:                    } else if (comboSoapEnable.getText().equals("false")) {
648:                        httpConsumer.setSoapEnabled(false);
649:                        httpWizard.getModels().getConsumerCCSL()
650:                                .setUseSendMessage(false);
651:                        httpWizard.getModels().getConsumerCCSL().setAddRecord(
652:                                true);
653:                        httpWizard.getModels().getConsumerCCSL()
654:                                .setStripRecord(true);
655:                    }
656:
657:                    httpConsumer.setTimeout(Integer.parseInt(timeOutText
658:                            .getText()));
659:
660:                    httpConsumer.setDefaultMep(DefaultMepType
661:                            .get(comboDefaultMep.getText()));
662:
663:                    if (sslButton.getSelection()) {
664:                        httpConsumer.setUseSsl(true);
665:                        SSL sslModel = httpConsumer.getSSL();
666:                        sslModel.setSslProtocol(SSLMode.get(sslMap
667:                                .get("sslProtocol")));
668:                        sslModel.setAllowAnonymous(Boolean.parseBoolean(sslMap
669:                                .get("allowAnonymous")));
670:                        sslModel.setUsePrivateKey(Boolean.parseBoolean(sslMap
671:                                .get("usePrivateKey")));
672:                        sslModel.setKeyStoreFile(sslMap.get("keyStoreFile"));
673:                        sslModel.setKeyStorePassword(sslMap
674:                                .get("keyStorePassword"));
675:                        sslModel.setAuthenticatePeer(new Boolean(sslMap.get(
676:                                "authenticateClient").toString()));
677:                        sslModel.setUseDefaultTrustStore(Boolean
678:                                .parseBoolean(sslMap
679:                                        .get("useDefaultTrustStore")));
680:                        sslModel
681:                                .setTrustStoreFile(sslMap.get("trustStoreFile"));
682:                        sslModel.setTrustStorePassword(sslMap
683:                                .get("trustStorePassword"));
684:                    } else {
685:                        httpConsumer.setUseSsl(false);
686:                    }
687:
688:                    FileEditorInput editorInput = (FileEditorInput) PlatformUI
689:                            .getWorkbench().getActiveWorkbenchWindow()
690:                            .getActivePage().getActiveEditor().getEditorInput();
691:
692:                    String projectName = editorInput.getFile().getProject()
693:                            .getName();
694:                    String suNAmeaaa = ((HttpPropertyWizardPageMain) getWizard()
695:                            .getPage("Main")).getTextName().getText();
696:                    File folder = ResourcesPlugin.getWorkspace().getRoot()
697:                            .getProject(projectName).getFile(
698:                                    "src/wsdl/" + suNAmeaaa).getLocation()
699:                            .toFile();
700:
701:                    if (useGeneratedWsdlButton.getSelection()
702:                            && httpConsumer.isSoapEnabled()) {
703:                        httpConsumer
704:                                .setMarshaller("com.bostechcorp.cbesb.runtime.component.http.marshallers.SendMessageMarshaller");
705:                    } else {
706:                        httpConsumer.setMarshaller("");
707:                    }
708:
709:                    if (folder.exists() && folder.isDirectory()) {
710:                        if (useGeneratedWsdlButton.getSelection()) {
711:
712:                            folder.delete();
713:                        }
714:                        File file = new File(folder.getPath()
715:                                + NewWSDLWizard.fileName);
716:                        if (file.exists()) {
717:                            if (useAnExistingButton.getSelection()) {
718:                                file.delete();
719:                            }
720:                        }
721:                    }
722:
723:                } catch (Exception e) {
724:                    e.printStackTrace();
725:                }
726:            }
727:
728:            public IWizardPage getNextPage() {
729:                if (this .getWizard().getMainPage().isProvider()
730:                        && this .getWizard().getMainPage().isUseCCSL())
731:                    return getWizard().getCcslProviderPage();
732:                else if (this .getWizard().getMainPage().isUseCCSL()) {
733:
734:                    return super .getWizard().getCcslConsumerPage();
735:                }
736:
737:                return null;
738:            }
739:
740:            @Override
741:            public void modelsToControl() {
742:
743:                HttpPropertyWizard httpWizard = (HttpPropertyWizard) this 
744:                        .getWizard();
745:                if (!httpWizard.isUpdateOperation())
746:                    return;
747:                try {
748:                    HttpConsumer httpConsumer = httpWizard.getModels()
749:                            .getHttpConsumer();
750:                    if (httpConsumer.getLocationUrl() != null)
751:                        textLocationURI.setText(httpConsumer.getLocationUrl());
752:                    else
753:                        textLocationURI.setText("");
754:
755:                    timeOutText.setText(String.valueOf(httpConsumer
756:                            .getTimeout()));
757:
758:                    if (httpConsumer.isSoapEnabled() == true) {
759:                        comboSoapEnable.setText("true");
760:                        attachmentModeCombo.setText(httpConsumer
761:                                .getAttachmentMode().getLiteral());
762:
763:                        if (httpConsumer.getWSDLSource().getLiteral()
764:                                .equalsIgnoreCase(
765:                                        WSDLSource.USE_DEFAULT_LITERAL
766:                                                .getLiteral())) {
767:                            useGeneratedWsdlButton.setSelection(true);
768:                            useExistingButton.setEnabled(false);
769:                            createNewButton.setEnabled(false);
770:                            regenerateButton.setEnabled(true);
771:                        } else if (httpConsumer.getWSDLSource().getLiteral()
772:                                .equalsIgnoreCase(
773:                                        WSDLSource.USE_EXISTING_LITERAL
774:                                                .getLiteral())) {
775:                            useAnExistingButton.setSelection(true);
776:                            useExistingButton.setEnabled(true);
777:                            createNewButton.setEnabled(false);
778:                            regenerateButton.setEnabled(false);
779:                        } else if (httpConsumer.getWSDLSource().getLiteral()
780:                                .equalsIgnoreCase(
781:                                        WSDLSource.CREATE_NEW_LITERAL
782:                                                .getLiteral())) {
783:                            buildAndUseButton.setSelection(true);
784:                            useExistingButton.setEnabled(false);
785:                            createNewButton.setEnabled(true);
786:                            regenerateButton.setEnabled(false);
787:                        }
788:
789:                    } else if (httpConsumer.isSoapEnabled() == false)
790:                        comboSoapEnable.setText("false");
791:                    comboDefaultMep.select(comboDefaultMep.indexOf(httpConsumer
792:                            .getDefaultMep().getLiteral()));
793:
794:                    sslButton.setSelection(httpConsumer.isUseSsl());
795:                    advancedSettingButton.setEnabled(httpConsumer.isUseSsl());
796:                    SSL sslModel = httpConsumer.getSSL();
797:                    sslMap.put("sslProtocol", sslModel.getSslProtocol()
798:                            .getLiteral());
799:                    sslMap.put("allowAnonymous", Boolean.toString(sslModel
800:                            .isAllowAnonymous()));
801:                    sslMap.put("usePrivateKey", Boolean.toString(sslModel
802:                            .isUsePrivateKey()));
803:                    sslMap.put("keyStoreFile", sslModel.getKeyStoreFile());
804:                    sslMap.put("keyStorePassword", sslModel
805:                            .getKeyStorePassword());
806:                    sslMap.put("authenticateClient", new Boolean(sslModel
807:                            .isAuthenticatePeer()).toString());
808:                    sslMap.put("useDefaultTrustStore", Boolean
809:                            .toString(sslModel.isUseDefaultTrustStore()));
810:                    sslMap.put("trustStoreFile", sslModel.getTrustStoreFile());
811:                    sslMap.put("trustStorePassword", sslModel
812:                            .getTrustStorePassword());
813:
814:                } catch (Exception e) {
815:                    e.printStackTrace();
816:                }
817:            }
818:
819:            private void askToDeleteFile() {
820:                HttpPropertyWizard wizard = getCurrentWizard();
821:
822:                String httpName = wizard.getModels().getName();
823:                File file = oldWSDLExist(httpName);
824:                String name = this .getWizard().getMainPage().getTextName()
825:                        .getText();
826:                File file1 = oldWSDLExist(name);
827:                if (file != null || file1 != null) {
828:                    int open = MsgUtil.confirmDialog(I18N
829:                            .getString(Messages.DELETE_WSDL_FILE),
830:                            SWT.ICON_QUESTION | SWT.YES | SWT.NO);
831:                    switch (open) {
832:                    case SWT.YES:
833:                        try {
834:                            if (file != null)
835:                                file.delete();
836:                            if (file1 != null)
837:                                file1.delete();
838:                        } catch (Exception e1) {
839:                            e1.printStackTrace();
840:                        }
841:
842:                    }
843:                }
844:            }
845:
846:            private void disableWSDLGroup() {
847:                getWsdlResourceGroup().setEnabled(false);
848:                useGeneratedWsdlButton.setEnabled(false);
849:                useAnExistingButton.setEnabled(false);
850:                buildAndUseButton.setEnabled(false);
851:                useExistingButton.setEnabled(false);
852:                createNewButton.setEnabled(false);
853:                this .regenerateButton.setEnabled(false);
854:            }
855:
856:            private void enableWSDLGroup() {
857:                getWsdlResourceGroup().setEnabled(true);
858:                useGeneratedWsdlButton.setEnabled(true);
859:                useAnExistingButton.setEnabled(true);
860:                buildAndUseButton.setEnabled(true);
861:                //useExistingButton.setEnabled(true);
862:                //createNewButton.setEnabled(true);
863:            }
864:
865:            private void deleteOldWSDL() {
866:                HttpPropertyWizard wizard = (HttpPropertyWizard) this 
867:                        .getWizard();
868:
869:                String httpName = wizard.getModels().getName();
870:                File file = oldWSDLExist(httpName);
871:                if (file != null) {
872:                    file.delete();
873:                }
874:
875:                file = oldWSDLExist("null");
876:                if (file != null) {
877:                    file.delete();
878:                }
879:                String name = this .getWizard().getMainPage().getTextName()
880:                        .getText();
881:                file = oldWSDLExist(name);
882:                if (file != null) {
883:                    file.delete();
884:                }
885:
886:            }
887:
888:            public Combo getComboSoapEnable() {
889:                return comboSoapEnable;
890:            }
891:
892:            public Text getTextLocationURI() {
893:                return textLocationURI;
894:            }
895:
896:            public String getWSDLResource() {
897:                if (useAnExistingButton.getSelection()) {
898:                    return "Existing";
899:                } else if (useGeneratedWsdlButton.getSelection()) {
900:                    return "Generated";
901:                } else if (buildAndUseButton.getSelection()) {
902:                    return "New";
903:                }
904:                return "";
905:            }
906:
907:            protected Group getWsdlResourceGroup() {
908:                return wsdlResourceGroup;
909:            }
910:
911:            public Button getUseGeneratedWsdlButton() {
912:                return useGeneratedWsdlButton;
913:            }
914:
915:            public Button getUseAnExistingButton() {
916:                return useAnExistingButton;
917:            }
918:
919:            public Button getBuildAndUseButton() {
920:                return buildAndUseButton;
921:            }
922:        }
w_w__w__.j__av___a_2___s_.c___o__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.