Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 101094 Details for
Bug 231926
EJB 3.0 Message Driven Beans need @MessageDriven.messageListenerInterface if not JMS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch
231926_patch.txt (text/plain), 18.43 KB, created by
Yavor Boyadzhiev
on 2008-05-20 12:49:46 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Yavor Boyadzhiev
Created:
2008-05-20 12:49:46 EDT
Size:
18.43 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jst.ejb.ui >Index: ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/NewMessageDrivenBeanClassWizardPage.java >=================================================================== >RCS file: /cvsroot/webtools/ejbtools/plugins/org.eclipse.jst.ejb.ui/ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/NewMessageDrivenBeanClassWizardPage.java,v >retrieving revision 1.4 >diff -u -r1.4 NewMessageDrivenBeanClassWizardPage.java >--- ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/NewMessageDrivenBeanClassWizardPage.java 21 Apr 2008 14:52:16 -0000 1.4 >+++ ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/NewMessageDrivenBeanClassWizardPage.java 20 May 2008 16:47:08 -0000 >@@ -90,6 +90,19 @@ > } > > @Override >+ protected String[] getValidationPropertyNames() { >+ String[] retVal = null; >+ String[] baseVals = super.getValidationPropertyNames(); >+ retVal = new String[baseVals.length+1]; >+ for (int cnt=0; cnt < baseVals.length; cnt++) >+ { >+ retVal[cnt] = baseVals[cnt]; >+ } >+ retVal[baseVals.length] = JMS; >+ return retVal; >+ } >+ >+ @Override > protected void updateControls() { > super.updateControls(); > destinationTypeCombo.setEnabled(jmsCheckbox.getSelection()); >Index: ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/AddMessageDrivenBeanWizardPage.java >=================================================================== >RCS file: /cvsroot/webtools/ejbtools/plugins/org.eclipse.jst.ejb.ui/ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/AddMessageDrivenBeanWizardPage.java,v >retrieving revision 1.7 >diff -u -r1.7 AddMessageDrivenBeanWizardPage.java >--- ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/AddMessageDrivenBeanWizardPage.java 21 Apr 2008 14:52:15 -0000 1.7 >+++ ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/AddMessageDrivenBeanWizardPage.java 20 May 2008 16:47:08 -0000 >@@ -12,24 +12,47 @@ > > import static org.eclipse.jst.j2ee.ejb.internal.operations.INewEnterpriseBeanClassDataModelProperties.EJB_NAME; > import static org.eclipse.jst.j2ee.ejb.internal.operations.INewEnterpriseBeanClassDataModelProperties.TRANSACTION_TYPE; >+import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.MESSAGELISTENERIINTERFACE; > >+import org.eclipse.core.resources.IProject; >+import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.jdt.core.IType; >+import org.eclipse.jdt.core.search.IJavaSearchConstants; >+import org.eclipse.jdt.core.search.IJavaSearchScope; >+import org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog; >+import org.eclipse.jem.workbench.utility.JemProjectUtilities; >+import org.eclipse.jface.operation.IRunnableContext; >+import org.eclipse.jface.window.Window; > import org.eclipse.jst.ejb.ui.internal.util.EJBUIMessages; >+import org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties; >+import org.eclipse.jst.j2ee.internal.dialogs.TypeSearchEngine; >+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages; > import org.eclipse.swt.SWT; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Combo; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Display; > import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Text; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.forms.HyperlinkGroup; >+import org.eclipse.ui.forms.HyperlinkSettings; >+import org.eclipse.ui.forms.events.HyperlinkEvent; >+import org.eclipse.ui.forms.events.IHyperlinkListener; >+import org.eclipse.ui.forms.widgets.Hyperlink; > import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor; > import org.eclipse.wst.common.frameworks.datamodel.IDataModel; > > public class AddMessageDrivenBeanWizardPage extends > AddEnterpriseBeanWizardPage { > >+ private static final String MESSAGE_DRIVEN_LISTENER_INTERFACE_PREFIX = "Message listener interface: "; > private Text ejbNameText; > private Combo transactionTypeCombo; > >+ private Hyperlink hMessageDrivenInterface; >+ > public AddMessageDrivenBeanWizardPage(IDataModel model, String pageName) { > super(model, pageName, > IEjbWizardConstants.ADD_MESSAGE_DRIVEN_BEAN_WIZARD_PAGE_DESC, >@@ -68,10 +91,73 @@ > > createInterfaceControls(composite); > >+ createMessageInterfacesControl(composite); >+ > createStubsComposite(composite); > > return composite; > } > >+ private void createMessageInterfacesControl(Composite composite) { >+ Composite messageComposite = new Composite(composite, SWT.NULL); >+ GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); >+ gridData.horizontalSpan = 4; >+ gridData.grabExcessHorizontalSpace = true; >+ messageComposite.setLayout(new GridLayout()); >+ messageComposite.setLayoutData(gridData); >+ hMessageDrivenInterface = new Hyperlink(messageComposite, SWT.NULL); >+ String msgListenerInterface = getDataModel().getStringProperty(MESSAGELISTENERIINTERFACE); >+ hMessageDrivenInterface.setText(MESSAGE_DRIVEN_LISTENER_INTERFACE_PREFIX + msgListenerInterface); >+ hMessageDrivenInterface.setToolTipText("Set Message-Driven listener interface"); >+ hMessageDrivenInterface.setVisible(true); >+ hMessageDrivenInterface.setUnderlined(true); >+ hMessageDrivenInterface.addHyperlinkListener(new IHyperlinkListener(){ >+ public void linkActivated(HyperlinkEvent e){ >+ IProject project = (IProject) model.getProperty(INewJavaClassDataModelProperties.PROJECT); >+ IRunnableContext context = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); >+ IJavaProject javaProject = JemProjectUtilities.getJavaProject(project); >+ // this eliminates the non-exported classpath entries >+ final IJavaSearchScope scope = TypeSearchEngine.createJavaSearchScopeForAProject(javaProject, true, true); >+ FilteredTypesSelectionDialog dialog = new FilteredTypesSelectionDialog(getShell(),false, context, scope,IJavaSearchConstants.INTERFACE); >+ dialog.setTitle(J2EEUIMessages.INTERFACE_SELECTION_DIALOG_TITLE); >+ if (dialog.open() == Window.OK) { >+ IType type = (IType) dialog.getFirstResult(); >+ String text = MESSAGE_DRIVEN_LISTENER_INTERFACE_PREFIX + type.getFullyQualifiedName(); >+ hMessageDrivenInterface.setText(text); >+ model.setProperty(MESSAGELISTENERIINTERFACE, type.getFullyQualifiedName()); >+ hMessageDrivenInterface.pack(true); >+ } >+ } >+ public void linkEntered(HyperlinkEvent e){} >+ public void linkExited(HyperlinkEvent e){} >+ }); >+ HyperlinkGroup serverRuntimeGroup = new HyperlinkGroup(Display.getCurrent()); >+ >+ serverRuntimeGroup.add(hMessageDrivenInterface); >+ serverRuntimeGroup.setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_ALWAYS); >+ } >+ >+ @Override >+ protected boolean showValidationErrorsOnEnter() { >+ return true; >+ } >+ >+ @Override >+ protected String[] getValidationPropertyNames() { >+ return new String[] {MESSAGELISTENERIINTERFACE}; >+ } >+ >+ @Override >+ protected void updateControls() { >+ super.updateControls(); >+ String value = MESSAGE_DRIVEN_LISTENER_INTERFACE_PREFIX + getDataModel().getStringProperty(MESSAGELISTENERIINTERFACE); >+ System.out.println(value); >+ if (!hMessageDrivenInterface.getText().equals(value)){ >+ hMessageDrivenInterface.setText(value); >+ hMessageDrivenInterface.pack(true); >+ } >+ } >+ >+ > } > >#P org.eclipse.jst.j2ee.ejb >Index: ejb/org/eclipse/jst/j2ee/ejb/internal/operations/NewMessageDrivenBeanClassDataModelProvider.java >=================================================================== >RCS file: /cvsroot/webtools/ejbtools/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/NewMessageDrivenBeanClassDataModelProvider.java,v >retrieving revision 1.3 >diff -u -r1.3 NewMessageDrivenBeanClassDataModelProvider.java >--- ejb/org/eclipse/jst/j2ee/ejb/internal/operations/NewMessageDrivenBeanClassDataModelProvider.java 21 Apr 2008 14:52:21 -0000 1.3 >+++ ejb/org/eclipse/jst/j2ee/ejb/internal/operations/NewMessageDrivenBeanClassDataModelProvider.java 20 May 2008 16:47:38 -0000 >@@ -12,6 +12,7 @@ > > import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.DESTINATION_TYPE; > import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.JMS; >+import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.MESSAGELISTENERIINTERFACE; > import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.INTERFACES; > import static org.eclipse.jst.j2ee.internal.common.operations.INewJavaClassDataModelProperties.SUPERCLASS; > >@@ -19,11 +20,14 @@ > import java.util.List; > import java.util.Set; > >+import org.eclipse.core.runtime.IStatus; > import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider; > import org.eclipse.jst.j2ee.internal.ejb.project.operations.EJBCreationResourceHandler; > import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor; >+import org.eclipse.wst.common.frameworks.datamodel.IDataModel; > import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; > import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider; >+import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin; > > public class NewMessageDrivenBeanClassDataModelProvider extends NewEnterpriseBeanClassDataModelProvider { > >@@ -45,6 +49,7 @@ > > propertyNames.add(DESTINATION_TYPE); > propertyNames.add(JMS); >+ propertyNames.add(MESSAGELISTENERIINTERFACE); > > return propertyNames; > } >@@ -70,6 +75,14 @@ > return Boolean.FALSE; > else if (propertyName.equals(DESTINATION_TYPE)) { > return DestinationType.QUEUE.toString(); >+ } else if (propertyName.equals(MESSAGELISTENERIINTERFACE)){ >+ if (getBooleanProperty(JMS)){ >+ return QUALIFIED_JMS_MESSAGELISTENER; >+ } >+ List<String> interfaces = (List<String>) getProperty(INTERFACES); >+ if (interfaces.size() > 0){ >+ return interfaces.get(0); >+ } > } > > // Otherwise check super for default value for property >@@ -95,22 +108,41 @@ > > // Call super to set the property on the data model > boolean result = super.propertySet(propertyName, propertyValue); >- >+ > if (propertyName.equals(JMS)){ > updateInterfaces(JMS, (Boolean) propertyValue); >+ if (isPropertySet(MESSAGELISTENERIINTERFACE)) >+ updateMessageListenerInterfaces((Boolean) propertyValue); >+ else >+ getDataModel().notifyPropertyChange(MESSAGELISTENERIINTERFACE, IDataModel.DEFAULT_CHG); > } > if (propertyName.equals(INTERFACES)){ >- boolean isAlreadyExist = ((List<String>) propertyValue).contains(QUALIFIED_JMS_MESSAGELISTENER); >- if (isAlreadyExist && !getBooleanProperty(JMS)){ >- getDataModel().setProperty(JMS, true); >- return true; >- } >- if (!isAlreadyExist && getBooleanProperty(JMS)) >- getDataModel().setProperty(JMS, false); >+ getDataModel().notifyPropertyChange(MESSAGELISTENERIINTERFACE, IDataModel.VALUE_CHG); >+ } >+ if (propertyName.equals(MESSAGELISTENERIINTERFACE)){ >+ boolean needSetJMS = propertyValue.equals(QUALIFIED_JMS_MESSAGELISTENER); >+ if (getDataModel().getBooleanProperty(JMS) != needSetJMS) >+ getDataModel().setProperty(JMS, needSetJMS); >+ return true; > } > return result; > } >- >+ >+ private void updateMessageListenerInterfaces(boolean isJMS) { >+ if (isJMS){ >+ getDataModel().setProperty(MESSAGELISTENERIINTERFACE, QUALIFIED_JMS_MESSAGELISTENER); >+ } else { >+ String stringProperty = getStringProperty(MESSAGELISTENERIINTERFACE); >+ if (QUALIFIED_JMS_MESSAGELISTENER.equals(stringProperty)){ >+ List<String> interfaces = (List<String>) getProperty(INTERFACES); >+ if (interfaces.size() > 0){ >+ getDataModel().setProperty(MESSAGELISTENERIINTERFACE,interfaces.get(0)); >+ }else >+ getDataModel().setProperty(MESSAGELISTENERIINTERFACE,""); >+ } >+ } >+ } >+ > @Override > public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) { > if (propertyName.equals(DESTINATION_TYPE)) { >@@ -124,7 +156,7 @@ > EJBCreationResourceHandler.DESTINATION_TYPE_TOPIC > }); > } >- >+ > return super.getValidPropertyDescriptors(propertyName); > } > >@@ -139,4 +171,17 @@ > interfacesList.remove(QUALIFIED_JMS_MESSAGELISTENER); > getDataModel().setProperty(INTERFACES, interfacesList); > } >+ >+ @Override >+ public IStatus validate(String propertyName) { >+ if (propertyName.equals(MESSAGELISTENERIINTERFACE)){ >+ String value = (String) getProperty(MESSAGELISTENERIINTERFACE); >+ if (value == null || value.trim().length() == 0){ >+ List<String> interfaces = (List<String>) getProperty(INTERFACES); >+ return WTPCommonPlugin.createErrorStatus(EJBCreationResourceHandler.ERR_MESSAGELISTENERINTERFACE); >+ } >+ } >+ return super.validate(propertyName); >+ } >+ > } >Index: ejb/org/eclipse/jst/j2ee/ejb/internal/operations/CreateMessageDrivenBeanTemplateModel.java >=================================================================== >RCS file: /cvsroot/webtools/ejbtools/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/CreateMessageDrivenBeanTemplateModel.java,v >retrieving revision 1.3 >diff -u -r1.3 CreateMessageDrivenBeanTemplateModel.java >--- ejb/org/eclipse/jst/j2ee/ejb/internal/operations/CreateMessageDrivenBeanTemplateModel.java 21 Apr 2008 14:52:21 -0000 1.3 >+++ ejb/org/eclipse/jst/j2ee/ejb/internal/operations/CreateMessageDrivenBeanTemplateModel.java 20 May 2008 16:47:37 -0000 >@@ -14,12 +14,15 @@ > import static org.eclipse.jst.j2ee.ejb.internal.operations.INewEnterpriseBeanClassDataModelProperties.MAPPED_NAME; > import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.DESTINATION_TYPE; > import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.JMS; >+import static org.eclipse.jst.j2ee.ejb.internal.operations.INewMessageDrivenBeanClassDataModelProperties.MESSAGELISTENERIINTERFACE; > > import java.util.Collection; > import java.util.Hashtable; > import java.util.Iterator; >+import java.util.List; > import java.util.Map; > >+import org.eclipse.jdt.core.Signature; > import org.eclipse.jst.j2ee.internal.common.operations.Method; > import org.eclipse.wst.common.frameworks.datamodel.IDataModel; > >@@ -32,9 +35,12 @@ > public static final String QUALIFIED_JSM_MESSAGE = "javax.jms.Message"; //$NON-NLS-1$ > public static final String QUALIFIED_MESSAGE_DRIVEN = "javax.ejb.MessageDriven"; //$NON-NLS-1$ > public static final String ATT_ACTIVATION_CONFIG = "activationConfig"; //$NON-NLS-1$ >+ public static final String ATT_MESSAGE_LISTENER_INTERFACE = "messageListenerInterface"; //$NON-NLS-1$ > public static final String ON_MESSAGE = "onMessage"; //$NON-NLS-1$ > public static final String ON_MESSAGE_SIGNATURE = "(Ljavax/jms/Message;)V"; //$NON-NLS-1$ > >+ private static final String CLASS_SUFFIX = ".class"; //$NON-NLS-1$ >+ > public CreateMessageDrivenBeanTemplateModel(IDataModel dataModel) { > super(dataModel); > } >@@ -53,6 +59,8 @@ > collection.add(QUALIFIED_TRANSACTION_MANAGEMENT); > collection.add(QUALIFIED_TRANSACTION_MANAGEMENT_TYPE); > } >+ >+ collection.add(dataModel.getStringProperty(MESSAGELISTENERIINTERFACE)); > > return collection; > } >@@ -75,6 +83,14 @@ > if (mappedName != null && mappedName.length() > 0) { > result.put(ATT_MAPPED_NAME, QUOTATION_STRING + mappedName + QUOTATION_STRING); > } >+ String messageInterfaceListener = getProperty(MESSAGELISTENERIINTERFACE); >+ >+ List<String> interfaces = getQualifiedInterfaces(); >+ if (interfaces.size() != 1 || !interfaces.contains(messageInterfaceListener)){ >+ result.put(ATT_MESSAGE_LISTENER_INTERFACE, >+ Signature.getSimpleName(messageInterfaceListener)+CLASS_SUFFIX); >+ } >+ > return result; > } > >Index: ejb/org/eclipse/jst/j2ee/ejb/internal/operations/INewMessageDrivenBeanClassDataModelProperties.java >=================================================================== >RCS file: /cvsroot/webtools/ejbtools/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/INewMessageDrivenBeanClassDataModelProperties.java,v >retrieving revision 1.1 >diff -u -r1.1 INewMessageDrivenBeanClassDataModelProperties.java >--- ejb/org/eclipse/jst/j2ee/ejb/internal/operations/INewMessageDrivenBeanClassDataModelProperties.java 15 Jan 2008 12:14:35 -0000 1.1 >+++ ejb/org/eclipse/jst/j2ee/ejb/internal/operations/INewMessageDrivenBeanClassDataModelProperties.java 20 May 2008 16:47:37 -0000 >@@ -27,4 +27,6 @@ > */ > public static final String DESTINATION_TYPE = "INewMessageDrivenBeanClassDataModelProperties.DESTINATION_TYPE"; //$NON-NLS-1$ > >+ public static final String MESSAGELISTENERIINTERFACE = "INewMessageDrivenBeanClassDataModelProperties.MESSAGELISTENERIINTERFACE"; //$NON-NLS-1$ >+ > } >Index: property_files/ejbcreation.properties >=================================================================== >RCS file: /cvsroot/webtools/ejbtools/plugins/org.eclipse.jst.j2ee.ejb/property_files/ejbcreation.properties,v >retrieving revision 1.9 >diff -u -r1.9 ejbcreation.properties >--- property_files/ejbcreation.properties 23 Apr 2008 14:52:07 -0000 1.9 >+++ property_files/ejbcreation.properties 20 May 2008 16:47:38 -0000 >@@ -135,6 +135,7 @@ > DESTINATION_TYPE_QUEUE=Queue > DESTINATION_TYPE_TOPIC=Topic > >+ERR_MESSAGELISTENERINTERFACE=You must specify message listener interface. > ERR_COULD_NOT_RESOLVE_INTERFACE = Could not resolve interface. > ERR_LOCAL_HOME_MISSING_CREATE_METHOD=The specified Local Home interface has not valid create() method. > ERR_REMOTE_HOME_MISSING_CREATE_METHOD=The specified Remote Home interface has not valid create() method. >Index: ejbcreation/org/eclipse/jst/j2ee/internal/ejb/project/operations/EJBCreationResourceHandler.java >=================================================================== >RCS file: /cvsroot/webtools/ejbtools/plugins/org.eclipse.jst.j2ee.ejb/ejbcreation/org/eclipse/jst/j2ee/internal/ejb/project/operations/EJBCreationResourceHandler.java,v >retrieving revision 1.8 >diff -u -r1.8 EJBCreationResourceHandler.java >--- ejbcreation/org/eclipse/jst/j2ee/internal/ejb/project/operations/EJBCreationResourceHandler.java 23 Apr 2008 14:52:07 -0000 1.8 >+++ ejbcreation/org/eclipse/jst/j2ee/internal/ejb/project/operations/EJBCreationResourceHandler.java 20 May 2008 16:47:38 -0000 >@@ -160,6 +160,7 @@ > public static String ERR_LOCAL_HOME_NOT_INTERFACE; > public static String ERR_REMOTE_COMPONENT_NOT_INTERFACE; > public static String ERR_REMOTE_HOME_NOT_INTERFACE; >+ public static String ERR_MESSAGELISTENERINTERFACE; > > > static {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
kaloyan
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 231926
:
100432
|
101094
|
101221
|
101224
|
101487