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:
025: package com.bostechcorp.cbesb.ui.ide.security;
026:
027: import org.eclipse.jface.viewers.IStructuredSelection;
028:
029: import org.eclipse.jface.wizard.IWizardPage;
030: import org.eclipse.jface.wizard.Wizard;
031: import org.eclipse.jface.wizard.WizardPage;
032:
033: import org.eclipse.ui.IWorkbench;
034:
035: import com.bostechcorp.cbesb.common.i18n.I18N;
036: import com.bostechcorp.cbesb.common.i18n.Messages;
037: import com.bostechcorp.cbesb.ui.util.ProjectUtil;
038:
039: public class CertificateManagerWizard extends Wizard {
040:
041: private CMWMainPage mainPage;
042: //first lvl
043: private CMWAnonimousSSL anonimousPage;
044: private CMWClientAuthorityServerAuthenticated clientAas;
045: private CMWClientPointAuthenticated clientp2p;
046: private CMWServerAuthorityServerAuthenticated serverAas;
047: private CMWServerPointAuthenticated serverp2p;
048: private CMWAdvancedSelectPage advanced;
049: //2nd lvl
050: // cl aas
051: //private CMWClientAuthorityServerAuthenticated clientAuthorityServerAuthenticated;
052: //cl p2p
053: //private CMWClientPointAuthenticated clientPointAuthenticated;
054: private CMWClientPointAuthenticated3 clientPointAuthenticated3;
055: private CMWClientPointAuthenticated5 clientPointAuthenticated5;
056: private CMWClientPointAuthenticated7 clientPointAuthenticated7;
057: //srv aas
058: //private CMWServerAuthorityServerAuthenticated serverAuthorityServerAuthenticated;
059: private CMWServerAuthorityServerAuthenticated3 serverAuthorityServerAuthenticated3;
060: private CMWServerAuthorityServerAuthenticated5 serverAuthorityServerAuthenticated5;
061: private CMWServerAuthorityServerAuthenticated7 serverAuthorityServerAuthenticated7;
062:
063: //srv p2p
064: //private CMWServerPointAuthenticated serverPointAuthenticated;
065: private CMWServerPointAuthenticated3 serverPointAuthenticated3;
066: private CMWServerPointAuthenticated5 serverPointAuthenticated5;
067: private CMWServerPointAuthenticated7 serverPointAuthenticated7;
068:
069: //3rd-advanced lvl
070: private CMWAdvDeleteCertificate advDeleteCertificate;
071: private CMWAdvExportCertificate advExportCertificate;
072: private CMWAdvExportCSR advExportCSR;//
073: private CMWAdvExportPKC advExportPKC;//
074: private CMWAdvGenerateKey advGenerateKey;//
075: private CMWAdvImportCertificate advImportCertificate;
076: private CMWAdvImportSC advImportSC;//
077: private CMWAdvViewCEF advViewCEF;
078: private CMWAdvViewKF advViewKF;//
079: private CMWAdvViewTF advViewTF;
080:
081: //Atributes for Specifyying the page order
082: public WizardPage next = null;
083: public WizardPage previous = null;
084:
085: //Attributes to keep track of the project being used
086: public IStructuredSelection selection;
087: public IWorkbench workbrench;
088: public static String projectWorkSpace = null;
089: public static String projectName = null;
090:
091: /**
092: * Constructor of the Certificate wizard to be invoked by the Actions
093: * @param workbench
094: * @param selection
095: */
096: public CertificateManagerWizard(IWorkbench workbench,
097: IStructuredSelection selection) {
098: super ();
099: setWindowTitle(I18N.getString(Messages.CMW_TITLE));
100: init(workbench, selection);
101: }
102:
103: /**
104: * Constructor of the Certificate Wizard to be invoked by non action classes
105: * @param projectWorkSpace path to the Workspace.
106: * very important! path should use "/" separator because BaseFileBrowser
107: * knows only "/" path separator
108: * @param projectName the CASE sensitive project name within the workspace
109: */
110: public CertificateManagerWizard(String projectPath,
111: String projectName) {
112: super ();
113: setWindowTitle(I18N.getString(Messages.CMW_TITLE));
114: CertificateManagerWizard.projectName = projectName;
115: CertificateManagerWizard.projectWorkSpace = projectPath;
116: }
117:
118: private CertificateManagerWizard() {
119: super ();
120: setWindowTitle(I18N.getString(Messages.CMW_TITLE));
121: }
122:
123: @Override
124: public boolean performFinish() {
125: boolean result = false;
126: if (this .getContainer().getCurrentPage() instanceof CMWContextAwarePage) {
127: result = ((CMWContextAwarePage) this .getContainer()
128: .getCurrentPage()).performFinish();
129: }
130: ProjectUtil.refreshProject(projectName);
131: return result;
132: }
133:
134: @Override
135: public boolean performCancel() {
136: boolean result = false;
137: if (this .getContainer().getCurrentPage() instanceof CMWContextAwarePage) {
138: result = ((CMWContextAwarePage) this .getContainer()
139: .getCurrentPage()).performCancel();
140: }
141: ProjectUtil.refreshProject(projectName);
142: return result;
143:
144: }
145:
146: @Override
147: public void addPages() {
148: super .addPages();
149: //
150: //nextSequence = new ArrayList<WizardPage>();
151: //previousSequence = new ArrayList<WizardPage>();
152: //
153: mainPage = new CMWMainPage("");
154: addCAPage(mainPage);
155: anonimousPage = new CMWAnonimousSSL("");
156: addCAPage(anonimousPage);
157: clientAas = new CMWClientAuthorityServerAuthenticated("");
158: addCAPage(clientAas);
159: clientp2p = new CMWClientPointAuthenticated("");
160: addCAPage(clientp2p);
161: serverAas = new CMWServerAuthorityServerAuthenticated("");
162: addCAPage(serverAas);
163: serverp2p = new CMWServerPointAuthenticated("");
164: addCAPage(serverp2p);
165: advanced = new CMWAdvancedSelectPage("");
166: addCAPage(advanced);
167:
168: // adding advanced pages
169: advDeleteCertificate = new CMWAdvDeleteCertificate("");
170: addCAPage(advDeleteCertificate);
171: advExportCertificate = new CMWAdvExportCertificate("");
172: addCAPage(advExportCertificate);
173: advExportCSR = new CMWAdvExportCSR("");
174: addCAPage(advExportCSR);
175: advExportPKC = new CMWAdvExportPKC("");
176: addCAPage(advExportPKC);
177: advGenerateKey = new CMWAdvGenerateKey("");
178: addCAPage(advGenerateKey);
179: advImportCertificate = new CMWAdvImportCertificate("");
180: addCAPage(advImportCertificate);
181: advImportSC = new CMWAdvImportSC("");
182: addCAPage(advImportSC);
183: advViewCEF = new CMWAdvViewCEF("");
184: addCAPage(advViewCEF);
185: advViewKF = new CMWAdvViewKF("");
186: addCAPage(advViewKF);
187: advViewTF = new CMWAdvViewTF("");
188: addCAPage(advViewTF);
189: //
190: clientPointAuthenticated3 = new CMWClientPointAuthenticated3("");
191: addCAPage(clientPointAuthenticated3);
192: clientPointAuthenticated5 = new CMWClientPointAuthenticated5("");
193: addCAPage(clientPointAuthenticated5);
194: clientPointAuthenticated7 = new CMWClientPointAuthenticated7("");
195: addCAPage(clientPointAuthenticated7);
196: //srv aas
197: serverAuthorityServerAuthenticated3 = new CMWServerAuthorityServerAuthenticated3(
198: "");
199: addCAPage(serverAuthorityServerAuthenticated3);
200: serverAuthorityServerAuthenticated5 = new CMWServerAuthorityServerAuthenticated5(
201: "");
202: addCAPage(serverAuthorityServerAuthenticated5);
203: serverAuthorityServerAuthenticated7 = new CMWServerAuthorityServerAuthenticated7(
204: "");
205: addCAPage(serverAuthorityServerAuthenticated7);
206: //srv p2p
207: serverPointAuthenticated3 = new CMWServerPointAuthenticated3("");
208: addCAPage(serverPointAuthenticated3);
209: serverPointAuthenticated5 = new CMWServerPointAuthenticated5("");
210: addCAPage(serverPointAuthenticated5);
211: serverPointAuthenticated7 = new CMWServerPointAuthenticated7("");
212: addCAPage(serverPointAuthenticated7);
213:
214: }
215:
216: private void addCAPage(CMWContextAwarePage page) {
217: addPage(page);
218: page.init(selection);
219: }
220:
221: @Override
222: public boolean canFinish() {
223: //return super.canFinish();
224: if (this .getContainer().getCurrentPage() instanceof CMWContextAwarePage) {
225: return ((CMWContextAwarePage) this .getContainer()
226: .getCurrentPage()).canFinish();
227: }
228: return true;
229: }
230:
231: ///
232:
233: @Override
234: public IWizardPage getNextPage(IWizardPage page) {
235: WizardPage toReturn = next;
236: return toReturn;
237: }
238:
239: @Override
240: public IWizardPage getPreviousPage(IWizardPage page) {
241: WizardPage toReturn = previous;
242: return toReturn;
243: }
244:
245: public void setNext(WizardPage p) {
246: this .next = p;
247: }
248:
249: public void setPrevious(WizardPage p) {
250: this .previous = p;
251: }
252:
253: //Getters ****
254: /**
255: * @return the advanced
256: */
257: public CMWAdvancedSelectPage getAdvanced() {
258: return advanced;
259: }
260:
261: /**
262: * @return the advDeleteCertificate
263: */
264: public CMWAdvDeleteCertificate getAdvDeleteCertificate() {
265: return advDeleteCertificate;
266: }
267:
268: /**
269: * @return the advExportCertificate
270: */
271: public CMWAdvExportCertificate getAdvExportCertificate() {
272: return advExportCertificate;
273: }
274:
275: /**
276: * @return the advExportCSR
277: */
278: public CMWAdvExportCSR getAdvExportCSR() {
279: return advExportCSR;
280: }
281:
282: /**
283: * @return the advExportPKC
284: */
285: public CMWAdvExportPKC getAdvExportPKC() {
286: return advExportPKC;
287: }
288:
289: /**
290: * @return the advGenerateKey
291: */
292: public CMWAdvGenerateKey getAdvGenerateKey() {
293: return advGenerateKey;
294: }
295:
296: /**
297: * @return the advImportCertificate
298: */
299: public CMWAdvImportCertificate getAdvImportCertificate() {
300: return advImportCertificate;
301: }
302:
303: /**
304: * @return the advImportSC
305: */
306: public CMWAdvImportSC getAdvImportSC() {
307: return advImportSC;
308: }
309:
310: /**
311: * @return the advViewCEF
312: */
313: public CMWAdvViewCEF getAdvViewCEF() {
314: return advViewCEF;
315: }
316:
317: /**
318: * @return the advViewKF
319: */
320: public CMWAdvViewKF getAdvViewKF() {
321: return advViewKF;
322: }
323:
324: /**
325: * @return the advViewTF
326: */
327: public CMWAdvViewTF getAdvViewTF() {
328: return advViewTF;
329: }
330:
331: /**
332: * @return the anonimousPage
333: */
334: public CMWAnonimousSSL getAnonimousPage() {
335: return anonimousPage;
336: }
337:
338: /**
339: * @return the clientAas
340: */
341: public CMWClientAuthorityServerAuthenticated getClientAas() {
342: return clientAas;
343: }
344:
345: /**
346: * @return the clientp2p
347: */
348: public CMWClientPointAuthenticated getClientp2p() {
349: return clientp2p;
350: }
351:
352: /**
353: * @return the clientPointAuthenticated3
354: */
355: public CMWClientPointAuthenticated3 getClientPointAuthenticated3() {
356: return clientPointAuthenticated3;
357: }
358:
359: /**
360: * @return the clientPointAuthenticated5
361: */
362: public CMWClientPointAuthenticated5 getClientPointAuthenticated5() {
363: return clientPointAuthenticated5;
364: }
365:
366: /**
367: * @return the clientPointAuthenticated7
368: */
369: public CMWClientPointAuthenticated7 getClientPointAuthenticated7() {
370: return clientPointAuthenticated7;
371: }
372:
373: /**
374: * @return the mainPage
375: */
376: public CMWMainPage getMainPage() {
377: return mainPage;
378: }
379:
380: /* *//**
381: * @return the nextSequence
382: */
383: /*
384: public List<WizardPage> getNextSequence() {
385: return nextSequence;
386: }
387: */
388: /* *//**
389: * @return the previousSequence
390: */
391: /*
392: public List<WizardPage> getPreviousSequence() {
393: return previousSequence;
394: }
395: */
396: /**
397: * @return the serverAas
398: */
399: public CMWServerAuthorityServerAuthenticated getServerAas() {
400: return serverAas;
401: }
402:
403: /**
404: * @return the serverAuthorityServerAuthenticated3
405: */
406: public CMWServerAuthorityServerAuthenticated3 getServerAuthorityServerAuthenticated3() {
407: return serverAuthorityServerAuthenticated3;
408: }
409:
410: /**
411: * @return the serverAuthorityServerAuthenticated5
412: */
413: public CMWServerAuthorityServerAuthenticated5 getServerAuthorityServerAuthenticated5() {
414: return serverAuthorityServerAuthenticated5;
415: }
416:
417: /**
418: * @return the serverAuthorityServerAuthenticated7
419: */
420: public CMWServerAuthorityServerAuthenticated7 getServerAuthorityServerAuthenticated7() {
421: return serverAuthorityServerAuthenticated7;
422: }
423:
424: /**
425: * @return the serverp2p
426: */
427: public CMWServerPointAuthenticated getServerp2p() {
428: return serverp2p;
429: }
430:
431: /**
432: * @return the serverPointAuthenticated3
433: */
434: public CMWServerPointAuthenticated3 getServerPointAuthenticated3() {
435: return serverPointAuthenticated3;
436: }
437:
438: /**
439: * @return the serverPointAuthenticated5
440: */
441: public CMWServerPointAuthenticated5 getServerPointAuthenticated5() {
442: return serverPointAuthenticated5;
443: }
444:
445: public void init(IWorkbench workbench,
446: IStructuredSelection selection) {
447: this .selection = selection;
448: this .workbrench = workbench;
449: }
450:
451: /**
452: * @return the serverPointAuthenticated7
453: */
454: public CMWServerPointAuthenticated7 getServerPointAuthenticated7() {
455: return serverPointAuthenticated7;
456: }
457: }
|