KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > wsitconf > ui > service > profiles > SAMLAuthorizationOverSSLProfile


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.websvc.wsitconf.ui.service.profiles;
21
22 import java.awt.Dialog JavaDoc;
23 import javax.swing.JPanel JavaDoc;
24 import javax.swing.undo.UndoManager JavaDoc;
25 import org.netbeans.modules.websvc.wsitconf.spi.SecurityProfile;
26 import org.netbeans.modules.websvc.wsitconf.ui.ComboConstants;
27 import org.netbeans.modules.websvc.wsitconf.util.UndoCounter;
28 import org.netbeans.modules.websvc.wsitconf.wsdlmodelext.ProfilesModelHelper;
29 import org.netbeans.modules.websvc.wsitconf.wsdlmodelext.SecurityPolicyModelHelper;
30 import org.netbeans.modules.xml.wsdl.model.WSDLComponent;
31 import org.netbeans.modules.xml.wsdl.model.WSDLModel;
32 import org.openide.DialogDescriptor;
33 import org.openide.DialogDisplayer;
34
35 /**
36  * Transport Security Profile definition
37  *
38  * @author Martin Grebac
39  */

40 public class SAMLAuthorizationOverSSLProfile extends SecurityProfile {
41     
42     public int getId() {
43         return 50;
44     }
45
46     public String JavaDoc getDisplayName() {
47         return ComboConstants.PROF_SAMLSSL;
48     }
49
50     public String JavaDoc getDescription() {
51         return ComboConstants.PROF_SAMLSSL_INFO;
52     }
53     
54     /**
55      * Called when the profile is selected in the combo box.
56      */

57     public void profileSelected(WSDLComponent component) {
58         ProfilesModelHelper.setSecurityProfile(component, getDisplayName());
59     }
60
61     /**
62      * Called when there's another profile selected, or security is disabled at all.
63      */

64     public void profileDeselected(WSDLComponent component) {
65         SecurityPolicyModelHelper.disableSecurity(component, false);
66     }
67
68     /**
69      * Should return true if the profile is set on component, false otherwise
70      */

71     public boolean isCurrentProfile(WSDLComponent component) {
72         return getDisplayName().equals(ProfilesModelHelper.getWSITSecurityProfile(component));
73     }
74     
75     @Override JavaDoc()
76     public void displayConfig(WSDLComponent component, UndoManager JavaDoc undoManager) {
77         UndoCounter undoCounter = new UndoCounter();
78         WSDLModel model = component.getModel();
79         
80         model.addUndoableEditListener(undoCounter);
81
82         JPanel JavaDoc profConfigPanel = new SAMLAuthorizationOverSSL(component);
83         DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
84         Dialog JavaDoc dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);
85
86         dlg.setVisible(true);
87         if (dlgDesc.getValue() == dlgDesc.CANCEL_OPTION) {
88             for (int i=0; i<undoCounter.getCounter();i++) {
89                 if (undoManager.canUndo()) {
90                     undoManager.undo();
91                 }
92             }
93         }
94         
95         model.removeUndoableEditListener(undoCounter);
96     }
97 }
98
Popular Tags