Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortle2010-01-05 21:27:38 +0000
committertle2010-01-05 21:27:38 +0000
commitb069e39155ee0d4a83df88c4f5093d61d8acf451 (patch)
tree63a989a898c0288546e478f87b321d4a7770ce73
parentcb7bd03175a28d26a99227fb469e2845fab9ed36 (diff)
downloadwebtools.dali-b069e39155ee0d4a83df88c4f5093d61d8acf451.tar.gz
webtools.dali-b069e39155ee0d4a83df88c4f5093d61d8acf451.tar.xz
webtools.dali-b069e39155ee0d4a83df88c4f5093d61d8acf451.zip
297537 - [EclipseLink] Support logging level by category configuration
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/META-INF/MANIFEST.MF1
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceUnit.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/context/persistence/logging/EclipseLinkLogging2_0.java291
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/v2_0/context/persistence/logging/Logging2_0.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties30
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/EclipseLinkPersistenceXmlUiFactory.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/EclipseLinkLoggingComposite.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/PersistenceXmlLoggingTab.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/EclipseLink2_0PersistenceXmlUiFactory.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/logging/EclipseLinkCategoryLoggingLevelComposite.java198
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/logging/EclipseLinkLogging2_0Composite.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/logging/PersistenceXmlLogging2_0Tab.java37
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTestCase.java8
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/persistence/EclipseLink2_0LoggingTests.java430
17 files changed, 1216 insertions, 27 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.eclipselink.core/META-INF/MANIFEST.MF
index d250169afc..36b7c7b228 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/META-INF/MANIFEST.MF
@@ -71,4 +71,5 @@ Export-Package: org.eclipse.jpt.eclipselink.core,
org.eclipse.jpt.eclipselink.core.resource.orm.v2_0,
org.eclipse.jpt.eclipselink.core.v2_0.context,
org.eclipse.jpt.eclipselink.core.v2_0.context.persistence.connection,
+ org.eclipse.jpt.eclipselink.core.v2_0.context.persistence.logging,
org.eclipse.jpt.eclipselink.core.v2_0.context.persistence.options
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java
index f0184ed12c..38b90547fd 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java
@@ -60,6 +60,7 @@ public class EclipseLinkPersistenceUnit
protected final List<EclipseLinkConverter> converters = new ArrayList<EclipseLinkConverter>();
+ // ********** constructors/initialization **********
public EclipseLinkPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) {
super(parent, xmlPersistenceUnit);
}
@@ -158,7 +159,7 @@ public class EclipseLinkPersistenceUnit
}
MappingFileRef mappingFileRef = buildEclipseLinkImpliedMappingFileRef();
this.impliedEclipseLinkMappingFileRef = mappingFileRef;
- firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, null, mappingFileRef);
+ this.firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, null, mappingFileRef);
return mappingFileRef;
}
@@ -169,7 +170,7 @@ public class EclipseLinkPersistenceUnit
MappingFileRef mappingFileRef = this.impliedEclipseLinkMappingFileRef;
this.impliedEclipseLinkMappingFileRef.dispose();
this.impliedEclipseLinkMappingFileRef = null;
- firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, mappingFileRef, null);
+ this.firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, mappingFileRef, null);
}
@@ -180,7 +181,7 @@ public class EclipseLinkPersistenceUnit
}
protected Connection buildEclipseLinkConnection() {
- return (Connection) getContextNodeFactory().buildConnection(this);
+ return (Connection) this.getContextNodeFactory().buildConnection(this);
}
protected Customization buildEclipseLinkCustomization() {
@@ -196,7 +197,7 @@ public class EclipseLinkPersistenceUnit
}
protected Options buildEclipseLinkOptions() {
- return (Options) getContextNodeFactory().buildOptions(this);
+ return (Options) this.getContextNodeFactory().buildOptions(this);
}
protected SchemaGeneration buildEclipseLinkSchemaGeneration() {
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceUnit.java
new file mode 100644
index 0000000000..61f4587b68
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceUnit.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.eclipselink.core.internal.v2_0.context.persistence;
+
+import org.eclipse.jpt.core.context.persistence.Persistence;
+import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.eclipselink.core.context.persistence.logging.Logging;
+import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
+import org.eclipse.jpt.eclipselink.core.internal.v2_0.context.persistence.logging.EclipseLinkLogging2_0;
+
+/**
+ * EclipseLink2_0PersistenceUnit
+ */
+public class EclipseLink2_0PersistenceUnit extends EclipseLinkPersistenceUnit
+{
+ // ********** constructors/initialization **********
+ public EclipseLink2_0PersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) {
+ super(parent, xmlPersistenceUnit);
+ }
+
+ // ********** factory methods **********
+ protected Logging buildEclipseLinkLogging() {
+ return new EclipseLinkLogging2_0(this);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java
index d24a824397..963a7d7744 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
@@ -19,7 +19,6 @@ import org.eclipse.jpt.core.jpa2.context.persistence.options.JpaOptions2_0;
import org.eclipse.jpt.core.resource.persistence.XmlJarFileRef;
import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkJarFileRef;
-import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.eclipselink.core.internal.v2_0.context.persistence.connection.EclipseLinkConnection2_0;
import org.eclipse.jpt.eclipselink.core.internal.v2_0.context.persistence.options.EclipseLinkOptions2_0;
@@ -29,7 +28,7 @@ public class EclipseLink2_0PersistenceXmlContextNodeFactory extends AbstractPers
@Override
public PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) {
- return new EclipseLinkPersistenceUnit(parent, xmlPersistenceUnit);
+ return new EclipseLink2_0PersistenceUnit(parent, xmlPersistenceUnit);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/context/persistence/logging/EclipseLinkLogging2_0.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/context/persistence/logging/EclipseLinkLogging2_0.java
new file mode 100644
index 0000000000..7b12e153a6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/context/persistence/logging/EclipseLinkLogging2_0.java
@@ -0,0 +1,291 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.eclipselink.core.internal.v2_0.context.persistence.logging;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.eclipselink.core.context.persistence.logging.LoggingLevel;
+import org.eclipse.jpt.eclipselink.core.internal.context.persistence.logging.EclipseLinkLogging;
+import org.eclipse.jpt.eclipselink.core.v2_0.context.persistence.logging.Logging2_0;
+
+/**
+ * EclipseLinkLogging2_0
+ */
+public class EclipseLinkLogging2_0 extends EclipseLinkLogging
+ implements Logging2_0
+{
+ // ********** EclipseLink properties **********
+
+ /**
+ * Store Category levels in a map
+ * key/value pairs, where:
+ * key = Category property id
+ * value = value
+ */
+ private Map<String, LoggingLevel> categoryValues;
+
+ private LoggingLevel categoriesDefaultValue;
+
+ // ********** constructors **********
+ public EclipseLinkLogging2_0(PersistenceUnit parent) {
+ super(parent);
+ }
+
+ // ********** initialization **********
+ /**
+ * Initializes properties with values from the persistence unit.
+ */
+ @Override
+ protected void initializeProperties() {
+ super.initializeProperties();
+
+ this.categoriesDefaultValue =
+ this.getEnumValue(ECLIPSELINK_LEVEL, LoggingLevel.values());
+ this.initializeCategory(SQL_CATEGORY_LOGGING_PROPERTY);
+ this.initializeCategory(TRANSACTION_CATEGORY_LOGGING_PROPERTY);
+ this.initializeCategory(EVENT_CATEGORY_LOGGING_PROPERTY);
+ this.initializeCategory(CONNECTION_CATEGORY_LOGGING_PROPERTY);
+ this.initializeCategory(QUERY_CATEGORY_LOGGING_PROPERTY);
+ this.initializeCategory(CACHE_CATEGORY_LOGGING_PROPERTY);
+ this.initializeCategory(PROPAGATION_CATEGORY_LOGGING_PROPERTY);
+ this.initializeCategory(SEQUENCING_CATEGORY_LOGGING_PROPERTY);
+ this.initializeCategory(EJB_CATEGORY_LOGGING_PROPERTY);
+ this.initializeCategory(DMS_CATEGORY_LOGGING_PROPERTY);
+ this.initializeCategory(EJB_OR_METADATA_CATEGORY_LOGGING_PROPERTY);
+ this.initializeCategory(METAMODEL_CATEGORY_LOGGING_PROPERTY);
+ this.initializeCategory(WEAVER_CATEGORY_LOGGING_PROPERTY);
+ this.initializeCategory(PROPERTIES_CATEGORY_LOGGING_PROPERTY);
+ this.initializeCategory(SERVER_CATEGORY_LOGGING_PROPERTY);
+ }
+
+ @Override
+ protected void initialize() {
+ super.initialize();
+
+ this.categoryValues = new HashMap<String, LoggingLevel>();
+ }
+
+ /**
+ * Convenience method to set a logging level category value from the value in the persistence unit.
+ *
+ * key = Category property id; value = value (LoggingLevel)
+ * @param categoryId - Category property id
+ */
+ private void initializeCategory(String categoryId) {
+ String puKey = this.persistenceUnitKeyOf(categoryId);
+ LoggingLevel puValue = this.getEnumValue(puKey, LoggingLevel.values());
+
+ this.categoryValues.put(categoryId, puValue);
+ }
+
+ // ********** behavior **********
+
+ public void propertyValueChanged(String propertyName, String newValue) {
+ super.propertyValueChanged(propertyName, newValue);
+
+ if (propertyName.equals(ECLIPSELINK_SQL_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_SQL_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_TRANSACTION_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_TRANSACTION_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_EVENT_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_EVENT_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_CONNECTION_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_CONNECTION_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_QUERY_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_QUERY_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_CACHE_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_CACHE_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_PROPAGATION_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_PROPAGATION_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_SEQUENCING_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_SEQUENCING_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_EJB_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_EJB_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_DMS_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_DMS_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_EJB_OR_METADATA_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_EJB_OR_METADATA_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_METAMODEL_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_METAMODEL_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WEAVER_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_WEAVER_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_PROPERTIES_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_PROPERTIES_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ else if (propertyName.equals(ECLIPSELINK_SERVER_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_SERVER_CATEGORY_LOGGING_LEVEL, newValue);
+ }
+ }
+
+ @Override
+ public void propertyRemoved(String propertyName) {
+ super.propertyRemoved(propertyName);
+
+ if (propertyName.equals(ECLIPSELINK_SQL_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_SQL_CATEGORY_LOGGING_LEVEL, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_TRANSACTION_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_TRANSACTION_CATEGORY_LOGGING_LEVEL, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_EVENT_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_EVENT_CATEGORY_LOGGING_LEVEL, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_CONNECTION_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_CONNECTION_CATEGORY_LOGGING_LEVEL, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_QUERY_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_QUERY_CATEGORY_LOGGING_LEVEL, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_CACHE_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_CACHE_CATEGORY_LOGGING_LEVEL, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_PROPAGATION_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_PROPAGATION_CATEGORY_LOGGING_LEVEL, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_SEQUENCING_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_SEQUENCING_CATEGORY_LOGGING_LEVEL, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_EJB_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_EJB_CATEGORY_LOGGING_LEVEL, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_DMS_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_DMS_CATEGORY_LOGGING_LEVEL, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_EJB_OR_METADATA_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_EJB_OR_METADATA_CATEGORY_LOGGING_LEVEL, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_METAMODEL_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_METAMODEL_CATEGORY_LOGGING_LEVEL, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_WEAVER_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_WEAVER_CATEGORY_LOGGING_LEVEL, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_PROPERTIES_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_PROPERTIES_CATEGORY_LOGGING_LEVEL, null);
+ }
+ else if (propertyName.equals(ECLIPSELINK_SERVER_CATEGORY_LOGGING_LEVEL)) {
+ this.categoryLoggingChanged_(ECLIPSELINK_SERVER_CATEGORY_LOGGING_LEVEL, null);
+ }
+ }
+
+ /**
+ * Adds property names key/value pairs, where:
+ * key = EclipseLink property key
+ * value = property id
+ */
+ @Override
+ protected void addPropertyNames(Map<String, String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+
+ propertyNames.put(
+ ECLIPSELINK_SQL_CATEGORY_LOGGING_LEVEL,
+ SQL_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_TRANSACTION_CATEGORY_LOGGING_LEVEL,
+ TRANSACTION_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_EVENT_CATEGORY_LOGGING_LEVEL,
+ EVENT_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_CONNECTION_CATEGORY_LOGGING_LEVEL,
+ CONNECTION_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_QUERY_CATEGORY_LOGGING_LEVEL,
+ QUERY_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_CACHE_CATEGORY_LOGGING_LEVEL,
+ CACHE_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_PROPAGATION_CATEGORY_LOGGING_LEVEL,
+ PROPAGATION_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_SEQUENCING_CATEGORY_LOGGING_LEVEL,
+ SEQUENCING_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_EJB_CATEGORY_LOGGING_LEVEL,
+ EJB_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_DMS_CATEGORY_LOGGING_LEVEL,
+ DMS_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_EJB_OR_METADATA_CATEGORY_LOGGING_LEVEL,
+ EJB_OR_METADATA_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_METAMODEL_CATEGORY_LOGGING_LEVEL,
+ METAMODEL_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_WEAVER_CATEGORY_LOGGING_LEVEL,
+ WEAVER_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_PROPERTIES_CATEGORY_LOGGING_LEVEL,
+ PROPERTIES_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.put(
+ ECLIPSELINK_SERVER_CATEGORY_LOGGING_LEVEL,
+ SERVER_CATEGORY_LOGGING_PROPERTY);
+ }
+
+
+ // ********** Category Levels **********
+
+ public LoggingLevel getLevel(String category) {
+
+ return this.categoryValues.get(category);
+ }
+
+ public void setLevel(String category, LoggingLevel newLevel) {
+ LoggingLevel old = this.getLevel(category);
+ this.categoryValues.put(category, newLevel);
+ this.putProperty(category, newLevel);
+ this.firePropertyChanged(category, old, newLevel);
+ }
+
+ private void categoryLoggingChanged_(String eclipselinkKey, String stringValue) {
+ String category = this.propertyIdOf(eclipselinkKey);
+ this.categoryLoggingChanged(category, stringValue);
+ }
+
+ private void categoryLoggingChanged(String category, String stringValue) {
+ LoggingLevel enumValue = getEnumValueOf(stringValue, LoggingLevel.values());
+ LoggingLevel old = this.getLevel(category);
+ this.categoryValues.put(category, enumValue);
+ this.firePropertyChanged(category, old, enumValue);
+ }
+
+ public LoggingLevel getCategoriesDefaultLevel() {
+ return (this.categoriesDefaultValue == null) ? super.getDefaultLevel() : this.categoriesDefaultValue;
+ }
+
+ @Override
+ public void setLevel(LoggingLevel level) {
+ super.setLevel(level);
+ this.setDefaultLevel(level);
+ }
+
+ public void setDefaultLevel(LoggingLevel level) {
+ LoggingLevel old = this.categoriesDefaultValue;
+ this.categoriesDefaultValue = level;
+ this.firePropertyChanged(CATEGORIES_DEFAULT_LOGGING_PROPERTY, old, level);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/v2_0/context/persistence/logging/Logging2_0.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/v2_0/context/persistence/logging/Logging2_0.java
new file mode 100644
index 0000000000..9908ec05de
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/v2_0/context/persistence/logging/Logging2_0.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.eclipselink.core.v2_0.context.persistence.logging;
+
+import org.eclipse.jpt.eclipselink.core.context.persistence.logging.Logging;
+import org.eclipse.jpt.eclipselink.core.context.persistence.logging.LoggingLevel;
+/**
+ * Logging2_0
+ */
+public interface Logging2_0 extends Logging
+{
+ public static final String CATEGORY_PREFIX_ = "eclipselink.logging.level.";
+
+ LoggingLevel getCategoriesDefaultLevel();
+ LoggingLevel getLevel(String category);
+ void setLevel(String category, LoggingLevel level);
+ void setDefaultLevel(LoggingLevel level);
+ static final String CATEGORIES_DEFAULT_LOGGING_PROPERTY = "categoriesDefaultLoggingLevel"; //$NON-NLS-1$
+
+ static final String SQL_CATEGORY_LOGGING_PROPERTY = "sqlLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_SQL_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "sql"; //$NON-NLS-1$
+
+ static final String TRANSACTION_CATEGORY_LOGGING_PROPERTY = "transactionLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_TRANSACTION_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "transaction"; //$NON-NLS-1$
+
+ static final String EVENT_CATEGORY_LOGGING_PROPERTY = "eventLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_EVENT_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "event"; //$NON-NLS-1$
+
+ static final String CONNECTION_CATEGORY_LOGGING_PROPERTY = "connectionLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_CONNECTION_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "connection"; //$NON-NLS-1$
+
+ static final String QUERY_CATEGORY_LOGGING_PROPERTY = "queryLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_QUERY_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "query"; //$NON-NLS-1$
+
+ static final String CACHE_CATEGORY_LOGGING_PROPERTY = "cacheLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_CACHE_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "cache"; //$NON-NLS-1$
+
+ static final String PROPAGATION_CATEGORY_LOGGING_PROPERTY = "propagationLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_PROPAGATION_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "propagation"; //$NON-NLS-1$
+
+ static final String SEQUENCING_CATEGORY_LOGGING_PROPERTY = "sequencingLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_SEQUENCING_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "sequencing"; //$NON-NLS-1$
+
+ static final String EJB_CATEGORY_LOGGING_PROPERTY = "ejbLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_EJB_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "ejb"; //$NON-NLS-1$
+
+ static final String DMS_CATEGORY_LOGGING_PROPERTY = "dmsLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_DMS_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "dms"; //$NON-NLS-1$
+
+ static final String EJB_OR_METADATA_CATEGORY_LOGGING_PROPERTY = "ejb_or_metadataLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_EJB_OR_METADATA_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "ejb_or_metadata"; //$NON-NLS-1$
+
+ static final String METAMODEL_CATEGORY_LOGGING_PROPERTY = "jpa_metamodelLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_METAMODEL_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "jpa_metamodel"; //$NON-NLS-1$
+
+ static final String WEAVER_CATEGORY_LOGGING_PROPERTY = "weaverLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_WEAVER_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "weaver"; //$NON-NLS-1$
+
+ static final String PROPERTIES_CATEGORY_LOGGING_PROPERTY = "propertiesLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_PROPERTIES_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "properties"; //$NON-NLS-1$
+
+ static final String SERVER_CATEGORY_LOGGING_PROPERTY = "serverLoggingLevel"; //$NON-NLS-1$
+ static final String ECLIPSELINK_SERVER_CATEGORY_LOGGING_LEVEL = CATEGORY_PREFIX_ + "server"; //$NON-NLS-1$
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties
index fc5e50e975..cfb8d18c90 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/property_files/eclipselink_ui.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2007, 2009 Oracle. All rights reserved.
+# Copyright (c) 2007, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
@@ -238,7 +238,25 @@ PersistenceXmlLoggingTab_sectionDescription = Configure the EclipseLink logging
PersistenceXmlLoggingTab_defaultWithOneParam = Default ({0})
PersistenceXmlLoggingTab_defaultEmpty = Default ()
+PersistenceXmlLoggingTab_categoryLoggingLevelSectionTitle = Category logging level
PersistenceXmlLoggingTab_loggingLevelLabel = Logging level:
+PersistenceXmlLoggingTab_sqlLoggingLevelLabel = SQL Logging level:
+
+PersistenceXmlLoggingTab_transactionLoggingLevelLabel = Transaction Logging level:
+PersistenceXmlLoggingTab_eventLoggingLevelLabel = Event Logging level:
+PersistenceXmlLoggingTab_connectionLoggingLevelLabel = Connection Logging level:
+PersistenceXmlLoggingTab_queryLoggingLevelLabel = Query Logging level:
+PersistenceXmlLoggingTab_cacheLoggingLevelLabel = Cache Logging level:
+PersistenceXmlLoggingTab_propagationLoggingLevelLabel = Propagation Logging level:
+PersistenceXmlLoggingTab_sequencingLoggingLevelLabel = Sequencing Logging level:
+PersistenceXmlLoggingTab_ejbLoggingLevelLabel = EJB Logging level:
+PersistenceXmlLoggingTab_dmsLoggingLevelLabel = DMS Logging level:
+PersistenceXmlLoggingTab_ejb_or_metadataLoggingLevelLabel = EJB or Metadata Logging level:
+PersistenceXmlLoggingTab_jpa_metamodelLoggingLevelLabel = JPA Metamodel Logging level:
+
+PersistenceXmlLoggingTab_weaverLoggingLevelLabel = Weaving Logging level:
+PersistenceXmlLoggingTab_propertiesLoggingLevelLabel = Properties Logging level:
+PersistenceXmlLoggingTab_serverLoggingLevelLabel = Server Logging level:
LoggingLevelComposite_off = Off
LoggingLevelComposite_severe = Severe
@@ -250,6 +268,16 @@ LoggingLevelComposite_finer = Finer
LoggingLevelComposite_finest = Finest
LoggingLevelComposite_all = All
+EclipseLinkCategoryLoggingLevelComposite_off = Off
+EclipseLinkCategoryLoggingLevelComposite_severe = Severe
+EclipseLinkCategoryLoggingLevelComposite_warning = Warning
+EclipseLinkCategoryLoggingLevelComposite_info = Info
+EclipseLinkCategoryLoggingLevelComposite_config = Config
+EclipseLinkCategoryLoggingLevelComposite_fine = Fine
+EclipseLinkCategoryLoggingLevelComposite_finer = Finer
+EclipseLinkCategoryLoggingLevelComposite_finest = Finest
+EclipseLinkCategoryLoggingLevelComposite_all = All
+
PersistenceXmlLoggingTab_loggerLabel = Logger:
PersistenceXmlLoggingTab_browse = Browse...
LoggerComposite_default_logger = Default Logger
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java
index 115f8aff4a..5e85a71cf9 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/EclipseLinkUiMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2007, 2009 Oracle. All rights reserved.
+* Copyright (c) 2007, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
@@ -246,8 +246,24 @@ public class EclipseLinkUiMessages {
public static String PersistenceXmlLoggingTab_defaultWithOneParam;
public static String PersistenceXmlLoggingTab_defaultEmpty;
+ public static String PersistenceXmlLoggingTab_categoryLoggingLevelSectionTitle;
public static String PersistenceXmlLoggingTab_loggingLevelLabel;
-
+ public static String PersistenceXmlLoggingTab_sqlLoggingLevelLabel;
+ public static String PersistenceXmlLoggingTab_transactionLoggingLevelLabel;
+ public static String PersistenceXmlLoggingTab_eventLoggingLevelLabel;
+ public static String PersistenceXmlLoggingTab_connectionLoggingLevelLabel;
+ public static String PersistenceXmlLoggingTab_queryLoggingLevelLabel;
+ public static String PersistenceXmlLoggingTab_cacheLoggingLevelLabel;
+ public static String PersistenceXmlLoggingTab_propagationLoggingLevelLabel;
+ public static String PersistenceXmlLoggingTab_sequencingLoggingLevelLabel;
+ public static String PersistenceXmlLoggingTab_ejbLoggingLevelLabel;
+ public static String PersistenceXmlLoggingTab_dmsLoggingLevelLabel;
+ public static String PersistenceXmlLoggingTab_ejb_or_metadataLoggingLevelLabel;
+ public static String PersistenceXmlLoggingTab_jpa_metamodelLoggingLevelLabel;
+ public static String PersistenceXmlLoggingTab_weaverLoggingLevelLabel;
+ public static String PersistenceXmlLoggingTab_propertiesLoggingLevelLabel;
+ public static String PersistenceXmlLoggingTab_serverLoggingLevelLabel;
+
public static String LoggingLevelComposite_off;
public static String LoggingLevelComposite_severe;
public static String LoggingLevelComposite_warning;
@@ -258,6 +274,16 @@ public class EclipseLinkUiMessages {
public static String LoggingLevelComposite_finest;
public static String LoggingLevelComposite_all;
+ public static String EclipseLinkCategoryLoggingLevelComposite_off;
+ public static String EclipseLinkCategoryLoggingLevelComposite_severe;
+ public static String EclipseLinkCategoryLoggingLevelComposite_warning;
+ public static String EclipseLinkCategoryLoggingLevelComposite_info;
+ public static String EclipseLinkCategoryLoggingLevelComposite_config;
+ public static String EclipseLinkCategoryLoggingLevelComposite_fine;
+ public static String EclipseLinkCategoryLoggingLevelComposite_finer;
+ public static String EclipseLinkCategoryLoggingLevelComposite_finest;
+ public static String EclipseLinkCategoryLoggingLevelComposite_all;
+
public static String PersistenceXmlLoggingTab_loggerLabel;
public static String PersistenceXmlLoggingTab_browse;
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/EclipseLinkPersistenceXmlUiFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/EclipseLinkPersistenceXmlUiFactory.java
index 21835c5775..f15882882f 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/EclipseLinkPersistenceXmlUiFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/EclipseLinkPersistenceXmlUiFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
@@ -104,13 +104,13 @@ public class EclipseLinkPersistenceXmlUiFactory implements PersistenceXmlUiFacto
return new PersistenceXmlCachingTab<Caching>(cachingHolder, parent, widgetFactory);
}
- protected PersistenceXmlLoggingTab buildLoggingTab(
+ protected PersistenceXmlLoggingTab<? extends Logging> buildLoggingTab(
PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder,
Composite parent,
WidgetFactory widgetFactory) {
PropertyValueModel<Logging> loggingHolder = this.buildLoggingHolder(subjectHolder);
- return new PersistenceXmlLoggingTab(loggingHolder, parent, widgetFactory);
+ return new PersistenceXmlLoggingTab<Logging>(loggingHolder, parent, widgetFactory);
}
protected PersistenceXmlOptionsTab<? extends Options> buildOptionsTab(
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/EclipseLinkLoggingComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/EclipseLinkLoggingComposite.java
index 16bebf45b9..baeecb1248 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/EclipseLinkLoggingComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/EclipseLinkLoggingComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
@@ -22,11 +22,11 @@ import org.eclipse.ui.forms.widgets.Section;
/**
* EclipseLinkLoggingComposite
*/
-public class EclipseLinkLoggingComposite
- extends FormPane<Logging>
+public class EclipseLinkLoggingComposite<T extends Logging>
+ extends FormPane<T>
{
public EclipseLinkLoggingComposite(
- FormPane<Logging> subjectHolder,
+ FormPane<T> subjectHolder,
Composite container) {
super(subjectHolder, container, false);
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/PersistenceXmlLoggingTab.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/PersistenceXmlLoggingTab.java
index 09c75f0d98..a8c9abe13a 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/PersistenceXmlLoggingTab.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/persistence/logging/PersistenceXmlLoggingTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
@@ -25,13 +25,13 @@ import org.eclipse.swt.widgets.Composite;
/**
* PersistenceXmlLoggingTab
*/
-public class PersistenceXmlLoggingTab
- extends FormPane<Logging>
+public class PersistenceXmlLoggingTab<T extends Logging>
+ extends FormPane<T>
implements JpaPageComposite
{
// ********** constructors/initialization **********
public PersistenceXmlLoggingTab(
- PropertyValueModel<Logging> subjectHolder,
+ PropertyValueModel<T> subjectHolder,
Composite parent,
WidgetFactory widgetFactory) {
@@ -40,7 +40,7 @@ public class PersistenceXmlLoggingTab
@Override
protected void initializeLayout(Composite container) {
- new EclipseLinkLoggingComposite(this, container);
+ new EclipseLinkLoggingComposite<T>(this, container);
}
// ********** JpaPageComposite implementation **********
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/EclipseLink2_0PersistenceXmlUiFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/EclipseLink2_0PersistenceXmlUiFactory.java
index 6afec0f82f..0373cfb819 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/EclipseLink2_0PersistenceXmlUiFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/EclipseLink2_0PersistenceXmlUiFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
+* Copyright (c) 2009, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
@@ -13,11 +13,15 @@ import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
import org.eclipse.jpt.eclipselink.core.context.persistence.caching.Caching;
import org.eclipse.jpt.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
+import org.eclipse.jpt.eclipselink.core.internal.v2_0.context.persistence.EclipseLink2_0PersistenceUnit;
+import org.eclipse.jpt.eclipselink.core.v2_0.context.persistence.logging.Logging2_0;
import org.eclipse.jpt.eclipselink.core.v2_0.context.persistence.options.Options2_0;
import org.eclipse.jpt.eclipselink.ui.internal.persistence.EclipseLinkPersistenceXmlUiFactory;
import org.eclipse.jpt.eclipselink.ui.internal.persistence.caching.PersistenceXmlCachingTab;
+import org.eclipse.jpt.eclipselink.ui.internal.persistence.logging.PersistenceXmlLoggingTab;
import org.eclipse.jpt.eclipselink.ui.internal.persistence.options.PersistenceXmlOptionsTab;
import org.eclipse.jpt.eclipselink.ui.internal.v2_0.persistence.caching.PersistenceXmlCaching2_0Tab;
+import org.eclipse.jpt.eclipselink.ui.internal.v2_0.persistence.logging.PersistenceXmlLogging2_0Tab;
import org.eclipse.jpt.eclipselink.ui.internal.v2_0.persistence.options.PersistenceXmlOptions2_0Tab;
import org.eclipse.jpt.ui.WidgetFactory;
import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
@@ -43,6 +47,16 @@ public class EclipseLink2_0PersistenceXmlUiFactory extends EclipseLinkPersistenc
return new PersistenceXmlCaching2_0Tab(cachingHolder, parent, widgetFactory);
}
+
+ @Override
+ protected PersistenceXmlLoggingTab<? extends Logging2_0> buildLoggingTab(
+ PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder,
+ Composite parent,
+ WidgetFactory widgetFactory) {
+ PropertyValueModel<Logging2_0> logging2_0Holder = this.buildLogging2_0Holder(subjectHolder);
+
+ return new PersistenceXmlLogging2_0Tab(logging2_0Holder, parent, widgetFactory);
+ }
@Override
protected PersistenceXmlOptionsTab<Options2_0> buildOptionsTab(
@@ -56,6 +70,17 @@ public class EclipseLink2_0PersistenceXmlUiFactory extends EclipseLinkPersistenc
// ********** private methods **********
+ private PropertyValueModel<Logging2_0> buildLogging2_0Holder(
+ PropertyValueModel<EclipseLinkPersistenceUnit> subjectHolder) {
+ return new TransformationPropertyValueModel<EclipseLinkPersistenceUnit, Logging2_0>(subjectHolder) {
+ @Override
+ protected Logging2_0 transform_(EclipseLinkPersistenceUnit value) {
+
+ return (Logging2_0) ((EclipseLink2_0PersistenceUnit)value).getLogging();
+ }
+ };
+ }
+
private PropertyValueModel<Options2_0> buildOptions2_0Holder(
PropertyValueModel<PersistenceUnit> subjectHolder) {
return new TransformationPropertyValueModel<PersistenceUnit, Options2_0>(subjectHolder) {
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/logging/EclipseLinkCategoryLoggingLevelComposite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/logging/EclipseLinkCategoryLoggingLevelComposite.java
new file mode 100644
index 0000000000..09b416c592
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/logging/EclipseLinkCategoryLoggingLevelComposite.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.eclipselink.ui.internal.v2_0.persistence.logging;
+
+import java.util.Collection;
+
+import org.eclipse.jpt.eclipselink.core.context.persistence.logging.LoggingLevel;
+import org.eclipse.jpt.eclipselink.core.v2_0.context.persistence.logging.Logging2_0;
+import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
+import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
+import org.eclipse.jpt.ui.internal.widgets.FormPane;
+import org.eclipse.jpt.utility.internal.ReflectionTools;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * EclipseLinkCategoryLoggingLevelComposite
+ */
+public class EclipseLinkCategoryLoggingLevelComposite extends FormPane<Logging2_0>
+{
+ private String property;
+
+ /**
+ * Creates a new <code>EclipseLinkCategoryLoggingLevelComposite</code>.
+ *
+ * @param parentController
+ * The parent container of this one
+ * @param parent
+ * The parent container
+ */
+ public EclipseLinkCategoryLoggingLevelComposite(
+ FormPane<Logging2_0> parentComposite,
+ Composite parent) {
+
+ super(parentComposite, parent);
+ }
+
+ @Override
+ protected void initializeLayout(Composite parent) {
+
+ this.property = Logging2_0.SQL_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+
+ this.property = Logging2_0.TRANSACTION_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+
+ this.property = Logging2_0.EVENT_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+
+ this.property = Logging2_0.CONNECTION_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+
+ this.property = Logging2_0.QUERY_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+
+ this.property = Logging2_0.CACHE_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+
+ this.property = Logging2_0.PROPAGATION_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+
+ this.property = Logging2_0.SEQUENCING_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+
+ this.property = Logging2_0.EJB_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+
+ this.property = Logging2_0.DMS_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+
+ this.property = Logging2_0.EJB_OR_METADATA_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+
+ this.property = Logging2_0.METAMODEL_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+
+ this.property = Logging2_0.WEAVER_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+
+ this.property = Logging2_0.PROPERTIES_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+
+ this.property = Logging2_0.SERVER_CATEGORY_LOGGING_PROPERTY;
+ new CategoryLoggingLevelComboViewer(this, parent);
+ }
+
+
+
+ private class CategoryLoggingLevelComboViewer extends FormPane<Logging2_0>
+ {
+ private static final String DEFAULT_PROPERTY = Logging2_0.CATEGORIES_DEFAULT_LOGGING_PROPERTY;
+ final private String category;
+
+ /**
+ * Creates a new <code>CategoryLoggingLevelComposite</code>.
+ *
+ * @param parentController
+ * The parent container of this one
+ * @param parent
+ * The parent container
+ */
+ public CategoryLoggingLevelComboViewer(
+ FormPane<? extends Logging2_0> parentComposite,
+ Composite parent
+ ) {
+ super(parentComposite, parent);
+
+ this.category = EclipseLinkCategoryLoggingLevelComposite.this.property;
+ }
+
+ private EnumFormComboViewer<Logging2_0, LoggingLevel> addLoggingLevelCombo(Composite container) {
+ return new EnumFormComboViewer<Logging2_0, LoggingLevel>(this, container) {
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(DEFAULT_PROPERTY);
+ propertyNames.add(Logging2_0.SQL_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.add(Logging2_0.TRANSACTION_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.add(Logging2_0.EVENT_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.add(Logging2_0.CONNECTION_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.add(Logging2_0.QUERY_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.add(Logging2_0.CACHE_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.add(Logging2_0.PROPAGATION_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.add(Logging2_0.SEQUENCING_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.add(Logging2_0.EJB_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.add(Logging2_0.DMS_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.add(Logging2_0.EJB_OR_METADATA_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.add(Logging2_0.METAMODEL_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.add(Logging2_0.WEAVER_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.add(Logging2_0.PROPERTIES_CATEGORY_LOGGING_PROPERTY);
+ propertyNames.add(Logging2_0.SERVER_CATEGORY_LOGGING_PROPERTY);
+ }
+
+ @Override
+ protected LoggingLevel[] getChoices() {
+ return LoggingLevel.values();
+ }
+
+ @Override
+ protected boolean sortChoices() {
+ return false;
+ }
+
+ @Override
+ protected LoggingLevel getDefaultValue() {
+ return this.getSubject().getCategoriesDefaultLevel();
+ }
+
+ @Override
+ protected String displayString(LoggingLevel value) {
+ return this.buildDisplayString(EclipseLinkUiMessages.class, EclipseLinkCategoryLoggingLevelComposite.class, value);
+ }
+
+ @Override
+ protected LoggingLevel getValue() {
+ return this.getSubject().getLevel(category);
+ }
+
+ @Override
+ protected void setValue(LoggingLevel value) {
+ this.getSubject().setLevel(category, value);
+ }
+
+ @Override
+ protected void propertyChanged(String propertyName) {
+ if( propertyName != category && propertyName != DEFAULT_PROPERTY) return;
+ super.propertyChanged(propertyName);
+ }
+ };
+ }
+
+ @Override
+ protected void initializeLayout(Composite parent) {
+ this.addLabeledComposite(
+ parent,
+ this.buildLabelString(),
+ this.addLoggingLevelCombo(parent),
+ null // TODO
+ );
+ }
+
+ private String buildLabelString() {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("PersistenceXmlLoggingTab_"); //$NON-NLS-1$
+ sb.append(EclipseLinkCategoryLoggingLevelComposite.this.property);
+ sb.append("Label"); //$NON-NLS-1$
+
+ return (String) ReflectionTools.getStaticFieldValue(EclipseLinkUiMessages.class, sb.toString());
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/logging/EclipseLinkLogging2_0Composite.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/logging/EclipseLinkLogging2_0Composite.java
new file mode 100644
index 0000000000..2afc99db92
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/logging/EclipseLinkLogging2_0Composite.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.eclipselink.ui.internal.v2_0.persistence.logging;
+
+import org.eclipse.jpt.eclipselink.core.v2_0.context.persistence.logging.Logging2_0;
+import org.eclipse.jpt.eclipselink.ui.internal.EclipseLinkUiMessages;
+import org.eclipse.jpt.eclipselink.ui.internal.persistence.logging.EclipseLinkLoggingComposite;
+import org.eclipse.jpt.ui.internal.widgets.FormPane;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * EclipseLinkLogging2_0Composite
+ */
+public class EclipseLinkLogging2_0Composite extends EclipseLinkLoggingComposite<Logging2_0>
+{
+
+ public EclipseLinkLogging2_0Composite(
+ FormPane<Logging2_0> subjectHolder,
+ Composite container) {
+ super(subjectHolder, container);
+ }
+
+ @Override
+ protected void initializeLayout(Composite parent) {
+ super.initializeLayout(parent);
+
+ Composite categoryLoggingSection = this.addCollapsibleSubSection(
+ this.addSubPane(parent, 0, 16),
+ EclipseLinkUiMessages.PersistenceXmlLoggingTab_categoryLoggingLevelSectionTitle,
+ new SimplePropertyValueModel<Boolean>(Boolean.FALSE)
+ );
+
+ this.addCategoryLoggingLevelComposite(categoryLoggingSection);
+ }
+
+ protected void addCategoryLoggingLevelComposite(Composite parent) {
+ new EclipseLinkCategoryLoggingLevelComposite(this, parent);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/logging/PersistenceXmlLogging2_0Tab.java b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/logging/PersistenceXmlLogging2_0Tab.java
new file mode 100644
index 0000000000..3f6ec5871c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/src/org/eclipse/jpt/eclipselink/ui/internal/v2_0/persistence/logging/PersistenceXmlLogging2_0Tab.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.eclipselink.ui.internal.v2_0.persistence.logging;
+
+import org.eclipse.jpt.eclipselink.core.v2_0.context.persistence.logging.Logging2_0;
+import org.eclipse.jpt.eclipselink.ui.internal.persistence.logging.PersistenceXmlLoggingTab;
+import org.eclipse.jpt.ui.WidgetFactory;
+import org.eclipse.jpt.utility.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * PersistenceXmlLogging2_0Tab
+ */
+public class PersistenceXmlLogging2_0Tab extends PersistenceXmlLoggingTab<Logging2_0>
+{
+ // ********** constructors/initialization **********
+ public PersistenceXmlLogging2_0Tab(
+ PropertyValueModel<Logging2_0> subjectHolder,
+ Composite parent,
+ WidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ @Override
+ protected void initializeLayout(Composite container) {
+ new EclipseLinkLogging2_0Composite(this, container);
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTestCase.java
index 4e2e837544..2417931e9f 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTestCase.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
+* Copyright (c) 2009, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
@@ -192,8 +192,8 @@ public abstract class PersistenceUnitTestCase extends ContextModelTestCase
this.verifyHasListeners(this.getModel(), propertyName);
PersistenceUnit.Property property = this.getPersistenceUnit().getProperty(puKey);
- assertTrue("model.itemIsProperty() is false: ", getModel().itemIsProperty(property));
- assertEquals("propertyIdFor() not updated: ", propertyName, getModel().propertyIdOf(property));
+ assertTrue("model.itemIsProperty() is false: ", this.getModel().itemIsProperty(property));
+ assertEquals("propertyIdFor() not updated: ", propertyName, this.getModel().propertyIdOf(property));
}
/**
@@ -204,7 +204,7 @@ public abstract class PersistenceUnitTestCase extends ContextModelTestCase
*/
protected void verifyModelInitialized(String puKey, Object expectedValue) throws Exception {
PersistenceUnit.Property property = this.getPersistenceUnit().getProperty(puKey);
- assertTrue("model.itemIsProperty() is false: ", getModel().itemIsProperty(property));
+ assertTrue("model.itemIsProperty() is false: ", this.getModel().itemIsProperty(property));
assertTrue("PersistenceUnit not populated - populatedPu()", this.propertyValueEquals(puKey, this.getPropertyStringValueOf(expectedValue)));
String propertyName = this.getModel().propertyIdOf(property);
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/persistence/EclipseLink2_0LoggingTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/persistence/EclipseLink2_0LoggingTests.java
new file mode 100644
index 0000000000..ee6345e01e
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/persistence/EclipseLink2_0LoggingTests.java
@@ -0,0 +1,430 @@
+/*******************************************************************************
+* Copyright (c) 2009, 2010 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html.
+*
+* Contributors:
+* Oracle - initial API and implementation
+*******************************************************************************/
+package org.eclipse.jpt.eclipselink2_0.core.tests.internal.context.persistence;
+
+import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties;
+import org.eclipse.jpt.eclipselink.core.context.persistence.logging.LoggingLevel;
+import org.eclipse.jpt.eclipselink.core.v2_0.context.persistence.logging.Logging2_0;
+import org.eclipse.jpt.utility.model.listener.PropertyChangeListener;
+
+/**
+ * EclipseLink2_0LoggingTests
+ */
+public class EclipseLink2_0LoggingTests extends EclipseLink2_0PersistenceUnitTestCase
+{
+ private Logging2_0 logging;
+
+ public static final String SQL_LOGGING_KEY = Logging2_0.ECLIPSELINK_SQL_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel SQL_LOGGING_TEST_VALUE = LoggingLevel.off;
+ public static final LoggingLevel SQL_LOGGING_TEST_VALUE_2 = LoggingLevel.severe;
+
+ public static final String TRANSACTION_LOGGING_KEY = Logging2_0.ECLIPSELINK_TRANSACTION_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel TRANSACTION_LOGGING_TEST_VALUE = LoggingLevel.warning;
+ public static final LoggingLevel TRANSACTION_LOGGING_TEST_VALUE_2 = LoggingLevel.info;
+
+ public static final String EVENT_LOGGING_KEY = Logging2_0.ECLIPSELINK_EVENT_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel EVENT_LOGGING_TEST_VALUE = LoggingLevel.config;
+ public static final LoggingLevel EVENT_LOGGING_TEST_VALUE_2 = LoggingLevel.fine;
+
+ public static final String CONNECTION_LOGGING_KEY = Logging2_0.ECLIPSELINK_CONNECTION_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel CONNECTION_LOGGING_TEST_VALUE = LoggingLevel.finer;
+ public static final LoggingLevel CONNECTION_LOGGING_TEST_VALUE_2 = LoggingLevel.finest;
+
+ public static final String QUERY_LOGGING_KEY = Logging2_0.ECLIPSELINK_QUERY_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel QUERY_LOGGING_TEST_VALUE = LoggingLevel.all;
+ public static final LoggingLevel QUERY_LOGGING_TEST_VALUE_2 = LoggingLevel.off;
+
+ public static final String CACHE_LOGGING_KEY = Logging2_0.ECLIPSELINK_CACHE_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel CACHE_LOGGING_TEST_VALUE = LoggingLevel.severe;
+ public static final LoggingLevel CACHE_LOGGING_TEST_VALUE_2 = LoggingLevel.warning;
+
+ public static final String PROPAGATION_LOGGING_KEY = Logging2_0.ECLIPSELINK_PROPAGATION_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel PROPAGATION_LOGGING_TEST_VALUE = LoggingLevel.info;
+ public static final LoggingLevel PROPAGATION_LOGGING_TEST_VALUE_2 = LoggingLevel.config;
+
+ public static final String SEQUENCING_LOGGING_KEY = Logging2_0.ECLIPSELINK_SEQUENCING_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel SEQUENCING_LOGGING_TEST_VALUE = LoggingLevel.fine;
+ public static final LoggingLevel SEQUENCING_LOGGING_TEST_VALUE_2 = LoggingLevel.finer;
+
+ public static final String EJB_LOGGING_KEY = Logging2_0.ECLIPSELINK_EJB_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel EJB_LOGGING_TEST_VALUE = LoggingLevel.finest;
+ public static final LoggingLevel EJB_LOGGING_TEST_VALUE_2 = LoggingLevel.all;
+
+ public static final String DMS_LOGGING_KEY = Logging2_0.ECLIPSELINK_DMS_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel DMS_LOGGING_TEST_VALUE = LoggingLevel.off;
+ public static final LoggingLevel DMS_LOGGING_TEST_VALUE_2 = LoggingLevel.severe;
+
+ public static final String EJB_OR_METADATA_LOGGING_KEY = Logging2_0.ECLIPSELINK_EJB_OR_METADATA_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel EJB_OR_METADATA_LOGGING_TEST_VALUE = LoggingLevel.warning;
+ public static final LoggingLevel EJB_OR_METADATA_LOGGING_TEST_VALUE_2 = LoggingLevel.info;
+
+ public static final String METAMODEL_LOGGING_KEY = Logging2_0.ECLIPSELINK_METAMODEL_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel METAMODEL_LOGGING_TEST_VALUE = LoggingLevel.config;
+ public static final LoggingLevel METAMODEL_LOGGING_TEST_VALUE_2 = LoggingLevel.fine;
+
+ public static final String WEAVER_LOGGING_KEY = Logging2_0.ECLIPSELINK_WEAVER_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel WEAVER_LOGGING_TEST_VALUE = LoggingLevel.finer;
+ public static final LoggingLevel WEAVER_LOGGING_TEST_VALUE_2 = LoggingLevel.finest;
+
+ public static final String PROPERTIES_LOGGING_KEY = Logging2_0.ECLIPSELINK_PROPERTIES_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel PROPERTIES_LOGGING_TEST_VALUE = LoggingLevel.all;
+ public static final LoggingLevel PROPERTIES_LOGGING_TEST_VALUE_2 = LoggingLevel.off;
+
+ public static final String SERVER_LOGGING_KEY = Logging2_0.ECLIPSELINK_SERVER_CATEGORY_LOGGING_LEVEL;
+ public static final LoggingLevel SERVER_LOGGING_TEST_VALUE = LoggingLevel.severe;
+ public static final LoggingLevel SERVER_LOGGING_TEST_VALUE_2 = LoggingLevel.warning;
+
+ // ********** constructors **********
+ public EclipseLink2_0LoggingTests(String name) {
+ super(name);
+ }
+
+ // ********** behavior **********
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.logging = (Logging2_0) this.subject.getLogging();
+ PropertyChangeListener propertyChangeListener = this.buildPropertyChangeListener();
+
+ this.logging.addPropertyChangeListener(Logging2_0.SQL_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+ this.logging.addPropertyChangeListener(Logging2_0.TRANSACTION_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+ this.logging.addPropertyChangeListener(Logging2_0.EVENT_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+ this.logging.addPropertyChangeListener(Logging2_0.CONNECTION_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+ this.logging.addPropertyChangeListener(Logging2_0.QUERY_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+ this.logging.addPropertyChangeListener(Logging2_0.CACHE_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+ this.logging.addPropertyChangeListener(Logging2_0.PROPAGATION_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+ this.logging.addPropertyChangeListener(Logging2_0.SEQUENCING_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+ this.logging.addPropertyChangeListener(Logging2_0.EJB_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+ this.logging.addPropertyChangeListener(Logging2_0.DMS_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+ this.logging.addPropertyChangeListener(Logging2_0.EJB_OR_METADATA_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+ this.logging.addPropertyChangeListener(Logging2_0.METAMODEL_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+ this.logging.addPropertyChangeListener(Logging2_0.WEAVER_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+ this.logging.addPropertyChangeListener(Logging2_0.PROPERTIES_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+ this.logging.addPropertyChangeListener(Logging2_0.SERVER_CATEGORY_LOGGING_PROPERTY, propertyChangeListener);
+
+ this.clearEvent();
+ }
+
+ /**
+ * Initializes directly the PersistenceUnit properties before testing.
+ */
+ @Override
+ protected void populatePu() {
+ this.modelPropertiesSizeOriginal = 15; // PersistenceUnit properties
+ this.propertiesTotal = this.modelPropertiesSizeOriginal + 1; // 1 misc properties
+ this.modelPropertiesSize = this.modelPropertiesSizeOriginal;
+
+ // Initializes PersistenceUnit properties
+ this.persistenceUnitSetProperty("misc.property.1", "value.1");
+ this.persistenceUnitSetProperty(SQL_LOGGING_KEY, SQL_LOGGING_TEST_VALUE);
+ this.persistenceUnitSetProperty(TRANSACTION_LOGGING_KEY, TRANSACTION_LOGGING_TEST_VALUE);
+ this.persistenceUnitSetProperty(EVENT_LOGGING_KEY, EVENT_LOGGING_TEST_VALUE);
+ this.persistenceUnitSetProperty(CONNECTION_LOGGING_KEY, CONNECTION_LOGGING_TEST_VALUE);
+ this.persistenceUnitSetProperty(QUERY_LOGGING_KEY, QUERY_LOGGING_TEST_VALUE);
+ this.persistenceUnitSetProperty(CACHE_LOGGING_KEY, CACHE_LOGGING_TEST_VALUE);
+ this.persistenceUnitSetProperty(PROPAGATION_LOGGING_KEY, PROPAGATION_LOGGING_TEST_VALUE);
+ this.persistenceUnitSetProperty(SEQUENCING_LOGGING_KEY, SEQUENCING_LOGGING_TEST_VALUE);
+ this.persistenceUnitSetProperty(EJB_LOGGING_KEY, EJB_LOGGING_TEST_VALUE);
+ this.persistenceUnitSetProperty(DMS_LOGGING_KEY, DMS_LOGGING_TEST_VALUE);
+ this.persistenceUnitSetProperty(EJB_OR_METADATA_LOGGING_KEY, EJB_OR_METADATA_LOGGING_TEST_VALUE);
+ this.persistenceUnitSetProperty(METAMODEL_LOGGING_KEY, METAMODEL_LOGGING_TEST_VALUE);
+ this.persistenceUnitSetProperty(WEAVER_LOGGING_KEY, WEAVER_LOGGING_TEST_VALUE);
+ this.persistenceUnitSetProperty(PROPERTIES_LOGGING_KEY, PROPERTIES_LOGGING_TEST_VALUE);
+ this.persistenceUnitSetProperty(SERVER_LOGGING_KEY, SERVER_LOGGING_TEST_VALUE);
+
+ }
+
+ @Override
+ protected PersistenceUnitProperties getModel() {
+ return this.logging;
+ }
+
+ @Override
+ protected Object getProperty(String propertyName) throws NoSuchFieldException {
+
+ return this.logging.getLevel(propertyName);
+ }
+
+ @Override
+ protected void setProperty(String propertyName, Object newValue) throws Exception {
+
+ this.logging.setLevel(propertyName, (LoggingLevel) newValue);
+ }
+
+ // ********** Sql Level tests **********
+ public void testSetSqlLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ SQL_LOGGING_KEY,
+ SQL_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ SQL_LOGGING_KEY,
+ SQL_LOGGING_TEST_VALUE,
+ SQL_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemoveSqlLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ SQL_LOGGING_KEY,
+ SQL_LOGGING_TEST_VALUE,
+ SQL_LOGGING_TEST_VALUE_2);
+ }
+
+ // ********** Transaction Level tests **********
+ public void testSetTransactionLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ TRANSACTION_LOGGING_KEY,
+ TRANSACTION_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ TRANSACTION_LOGGING_KEY,
+ TRANSACTION_LOGGING_TEST_VALUE,
+ TRANSACTION_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemoveTransactionLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ TRANSACTION_LOGGING_KEY,
+ TRANSACTION_LOGGING_TEST_VALUE,
+ TRANSACTION_LOGGING_TEST_VALUE_2);
+ }
+
+ // ********** Event Level tests **********
+ public void testSetEventLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ EVENT_LOGGING_KEY,
+ EVENT_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ EVENT_LOGGING_KEY,
+ EVENT_LOGGING_TEST_VALUE,
+ EVENT_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemoveEventLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ EVENT_LOGGING_KEY,
+ EVENT_LOGGING_TEST_VALUE,
+ EVENT_LOGGING_TEST_VALUE_2);
+ }
+
+ // ********** Connection Level tests **********
+ public void testSetConnectionLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ CONNECTION_LOGGING_KEY,
+ CONNECTION_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ CONNECTION_LOGGING_KEY,
+ CONNECTION_LOGGING_TEST_VALUE,
+ CONNECTION_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemoveConnectionLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ CONNECTION_LOGGING_KEY,
+ CONNECTION_LOGGING_TEST_VALUE,
+ CONNECTION_LOGGING_TEST_VALUE_2);
+ }
+
+ // ********** Query Level tests **********
+ public void testSetQueryLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ QUERY_LOGGING_KEY,
+ QUERY_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ QUERY_LOGGING_KEY,
+ QUERY_LOGGING_TEST_VALUE,
+ QUERY_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemoveQueryLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ QUERY_LOGGING_KEY,
+ QUERY_LOGGING_TEST_VALUE,
+ QUERY_LOGGING_TEST_VALUE_2);
+ }
+
+ // ********** Cache Level tests **********
+ public void testSetCacheLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ CACHE_LOGGING_KEY,
+ CACHE_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ CACHE_LOGGING_KEY,
+ CACHE_LOGGING_TEST_VALUE,
+ CACHE_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemoveCacheLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ CACHE_LOGGING_KEY,
+ CACHE_LOGGING_TEST_VALUE,
+ CACHE_LOGGING_TEST_VALUE_2);
+ }
+
+ // ********** Propagation Level tests **********
+ public void testSetPropagationLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ PROPAGATION_LOGGING_KEY,
+ PROPAGATION_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ PROPAGATION_LOGGING_KEY,
+ PROPAGATION_LOGGING_TEST_VALUE,
+ PROPAGATION_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemovePropagationLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ PROPAGATION_LOGGING_KEY,
+ PROPAGATION_LOGGING_TEST_VALUE,
+ PROPAGATION_LOGGING_TEST_VALUE_2);
+ }
+
+ // ********** Sequencing Level tests **********
+ public void testSetSequencingLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ SEQUENCING_LOGGING_KEY,
+ SEQUENCING_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ SEQUENCING_LOGGING_KEY,
+ SEQUENCING_LOGGING_TEST_VALUE,
+ SEQUENCING_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemoveSequencingLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ SEQUENCING_LOGGING_KEY,
+ SEQUENCING_LOGGING_TEST_VALUE,
+ SEQUENCING_LOGGING_TEST_VALUE_2);
+ }
+
+ // ********** EJB Level tests **********
+ public void testSetEJBLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ EJB_LOGGING_KEY,
+ EJB_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ EJB_LOGGING_KEY,
+ EJB_LOGGING_TEST_VALUE,
+ EJB_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemoveEJBLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ EJB_LOGGING_KEY,
+ EJB_LOGGING_TEST_VALUE,
+ EJB_LOGGING_TEST_VALUE_2);
+ }
+
+ // ********** DMS Level tests **********
+ public void testSetDMSLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ DMS_LOGGING_KEY,
+ DMS_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ DMS_LOGGING_KEY,
+ DMS_LOGGING_TEST_VALUE,
+ DMS_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemoveDMSLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ DMS_LOGGING_KEY,
+ DMS_LOGGING_TEST_VALUE,
+ DMS_LOGGING_TEST_VALUE_2);
+ }
+
+ // ********** EJB or Metadata Level tests **********
+ public void testSetEJBOrMetadataLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ EJB_OR_METADATA_LOGGING_KEY,
+ EJB_OR_METADATA_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ EJB_OR_METADATA_LOGGING_KEY,
+ EJB_OR_METADATA_LOGGING_TEST_VALUE,
+ EJB_OR_METADATA_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemoveEJBOrMetadataLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ EJB_OR_METADATA_LOGGING_KEY,
+ EJB_OR_METADATA_LOGGING_TEST_VALUE,
+ EJB_OR_METADATA_LOGGING_TEST_VALUE_2);
+ }
+
+ // ********** Metamodel Level tests **********
+ public void testSetMetamodelLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ METAMODEL_LOGGING_KEY,
+ METAMODEL_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ METAMODEL_LOGGING_KEY,
+ METAMODEL_LOGGING_TEST_VALUE,
+ METAMODEL_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemoveMetamodelLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ METAMODEL_LOGGING_KEY,
+ METAMODEL_LOGGING_TEST_VALUE,
+ METAMODEL_LOGGING_TEST_VALUE_2);
+ }
+
+ // ********** Weaver Level tests **********
+ public void testSetWeaverLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ WEAVER_LOGGING_KEY,
+ WEAVER_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ WEAVER_LOGGING_KEY,
+ WEAVER_LOGGING_TEST_VALUE,
+ WEAVER_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemoveWeaverLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ WEAVER_LOGGING_KEY,
+ WEAVER_LOGGING_TEST_VALUE,
+ WEAVER_LOGGING_TEST_VALUE_2);
+ }
+
+ // ********** Properties Level tests **********
+ public void testSetPropertiesLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ PROPERTIES_LOGGING_KEY,
+ PROPERTIES_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ PROPERTIES_LOGGING_KEY,
+ PROPERTIES_LOGGING_TEST_VALUE,
+ PROPERTIES_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemovePropertiesLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ PROPERTIES_LOGGING_KEY,
+ PROPERTIES_LOGGING_TEST_VALUE,
+ PROPERTIES_LOGGING_TEST_VALUE_2);
+ }
+
+ // ********** Server Level tests **********
+ public void testSetServerLoggingLevel() throws Exception {
+ this.verifyModelInitialized(
+ SERVER_LOGGING_KEY,
+ SERVER_LOGGING_TEST_VALUE);
+ this.verifySetProperty(
+ SERVER_LOGGING_KEY,
+ SERVER_LOGGING_TEST_VALUE,
+ SERVER_LOGGING_TEST_VALUE_2);
+ }
+
+ public void testAddRemoveServerLoggingLevel() throws Exception {
+ this.verifyAddRemoveProperty(
+ SERVER_LOGGING_KEY,
+ SERVER_LOGGING_TEST_VALUE,
+ SERVER_LOGGING_TEST_VALUE_2);
+ }
+} \ No newline at end of file

Back to the top