You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by bj...@apache.org on 2008/09/29 22:50:13 UTC

svn commit: r700249 - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/ org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/ org.apache.geronimo.st.v21...

Author: bjreed
Date: Mon Sep 29 13:50:12 2008
New Revision: 700249

URL: http://svn.apache.org/viewvc?rev=700249&view=rev
Log:
Fix for GERONIMODEVTOOLS-379.  Added GUI support for modifying the C-M-P Connection Factory data in the EJB Deployment Plan Editor main page.

Added:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/OpenEjbJarCMPSection.java   (with props)
Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/DeploymentPage.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/EjbOverviewPage.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/NamingFormPage.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/WebGeneralPage.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java?rev=700249&r1=700248&r2=700249&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java Mon Sep 29 13:50:12 2008
@@ -20,6 +20,8 @@
 
 import org.apache.geronimo.jee.naming.GbeanLocator;
 import org.apache.geronimo.jee.naming.Pattern;
+import org.apache.geronimo.jee.naming.ResourceLocator;
+import org.apache.geronimo.jee.openejb.OpenejbJar;
 import org.apache.geronimo.jee.security.Security;
 import org.apache.geronimo.jee.web.WebApp;
 
@@ -38,6 +40,12 @@
             if (gbeanlocator != null && isEmpty(gbeanlocator.getGbeanLink()) && isEmpty(gbeanlocator.getPattern())) {
                 webapp.setWebContainer(null);
             }
+        } else if (source instanceof OpenejbJar) {
+            OpenejbJar openejb = (OpenejbJar)source;
+            ResourceLocator locator = openejb.getCmpConnectionFactory();
+            if (locator != null && isEmpty(locator.getResourceLink()) && isEmpty(locator.getUrl()) && isEmpty(locator.getPattern())) {
+                openejb.setCmpConnectionFactory(null);
+            }
         }
 	}
 		

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java?rev=700249&r1=700248&r2=700249&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.java Mon Sep 29 13:50:12 2008
@@ -325,10 +325,18 @@
     public static String inverseClassloading;
     public static String supressDefaultEnv;
     public static String sharedLibDepends;
+
+    public static String useResourceLink;
+    public static String useUrl;
+    public static String useResourcePattern;
+    public static String resourceLink;
+    public static String url;
     
     public static String addSharedLib;
     public static String webContainerSection;
     public static String webContainerSectionDescription;
+    public static String cmpConnectionSection;
+    public static String cmpConnectionSectionDescription;
 
     public static String moduleType;
     public static String path;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties?rev=700249&r1=700248&r2=700249&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.ui/src/main/java/org/apache/geronimo/st/ui/internal/Messages.properties Mon Sep 29 13:50:12 2008
@@ -334,6 +334,14 @@
 useGBeanPattern=Specify as GBean Pattern
 moduleId=Module Id:
 
+cmpConnectionSection=C-M-P Connection Factory
+cmpConnectionSectionDescription=C-M-P Connection Factory Configuration
+useResourceLink=Specify as Resource Link
+resourceLink=Resource Link:
+useUrl=Specify as URL
+url=URL:
+useResourcePattern=Specify as Resource Pattern
+
 moduleType=Module Type
 path=Path
 internalPath=Internal Path

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/DeploymentPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/DeploymentPage.java?rev=700249&r1=700248&r2=700249&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/DeploymentPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/DeploymentPage.java Mon Sep 29 13:50:12 2008
@@ -16,8 +16,6 @@
  */
 package org.apache.geronimo.st.v21.ui.pages;
 
-import java.util.List;
-
 import org.apache.geronimo.jee.application.Application;
 import org.apache.geronimo.st.ui.CommonMessages;
 import org.apache.geronimo.st.ui.editors.AbstractGeronimoDeploymentPlanEditor;

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/EjbOverviewPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/EjbOverviewPage.java?rev=700249&r1=700248&r2=700249&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/EjbOverviewPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/EjbOverviewPage.java Mon Sep 29 13:50:12 2008
@@ -18,6 +18,7 @@
 
 import org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage;
 import org.apache.geronimo.st.v21.core.GeronimoServerInfo;
