[426809] Non-persistent EJB Timer service (wizard changes)
diff --git a/plugins/org.eclipse.jst.ejb.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.ejb.ui/META-INF/MANIFEST.MF
index 5439190..e8bda97 100644
--- a/plugins/org.eclipse.jst.ejb.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.ejb.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jst.ejb.ui; singleton:=true
-Bundle-Version: 1.1.800.qualifier
+Bundle-Version: 1.1.900.qualifier
Bundle-Activator: org.eclipse.jst.ejb.ui.internal.plugin.EJBUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.ejb.ui/ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/AddEjbTimerWizardPage.java b/plugins/org.eclipse.jst.ejb.ui/ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/AddEjbTimerWizardPage.java
index ec43328..3e211de 100644
--- a/plugins/org.eclipse.jst.ejb.ui/ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/AddEjbTimerWizardPage.java
+++ b/plugins/org.eclipse.jst.ejb.ui/ejb_ui/org/eclipse/jst/ejb/ui/internal/wizard/AddEjbTimerWizardPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Oracle and others.
+ * Copyright (c) 2011, 2014 Oracle and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Ludovic Champenois ludo@java.net
+ * IBM - Async and Non-persistent support
*******************************************************************************/
@@ -16,6 +17,7 @@
import org.eclipse.jst.j2ee.ejb.internal.operations.AddEjbTimerDataModelProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
@@ -28,6 +30,7 @@
public class AddEjbTimerWizardPage extends NewEnterpriseBeanClassWizardPage {
private Text scheduleText;
+ private Button nonPersistentCheckbox;
public AddEjbTimerWizardPage(IDataModel mode, String pageName,
String pageDesc, String pageTitle, String moduleType) {
@@ -49,6 +52,14 @@
scheduleText.setLayoutData(layoutData);
synchHelper.synchText(scheduleText,
AddEjbTimerDataModelProvider.SCHEDULE, null);
+
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gd.horizontalSpan = 2;
+ nonPersistentCheckbox = new Button(composite, SWT.CHECK);
+ nonPersistentCheckbox.setLayoutData(gd);
+ nonPersistentCheckbox.setText(IEjbWizardConstants.NON_PERSISTENT);
+ synchHelper.synchCheckbox(nonPersistentCheckbox,
+ AddEjbTimerDataModelProvider.NON_PERSISTENT, null);
return composite;
}
@@ -56,9 +67,11 @@
@Override
protected String[] getValidationPropertyNames() {
String[] base = super.getValidationPropertyNames();
- String[] result = new String[base.length + 1];
+ String[] result = new String[base.length + 2];
System.arraycopy(base, 0, result, 0, base.length);
result[base.length] = AddEjbTimerDataModelProvider.SCHEDULE;
+ result[base.length+1] = AddEjbTimerDataModelProvider.NON_PERSISTENT;
+
return result;
}
diff --git a/plugins/org.eclipse.jst.ejb.ui/pom.xml b/plugins/org.eclipse.jst.ejb.ui/pom.xml
index 31b880d..e29cc81 100644
--- a/plugins/org.eclipse.jst.ejb.ui/pom.xml
+++ b/plugins/org.eclipse.jst.ejb.ui/pom.xml
@@ -22,6 +22,6 @@
<groupId>org.eclipse.webtools.ejb</groupId>
<artifactId>org.eclipse.jst.ejb.ui</artifactId>
- <version>1.1.800-SNAPSHOT</version>
+ <version>1.1.900-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/META-INF/MANIFEST.MF b/plugins/org.eclipse.jst.j2ee.ejb/META-INF/MANIFEST.MF
index 472be4f..e798785 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jst.j2ee.ejb/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.eclipse.jst.j2ee.ejb; singleton:=true
-Bundle-Version: 1.1.700.qualifier
+Bundle-Version: 1.1.800.qualifier
Bundle-Activator: org.eclipse.jst.j2ee.ejb.internal.plugin.EjbPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/AddEjbTimerDataModelProvider.java b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/AddEjbTimerDataModelProvider.java
index 5614f37..8693993 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/AddEjbTimerDataModelProvider.java
+++ b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/AddEjbTimerDataModelProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Oracle and others.
+ * Copyright (c) 2011, 2014 Oracle and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Ludovic Champenois ludo@java.net
+ * IBM - Async and Non-persistent support
*******************************************************************************/
@@ -17,6 +18,9 @@
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jst.j2ee.ejb.internal.plugin.EjbPlugin;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
import org.eclipse.jst.j2ee.internal.common.operations.NewJavaClassDataModelProvider;
import org.eclipse.jst.j2ee.internal.common.operations.NewJavaEEArtifactClassOperation;
import org.eclipse.jst.j2ee.internal.ejb.project.operations.EJBCreationResourceHandler;
@@ -30,6 +34,9 @@
NewEnterpriseBeanClassDataModelProvider {
public static final String SCHEDULE = "AddEjbTimer.SCHEDULE"; //$NON-NLS-1$
+
+ public static final String NON_PERSISTENT = "AddEjbTimer.NON_PERSISTENT"; //$NON-NLS-1$
+
@Override
public IDataModelOperation getDefaultOperation() {
@@ -54,6 +61,7 @@
Set<String> propertyNames = super.getPropertyNames();
propertyNames.add(SCHEDULE);
+ propertyNames.add(NON_PERSISTENT);
return propertyNames;
}
@@ -73,11 +81,23 @@
public Object getDefaultProperty(String propertyName) {
if (propertyName.equals(SCHEDULE)) {
return EJBCreationResourceHandler.timerScheduleDefault;
+ } else if (propertyName.equals(NON_PERSISTENT)) {
+ return Boolean.FALSE;
}
// Otherwise check super for default value for property
return super.getDefaultProperty(propertyName);
}
+
+ @Override
+ public boolean isPropertyEnabled(String propertyName) {
+ if (propertyName.equals(SCHEDULE)) {
+ return Boolean.TRUE;
+ } else if (propertyName.equals(NON_PERSISTENT)) {
+ return ejb3xOrLater(J2EEVersionConstants.VERSION_3_1);
+ }
+ return super.isPropertyEnabled(propertyName);
+ }
@Override
public IStatus validate(String propertyName) {
@@ -91,6 +111,8 @@
if (value == null || value.trim().length() == 0) {
return WTPCommonPlugin.createErrorStatus(EJBCreationResourceHandler.errorTimerScheduleMissing);
}
+ } else if (NON_PERSISTENT.equals(propertyName) && ejb3xOrLater(J2EEVersionConstants.VERSION_3_1) && !ejb3xOrLater(J2EEVersionConstants.VERSION_3_2)) {
+ return new Status(IStatus.WARNING, EjbPlugin.PLUGIN_ID, EJBCreationResourceHandler.WRN_EJB31_NON_PERSISTENT_NO_SUPPORTED);
}
IStatus status = super.validate(propertyName);
return status;
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/AddEjbTimerTemplateModel.java b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/AddEjbTimerTemplateModel.java
index 9e6fafb..a6dc2f8 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/AddEjbTimerTemplateModel.java
+++ b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/AddEjbTimerTemplateModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Oracle and others.
+ * Copyright (c) 2011, 2014 Oracle and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Ludovic Champenois ludo@java.net
+ * IBM - Async and Non-persistent support
*******************************************************************************/
package org.eclipse.jst.j2ee.ejb.internal.operations;
@@ -81,5 +82,9 @@
return unimplementedMethods;
}
+
+ public boolean isNonPersistent() {
+ return (Boolean) dataModel.getProperty(AddEjbTimerDataModelProvider.NON_PERSISTENT);
+ }
}
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/EjbTimerTemplate.java b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/EjbTimerTemplate.java
index e446736..c973f90 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/EjbTimerTemplate.java
+++ b/plugins/org.eclipse.jst.j2ee.ejb/ejb/org/eclipse/jst/j2ee/ejb/internal/operations/EjbTimerTemplate.java
@@ -229,10 +229,13 @@
stringBuffer.append(TEXT_34);
- String schedule = model.getProperty(AddEjbTimerDataModelProvider.SCHEDULE).trim();
+ StringBuilder schedule = new StringBuilder(model.getProperty(AddEjbTimerDataModelProvider.SCHEDULE));
+ if (model.isNonPersistent()) {
+ schedule.append(", persistent=false"); //$NON-NLS-1$
+ }
stringBuffer.append(TEXT_35);
- stringBuffer.append( schedule );
+ stringBuffer.append( schedule.toString().trim() );
stringBuffer.append(TEXT_36);
return stringBuffer.toString();
}
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/pom.xml b/plugins/org.eclipse.jst.j2ee.ejb/pom.xml
index 93d3498..d57e06c 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/pom.xml
+++ b/plugins/org.eclipse.jst.j2ee.ejb/pom.xml
@@ -22,6 +22,6 @@
<groupId>org.eclipse.webtools.ejb</groupId>
<artifactId>org.eclipse.jst.j2ee.ejb</artifactId>
- <version>1.1.700-SNAPSHOT</version>
+ <version>1.1.800-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.jst.j2ee.ejb/templates/ejbtimer.javajet b/plugins/org.eclipse.jst.j2ee.ejb/templates/ejbtimer.javajet
index 83429b7..edd04b7 100644
--- a/plugins/org.eclipse.jst.j2ee.ejb/templates/ejbtimer.javajet
+++ b/plugins/org.eclipse.jst.j2ee.ejb/templates/ejbtimer.javajet
@@ -1,7 +1,6 @@
<%@ jet package="org.eclipse.jst.j2ee.ejb.internal.operations"
imports="java.util.* org.eclipse.jst.j2ee.internal.common.operations.*"
class="EjbTimerTemplate"
- skeleton="generator.skeleton"
%>
<% AddEjbTimerTemplateModel model = (AddEjbTimerTemplateModel) argument; %>
<%@ include file="_flags.template" %>
@@ -12,10 +11,13 @@
<%@ include file="_constructors.template" %>
<%@ include file="_methods.template" %>
<%
- String schedule = model.getProperty(AddEjbTimerDataModelProvider.SCHEDULE).trim();
+ StringBuilder schedule = new StringBuilder(model.getProperty(AddEjbTimerDataModelProvider.SCHEDULE));
+ if (model.isNonPersistent()) {
+ schedule.append(", persistent=false");
+ }
%>
@SuppressWarnings("unused")
- @Schedule(<%= schedule %>)
+ @Schedule(<%= schedule.toString().trim() %>)
private void scheduledTimeout(final Timer t) {
System.out.println("@Schedule called at: " + new java.util.Date());
}