geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcco...@apache.org
Subject svn commit: r938593 [4/8] - in /geronimo/devtools/eclipse-plugin/trunk: plugins/org.apache.geronimo.st.ui/ plugins/org.apache.geronimo.st.v21.ui/ plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/ plugins/org.ap...
Date Tue, 27 Apr 2010 18:20:24 GMT
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityAdvancedSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityAdvancedSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityAdvancedSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityAdvancedSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,526 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.deployment.Pattern;
+import org.apache.geronimo.jee.security.Role;
+import org.apache.geronimo.jee.security.RoleMappings;
+import org.apache.geronimo.jee.security.Security;
+import org.apache.geronimo.jee.security.SubjectInfo;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.v30.core.GeronimoServerInfo;
+import org.apache.geronimo.st.v30.core.jaxb.JAXBModelUtils;
+import org.apache.geronimo.st.v30.ui.wizards.SecurityRunAsSubjectWizard;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SecurityAdvancedSection extends AbstractTableSection {
+
+    //private static final String SPECIFY_CREDENTIAL_STORE_MANUALLY = "<specify manually>";
+
+    protected Combo credentialStoreRef;
+//    protected Button specifyCredentialStoreRefButton;
+//    protected Button deleteCredentialStoreRefButton;
+
+    private Hashtable<String, Pattern> credentialStoreList = new Hashtable<String, Pattern>();
+
+    protected Combo defaultSubjectRealmName;
+
+    protected Combo defaultSubjectId;
+
+    protected Button doAsCurrentCaller;
+
+    protected Button useContextHandler;
+    
+    private HashMap<Pattern,HashMap<String,ArrayList<String>>> credentialStoreAttributes;
+
+    public SecurityAdvancedSection(JAXBElement plan, Composite parent, FormToolkit toolkit, int style) {
+        super(plan, parent, toolkit, style);
+        createClient();
+    }
+
+    public void createClient() {
+        Section section = getSection();
+        section.setText(getTitle());
+        section.setDescription(getDescription());
+        section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+        Composite clientComposite = createComposite(getSection(), 3);
+        section.setClient(clientComposite);
+
+        Composite composite1 = createComposite(clientComposite, 2);
+        composite1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
+
+        doAsCurrentCaller = toolkit.createButton(composite1, CommonMessages.securityDoasCurrentCaller,
+                SWT.CHECK);
+        doAsCurrentCaller.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+        doAsCurrentCaller.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                setDoAsCurrentCaller();
+                markDirty();
+            }
+        });
+        doAsCurrentCaller.setSelection(isDoasCurrentCaller());
+
+        useContextHandler = toolkit.createButton(composite1, CommonMessages.securityUseContextHandler,
+                SWT.CHECK);
+        useContextHandler.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+        useContextHandler.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                setUseContextHandler();
+                markDirty();
+            }
+        });
+        useContextHandler.setSelection(isUseContextHandler());
+
+        createLabel(clientComposite, CommonMessages.securityCredentialStore);
+        credentialStoreRef = new Combo(clientComposite, SWT.READ_ONLY| SWT.BORDER);
+   //   credentialStoreRef.setText("<credential store ref name will go here>");
+        GridData gridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
+        gridData.widthHint = 300;
+        credentialStoreRef.setLayoutData(gridData);
+        populateCredentialStores();
+        credentialStoreRef.addSelectionListener(new SelectionAdapter(){
+
+            public void widgetSelected(SelectionEvent arg0) {
+                setCredentialStoreRef();
+                populateDefaultSubjectRealmName();
+                populateDefaultSubjectId();
+                toggleAdvancedSettings();
+                markDirty();
+            }
+            
+        });
+
+        Composite composite2 = toolkit.createComposite(clientComposite);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        layout.marginHeight = 5;
+        layout.marginWidth = 0;
+        layout.verticalSpacing = 5;
+        layout.horizontalSpacing = 5;
+        composite2.setLayout(layout);
+        composite2.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+    /*    specifyCredentialStoreRefButton = toolkit.createButton(composite2, CommonMessages.edit, SWT.NONE);
+        specifyCredentialStoreRefButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+        specifyCredentialStoreRefButton.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                Wizard wizard = getCredentialStoreRefWizard();
+                WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
+                dialog.open();
+                if (dialog.getReturnCode() == Dialog.OK) {
+                    setCredentialStoreRef();
+                    toggleAdvancedSettings();
+                    markDirty();
+                }
+            }
+        });
+        deleteCredentialStoreRefButton = toolkit.createButton(composite2, CommonMessages.remove, SWT.NONE);
+        deleteCredentialStoreRefButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+        deleteCredentialStoreRefButton.addSelectionListener(new SelectionAdapter(){
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+            }
+        });*/
+
+        createLabel(clientComposite, CommonMessages.securityDefaultSubject);
+        createLabel(clientComposite, "");
+        createLabel(clientComposite, "");
+        //group = createGroup(clientComposite, CommonMessages.securityDefaultSubject);
+
+        //createLabel(clientComposite, "");
+        //Composite composite3 = createComposite(clientComposite, 2);
+        //composite3.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
+        createLabel(clientComposite, CommonMessages.securityDefaultSubjectRealmName).setLayoutData(
+                new GridData(SWT.RIGHT, SWT.CENTER, false, false));
+        defaultSubjectRealmName = new Combo(clientComposite, SWT.SINGLE | SWT.DROP_DOWN |SWT.READ_ONLY);
+        populateDefaultSubjectRealmName();
+        gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
+        gridData.widthHint = 100;
+        defaultSubjectRealmName.setLayoutData(gridData);
+        defaultSubjectRealmName.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent arg0) {
+                populateDefaultSubjectId();
+                markDirty();
+            }
+        });
+        defaultSubjectRealmName.pack();
+
+        //createLabel(clientComposite, "");
+        //Composite composite4 = createComposite(clientComposite, 2);
+        //composite4.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
+        createLabel(clientComposite, CommonMessages.securityDefaultSubjectId).setLayoutData(
+                new GridData(SWT.RIGHT, SWT.CENTER, false, false));
+        defaultSubjectId = new Combo(clientComposite, SWT.SINGLE | SWT.DROP_DOWN |SWT.READ_ONLY);
+        defaultSubjectId.add(getDefaultSubjectId());
+        gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
+        gridData.widthHint = 100;
+        defaultSubjectId.setLayoutData(gridData);
+        populateDefaultSubjectId();
+        defaultSubjectId.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent arg0) {
+                setDefaultSubject();
+                markDirty();
+            }
+        });
+        defaultSubjectId.pack();
+
+        //group = createGroup(clientComposite, CommonMessages.securityRunAsSubjects);
+        createLabel(clientComposite, "").setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
+        createLabel(clientComposite, CommonMessages.securityRunAsSubjects).setLayoutData(
+                new GridData(SWT.LEFT, SWT.TOP, false, false));
+        createViewer(clientComposite);
+        viewer.setContentProvider(getContentProvider());
+        viewer.setLabelProvider(getLabelProvider());
+        viewer.setInput(getInput());
+
+        Composite buttonComposite = createButtonComposite(clientComposite);
+        createAddButton(buttonComposite);
+        createRemoveButton(buttonComposite);
+        createEditButton(buttonComposite);
+        activateButtons();
+
+        section.setExpanded(false);
+        toggleAdvancedSettings();
+    }
+
+    private void populateDefaultSubjectRealmName() {
+         defaultSubjectRealmName.removeAll();
+        
+         String realmName = getDefaultSubjectRealmName();
+         
+         defaultSubjectRealmName.add(realmName);
+         if (realmName.length() > 0) {
+             defaultSubjectRealmName.add("");
+         }
+        
+         String credentialStoreName = credentialStoreRef.getText();
+         if (credentialStoreName!=null && credentialStoreName.length()!=0) {
+             Map<String,ArrayList<String>> realmNameMap = credentialStoreAttributes.get(credentialStoreList.get(credentialStoreName));
+             if (realmNameMap!=null) {
+                 Set<String> nameSet = realmNameMap.keySet();
+                 for (String name: nameSet){
+                     if (!name.equals(realmName))
+                         defaultSubjectRealmName.add(name);
+                 }
+             }
+         }   
+         defaultSubjectRealmName.select(0);
+    }
+    
+    private void populateDefaultSubjectId() {
+         defaultSubjectId.removeAll();
+        
+         String subjectId = getDefaultSubjectId();
+         defaultSubjectId.add(subjectId);
+         if (subjectId.length() > 0) {
+            defaultSubjectId.add(""); 
+         }
+            
+         String credentialStoreName = credentialStoreRef.getText();
+         String defaultRealmName = defaultSubjectRealmName.getText();
+         if (credentialStoreName!=null && credentialStoreName.length()!=0 && defaultRealmName!=null && defaultRealmName.length()!=0) {
+             Map<String,ArrayList<String>> realmNameMap = credentialStoreAttributes.get(credentialStoreList.get(credentialStoreName));
+             if (realmNameMap!=null) {
+                 ArrayList<String> ids = realmNameMap.get(defaultRealmName);
+                 for (String id: ids){
+                     if (!id.equals(subjectId))                  
+                         defaultSubjectId.add(id);
+                 }
+             }
+         }   
+         defaultSubjectId.select(0);
+    }
+
+/*    private Wizard getCredentialStoreRefWizard() {
+        return null;
+    }*/
+
+    private void toggleAdvancedSettings() {
+        boolean enable = false;
+        
+        if (getSecurity() != null && getSecurity().getCredentialStoreRef() != null 
+                && (defaultSubjectRealmName.getItemCount() > 0 || defaultSubjectId.getItemCount() >0)) {
+            enable = true;
+        }
+        
+        defaultSubjectRealmName.setEnabled(enable);
+        defaultSubjectId.setEnabled(enable);
+        table.setEnabled(enable);        
+        activateAddButton();
+    }
+
+    @Override
+    public Object getInput() {
+        return SecurityRoleMappingSection.getRoleMappings(getPlan(), false);
+    }
+
+    @Override
+    public IContentProvider getContentProvider() {
+        return new ContentProvider() {
+            @Override
+            public Object[] getElements(Object inputElement) {
+                if (inputElement instanceof RoleMappings) {
+                    return ((RoleMappings) inputElement).getRole().toArray();
+                }
+                return super.getElements(inputElement);
+            }
+        };
+    }
+
+    @Override
+    protected boolean filter(Viewer viewer, Object parentElement, Object element) {
+        if (element instanceof Role) {
+            return ((Role) element).getRunAsSubject() != null;
+        }
+        return false;
+    }
+
+    @Override
+    public IBaseLabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
+            public String getColumnText(Object element, int columnIndex) {
+                if (element instanceof Role) {
+                    Role role = (Role) element;
+                    switch (columnIndex) {
+                    case 0:
+                        return role.getRoleName();
+                    case 1:
+                        return role.getRunAsSubject().getRealm();
+                    case 2:
+                        return role.getRunAsSubject().getId();
+                    }
+                }
+                return "";
+            }
+        };
+    }
+
+    @Override
+    protected void removeItem(Object selectedItem) {
+        if (selectedItem instanceof Role) {
+            ((Role) selectedItem).setRunAsSubject(null);
+            return;
+        }
+        super.removeItem(selectedItem);
+    }
+
+    @Override
+    protected Wizard getWizard() {
+        return new SecurityRunAsSubjectWizard(this);
+    }
+
+    @Override
+    public void activateAddButton() {
+        if (getSecurity() != null && getSecurity().getCredentialStoreRef() != null
+                && getRolesWithoutRunAsSubject().length > 0) {
+            addButton.setEnabled(true);
+        } else {
+            addButton.setEnabled(false);
+        }
+    }
+
+    public Role getRole(String roleName) {
+        List<Role> roles = SecurityRoleMappingSection.getRoles(getPlan(), false);
+        for (int i = 0; i < roles.size(); i++) {
+            Role role = roles.get(i);
+            if (role.getRoleName().equals(roleName)) {
+                return role;
+            }
+        }
+        return null;
+    }
+
+    public String[] getRolesWithoutRunAsSubject() {
+        List<Role> roles = SecurityRoleMappingSection.getRoles(getPlan(), false);
+        List<Role> rolesWithoutRunAsSubject = new ArrayList<Role>();
+        for (int i = 0; i < roles.size(); i++) {
+            Role role = roles.get(i);
+            if(role.getRunAsSubject() == null) {
+                rolesWithoutRunAsSubject.add(role);
+            }
+        }
+        String[] roleNames = new String[rolesWithoutRunAsSubject.size()];
+        for (int i = 0; i < rolesWithoutRunAsSubject.size(); i++) {
+            roleNames[i] = rolesWithoutRunAsSubject.get(i).getRoleName();
+        }
+        return roleNames;
+    }
+
+    private void populateCredentialStores() {
+        String credentialStoreRefName = getCredentialStoreRefName();
+        credentialStoreRef.add(credentialStoreRefName);
+        if (credentialStoreRefName.length() > 0) {
+            credentialStoreRef.add(""); //users will select this empty string to unset credentialStoreRef
+        }
+        
+        List<Pattern> deployedCredentialStores = GeronimoServerInfo.getInstance().getDeployedCredentialStores();
+        Pattern pattern = new Pattern();
+        pattern.setCustomFoo(credentialStoreRefName);
+        if (deployedCredentialStores.contains(pattern)) {
+            deployedCredentialStores.remove(pattern);
+        }
+        for (int i = 0; i < deployedCredentialStores.size(); i++) {
+            String credentialStoreName = deployedCredentialStores.get(i).toString();
+            //in case that module is null, replace the ending string of pattern.toString() with type 
+            credentialStoreName = credentialStoreName.substring(0, credentialStoreName.lastIndexOf("/")+1).concat(deployedCredentialStores.get(i).getType()+")");
+            credentialStoreRef.add(credentialStoreName);
+            credentialStoreList.put(credentialStoreName, deployedCredentialStores.get(i));
+        }
+        credentialStoreAttributes = GeronimoServerInfo.getInstance().getDeployedCredentialStoreAttributes();
+        credentialStoreRef.select(0);
+    }
+
+    @Override
+    public List getObjectContainer() {
+        return getSecurity().getRoleMappings().getRole();
+    }
+
+    @Override
+    public Class getTableEntryObjectType() {
+        return Role.class;
+    }
+
+    @Override
+    public String[] getTableColumnNames() {
+        return new String[] { CommonMessages.securityRunAsSubjectRole, CommonMessages.securityRunAsSubjectRealm,
+                CommonMessages.securityRunAsSubjectId };
+    }
+
+    @Override
+    public String getTitle() {
+        return CommonMessages.editorSectionSecurityAdvancedTitle;
+    }
+
+    @Override
+    public String getDescription() {
+        return CommonMessages.editorSectionSecurityAdvancedDescription;
+    }
+
+    private Security getSecurity() {
+        return JAXBModelUtils.getSecurity(getPlan());
+    }
+
+    private String getCredentialStoreRefName() {
+        if (getSecurity() != null) {
+            Pattern credentialStoreRef = getSecurity().getCredentialStoreRef();
+            if (credentialStoreRef != null) {
+                return credentialStoreRef.getCustomFoo();
+            }
+        }
+        return "";
+    }
+
+    private String getDefaultSubjectRealmName() {
+        if (getSecurity() != null) {
+            SubjectInfo subjectInfo = getSecurity().getDefaultSubject();
+            if (subjectInfo != null) {
+                return subjectInfo.getRealm();
+            }
+        }
+        return "";
+    }
+
+    private String getDefaultSubjectId() {
+        if (getSecurity() != null) {
+            SubjectInfo subjectInfo = getSecurity().getDefaultSubject();
+            if (subjectInfo != null) {
+                return subjectInfo.getId();
+            }
+        }
+        return "";
+    }
+
+    private boolean isDoasCurrentCaller() {
+        if (getSecurity() != null) {
+            return getSecurity().isDoasCurrentCaller();
+        }
+        return false;
+    }
+
+    private boolean isUseContextHandler() {
+        if (getSecurity() != null) {
+            return getSecurity().isUseContextHandler();
+        }
+        return false;
+    }
+
+    private void setCredentialStoreRef() {
+        if (getSecurity() != null) {
+            String credentialStoreRefName = credentialStoreRef.getText();
+            if (credentialStoreRefName.trim().length() > 0) {
+                Pattern credentialStoreRef = credentialStoreList.get(credentialStoreRefName);
+                getSecurity().setCredentialStoreRef(credentialStoreRef);
+            } else {
+                getSecurity().setCredentialStoreRef(null);
+            }
+        }
+    }
+
+    private void setDefaultSubject() {
+        if (getSecurity() != null) {
+            String realmName = defaultSubjectRealmName.getText();
+            String realmId = defaultSubjectId.getText();
+            if (realmName.trim().length() > 0 && realmId.trim().length() > 0) {
+                SubjectInfo defaultSubject = new SubjectInfo();
+                defaultSubject.setRealm(realmName);
+                defaultSubject.setId(realmId);
+                getSecurity().setDefaultSubject(defaultSubject);
+            } else {
+                getSecurity().setDefaultSubject(null);
+            }
+        }
+    }
+
+    private void setDoAsCurrentCaller() {
+        if (getSecurity() != null) {
+            getSecurity().setDoasCurrentCaller(doAsCurrentCaller.getSelection());
+        }
+    }
+
+    private void setUseContextHandler() {
+        if (getSecurity() != null) {
+            getSecurity().setUseContextHandler(useContextHandler.getSelection());
+        }
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityAdvancedSection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityAdvancedSection.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityAdvancedSection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityRealmSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityRealmSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityRealmSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityRealmSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.deployment.Attribute;
+import org.apache.geronimo.jee.deployment.Gbean;
+import org.apache.geronimo.jee.deployment.XmlAttributeType;
+import org.apache.geronimo.jee.loginconfig.LoginConfig;
+import org.apache.geronimo.jee.loginconfig.LoginModule;
+import org.apache.geronimo.st.ui.sections.AbstractTableSection;
+import org.apache.geronimo.st.v30.ui.pages.SecurityPage;
+import org.apache.geronimo.st.v30.ui.wizards.SecurityRealmWizard;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.IFormPart;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SecurityRealmSection extends AbstractTableSection {
+    public SecurityRealmSection(JAXBElement plan, List gbeans,
+        Composite parent, FormToolkit toolkit, int style) {
+    super(plan, parent, toolkit, style);
+    this.objectContainer = gbeans;
+    COLUMN_NAMES = new String[] { "Security Realm Name",
+        "Login Module Class" };// TODO put into message
+    createClient();
+    }
+
+    @Override
+    public String getDescription() {
+    return "The following security realms are defined:";// TODO put into
+    // message
+    }
+
+    @Override
+    public Class getTableEntryObjectType() {
+    return JAXBElement.class;
+    }
+
+    @Override
+    public String getTitle() {
+    return "Security Realm";// TODO put into message
+    }
+
+    @Override
+    protected Wizard getWizard() {
+    return new SecurityRealmWizard(this);
+    }
+
+    protected void notifyOthers() {
+    notifyGBeanSectionToRefresh();
+    }
+
+    /*
+     * After add, remove, edit realm gbean, notify the gbean section to refresh.
+     * If the deploymentpage has not been initialized, catch a
+     * NullPointerException and just ignore it.
+     */
+    private void notifyGBeanSectionToRefresh() {
+    try {
+        SecurityPage securityPage = (SecurityPage) this.getManagedForm()
+            .getContainer();
+        FormEditor editor = securityPage.getEditor();
+        IFormPart[] parts = editor.findPage("deploymentpage")
+            .getManagedForm().getParts();
+        GBeanSection gbeanSection = null;
+        for (IFormPart part : parts) {
+        if (GBeanSection.class.isInstance(part)) {
+            gbeanSection = (GBeanSection) part;
+        }
+        }
+        gbeanSection.getViewer().refresh();
+    } catch (NullPointerException e) {
+        // Ignore, this exception happens when the deployment page hasn't
+        // been initialized
+    }
+    }
+
+    @Override
+    public ITreeContentProvider getContentProvider() {
+    return new ContentProvider() {
+        @Override
+        public Object[] getElements(Object inputElement) {
+        List<JAXBElement<?>> result = new ArrayList<JAXBElement<?>>();
+        List<?> list = getObjectContainer();
+        for (Iterator<?> it = list.iterator(); it.hasNext();) {
+            JAXBElement<?> current = (JAXBElement<?>) it.next();
+            if (isSecurityRealmGbean((Gbean) current.getValue())) {
+            result.add(current);
+            }
+        }
+        return result.toArray();
+        }
+    };
+    }
+
+    private boolean isSecurityRealmGbean(Gbean gbean) {
+    return "org.apache.geronimo.security.realm.GenericSecurityRealm"
+        .equals(gbean.getClazz());
+    }
+
+    @Override
+    public ITableLabelProvider getLabelProvider() {
+    return new LabelProvider() {
+        @Override
+        public String getColumnText(Object element, int columnIndex) {
+        // System.out.println("here");
+        if (JAXBElement.class.isInstance(element)) {
+            Object value = ((JAXBElement<?>) element).getValue();
+            if (Gbean.class.isInstance(value)) {
+            Gbean gbean = (Gbean) value;
+            switch (columnIndex) {
+            case 0:// security realm name
+                if (getGbeanAttributeValue(gbean, "realmName") != null) {
+                return getGbeanAttributeValue(gbean,
+                    "realmName");
+                }
+                return "";
+            case 1:// login module class
+                if (getSecurityRealmGbeanLoginModuleClass(gbean) != null) {
+                return getSecurityRealmGbeanLoginModuleClass(gbean);
+                }
+                return "";
+            }
+            }
+        }
+        return null;
+        }
+    };
+    }
+
+    private String getGbeanAttributeValue(Gbean gbean, String attributeName) {
+    try {
+        List<JAXBElement<?>> elelist = gbean
+            .getAttributeOrXmlAttributeOrReference();
+        for (JAXBElement<?> ele : elelist) {
+        if (Attribute.class.isInstance(ele.getValue())
+            && ((Attribute) ele.getValue()).getName().equals(
+                attributeName)) {
+            return ((Attribute) ele.getValue()).getValue();
+        }
+        }
+    } catch (NullPointerException e) {
+        // ignore
+    }
+    return null;
+    }
+
+    private String getSecurityRealmGbeanLoginModuleClass(Gbean gbean) {
+    if (isSecurityRealmGbean(gbean)) {
+        try {
+        List<JAXBElement<?>> elelist = gbean
+            .getAttributeOrXmlAttributeOrReference();
+        for (JAXBElement<?> ele : elelist) {
+            if (XmlAttributeType.class.isInstance(ele.getValue())
+                && ((XmlAttributeType) ele.getValue()).getName()
+                    .equals("LoginModuleConfiguration")) {
+            LoginModule loginModule = (LoginModule) ((LoginConfig) ((XmlAttributeType) ele
+                .getValue()).getAny())
+                .getLoginModuleRefOrLoginModule().get(0);
+            return loginModule.getLoginModuleClass();
+            }
+        }
+        return null;
+        } catch (NullPointerException e) {
+        // ignore
+        }
+    }
+    return null;
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityRealmSection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityRealmSection.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityRealmSection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityRoleMappingSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityRoleMappingSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityRoleMappingSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityRoleMappingSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,294 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.security.DistinguishedName;
+import org.apache.geronimo.jee.security.LoginDomainPrincipal;
+import org.apache.geronimo.jee.security.Principal;
+import org.apache.geronimo.jee.security.RealmPrincipal;
+import org.apache.geronimo.jee.security.Role;
+import org.apache.geronimo.jee.security.RoleMappings;
+import org.apache.geronimo.jee.security.Security;
+import org.apache.geronimo.st.core.descriptor.AbstractDeploymentDescriptor;
+import org.apache.geronimo.st.core.descriptor.ApplicationDeploymentDescriptor;
+import org.apache.geronimo.st.core.descriptor.EjbDeploymentDescriptor;
+import org.apache.geronimo.st.core.descriptor.WebDeploymentDescriptor;
+import org.apache.geronimo.st.core.jaxb.JAXBUtils;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
+import org.apache.geronimo.st.v30.core.jaxb.JAXBModelUtils;
+import org.apache.geronimo.st.v30.ui.Activator;
+import org.apache.geronimo.st.v30.ui.wizards.SecurityRoleMappingWizard;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SecurityRoleMappingSection extends AbstractTreeSection {
+
+    public SecurityRoleMappingSection(JAXBElement plan, Composite parent, FormToolkit toolkit, int style) {
+        super(plan, parent, toolkit, style);
+        createClient();
+    }
+
+    public SecurityRoleMappingSection(JAXBElement plan, AbstractDeploymentDescriptor descriptor, Composite parent,
+            FormToolkit toolkit, int style) {
+        super(plan, descriptor, parent, toolkit, style);
+        createClient();
+    }
+
+    @Override
+    protected boolean isRequiredSyncToolbarAction() {
+        return true;
+    }
+
+    @Override
+    protected IAction getSyncAction() {
+        return new SyncAction(CommonMessages.securityRefreshRoles) {
+            @Override
+            public void run() {
+                if( addRolesFromDeploymentDescriptor() ) {
+                    markDirty();
+                }
+            }
+        };
+    }
+
+    @Override
+    protected void activateRemoveButton() {
+        if (tree.getSelectionCount() > 0 && tree.getSelection()[0].getParentItem() != null) {
+            removeButton.setEnabled(true);
+        } else {
+            removeButton.setEnabled(false);
+        }
+    }
+
+    @Override
+    protected void activateEditButton() {
+        if (tree.getSelectionCount() > 0 && tree.getSelection()[0].getParentItem() != null) {
+            editButton.setEnabled(true);
+        } else {
+            editButton.setEnabled(false);
+        }
+    }
+
+    @Override
+    protected void activateAddButton() {
+        if (tree.getSelectionCount() > 0 && tree.getSelection()[0].getParentItem() == null) {
+            addButton.setEnabled(true);
+        } else {
+            addButton.setEnabled(false);
+        }
+    }
+
+    @Override
+    public void handleDelete() {
+        TreeItem selectedItem = tree.getSelection()[0];
+        Object selectedObject = selectedItem.getData();
+        Role role = (Role) selectedItem.getParentItem().getData();
+        try {
+            ((ArrayList) JAXBUtils.getValue(role, selectedObject.getClass().getSimpleName())).remove(selectedObject);
+        } catch (Exception e) {
+            MessageDialog.openError(Display.getCurrent().getActiveShell(),"Error", e.getMessage());
+        }
+    }
+
+    public Role getSelectedObject() {
+        return (Role) tree.getSelection()[0].getData();
+    }
+
+    @Override
+    public String getTitle() {
+        return CommonMessages.editorSectionSecurityRolesTitle;
+    }
+
+    @Override
+    public String getDescription() {
+        return CommonMessages.editorSectionSecurityRolesDescription;
+    }
+
+    @Override
+    public Wizard getWizard() {
+        return new SecurityRoleMappingWizard(this);
+    }
+
+    @Override
+    public Class getTableEntryObjectType() {
+        return Role.class;
+    }
+
+    @Override
+    public List getObjectContainer() {
+        return getRoles(getPlan(), false);
+    }
+
+    public static List<Role> getRoles(JAXBElement plan, boolean create) {
+        RoleMappings roleMappings = getRoleMappings(plan, create);
+        if (roleMappings != null) {
+            return roleMappings.getRole();
+        }
+        return null;
+    }
+
+    public static RoleMappings getRoleMappings(JAXBElement plan, boolean create) {
+        Security security = JAXBModelUtils.getSecurity(plan);
+        if (security == null && create) {
+            security = new Security();
+            JAXBModelUtils.setSecurity(plan, security);
+        }
+        if (security != null) {
+            RoleMappings roleMappings = security.getRoleMappings();
+            if (roleMappings == null && create) {
+                roleMappings = new RoleMappings();
+                security.setRoleMappings(roleMappings);
+            }
+            return roleMappings;
+        }
+        return null;
+    }
+
+    protected boolean addRolesFromDeploymentDescriptor() {
+        List<String> declaredRoleNames = null;
+        if (WebDeploymentDescriptor.class.isInstance(getDescriptor())) {
+            declaredRoleNames = ((WebDeploymentDescriptor)getDescriptor()).getSecurityRoles();
+        }
+        else if (ApplicationDeploymentDescriptor.class.isInstance(getDescriptor())) {
+            declaredRoleNames = ((ApplicationDeploymentDescriptor)getDescriptor()).getSecurityRoles();
+        }
+        else if (EjbDeploymentDescriptor.class.isInstance(getDescriptor())) {
+            declaredRoleNames = ((EjbDeploymentDescriptor)getDescriptor()).getSecurityRoles();
+        }
+        
+        if (declaredRoleNames == null || declaredRoleNames.size() <= 0) {
+            return false;
+        }
+        List<Role> definedRoles = getRoles(getPlan(), true);
+        List<Role> newRoles = new ArrayList<Role>();
+        for (int i = 0; i < declaredRoleNames.size(); i++) {
+            String roleName = declaredRoleNames.get(i);
+            boolean roleExists = false;
+            for (int j = 0; j < definedRoles.size(); j++) {
+                if (definedRoles.get(j).getRoleName().equals(roleName)) {
+                    roleExists = true;
+                    break;
+                }
+            }
+            if (!roleExists) {
+                Role newRole = new Role();
+                newRole.setRoleName(roleName);
+                newRoles.add(newRole);
+            }
+        }
+        definedRoles.addAll(newRoles);
+        return newRoles.size() > 0;
+    }
+
+    @Override
+    public Object getInput() {
+        addRolesFromDeploymentDescriptor();
+        return getRoleMappings(getPlan(), false);
+    }
+
+    @Override
+    public ITreeContentProvider getContentProvider() {
+        return new ContentProvider() {
+            @Override
+            public Object[] getElements(Object inputElement) {
+                return getChildren(inputElement);
+            }
+
+            @Override
+            public Object[] getChildren(Object parentElement) {
+                if (RoleMappings.class.isInstance(parentElement)) {
+                    return ((RoleMappings) parentElement).getRole().toArray();
+                }
+                if (parentElement instanceof Role) {
+                    Role role = (Role) parentElement;
+                    return concat(role.getDistinguishedName().toArray(), role.getPrincipal().toArray(), 
+                            role.getLoginDomainPrincipal().toArray(), role.getRealmPrincipal().toArray());
+                }
+                return new String[] {};
+            }
+
+            private Object[] concat(Object[] arr1, Object[] arr2, Object[] arr3, Object[] arr4) {
+                Object[] all = new Object[arr1.length + arr2.length + arr3.length + arr4.length];
+                System.arraycopy(arr1, 0, all, 0, arr1.length);
+                System.arraycopy(arr2, 0, all, arr1.length, arr2.length);
+                System.arraycopy(arr3, 0, all, arr1.length + arr2.length, arr3.length);
+                System.arraycopy(arr4, 0, all, arr1.length + arr2.length + arr3.length, arr4.length);
+                return all;
+            }
+        };
+    }
+
+    @Override
+    public ILabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
+            public String getText(Object element) {
+                if (Role.class.isInstance(element)) {
+                    Role role = (Role) element;
+                    return "Role: role-name = \"" + role.getRoleName() + "\"";
+                }
+                else if (element instanceof DistinguishedName) {
+                    DistinguishedName object = (DistinguishedName) element;
+                    return "DistinguishedName: name = \"" + object.getName() + "\"";
+                }
+                else if (element instanceof RealmPrincipal) {
+                    RealmPrincipal object = (RealmPrincipal) element;
+                    return "RealmPrincipal: name = \"" + object.getName() +
+                            "\", class = \"" + object.getClazz() +
+                            "\", domain-name = \"" + object.getDomainName() +
+                            "\", realm-name = \"" + object.getRealmName() +"\"";
+                }
+                else if (element instanceof LoginDomainPrincipal) {
+                    LoginDomainPrincipal object = (LoginDomainPrincipal) element;
+                    return "LoginDomainPrincipal: name = \"" + object.getName() +
+                            "\", class = \"" + object.getClazz() +
+                            "\", domain-name = \"" + object.getDomainName() +"\"";
+                }
+                else if (element instanceof Principal) {
+                    Principal object = (Principal) element;
+                    return "Principal: name = \"" + object.getName() +
+                            "\", class = \"" + object.getClazz() + "\"";
+                }
+
+                return null;
+            }
+
+            @Override
+            public Image getImage(Object arg0) {
+                return Activator.imageDescriptorFromPlugin("org.eclipse.jst.j2ee",
+                        "icons/full/obj16/security_role.gif").createImage();
+            }
+        };
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityRoleMappingSection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityRoleMappingSection.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/SecurityRoleMappingSection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerPluginSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerPluginSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerPluginSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerPluginSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import org.apache.geronimo.st.v30.core.internal.Trace;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractServerEditorSection;
+import org.apache.geronimo.st.v30.core.operations.GeronimoServerPluginManager;
+import org.apache.geronimo.st.v30.ui.wizards.ServerCustomAssemblyWizard;
+import org.apache.geronimo.st.v30.ui.wizards.ServerPluginManagerDialog;
+import org.apache.geronimo.st.v30.ui.wizards.ServerPluginManagerWizard;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ * Server advanced editor section
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServerPluginSection extends AbstractServerEditorSection {
+    
+    private Button customAssemblyButton;
+    private Button pluginManagerButton;
+
+    public ServerPluginSection() {
+        super();
+    }
+    
+    /* (non-Javadoc)
+     * @see org.eclipse.wst.server.ui.editor.ServerEditorSection#createSection(org.eclipse.swt.widgets.Composite)
+     */
+    public void createSection(Composite parent) {
+        super.createSection(parent);
+    
+        Trace.tracePoint("Entry", "ServerPluginSection.createSection", parent);
+    
+        FormToolkit toolkit = getFormToolkit(parent.getDisplay());
+        
+        Section section = toolkit.createSection(parent,
+                ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED
+                        | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION
+                        | ExpandableComposite.FOCUS_TITLE);
+        section.setText(CommonMessages.plugin);
+        section.setDescription(CommonMessages.pluginActions);
+        section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+        
+        Composite composite = toolkit.createComposite(section);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        layout.marginHeight = 5;
+        layout.marginWidth = 10;
+        layout.verticalSpacing = 5;
+        layout.horizontalSpacing = 15;
+        composite.setLayout(layout);
+        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+        section.setClient(composite);
+
+        customAssemblyButton = toolkit.createButton(composite, CommonMessages.createCustomAssembly, SWT.PUSH);
+        customAssemblyButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+        customAssemblyButton.addSelectionListener(new SelectionListener() {
+            public void widgetSelected(SelectionEvent e) {
+                // if the server is started, then we can bring up the dialog
+                if (isServerRunning()) {
+                    GeronimoServerPluginManager pluginManager = new GeronimoServerPluginManager (gs.getServer());
+                    ServerCustomAssemblyWizard wizard = new ServerCustomAssemblyWizard (pluginManager);
+                    WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
+                    dialog.open();
+                    if (dialog.getReturnCode() == Dialog.OK) {
+                    }
+                } else {
+                    MessageDialog.openError(Display.getCurrent().getActiveShell(), CommonMessages.errorOpenWizard, CommonMessages.serverNotStarted);
+                }
+            }
+
+            public void widgetDefaultSelected(SelectionEvent e) {
+            }
+        });
+        
+        pluginManagerButton = toolkit.createButton(composite, CommonMessages.convertAppsToPlugins, SWT.PUSH);
+        pluginManagerButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
+        pluginManagerButton.addSelectionListener(new SelectionListener() {
+            public void widgetSelected(SelectionEvent e) {
+                // if the server is started, then we can bring up the dialog
+                if (isServerRunning()) {
+                    GeronimoServerPluginManager pluginManager = new GeronimoServerPluginManager (gs.getServer());
+                    ServerPluginManagerWizard wizard = new ServerPluginManagerWizard (pluginManager);
+                    ServerPluginManagerDialog dialog = new ServerPluginManagerDialog(Display.getCurrent().getActiveShell(), wizard);
+                    dialog.open();
+                    if (dialog.getReturnCode() == Dialog.OK) {
+                    }
+                } else {
+                    MessageDialog.openError(Display.getCurrent().getActiveShell(), CommonMessages.errorOpenWizard, CommonMessages.serverNotStarted);
+                }
+            }
+
+            public void widgetDefaultSelected(SelectionEvent e) {
+            }
+        });
+    
+        Trace.tracePoint("Exit", "ServerPluginSection.createSection");
+    }
+
+    private boolean isServerRunning () {
+        if (gs == null || gs.getServer() == null)
+            return false;
+        
+        return gs.getServer().getServerState() == IServer.STATE_STARTED;
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerPluginSection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerPluginSection.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServerPluginSection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServiceRefSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServiceRefSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServiceRefSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServiceRefSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+
+import org.apache.geronimo.jee.naming.Port;
+import org.apache.geronimo.jee.naming.PortCompletion;
+import org.apache.geronimo.jee.naming.ServiceRef;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
+import org.apache.geronimo.st.v30.ui.Activator;
+import org.apache.geronimo.st.v30.ui.wizards.ServiceRefWizard;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServiceRefSection extends AbstractTreeSection {
+    public ServiceRefSection(JAXBElement plan, Composite parent, FormToolkit toolkit, int style, List serviceRefs) {
+        super(plan, parent, toolkit, style);
+        this.objectContainer = serviceRefs;
+        createClient();
+    }
+
+    @Override
+    public String getTitle() {
+        return CommonMessages.editorServiceRefTitle;
+    }
+
+    @Override
+    public String getDescription() {
+        return CommonMessages.editorServiceRefDescription;
+    }
+
+    @Override
+    public Wizard getWizard() {
+        return new ServiceRefWizard(this);
+    }
+
+    @Override
+    public Class getTableEntryObjectType() {
+        return ServiceRef.class;
+    }
+
+    @Override
+    protected void activateAddButton() {
+        if (tree.getSelectionCount() == 0 || tree.getSelection()[0].getParentItem() == null) {
+            addButton.setEnabled(true);
+        } else {
+            addButton.setEnabled(false);
+        }
+    }
+
+    public ServiceRef getSelectedObject () {
+        if (tree.getSelection().length == 0) {
+            return null;
+        }
+        return (ServiceRef)tree.getSelection()[0].getData();
+    }
+    
+    @Override
+    public void removeItem(Object anItem) {
+        if (ServiceRef.class.isInstance(anItem)) {
+            getObjectContainer().remove(anItem);
+        }
+        else if (Port.class.isInstance(anItem)) {
+            ServiceRef serviceRef = (ServiceRef)tree.getSelection()[0].getParentItem().getData();
+            serviceRef.getPort().remove(anItem);
+        }
+        else if (PortCompletion.class.isInstance(anItem)) {
+            ServiceRef serviceRef = (ServiceRef)tree.getSelection()[0].getParentItem().getData();
+            serviceRef.getServiceCompletion().getPortCompletion().remove(anItem);
+        }
+    }
+    
+    @Override
+    public Object getInput() {
+        if (objectContainer != null) {
+            return objectContainer;
+        }
+        return super.getInput();
+    }
+
+    @Override
+    public ITreeContentProvider getContentProvider() {
+        return new ContentProvider() {
+            @Override
+            public Object[] getElements(Object inputElement) {
+                return getChildren(inputElement);
+            }
+
+            @Override
+            public Object[] getChildren(Object parentElement) {
+                if (List.class.isInstance(parentElement)) {
+                    return ((List)parentElement).toArray();
+                }
+                if (ServiceRef.class.isInstance(parentElement)) {
+                    ServiceRef serviceRef = (ServiceRef)parentElement;
+                    Object[] portList = serviceRef.getPort().toArray();
+                    Object[] compList = new Object[0];
+                    if (serviceRef.getServiceCompletion() != null) {
+                        compList = serviceRef.getServiceCompletion().getPortCompletion().toArray();
+                    }
+                    Object[] fullList = new Object[portList.length + compList.length];
+                    System.arraycopy(portList, 0, fullList, 0, portList.length);
+                    System.arraycopy(compList, 0, fullList, portList.length, compList.length);
+                    return fullList;
+                }
+                return new String[] {};
+            }
+        };
+    }
+
+    @Override
+    public ILabelProvider getLabelProvider() {
+        return new LabelProvider() {
+            @Override
+            public String getText(Object element) {
+                if (ServiceRef.class.isInstance(element)) {
+                    ServiceRef serviceRef = (ServiceRef)element;
+                        String retString = "Service Ref: name = \"" + serviceRef.getServiceRefName() + "\"";
+                        if (serviceRef.getServiceCompletion() != null) {
+                            retString += ", service completion name = \"" + serviceRef.getServiceCompletion().getServiceName() + "\"";
+                        }
+                        return retString;
+                }
+                else if (Port.class.isInstance(element)) {
+                    Port port = (Port)element;
+                    return "Port: name = \"" + port.getPortName() + 
+                            "\", protocol = \"" + port.getProtocol() + 
+                            "\", host = \"" + port.getHost() + 
+                            "\", port = \"" + port.getPort() + 
+                            "\", uri = \"" + port.getUri() + 
+                            "\", credential = \"" + port.getCredentialsName() + "\"";
+                }
+                else if (PortCompletion.class.isInstance(element)) {
+                    PortCompletion portComp = (PortCompletion)element;
+                    return "Port Completion: name = \"" + portComp.getPort().getPortName() + 
+                            "\", protocol = \"" + portComp.getPort().getProtocol() + 
+                            "\", host = \"" + portComp.getPort().getHost() + 
+                            "\", port = \"" + portComp.getPort().getPort() + 
+                            "\", uri = \"" + portComp.getPort().getUri() + 
+                            "\", credential = \"" + portComp.getPort().getCredentialsName() +
+                            "\", binding name = \"" + portComp.getBindingName() + "\"";
+                }
+
+                return null;
+            }
+
+            @Override
+            public Image getImage(Object arg0) {
+                return Activator.imageDescriptorFromPlugin("org.eclipse.jst.j2ee",
+                        "icons/full/obj16/module_web_obj.gif").createImage();
+            }
+        };
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServiceRefSection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServiceRefSection.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/ServiceRefSection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/WebContainerSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/WebContainerSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/WebContainerSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/WebContainerSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,261 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.naming.GbeanLocator;
+import org.apache.geronimo.jee.naming.ObjectFactory;
+import org.apache.geronimo.jee.naming.Pattern;
+import org.apache.geronimo.jee.web.WebApp;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractSectionPart;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebContainerSection extends AbstractSectionPart {
+
+    protected Text gBeanLink;
+
+    protected Text artifact;
+
+    protected Text group;
+
+    protected Text module;
+
+    protected Text name;
+
+    protected Text version;
+
+    protected Button specifyAsLink;
+
+    protected Button specifyAsPattern;
+
+    WebApp plan;
+    
+    private ObjectFactory namingFactory;
+
+    /**
+     * @param parent
+     * @param toolkit
+     * @param style
+     * @param plan
+     */
+    public WebContainerSection(Composite parent, FormToolkit toolkit, int style, JAXBElement plan) {
+        super(parent, toolkit, style, plan);
+        this.plan = (WebApp) plan.getValue();
+        namingFactory = new ObjectFactory();
+        createClient();
+    }
+
+    protected void createClient() {
+        Section section = getSection();
+
+        section.setText(CommonMessages.webContainerSection);
+        section.setDescription(CommonMessages.webContainerSectionDescription);
+        section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+
+        Composite composite = toolkit.createComposite(section);
+        GridLayout layout = new GridLayout();
+        layout.numColumns = 2;
+        layout.marginHeight = 5;
+        layout.marginWidth = 10;
+        layout.verticalSpacing = 5;
+        layout.horizontalSpacing = 15;
+        composite.setLayout(layout);
+        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+        section.setClient(composite);
+
+        specifyAsLink = toolkit.createButton(composite, CommonMessages.useGBeanLink, SWT.RADIO);
+        GridData data = new GridData();
+        data.horizontalSpan = 2;
+        specifyAsLink.setLayoutData(data);
+
+        GbeanLocator wc = plan.getWebContainer();
+
+        toolkit.createLabel(composite, CommonMessages.gBeanLink);
+        String value = wc != null ? wc.getGbeanLink() : null;
+        gBeanLink = toolkit.createText(composite, value, SWT.BORDER);
+        gBeanLink.setLayoutData(createTextFieldGridData());
+        gBeanLink.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getGBeanLocator().setGbeanLink(gBeanLink.getText());
+                markDirty();
+            }
+        });
+
+        specifyAsPattern = toolkit.createButton(composite, CommonMessages.useGBeanPattern, SWT.RADIO);
+        specifyAsPattern.setLayoutData(data);
+
+        toolkit.createLabel(composite, CommonMessages.groupId);
+        value = wc != null && wc.getPattern() != null ? wc.getPattern().getGroupId()
+                : null;
+        group = toolkit.createText(composite, value, SWT.BORDER);
+        group.setLayoutData(createTextFieldGridData());
+        group.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getPattern().setGroupId(group.getText());
+                markDirty();
+            }
+        });
+
+        toolkit.createLabel(composite, CommonMessages.artifactId);
+        value = wc != null && wc.getPattern() != null ? wc.getPattern().getArtifactId()
+                : null;
+        artifact = toolkit.createText(composite, value, SWT.BORDER);
+        artifact.setLayoutData(createTextFieldGridData());
+        artifact.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getPattern().setArtifactId(artifact.getText());
+                markDirty();
+            }
+        });
+
+        toolkit.createLabel(composite, CommonMessages.moduleId);
+        value = wc != null && wc.getPattern() != null ? wc.getPattern().getModule()
+                : null;
+        module = toolkit.createText(composite, value, SWT.BORDER);
+        module.setLayoutData(createTextFieldGridData());
+        module.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getPattern().setModule(module.getText());
+                markDirty();
+            }
+        });
+
+        toolkit.createLabel(composite, CommonMessages.name);
+        value = wc != null && wc.getPattern() != null ? wc.getPattern().getName()
+                : null;
+        name = toolkit.createText(composite, value, SWT.BORDER);
+        name.setLayoutData(createTextFieldGridData());
+        name.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getPattern().setName(name.getText());
+                markDirty();
+            }
+        });
+
+        toolkit.createLabel(composite, CommonMessages.version);
+        value = wc != null && wc.getPattern() != null ? wc.getPattern().getVersion()
+                : null;
+        version = toolkit.createText(composite, value, SWT.BORDER);
+        version.setLayoutData(createTextFieldGridData());
+        version.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getPattern().setVersion(version.getText());
+                markDirty();
+            }
+        });
+
+        specifyAsLink.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                if (specifyAsLink.getSelection()) {
+                    getGBeanLocator().setPattern(null);
+                    if (gBeanLink.getText().length() > 0) {
+                        plan.getWebContainer().setGbeanLink(gBeanLink.getText());
+                    }
+                    markDirty();
+                    toggle();
+                }
+            }
+        });
+ 
+        specifyAsPattern.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                if (specifyAsPattern.getSelection()) {
+                    if (plan.getWebContainer() != null) {
+                        plan.getWebContainer().setGbeanLink (null);
+                    }
+                    if (group.getText().length() > 0) {
+                        getPattern().setGroupId(group.getText());
+                    }
+                    if (artifact.getText().length() > 0) {
+                        getPattern().setArtifactId(artifact.getText());
+                    }
+                    if (module.getText().length() > 0) {
+                        getPattern().setModule(module.getText());
+                    }
+                    if (name.getText().length() > 0) {
+                        getPattern().setName(name.getText());
+                    }
+                    if (version.getText().length() > 0) {
+                        getPattern().setVersion(version.getText());
+                    }
+                    markDirty();
+                    toggle();
+                }
+            }
+        });
+
+        if (wc != null) {
+            if (wc.getGbeanLink() != null) {
+                specifyAsLink.setSelection(true);
+            } else if (wc.getPattern() != null) {
+                specifyAsPattern.setSelection(true);
+            }
+        }
+
+        toggle();
+    }
+
+    public void toggle() {
+        gBeanLink.setEnabled(specifyAsLink.getSelection());
+        artifact.setEnabled(specifyAsPattern.getSelection());
+        group.setEnabled(specifyAsPattern.getSelection());
+        module.setEnabled(specifyAsPattern.getSelection());
+        name.setEnabled(specifyAsPattern.getSelection());
+        version.setEnabled(specifyAsPattern.getSelection());
+    }
+
+    /**
+     * @return
+     */
+    private GbeanLocator getGBeanLocator() {
+        GbeanLocator wc = plan.getWebContainer();
+        if (wc == null) {
+            wc = namingFactory.createGbeanLocator();
+            plan.setWebContainer(wc);
+        }
+        return wc;
+    }
+
+    /**
+     * @return
+     */
+    private Pattern getPattern() {
+        GbeanLocator locator = getGBeanLocator();
+        Pattern pattern = locator.getPattern();
+        if (pattern == null) {
+            pattern = namingFactory.createPattern();
+            locator.setPattern(pattern);
+        }
+        return pattern;
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/WebContainerSection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/WebContainerSection.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/WebContainerSection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/WebGeneralSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/WebGeneralSection.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/WebGeneralSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/WebGeneralSection.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.sections;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.web.WebApp;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WebGeneralSection extends CommonGeneralSection {
+
+    protected Text contextRoot;
+
+    protected Text workDir;
+
+    protected Text securityRealmName;
+
+    WebApp plan;
+
+    public WebGeneralSection(Composite parent, FormToolkit toolkit, int style, JAXBElement plan) {
+        super(parent, toolkit, style, plan);
+        this.plan = (WebApp) plan.getValue();
+        createClient();
+    }
+
+    protected void createClient() {
+        super.createClient();
+        Composite composite = (Composite) getSection().getClient();
+
+        createLabel(composite, CommonMessages.editorContextRoot);
+
+        contextRoot = toolkit.createText(composite, plan.getContextRoot(), SWT.BORDER);
+        contextRoot.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+        contextRoot.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                plan.setContextRoot(contextRoot.getText());
+                markDirty();
+            }
+        });
+
+        createLabel(composite, CommonMessages.editorWorkDir);
+
+        workDir = toolkit.createText(composite, plan.getWorkDir(), SWT.BORDER);
+        workDir.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+        workDir.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                plan.setWorkDir(workDir.getText());
+                markDirty();
+            }
+        });
+
+        createLabel(composite, CommonMessages.editorSecurityRealmName);
+
+        securityRealmName = toolkit.createText(composite, plan.getSecurityRealmName(), SWT.BORDER);
+        securityRealmName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+        securityRealmName.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                plan.setSecurityRealmName(securityRealmName.getText());
+                markDirty();
+            }
+        });
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/WebGeneralSection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/WebGeneralSection.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/sections/WebGeneralSection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/AdminObjectWizard.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/AdminObjectWizard.java?rev=938593&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/AdminObjectWizard.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/AdminObjectWizard.java Tue Apr 27 18:20:22 2010
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.v30.ui.wizards;
+
+import java.util.List;
+
+import org.apache.geronimo.jee.connector.Adminobject;
+import org.apache.geronimo.jee.connector.AdminobjectInstance;
+import org.apache.geronimo.jee.connector.ConfigPropertySetting;
+import org.apache.geronimo.st.core.jaxb.JAXBObjectFactory;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.sections.AbstractTreeSection;
+import org.apache.geronimo.st.ui.wizards.AbstractTreeWizard;
+import org.apache.geronimo.st.v30.core.jaxb.JAXBObjectFactoryImpl;
+import org.apache.geronimo.st.v30.ui.sections.AdminObjectSection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AdminObjectWizard extends AbstractTreeWizard {
+
+    private final int ADMIN_OBJECT = 0;
+    private final int ADMIN_OBJECT_INSTANCE = 1;
+    private final int CONFIG_PROPERTY_SETTING = 2;
+
+    public AdminObjectWizard(AbstractTreeSection section) {
+        super(section, 3, 2);
+        elementTypes[ADMIN_OBJECT] = "Admin Object";
+        elementTypes[ADMIN_OBJECT_INSTANCE] = "Admin Object Instance";
+        elementTypes[CONFIG_PROPERTY_SETTING] = "Config Property";
+    }
+
+    public class EjbRelationWizardPage extends AbstractTreeWizardPage {
+
+        public EjbRelationWizardPage(String pageName) {
+            super(pageName);
+        }
+
+        protected void initControl () {
+            if (eObject == null) {
+                element.select(ADMIN_OBJECT);
+                if (Adminobject.class.isInstance(((AdminObjectSection)section).getSelectedObject())) {
+                    element.remove(elementTypes[CONFIG_PROPERTY_SETTING]);
+                }
+                else if (AdminobjectInstance.class.isInstance(((AdminObjectSection)section).getSelectedObject())) {
+                    element.select(CONFIG_PROPERTY_SETTING);
+                    element.setEnabled(false);
+                }
+                else {
+                    element.setEnabled(false);
+                }
+            }
+            else {
+                if (Adminobject.class.isInstance(eObject)) {
+                    textList.get(0).setText(((Adminobject)eObject).getAdminobjectInterface());
+                    textList.get(1).setText(((Adminobject)eObject).getAdminobjectClass());
+                    element.select(ADMIN_OBJECT);
+                }
+                else if (AdminobjectInstance.class.isInstance(eObject)) {
+                    textList.get(0).setText(((AdminobjectInstance)eObject).getMessageDestinationName());
+                    element.select(ADMIN_OBJECT_INSTANCE);
+                }
+                else if (ConfigPropertySetting.class.isInstance(eObject)) {
+                    textList.get(0).setText(((ConfigPropertySetting)eObject).getName());
+                    textList.get(1).setText(((ConfigPropertySetting)eObject).getValue());
+                    element.select(CONFIG_PROPERTY_SETTING);
+                }
+                element.setEnabled(false);
+            }
+        }
+        
+        protected void toggleFields (boolean clearFields) {
+            if (element.getText().equals(elementTypes[ADMIN_OBJECT])) {
+                for (int i = 0; i < maxTextFields; i++) {
+                    labelList.get(i).setVisible(true);
+                    textList.get(i).setVisible(true);
+                    if (clearFields == true) {
+                        textList.get(i).setText("");
+                    }
+                }
+                labelList.get(0).setText(CommonMessages.interfaceName);
+                labelList.get(1).setText(CommonMessages.className);
+            }
+            else if (element.getText().equals(elementTypes[ADMIN_OBJECT_INSTANCE])) {
+                for (int i = 0; i < maxTextFields; i++) {
+                    labelList.get(i).setVisible(i < 1 ? true : false);
+                    textList.get(i).setVisible(i < 1 ? true : false);
+                    if (clearFields == true) {
+                        textList.get(i).setText("");
+                    }
+                }
+                labelList.get(0).setText(CommonMessages.messageDestinationName);
+            }
+            else if (element.getText().equals(elementTypes[CONFIG_PROPERTY_SETTING])) {
+                for (int i = 0; i < maxTextFields; i++) {
+                    labelList.get(i).setVisible(true);
+                    textList.get(i).setVisible(true);
+                    if (clearFields == true) {
+                        textList.get(i).setText("");
+                    }
+                }
+                labelList.get(0).setText(CommonMessages.name);
+                labelList.get(1).setText(CommonMessages.value);
+            }
+        }
+
+        public String getWizardPageTitle() {
+            return CommonMessages.wizardPageTitle_AdminObject;
+        }
+
+        public String getWizardPageDescription() {
+            return CommonMessages.wizardPageDescription_AdminObject;
+        }
+    }
+
+    @Override
+    public void addPages() {
+        addPage(new EjbRelationWizardPage("Page0"));
+    }
+
+    @Override
+    public boolean performFinish() {
+        Adminobject admin;
+        if (element.getText().equals(elementTypes[ADMIN_OBJECT])) {
+            if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+                return false;
+            }
+            admin = (Adminobject)eObject;
+            if (admin == null) {
+                admin = (Adminobject)getEFactory().create(Adminobject.class);
+                List objectList = (List)section.getInput();
+                objectList.add (admin);
+            }
+            admin.setAdminobjectInterface(textList.get(0).getText());
+            admin.setAdminobjectClass(textList.get(1).getText());
+        }
+        else if (element.getText().equals(elementTypes[ADMIN_OBJECT_INSTANCE])) {
+            if (isEmpty(textList.get(0).getText())) {
+                return false;
+            }
+            AdminobjectInstance aoInstance = (AdminobjectInstance)eObject;
+            if (aoInstance == null) {
+                aoInstance = (AdminobjectInstance)getEFactory().create(AdminobjectInstance.class);
+                admin = (Adminobject)((AdminObjectSection)section).getSelectedObject();
+                admin.getAdminobjectInstance().add(aoInstance);
+            }
+            aoInstance.setMessageDestinationName(textList.get(0).getText());
+        }
+        else if (element.getText().equals(elementTypes[CONFIG_PROPERTY_SETTING])) { 
+            if (isEmpty(textList.get(0).getText()) || isEmpty(textList.get(1).getText())) {
+                return false;
+            }
+            ConfigPropertySetting property = (ConfigPropertySetting)eObject;
+            if (property == null) {
+                property = (ConfigPropertySetting)getEFactory().create(ConfigPropertySetting.class);
+                AdminobjectInstance aoInstance = (AdminobjectInstance)((AdminObjectSection)section).getSelectedObject();
+                aoInstance.getConfigPropertySetting().add(property);
+            }
+            property.setName(textList.get(0).getText());
+            property.setValue(textList.get(1).getText());
+        }
+        return true;
+    }
+
+    public JAXBObjectFactory getEFactory() {
+        return JAXBObjectFactoryImpl.getInstance();
+    }
+
+    public String getAddWizardWindowTitle() {
+        return CommonMessages.wizardNewTitle_AdminObject;
+    }
+
+    public String getEditWizardWindowTitle() {
+        return CommonMessages.wizardEditTitle_AdminObject;
+    }
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/AdminObjectWizard.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/AdminObjectWizard.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.ui/src/main/java/org/apache/geronimo/st/v30/ui/wizards/AdminObjectWizard.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message