+import org.apache.geronimo.st.v21.ui.sections.OpenEjbJarCMPSection;
 import org.apache.geronimo.st.v21.ui.sections.OpenEjbJarGeneralSection;
 import org.eclipse.ui.forms.IManagedForm;
 import org.eclipse.ui.forms.editor.FormEditor;
@@ -27,22 +28,22 @@
  */
 public class EjbOverviewPage extends AbstractGeronimoFormPage {
 
-	public EjbOverviewPage(FormEditor editor, String id, String title) {
-		super(editor, id, title);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
-	 */
-	protected void fillBody(IManagedForm managedForm) {
-		managedForm.addPart(new OpenEjbJarGeneralSection(body, toolkit, getStyle(), getDeploymentPlan()));
-	}
+    public EjbOverviewPage(FormEditor editor, String id, String title) {
+        super(editor, id, title);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.st.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
+     */
+    protected void fillBody(IManagedForm managedForm) {
+        managedForm.addPart(new OpenEjbJarGeneralSection(body, toolkit, getStyle(), getDeploymentPlan()));
+        managedForm.addPart(new OpenEjbJarCMPSection(body, toolkit, getStyle(), getDeploymentPlan()));
+    }
 
     @Override
-	protected void triggerGeronimoServerInfoUpdate() {
-		GeronimoServerInfo.getInstance().updateInfo();
-	}
-
+    protected void triggerGeronimoServerInfoUpdate() {
+        GeronimoServerInfo.getInstance().updateInfo();
+    }
 }

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/NamingFormPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/NamingFormPage.java?rev=700249&r1=700248&r2=700249&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/NamingFormPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/NamingFormPage.java Mon Sep 29 13:50:12 2008
@@ -16,8 +16,6 @@
  */
 package org.apache.geronimo.st.v21.ui.pages;
 
-import java.util.List;
-
 import org.apache.geronimo.jee.applicationclient.ApplicationClient;
 import org.apache.geronimo.jee.openejb.OpenejbJar;
 import org.apache.geronimo.jee.web.WebApp;
@@ -41,44 +39,8 @@
  */
 public class NamingFormPage extends AbstractGeronimoFormPage {
 
-    public List resRefs;
-
-    public List resEnvRefs;
-
-    public List ejbRefs;
-
-    public List ejbLocalRefs;
-
-    public List gbeanRefs;
-
-    public List serviceRefs;
-    
-    public List messageDestinations;
-
     public NamingFormPage(FormEditor editor, String id, String title) {
         super(editor, id, title);
-        if (WebApp.class.isInstance (((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue())) {
-            WebApp webapp = (WebApp)((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue();
-            resRefs = webapp.getResourceRef();
-            resEnvRefs = webapp.getResourceEnvRef();
-            ejbRefs = webapp.getEjbRef();
-            ejbLocalRefs = webapp.getEjbLocalRef();
-            serviceRefs = webapp.getServiceRef();
-            messageDestinations = webapp.getMessageDestination();
-        }
-        else if (ApplicationClient.class.isInstance (((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue())) {
-            ApplicationClient appClient = (ApplicationClient)((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue();
-            resRefs = appClient.getResourceRef();
-            resEnvRefs = appClient.getResourceEnvRef();
-            ejbRefs = appClient.getEjbRef();
-            gbeanRefs = appClient.getGbeanRef();
-            serviceRefs = appClient.getServiceRef();
-            messageDestinations = appClient.getMessageDestination();
-        }
-        else if (OpenejbJar.class.isInstance (((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue())) {
-            OpenejbJar ejbJar = (OpenejbJar)((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue();
-            messageDestinations = ejbJar.getMessageDestination();
-        }
     }
 
     /*
@@ -88,23 +50,26 @@
      */
     protected void fillBody(IManagedForm managedForm) {
         if (WebApp.class.isInstance (getDeploymentPlan().getValue())) {
-            managedForm.addPart(new EjbRefSection(getDeploymentPlan(), body, toolkit, getStyle(), ejbRefs));
-            managedForm.addPart(new ResourceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), resRefs));
-            managedForm.addPart(new ServiceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), serviceRefs));
-            managedForm.addPart(new ResourceEnvRefSection(getDeploymentPlan(), body, toolkit, getStyle(), resEnvRefs));
-            managedForm.addPart(new EjbLocalRefSection(getDeploymentPlan(), body, toolkit, getStyle(), ejbLocalRefs));
-            managedForm.addPart(new MessageDestSection(getDeploymentPlan(), body, toolkit, getStyle(), messageDestinations));
+            WebApp webapp = (WebApp)((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue();
+            managedForm.addPart(new EjbRefSection(getDeploymentPlan(), body, toolkit, getStyle(), webapp.getEjbRef()));
+            managedForm.addPart(new ResourceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), webapp.getResourceRef()));
+            managedForm.addPart(new ServiceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), webapp.getServiceRef()));
+            managedForm.addPart(new ResourceEnvRefSection(getDeploymentPlan(), body, toolkit, getStyle(), webapp.getResourceEnvRef()));
+            managedForm.addPart(new EjbLocalRefSection(getDeploymentPlan(), body, toolkit, getStyle(), webapp.getEjbLocalRef()));
+            managedForm.addPart(new MessageDestSection(getDeploymentPlan(), body, toolkit, getStyle(), webapp.getMessageDestination()));
         }
         else if (ApplicationClient.class.isInstance (getDeploymentPlan().getValue())){
-            managedForm.addPart(new EjbRefSection(getDeploymentPlan(), body, toolkit, getStyle(), ejbRefs));
-            managedForm.addPart(new ResourceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), resRefs));
-            managedForm.addPart(new ServiceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), serviceRefs));
-            managedForm.addPart(new ResourceEnvRefSection(getDeploymentPlan(), body, toolkit, getStyle(), resEnvRefs));
-            managedForm.addPart(new GBeanRefSection(getDeploymentPlan(), body, toolkit, getStyle(), gbeanRefs));
-            managedForm.addPart(new MessageDestSection(getDeploymentPlan(), body, toolkit, getStyle(), messageDestinations));
+            ApplicationClient appClient = (ApplicationClient)((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue();
+            managedForm.addPart(new EjbRefSection(getDeploymentPlan(), body, toolkit, getStyle(), appClient.getEjbRef()));
+            managedForm.addPart(new ResourceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), appClient.getResourceRef()));
+            managedForm.addPart(new ServiceRefSection(getDeploymentPlan(), body, toolkit, getStyle(), appClient.getServiceRef()));
+            managedForm.addPart(new ResourceEnvRefSection(getDeploymentPlan(), body, toolkit, getStyle(), appClient.getResourceEnvRef()));
+            managedForm.addPart(new GBeanRefSection(getDeploymentPlan(), body, toolkit, getStyle(), appClient.getGbeanRef()));
+            managedForm.addPart(new MessageDestSection(getDeploymentPlan(), body, toolkit, getStyle(), appClient.getMessageDestination()));
         }
         else if (OpenejbJar.class.isInstance (getDeploymentPlan().getValue())){
-            managedForm.addPart(new MessageDestSection(getDeploymentPlan(), body, toolkit, getStyle(), messageDestinations));
+            OpenejbJar ejbJar = (OpenejbJar)((AbstractGeronimoDeploymentPlanEditor) getEditor()).getDeploymentPlan().getValue();
+            managedForm.addPart(new MessageDestSection(getDeploymentPlan(), body, toolkit, getStyle(), ejbJar.getMessageDestination()));
         }
     }
     
@@ -113,7 +78,7 @@
         layout.numColumns = 1;
         layout.horizontalSpacing = 20;
         return layout;
-        }
+    }
 
     /*
      * (non-Javadoc)

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/WebGeneralPage.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/WebGeneralPage.java?rev=700249&r1=700248&r2=700249&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/WebGeneralPage.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/pages/WebGeneralPage.java Mon Sep 29 13:50:12 2008
@@ -29,31 +29,31 @@
  */
 public class WebGeneralPage extends AbstractGeronimoFormPage {
 
-	public WebGeneralPage(FormEditor editor, String id, String title) {
-		super(editor, id, title);
-	}
+    public WebGeneralPage(FormEditor editor, String id, String title) {
+        super(editor, id, title);
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
-	 */
-	protected void fillBody(IManagedForm managedForm) {
-		managedForm.addPart(new WebGeneralSection(body, toolkit, getStyle(), getDeploymentPlan()));
-		managedForm.addPart(new WebContainerSection(body, toolkit, getStyle(), getDeploymentPlan()));
-	}
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#fillBody(org.eclipse.ui.forms.IManagedForm)
+     */
+    protected void fillBody(IManagedForm managedForm) {
+        managedForm.addPart(new WebGeneralSection(body, toolkit, getStyle(), getDeploymentPlan()));
+        managedForm.addPart(new WebContainerSection(body, toolkit, getStyle(), getDeploymentPlan()));
+    }
 
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#getFormTitle()
-	 */
-	public String getFormTitle() {
-		return CommonMessages.webGeneralPageTitle;
-	}
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.geronimo.ui.pages.AbstractGeronimoFormPage#getFormTitle()
+     */
+    public String getFormTitle() {
+        return CommonMessages.webGeneralPageTitle;
+    }
 
-	@Override
-	protected void triggerGeronimoServerInfoUpdate() {
-		GeronimoServerInfo.getInstance().updateInfo();
-	}
+    @Override
+    protected void triggerGeronimoServerInfoUpdate() {
+        GeronimoServerInfo.getInstance().updateInfo();
+    }
 }

Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/OpenEjbJarCMPSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/OpenEjbJarCMPSection.java?rev=700249&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/OpenEjbJarCMPSection.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/OpenEjbJarCMPSection.java Mon Sep 29 13:50:12 2008
@@ -0,0 +1,300 @@
+/*
+ * 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.v21.ui.sections;
+
+import javax.xml.bind.JAXBElement;
+
+import org.apache.geronimo.jee.naming.ResourceLocator;
+import org.apache.geronimo.jee.naming.ObjectFactory;
+import org.apache.geronimo.jee.naming.Pattern;
+import org.apache.geronimo.jee.openejb.OpenejbJar;
+import org.apache.geronimo.st.ui.CommonMessages;
+import org.apache.geronimo.st.ui.internal.Messages;
+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 OpenEjbJarCMPSection extends AbstractSectionPart {
+
+    protected Text resourceLink;
+
+    protected Text url;
+
+    protected Text artifact;
+
+    protected Text group;
+
+    protected Text module;
+
+    protected Text name;
+
+    protected Text version;
+
+    protected Button specifyAsLink;
+
+    protected Button specifyAsUrl;
+
+    protected Button specifyAsPattern;
+
+    OpenejbJar plan;
+    
+    private ObjectFactory namingFactory;
+
+    /**
+     * @param parent
+     * @param toolkit
+     * @param style
+     * @param plan
+     */
+    public OpenEjbJarCMPSection(Composite parent, FormToolkit toolkit, int style, JAXBElement plan) {
+        super(parent, toolkit, style, plan);
+        this.plan = (OpenejbJar) plan.getValue();
+        namingFactory = new ObjectFactory();
+        createClient();
+    }
+
+    protected void createClient() {
+        Section section = getSection();
+
+        section.setText(Messages.cmpConnectionSection);
+        section.setDescription(Messages.cmpConnectionSectionDescription);
+        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.useResourceLink, SWT.RADIO);
+        GridData data = new GridData();
+        data.horizontalSpan = 2;
+        specifyAsLink.setLayoutData(data);
+
+        ResourceLocator locator = plan.getCmpConnectionFactory();
+
+        toolkit.createLabel(composite, CommonMessages.resourceLink);
+        String value = locator != null ? locator.getResourceLink() : null;
+        resourceLink = toolkit.createText(composite, value, SWT.BORDER);
+        resourceLink.setLayoutData(createTextFieldGridData());
+        resourceLink.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getResourceLocator().setResourceLink(resourceLink.getText());
+                markDirty();
+            }
+        });
+        
+        specifyAsUrl = toolkit.createButton(composite, CommonMessages.useUrl, SWT.RADIO);
+        data = new GridData();
+        data.horizontalSpan = 2;
+        specifyAsUrl.setLayoutData(data);
+
+        toolkit.createLabel(composite, CommonMessages.url);
+        value = locator != null ? locator.getUrl() : null;
+        url = toolkit.createText(composite, value, SWT.BORDER);
+        url.setLayoutData(createTextFieldGridData());
+        url.addModifyListener(new ModifyListener() {
+            public void modifyText(ModifyEvent e) {
+                getResourceLocator().setUrl(url.getText());
+                markDirty();
+            }
+        });
+
+        specifyAsPattern = toolkit.createButton(composite, CommonMessages.useResourcePattern, SWT.RADIO);
+        specifyAsPattern.setLayoutData(data);
+
+        toolkit.createLabel(composite, CommonMessages.groupId);
+        value = locator != null && locator.getPattern() != null ? locator.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 = locator != null && locator.getPattern() != null ? locator.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 = locator != null && locator.getPattern() != null ? locator.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 = locator != null && locator.getPattern() != null ? locator.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 = locator != null && locator.getPattern() != null ? locator.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()) {
+                    getResourceLocator().setUrl(null);
+                    getResourceLocator().setPattern(null);
+                    if (resourceLink.getText().length() > 0) {
+                        getResourceLocator().setResourceLink(resourceLink.getText());
+                    }
+                    markDirty();
+                    toggle();
+                }
+            }
+        });
+
+        specifyAsUrl.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                if (specifyAsUrl.getSelection()) {
+                    getResourceLocator().setResourceLink(null);
+                    getResourceLocator().setPattern(null);
+                    if (url.getText().length() > 0) {
+                        getResourceLocator().setUrl(url.getText());
+                    }
+                    markDirty();
+                    toggle();
+                }
+            }
+        });
+ 
+        specifyAsPattern.addSelectionListener(new SelectionAdapter() {
+            public void widgetSelected(SelectionEvent e) {
+                if (specifyAsPattern.getSelection()) {
+              	    getResourceLocator().setResourceLink (null);
+                    getResourceLocator().setUrl (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 (locator != null) {
+            if (locator.getResourceLink() != null) {
+                specifyAsLink.setSelection(true);
+            } else if (locator.getUrl() != null) {
+                specifyAsUrl.setSelection(true);
+            } else if (locator.getPattern() != null) {
+                specifyAsPattern.setSelection(true);
+            }
+        }
+
+        toggle();
+    }
+
+    public void toggle() {
+        resourceLink.setEnabled(specifyAsLink.getSelection());
+        url.setEnabled(specifyAsUrl.getSelection());
+        artifact.setEnabled(specifyAsPattern.getSelection());
+        group.setEnabled(specifyAsPattern.getSelection());
+        module.setEnabled(specifyAsPattern.getSelection());
+        name.setEnabled(specifyAsPattern.getSelection());
+        version.setEnabled(specifyAsPattern.getSelection());
+    }
+
+    /**
+     * @return
+     */
+    private ResourceLocator getResourceLocator() {
+        ResourceLocator locator = plan.getCmpConnectionFactory();
+        if (locator == null) {
+            locator = namingFactory.createResourceLocator();
+            plan.setCmpConnectionFactory(locator);
+        }
+        return locator;
+    }
+
+    /**
+     * @return
+     */
+    private Pattern getPattern() {
+        ResourceLocator locator = getResourceLocator();
+        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.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/OpenEjbJarCMPSection.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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