Bug 489086: Unify logging
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
Reviewed-by: Petros, Dmitry
diff --git a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/PersistenceContext.java b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/PersistenceContext.java
index bc58d38..d78c868 100644
--- a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/PersistenceContext.java
+++ b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/PersistenceContext.java
@@ -1,8 +1,8 @@
/*******************************************************************************
- * Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
+ * Copyright (c) 2011, 2016 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
@@ -63,6 +63,7 @@
import org.eclipse.persistence.jpa.rs.util.list.SingleResultQueryList;
import org.eclipse.persistence.jpa.rs.util.xmladapters.LinkAdapter;
import org.eclipse.persistence.jpa.rs.util.xmladapters.RelationshipLinkAdapter;
+import org.eclipse.persistence.logging.SessionLog;
import org.eclipse.persistence.mappings.DatabaseMapping;
import org.eclipse.persistence.mappings.ForeignReferenceMapping;
import org.eclipse.persistence.mappings.ObjectReferenceMapping;
@@ -146,6 +147,8 @@
/** The URI of the Persistence context. This is used to build Links in JSON and XML **/
protected URI baseURI = null;
+ private SessionLog sessionLog = null;
+
protected TransactionWrapper transaction = null;
private Boolean weavingEnabled = null;
@@ -194,6 +197,7 @@
this.emf = emf;
this.name = emfName;
this.baseURI = defaultURI;
+ this.sessionLog = emf.getServerSession().getSessionLog();
if (version != null) {
this.version = version;
@@ -210,10 +214,10 @@
try {
this.jaxbContext = createDynamicJAXBContext(emf.getDatabaseSession());
} catch (JAXBException jaxbe) {
- JPARSLogger.exception("exception_creating_jaxb_context", new Object[] { emfName, jaxbe.toString() }, jaxbe);
+ JPARSLogger.exception(getSessionLog(), "exception_creating_jaxb_context", new Object[] { emfName, jaxbe.toString() }, jaxbe);
emf.close();
} catch (IOException e) {
- JPARSLogger.exception("exception_creating_jaxb_context", new Object[] { emfName, e.toString() }, e);
+ JPARSLogger.exception(getSessionLog(), "exception_creating_jaxb_context", new Object[] { emfName, e.toString() }, e);
emf.close();
}
}
@@ -517,10 +521,10 @@
setMappingValueInObject(object, attributeValue, mapping, partnerMapping);
transaction.commitTransaction(em);
} catch (RollbackException e) {
- JPARSLogger.exception("exception_while_updating_attribute", new Object[] { entityName, getName() }, e);
+ JPARSLogger.exception(getSessionLog(), "exception_while_updating_attribute", new Object[] { entityName, getName() }, e);
return null;
} catch (Exception e) {
- JPARSLogger.exception("exception_while_updating_attribute", new Object[] { entityName, getName() }, e);
+ JPARSLogger.exception(getSessionLog(), "exception_while_updating_attribute", new Object[] { entityName, getName() }, e);
transaction.rollbackTransaction(em);
return null;
}
@@ -608,7 +612,7 @@
}
return null;
} catch (Exception e) {
- JPARSLogger.exception("exception_while_removing_attribute", new Object[] { fieldName, entityName, getName() }, e);
+ JPARSLogger.exception(getSessionLog(), "exception_while_removing_attribute", new Object[] { fieldName, entityName, getName() }, e);
transaction.rollbackTransaction(em);
return null;
} finally {
@@ -785,6 +789,10 @@
return name;
}
+ public SessionLog getSessionLog() {
+ return sessionLog;
+ }
+
/**
* A part of the facade over the JPA API
* Call jpa merge on the given object and commit
@@ -849,7 +857,7 @@
return jaxbType.newDynamicEntity();
}
}
- JPARSLogger.exception("exception_thrown_while_creating_dynamic_entity", new Object[] { type }, e);
+ JPARSLogger.exception(getSessionLog(), "exception_thrown_while_creating_dynamic_entity", new Object[] { type }, e);
throw e;
}
return entity;
@@ -1013,16 +1021,16 @@
* @throws JAXBException the JAXB exception
*/
public Object unmarshalEntity(String type, MediaType acceptedMediaType, InputStream in) throws JAXBException {
- if (JPARSLogger.isLoggableFinest()) {
+ if (JPARSLogger.isLoggableFinest(getSessionLog())) {
in = in.markSupported() ? in : new BufferedInputStream(in);
// TODO: Make readlimit configurable. Some http servers allow http post size to be unlimited.
// If this is the case and if an application is sending huge post requests while jpars log
// level configured to finest, this readlimit might not be sufficient.
in.mark(52428800); // (~50MB)
- JPARSLogger.entering(CLASS_NAME, "unmarshalEntity", in);
+ JPARSLogger.entering(getSessionLog(), CLASS_NAME, "unmarshalEntity", in);
}
Object unmarshalled = unmarshal(getClass(type), acceptedMediaType, in);
- JPARSLogger.exiting(CLASS_NAME, "unmarshalEntity", new Object[] { unmarshalled.getClass().getName(), unmarshalled });
+ JPARSLogger.exiting(getSessionLog(), CLASS_NAME, "unmarshalEntity", new Object[] { unmarshalled.getClass().getName(), unmarshalled });
return unmarshalled;
}
@@ -1122,7 +1130,7 @@
for (DatabaseMapping mapping : descriptor.getMappings()) {
if (mapping instanceof XMLInverseReferenceMapping) {
// we require Fetch groups to handle relationships
- JPARSLogger.error("weaving_required_for_relationships", new Object[] {});
+ JPARSLogger.error(getSessionLog(), "weaving_required_for_relationships", new Object[] {});
throw JPARSException.invalidConfiguration();
}
}
@@ -1141,9 +1149,9 @@
* @throws JAXBException
*/
public void marshallEntity(Object object, MediaType mediaType, OutputStream output) throws JAXBException {
- JPARSLogger.entering(CLASS_NAME, "marshallEntity", new Object[] { object, mediaType });
+ JPARSLogger.entering(getSessionLog(), CLASS_NAME, "marshallEntity", new Object[] { object, mediaType });
marshall(object, mediaType, output, true);
- JPARSLogger.exiting(CLASS_NAME, "marshallEntity", this, object, mediaType);
+ JPARSLogger.exiting(getSessionLog(), CLASS_NAME, "marshallEntity", this, object, mediaType);
}
/**
@@ -1156,9 +1164,9 @@
* @throws JAXBException
*/
public void marshallEntity(Object object, FieldsFilter filter, MediaType mediaType, OutputStream output) throws JAXBException {
- JPARSLogger.entering(CLASS_NAME, "marshallEntity", new Object[] { object, filter, mediaType });
+ JPARSLogger.entering(getSessionLog(), CLASS_NAME, "marshallEntity", new Object[] { object, filter, mediaType });
marshall(object, mediaType, output, true, filter);
- JPARSLogger.exiting(CLASS_NAME, "marshallEntity", this, object, mediaType);
+ JPARSLogger.exiting(getSessionLog(), CLASS_NAME, "marshallEntity", this, object, mediaType);
}
/**
diff --git a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/PersistenceFactoryBase.java b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/PersistenceFactoryBase.java
index 0f8ab92..ca31b3a 100644
--- a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/PersistenceFactoryBase.java
+++ b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/PersistenceFactoryBase.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * dclarke/tware - initial implementation
- * gonural - version based persistence context
+/*******************************************************************************
+ * Copyright (c) 2011, 2016 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * dclarke/tware - initial implementation
+ * gonural - version based persistence context
* Dmitry Kornilov - JPARS 2.0 related changes
- ******************************************************************************/
-package org.eclipse.persistence.jpa.rs;
-
-import org.eclipse.persistence.config.PersistenceUnitProperties;
-import org.eclipse.persistence.dynamic.DynamicClassLoader;
-import org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl;
-import org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl;
-import org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor;
-import org.eclipse.persistence.internal.jpa.deployment.SEPersistenceUnitInfo;
-import org.eclipse.persistence.jpa.Archive;
-import org.eclipse.persistence.jpa.rs.exceptions.JPARSException;
+ ******************************************************************************/
+package org.eclipse.persistence.jpa.rs;
+
+import org.eclipse.persistence.config.PersistenceUnitProperties;
+import org.eclipse.persistence.dynamic.DynamicClassLoader;
+import org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl;
+import org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl;
+import org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor;
+import org.eclipse.persistence.internal.jpa.deployment.SEPersistenceUnitInfo;
+import org.eclipse.persistence.jpa.Archive;
+import org.eclipse.persistence.jpa.rs.exceptions.JPARSException;
import org.eclipse.persistence.jpa.rs.features.ServiceVersion;
-import org.eclipse.persistence.jpa.rs.util.JPARSLogger;
-
+import org.eclipse.persistence.jpa.rs.util.JPARSLogger;
+
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import java.net.URI;
@@ -35,16 +35,16 @@
import java.util.Map;
import java.util.Set;
-/**
- * Manages the PersistenceContexts that are used by a JPA-RS deployment. Provides a single point to bootstrap
+/**
+ * Manages the PersistenceContexts that are used by a JPA-RS deployment. Provides a single point to bootstrap
* and look up PersistenceContexts.
- *
+ *
* @author tware
- */
-public class PersistenceFactoryBase implements PersistenceContextFactory {
+ */
+public class PersistenceFactoryBase implements PersistenceContextFactory {
protected final Map<String, Set<PersistenceContext>> dynamicPersistenceContexts = new HashMap<>();
-
- /**
+
+ /**
* Bootstrap a PersistenceContext based on an pre-existing EntityManagerFactory.
*
* @param name persistence context name
@@ -54,8 +54,8 @@
* @param replace Indicates that existing persistence context with given name and version must be replaced
* with the newly created one. If false passed the newly created context is not added to cache at all.
* @return newly created persistence context
- */
- public PersistenceContext bootstrapPersistenceContext(String name, EntityManagerFactory emf, URI baseURI, String version, boolean replace) {
+ */
+ public PersistenceContext bootstrapPersistenceContext(String name, EntityManagerFactory emf, URI baseURI, String version, boolean replace) {
final PersistenceContext persistenceContext = new PersistenceContext(name, (EntityManagerFactoryImpl) emf, baseURI, ServiceVersion.fromCode(version));
if (replace) {
@@ -63,45 +63,45 @@
}
return persistenceContext;
- }
-
- /**
+ }
+
+ /**
* Stop the factory. Remove all the PersistenceContexts.
- */
+ */
@Override
- public void close() {
- synchronized (this) {
- for (String key : dynamicPersistenceContexts.keySet()) {
- Set<PersistenceContext> contextSet = dynamicPersistenceContexts.get(key);
- if (contextSet != null) {
- for (PersistenceContext context : contextSet) {
- context.stop();
- }
- }
- }
- dynamicPersistenceContexts.clear();
- }
- }
-
- /**
+ public void close() {
+ synchronized (this) {
+ for (String key : dynamicPersistenceContexts.keySet()) {
+ Set<PersistenceContext> contextSet = dynamicPersistenceContexts.get(key);
+ if (contextSet != null) {
+ for (PersistenceContext context : contextSet) {
+ context.stop();
+ }
+ }
+ }
+ dynamicPersistenceContexts.clear();
+ }
+ }
+
+ /**
* Close the PersistenceContext of a given name and clean it out of our list of PersistenceContexts.
*
* @param name name of the persistence context to close.
- */
+ */
@Override
- public void closePersistenceContext(String name) {
- synchronized (this) {
- Set<PersistenceContext> contextSet = dynamicPersistenceContexts.get(name);
- if (contextSet != null) {
- for (PersistenceContext context : contextSet) {
- context.stop();
- }
- }
- dynamicPersistenceContexts.remove(name);
- }
- }
-
- /**
+ public void closePersistenceContext(String name) {
+ synchronized (this) {
+ Set<PersistenceContext> contextSet = dynamicPersistenceContexts.get(name);
+ if (contextSet != null) {
+ for (PersistenceContext context : contextSet) {
+ context.stop();
+ }
+ }
+ dynamicPersistenceContexts.remove(name);
+ }
+ }
+
+ /**
* Close the PersistenceContext and clean it out of our list of PersistenceContexts.
*
* @param name name of the persistence context to close.
@@ -130,94 +130,94 @@
}
/**
- * Provide an initial set of properties for bootstrapping PersistenceContexts.
- * @param dcl
- * @param originalProperties
- * @return
- */
- protected static Map<String, Object> createProperties(DynamicClassLoader dcl, Map<String, ?> originalProperties) {
+ * Provide an initial set of properties for bootstrapping PersistenceContexts.
+ * @param dcl
+ * @param originalProperties
+ * @return
+ */
+ protected static Map<String, Object> createProperties(DynamicClassLoader dcl, Map<String, ?> originalProperties) {
Map<String, Object> properties = new HashMap<>();
-
- properties.put(PersistenceUnitProperties.CLASSLOADER, dcl);
- properties.put(PersistenceUnitProperties.WEAVING, "static");
-
- // For now we'll copy the connection info from admin PU
- for (Map.Entry<String, ?> entry : originalProperties.entrySet()) {
- if (entry.getKey().startsWith("javax") || entry.getKey().startsWith("eclipselink.log") || entry.getKey().startsWith("eclipselink.target-server")) {
- properties.put(entry.getKey(), entry.getValue());
- }
- }
- return properties;
- }
-
+
+ properties.put(PersistenceUnitProperties.CLASSLOADER, dcl);
+ properties.put(PersistenceUnitProperties.WEAVING, "static");
+
+ // For now we'll copy the connection info from admin PU
+ for (Map.Entry<String, ?> entry : originalProperties.entrySet()) {
+ if (entry.getKey().startsWith("javax") || entry.getKey().startsWith("eclipselink.log") || entry.getKey().startsWith("eclipselink.target-server")) {
+ properties.put(entry.getKey(), entry.getValue());
+ }
+ }
+ return properties;
+ }
+
/**
* Gets existing persistence context or create new based on given parameters if it doesn't exist.
*/
@Override
- public PersistenceContext get(String persistenceUnitName, URI defaultURI, String version, Map<String, Object> initializationProperties) {
- PersistenceContext persistenceContext = getDynamicPersistenceContext(persistenceUnitName, version);
-
- if (persistenceContext == null) {
- try {
- DynamicClassLoader dcl = new DynamicClassLoader(Thread.currentThread().getContextClassLoader());
+ public PersistenceContext get(String persistenceUnitName, URI defaultURI, String version, Map<String, Object> initializationProperties) {
+ PersistenceContext persistenceContext = getDynamicPersistenceContext(persistenceUnitName, version);
+
+ if (persistenceContext == null) {
+ try {
+ DynamicClassLoader dcl = new DynamicClassLoader(Thread.currentThread().getContextClassLoader());
Map<String, Object> properties = new HashMap<>();
- properties.put(PersistenceUnitProperties.CLASSLOADER, dcl);
- if (initializationProperties != null) {
- properties.putAll(initializationProperties);
- }
-
- EntityManagerFactoryImpl factory = (EntityManagerFactoryImpl) Persistence.createEntityManagerFactory(persistenceUnitName, properties);
- ClassLoader sessionLoader = factory.getServerSession().getLoader();
- if (!DynamicClassLoader.class.isAssignableFrom(sessionLoader.getClass())) {
+ properties.put(PersistenceUnitProperties.CLASSLOADER, dcl);
+ if (initializationProperties != null) {
+ properties.putAll(initializationProperties);
+ }
+
+ EntityManagerFactoryImpl factory = (EntityManagerFactoryImpl) Persistence.createEntityManagerFactory(persistenceUnitName, properties);
+ ClassLoader sessionLoader = factory.getServerSession().getLoader();
+ if (!DynamicClassLoader.class.isAssignableFrom(sessionLoader.getClass())) {
properties = new HashMap<>();
- dcl = new DynamicClassLoader(sessionLoader);
- properties.put(PersistenceUnitProperties.CLASSLOADER, dcl);
- if (initializationProperties != null) {
- properties.putAll(initializationProperties);
- }
- factory.refreshMetadata(properties);
- }
-
+ dcl = new DynamicClassLoader(sessionLoader);
+ properties.put(PersistenceUnitProperties.CLASSLOADER, dcl);
+ if (initializationProperties != null) {
+ properties.putAll(initializationProperties);
+ }
+ factory.refreshMetadata(properties);
+ }
+
persistenceContext = bootstrapPersistenceContext(persistenceUnitName, factory, defaultURI, version, true);
- } catch (Exception e) {
- JPARSLogger.exception("exception_creating_persistence_context", new Object[] { persistenceUnitName, e.toString() }, e);
- }
- }
-
- if ((persistenceContext != null) && (!persistenceContext.isWeavingEnabled())) {
- JPARSLogger.error("weaving_required_for_relationships", new Object[] {});
- throw JPARSException.invalidConfiguration();
- }
-
- return persistenceContext;
- }
-
+ } catch (Exception e) {
+ JPARSLogger.exception("exception_creating_persistence_context", new Object[] { persistenceUnitName, e.toString() }, e);
+ }
+ }
+
+ if ((persistenceContext != null) && (!persistenceContext.isWeavingEnabled())) {
+ JPARSLogger.error(persistenceContext.getServerSession().getSessionLog(), "weaving_required_for_relationships", new Object[] {});
+ throw JPARSException.invalidConfiguration();
+ }
+
+ return persistenceContext;
+ }
+
/**
* Returns names of all currently cached persistence contexts.
*/
@Override
- public Set<String> getPersistenceContextNames() {
+ public Set<String> getPersistenceContextNames() {
Set<String> contextNames = new HashSet<>();
- try {
- Set<Archive> archives = PersistenceUnitProcessor.findPersistenceArchives();
- for (Archive archive : archives) {
- List<SEPersistenceUnitInfo> infos = PersistenceUnitProcessor.processPersistenceArchive(archive, Thread.currentThread().getContextClassLoader());
- for (SEPersistenceUnitInfo info : infos) {
- if (!info.getPersistenceUnitName().equals("jpa-rs")) {
- if (EntityManagerSetupImpl.mustBeCompositeMember(info)) {
- continue;
- }
- contextNames.add(info.getPersistenceUnitName());
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- contextNames.addAll(dynamicPersistenceContexts.keySet());
- return contextNames;
- }
-
+ try {
+ Set<Archive> archives = PersistenceUnitProcessor.findPersistenceArchives();
+ for (Archive archive : archives) {
+ List<SEPersistenceUnitInfo> infos = PersistenceUnitProcessor.processPersistenceArchive(archive, Thread.currentThread().getContextClassLoader());
+ for (SEPersistenceUnitInfo info : infos) {
+ if (!info.getPersistenceUnitName().equals("jpa-rs")) {
+ if (EntityManagerSetupImpl.mustBeCompositeMember(info)) {
+ continue;
+ }
+ contextNames.add(info.getPersistenceUnitName());
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ contextNames.addAll(dynamicPersistenceContexts.keySet());
+ return contextNames;
+ }
+
/**
* Gets cached persistence context by its name and JPARS version.
*
@@ -225,27 +225,27 @@
* @param version JPARS version. See {@link ServiceVersion} for more details.
* @return persistence context or null if doesn't exist.
*/
- public PersistenceContext getDynamicPersistenceContext(String name, String version) {
- synchronized (this) {
- Set<PersistenceContext> persistenceContextSet = dynamicPersistenceContexts.get(name);
- if (persistenceContextSet != null) {
- for (PersistenceContext persistenceContext : persistenceContextSet) {
- if ((name != null) && (version != null)) {
- if ((name.equals(persistenceContext.getName())) && (version.equals(persistenceContext.getVersion()))) {
- return persistenceContext;
- }
- } else if (((version == null) && (persistenceContext.getVersion() == null)) &&
- ((name != null) && (name.equals(persistenceContext.getName())))) {
- return persistenceContext;
- }
- }
- }
- }
- return null;
- }
-
+ public PersistenceContext getDynamicPersistenceContext(String name, String version) {
+ synchronized (this) {
+ Set<PersistenceContext> persistenceContextSet = dynamicPersistenceContexts.get(name);
+ if (persistenceContextSet != null) {
+ for (PersistenceContext persistenceContext : persistenceContextSet) {
+ if ((name != null) && (version != null)) {
+ if ((name.equals(persistenceContext.getName())) && (version.equals(persistenceContext.getVersion()))) {
+ return persistenceContext;
+ }
+ } else if (((version == null) && (persistenceContext.getVersion() == null)) &&
+ ((name != null) && (name.equals(persistenceContext.getName())))) {
+ return persistenceContext;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
protected void addReplacePersistenceContext(PersistenceContext persistenceContext) {
- synchronized (this) {
+ synchronized (this) {
final PersistenceContext existingContext = getDynamicPersistenceContext(persistenceContext.getName(), persistenceContext.getVersion());
Set<PersistenceContext> persistenceContextSet = dynamicPersistenceContexts.get(persistenceContext.getName());
@@ -259,6 +259,6 @@
persistenceContextSet.add(persistenceContext);
dynamicPersistenceContexts.put(persistenceContext.getName(), persistenceContextSet);
- }
- }
-}
+ }
+ }
+}
diff --git a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/MetadataResource.java b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/MetadataResource.java
index 1377ce4..c97a315 100644
--- a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/MetadataResource.java
+++ b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/MetadataResource.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -164,7 +164,7 @@
final PersistenceContext context = getPersistenceContext(persistenceUnit, null, uriInfo.getBaseUri(), version, null);
final ClassDescriptor descriptor = context.getServerSession().getDescriptorForAlias(entityName);
if (descriptor == null) {
- JPARSLogger.error("jpars_could_not_find_entity_type", new Object[] { entityName, persistenceUnit });
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_find_entity_type", new Object[] { entityName, persistenceUnit });
throw JPARSException.classOrClassDescriptorCouldNotBeFoundForEntity(entityName, persistenceUnit);
} else {
final String mediaType = StreamingOutputMarshaller.mediaType(httpHeaders.getAcceptableMediaTypes()).toString();
@@ -187,7 +187,7 @@
// We need to make sure that query with given name exists
final DatabaseQuery query = context.getServerSession().getQuery(queryName);
if (query == null) {
- JPARSLogger.error("jpars_could_not_find_query", new Object[] {queryName, persistenceUnit});
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_find_query", new Object[] {queryName, persistenceUnit});
throw JPARSException.responseCouldNotBeBuiltForNamedQueryRequest(queryName, context.getName());
}
@@ -208,7 +208,7 @@
final PersistenceContext context = getPersistenceContext(persistenceUnit, null, uriInfo.getBaseUri(), version, null);
final ClassDescriptor descriptor = context.getServerSession().getDescriptorForAlias(entityName);
if (descriptor == null) {
- JPARSLogger.error("jpars_could_not_find_entity_type", new Object[] { entityName, persistenceUnit });
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_find_entity_type", new Object[] { entityName, persistenceUnit });
throw JPARSException.classOrClassDescriptorCouldNotBeFoundForEntity(entityName, persistenceUnit);
} else {
final ResourceSchema schema = new ResourceSchema();
@@ -249,7 +249,7 @@
// We need to make sure that query with given name exists
final DatabaseQuery query = context.getServerSession().getQuery(queryName);
if (query == null) {
- JPARSLogger.error("jpars_could_not_find_query", new Object[] {queryName, persistenceUnit});
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_find_query", new Object[] {queryName, persistenceUnit});
throw JPARSException.responseCouldNotBeBuiltForNamedQueryRequest(queryName, context.getName());
}
diff --git a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractEntityResource.java b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractEntityResource.java
index 8ef2069..e0bfb1d 100644
--- a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractEntityResource.java
+++ b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractEntityResource.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,20 @@
******************************************************************************/
package org.eclipse.persistence.jpa.rs.resources.common;
+import static org.eclipse.persistence.jpa.rs.util.StreamingOutputMarshaller.mediaType;
+
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.core.UriInfo;
+
import org.eclipse.persistence.descriptors.ClassDescriptor;
import org.eclipse.persistence.descriptors.RelationalDescriptor;
import org.eclipse.persistence.expressions.Expression;
@@ -41,19 +55,6 @@
import org.eclipse.persistence.queries.ReadQuery;
import org.eclipse.persistence.sessions.DatabaseSession;
-import javax.persistence.EntityManager;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.ResponseBuilder;
-import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriInfo;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import static org.eclipse.persistence.jpa.rs.util.StreamingOutputMarshaller.mediaType;
-
/**
* Base class for entity resource.
*
@@ -86,7 +87,7 @@
if (!attributeMapping.isCollectionMapping()) {
Object result = attributeMapping.getRealAttributeValueFromAttribute(attributeMapping.getAttributeValueFromObject(entity), entity, (AbstractSession) serverSession);
if (result == null) {
- JPARSLogger.error("jpars_could_not_find_entity_for_attribute", new Object[] { attribute, type, id, persistenceUnit });
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_find_entity_for_attribute", new Object[] { attribute, type, id, persistenceUnit });
throw JPARSException.attributeCouldNotBeFoundForEntity(attribute, type, id, persistenceUnit);
}
final FeatureResponseBuilder responseBuilder = context.getSupportedFeatureSet().getResponseBuilder(Feature.NO_PAGING);
@@ -125,7 +126,7 @@
queryParams.put(QueryParameters.JPARS_PAGING_OFFSET, String.valueOf(validator.getOffset()));
// check orderBy, and generate a warning if there is none
- checkOrderBy(query);
+ checkOrderBy(context, query);
final Object result = clientSession.executeQuery(query, descriptor.getObjectBuilder().buildRow(entity, clientSession, WriteType.INSERT));
final FeatureResponseBuilder responseBuilder = context.getSupportedFeatureSet().getResponseBuilder(Feature.PAGING);
@@ -156,7 +157,7 @@
final Object entityId = IdHelper.buildId(context, type, id);
final Object entity = context.find(discriminators, type, entityId, getQueryParameters(uriInfo));
if (entity == null) {
- JPARSLogger.error("jpars_could_not_find_entity_for_key", new Object[] { type, id, persistenceUnit });
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_find_entity_for_key", new Object[] { type, id, persistenceUnit });
throw JPARSException.entityNotFound(type, id, persistenceUnit);
}
@@ -185,7 +186,7 @@
final PersistenceContext context = getPersistenceContext(persistenceUnit, type, uriInfo.getBaseUri(), version, null);
final ClassDescriptor descriptor = context.getDescriptor(type);
if (descriptor == null) {
- JPARSLogger.error("jpars_could_not_find_class_in_persistence_unit", new Object[] { type, persistenceUnit });
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_find_class_in_persistence_unit", new Object[] { type, persistenceUnit });
throw JPARSException.classOrClassDescriptorCouldNotBeFoundForEntity(type, persistenceUnit);
}
@@ -193,13 +194,13 @@
// Check idempotence of the entity
if (!checkIdempotence(descriptor, entity)) {
- JPARSLogger.error("jpars_put_not_idempotent", new Object[]{type, persistenceUnit});
+ JPARSLogger.error(context.getSessionLog(), "jpars_put_not_idempotent", new Object[]{type, persistenceUnit});
throw JPARSException.entityIsNotIdempotent(type, persistenceUnit);
}
// Check idempotence of the entity's relationships
if (!checkIdempotenceOnRelationships(descriptor, entity)) {
- JPARSLogger.error("jpars_put_not_idempotent", new Object[]{type, persistenceUnit});
+ JPARSLogger.error(context.getSessionLog(), "jpars_put_not_idempotent", new Object[]{type, persistenceUnit});
throw JPARSException.entityIsNotIdempotent(type, persistenceUnit);
}
@@ -345,13 +346,13 @@
ClassDescriptor descriptor = context.getDescriptor(type);
DatabaseMapping mapping = descriptor.getMappingForAttributeName(attribute);
if (!mapping.isForeignReferenceMapping()) {
- JPARSLogger.error("jpars_could_not_find_appropriate_mapping_for_update", new Object[] { attribute, type, id, persistenceUnit });
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_find_appropriate_mapping_for_update", new Object[] { attribute, type, id, persistenceUnit });
throw JPARSException.databaseMappingCouldNotBeFoundForEntityAttribute(attribute, type, id, persistenceUnit);
}
Object entity = context.unmarshalEntity(mapping.getReferenceDescriptor().getAlias(), mediaType(headers.getAcceptableMediaTypes()), in);
Object result = context.updateOrAddAttribute(getMatrixParameters(uriInfo, persistenceUnit), type, entityId, getQueryParameters(uriInfo), attribute, entity, partner);
if (result == null) {
- JPARSLogger.error("jpars_could_not_update_attribute", new Object[] { attribute, type, id, persistenceUnit });
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_update_attribute", new Object[] { attribute, type, id, persistenceUnit });
throw JPARSException.attributeCouldNotBeUpdated(attribute, type, id, persistenceUnit);
}
return Response.ok(new StreamingOutputMarshaller(context, singleEntityResponse(context, result, uriInfo), headers.getAcceptableMediaTypes())).build();
@@ -381,7 +382,7 @@
ClassDescriptor descriptor = context.getDescriptor(type);
DatabaseMapping mapping = descriptor.getMappingForAttributeName(attribute);
if (!mapping.isForeignReferenceMapping()) {
- JPARSLogger.error("jpars_could_not_find_appropriate_mapping_for_update", new Object[] { attribute, type, id, persistenceUnit });
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_find_appropriate_mapping_for_update", new Object[] { attribute, type, id, persistenceUnit });
throw JPARSException.databaseMappingCouldNotBeFoundForEntityAttribute(attribute, type, id, persistenceUnit);
}
@@ -390,7 +391,7 @@
Object result = context.removeAttribute(getMatrixParameters(uriInfo, persistenceUnit), type, entityId, attribute, listItemId, entity, partner);
if (result == null) {
- JPARSLogger.error("jpars_could_not_update_attribute", new Object[] { attribute, type, id, persistenceUnit });
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_update_attribute", new Object[] { attribute, type, id, persistenceUnit });
throw JPARSException.attributeCouldNotBeUpdated(attribute, type, id, persistenceUnit);
} else {
return Response.ok(new StreamingOutputMarshaller(context, singleEntityResponse(context, result, uriInfo), headers.getAcceptableMediaTypes())).build();
@@ -420,7 +421,7 @@
// We need to make sure that entity with given name exists
final ClassDescriptor descriptor = context.getServerSession().getDescriptorForAlias(entityName);
if (descriptor == null) {
- JPARSLogger.error("jpars_could_not_find_entity_type", new Object[]{entityName, persistenceUnit});
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_find_entity_type", new Object[]{entityName, persistenceUnit});
throw JPARSException.classOrClassDescriptorCouldNotBeFoundForEntity(entityName, persistenceUnit);
}
@@ -454,12 +455,12 @@
return Response.ok(new StreamingOutputMarshaller(context, null, headers.getAcceptableMediaTypes(), filter)).build();
}
- private void checkOrderBy(ReadQuery query) {
+ private void checkOrderBy(PersistenceContext context, ReadQuery query) {
if (query.isReadAllQuery()) {
ReadAllQuery readAllQuery = (ReadAllQuery) query;
List<Expression> orderBy = readAllQuery.getOrderByExpressions();
if ((orderBy == null) || (orderBy.isEmpty())) {
- JPARSLogger.warning("no_orderby_clause_for_paging", new Object[] { query.toString() });
+ JPARSLogger.warning(context.getSessionLog(), "no_orderby_clause_for_paging", new Object[] { query.toString() });
}
}
}
diff --git a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractPersistenceUnitResource.java b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractPersistenceUnitResource.java
index 23dbaed..cf7d1de 100644
--- a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractPersistenceUnitResource.java
+++ b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractPersistenceUnitResource.java
@@ -1,8 +1,8 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
+ * Copyright (c) 2011, 2016 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
@@ -66,7 +66,7 @@
PersistenceContext context = getPersistenceContext(persistenceUnit, null, baseURI, version, null);
ClassDescriptor descriptor = context.getServerSession().getDescriptorForAlias(descriptorAlias);
if (descriptor == null) {
- JPARSLogger.error("jpars_could_not_find_entity_type", new Object[] { descriptorAlias, persistenceUnit });
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_find_entity_type", new Object[] { descriptorAlias, persistenceUnit });
throw JPARSException.classOrClassDescriptorCouldNotBeFoundForEntity(descriptorAlias, persistenceUnit);
} else {
String mediaType = StreamingOutputMarshaller.mediaType(headers.getAcceptableMediaTypes()).toString();
diff --git a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractQueryResource.java b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractQueryResource.java
index 77f1434..b22ce68 100644
--- a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractQueryResource.java
+++ b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractQueryResource.java
@@ -1,8 +1,8 @@
/*******************************************************************************
- * Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
+ * Copyright (c) 2011, 2016 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
@@ -112,7 +112,7 @@
// We need to make sure that query with given name exists
final DatabaseQuery query = context.getServerSession().getQuery(queryName);
if (query == null) {
- JPARSLogger.error("jpars_could_not_find_query", new Object[] {queryName, persistenceUnit});
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_find_query", new Object[] {queryName, persistenceUnit});
throw JPARSException.responseCouldNotBeBuiltForNamedQueryRequest(queryName, context.getName());
}
@@ -182,4 +182,4 @@
}
return Response.ok(new StreamingOutputMarshaller(context, results, headers.getAcceptableMediaTypes(), fieldsFilter)).build();
}
-}
\ No newline at end of file
+}
diff --git a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractResource.java b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractResource.java
index 317e81d..6167167 100644
--- a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractResource.java
+++ b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/resources/common/AbstractResource.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -12,6 +12,24 @@
******************************************************************************/
package org.eclipse.persistence.jpa.rs.resources.common;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.ServiceLoader;
+import java.util.UUID;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.PathSegment;
+import javax.ws.rs.core.UriInfo;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
import org.eclipse.persistence.internal.jpa.rs.metadata.model.Attribute;
import org.eclipse.persistence.internal.jpa.rs.metadata.model.Descriptor;
import org.eclipse.persistence.internal.jpa.rs.metadata.model.ItemLinks;
@@ -41,23 +59,6 @@
import org.eclipse.persistence.jpa.rs.util.list.LinkList;
import org.eclipse.persistence.jpa.rs.util.list.QueryList;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.PathSegment;
-import javax.ws.rs.core.UriInfo;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.ServiceLoader;
-import java.util.UUID;
-
/**
* Base class for all resources.
*
@@ -191,7 +192,7 @@
}
if ((entityType != null) && (context.getClass(entityType) == null)) {
- JPARSLogger.error("jpars_could_not_find_class_in_persistence_unit", new Object[] { entityType, persistenceUnit });
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_find_class_in_persistence_unit", new Object[] { entityType, persistenceUnit });
throw JPARSException.classOrClassDescriptorCouldNotBeFoundForEntity(entityType, persistenceUnit);
}
diff --git a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/util/JPARSLogger.java b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/util/JPARSLogger.java
index f0b6760..853bc23 100644
--- a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/util/JPARSLogger.java
+++ b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/util/JPARSLogger.java
@@ -1,241 +1,399 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2014 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * tware - initial
- ******************************************************************************/
-package org.eclipse.persistence.jpa.rs.util;
-
+/*******************************************************************************
+ * Copyright (c) 2011, 2016 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * tware - initial
+ ******************************************************************************/
+package org.eclipse.persistence.jpa.rs.util;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.util.Objects;
+import java.util.logging.Level;
+
+import javax.ws.rs.core.MediaType;
+
+import org.eclipse.persistence.internal.sessions.AbstractSession;
import org.eclipse.persistence.internal.weaving.PersistenceWeavedRest;
import org.eclipse.persistence.jpa.rs.DataStorage;
import org.eclipse.persistence.jpa.rs.PersistenceContext;
import org.eclipse.persistence.jpa.rs.logging.LoggingLocalization;
+import org.eclipse.persistence.logging.AbstractSessionLog;
+import org.eclipse.persistence.logging.SessionLog;
+import org.eclipse.persistence.logging.SessionLogEntry;
+import org.eclipse.persistence.sessions.Session;
-import javax.ws.rs.core.MediaType;
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public class JPARSLogger {
-
- static final Logger logger = Logger.getLogger("org.eclipse.persistence.jpars");
-
- /**
- * Entering
- *
- * @param sourceClass the source class
- * @param sourceMethod the source method
- * @param params the params
- * {@link java.util.logging.Logger#entering(String sourceClass, String sourceMethod)}
- */
- public static void entering(String sourceClass, String sourceMethod, Object[] params) {
- // Logger logs entering logs when log level <= FINER. But, we want to get these logs created only when the log level is FINEST.
- if (logger.isLoggable(Level.FINEST)) {
- try {
- logger.entering(sourceClass, sourceMethod, getParamsWithAdditionalInfo(params));
- } catch (Throwable throwable) {
- }
- }
- }
-
- /**
- * Entering
- *
- * @param sourceClass the source class
- * @param sourceMethod the source method
- * @param in the input stream
- * {@link java.util.logging.Logger#entering(String sourceClass, String sourceMethod)}
- */
- public static void entering(String sourceClass, String sourceMethod, InputStream in) {
- // Logger logs entering logs when log level <= FINER. But, we want to get these logs created only when the log level is FINEST.
-
- // make sure input stream supports mark so that the or create a new BufferedInputStream which supports mark.
- // when mark is supported, the stream remembers all the bytes read after the call to mark and
- // stands ready to supply those same bytes again if and whenever the method reset is called.
- if (logger.isLoggable(Level.FINEST) && (in.markSupported())) {
- try {
- String data = readData(in);
- in.reset();
- if (data != null) {
- logger.entering(sourceClass, sourceMethod, getParamsWithAdditionalInfo(new Object[] { data }));
- }
- } catch (Throwable throwable) {
- }
- }
- }
-
- /**
- * Exiting
- *
- * @param sourceClass the source class
- * @param sourceMethod the source method
- * @param params the params
- * {@link java.util.logging.Logger#exiting(String sourceClass, String sourceMethod)}
- */
- public static void exiting(String sourceClass, String sourceMethod, Object[] params) {
- // Logger logs exiting logs when log level <= FINER. But, we want to get these logs created only when the log level is FINEST.
- if (logger.isLoggable(Level.FINEST)) {
- try {
- logger.exiting(sourceClass, sourceMethod, new MethodExitLogData(getParamsWithAdditionalInfo(params)));
- } catch (Throwable throwable) {
- }
- }
- }
-
- /**
- * Exiting
- *
- * @param sourceClass the source class
- * @param sourceMethod the source method
- * @param context the context
- * @param object the object
- * @param mediaType the media type
- */
- public static void exiting(String sourceClass, String sourceMethod, PersistenceContext context, Object object, MediaType mediaType) {
- // Log marshaled object only when the log level is FINEST
- if (logger.isLoggable(Level.FINEST) && (context != null) && (object != null) && (mediaType != null)) {
- try {
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- context.marshall(object, mediaType, outputStream, true);
- if (object instanceof PersistenceWeavedRest) {
- exiting(sourceClass, sourceMethod, new Object[] { object.getClass().getName(), outputStream.toString("UTF-8") });
- } else {
- exiting(sourceClass, sourceMethod, new Object[] { outputStream.toString("UTF-8") });
- }
- } catch (Throwable throwable) {
- }
- }
- }
-
- /**
- * Finest
- *
- * @param message the message
- * @param params the params
- */
- public static void finest(String message, Object[] params) {
- log(message, Level.FINEST, getParamsWithAdditionalInfo(params));
- }
-
- /**
- * Fine
- *
- * @param message the message
- * @param params the params
- */
- public static void fine(String message, Object[] params) {
- log(message, Level.FINE, getParamsWithAdditionalInfo(params));
- }
-
- /**
- * Warning
- *
- * @param message the message
- * @param params the params
- */
- public static void warning(String message, Object[] params) {
- log(message, Level.WARNING, getParamsWithAdditionalInfo(params));
- }
-
- /**
- * Error
- *
- * @param message the message
- * @param params the params
- */
- public static void error(String message, Object[] params) {
- log(message, Level.SEVERE, getParamsWithAdditionalInfo(params));
- }
-
- /**
- * Exception
- *
- * @param message the message
- * @param params the params
- * @param exc the exc
- */
- public static void exception(String message, Object[] params, Exception exc) {
- logger.log(Level.SEVERE, LoggingLocalization.buildMessage(message, getParamsWithAdditionalInfo(params)), exc);
- }
-
- /**
- * Sets the log level
- *
- * @param level the new log level
- */
- public static void setLogLevel(Level level) {
- logger.setLevel(level);
- }
-
- public static boolean isLoggableFinest() {
- return logger.isLoggable(Level.FINEST);
- }
-
- private static Object[] getParamsWithAdditionalInfo(Object[] params) {
- String requestId = (String) DataStorage.get(DataStorage.REQUEST_ID);
- if (params != null) {
- Object[] paramsWithRequestId = new Object[params.length + 1];
- paramsWithRequestId[0] = requestId;
+/**
+ * Logger for EclipseLink JPA-RS related functionality.
+ * Publishes messages under the {@link SessionLog#JPARS} category.
+ */
+public class JPARSLogger {
+
+ private static final SessionLog defaultLog = AbstractSessionLog.getLog();
+
+ /**
+ * Entering
+ *
+ * @param sourceClass the source class
+ * @param sourceMethod the source method
+ * @param params parameters
+ */
+ public static void entering(String sourceClass, String sourceMethod, Object[] params) {
+ entering(defaultLog, sourceClass, sourceMethod, params);
+ }
+
+ /**
+ * Entering
+ *
+ * @param sessionLog the log
+ * @param sourceClass the source class
+ * @param sourceMethod the source method
+ * @param params parameters
+ */
+ public static void entering(SessionLog sessionLog, String sourceClass, String sourceMethod, Object[] params) {
+ // Logger logs entering logs when log level <= FINER. But, we want to get these logs created only when the log level is FINEST.
+ if (isLoggableFinest(sessionLog)) {
+ SessionLogEntry sle = newLogEntry(sessionLog.getSession());
+ sle.setSourceClassName(sourceClass);
+ sle.setSourceMethodName(sourceMethod);
+ sle.setMessage("ENTRY {0}");
+ sle.setParameters(getParamsWithAdditionalInfo(params));
+ sessionLog.log(sle);
+ }
+ }
+
+ /**
+ * Entering
+ *
+ * @param sourceClass the source class
+ * @param sourceMethod the source method
+ * @param in the input stream
+ */
+ public static void entering(String sourceClass, String sourceMethod, InputStream in) {
+ entering(defaultLog, sourceClass, sourceMethod, in);
+ }
+
+ /**
+ * Entering
+ *
+ * @param sessionLog log receiving the message
+ * @param sourceClass the source class
+ * @param sourceMethod the source method
+ * @param in the input stream
+ */
+ public static void entering(SessionLog sessionLog, String sourceClass, String sourceMethod, InputStream in) {
+ // Logger logs entering logs when log level <= FINER. But, we want to get these logs created only when the log level is FINEST.
+
+ // make sure input stream supports mark so that the or create a new BufferedInputStream which supports mark.
+ // when mark is supported, the stream remembers all the bytes read after the call to mark and
+ // stands ready to supply those same bytes again if and whenever the method reset is called.
+ if (isLoggableFinest(sessionLog) && (in.markSupported())) {
+ try {
+ String data = readData(in);
+ in.reset();
+ if (data != null) {
+ SessionLogEntry sle = newLogEntry(sessionLog.getSession());
+ sle.setSourceClassName(sourceClass);
+ sle.setSourceMethodName(sourceMethod);
+ sle.setMessage("ENTRY {0}");
+ sle.setParameters(getParamsWithAdditionalInfo(new Object[] { data }));
+ sessionLog.log(sle);
+ }
+ } catch (Throwable throwable) {
+ exception(throwable.getMessage(), new Object[] {}, throwable);
+ }
+ }
+ }
+
+ /**
+ * Exiting
+ *
+ * @param sourceClass the source class
+ * @param sourceMethod the source method
+ * @param params parameters
+ */
+ public static void exiting(String sourceClass, String sourceMethod, Object[] params) {
+ exiting(defaultLog, sourceClass, sourceMethod, params);
+ }
+
+ /**
+ * Exiting
+ *
+ * @param sessionLog the log
+ * @param sourceClass the source class
+ * @param sourceMethod the source method
+ * @param params parameters
+ */
+ public static void exiting(SessionLog sessionLog, String sourceClass, String sourceMethod, Object[] params) {
+ // Logger logs exiting logs when log level <= FINER. But, we want to get these logs created only when the log level is FINEST.
+ if (isLoggableFinest()) {
+ try {
+ SessionLogEntry sle = newLogEntry(sessionLog.getSession());
+ sle.setSourceClassName(sourceClass);
+ sle.setSourceMethodName(sourceMethod);
+ sle.setMessage("RETURN {0}");
+ sle.setParameters(new Object[] {new MethodExitLogData(getParamsWithAdditionalInfo(params))});
+ sessionLog.log(sle);
+ } catch (Throwable throwable) {
+ exception(throwable.getMessage(), new Object[] {}, throwable);
+ }
+ }
+ }
+
+ /**
+ * Exiting
+ *
+ * @param sourceClass the source class
+ * @param sourceMethod the source method
+ * @param context the context
+ * @param object the object
+ * @param mediaType the media type
+ */
+ public static void exiting(String sourceClass, String sourceMethod, PersistenceContext context, Object object, MediaType mediaType) {
+ exiting(defaultLog, sourceClass, sourceMethod, context, object, mediaType);
+ }
+
+ /**
+ * Exiting
+ *
+ * @param sessionLog the log
+ * @param sourceClass the source class
+ * @param sourceMethod the source method
+ * @param context the context
+ * @param object the object
+ * @param mediaType the media type
+ */
+ public static void exiting(SessionLog sessionLog, String sourceClass, String sourceMethod, PersistenceContext context, Object object, MediaType mediaType) {
+ // Log marshaled object only when the log level is FINEST
+ if (isLoggableFinest(sessionLog) && (context != null) && (object != null) && (mediaType != null)) {
+ try {
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ context.marshall(object, mediaType, outputStream, true);
+ if (object instanceof PersistenceWeavedRest) {
+ exiting(sessionLog, sourceClass, sourceMethod, new Object[] { object.getClass().getName(), outputStream.toString(StandardCharsets.UTF_8.name())});
+ } else {
+ exiting(sessionLog, sourceClass, sourceMethod, new Object[] { outputStream.toString(StandardCharsets.UTF_8.name()) });
+ }
+ } catch (Throwable throwable) {
+ exception(throwable.getMessage(), new Object[] {}, throwable);
+ }
+ }
+ }
+
+ /**
+ * Finest
+ *
+ * @param message the message
+ * @param params parameters
+ */
+ public static void finest(String message, Object[] params) {
+ finest(defaultLog, message, params);
+ }
+
+ /**
+ * Finest
+ *
+ * @param sessionLog the log
+ * @param message the message
+ * @param params parameters
+ */
+ public static void finest(SessionLog sessionLog, String message, Object[] params) {
+ log(sessionLog, SessionLog.FINEST, message, getParamsWithAdditionalInfo(params));
+ }
+
+ /**
+ * Fine
+ *
+ * @param message the message
+ * @param params parameters
+ */
+ public static void fine(String message, Object[] params) {
+ fine(defaultLog, message, params);
+ }
+
+ /**
+ * Fine
+ *
+ * @param sessionLog the log
+ * @param message the message
+ * @param params parameters
+ */
+ public static void fine(SessionLog sessionLog, String message, Object[] params) {
+ log(sessionLog, SessionLog.FINE, message, getParamsWithAdditionalInfo(params));
+ }
+
+ /**
+ * Warning
+ *
+ * @param message the message
+ * @param params parameters
+ */
+ public static void warning(String message, Object[] params) {
+ warning(defaultLog, message, params);
+ }
+
+ /**
+ * Warning
+ *
+ * @param sessionLog the log
+ * @param message the message
+ * @param params parameters
+ */
+ public static void warning(SessionLog sessionLog, String message, Object[] params) {
+ log(sessionLog, SessionLog.WARNING, message, getParamsWithAdditionalInfo(params));
+ }
+
+ /**
+ * Error
+ *
+ * @param message the message
+ * @param params parameters
+ */
+ public static void error(String message, Object[] params) {
+ error(defaultLog, message, params);
+ }
+
+ /**
+ * Error
+ *
+ * @param sessionLog the log
+ * @param message the message
+ * @param params parameters
+ */
+ public static void error(SessionLog sessionLog, String message, Object[] params) {
+ log(sessionLog, SessionLog.SEVERE, message, getParamsWithAdditionalInfo(params));
+ }
+
+ /**
+ * Exception
+ *
+ * @param message the message
+ * @param params parameters
+ * @param exc the throwable
+ */
+ public static void exception(String message, Object[] params, Throwable exc) {
+ exception(defaultLog, message, params, exc);
+ }
+
+ /**
+ * Exception
+ *
+ * @param sessionLog the log
+ * @param message the message
+ * @param params parameters
+ * @param exc the throwable
+ */
+ public static void exception(SessionLog sessionLog, String message, Object[] params, Throwable exc) {
+ log(sessionLog, SessionLog.SEVERE, message, getParamsWithAdditionalInfo(params), exc);
+ }
+
+ /**
+ * Sets the log level
+ *
+ * @param level the new log level
+ */
+ public static void setLogLevel(Level level) {
+ setLogLevel(defaultLog, AbstractSessionLog.translateStringToLoggingLevel(level.getName()));
+ }
+
+ /**
+ * Sets the log level
+ *
+ * @param sessionLog the log
+ * @param level the new log level
+ */
+ public static void setLogLevel(SessionLog sessionLog, int level) {
+ sessionLog.setLevel(level, SessionLog.JPARS);
+ }
+
+ /**
+ * @return true if log level is set to {@link SessionLog#FINEST}
+ */
+ public static boolean isLoggableFinest() {
+ return isLoggableFinest(defaultLog);
+ }
+
+ /**
+ * @param sessionLog the log
+ *
+ * @return true if log level is set to {@link SessionLog#FINEST}
+ */
+ public static boolean isLoggableFinest(SessionLog sessionLog) {
+ return sessionLog.shouldLog(SessionLog.FINEST, SessionLog.JPARS);
+ }
+
+ private static Object[] getParamsWithAdditionalInfo(Object[] params) {
+ String requestId = (String) DataStorage.get(DataStorage.REQUEST_ID);
+ if (params != null) {
+ Object[] paramsWithRequestId = new Object[params.length + 1];
+ paramsWithRequestId[0] = requestId;
System.arraycopy(params, 0, paramsWithRequestId, 1, params.length);
- return paramsWithRequestId;
- }
- return new Object[] { requestId };
- }
-
- private static void log(String message, Level level, Object[] params) {
- logger.log(level, LoggingLocalization.buildMessage(message, params));
- }
-
- private static String readData(InputStream is) {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ByteArrayInputStream bais = null;
- int nRead;
- byte[] data = new byte[16384];
- try {
- while ((nRead = is.read(data, 0, data.length)) != -1) {
- buffer.write(data, 0, nRead);
- }
- buffer.flush();
- byte[] bytes = buffer.toByteArray();
- bais = new ByteArrayInputStream(bytes);
- } catch (IOException e) {
- }
- return getDataFromInputStream(bais);
- }
-
- private static String getDataFromInputStream(InputStream is) {
- BufferedReader br = null;
- StringBuilder sb = new StringBuilder();
- try {
- String line;
- br = new BufferedReader(new InputStreamReader(is));
- while ((line = br.readLine()) != null) {
- sb.append(line);
- }
- } catch (IOException e) {
- } finally {
- try {
- if (br != null) {
- br.close();
- }
- if (is != null) {
- is.close();
- }
- } catch (Exception ex) {
-
- }
- }
- return sb.toString();
- }
-}
+ return paramsWithRequestId;
+ }
+ return new Object[] { requestId };
+ }
+
+ private static void log(SessionLog sessionLog, int level, String message, Object[] params) {
+ log(sessionLog, level, message, params, null);
+ }
+
+ private static void log(SessionLog sessionLog, int level, String message, Object[] params, Throwable t) {
+ Objects.requireNonNull(sessionLog);
+ if (sessionLog.shouldLog(level, SessionLog.JPARS)) {
+ SessionLogEntry sle = newLogEntry(sessionLog.getSession());
+ sle.setLevel(level);
+ sle.setMessage(LoggingLocalization.buildMessage(message, params));
+ sle.setParameters(params);
+ sle.setException(t);
+ sessionLog.log(sle);
+ }
+ }
+
+ private static SessionLogEntry newLogEntry(Session session) {
+ SessionLogEntry entry = session instanceof AbstractSession
+ ? new SessionLogEntry((AbstractSession) session)
+ : new SessionLogEntry(null);
+ entry.setLevel(SessionLog.FINEST);
+ entry.setNameSpace(SessionLog.JPARS);
+ entry.setShouldTranslate(false);
+ return entry;
+ }
+
+ private static String readData(InputStream is) throws IOException {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ByteArrayInputStream bais = null;
+ int nRead;
+ byte[] data = new byte[16384];
+ while ((nRead = is.read(data, 0, data.length)) != -1) {
+ buffer.write(data, 0, nRead);
+ }
+ buffer.flush();
+ byte[] bytes = buffer.toByteArray();
+ bais = new ByteArrayInputStream(bytes);
+ return getDataFromInputStream(bais);
+ }
+
+ private static String getDataFromInputStream(InputStream is) {
+ StringBuilder sb = new StringBuilder();
+ try (BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
+ String line;
+ while ((line = br.readLine()) != null) {
+ sb.append(line);
+ }
+ } catch (IOException e) {
+ // ignore
+ }
+ return sb.toString();
+ }
+}
diff --git a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/util/StreamingOutputMarshaller.java b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/util/StreamingOutputMarshaller.java
index c30f3db..f045f26 100644
--- a/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/util/StreamingOutputMarshaller.java
+++ b/dbws/org.eclipse.persistence.dbws/src/org/eclipse/persistence/jpa/rs/util/StreamingOutputMarshaller.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -14,6 +14,23 @@
******************************************************************************/
package org.eclipse.persistence.jpa.rs.util;
+import java.beans.PropertyChangeListener;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.StreamingOutput;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+
import org.eclipse.persistence.dynamic.DynamicEntity;
import org.eclipse.persistence.internal.dynamic.DynamicEntityImpl;
import org.eclipse.persistence.jaxb.MarshallerProperties;
@@ -24,21 +41,6 @@
import org.eclipse.persistence.jpa.rs.util.list.ReportQueryResultList;
import org.eclipse.persistence.jpa.rs.util.xmladapters.LinkAdapter;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.StreamingOutput;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import java.beans.PropertyChangeListener;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.util.List;
-
/**
* Simple {@link StreamingOutput} implementation that uses the provided
* {@link JAXBContext} to marshal the result when requested to either XML or
@@ -114,7 +116,7 @@
}
return;
} catch (Exception ex) {
- JPARSLogger.exception("jpars_caught_exception", new Object[] {}, ex);
+ JPARSLogger.exception(context.getSessionLog(), "jpars_caught_exception", new Object[] {}, ex);
throw JPARSException.exceptionOccurred(ex);
}
}
@@ -128,7 +130,11 @@
oos.close();
output.write(baos.toByteArray());
} else {
- JPARSLogger.error("jpars_could_not_marshal_requested_result_to_requested_type", new Object[] { result });
+ if (context != null) {
+ JPARSLogger.error(context.getSessionLog(), "jpars_could_not_marshal_requested_result_to_requested_type", new Object[] { result });
+ } else {
+ JPARSLogger.error("jpars_could_not_marshal_requested_result_to_requested_type", new Object[] { result });
+ }
throw new WebApplicationException();
}
}
diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/AbstractSessionLog.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/AbstractSessionLog.java
index 23e5800..8c235d1 100644
--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/AbstractSessionLog.java
+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/AbstractSessionLog.java
@@ -1,1115 +1,1189 @@
-/*******************************************************************************
- * Copyright (c) 1998, 2014 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation from Oracle TopLink
- ******************************************************************************/
-package org.eclipse.persistence.logging;
-
-import java.util.Date;
-import java.text.DateFormat;
-import java.io.*;
-
-import org.eclipse.persistence.sessions.Session;
-import org.eclipse.persistence.internal.databaseaccess.Accessor;
-import org.eclipse.persistence.internal.helper.ConversionManager;
-import org.eclipse.persistence.internal.localization.LoggingLocalization;
-import org.eclipse.persistence.internal.localization.TraceLocalization;
-import org.eclipse.persistence.config.PersistenceUnitProperties;
-import org.eclipse.persistence.exceptions.ValidationException;
-
-/**
- * Represents the abstract log that implements all the generic logging functions.
- * It contains a singleton SessionLog that logs messages from outside any EclipseLink session.
- * The singleton SessionLog can also be passed to an EclipseLink session when messages
- * are logged through that session. When JDK1.4 is used, a singleton JavaLog is created.
- * Otherwise a singleton DefaultSessionLog is created.
- *
- * @see SessionLog
- * @see SessionLogEntry
- * @see DefaultSessionLog
- * @see JavaLog
- */
-public abstract class AbstractSessionLog implements SessionLog, java.lang.Cloneable {
-
- /**
- * Represents the log level
- */
- protected int level;
-
- /**
- * Represents the singleton SessionLog
- */
- protected static SessionLog defaultLog;
-
- /**
- * Represents the session that owns this SessionLog
- */
- protected Session session;
-
- /**
- * Represents prefix to logged severe
- */
- protected static String SEVERE_PREFIX = null;
-
- /**
- * Represents prefix to logged warning
- */
- protected static String WARNING_PREFIX = null;
-
- /**
- * Represents prefix to logged info
- */
- protected static String INFO_PREFIX = null;
-
- /**
- * Represents prefix to logged config
- */
- protected static String CONFIG_PREFIX = null;
-
- /**
- * Represents prefix to logged fine
- */
- protected static String FINE_PREFIX = null;
-
- /**
- * Represents prefix to logged finer
- */
- protected static String FINER_PREFIX = null;
-
- /**
- * Represents prefix to logged finest
- */
- protected static String FINEST_PREFIX = null;
-
- /**
- * Cached TopLink prefix string.
- */
- protected static String TOPLINK_PREFIX = null;
-
- /**
- * Connection string
- */
- protected static final String CONNECTION_STRING = "Connection";
-
- /**
- * Thread string
- */
- protected static final String THREAD_STRING = "Thread";
-
- /**
- * Represents the writer that will receive the formatted log entries
- */
- protected Writer writer;
-
- protected static String DATE_FORMAT_STR = "yyyy.MM.dd HH:mm:ss.SSS";
- /**
- * Format use to print the current date/time.
- */
- protected DateFormat dateFormat;
-
- /**
- * Allows the printing of the stack to be explicitly disabled/enabled.
- * CR #3870467.
- * null value is default behavior of determining from log level.
- */
- protected Boolean shouldLogExceptionStackTrace;
-
- /**
- * Allows the printing of the date to be explicitly disabled/enabled.
- * CR #3870467.
- * null value is default behavior of determining from log level.
- */
- protected Boolean shouldPrintDate;
-
- /**
- * Allows the printing of the thread to be explicitly disabled/enabled.
- * CR #3870467.
- * null value is default behavior of determining from log level.
- */
- protected Boolean shouldPrintThread;
-
- /**
- * Allows the printing of the session to be explicitly disabled/enabled.
- * CR #3870467.
- * null value is default behavior of determining from log level.
- */
- protected Boolean shouldPrintSession;
-
- /**
- * Allows the printing of the connection to be explicitly disabled/enabled.
- * CR #4157545.
- * null value is default behavior of determining from log level.
- */
- protected Boolean shouldPrintConnection;
-
- /** Used to determine if bingdparameters should be logged or hidden. */
- protected Boolean shouldDisplayData;
-
-
- /**
- * Return the system default log level.
- * This is based on the System property "eclipselink.logging.level", or INFO if not set.
- */
- public static int getDefaultLoggingLevel() {
- String logLevel = System.getProperty(PersistenceUnitProperties.LOGGING_LEVEL);
- return translateStringToLoggingLevel(logLevel);
- }
-
- /**
- * PUBLIC:
- * Create a new AbstractSessionLog
- */
- public AbstractSessionLog() {
- this.writer = new PrintWriter(System.out);
- this.level = getDefaultLoggingLevel();
- }
-
- /**
- * PUBLIC:
- * <p>
- * Return the log level. It is used when session is not available.
- *
- * @return the log level
- */
- public int getLevel() {
- return getLevel(null);
- }
-
- /**
- * PUBLIC:
- * <p>
- * Return the log level as a string value.
- */
- public String getLevelString() {
- int level = getLevel();
- switch (level) {
- case OFF:
- return "OFF";
- case SEVERE:
- return "SEVERE";
- case WARNING:
- return "WARNING";
- case INFO:
- return "INFO";
- case CONFIG:
- return "CONFIG";
- case FINE:
- return "FINE";
- case FINER:
- return "FINER";
- case FINEST:
- return "FINEST";
- case ALL:
- return "ALL";
- default:
- return "INFO";
- }
- }
-
- /**
- * PUBLIC:
- * <p>
- * Return the log level for the category name space.
- *
- * @return the log level
- * @param category the string representation of a EclipseLink category, e.g. "sql", "transaction" ...
- */
- public int getLevel(String category) {
- return level;
- }
-
- /**
- * PUBLIC:
- * <p>
- * Set the log level. It is used when session is not available.
- *
- * @param level the new log level
- */
- public void setLevel(int level) {
- setLevel(level, null);
- }
-
- /**
- * PUBLIC:
- * <p>
- * Set the log level for the category name space.
- *
- * @param level the new log level
- * @param category the string representation of an EclipseLink category, e.g. "sql", "transaction" ...
- */
- public void setLevel(int level, String category) {
- this.level = level;
- }
-
- /**
- * PUBLIC:
- * Return true if SQL logging should log visible bind parameters. If the
- * shouldDisplayData is not set, check the session log level and return
- * true for a level greater than CONFIG.
- */
- public boolean shouldDisplayData() {
- if (this.shouldDisplayData != null) {
- return shouldDisplayData.booleanValue();
- } else {
- return this.level < SessionLog.CONFIG;
- }
- }
-
- /**
- * PUBLIC:
- * <p>
- * Check if a message of the given level would actually be logged.
- * It is used when session is not available.
- *
- * @return true if the given message level will be logged
- * @param level the log request level
- */
- public boolean shouldLog(int level) {
- return shouldLog(level, null);
- }
-
- /**
- * PUBLIC:
- * <p>
- * Check if a message of the given level would actually be logged for the category name space.
- * !isOff() is checked to screen out the possibility when both
- * log level and log request level are set to OFF.
- *
- * @return true if the given message level will be logged
- * @param level the log request level
+/*******************************************************************************
+ * Copyright (c) 1998, 2016 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation from Oracle TopLink
+ ******************************************************************************/
+package org.eclipse.persistence.logging;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.security.AccessController;
+import java.text.DateFormat;
+import java.util.Date;
+
+import org.eclipse.persistence.config.PersistenceUnitProperties;
+import org.eclipse.persistence.exceptions.ValidationException;
+import org.eclipse.persistence.internal.databaseaccess.Accessor;
+import org.eclipse.persistence.internal.helper.ConversionManager;
+import org.eclipse.persistence.internal.localization.LoggingLocalization;
+import org.eclipse.persistence.internal.localization.TraceLocalization;
+import org.eclipse.persistence.internal.security.PrivilegedAccessHelper;
+import org.eclipse.persistence.internal.security.PrivilegedGetSystemProperty;
+import org.eclipse.persistence.sessions.Session;
+
+/**
+ * Represents the abstract log that implements all the generic logging functions.
+ * It contains a singleton SessionLog that logs messages from outside any EclipseLink session.
+ * The singleton SessionLog can also be passed to an EclipseLink session when messages
+ * are logged through that session. When JDK1.4 is used, a singleton JavaLog is created.
+ * Otherwise a singleton DefaultSessionLog is created.
+ *
+ * @see SessionLog
+ * @see SessionLogEntry
+ * @see DefaultSessionLog
+ * @see JavaLog
+ */
+public abstract class AbstractSessionLog implements SessionLog, java.lang.Cloneable {
+
+ /**
+ * Represents the log level
+ */
+ protected int level;
+
+ /**
+ * Represents the singleton SessionLog
+ */
+ protected static SessionLog defaultLog;
+
+ /**
+ * Represents the session that owns this SessionLog
+ */
+ protected Session session;
+
+ /**
+ * Represents prefix to logged severe
+ */
+ protected static String SEVERE_PREFIX = null;
+
+ /**
+ * Represents prefix to logged warning
+ */
+ protected static String WARNING_PREFIX = null;
+
+ /**
+ * Represents prefix to logged info
+ */
+ protected static String INFO_PREFIX = null;
+
+ /**
+ * Represents prefix to logged config
+ */
+ protected static String CONFIG_PREFIX = null;
+
+ /**
+ * Represents prefix to logged fine
+ */
+ protected static String FINE_PREFIX = null;
+
+ /**
+ * Represents prefix to logged finer
+ */
+ protected static String FINER_PREFIX = null;
+
+ /**
+ * Represents prefix to logged finest
+ */
+ protected static String FINEST_PREFIX = null;
+
+ /**
+ * Cached TopLink prefix string.
+ */
+ protected static String TOPLINK_PREFIX = null;
+
+ /**
+ * Connection string
+ */
+ protected static final String CONNECTION_STRING = "Connection";
+
+ /**
+ * Thread string
+ */
+ protected static final String THREAD_STRING = "Thread";
+
+ /**
+ * Represents the writer that will receive the formatted log entries
+ */
+ protected Writer writer;
+
+ protected static String DATE_FORMAT_STR = "yyyy.MM.dd HH:mm:ss.SSS";
+ /**
+ * Format use to print the current date/time.
+ */
+ protected DateFormat dateFormat;
+
+ /**
+ * Allows the printing of the stack to be explicitly disabled/enabled.
+ * CR #3870467.
+ * null value is default behavior of determining from log level.
+ */
+ protected Boolean shouldLogExceptionStackTrace;
+
+ /**
+ * Allows the printing of the date to be explicitly disabled/enabled.
+ * CR #3870467.
+ * null value is default behavior of determining from log level.
+ */
+ protected Boolean shouldPrintDate;
+
+ /**
+ * Allows the printing of the thread to be explicitly disabled/enabled.
+ * CR #3870467.
+ * null value is default behavior of determining from log level.
+ */
+ protected Boolean shouldPrintThread;
+
+ /**
+ * Allows the printing of the session to be explicitly disabled/enabled.
+ * CR #3870467.
+ * null value is default behavior of determining from log level.
+ */
+ protected Boolean shouldPrintSession;
+
+ /**
+ * Allows the printing of the connection to be explicitly disabled/enabled.
+ * CR #4157545.
+ * null value is default behavior of determining from log level.
+ */
+ protected Boolean shouldPrintConnection;
+
+ /** Used to determine if bingdparameters should be logged or hidden. */
+ protected Boolean shouldDisplayData;
+
+ /**
+ * Return the system default log level property value.
+ * @return The system default log level property value or {@code null} if no such property is set.
+ */
+ private static String getDefaultLoggingLevelProperty() {
+ return PrivilegedAccessHelper.shouldUsePrivilegedAccess()
+ ? AccessController.doPrivileged(
+ new PrivilegedGetSystemProperty(PersistenceUnitProperties.LOGGING_LEVEL))
+ : System.getProperty(PersistenceUnitProperties.LOGGING_LEVEL);
+ }
+
+ /**
+ * Return the system default log level.
+ * This is based on the System property "eclipselink.logging.level", or INFO if not set.
+ */
+ public static int getDefaultLoggingLevel() {
+ return translateStringToLoggingLevel(getDefaultLoggingLevelProperty());
+ }
+
+ /**
+ * PUBLIC:
+ * Create a new AbstractSessionLog
+ */
+ public AbstractSessionLog() {
+ this.writer = new PrintWriter(System.out);
+ this.level = getDefaultLoggingLevel();
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Return the log level. It is used when session is not available.
+ *
+ * @return the log level
+ */
+ @Override
+ public int getLevel() {
+ return getLevel(null);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Return the log level as a string value.
+ */
+ @Override
+ public String getLevelString() {
+ int level = getLevel();
+ switch (level) {
+ case OFF:
+ return "OFF";
+ case SEVERE:
+ return "SEVERE";
+ case WARNING:
+ return "WARNING";
+ case INFO:
+ return "INFO";
+ case CONFIG:
+ return "CONFIG";
+ case FINE:
+ return "FINE";
+ case FINER:
+ return "FINER";
+ case FINEST:
+ return "FINEST";
+ case ALL:
+ return "ALL";
+ default:
+ return "INFO";
+ }
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Return the log level for the category name space.
+ *
+ * @return the log level
+ * @param category the string representation of a EclipseLink category, e.g. "sql", "transaction" ...
+ */
+ @Override
+ public int getLevel(String category) {
+ return level;
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Set the log level. It is used when session is not available.
+ *
+ * @param level the new log level
+ */
+ @Override
+ public void setLevel(int level) {
+ setLevel(level, null);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Set the log level for the category name space.
+ *
+ * @param level the new log level
+ * @param category the string representation of an EclipseLink category, e.g. "sql", "transaction" ...
+ */
+ @Override
+ public void setLevel(int level, String category) {
+ this.level = level;
+ }
+
+ /**
+ * PUBLIC:
+ * Return true if SQL logging should log visible bind parameters. If the
+ * shouldDisplayData is not set, check the session log level and return
+ * true for a level greater than CONFIG.
+ */
+ @Override
+ public boolean shouldDisplayData() {
+ if (this.shouldDisplayData != null) {
+ return shouldDisplayData.booleanValue();
+ } else {
+ return this.level < SessionLog.CONFIG;
+ }
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Check if a message of the given level would actually be logged.
+ * It is used when session is not available.
+ *
+ * @return true if the given message level will be logged
+ * @param level the log request level
+ */
+ @Override
+ public boolean shouldLog(int level) {
+ return shouldLog(level, null);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Check if a message of the given level would actually be logged for the category name space.
+ * !isOff() is checked to screen out the possibility when both
+ * log level and log request level are set to OFF.
+ *
+ * @return true if the given message level will be logged
+ * @param level the log request level
* @param category the string representation of an EclipseLink category, e.g. "sql", "transaction" ...*
- */
- public boolean shouldLog(int level, String category) {
- return (this.level <= level) && !isOff();
- }
-
- /**
- * PUBLIC:
- * <p>
- * Return the singleton SessionLog. If the singleton SessionLog does not exist,
- * a new one is created based on the version of JDK being used from the Version class.
- *
- * @return the singleton SessionLog
- */
- public static SessionLog getLog() {
- if (defaultLog == null) {
- defaultLog = new DefaultSessionLog();
- }
- return defaultLog;
- }
-
- /**
- * PUBLIC:
- * <p>
- * Set the singleton SessionLog.
- * </p>
- *
- * @param sessionLog a SessionLog
- */
- public static void setLog(SessionLog sessionLog) {
- defaultLog = sessionLog;
- defaultLog.setSession(null);
- }
-
- /**
- * PUBLIC:
- * <p>
- * Get the session.
- * </p>
- *
- * @return session
- */
- public Session getSession() {
- return this.session;
- }
-
- /**
- * PUBLIC:
- * <p>
- * Set the session.
- * </p>
- *
- * @param session a Session
- */
- public void setSession(Session session) {
- this.session = session;
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a message that does not need to be translated. This method is intended for
- * external use when logging messages are required within the EclipseLink output.
- *
- * @param level the log request level value
- * @param message the string message - this should not be a bundle key
- */
- public void log(int level, String message) {
- // Warning: do not use this function to pass in bundle keys as they will not get transformed into string messages
- if (!shouldLog(level)) {
- return;
- }
- //Bug#4566524 Pass in false for external use
- log(level, message, (Object[])null, false);
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a message with one parameter that needs to be translated.
- *
- * @param level the log request level value
- * @param message the string message
- * @param param a parameter of the message
- */
- public void log(int level, String message, Object param) {
- if (!shouldLog(level)) {
- return;
- }
- log(level, message, new Object[] { param });
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a message with one parameter that needs to be translated.
- *
- * @param level the log request level value
- * @param message the string message
- * @param param a parameter of the message
- */
- public void log(int level, String category, String message, Object param) {
- if (!shouldLog(level, category)) {
- return;
- }
- log(level, category, message, new Object[] { param }, true);
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a message with two parameters that needs to be translated.
- *
- * @param level the log request level value
- * @param message the string message
- * @param param1 a parameter of the message
- * @param param2 second parameter of the message
- */
- public void log(int level, String message, Object param1, Object param2) {
- if (!shouldLog(level)) {
- return;
- }
- log(level, message, new Object[] { param1, param2 });
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a message with two parameters that needs to be translated.
- *
- * @param level the log request level value
- * @param message the string message
- * @param param1 a parameter of the message
- * @param param2 second parameter of the message
- */
- public void log(int level, String category, String message, Object param1, Object param2) {
- if (!shouldLog(level)) {
- return;
- }
- log(level, category, message, new Object[] { param1, param2 }, true);
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a message with three parameters that needs to be translated.
- *
- * @param level the log request level value
- * @param message the string message
- * @param param1 a parameter of the message
- * @param param2 second parameter of the message
- * @param param3 third parameter of the message
- */
- public void log(int level, String message, Object param1, Object param2, Object param3) {
- if (!shouldLog(level)) {
- return;
- }
- log(level, message, new Object[] { param1, param2, param3 });
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a message with three parameters that needs to be translated.
- *
- * @param level the log request level value
- * @param message the string message
- * @param param1 a parameter of the message
- * @param param2 second parameter of the message
- * @param param3 third parameter of the message
- */
- public void log(int level, String category, String message, Object param1, Object param2, Object param3) {
- if (!shouldLog(level)) {
- return;
- }
- log(level, category, message, new Object[] { param1, param2, param3 }, true);
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a message with four parameters that needs to be translated.
- *
- * @param level the log request level value
- * @param message the string message
- * @param param1 a parameter of the message
- * @param param2 second parameter of the message
- * @param param3 third parameter of the message
- * @param param4 third parameter of the message
- */
- public void log(int level, String message, Object param1, Object param2, Object param3, Object param4) {
- if (!shouldLog(level)) {
- return;
- }
- log(level, message, new Object[] { param1, param2, param3, param4 });
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a message with four parameters that needs to be translated.
- *
- * @param level the log request level value
- * @param message the string message
- * @param param1 a parameter of the message
- * @param param2 second parameter of the message
- * @param param3 third parameter of the message
- * @param param4 third parameter of the message
- */
- public void log(int level, String category, String message, Object param1, Object param2, Object param3, Object param4) {
- if (!shouldLog(level)) {
- return;
- }
- log(level, category, message, new Object[] { param1, param2, param3, param4 }, true);
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a message with an array of parameters that needs to be translated.
- *
- * @param level the log request level value
- * @param message the string message
- * @param params array of parameters to the message
- */
- public void log(int level, String message, Object[] params) {
- log(level, message, params, true);
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a message with an array of parameters that needs to be translated.
- *
- * @param level the log request level value
- * @param message the string message
- * @param params array of parameters to the message
- */
- public void log(int level, String category, String message, Object[] params) {
- log(level, category, message, params, true);
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a message. shouldTranslate determines if the message needs to be translated.
- *
- * @param level the log request level
- * @param message the string message
- * @param params array of parameters to the message
- * @param shouldTranslate true if the message needs to be translated
- */
- public void log(int level, String message, Object[] params, boolean shouldTranslate) {
- if (!shouldLog(level)) {
- return;
- }
- log(new SessionLogEntry(level, null, message, params, null, shouldTranslate));
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a message. shouldTranslate determines if the message needs to be translated.
- *
- * @param level the log request level
- * @param message the string message
- * @param category the log category
- * @param params array of parameters to the message
- * @param shouldTranslate true if the message needs to be translated
- */
- public void log(int level, String category, String message, Object[] params, boolean shouldTranslate) {
- if (!shouldLog(level, category)) {
- return;
- }
- log(new SessionLogEntry(level, category, null, message, params, null, shouldTranslate));
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a SessionLogEntry
- *
+ */
+ @Override
+ public boolean shouldLog(int level, String category) {
+ return (this.level <= level) && !isOff();
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Return the singleton SessionLog. If the singleton SessionLog does not exist,
+ * a new one is created based on the version of JDK being used from the Version class.
+ *
+ * @return the singleton SessionLog
+ */
+ public static SessionLog getLog() {
+ if (defaultLog == null) {
+ defaultLog = new DefaultSessionLog();
+ }
+ return defaultLog;
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Set the singleton SessionLog.
+ * </p>
+ *
+ * @param sessionLog a SessionLog
+ */
+ public static void setLog(SessionLog sessionLog) {
+ defaultLog = sessionLog;
+ defaultLog.setSession(null);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Get the session.
+ * </p>
+ *
+ * @return session
+ */
+ @Override
+ public Session getSession() {
+ return this.session;
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Set the session.
+ * </p>
+ *
+ * @param session a Session
+ */
+ @Override
+ public void setSession(Session session) {
+ this.session = session;
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a message that does not need to be translated. This method is intended for
+ * external use when logging messages are required within the EclipseLink output.
+ *
+ * @param level the log request level value
+ * @param message the string message - this should not be a bundle key
+ */
+ @Override
+ public void log(int level, String message) {
+ // Warning: do not use this function to pass in bundle keys as they will not get transformed into string messages
+ if (!shouldLog(level)) {
+ return;
+ }
+ //Bug#4566524 Pass in false for external use
+ log(level, message, (Object[])null, false);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a message with one parameter that needs to be translated.
+ *
+ * @param level the log request level value
+ * @param message the string message
+ * @param param a parameter of the message
+ */
+ @Override
+ public void log(int level, String message, Object param) {
+ if (!shouldLog(level)) {
+ return;
+ }
+ log(level, message, new Object[] { param });
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a message with one parameter that needs to be translated.
+ *
+ * @param level the log request level value
+ * @param message the string message
+ * @param param a parameter of the message
+ */
+ @Override
+ public void log(int level, String category, String message, Object param) {
+ if (!shouldLog(level, category)) {
+ return;
+ }
+ log(level, category, message, new Object[] { param }, true);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a message with two parameters that needs to be translated.
+ *
+ * @param level the log request level value
+ * @param message the string message
+ * @param param1 a parameter of the message
+ * @param param2 second parameter of the message
+ */
+ @Override
+ public void log(int level, String message, Object param1, Object param2) {
+ if (!shouldLog(level)) {
+ return;
+ }
+ log(level, message, new Object[] { param1, param2 });
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a message with two parameters that needs to be translated.
+ *
+ * @param level the log request level value
+ * @param message the string message
+ * @param param1 a parameter of the message
+ * @param param2 second parameter of the message
+ */
+ @Override
+ public void log(int level, String category, String message, Object param1, Object param2) {
+ if (!shouldLog(level)) {
+ return;
+ }
+ log(level, category, message, new Object[] { param1, param2 }, true);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a message with three parameters that needs to be translated.
+ *
+ * @param level the log request level value
+ * @param message the string message
+ * @param param1 a parameter of the message
+ * @param param2 second parameter of the message
+ * @param param3 third parameter of the message
+ */
+ @Override
+ public void log(int level, String message, Object param1, Object param2, Object param3) {
+ if (!shouldLog(level)) {
+ return;
+ }
+ log(level, message, new Object[] { param1, param2, param3 });
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a message with three parameters that needs to be translated.
+ *
+ * @param level the log request level value
+ * @param message the string message
+ * @param param1 a parameter of the message
+ * @param param2 second parameter of the message
+ * @param param3 third parameter of the message
+ */
+ @Override
+ public void log(int level, String category, String message, Object param1, Object param2, Object param3) {
+ if (!shouldLog(level)) {
+ return;
+ }
+ log(level, category, message, new Object[] { param1, param2, param3 }, true);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a message with four parameters that needs to be translated.
+ *
+ * @param level the log request level value
+ * @param message the string message
+ * @param param1 a parameter of the message
+ * @param param2 second parameter of the message
+ * @param param3 third parameter of the message
+ * @param param4 third parameter of the message
+ */
+ @Override
+ public void log(int level, String message, Object param1, Object param2, Object param3, Object param4) {
+ if (!shouldLog(level)) {
+ return;
+ }
+ log(level, message, new Object[] { param1, param2, param3, param4 });
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a message with four parameters that needs to be translated.
+ *
+ * @param level the log request level value
+ * @param message the string message
+ * @param param1 a parameter of the message
+ * @param param2 second parameter of the message
+ * @param param3 third parameter of the message
+ * @param param4 third parameter of the message
+ */
+ @Override
+ public void log(int level, String category, String message, Object param1, Object param2, Object param3, Object param4) {
+ if (!shouldLog(level)) {
+ return;
+ }
+ log(level, category, message, new Object[] { param1, param2, param3, param4 }, true);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a message with an array of parameters that needs to be translated.
+ *
+ * @param level the log request level value
+ * @param message the string message
+ * @param params array of parameters to the message
+ */
+ @Override
+ public void log(int level, String message, Object[] params) {
+ log(level, message, params, true);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a message with an array of parameters that needs to be translated.
+ *
+ * @param level the log request level value
+ * @param message the string message
+ * @param params array of parameters to the message
+ */
+ @Override
+ public void log(int level, String category, String message, Object[] params) {
+ log(level, category, message, params, true);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a message. shouldTranslate determines if the message needs to be translated.
+ *
+ * @param level the log request level
+ * @param message the string message
+ * @param params array of parameters to the message
+ * @param shouldTranslate true if the message needs to be translated
+ */
+ @Override
+ public void log(int level, String message, Object[] params, boolean shouldTranslate) {
+ if (!shouldLog(level)) {
+ return;
+ }
+ log(new SessionLogEntry(level, null, message, params, null, shouldTranslate));
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a message. shouldTranslate determines if the message needs to be translated.
+ *
+ * @param level the log request level
+ * @param message the string message
+ * @param category the log category
+ * @param params array of parameters to the message
+ * @param shouldTranslate true if the message needs to be translated
+ */
+ @Override
+ public void log(int level, String category, String message, Object[] params, boolean shouldTranslate) {
+ if (!shouldLog(level, category)) {
+ return;
+ }
+ log(new SessionLogEntry(level, category, null, message, params, null, shouldTranslate));
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a SessionLogEntry
+ *
* @param sessionLogEntry SessionLogEntry that holds all the information for an EclipseLink logging event
- */
- public abstract void log(SessionLogEntry sessionLogEntry);
-
- /**
- * By default the session (and its connection is available) are printed,
- * this can be turned off.
- */
- public boolean shouldPrintSession() {
- return (shouldPrintSession == null) || shouldPrintSession.booleanValue();
- }
-
- /**
- * By default the session (and its connection is available) are printed,
- * this can be turned off.
- */
- public void setShouldPrintSession(boolean shouldPrintSession) {
- if (shouldPrintSession) {
- this.shouldPrintSession = Boolean.TRUE;
- } else {
- this.shouldPrintSession = Boolean.FALSE;
- }
- }
-
- /**
- * By default the connection is printed, this can be turned off.
- */
- public boolean shouldPrintConnection() {
- return (shouldPrintConnection == null) || shouldPrintConnection.booleanValue();
- }
-
- /**
- * By default the connection is printed, this can be turned off.
- */
- public void setShouldPrintConnection(boolean shouldPrintConnection) {
- if (shouldPrintConnection) {
- this.shouldPrintConnection = Boolean.TRUE;
- } else {
- this.shouldPrintConnection = Boolean.FALSE;
- }
- }
-
- /**
- * By default the stack is logged for FINER or less (finest).
- * The logging of the stack can also be explicitly turned on or off.
- */
- public boolean shouldLogExceptionStackTrace() {
- if (shouldLogExceptionStackTrace == null) {
- return getLevel() <= FINER;
- } else {
- return shouldLogExceptionStackTrace.booleanValue();
- }
- }
-
- /**
- * PUBLIC:
- * Set whether bind parameters should be displayed when logging SQL.
- */
- public void setShouldDisplayData(Boolean shouldDisplayData) {
- this.shouldDisplayData = shouldDisplayData;
- }
-
- /**
- * By default the stack is logged for FINER or less (finest).
- * The logging of the stack can also be explicitly turned on or off.
- */
- public void setShouldLogExceptionStackTrace(boolean shouldLogExceptionStackTrace) {
- if (shouldLogExceptionStackTrace) {
- this.shouldLogExceptionStackTrace = Boolean.TRUE;
- } else {
- this.shouldLogExceptionStackTrace = Boolean.FALSE;
- }
- }
-
- /**
- * By default the date is always printed, but can be turned off.
- */
- public boolean shouldPrintDate() {
- return (shouldPrintDate == null) || (shouldPrintDate.booleanValue());
- }
-
- /**
- * By default the date is always printed, but can be turned off.
- */
- public void setShouldPrintDate(boolean shouldPrintDate) {
- if (shouldPrintDate) {
- this.shouldPrintDate = Boolean.TRUE;
- } else {
- this.shouldPrintDate = Boolean.FALSE;
- }
- }
-
- /**
- * By default the thread is logged for FINE or less (finer,etc.).
- * The logging of the thread can also be explicitly turned on or off.
- */
- public boolean shouldPrintThread() {
- if (shouldPrintThread == null) {
- return getLevel() <= FINE;
- } else {
- return shouldPrintThread.booleanValue();
- }
- }
-
- /**
- * By default the thread is logged for FINE or less (finer,etc.).
- * The logging of the thread can also be explicitly turned on or off.
- */
- public void setShouldPrintThread(boolean shouldPrintThread) {
- if (shouldPrintThread) {
- this.shouldPrintThread = Boolean.TRUE;
- } else {
- this.shouldPrintThread = Boolean.FALSE;
- }
- }
-
- /**
- * PUBLIC:
- * <p>
- * Return the writer that will receive the formatted log entries.
- *
- * @return the log writer
- */
- public Writer getWriter() {
- return writer;
- }
-
- /**
- * PUBLIC:
- * <p>
- * Set the writer that will receive the formatted log entries.
- *
- * @param writer the log writer
- */
- public void setWriter(Writer writer) {
- this.writer = writer;
- }
-
-
- /**
- * PUBLIC:
- * <p>
- * Set the writer that will receive the formatted log entries.
- *
+ */
+ @Override
+ public abstract void log(SessionLogEntry sessionLogEntry);
+
+ /**
+ * By default the session (and its connection is available) are printed,
+ * this can be turned off.
+ */
+ @Override
+ public boolean shouldPrintSession() {
+ return (shouldPrintSession == null) || shouldPrintSession.booleanValue();
+ }
+
+ /**
+ * By default the session (and its connection is available) are printed,
+ * this can be turned off.
+ */
+ @Override
+ public void setShouldPrintSession(boolean shouldPrintSession) {
+ if (shouldPrintSession) {
+ this.shouldPrintSession = Boolean.TRUE;
+ } else {
+ this.shouldPrintSession = Boolean.FALSE;
+ }
+ }
+
+ /**
+ * By default the connection is printed, this can be turned off.
+ */
+ @Override
+ public boolean shouldPrintConnection() {
+ return (shouldPrintConnection == null) || shouldPrintConnection.booleanValue();
+ }
+
+ /**
+ * By default the connection is printed, this can be turned off.
+ */
+ @Override
+ public void setShouldPrintConnection(boolean shouldPrintConnection) {
+ if (shouldPrintConnection) {
+ this.shouldPrintConnection = Boolean.TRUE;
+ } else {
+ this.shouldPrintConnection = Boolean.FALSE;
+ }
+ }
+
+ /**
+ * By default the stack is logged for FINER or less (finest).
+ * The logging of the stack can also be explicitly turned on or off.
+ */
+ @Override
+ public boolean shouldLogExceptionStackTrace() {
+ if (shouldLogExceptionStackTrace == null) {
+ return getLevel() <= FINER;
+ } else {
+ return shouldLogExceptionStackTrace.booleanValue();
+ }
+ }
+
+ /**
+ * PUBLIC:
+ * Set whether bind parameters should be displayed when logging SQL.
+ */
+ @Override
+ public void setShouldDisplayData(Boolean shouldDisplayData) {
+ this.shouldDisplayData = shouldDisplayData;
+ }
+
+ /**
+ * By default the stack is logged for FINER or less (finest).
+ * The logging of the stack can also be explicitly turned on or off.
+ */
+ @Override
+ public void setShouldLogExceptionStackTrace(boolean shouldLogExceptionStackTrace) {
+ if (shouldLogExceptionStackTrace) {
+ this.shouldLogExceptionStackTrace = Boolean.TRUE;
+ } else {
+ this.shouldLogExceptionStackTrace = Boolean.FALSE;
+ }
+ }
+
+ /**
+ * By default the date is always printed, but can be turned off.
+ */
+ @Override
+ public boolean shouldPrintDate() {
+ return (shouldPrintDate == null) || (shouldPrintDate.booleanValue());
+ }
+
+ /**
+ * By default the date is always printed, but can be turned off.
+ */
+ @Override
+ public void setShouldPrintDate(boolean shouldPrintDate) {
+ if (shouldPrintDate) {
+ this.shouldPrintDate = Boolean.TRUE;
+ } else {
+ this.shouldPrintDate = Boolean.FALSE;
+ }
+ }
+
+ /**
+ * By default the thread is logged for FINE or less (finer,etc.).
+ * The logging of the thread can also be explicitly turned on or off.
+ */
+ @Override
+ public boolean shouldPrintThread() {
+ if (shouldPrintThread == null) {
+ return getLevel() <= FINE;
+ } else {
+ return shouldPrintThread.booleanValue();
+ }
+ }
+
+ /**
+ * By default the thread is logged for FINE or less (finer,etc.).
+ * The logging of the thread can also be explicitly turned on or off.
+ */
+ @Override
+ public void setShouldPrintThread(boolean shouldPrintThread) {
+ if (shouldPrintThread) {
+ this.shouldPrintThread = Boolean.TRUE;
+ } else {
+ this.shouldPrintThread = Boolean.FALSE;
+ }
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Return the writer that will receive the formatted log entries.
+ *
+ * @return the log writer
+ */
+ @Override
+ public Writer getWriter() {
+ return writer;
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Set the writer that will receive the formatted log entries.
+ *
+ * @param writer the log writer
+ */
+ @Override
+ public void setWriter(Writer writer) {
+ this.writer = writer;
+ }
+
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Set the writer that will receive the formatted log entries.
+ *
* @param outputstream the log writer
- */
- public void setWriter(OutputStream outputstream) {
- this.writer = new OutputStreamWriter(outputstream);
- }
-
- /**
- * PUBLIC:
- * Return the date format to be used when printing a log entry date.
- * @return the date format
- */
- public DateFormat getDateFormat() {
- return dateFormat;
- }
-
- /**
- * Return the specified date and/or time information in string.
- * The format will be determined by the date format settings.
- */
- protected String getDateString(Date date) {
- if (getDateFormat() != null) {
- return getDateFormat().format(date);
-
- }
-
- if (date == null) {
- return null;
- }
-
- // Since we currently do not have a thread-safe way to format dates,
- // we will use ConversionManager to build the string.
- return ConversionManager.getDefaultManager().convertObject(date, String.class).toString();
- }
-
- /**
- * Return the supplement detail information including date, session, thread and connection.
- */
- protected String getSupplementDetailString(SessionLogEntry entry) {
- StringWriter writer = new StringWriter();
-
- if (shouldPrintDate()) {
- writer.write(getDateString(entry.getDate()));
- writer.write("--");
- }
- if (shouldPrintSession() && (entry.getSession() != null)) {
- writer.write(this.getSessionString(entry.getSession()));
- writer.write("--");
- }
- if (shouldPrintConnection() && (entry.getConnection() != null)) {
- writer.write(this.getConnectionString(entry.getConnection()));
- writer.write("--");
- }
- if (shouldPrintThread()) {
- writer.write(this.getThreadString(entry.getThread()));
- writer.write("--");
- }
- return writer.toString();
- }
-
- /**
- * Return the current session including the type and id.
- */
- protected String getSessionString(Session session) {
- // For bug 3422759 the session to log against should be the one in the
- // event, not the static one in the SessionLog, for there are many
- // sessions but only one SessionLog.
- if (session != null) {
- return ((org.eclipse.persistence.internal.sessions.AbstractSession)session).getLogSessionString();
- } else {
- return "";
- }
- }
-
- /**
- * Return the specified connection information.
- */
- protected String getConnectionString(Accessor connection) {
- // Bug 3630182 - if possible, print the actual connection's hashcode instead of just the accessor
- if (connection.getDatasourceConnection() == null){
- return CONNECTION_STRING + "(" + String.valueOf(System.identityHashCode(connection)) + ")";
- } else {
- return CONNECTION_STRING + "(" + String.valueOf(System.identityHashCode(connection.getDatasourceConnection())) + ")";
- }
- }
-
- /**
- * Return the specified thread information.
- */
- protected String getThreadString(Thread thread) {
- return THREAD_STRING + "(" + String.valueOf(thread) + ")";
- }
-
- /**
- * Print the prefix string representing EclipseLink logging
- */
-
- //Bug3135111 Prefix strings are not translated until the first time they are used.
- protected void printPrefixString(int level, String category) {
- try {
- switch (level) {
- case SEVERE:
- if (SEVERE_PREFIX == null) {
- SEVERE_PREFIX = LoggingLocalization.buildMessage("toplink_severe");
- }
- this.getWriter().write(SEVERE_PREFIX);
- break;
- case WARNING:
- if (WARNING_PREFIX == null) {
- WARNING_PREFIX = LoggingLocalization.buildMessage("toplink_warning");
- }
- this.getWriter().write(WARNING_PREFIX);
- break;
- case INFO:
- if (INFO_PREFIX == null) {
- INFO_PREFIX = LoggingLocalization.buildMessage("toplink_info");
- }
- this.getWriter().write(INFO_PREFIX);
- break;
- case CONFIG:
- if (CONFIG_PREFIX == null) {
- CONFIG_PREFIX = LoggingLocalization.buildMessage("toplink_config");
- }
- this.getWriter().write(CONFIG_PREFIX);
- break;
- case FINE:
- if (FINE_PREFIX == null) {
- FINE_PREFIX = LoggingLocalization.buildMessage("toplink_fine");
- }
- this.getWriter().write(FINE_PREFIX);
- break;
- case FINER:
- if (FINER_PREFIX == null) {
- FINER_PREFIX = LoggingLocalization.buildMessage("toplink_finer");
- }
- this.getWriter().write(FINER_PREFIX);
- break;
- case FINEST:
- if (FINEST_PREFIX == null) {
- FINEST_PREFIX = LoggingLocalization.buildMessage("toplink_finest");
- }
- this.getWriter().write(FINEST_PREFIX);
- break;
- default:
- if (TOPLINK_PREFIX == null) {
- TOPLINK_PREFIX = LoggingLocalization.buildMessage("toplink");
- }
- this.getWriter().write(TOPLINK_PREFIX);
- }
- if (category != null) {
- this.getWriter().write(category);
- this.getWriter().write(": ");
- }
- } catch (IOException exception) {
- throw ValidationException.logIOError(exception);
- }
- }
-
-
- /**
- * PUBLIC:
- * Set the date format to be used when printing a log entry date.
+ */
+ public void setWriter(OutputStream outputstream) {
+ this.writer = new OutputStreamWriter(outputstream);
+ }
+
+ /**
+ * PUBLIC:
+ * Return the date format to be used when printing a log entry date.
+ * @return the date format
+ */
+ public DateFormat getDateFormat() {
+ return dateFormat;
+ }
+
+ /**
+ * Return the specified date and/or time information in string.
+ * The format will be determined by the date format settings.
+ */
+ protected String getDateString(Date date) {
+ if (getDateFormat() != null) {
+ return getDateFormat().format(date);
+
+ }
+
+ if (date == null) {
+ return null;
+ }
+
+ // Since we currently do not have a thread-safe way to format dates,
+ // we will use ConversionManager to build the string.
+ return ConversionManager.getDefaultManager().convertObject(date, String.class).toString();
+ }
+
+ /**
+ * Return the supplement detail information including date, session, thread, connection,
+ * source class name and source method name.
+ */
+ protected String getSupplementDetailString(SessionLogEntry entry) {
+ StringWriter writer = new StringWriter();
+
+ if (shouldPrintDate()) {
+ writer.write(getDateString(entry.getDate()));
+ writer.write("--");
+ }
+ if (shouldPrintSession() && (entry.getSession() != null)) {
+ writer.write(this.getSessionString(entry.getSession()));
+ writer.write("--");
+ }
+ if (shouldPrintConnection() && (entry.getConnection() != null)) {
+ writer.write(this.getConnectionString(entry.getConnection()));
+ writer.write("--");
+ }
+ if (shouldPrintThread()) {
+ writer.write(this.getThreadString(entry.getThread()));
+ writer.write("--");
+ }
+ if (entry.getSourceClassName() != null) {
+ writer.write(entry.getSourceClassName());
+ writer.write("--");
+ }
+ if (entry.getSourceMethodName() != null) {
+ writer.write(entry.getSourceMethodName());
+ writer.write("--");
+ }
+ return writer.toString();
+ }
+
+ /**
+ * Return the current session including the type and id.
+ */
+ protected String getSessionString(Session session) {
+ // For bug 3422759 the session to log against should be the one in the
+ // event, not the static one in the SessionLog, for there are many
+ // sessions but only one SessionLog.
+ if (session != null) {
+ return ((org.eclipse.persistence.internal.sessions.AbstractSession)session).getLogSessionString();
+ } else {
+ return "";
+ }
+ }
+
+ /**
+ * Return the specified connection information.
+ */
+ protected String getConnectionString(Accessor connection) {
+ // Bug 3630182 - if possible, print the actual connection's hashcode instead of just the accessor
+ if (connection.getDatasourceConnection() == null){
+ return CONNECTION_STRING + "(" + String.valueOf(System.identityHashCode(connection)) + ")";
+ } else {
+ return CONNECTION_STRING + "(" + String.valueOf(System.identityHashCode(connection.getDatasourceConnection())) + ")";
+ }
+ }
+
+ /**
+ * Return the specified thread information.
+ */
+ protected String getThreadString(Thread thread) {
+ return THREAD_STRING + "(" + String.valueOf(thread) + ")";
+ }
+
+ /**
+ * Print the prefix string representing EclipseLink logging
+ */
+
+ //Bug3135111 Prefix strings are not translated until the first time they are used.
+ protected void printPrefixString(int level, String category) {
+ try {
+ switch (level) {
+ case SEVERE:
+ if (SEVERE_PREFIX == null) {
+ SEVERE_PREFIX = LoggingLocalization.buildMessage("toplink_severe");
+ }
+ this.getWriter().write(SEVERE_PREFIX);
+ break;
+ case WARNING:
+ if (WARNING_PREFIX == null) {
+ WARNING_PREFIX = LoggingLocalization.buildMessage("toplink_warning");
+ }
+ this.getWriter().write(WARNING_PREFIX);
+ break;
+ case INFO:
+ if (INFO_PREFIX == null) {
+ INFO_PREFIX = LoggingLocalization.buildMessage("toplink_info");
+ }
+ this.getWriter().write(INFO_PREFIX);
+ break;
+ case CONFIG:
+ if (CONFIG_PREFIX == null) {
+ CONFIG_PREFIX = LoggingLocalization.buildMessage("toplink_config");
+ }
+ this.getWriter().write(CONFIG_PREFIX);
+ break;
+ case FINE:
+ if (FINE_PREFIX == null) {
+ FINE_PREFIX = LoggingLocalization.buildMessage("toplink_fine");
+ }
+ this.getWriter().write(FINE_PREFIX);
+ break;
+ case FINER:
+ if (FINER_PREFIX == null) {
+ FINER_PREFIX = LoggingLocalization.buildMessage("toplink_finer");
+ }
+ this.getWriter().write(FINER_PREFIX);
+ break;
+ case FINEST:
+ if (FINEST_PREFIX == null) {
+ FINEST_PREFIX = LoggingLocalization.buildMessage("toplink_finest");
+ }
+ this.getWriter().write(FINEST_PREFIX);
+ break;
+ default:
+ if (TOPLINK_PREFIX == null) {
+ TOPLINK_PREFIX = LoggingLocalization.buildMessage("toplink");
+ }
+ this.getWriter().write(TOPLINK_PREFIX);
+ }
+ if (category != null) {
+ this.getWriter().write(category);
+ this.getWriter().write(": ");
+ }
+ } catch (IOException exception) {
+ throw ValidationException.logIOError(exception);
+ }
+ }
+
+
+ /**
+ * PUBLIC:
+ * Set the date format to be used when printing a log entry date.
* <p>Note: the JDK's <tt>java.text.SimpleDateFormat</tt> is <b>NOT</b> thread-safe.<br>
- * The user is <b>strongly</b> advised to consider using Apache Commons<br>
- * <tt>org.apache.commons.lang.time.FastDateFormat</tt> instead.</p>
- *
- * @param dateFormat java.text.DateFormat
- */
- public void setDateFormat(DateFormat dateFormat) {
- this.dateFormat = dateFormat;
- }
-
- /**
- * Return the formatted message based on the information from the given SessionLogEntry.
- * The message will either be translated and formatted or formatted only depending
- * on if the shouldTranslate flag is set to true of false.
- */
- protected String formatMessage(SessionLogEntry entry) {
- String message = entry.getMessage();
- if (entry.shouldTranslate()) {
- if (entry.getLevel() > FINE) {
- message = LoggingLocalization.buildMessage(message, entry.getParameters());
- } else {
- message = TraceLocalization.buildMessage(message, entry.getParameters(), true);
- }
- } else {
- //Bug5976657, if there are entry parameters and the string "{0" contained in the message
- //body, we assume it needs to be formatted.
- if (entry.getParameters()!=null && entry.getParameters().length>0 && message.indexOf("{0") >= 0) {
- message = java.text.MessageFormat.format(message, entry.getParameters());
- }
- }
- return message;
- }
-
- /**
- * INTERNAL:
- * Translate the string value of the log level to the constant value.
- * If value is null or invalid use the default.
- */
- public static int translateStringToLoggingLevel(String loggingLevel) {
- if (loggingLevel == null){
- return INFO;
- }
- String level = loggingLevel.toUpperCase();
- if (level.equals("OFF")){
- return OFF;
- } else if (level.equals("SEVERE")){
- return SEVERE;
- } else if (level.equals("WARNING")){
- return WARNING;
- } else if (level.equals("INFO")){
- return INFO;
- } else if (level.equals("CONFIG")){
- return CONFIG;
- } else if (level.equals("FINE")){
- return FINE;
- } else if (level.equals("FINER")){
- return FINER;
- } else if (level.equals("FINEST")){
- return FINEST;
- } else if (level.equals("ALL")){
- return ALL;
- }
- return INFO;
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a throwable at FINER level.
- *
- * @param throwable a Throwable
- */
- public void throwing(Throwable throwable) {
- if (shouldLog(FINER)) {
- SessionLogEntry entry = new SessionLogEntry(null, throwable);
- entry.setLevel(FINER);
- log(entry);
- }
- }
-
- /**
- * PUBLIC:
- * <p>
- * This method is called when a severe level message needs to be logged.
- * The message will be translated
- *
- * @param message the message key
- */
- public void severe(String message) {
- log(SEVERE, message, (Object[])null);
- }
-
- /**
- * PUBLIC:
- * <p>
- * This method is called when a warning level message needs to be logged.
- * The message will be translated
- *
- * @param message the message key
- */
- public void warning(String message) {
- log(WARNING, message, (Object[])null);
- }
-
- /**
- * PUBLIC:
- * <p>
- * This method is called when a info level message needs to be logged.
- * The message will be translated
- *
- * @param message the message key
- */
- public void info(String message) {
- log(INFO, message, (Object[])null);
- }
-
- /**
- * PUBLIC:
- * <p>
- * This method is called when a config level message needs to be logged.
- * The message will be translated
- *
- * @param message the message key
- */
- public void config(String message) {
- log(CONFIG, message, (Object[])null);
- }
-
- /**
- * PUBLIC:
- * <p>
- * This method is called when a fine level message needs to be logged.
- * The message will be translated
- *
- * @param message the message key
- */
- public void fine(String message) {
- log(FINE, message, (Object[])null);
- }
-
- /**
- * PUBLIC:
- * <p>
- * This method is called when a finer level message needs to be logged.
- * The message will be translated
- *
- * @param message the message key
- */
- public void finer(String message) {
- log(FINER, message, (Object[])null);
- }
-
- /**
- * PUBLIC:
- * <p>
- * This method is called when a finest level message needs to be logged.
- * The message will be translated
- *
- * @param message the message key
- */
- public void finest(String message) {
- log(FINEST, message, (Object[])null);
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a throwable with level.
- *
- * @param level the log request level value
- * @param throwable a Throwable
- */
- public void logThrowable(int level, Throwable throwable) {
- // Must not create the log if not logging as is a performance issue.
- if (shouldLog(level)) {
- log(new SessionLogEntry(null, level, null, throwable));
- }
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a throwable with level.
- *
- * @param level the log request level value
- * @param throwable a Throwable
- */
- public void logThrowable(int level, String category, Throwable throwable) {
- // Must not create the log if not logging as is a performance issue.
- if (shouldLog(level, category)) {
- log(new SessionLogEntry(null, level, category, throwable));
- }
- }
-
- /**
- * INTERNAL:
- * Check if the log level is set to off.
- */
- public boolean isOff() {
- return this.level == OFF;
- }
-
- /**
- * INTERNAL:
- * Each session owns its own session log because session is stored in the session log
- */
- public Object clone() {
- try {
- return super.clone();
- } catch (Exception exception) {
- return null;
- }
- }
- /**
- * INTERNAL:
- * Translate the string value of the log level to the constant value.
- * If value is null or invalid use the default.
- */
- public static String translateLoggingLevelToString(int loggingLevel){
- if (loggingLevel == OFF){
- return "OFF";
- } else if (loggingLevel == SEVERE){
- return "SEVERE";
- } else if (loggingLevel == WARNING){
- return "WARNING";
- } else if (loggingLevel == INFO){
- return "INFO";
- } else if (loggingLevel == CONFIG){
- return "CONFIG";
- } else if (loggingLevel == FINE){
- return "FINE";
- } else if (loggingLevel == FINER){
- return "FINER";
- } else if (loggingLevel == FINEST){
- return "FINEST";
- } else if (loggingLevel == ALL){
- return "ALL";
- }
- return "INFO";
- }
-
-}
+ * The user is <b>strongly</b> advised to consider using Apache Commons<br>
+ * <tt>org.apache.commons.lang.time.FastDateFormat</tt> instead.</p>
+ *
+ * @param dateFormat java.text.DateFormat
+ */
+ public void setDateFormat(DateFormat dateFormat) {
+ this.dateFormat = dateFormat;
+ }
+
+ /**
+ * Return the formatted message based on the information from the given SessionLogEntry.
+ * The message will either be translated and formatted or formatted only depending
+ * on if the shouldTranslate flag is set to true of false.
+ */
+ protected String formatMessage(SessionLogEntry entry) {
+ String message = entry.getMessage();
+ if (entry.shouldTranslate()) {
+ if (entry.getLevel() > FINE) {
+ message = LoggingLocalization.buildMessage(message, entry.getParameters());
+ } else {
+ message = TraceLocalization.buildMessage(message, entry.getParameters(), true);
+ }
+ } else {
+ //Bug5976657, if there are entry parameters and the string "{0" contained in the message
+ //body, we assume it needs to be formatted.
+ if (entry.getParameters()!=null && entry.getParameters().length>0 && message.indexOf("{0") >= 0) {
+ message = java.text.MessageFormat.format(message, entry.getParameters());
+ }
+ }
+ return message;
+ }
+
+ /**
+ * INTERNAL:
+ * Translate the string value of the log level to the constant value.
+ * If value is null or invalid use the default.
+ */
+ public static int translateStringToLoggingLevel(String loggingLevel) {
+ if (loggingLevel == null){
+ return INFO;
+ }
+ String level = loggingLevel.toUpperCase();
+ if (level.equals("OFF")){
+ return OFF;
+ } else if (level.equals("SEVERE")){
+ return SEVERE;
+ } else if (level.equals("WARNING")){
+ return WARNING;
+ } else if (level.equals("INFO")){
+ return INFO;
+ } else if (level.equals("CONFIG")){
+ return CONFIG;
+ } else if (level.equals("FINE")){
+ return FINE;
+ } else if (level.equals("FINER")){
+ return FINER;
+ } else if (level.equals("FINEST")){
+ return FINEST;
+ } else if (level.equals("ALL")){
+ return ALL;
+ }
+ return INFO;
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a throwable at FINER level.
+ *
+ * @param throwable a Throwable
+ */
+ @Override
+ public void throwing(Throwable throwable) {
+ if (shouldLog(FINER)) {
+ SessionLogEntry entry = new SessionLogEntry(null, throwable);
+ entry.setLevel(FINER);
+ log(entry);
+ }
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * This method is called when a severe level message needs to be logged.
+ * The message will be translated
+ *
+ * @param message the message key
+ */
+ @Override
+ public void severe(String message) {
+ log(SEVERE, message, (Object[])null);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * This method is called when a warning level message needs to be logged.
+ * The message will be translated
+ *
+ * @param message the message key
+ */
+ @Override
+ public void warning(String message) {
+ log(WARNING, message, (Object[])null);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * This method is called when a info level message needs to be logged.
+ * The message will be translated
+ *
+ * @param message the message key
+ */
+ @Override
+ public void info(String message) {
+ log(INFO, message, (Object[])null);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * This method is called when a config level message needs to be logged.
+ * The message will be translated
+ *
+ * @param message the message key
+ */
+ @Override
+ public void config(String message) {
+ log(CONFIG, message, (Object[])null);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * This method is called when a fine level message needs to be logged.
+ * The message will be translated
+ *
+ * @param message the message key
+ */
+ @Override
+ public void fine(String message) {
+ log(FINE, message, (Object[])null);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * This method is called when a finer level message needs to be logged.
+ * The message will be translated
+ *
+ * @param message the message key
+ */
+ @Override
+ public void finer(String message) {
+ log(FINER, message, (Object[])null);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * This method is called when a finest level message needs to be logged.
+ * The message will be translated
+ *
+ * @param message the message key
+ */
+ @Override
+ public void finest(String message) {
+ log(FINEST, message, (Object[])null);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a throwable with level.
+ *
+ * @param level the log request level value
+ * @param throwable a Throwable
+ */
+ @Override
+ public void logThrowable(int level, Throwable throwable) {
+ // Must not create the log if not logging as is a performance issue.
+ if (shouldLog(level)) {
+ log(new SessionLogEntry(null, level, null, throwable));
+ }
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a throwable with level.
+ *
+ * @param level the log request level value
+ * @param throwable a Throwable
+ */
+ @Override
+ public void logThrowable(int level, String category, Throwable throwable) {
+ // Must not create the log if not logging as is a performance issue.
+ if (shouldLog(level, category)) {
+ log(new SessionLogEntry(null, level, category, throwable));
+ }
+ }
+
+ /**
+ * INTERNAL:
+ * Check if the log level is set to off.
+ */
+ public boolean isOff() {
+ return this.level == OFF;
+ }
+
+ /**
+ * INTERNAL:
+ * Each session owns its own session log because session is stored in the session log
+ */
+ @Override
+ public Object clone() {
+ try {
+ return super.clone();
+ } catch (Exception exception) {
+ throw new AssertionError(exception);
+ }
+ }
+ /**
+ * INTERNAL:
+ * Translate the string value of the log level to the constant value.
+ * If value is null or invalid use the default.
+ */
+ public static String translateLoggingLevelToString(int loggingLevel){
+ if (loggingLevel == OFF){
+ return "OFF";
+ } else if (loggingLevel == SEVERE){
+ return "SEVERE";
+ } else if (loggingLevel == WARNING){
+ return "WARNING";
+ } else if (loggingLevel == INFO){
+ return "INFO";
+ } else if (loggingLevel == CONFIG){
+ return "CONFIG";
+ } else if (loggingLevel == FINE){
+ return "FINE";
+ } else if (loggingLevel == FINER){
+ return "FINER";
+ } else if (loggingLevel == FINEST){
+ return "FINEST";
+ } else if (loggingLevel == ALL){
+ return "ALL";
+ }
+ return "INFO";
+ }
+
+}
diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/JavaLog.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/JavaLog.java
index 708c970..3b4c793 100644
--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/JavaLog.java
+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/JavaLog.java
@@ -1,318 +1,331 @@
-/*******************************************************************************
- * Copyright (c) 1998, 2014 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation from Oracle TopLink
- ******************************************************************************/
-package org.eclipse.persistence.logging;
-
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.*;
-import java.io.*;
-import java.util.logging.*;
-import org.eclipse.persistence.sessions.Session;
-
-/**
- * PUBLIC:
- * <p>
- * This is a wrapper class for java.util.logging. It is used when messages need to
- * be logged through java.util.logging.
- * </p>
- * @see SessionLog
- * @see AbstractSessionLog
- * @see SessionLogEntry
- * @see Session
- */
-public class JavaLog extends AbstractSessionLog {
-
- /**
- * Stores the default session name in case there is the session name is missing.
- */
- public static final String TOPLINK_NAMESPACE = "org.eclipse.persistence";
- protected static final String LOGGING_LOCALIZATION_STRING = "org.eclipse.persistence.internal.localization.i18n.LoggingLocalizationResource";
- protected static final String TRACE_LOCALIZATION_STRING = "org.eclipse.persistence.internal.localization.i18n.TraceLocalizationResource";
- public static final String DEFAULT_TOPLINK_NAMESPACE = TOPLINK_NAMESPACE + ".default";
- public static final String SESSION_TOPLINK_NAMESPACE = TOPLINK_NAMESPACE + ".session";
-
- /**
- * Stores all the java.util.logging.Levels. The indexes are TopLink logging levels.
- */
- private static final Level[] levels = new Level[] { Level.ALL, Level.FINEST, Level.FINER, Level.FINE, Level.CONFIG, Level.INFO, Level.WARNING, Level.SEVERE, Level.OFF };
-
- /**
- * Represents the HashMap that stores all the name space strings.
- * The keys are category names. The values are namespace strings.
- */
- private Map nameSpaceMap = new HashMap();
-
- /**
- * Stores the namespace for session, i.e."org.eclipse.persistence.session.<sessionname>".
- */
- private String sessionNameSpace;
-
- /**
- * Stores the Logger for session namespace, i.e. "org.eclipse.persistence.session.<sessionname>".
- */
- private Logger sessionLogger;
-
- private Map categoryloggers = new HashMap<String, Logger>();
-
- /**
- * INTERNAL:
- */
-
- public JavaLog(){
- super();
- addLogger(DEFAULT_TOPLINK_NAMESPACE, DEFAULT_TOPLINK_NAMESPACE);
- }
-
- /**
- * INTERNAL:
- * Add Logger to the catagoryloggers.
- */
- protected void addLogger(String loggerCategory, String loggerNameSpace) {
- categoryloggers.put(loggerCategory, Logger.getLogger(loggerNameSpace));
- }
-
- /**
- * INTERNAL:
- * Return catagoryloggers
- */
- public Map getCategoryLoggers() {
- return categoryloggers;
- }
-
- /**
- * PUBLIC:
- * <p>
- * Return the effective log level for the name space extracted from session and category.
- * If a Logger's level is set to be null then the Logger will use an effective Level that will
- * be obtained by walking up the parent tree and using the first non-null Level.
- * </p><p>
- *
- * @return the effective log level.
- * </p>
- */
- public int getLevel(String category) {
- Logger logger = getLogger(category);
- while ((logger != null) && (logger.getLevel() == null)) {
- logger = logger.getParent();
- }
-
- if (logger == null) {
- return OFF;
- }
-
- //For a given java.util.logging.Level, return the index (ie, TopLink logging level)
- int logLevel = logger.getLevel().intValue();
- for (int i = 0; i < levels.length ; i++) {
- if (logLevel == levels[i].intValue()) {
- return i;
- }
- }
- return OFF;
- }
-
- /**
- * PUBLIC:
- * <p>
- * Set the log level to a logger with name space extracted from the given category.
- * </p>
- */
- public void setLevel(final int level, String category) {
- final Logger logger = getLogger(category);
- if (logger == null) {
- return;
- }
-
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- logger.setLevel(getJavaLevel(level));
- return null; // nothing to return
- }
- });
- }
-
- /**
- * PUBLIC:
- * <p>
- * Set the output stream that will receive the formatted log entries.
- * </p><p>
- *
- * @param fileOutputStream the file output stream will receive the formatted log entries.
- * </p>
- */
- public void setWriter(OutputStream fileOutputStream){
- StreamHandler sh = new StreamHandler(fileOutputStream,new LogFormatter());
- ((Logger)categoryloggers.get(DEFAULT_TOPLINK_NAMESPACE)).addHandler(sh);
- if(sessionLogger!=null){
- sessionLogger.addHandler(sh);
- }
- }
-
- /**
- * INTERNAL:
- * Return the name space for the given category from the map.
- */
- protected String getNameSpaceString(String category) {
- if (session == null) {
- return DEFAULT_TOPLINK_NAMESPACE;
- } else if ((category == null) || (category.length() == 0)) {
- return sessionNameSpace;
- } else {
- return (String)nameSpaceMap.get(category);
- }
- }
-
- /**
- * INTERNAL:
- * Return the Logger for the given category
- */
- protected Logger getLogger(String category) {
- if (session == null) {
- return (Logger)categoryloggers.get(DEFAULT_TOPLINK_NAMESPACE);
- } else if ((category == null) || (category.length() == 0) || !this.categoryloggers.containsKey(category)) {
- return (Logger) categoryloggers.get(sessionNameSpace);
- } else {
- Logger logger = (Logger) categoryloggers.get(category);
- // If session != null, categoryloggers should have an entry for this category
- assert logger != null;
- return logger;
- }
- }
-
- /**
- * PUBLIC:
- * <p>
- * Set the session and session namespace.
- * </p>
- *
- * @param session a Session
- */
- public void setSession(Session session) {
- super.setSession(session);
- if (session != null) {
- String sessionName = session.getName();
- if ((sessionName != null) && (sessionName.length() != 0)) {
- sessionNameSpace = SESSION_TOPLINK_NAMESPACE + "." + sessionName;
- } else {
- sessionNameSpace = DEFAULT_TOPLINK_NAMESPACE;
- }
-
- //Initialize loggers eagerly
- addLogger(sessionNameSpace, sessionNameSpace);
- for (int i = 0; i < loggerCatagories.length; i++) {
- String loggerCategory = loggerCatagories[i];
- String loggerNameSpace = sessionNameSpace + "." + loggerCategory;
- nameSpaceMap.put(loggerCategory, loggerNameSpace);
- addLogger(loggerCategory, loggerNameSpace);
- }
- }
- }
-
- /**
- * INTERNAL:
- * Return the corresponding java.util.logging.Level for a given TopLink level.
- */
- protected Level getJavaLevel(int level) {
- return levels[level];
- }
-
- /**
- * PUBLIC:
- * <p>
- * Check if a message of the given level would actually be logged by the logger
- * with name space built from the given session and category.
- * Return the shouldLog for the given category from
- * </p><p>
- * @return true if the given message level will be logged
- * </p>
- */
- public boolean shouldLog(int level, String category) {
- Logger logger = getLogger(category);
- return logger.isLoggable(getJavaLevel(level));
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a SessionLogEntry
- * </p><p>
- * @param entry SessionLogEntry that holds all the information for a TopLink logging event
- * </p>
- */
- public void log(SessionLogEntry entry) {
- if (!shouldLog(entry.getLevel(), entry.getNameSpace())) {
- return;
- }
-
- Logger logger = getLogger(entry.getNameSpace());
- Level javaLevel = getJavaLevel(entry.getLevel());
-
- internalLog(entry, javaLevel, logger);
- }
-
- /**
- * INTERNAL:
- * <p>
- * Build a LogRecord
- * </p><p>
- * @param entry SessionLogEntry that holds all the information for a TopLink logging event
- * @param javaLevel the message level
- * </p>
- */
- protected void internalLog(SessionLogEntry entry, Level javaLevel, Logger logger) {
- // Format message so that we do not depend on the bundle
- EclipseLinkLogRecord lr = new EclipseLinkLogRecord(javaLevel, formatMessage(entry));
-
- lr.setSourceClassName(null);
- lr.setSourceMethodName(null);
- lr.setLoggerName(getNameSpaceString(entry.getNameSpace()));
- if (shouldPrintSession()) {
- lr.setSessionString(getSessionString(entry.getSession()));
- }
- if (shouldPrintConnection()) {
- lr.setConnection(entry.getConnection());
- }
- lr.setThrown(entry.getException());
- lr.setShouldLogExceptionStackTrace(shouldLogExceptionStackTrace());
- lr.setShouldPrintDate(shouldPrintDate());
- lr.setShouldPrintThread(shouldPrintThread());
- logger.log(lr);
- }
-
- /**
- * PUBLIC:
- * <p>
- * Log a throwable.
- * </p><p>
- * @param throwable a throwable
- * </p>
- */
- public void throwing(Throwable throwable) {
- getLogger(null).throwing(null, null, throwable);
- }
-
- /**
- * INTERNAL:
- * Each session owns its own session log because session is stored in the session log
- */
- public Object clone() {
- // There is no special treatment required for cloning here
- // The state of this object is described by member variables sessionLogger and categoryLoggers.
- // This state depends on session.
- // If session for the clone is going to be the same as session for this there is no
- // need to do "deep" cloning.
- // If not, the session being cloned should call setSession() on its JavaLog object to initialize it correctly.
- JavaLog cloneLog = (JavaLog)super.clone();
- return cloneLog;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 1998, 2016 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation from Oracle TopLink
+ ******************************************************************************/
+package org.eclipse.persistence.logging;
+
+
+import java.io.OutputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.logging.StreamHandler;
+
+import org.eclipse.persistence.sessions.Session;
+
+/**
+ * PUBLIC:
+ * <p>
+ * This is a wrapper class for java.util.logging. It is used when messages need to
+ * be logged through java.util.logging.
+ * </p>
+ * @see SessionLog
+ * @see AbstractSessionLog
+ * @see SessionLogEntry
+ * @see Session
+ */
+public class JavaLog extends AbstractSessionLog {
+
+ /**
+ * Stores the default session name in case there is the session name is missing.
+ */
+ public static final String TOPLINK_NAMESPACE = "org.eclipse.persistence";
+ protected static final String LOGGING_LOCALIZATION_STRING = "org.eclipse.persistence.internal.localization.i18n.LoggingLocalizationResource";
+ protected static final String TRACE_LOCALIZATION_STRING = "org.eclipse.persistence.internal.localization.i18n.TraceLocalizationResource";
+ public static final String DEFAULT_TOPLINK_NAMESPACE = TOPLINK_NAMESPACE + ".default";
+ public static final String SESSION_TOPLINK_NAMESPACE = TOPLINK_NAMESPACE + ".session";
+
+ /**
+ * Stores all the java.util.logging.Levels. The indexes are TopLink logging levels.
+ */
+ private static final Level[] levels = new Level[] { Level.ALL, Level.FINEST, Level.FINER, Level.FINE, Level.CONFIG, Level.INFO, Level.WARNING, Level.SEVERE, Level.OFF };
+
+ /**
+ * Represents the HashMap that stores all the name space strings.
+ * The keys are category names. The values are namespace strings.
+ */
+ private Map nameSpaceMap = new HashMap();
+
+ /**
+ * Stores the namespace for session, i.e."org.eclipse.persistence.session.<sessionname>".
+ */
+ private String sessionNameSpace;
+
+ /**
+ * Stores the Logger for session namespace, i.e. "org.eclipse.persistence.session.<sessionname>".
+ */
+ private Logger sessionLogger;
+
+ private Map categoryloggers = new HashMap<String, Logger>();
+
+ /**
+ * INTERNAL:
+ */
+
+ public JavaLog(){
+ super();
+ addLogger(DEFAULT_TOPLINK_NAMESPACE, DEFAULT_TOPLINK_NAMESPACE);
+ }
+
+ /**
+ * INTERNAL:
+ * Add Logger to the categoryloggers.
+ */
+ protected void addLogger(String loggerCategory, String loggerNameSpace) {
+ categoryloggers.put(loggerCategory, Logger.getLogger(loggerNameSpace));
+ }
+
+ /**
+ * INTERNAL:
+ * Return catagoryloggers
+ */
+ public Map getCategoryLoggers() {
+ return categoryloggers;
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Return the effective log level for the name space extracted from session and category.
+ * If a Logger's level is set to be null then the Logger will use an effective Level that will
+ * be obtained by walking up the parent tree and using the first non-null Level.
+ * </p><p>
+ *
+ * @return the effective log level.
+ * </p>
+ */
+ @Override
+ public int getLevel(String category) {
+ Logger logger = getLogger(category);
+ while ((logger != null) && (logger.getLevel() == null)) {
+ logger = logger.getParent();
+ }
+
+ if (logger == null) {
+ return OFF;
+ }
+
+ //For a given java.util.logging.Level, return the index (ie, TopLink logging level)
+ int logLevel = logger.getLevel().intValue();
+ for (int i = 0; i < levels.length ; i++) {
+ if (logLevel == levels[i].intValue()) {
+ return i;
+ }
+ }
+ return OFF;
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Set the log level to a logger with name space extracted from the given category.
+ * </p>
+ */
+ @Override
+ public void setLevel(final int level, String category) {
+ final Logger logger = getLogger(category);
+ if (logger == null) {
+ return;
+ }
+
+ AccessController.doPrivileged(new PrivilegedAction() {
+ @Override
+ public Object run() {
+ logger.setLevel(getJavaLevel(level));
+ return null; // nothing to return
+ }
+ });
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Set the output stream that will receive the formatted log entries.
+ * </p><p>
+ *
+ * @param fileOutputStream the file output stream will receive the formatted log entries.
+ * </p>
+ */
+ @Override
+ public void setWriter(OutputStream fileOutputStream){
+ StreamHandler sh = new StreamHandler(fileOutputStream,new LogFormatter());
+ ((Logger)categoryloggers.get(DEFAULT_TOPLINK_NAMESPACE)).addHandler(sh);
+ if(sessionLogger!=null){
+ sessionLogger.addHandler(sh);
+ }
+ }
+
+ /**
+ * INTERNAL:
+ * Return the name space for the given category from the map.
+ */
+ protected String getNameSpaceString(String category) {
+ if (session == null) {
+ return DEFAULT_TOPLINK_NAMESPACE;
+ } else if ((category == null) || (category.length() == 0)) {
+ return sessionNameSpace;
+ } else {
+ return (String)nameSpaceMap.get(category);
+ }
+ }
+
+ /**
+ * INTERNAL:
+ * Return the Logger for the given category
+ */
+ protected Logger getLogger(String category) {
+ if (session == null) {
+ return (Logger)categoryloggers.get(DEFAULT_TOPLINK_NAMESPACE);
+ } else if ((category == null) || (category.length() == 0) || !this.categoryloggers.containsKey(category)) {
+ return (Logger) categoryloggers.get(sessionNameSpace);
+ } else {
+ Logger logger = (Logger) categoryloggers.get(category);
+ // If session != null, categoryloggers should have an entry for this category
+ assert logger != null;
+ return logger;
+ }
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Set the session and session namespace.
+ * </p>
+ *
+ * @param session a Session
+ */
+ @Override
+ public void setSession(Session session) {
+ super.setSession(session);
+ if (session != null) {
+ String sessionName = session.getName();
+ if ((sessionName != null) && (sessionName.length() != 0)) {
+ sessionNameSpace = SESSION_TOPLINK_NAMESPACE + "." + sessionName;
+ } else {
+ sessionNameSpace = DEFAULT_TOPLINK_NAMESPACE;
+ }
+
+ //Initialize loggers eagerly
+ addLogger(sessionNameSpace, sessionNameSpace);
+ for (int i = 0; i < loggerCatagories.length; i++) {
+ String loggerCategory = loggerCatagories[i];
+ String loggerNameSpace = sessionNameSpace + "." + loggerCategory;
+ nameSpaceMap.put(loggerCategory, loggerNameSpace);
+ addLogger(loggerCategory, loggerNameSpace);
+ }
+ }
+ }
+
+ /**
+ * INTERNAL:
+ * Return the corresponding java.util.logging.Level for a given TopLink level.
+ */
+ protected Level getJavaLevel(int level) {
+ return levels[level];
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Check if a message of the given level would actually be logged by the logger
+ * with name space built from the given session and category.
+ * Return the shouldLog for the given category from
+ * </p><p>
+ * @return true if the given message level will be logged
+ * </p>
+ */
+ @Override
+ public boolean shouldLog(int level, String category) {
+ Logger logger = getLogger(category);
+ return logger.isLoggable(getJavaLevel(level));
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a SessionLogEntry
+ * </p><p>
+ * @param entry SessionLogEntry that holds all the information for a TopLink logging event
+ * </p>
+ */
+ @Override
+ public void log(SessionLogEntry entry) {
+ if (!shouldLog(entry.getLevel(), entry.getNameSpace())) {
+ return;
+ }
+
+ Logger logger = getLogger(entry.getNameSpace());
+ Level javaLevel = getJavaLevel(entry.getLevel());
+
+ internalLog(entry, javaLevel, logger);
+ }
+
+ /**
+ * INTERNAL:
+ * <p>
+ * Build a LogRecord
+ * </p><p>
+ * @param entry SessionLogEntry that holds all the information for a TopLink logging event
+ * @param javaLevel the message level
+ * </p>
+ */
+ protected void internalLog(SessionLogEntry entry, Level javaLevel, Logger logger) {
+ // Format message so that we do not depend on the bundle
+ EclipseLinkLogRecord lr = new EclipseLinkLogRecord(javaLevel, formatMessage(entry));
+
+ lr.setSourceClassName(entry.getSourceClassName());
+ lr.setSourceMethodName(entry.getSourceMethodName());
+ lr.setLoggerName(getNameSpaceString(entry.getNameSpace()));
+ if (shouldPrintSession()) {
+ lr.setSessionString(getSessionString(entry.getSession()));
+ }
+ if (shouldPrintConnection()) {
+ lr.setConnection(entry.getConnection());
+ }
+ lr.setThrown(entry.getException());
+ lr.setShouldLogExceptionStackTrace(shouldLogExceptionStackTrace());
+ lr.setShouldPrintDate(shouldPrintDate());
+ lr.setShouldPrintThread(shouldPrintThread());
+ logger.log(lr);
+ }
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Log a throwable.
+ * </p><p>
+ * @param throwable a throwable
+ * </p>
+ */
+ @Override
+ public void throwing(Throwable throwable) {
+ getLogger(null).throwing(null, null, throwable);
+ }
+
+ /**
+ * INTERNAL:
+ * Each session owns its own session log because session is stored in the session log
+ */
+ @Override
+ public Object clone() {
+ // There is no special treatment required for cloning here
+ // The state of this object is described by member variables sessionLogger and categoryLoggers.
+ // This state depends on session.
+ // If session for the clone is going to be the same as session for this there is no
+ // need to do "deep" cloning.
+ // If not, the session being cloned should call setSession() on its JavaLog object to initialize it correctly.
+ JavaLog cloneLog = (JavaLog)super.clone();
+ return cloneLog;
+ }
+}
diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/SessionLog.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/SessionLog.java
index 237a4cd..c309d31 100644
--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/SessionLog.java
+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/SessionLog.java
@@ -1,784 +1,796 @@
-/*******************************************************************************
- * Copyright (c) 1998, 2014 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation from Oracle TopLink
- ******************************************************************************/
-package org.eclipse.persistence.logging;
-
-import java.io.Writer;
-import org.eclipse.persistence.sessions.Session;
-
-/**
- * SessionLog is the ever-so-simple interface used by
- * EclipseLink to log generated messages and SQL. An implementor of
- * this interface can be passed to the EclipseLink session
- * (via the #setSessionLog(SessionLog) method); and
- * all logging data will be passed through to the implementor
- * via an instance of SessionLogEntry. This can be used
- * to supplement debugging; or the entries could be stored
- * in a database instead of logged to System.out, etc.
- * <p>
- * This class defines Eclipselink logging levels (that are used throughout EclipseLink code) with the following integer values:
+/*******************************************************************************
+ * Copyright (c) 1998, 2016 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation from Oracle TopLink
+ ******************************************************************************/
+package org.eclipse.persistence.logging;
+
+import java.io.Writer;
+
+import org.eclipse.persistence.sessions.Session;
+
+/**
+ * SessionLog is the ever-so-simple interface used by
+ * EclipseLink to log generated messages and SQL. An implementor of
+ * this interface can be passed to the EclipseLink session
+ * (via the #setSessionLog(SessionLog) method); and
+ * all logging data will be passed through to the implementor
+ * via an instance of SessionLogEntry. This can be used
+ * to supplement debugging; or the entries could be stored
+ * in a database instead of logged to System.out, etc.
+ * <p>
+ * This class defines Eclipselink logging levels (that are used throughout EclipseLink code) with the following integer values:
* <table summary="">
- * <tr><td> </td><td>ALL</td> <td> </td><td>= 0</td></tr>
- * <tr><td> </td><td>FINEST</td> <td> </td><td>= 1</td></tr>
- * <tr><td> </td><td>FINER</td> <td> </td><td>= 2</td></tr>
- * <tr><td> </td><td>FINE</td> <td> </td><td>= 3</td></tr>
- * <tr><td> </td><td>CONFIG</td> <td> </td><td>= 4</td></tr>
- * <tr><td> </td><td>INFO</td> <td> </td><td>= 5</td></tr>
- * <tr><td> </td><td>WARNING</td><td> </td><td>= 6</td></tr>
- * <tr><td> </td><td>SEVERE</td> <td> </td><td>= 7</td></tr>
- * <tr><td> </td><td>OFF</td> <td> </td><td>= 8</td></tr>
- * </table>
- * <p>
- * In addition, EclipseLink categories used for logging name space are defined with the following String values:
+ * <tr><td> </td><td>ALL</td> <td> </td><td>= 0</td></tr>
+ * <tr><td> </td><td>FINEST</td> <td> </td><td>= 1</td></tr>
+ * <tr><td> </td><td>FINER</td> <td> </td><td>= 2</td></tr>
+ * <tr><td> </td><td>FINE</td> <td> </td><td>= 3</td></tr>
+ * <tr><td> </td><td>CONFIG</td> <td> </td><td>= 4</td></tr>
+ * <tr><td> </td><td>INFO</td> <td> </td><td>= 5</td></tr>
+ * <tr><td> </td><td>WARNING</td><td> </td><td>= 6</td></tr>
+ * <tr><td> </td><td>SEVERE</td> <td> </td><td>= 7</td></tr>
+ * <tr><td> </td><td>OFF</td> <td> </td><td>= 8</td></tr>
+ * </table>
+ * <p>
+ * In addition, EclipseLink categories used for logging name space are defined with the following String values:
* <table summary="">
- * <tr><td> </td><td>{@link #SQL}</td> <td> </td><td>= {@value #SQL}</td></tr>
- * <tr><td> </td><td>{@link #TRANSACTION}</td> <td> </td><td>= {@value #TRANSACTION}</td></tr>
- * <tr><td> </td><td>{@link #EVENT}</td> <td> </td><td>= {@value #EVENT}</td></tr>
- * <tr><td> </td><td>{@link #CONNECTION}</td> <td> </td><td>= {@value #CONNECTION}</td></tr>
- * <tr><td> </td><td>{@link #QUERY}</td> <td> </td><td>= {@value #QUERY}</td></tr>
- * <tr><td> </td><td>{@link #CACHE}</td> <td> </td><td>= {@value #CACHE}</td></tr>
- * <tr><td> </td><td>{@link #PROPAGATION}</td> <td> </td><td>= {@value #PROPAGATION}</td></tr>
- * <tr><td> </td><td>{@link #SEQUENCING}</td> <td> </td><td>= {@value #SEQUENCING}</td></tr>
- * <tr><td> </td><td>{@link #EJB}</td> <td> </td><td>= {@value #EJB}</td></tr>
- * <tr><td> </td><td>{@link #DMS}</td> <td> </td><td>= {@value #DMS}</td></tr>
- * <tr><td> </td><td>{@link #METADATA}</td><td> </td><td>= {@value #METADATA} </td></tr>
- * <tr><td> </td><td>{@link #METAMODEL}</td><td> </td><td>= {@value #METAMODEL}</td></tr>
- * <tr><td> </td><td>{@link #WEAVER}</td> <td> </td><td>= {@value #WEAVER}</td></tr>
- * <tr><td> </td><td>{@link #PROPERTIES}</td> <td> </td><td>= {@value #PROPERTIES}</td></tr>
- * <tr><td> </td><td>{@link #SERVER}</td> <td> </td><td>= {@value #SERVER}</td></tr>
- * </table>
- *
- * @see AbstractSessionLog
- * @see SessionLogEntry
- * @see Session
- *
- * @since TOPLink/Java 3.0
- */
-public interface SessionLog extends Cloneable {
- //EclipseLink log levels. They are mapped to java.util.logging.Level values
- public static final int OFF = 8;
- public static final String OFF_LABEL = "OFF";
-
- //EL is not in a state to continue
- public static final int SEVERE = 7;
- public static final String SEVERE_LABEL = "SEVERE";
-
- //Exceptions that don't force a stop
- public static final int WARNING = 6;
- public static final String WARNING_LABEL = "WARNING";
-
- //Login and logout per server session with name
- public static final int INFO = 5;
- public static final String INFO_LABEL = "INFO";
-
- //Configuration info
- public static final int CONFIG = 4;
- public static final String CONFIG_LABEL = "CONFIG";
-
- //SQL
- public static final int FINE = 3;
- public static final String FINE_LABEL = "FINE";
-
- //Previously logged under logMessage and stack trace of exceptions at WARNING level
- public static final int FINER = 2;
- public static final String FINER_LABEL = "FINER";
-
- //Previously logged under logDebug
- public static final int FINEST = 1;
- public static final String FINEST_LABEL = "FINEST";
- public static final int ALL = 0;
- public static final String ALL_LABEL = "ALL";
-
- //EclipseLink categories used for logging name space.
- public static final String SQL = "sql";
- public static final String TRANSACTION = "transaction";
- public static final String EVENT = "event";
- public static final String CONNECTION = "connection";
- public static final String QUERY = "query";
- public static final String CACHE = "cache";
- public static final String PROPAGATION = "propagation";
- public static final String SEQUENCING = "sequencing";
- public static final String JPA = "jpa";
- public static final String EJB = "ejb";
- public static final String DMS = "dms";
- public static final String METADATA = "metadata";
- public static final String MONITORING = "monitoring";
- public static final String MISC = "misc";
-
- /**
- * @deprecated use {@link #METADATA}
- */
- @Deprecated
- public static final String EJB_OR_METADATA = METADATA;
- public static final String METAMODEL = "metamodel";
- public static final String WEAVER = "weaver";
- public static final String PROPERTIES = "properties";
- public static final String SERVER = "server";
- public static final String DDL = "ddl";
- public static final String JPARS = "jpars";
-
- public final String[] loggerCatagories = new String[] {
- SQL,
- TRANSACTION,
- EVENT,
- CONNECTION,
- QUERY,
- CACHE,
- PROPAGATION,
- SEQUENCING,
- JPA,
- EJB,
- DMS,
- METADATA,
- MONITORING,
- METAMODEL,
- WEAVER,
- PROPERTIES,
- SERVER,
- DDL,
- JPARS
- };
-
- /**
- * PUBLIC:
- * EclipseLink will call this method whenever something
- * needs to be logged (messages, SQL, etc.).
- * All the pertinent information will be contained in
- * the specified entry.
- *
- * @param entry org.eclipse.persistence.sessions.LogEntry
- */
- public void log(SessionLogEntry entry);
-
- /**
- * By default the stack trace is logged for SEVERE all the time and at FINER level for WARNING or less,
- * this can be turned off.
- */
- public boolean shouldLogExceptionStackTrace();
-
- /**
- * By default the date is always printed, this can be turned off.
- */
- public boolean shouldPrintDate();
-
- /**
- * By default the thread is logged at FINE or less level, this can be turned off.
- */
- public boolean shouldPrintThread();
-
- /**
- * Return whether bind parameters should be displayed when logging SQL, default is true.
- */
- public boolean shouldDisplayData();
-
- /**
- * By default the connection is always printed whenever available, this can be turned off.
- */
- public boolean shouldPrintConnection();
-
- /**
- * By default the Session is always printed whenever available, this can be turned off.
- */
- public boolean shouldPrintSession();
-
- /**
- * Set whether bind parameters should be displayed when logging SQL.
- */
- public void setShouldDisplayData(Boolean shouldDisplayData);
-
- /**
- * By default stack trace is logged for SEVERE all the time and at FINER level for WARNING or less.
- * This can be turned off.
- */
- public void setShouldLogExceptionStackTrace(boolean flag);
-
- /**
- * By default date is printed, this can be turned off.
- */
- public void setShouldPrintDate(boolean flag);
-
- /**
- * By default the thread is logged at FINE or less level, this can be turned off.
- */
- public void setShouldPrintThread(boolean flag);
-
- /**
- * By default the connection is always printed whenever available, this can be turned off.
- */
- public void setShouldPrintConnection(boolean flag);
-
- /**
- * By default the Session is always printed whenever available, this can be turned off.
- */
- public void setShouldPrintSession(boolean flag);
-
- /**
- * PUBLIC:
- * Return the writer to which an accessor writes logged messages and SQL.
- * If not set, this reference usually defaults to a writer on System.out.
- * To enable logging, logMessages must be turned on in the session.
- */
- public Writer getWriter();
-
- /**
- * PUBLIC:
- * Set the writer to which an accessor writes logged messages and SQL.
- * If not set, this reference usually defaults to a writer on System.out.
- * To enable logging, logMessages() is used on the session.
- */
- public void setWriter(Writer log);
-
- /**
- * PUBLIC:
- * Return the log level. Used when session is not available.
- * <p>
- * The EclipseLink logging levels returned correspond to:<br>
+ * <tr><td> </td><td>{@link #CACHE}</td> <td> </td><td>= {@value #CACHE}</td></tr>
+ * <tr><td> </td><td>{@link #CONNECTION}</td> <td> </td><td>= {@value #CONNECTION}</td></tr>
+ * <tr><td> </td><td>{@link #DMS}</td> <td> </td><td>= {@value #DMS}</td></tr>
+ * <tr><td> </td><td>{@link #EJB}</td> <td> </td><td>= {@value #EJB}</td></tr>
+ * <tr><td> </td><td>{@link #EVENT}</td> <td> </td><td>= {@value #EVENT}</td></tr>
+ * <tr><td> </td><td>{@link #JPARS}</td> <td> </td><td>= {@value #JPARS}</td></tr>
+ * <tr><td> </td><td>{@link #METADATA}</td> <td> </td><td>= {@value #METADATA} </td></tr>
+ * <tr><td> </td><td>{@link #METAMODEL}</td> <td> </td><td>= {@value #METAMODEL}</td></tr>
+ * <tr><td> </td><td>{@link #MOXY}</td> <td> </td><td>= {@value #MOXY}</td></tr>
+ * <tr><td> </td><td>{@link #PROPAGATION}</td> <td> </td><td>= {@value #PROPAGATION}</td></tr>
+ * <tr><td> </td><td>{@link #PROPERTIES}</td> <td> </td><td>= {@value #PROPERTIES}</td></tr>
+ * <tr><td> </td><td>{@link #QUERY}</td> <td> </td><td>= {@value #QUERY}</td></tr>
+ * <tr><td> </td><td>{@link #SEQUENCING}</td> <td> </td><td>= {@value #SEQUENCING}</td></tr>
+ * <tr><td> </td><td>{@link #SERVER}</td> <td> </td><td>= {@value #SERVER}</td></tr>
+ * <tr><td> </td><td>{@link #SQL}</td> <td> </td><td>= {@value #SQL}</td></tr>
+ * <tr><td> </td><td>{@link #TRANSACTION}</td> <td> </td><td>= {@value #TRANSACTION}</td></tr>
+ * <tr><td> </td><td>{@link #WEAVER}</td> <td> </td><td>= {@value #WEAVER}</td></tr>
+ * </table>
+ *
+ * @see AbstractSessionLog
+ * @see SessionLogEntry
+ * @see Session
+ *
+ * @since TOPLink/Java 3.0
+ */
+public interface SessionLog extends Cloneable {
+ //EclipseLink log levels. They are mapped to java.util.logging.Level values
+ public static final int OFF = 8;
+ public static final String OFF_LABEL = "OFF";
+
+ //EL is not in a state to continue
+ public static final int SEVERE = 7;
+ public static final String SEVERE_LABEL = "SEVERE";
+
+ //Exceptions that don't force a stop
+ public static final int WARNING = 6;
+ public static final String WARNING_LABEL = "WARNING";
+
+ //Login and logout per server session with name
+ public static final int INFO = 5;
+ public static final String INFO_LABEL = "INFO";
+
+ //Configuration info
+ public static final int CONFIG = 4;
+ public static final String CONFIG_LABEL = "CONFIG";
+
+ //SQL
+ public static final int FINE = 3;
+ public static final String FINE_LABEL = "FINE";
+
+ //Previously logged under logMessage and stack trace of exceptions at WARNING level
+ public static final int FINER = 2;
+ public static final String FINER_LABEL = "FINER";
+
+ //Previously logged under logDebug
+ public static final int FINEST = 1;
+ public static final String FINEST_LABEL = "FINEST";
+ public static final int ALL = 0;
+ public static final String ALL_LABEL = "ALL";
+
+ //EclipseLink categories used for logging name space.
+ public static final String SQL = "sql";
+ public static final String TRANSACTION = "transaction";
+ public static final String EVENT = "event";
+ public static final String CONNECTION = "connection";
+ public static final String QUERY = "query";
+ public static final String CACHE = "cache";
+ public static final String PROPAGATION = "propagation";
+ public static final String SEQUENCING = "sequencing";
+ public static final String JPA = "jpa";
+ public static final String EJB = "ejb";
+ public static final String DMS = "dms";
+ public static final String METADATA = "metadata";
+ public static final String MONITORING = "monitoring";
+ public static final String MISC = "misc";
+ public static final String MOXY = "moxy";
+
+ /**
+ * @deprecated use {@link #METADATA}
+ */
+ @Deprecated
+ public static final String EJB_OR_METADATA = METADATA;
+ public static final String METAMODEL = "metamodel";
+ public static final String WEAVER = "weaver";
+ public static final String PROPERTIES = "properties";
+ public static final String SERVER = "server";
+ public static final String DDL = "ddl";
+ public static final String JPARS = "jpars";
+
+ public final String[] loggerCatagories = new String[] {
+ SQL,
+ TRANSACTION,
+ EVENT,
+ CONNECTION,
+ QUERY,
+ CACHE,
+ PROPAGATION,
+ SEQUENCING,
+ JPA,
+ JPARS,
+ EJB,
+ DMS,
+ METADATA,
+ MONITORING,
+ MOXY,
+ METAMODEL,
+ WEAVER,
+ PROPERTIES,
+ SERVER,
+ DDL,
+ JPARS
+ };
+
+ /**
+ * PUBLIC:
+ * EclipseLink will call this method whenever something
+ * needs to be logged (messages, SQL, etc.).
+ * All the pertinent information will be contained in
+ * the specified entry.
+ *
+ * @param entry org.eclipse.persistence.sessions.LogEntry
+ */
+ public void log(SessionLogEntry entry);
+
+ /**
+ * By default the stack trace is logged for SEVERE all the time and at FINER level for WARNING or less,
+ * this can be turned off.
+ */
+ public boolean shouldLogExceptionStackTrace();
+
+ /**
+ * By default the date is always printed, this can be turned off.
+ */
+ public boolean shouldPrintDate();
+
+ /**
+ * By default the thread is logged at FINE or less level, this can be turned off.
+ */
+ public boolean shouldPrintThread();
+
+ /**
+ * Return whether bind parameters should be displayed when logging SQL, default is true.
+ */
+ public boolean shouldDisplayData();
+
+ /**
+ * By default the connection is always printed whenever available, this can be turned off.
+ */
+ public boolean shouldPrintConnection();
+
+ /**
+ * By default the Session is always printed whenever available, this can be turned off.
+ */
+ public boolean shouldPrintSession();
+
+ /**
+ * Set whether bind parameters should be displayed when logging SQL.
+ */
+ public void setShouldDisplayData(Boolean shouldDisplayData);
+
+ /**
+ * By default stack trace is logged for SEVERE all the time and at FINER level for WARNING or less.
+ * This can be turned off.
+ */
+ public void setShouldLogExceptionStackTrace(boolean flag);
+
+ /**
+ * By default date is printed, this can be turned off.
+ */
+ public void setShouldPrintDate(boolean flag);
+
+ /**
+ * By default the thread is logged at FINE or less level, this can be turned off.
+ */
+ public void setShouldPrintThread(boolean flag);
+
+ /**
+ * By default the connection is always printed whenever available, this can be turned off.
+ */
+ public void setShouldPrintConnection(boolean flag);
+
+ /**
+ * By default the Session is always printed whenever available, this can be turned off.
+ */
+ public void setShouldPrintSession(boolean flag);
+
+ /**
+ * PUBLIC:
+ * Return the writer to which an accessor writes logged messages and SQL.
+ * If not set, this reference usually defaults to a writer on System.out.
+ * To enable logging, logMessages must be turned on in the session.
+ */
+ public Writer getWriter();
+
+ /**
+ * PUBLIC:
+ * Set the writer to which an accessor writes logged messages and SQL.
+ * If not set, this reference usually defaults to a writer on System.out.
+ * To enable logging, logMessages() is used on the session.
+ */
+ public void setWriter(Writer log);
+
+ /**
+ * PUBLIC:
+ * Return the log level. Used when session is not available.
+ * <p>
+ * The EclipseLink logging levels returned correspond to:<br>
* <table summary="">
- * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
- * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
- * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
- * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
- * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
- * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
- * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
- * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
- * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
- * </table>
- */
- public int getLevel();
-
- /**
- * PUBLIC:
- * <p>
- * Return the log level as a string value.
- */
- public String getLevelString();
-
- /**
- * PUBLIC:
- * Return the log level; category is only needed where name space
- * is available.
- * <p>
- * The EclipseLink logging levels returned correspond to:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public int getLevel();
+
+ /**
+ * PUBLIC:
+ * <p>
+ * Return the log level as a string value.
+ */
+ public String getLevelString();
+
+ /**
+ * PUBLIC:
+ * Return the log level; category is only needed where name space
+ * is available.
+ * <p>
+ * The EclipseLink logging levels returned correspond to:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td></tr>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td></tr>
- * <tr><td>FINER</td> <td> </td><td>= 2</td></tr>
- * <tr><td>FINE</td> <td> </td><td>= 3</td></tr>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td></tr>
- * <tr><td>INFO</td> <td> </td><td>= 5</td></tr>
- * <tr><td>WARNING</td><td> </td><td>= 6</td></tr>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td></tr>
- * <tr><td>OFF</td> <td> </td><td>= 8</td></tr>
- * </table>
- * <p>
- * The EclipseLink categories for the logging name space are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ * <p>
+ * The EclipseLink categories for the logging name space are:<br>
* <table summary="">
- * <tr><td> </td><td>SQL</td> <td> </td><td>= "sql"</td></tr>
- * <tr><td> </td><td>TRANSACTION</td> <td> </td><td>= "transaction"</td></tr>
- * <tr><td> </td><td>EVENT</td> <td> </td><td>= "event"</td></tr>
- * <tr><td> </td><td>CONNECTION</td> <td> </td><td>= "connection"</td></tr>
- * <tr><td> </td><td>QUERY</td> <td> </td><td>= "query"</td></tr>
- * <tr><td> </td><td>CACHE</td> <td> </td><td>= "cache"</td></tr>
- * <tr><td> </td><td>PROPAGATION</td> <td> </td><td>= "propagation"</td></tr>
- * <tr><td> </td><td>SEQUENCING</td> <td> </td><td>= "sequencing"</td></tr>
- * <tr><td> </td><td>EJB</td> <td> </td><td>= "ejb"</td></tr>
- * <tr><td> </td><td>DMS</td> <td> </td><td>= "dms"</td></tr>
- * <tr><td> </td><td>EJB_OR_METADATA</td><td> </td><td>= "ejb_or_metadata"</td></tr>
- * <tr><td> </td><td>METAMODEL</td><td> </td><td>= "metamodel"</td></tr>
- * <tr><td> </td><td>WEAVER</td> <td> </td><td>= "weaver"</td></tr>
- * <tr><td> </td><td>PROPERTIES</td> <td> </td><td>= "properties"</td></tr>
- * <tr><td> </td><td>SERVER</td> <td> </td><td>= "server"</td></tr>
- * </table>
- */
- public int getLevel(String category);
-
- /**
- * PUBLIC:
- * Set the log level. Used when session is not available.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td> </td><td>{@link #CACHE}</td> <td> </td><td>= {@value #CACHE}</td></tr>
+ * <tr><td> </td><td>{@link #CONNECTION}</td> <td> </td><td>= {@value #CONNECTION}</td></tr>
+ * <tr><td> </td><td>{@link #DMS}</td> <td> </td><td>= {@value #DMS}</td></tr>
+ * <tr><td> </td><td>{@link #EJB}</td> <td> </td><td>= {@value #EJB}</td></tr>
+ * <tr><td> </td><td>{@link #EJB_OR_METADATA}</td> <td> </td><td>= {@value #EJB_OR_METADATA}</td></tr>
+ * <tr><td> </td><td>{@link #EVENT}</td> <td> </td><td>= {@value #EVENT}</td></tr>
+ * <tr><td> </td><td>{@link #JPARS}</td> <td> </td><td>= {@value #JPARS}</td></tr>
+ * <tr><td> </td><td>{@link #METAMODEL}</td> <td> </td><td>= {@value #METAMODEL}</td></tr>
+ * <tr><td> </td><td>{@link #MOXY}</td> <td> </td><td>= {@value #MOXY}</td></tr>
+ * <tr><td> </td><td>{@link #PROPAGATION}</td> <td> </td><td>= {@value #PROPAGATION}</td></tr>
+ * <tr><td> </td><td>{@link #PROPERTIES}</td> <td> </td><td>= {@value #PROPERTIES}</td></tr>
+ * <tr><td> </td><td>{@link #QUERY}</td> <td> </td><td>= {@value #QUERY}</td></tr>
+ * <tr><td> </td><td>{@link #SEQUENCING}</td> <td> </td><td>= {@value #SEQUENCING}</td></tr>
+ * <tr><td> </td><td>{@link #SERVER}</td> <td> </td><td>= {@value #SERVER}</td></tr>
+ * <tr><td> </td><td>{@link #SQL}</td> <td> </td><td>= {@value #SQL}</td></tr>
+ * <tr><td> </td><td>{@link #TRANSACTION}</td> <td> </td><td>= {@value #TRANSACTION}</td></tr>
+ * <tr><td> </td><td>{@link #WEAVER}</td> <td> </td><td>= {@value #WEAVER}</td></tr>
+ * </table>
+ */
+ public int getLevel(String category);
+
+ /**
+ * PUBLIC:
+ * Set the log level. Used when session is not available.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public void setLevel(int level);
-
- /**
- * PUBLIC:
- * Set the log level. Category is only needed where name space
- * is available.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void setLevel(int level);
+
+ /**
+ * PUBLIC:
+ * Set the log level. Category is only needed where name space
+ * is available.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- * <p>
- * The EclipseLink categories for logging name space are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ * <p>
+ * The EclipseLink categories for the logging name space are:<br>
* <table summary="">
- * <tr><td> </td><td>SQL</td> <td> </td><td>= "sql"</td></tr>
- * <tr><td> </td><td>TRANSACTION</td> <td> </td><td>= "transaction"</td></tr>
- * <tr><td> </td><td>EVENT</td> <td> </td><td>= "event"</td></tr>
- * <tr><td> </td><td>CONNECTION</td> <td> </td><td>= "connection"</td></tr>
- * <tr><td> </td><td>QUERY</td> <td> </td><td>= "query"</td></tr>
- * <tr><td> </td><td>CACHE</td> <td> </td><td>= "cache"</td></tr>
- * <tr><td> </td><td>PROPAGATION</td> <td> </td><td>= "propagation"</td></tr>
- * <tr><td> </td><td>SEQUENCING</td> <td> </td><td>= "sequencing"</td></tr>
- * <tr><td> </td><td>EJB</td> <td> </td><td>= "ejb"</td></tr>
- * <tr><td> </td><td>DMS</td> <td> </td><td>= "dms"</td></tr>
- * <tr><td> </td><td>EJB_OR_METADATA</td><td> </td><td>= "ejb_or_metadata"</td></tr>
- * <tr><td> </td><td>METAMODEL</td><td> </td><td>= "metamodel"</td></tr>
- * <tr><td> </td><td>WEAVER</td> <td> </td><td>= "weaver"</td></tr>
- * <tr><td> </td><td>PROPERTIES</td> <td> </td><td>= "properties"</td></tr>
- * <tr><td> </td><td>SERVER</td> <td> </td><td>= "server"</td></tr>
- * </table>
- */
- public void setLevel(int level, String category);
-
- /**
- * PUBLIC:
- * Check if a message of the given level would actually be logged.
- * Used when session is not available.
- * <p>
- * The EclipseLink logging levels available are:
+ * <tr><td> </td><td>{@link #CACHE}</td> <td> </td><td>= {@value #CACHE}</td></tr>
+ * <tr><td> </td><td>{@link #CONNECTION}</td> <td> </td><td>= {@value #CONNECTION}</td></tr>
+ * <tr><td> </td><td>{@link #DMS}</td> <td> </td><td>= {@value #DMS}</td></tr>
+ * <tr><td> </td><td>{@link #EJB}</td> <td> </td><td>= {@value #EJB}</td></tr>
+ * <tr><td> </td><td>{@link #EJB_OR_METADATA}</td> <td> </td><td>= {@value #EJB_OR_METADATA}</td></tr>
+ * <tr><td> </td><td>{@link #EVENT}</td> <td> </td><td>= {@value #EVENT}</td></tr>
+ * <tr><td> </td><td>{@link #JPARS}</td> <td> </td><td>= {@value #JPARS}</td></tr>
+ * <tr><td> </td><td>{@link #METAMODEL}</td> <td> </td><td>= {@value #METAMODEL}</td></tr>
+ * <tr><td> </td><td>{@link #MOXY}</td> <td> </td><td>= {@value #MOXY}</td></tr>
+ * <tr><td> </td><td>{@link #PROPAGATION}</td> <td> </td><td>= {@value #PROPAGATION}</td></tr>
+ * <tr><td> </td><td>{@link #PROPERTIES}</td> <td> </td><td>= {@value #PROPERTIES}</td></tr>
+ * <tr><td> </td><td>{@link #QUERY}</td> <td> </td><td>= {@value #QUERY}</td></tr>
+ * <tr><td> </td><td>{@link #SEQUENCING}</td> <td> </td><td>= {@value #SEQUENCING}</td></tr>
+ * <tr><td> </td><td>{@link #SERVER}</td> <td> </td><td>= {@value #SERVER}</td></tr>
+ * <tr><td> </td><td>{@link #SQL}</td> <td> </td><td>= {@value #SQL}</td></tr>
+ * <tr><td> </td><td>{@link #TRANSACTION}</td> <td> </td><td>= {@value #TRANSACTION}</td></tr>
+ * <tr><td> </td><td>{@link #WEAVER}</td> <td> </td><td>= {@value #WEAVER}</td></tr>
+ * </table>
+ */
+ public void setLevel(int level, String category);
+
+ /**
+ * PUBLIC:
+ * Check if a message of the given level would actually be logged.
+ * Used when session is not available.
+ * <p>
+ * The EclipseLink logging levels available are:
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public boolean shouldLog(int level);
-
- /**
- * PUBLIC:
- * Check if a message of the given level would actually be logged.
- * Category is only needed where name space is available.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public boolean shouldLog(int level);
+
+ /**
+ * PUBLIC:
+ * Check if a message of the given level would actually be logged.
+ * Category is only needed where name space is available.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- * <p>
- * The EclipseLink categories for logging name space are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ * <p>
+ * The EclipseLink categories for the logging name space are:<br>
* <table summary="">
- * <tr><td> </td><td>SQL</td> <td> </td><td>= "sql"</td></tr>
- * <tr><td> </td><td>TRANSACTION</td> <td> </td><td>= "transaction"</td></tr>
- * <tr><td> </td><td>EVENT</td> <td> </td><td>= "event"</td></tr>
- * <tr><td> </td><td>CONNECTION</td> <td> </td><td>= "connection"</td></tr>
- * <tr><td> </td><td>QUERY</td> <td> </td><td>= "query"</td></tr>
- * <tr><td> </td><td>CACHE</td> <td> </td><td>= "cache"</td></tr>
- * <tr><td> </td><td>PROPAGATION</td> <td> </td><td>= "propagation"</td></tr>
- * <tr><td> </td><td>SEQUENCING</td> <td> </td><td>= "sequencing"</td></tr>
- * <tr><td> </td><td>EJB</td> <td> </td><td>= "ejb"</td></tr>
- * <tr><td> </td><td>DMS</td> <td> </td><td>= "dms"</td></tr>
- * <tr><td> </td><td>EJB_OR_METADATA</td><td> </td><td>= "ejb_or_metadata"</td></tr>
- * <tr><td> </td><td>METAMODEL</td><td> </td><td>= "metamodel"</td></tr>
- * <tr><td> </td><td>WEAVER</td> <td> </td><td>= "weaver"</td></tr>
- * <tr><td> </td><td>PROPERTIES</td> <td> </td><td>= "properties"</td></tr>
- * <tr><td> </td><td>SERVER</td> <td> </td><td>= "server"</td></tr>
- * </table>
- */
- public boolean shouldLog(int level, String category);
-
- /**
- * PUBLIC:
- * Log a message that does not need to be translated. This method is intended for
- * external use when logging messages are wanted within the EclipseLink output.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td> </td><td>{@link #CACHE}</td> <td> </td><td>= {@value #CACHE}</td></tr>
+ * <tr><td> </td><td>{@link #CONNECTION}</td> <td> </td><td>= {@value #CONNECTION}</td></tr>
+ * <tr><td> </td><td>{@link #DMS}</td> <td> </td><td>= {@value #DMS}</td></tr>
+ * <tr><td> </td><td>{@link #EJB}</td> <td> </td><td>= {@value #EJB}</td></tr>
+ * <tr><td> </td><td>{@link #EJB_OR_METADATA}</td> <td> </td><td>= {@value #EJB_OR_METADATA}</td></tr>
+ * <tr><td> </td><td>{@link #EVENT}</td> <td> </td><td>= {@value #EVENT}</td></tr>
+ * <tr><td> </td><td>{@link #JPARS}</td> <td> </td><td>= {@value #JPARS}</td></tr>
+ * <tr><td> </td><td>{@link #METAMODEL}</td> <td> </td><td>= {@value #METAMODEL}</td></tr>
+ * <tr><td> </td><td>{@link #MOXY}</td> <td> </td><td>= {@value #MOXY}</td></tr>
+ * <tr><td> </td><td>{@link #PROPAGATION}</td> <td> </td><td>= {@value #PROPAGATION}</td></tr>
+ * <tr><td> </td><td>{@link #PROPERTIES}</td> <td> </td><td>= {@value #PROPERTIES}</td></tr>
+ * <tr><td> </td><td>{@link #QUERY}</td> <td> </td><td>= {@value #QUERY}</td></tr>
+ * <tr><td> </td><td>{@link #SEQUENCING}</td> <td> </td><td>= {@value #SEQUENCING}</td></tr>
+ * <tr><td> </td><td>{@link #SERVER}</td> <td> </td><td>= {@value #SERVER}</td></tr>
+ * <tr><td> </td><td>{@link #SQL}</td> <td> </td><td>= {@value #SQL}</td></tr>
+ * <tr><td> </td><td>{@link #TRANSACTION}</td> <td> </td><td>= {@value #TRANSACTION}</td></tr>
+ * <tr><td> </td><td>{@link #WEAVER}</td> <td> </td><td>= {@value #WEAVER}</td></tr>
+ * </table>
+ */
+ public boolean shouldLog(int level, String category);
+
+ /**
+ * PUBLIC:
+ * Log a message that does not need to be translated. This method is intended for
+ * external use when logging messages are wanted within the EclipseLink output.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public void log(int level, String message);
-
- /**
- * PUBLIC:
- * Log a message with one parameter that needs to be translated.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void log(int level, String message);
+
+ /**
+ * PUBLIC:
+ * Log a message with one parameter that needs to be translated.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public void log(int level, String message, Object param);
-
- /**
- * PUBLIC:
- * Log a message with one parameter that needs to be translated.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void log(int level, String message, Object param);
+
+ /**
+ * PUBLIC:
+ * Log a message with one parameter that needs to be translated.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public void log(int level, String category, String message, Object param);
-
- /**
- * PUBLIC:
- * Log a message with two parameters that needs to be translated.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void log(int level, String category, String message, Object param);
+
+ /**
+ * PUBLIC:
+ * Log a message with two parameters that needs to be translated.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public void log(int level, String message, Object param1, Object param2);
-
- /**
- * PUBLIC:
- * Log a message with two parameters that needs to be translated.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void log(int level, String message, Object param1, Object param2);
+
+ /**
+ * PUBLIC:
+ * Log a message with two parameters that needs to be translated.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public void log(int level, String category, String message, Object param1, Object param2);
-
- /**
- * PUBLIC:
- * Log a message with three parameters that needs to be translated.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void log(int level, String category, String message, Object param1, Object param2);
+
+ /**
+ * PUBLIC:
+ * Log a message with three parameters that needs to be translated.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public void log(int level, String message, Object param1, Object param2, Object param3);
-
- /**
- * PUBLIC:
- * Log a message with three parameters that needs to be translated.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void log(int level, String message, Object param1, Object param2, Object param3);
+
+ /**
+ * PUBLIC:
+ * Log a message with three parameters that needs to be translated.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public void log(int level, String category, String message, Object param1, Object param2, Object param3);
-
- /**
- * PUBLIC:
- * Log a message with four parameters that needs to be translated.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void log(int level, String category, String message, Object param1, Object param2, Object param3);
+
+ /**
+ * PUBLIC:
+ * Log a message with four parameters that needs to be translated.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public void log(int level, String message, Object param1, Object param2, Object param3, Object param4);
-
- /**
- * PUBLIC:
- * Log a message with four parameters that needs to be translated.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void log(int level, String message, Object param1, Object param2, Object param3, Object param4);
+
+ /**
+ * PUBLIC:
+ * Log a message with four parameters that needs to be translated.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public void log(int level, String category, String message, Object param1, Object param2, Object param3, Object param4);
-
- /**
- * PUBLIC:
- * This method is called when the log request is from somewhere session is not available.
- * The message needs to be translated.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void log(int level, String category, String message, Object param1, Object param2, Object param3, Object param4);
+
+ /**
+ * PUBLIC:
+ * This method is called when the log request is from somewhere session is not available.
+ * The message needs to be translated.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public void log(int level, String message, Object[] arguments);
-
- /**
- * PUBLIC:
- * This method is called when the log request is from somewhere session is not available.
- * The message needs to be translated.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void log(int level, String message, Object[] arguments);
+
+ /**
+ * PUBLIC:
+ * This method is called when the log request is from somewhere session is not available.
+ * The message needs to be translated.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public void log(int level, String category, String message, Object[] arguments);
-
- /**
- * PUBLIC:
- * This method is called when the log request is from somewhere session is not available.
- * shouldTranslate flag determines if the message needs to be translated.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void log(int level, String category, String message, Object[] arguments);
+
+ /**
+ * PUBLIC:
+ * This method is called when the log request is from somewhere session is not available.
+ * shouldTranslate flag determines if the message needs to be translated.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public void log(int level, String message, Object[] arguments, boolean shouldTranslate);
-
- /**
- * PUBLIC:
- * This method is called when the log request is from somewhere session is not available.
- * shouldTranslate flag determines if the message needs to be translated.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void log(int level, String message, Object[] arguments, boolean shouldTranslate);
+
+ /**
+ * PUBLIC:
+ * This method is called when the log request is from somewhere session is not available.
+ * shouldTranslate flag determines if the message needs to be translated.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>ALL</td> <td> </td><td>= 0</td>
- * <tr><td>FINEST</td> <td> </td><td>= 1</td>
- * <tr><td>FINER</td> <td> </td><td>= 2</td>
- * <tr><td>FINE</td> <td> </td><td>= 3</td>
- * <tr><td>CONFIG</td> <td> </td><td>= 4</td>
- * <tr><td>INFO</td> <td> </td><td>= 5</td>
- * <tr><td>WARNING</td><td> </td><td>= 6</td>
- * <tr><td>SEVERE</td> <td> </td><td>= 7</td>
- * <tr><td>OFF</td> <td> </td><td>= 8</td>
- * </table>
- */
- public void log(int level, String category, String message, Object[] arguments, boolean shouldTranslate);
-
- /**
- * PUBLIC:
- * This method is called when a throwable at finer level needs to be logged.
- */
- public void throwing(Throwable throwable);
-
- /**
- * PUBLIC:
- * This method is called when a severe level message needs to be logged.
- * The message will be translated
- */
- public void severe(String message);
-
- /**
- * PUBLIC:
- * This method is called when a warning level message needs to be logged.
- * The message will be translated
- */
- public void warning(String message);
-
- /**
- * PUBLIC:
- * This method is called when a info level message needs to be logged.
- * The message will be translated
- */
- public void info(String message);
-
- /**
- * PUBLIC:
- * This method is called when a config level message needs to be logged.
- * The message will be translated
- */
- public void config(String message);
-
- /**
- * PUBLIC:
- * This method is called when a fine level message needs to be logged.
- * The message will be translated
- */
- public void fine(String message);
-
- /**
- * PUBLIC:
- * This method is called when a finer level message needs to be logged.
- * The message will be translated
- */
- public void finer(String message);
-
- /**
- * PUBLIC:
- * This method is called when a finest level message needs to be logged.
- * The message will be translated
- */
- public void finest(String message);
-
- /**
- * PUBLIC:
- * Log a {@link Throwable} with level.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void log(int level, String category, String message, Object[] arguments, boolean shouldTranslate);
+
+ /**
+ * PUBLIC:
+ * This method is called when a throwable at finer level needs to be logged.
+ */
+ public void throwing(Throwable throwable);
+
+ /**
+ * PUBLIC:
+ * This method is called when a severe level message needs to be logged.
+ * The message will be translated
+ */
+ public void severe(String message);
+
+ /**
+ * PUBLIC:
+ * This method is called when a warning level message needs to be logged.
+ * The message will be translated
+ */
+ public void warning(String message);
+
+ /**
+ * PUBLIC:
+ * This method is called when a info level message needs to be logged.
+ * The message will be translated
+ */
+ public void info(String message);
+
+ /**
+ * PUBLIC:
+ * This method is called when a config level message needs to be logged.
+ * The message will be translated
+ */
+ public void config(String message);
+
+ /**
+ * PUBLIC:
+ * This method is called when a fine level message needs to be logged.
+ * The message will be translated
+ */
+ public void fine(String message);
+
+ /**
+ * PUBLIC:
+ * This method is called when a finer level message needs to be logged.
+ * The message will be translated
+ */
+ public void finer(String message);
+
+ /**
+ * PUBLIC:
+ * This method is called when a finest level message needs to be logged.
+ * The message will be translated
+ */
+ public void finest(String message);
+
+ /**
+ * PUBLIC:
+ * Log a {@link Throwable} with level.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
- * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
- * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
- * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
- * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
- * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
- * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
- * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
- * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
- * </table>
- */
- public void logThrowable(int level, Throwable throwable);
-
- /**
- * PUBLIC:
- * Log a throwable with level.
- * <p>
- * The EclipseLink logging levels available are:<br>
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void logThrowable(int level, Throwable throwable);
+
+ /**
+ * PUBLIC:
+ * Log a throwable with level.
+ * <p>
+ * The EclipseLink logging levels available are:<br>
* <table summary="">
- * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
- * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
- * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
- * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
- * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
- * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
- * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
- * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
- * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
- * </table>
- */
- public void logThrowable(int level, String category, Throwable throwable);
-
- /**
- * PUBLIC:
- * Get the session that owns this SessionLog.
- */
- public Session getSession();
-
- /**
- * PUBLIC:
- * Set the session that owns this SessionLog.
- */
- public void setSession(Session session);
-
- /**
- * PUBLIC:
- * Clone the log.
- */
- public Object clone();
-}
+ * <tr><td>{@link #ALL}</td> <td> </td><td>= {@value #ALL}</td>
+ * <tr><td>{@link #FINEST}</td> <td> </td><td>= {@value #FINEST}</td>
+ * <tr><td>{@link #FINER}</td> <td> </td><td>= {@value #FINER}</td>
+ * <tr><td>{@link #FINE}</td> <td> </td><td>= {@value #FINE}</td>
+ * <tr><td>{@link #CONFIG}</td> <td> </td><td>= {@value #CONFIG}</td>
+ * <tr><td>{@link #INFO}</td> <td> </td><td>= {@value #INFO}</td>
+ * <tr><td>{@link #WARNING}</td><td> </td><td>= {@value #WARNING}</td>
+ * <tr><td>{@link #SEVERE}</td> <td> </td><td>= {@value #SEVERE}</td>
+ * <tr><td>{@link #OFF}</td> <td> </td><td>= {@value #OFF}</td>
+ * </table>
+ */
+ public void logThrowable(int level, String category, Throwable throwable);
+
+ /**
+ * PUBLIC:
+ * Get the session that owns this SessionLog.
+ */
+ public Session getSession();
+
+ /**
+ * PUBLIC:
+ * Set the session that owns this SessionLog.
+ */
+ public void setSession(Session session);
+
+ /**
+ * PUBLIC:
+ * Clone the log.
+ */
+ public Object clone();
+}
diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/SessionLogEntry.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/SessionLogEntry.java
index 28ebf0d..b69956d 100644
--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/SessionLogEntry.java
+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/logging/SessionLogEntry.java
@@ -1,278 +1,392 @@
-/*******************************************************************************
- * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation from Oracle TopLink
- ******************************************************************************/
-package org.eclipse.persistence.logging;
-
-import java.util.Date;
-import java.io.Serializable;
-import org.eclipse.persistence.internal.databaseaccess.Accessor;
-import org.eclipse.persistence.internal.sessions.AbstractSession;
-
-/**
- * SessionLogEntry is a simple container object that holds
- * all the information pertinent to an EclipseLink logging event.
- * It has a date/time stamp indicating when the event took
- * place. It holds the session, thread, and accessor
- * responsible for the event. And it holds whatever message
- * was passed through to be logged.
- *
- * @see SessionLog
- * @see DefaultSessionLog
- *
- * @author Big Country
- * @since TOPLink/Java 3.0
- */
-public class SessionLogEntry implements Serializable {
- protected Date date;
- protected transient AbstractSession session;
- protected transient Thread thread;
- protected transient Accessor connection;
- protected String message;
- protected Throwable throwable;
- protected int level;
- protected String nameSpace;
- protected Object[] parameters;
- protected boolean shouldTranslate;
-
- public SessionLogEntry(AbstractSession session) {
- this.date = new Date();
- this.thread = Thread.currentThread();
- this.session = session;
- this.message = "";
- this.level = SessionLog.INFO;
- }
-
- public SessionLogEntry(AbstractSession session, Throwable throwable) {
- this(session);
- this.throwable = throwable;
- this.level = SessionLog.SEVERE;
- }
-
- public SessionLogEntry(AbstractSession session, String message) {
- this(session);
- this.message = message;
- }
-
- public SessionLogEntry(AbstractSession session, String message, Accessor connection) {
- this(session, message);
- this.connection = connection;
- }
-
- /**
- * Create a new session log entry for a request level, a session, a message
- * and an accessor. <br>
- * Possible values for log level are listed in SessionLog.
- *
- * @see SessionLog
- */
- public SessionLogEntry(int level, AbstractSession session, String message, Object[] params, Accessor connection, boolean shouldTranslate) {
- this(session, message, connection);
- this.level = level;
- this.parameters = params;
- this.shouldTranslate = shouldTranslate;
- }
-
- /**
- * Create a new session log entry for a request level, a session, a message
- * and an accessor. <br>
- * Possible values for log level and category are listed in SessionLog.
- *
- * @see SessionLog
- */
- public SessionLogEntry(int level, String category, AbstractSession session, String message, Object[] params, Accessor connection, boolean shouldTranslate) {
- this(level, session, message, params, connection, shouldTranslate);
- this.nameSpace = category;
- }
-
- /**
- * Create a new session log entry for a session, a level, a category and an
- * exception. <br>
- * Possible values for log level and category are listed in SessionLog.
- *
- * @see SessionLog
- */
- public SessionLogEntry(AbstractSession session, int level, String category, Throwable throwable) {
- this(session, throwable);
- this.level = level;
- this.nameSpace = category;
- }
-
- /**
- * Return the connection that generated the log entry.
- */
- public Accessor getConnection() {
- return connection;
- }
-
- /**
- * Return the date of the log entry.
- */
- public Date getDate() {
- return date;
- }
-
- /**
- * Return the exception that caused the log entry.
- */
- public Throwable getException() {
- return throwable;
- }
-
- /**
- * Return the log entry's message.
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Return the session that generated the log entry.
- */
- public AbstractSession getSession() {
- return session;
- }
-
- /**
- * Return the thread that was active when the log entry was generated.
- */
- public Thread getThread() {
- return thread;
- }
-
- /**
- * Return the request level of the log entry. <br>
- * Possible values for log level are listed in SessionLog.
- *
- * @see SessionLog
- */
- public int getLevel() {
- return level;
- }
-
- /**
- * Return the name space of the log entry. <br>
- * Possible values for log category (a String) are listed in SessionLog.
- *
- * @see SessionLog
- */
- public String getNameSpace() {
- return nameSpace;
- }
-
- /**
- * @return the array of parameters to the message.
- */
- public Object[] getParameters() {
- return parameters;
- }
-
- /**
- * @return if the message should be translated.
- */
- public boolean shouldTranslate() {
- return shouldTranslate;
- }
-
- /**
- * @return if the log entry was for an exception.
- */
- public boolean hasException() {
- return getException() != null;
- }
-
- /**
- * @return if the log entry has a message
- */
- public boolean hasMessage() {
- return getMessage() != null && !(getMessage().length() == 0);
- }
-
- /**
- * Set the connection that generated the log entry.
- */
- public void setConnection(Accessor connection) {
- this.connection = connection;
- }
-
- /**
- * Set the date of the log entry.
- */
- public void setDate(Date date) {
- this.date = date;
- }
-
- /**
- * Set the exception that caused the log entry.
- */
- public void setException(Throwable throwable) {
- this.throwable = throwable;
- }
-
- /**
- * Set the entry's message.
- */
- public void setMessage(String message) {
- this.message = message;
- }
-
- /**
- * Set the session that generated the log entry.
- */
- public void setSession(AbstractSession session) {
- this.session = session;
- }
-
- /**
- * Set the thread that was active when the log entry was generated.
- */
- public void setThread(Thread thread) {
- this.thread = thread;
- }
-
- /**
- * Set the request level of the log entry. <br>
- * Possible values for log level are listed in SessionLog.
- *
- * @see SessionLog
- */
- public void setLevel(int level) {
- this.level = level;
- }
-
- /**
- * Set the name space of the log entry. <br>
- * Possible values for log category (a String) are listed in SessionLog.
- *
- * @see SessionLog
- */
- public void setNameSpace(String nameSpace) {
- this.nameSpace = nameSpace;
- }
-
- /**
- * Set the array of parameters to the message.
- */
- public void setParameters(Object[] params) {
- this.parameters = params;
- }
-
- /**
- * Set if the message should be translated.
- */
- public void setShouldTranslate(boolean shouldTranslate) {
- this.shouldTranslate = shouldTranslate;
- }
-
- public String toString() {
- return org.eclipse.persistence.internal.helper.Helper.getShortClassName(getClass()) + "(" + getMessage() + ")";
- }
-}
+/*******************************************************************************
+ * Copyright (c) 1998, 2016 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation from Oracle TopLink
+ ******************************************************************************/
+package org.eclipse.persistence.logging;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.eclipse.persistence.internal.databaseaccess.Accessor;
+import org.eclipse.persistence.internal.sessions.AbstractSession;
+
+/**
+ * SessionLogEntry is a simple container object that holds
+ * all the information pertinent to an EclipseLink logging event.
+ * It has a date/time stamp indicating when the event took
+ * place. It holds the session, thread, and accessor
+ * responsible for the event. And it holds whatever message
+ * was passed through to be logged.
+ *
+ * @see SessionLog
+ * @see DefaultSessionLog
+ *
+ * @author Big Country
+ * @since TOPLink/Java 3.0
+ */
+public class SessionLogEntry implements Serializable {
+ protected Date date;
+ protected transient AbstractSession session;
+ protected transient Thread thread;
+ protected transient Accessor connection;
+ protected String message;
+ protected Throwable throwable;
+ protected int level;
+ protected String nameSpace;
+ protected Object[] parameters;
+ protected boolean shouldTranslate;
+ protected String sourceClassName;
+ protected String sourceMethodName;
+
+ /**
+ * Create a new session log entry for a session.
+ *
+ * @param session the session
+ */
+ public SessionLogEntry(AbstractSession session) {
+ this.date = new Date();
+ this.thread = Thread.currentThread();
+ this.session = session;
+ this.message = "";
+ this.level = SessionLog.INFO;
+ }
+
+ /**
+ * Create a new session log entry for a session and a throwable.
+ *
+ * @param session the session
+ * @param throwable the throwable
+ */
+ public SessionLogEntry(AbstractSession session, Throwable throwable) {
+ this(session);
+ this.throwable = throwable;
+ this.level = SessionLog.SEVERE;
+ }
+
+ /**
+ * Create a new session log entry for a session and a message.
+ *
+ * @param session the session
+ * @param message the message
+ */
+ public SessionLogEntry(AbstractSession session, String message) {
+ this(session);
+ this.message = message;
+ }
+
+ /**
+ * Create a new session log entry for a session, a message and an accessor.
+ *
+ * @param session the session
+ * @param message the message
+ * @param connection the accessor
+ */
+ public SessionLogEntry(AbstractSession session, String message, Accessor connection) {
+ this(session, message);
+ this.connection = connection;
+ }
+
+ /**
+ * Create a new session log entry for a request level, a session, a message,
+ * parameters and an accessor. <br>
+ * Possible values for log level are listed in SessionLog.
+ *
+ * @param level the log level
+ * @param session the session
+ * @param message the message
+ * @param params array of parameters
+ * @param connection the accessor
+ * @param shouldTranslate true if the entry should be translated
+ *
+ * @see SessionLog
+ */
+ public SessionLogEntry(int level, AbstractSession session, String message, Object[] params, Accessor connection, boolean shouldTranslate) {
+ this(session, message, connection);
+ this.level = level;
+ this.parameters = params;
+ this.shouldTranslate = shouldTranslate;
+ }
+
+ /**
+ * Create a new session log entry for a request level, a category, a session,
+ * a message, parameters and an accessor. <br>
+ * Possible values for log level and category are listed in SessionLog.
+ *
+ * @param level the log level
+ * @param category the category
+ * @param session the session
+ * @param message the message
+ * @param params array of parameters
+ * @param connection the accessor
+ * @param shouldTranslate true if the entry should be translated
+ *
+ * @see SessionLog
+ */
+ public SessionLogEntry(int level, String category, AbstractSession session, String message, Object[] params, Accessor connection, boolean shouldTranslate) {
+ this(level, session, message, params, connection, shouldTranslate);
+ this.nameSpace = category;
+ }
+
+ /**
+ * Create a new session log entry for a session, a level, a category and an
+ * exception. <br>
+ * Possible values for log level and category are listed in SessionLog.
+ *
+ * @param session the session
+ * @param level the log level
+ * @param category the category
+ * @param throwable the exception
+ *
+ * @see SessionLog
+ */
+ public SessionLogEntry(AbstractSession session, int level, String category, Throwable throwable) {
+ this(session, throwable);
+ this.level = level;
+ this.nameSpace = category;
+ }
+
+ /**
+ * Return the connection that generated the log entry.
+ *
+ * @return the connection accessor
+ */
+ public Accessor getConnection() {
+ return connection;
+ }
+
+ /**
+ * Return the date of the log entry.
+ *
+ * @return the date
+ */
+ public Date getDate() {
+ return date;
+ }
+
+ /**
+ * Return the exception that caused the log entry.
+ *
+ * @return the exception
+ */
+ public Throwable getException() {
+ return throwable;
+ }
+
+ /**
+ * Return the log entry's message.
+ *
+ * @return the message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Return the session that generated the log entry.
+ *
+ * @return the session
+ */
+ public AbstractSession getSession() {
+ return session;
+ }
+
+ /**
+ * Return the thread that was active when the log entry was generated.
+ *
+ * @return the thread
+ */
+ public Thread getThread() {
+ return thread;
+ }
+
+ /**
+ * Return the request level of the log entry. <br>
+ * Possible values for log level are listed in SessionLog.
+ *
+ * @return the request level of the log entry
+ * @see SessionLog
+ */
+ public int getLevel() {
+ return level;
+ }
+
+ /**
+ * Return the name space of the log entry. <br>
+ * Possible values for log category (a String) are listed in SessionLog.
+ *
+ * @return the name space of the log entry
+ * @see SessionLog
+ */
+ public String getNameSpace() {
+ return nameSpace;
+ }
+
+ /**
+ * @return the array of parameters to the message.
+ */
+ public Object[] getParameters() {
+ return parameters;
+ }
+
+ /**
+ * @return the source class name to the message
+ */
+ public String getSourceClassName() {
+ return sourceClassName;
+ }
+
+ /**
+ * @return the source method name to the message
+ */
+ public String getSourceMethodName() {
+ return sourceMethodName;
+ }
+
+ /**
+ * @return if the message should be translated.
+ */
+ public boolean shouldTranslate() {
+ return shouldTranslate;
+ }
+
+ /**
+ * @return if the log entry was for an exception.
+ */
+ public boolean hasException() {
+ return getException() != null;
+ }
+
+ /**
+ * @return if the log entry has a message
+ */
+ public boolean hasMessage() {
+ return getMessage() != null && !(getMessage().length() == 0);
+ }
+
+ /**
+ * Set the connection that generated the log entry.
+ *
+ * @param connection the connection
+ */
+ public void setConnection(Accessor connection) {
+ this.connection = connection;
+ }
+
+ /**
+ * Set the date of the log entry.
+ *
+ * @param date the date
+ */
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ /**
+ * Set the exception that caused the log entry.
+ *
+ * @param throwable the exception
+ */
+ public void setException(Throwable throwable) {
+ this.throwable = throwable;
+ }
+
+ /**
+ * Set the entry's message.
+ *
+ * @param message the message
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ /**
+ * Set the session that generated the log entry.
+ *
+ * @param session the session
+ */
+ public void setSession(AbstractSession session) {
+ this.session = session;
+ }
+
+ /**
+ * Set the thread that was active when the log entry was generated.
+ *
+ * @param thread the thread
+ */
+ public void setThread(Thread thread) {
+ this.thread = thread;
+ }
+
+ /**
+ * Set the request level of the log entry. <br>
+ * Possible values for log level are listed in SessionLog.
+ *
+ * @param level the log level
+ *
+ * @see SessionLog
+ */
+ public void setLevel(int level) {
+ this.level = level;
+ }
+
+ /**
+ * Set the name space of the log entry. <br>
+ * Possible values for log category (a String) are listed in SessionLog.
+ *
+ * @param nameSpace the log category
+ *
+ * @see SessionLog
+ */
+ public void setNameSpace(String nameSpace) {
+ this.nameSpace = nameSpace;
+ }
+
+ /**
+ * Set the array of parameters to the message.
+ *
+ * @param params array of parameters
+ */
+ public void setParameters(Object[] params) {
+ this.parameters = params;
+ }
+
+ /**
+ * Set if the message should be translated.
+ *
+ * @param shouldTranslate true if the message should be translated, false otherwise
+ */
+ public void setShouldTranslate(boolean shouldTranslate) {
+ this.shouldTranslate = shouldTranslate;
+ }
+
+ /**
+ * Set the source class name to the message.
+ *
+ * @param sourceClassName source class name
+ */
+ public void setSourceClassName(String sourceClassName) {
+ this.sourceClassName = sourceClassName;
+ }
+
+ /**
+ * Set the source method name to the message.
+ *
+ * @param sourceMethodName source method name
+ */
+ public void setSourceMethodName(String sourceMethodName) {
+ this.sourceMethodName = sourceMethodName;
+ }
+
+ @Override
+ public String toString() {
+ return org.eclipse.persistence.internal.helper.Helper.getShortClassName(getClass()) + "(" + getMessage() + ")";
+ }
+}
diff --git a/jpa/eclipselink.jpars.test/.settings/org.eclipse.jdt.core.prefs b/jpa/eclipselink.jpars.test/.settings/org.eclipse.jdt.core.prefs
index f00e2f2..b04d32d 100644
--- a/jpa/eclipselink.jpars.test/.settings/org.eclipse.jdt.core.prefs
+++ b/jpa/eclipselink.jpars.test/.settings/org.eclipse.jdt.core.prefs
@@ -1,12 +1,12 @@
-#Wed Mar 07 10:27:12 EST 2012
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+#Wed Mar 07 10:27:12 EST 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
diff --git a/jpa/eclipselink.jpars.test/antbuild.xml b/jpa/eclipselink.jpars.test/antbuild.xml
index 6323412..a1057f7 100644
--- a/jpa/eclipselink.jpars.test/antbuild.xml
+++ b/jpa/eclipselink.jpars.test/antbuild.xml
@@ -77,6 +77,7 @@
<available file="${jparstest.2.base.dir}/jpa/plugins" type="dir"/>
</condition>
<property name="jparstest.2.buildsys.dir" value="${jparstest.2.base.dir}/buildsystem"/>
+ <property name="jparstest.basedir" value="${jparstest.build.location}"/>
<condition property="custom.properties.message"
value="Loading ${user.home}/build.properties"
@@ -86,6 +87,9 @@
<available file="${user.home}/build.properties"/>
</and>
</condition>
+ <echo message="${custom.properties.message}"/>
+ <property file="${user.home}/build.properties"/>
+
<condition property="custom.cmd.properties.message"
value="Loading ${test.properties}"
else="Skipping ${test.properties}, file does not exist">
@@ -94,16 +98,13 @@
<available file="${test.properties}"/>
</and>
</condition>
- <echo message="${custom.properties.message}"/>
<echo message="${custom.cmd.properties.message}"/>
- <property file="${user.home}/build.properties"/>
- <property file="${jparstest.build.location}/antbuild.properties"/>
- <property file="${user.home}/test.properties"/>
<property file="${test.properties}"/>
+ <property file="${user.home}/test.properties"/>
<property file="${jparstest.build.location}/${test.properties}"/>
<property file="${jparstest.build.location}/test.properties"/>
- <property name="jparstest.basedir" value="${jparstest.build.location}"/>
+ <property file="${jparstest.build.location}/antbuild.properties"/>
<!-- Clean all build generated content. -->
<target name="clean" description="Clean the build">
diff --git a/jpa/eclipselink.jpars.test/src/META-INF/persistence.xml b/jpa/eclipselink.jpars.test/src/META-INF/persistence.xml
index 9c59bb4..dd6839a 100644
--- a/jpa/eclipselink.jpars.test/src/META-INF/persistence.xml
+++ b/jpa/eclipselink.jpars.test/src/META-INF/persistence.xml
@@ -1,92 +1,95 @@
-<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_2_0.xsd" version="2.0">
- <persistence-unit name="jpars_auction-static" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.eclipse.persistence.jpars.test.model.auction.StaticUser</class>
- <class>org.eclipse.persistence.jpars.test.model.auction.StaticAuction</class>
- <class>org.eclipse.persistence.jpars.test.model.auction.StaticBid</class>
- <class>org.eclipse.persistence.jpars.test.model.auction.StaticAddress</class>
- <class>org.eclipse.persistence.jpars.test.model.multitenant.Account</class>
- <exclude-unlisted-classes/>
- <properties>
- <property name="javax.persistence.nonJtaDataSource" value="jdbc/ELNonJTADS"/>
- <property name="eclipselink.logging.level" value="SEVERE"/>
- <property name="eclipselink.logging.parameters" value="true"/>
- <property name="eclipselink.target-server" value="Glassfish"/>
- </properties>
- </persistence-unit>
-
- <persistence-unit name="jpars_auction-static-local" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.eclipse.persistence.jpars.test.model.auction.StaticUser</class>
- <class>org.eclipse.persistence.jpars.test.model.auction.StaticAuction</class>
- <class>org.eclipse.persistence.jpars.test.model.auction.StaticBid</class>
- <class>org.eclipse.persistence.jpars.test.model.auction.StaticAddress</class>
- <class>org.eclipse.persistence.jpars.test.model.multitenant.Account</class>
- <exclude-unlisted-classes/>
- <properties>
- <property name="eclipselink.logging.level" value="SEVERE"/>
- <property name="eclipselink.logging.parameters" value="true"/>
- <property name="javax.persistence.jdbc.url" value="@DB_URL@"/>
- <property name="javax.persistence.jdbc.password" value="@DB_PWD@"/>
- <property name="javax.persistence.jdbc.driver" value="@DB_DRIVER@"/>
- <property name="javax.persistence.jdbc.user" value="@DB_USER@"/>
- </properties>
- </persistence-unit>
-
- <persistence-unit name="jpars_auction" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.eclipse.persistence.jpars.test.model.dynamic.auction.User</class>
- <class>org.eclipse.persistence.jpars.test.model.dynamic.auction.Auction</class>
- <class>org.eclipse.persistence.jpars.test.model.dynamic.auction.Bid</class>
- <exclude-unlisted-classes/>
- <properties>
- <property name="eclipselink.metadata-source" value="XML"/>
- <property name="eclipselink.weaving" value="static"/>
- <property name="eclipselink.metadata-source.xml.file" value="META-INF/auction-orm.xml"/>
- <property name="javax.persistence.jdbc.url" value="@DB_URL@"/>
- <property name="javax.persistence.jdbc.password" value="@DB_PWD@"/>
- <property name="javax.persistence.jdbc.driver" value="@DB_DRIVER@"/>
- <property name="javax.persistence.jdbc.user" value="@DB_USER@"/>
- </properties>
- </persistence-unit>
-
- <persistence-unit name="jpars_phonebook" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.eclipse.persistence.jpars.test.model.dynamic.phonebook.Person</class>
- <exclude-unlisted-classes/>
- <properties>
- <property name="eclipselink.metadata-source" value="XML"/>
- <property name="eclipselink.weaving" value="static"/>
- <property name="eclipselink.metadata-source.xml.file" value="META-INF/phonebook-orm.xml"/>
- <property name="javax.persistence.jdbc.url" value="@DB_URL@"/>
- <property name="javax.persistence.jdbc.password" value="@DB_PWD@"/>
- <property name="javax.persistence.jdbc.driver" value="@DB_DRIVER@"/>
- <property name="javax.persistence.jdbc.user" value="@DB_USER@"/>
- </properties>
- </persistence-unit>
-
- <persistence-unit name="jpars_employee-static" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.eclipse.persistence.jpars.test.model.employee.Employee</class>
- <class>org.eclipse.persistence.jpars.test.model.employee.EmployeeAddress</class>
- <class>org.eclipse.persistence.jpars.test.model.employee.EmploymentPeriod</class>
- <class>org.eclipse.persistence.jpars.test.model.employee.LargeProject</class>
- <class>org.eclipse.persistence.jpars.test.model.employee.PhoneNumber</class>
- <class>org.eclipse.persistence.jpars.test.model.employee.Project</class>
- <class>org.eclipse.persistence.jpars.test.model.employee.SmallProject</class>
- <class>org.eclipse.persistence.jpars.test.model.employee.Expertise</class>
- <class>org.eclipse.persistence.jpars.test.model.employee.Office</class>
- <class>org.eclipse.persistence.jpars.test.model.employee.Certification</class>
- <exclude-unlisted-classes/>
- <properties>
- <property name="javax.persistence.nonJtaDataSource" value="jdbc/ELNonJTADS"/>
- <property name="eclipselink.logging.level" value="SEVERE"/>
- <property name="eclipselink.logging.parameters" value="true"/>
- <property name="eclipselink.target-server" value="Glassfish"/>
- </properties>
- </persistence-unit>
-
+<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_2_0.xsd" version="2.0">
+ <persistence-unit name="jpars_auction-static" transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.eclipse.persistence.jpars.test.model.auction.StaticUser</class>
+ <class>org.eclipse.persistence.jpars.test.model.auction.StaticAuction</class>
+ <class>org.eclipse.persistence.jpars.test.model.auction.StaticBid</class>
+ <class>org.eclipse.persistence.jpars.test.model.auction.StaticAddress</class>
+ <class>org.eclipse.persistence.jpars.test.model.multitenant.Account</class>
+ <exclude-unlisted-classes/>
+ <properties>
+ <property name="javax.persistence.nonJtaDataSource" value="jdbc/ELNonJTADS"/>
+ <property name="eclipselink.logging.level" value="INFO"/>
+ <property name="eclipselink.logging.level.jpars" value="FINEST"/>
+ <property name="eclipselink.logging.parameters" value="true"/>
+ <property name="eclipselink.target-server" value="Glassfish"/>
+ </properties>
+ </persistence-unit>
+
+ <persistence-unit name="jpars_auction-static-local" transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.eclipse.persistence.jpars.test.model.auction.StaticUser</class>
+ <class>org.eclipse.persistence.jpars.test.model.auction.StaticAuction</class>
+ <class>org.eclipse.persistence.jpars.test.model.auction.StaticBid</class>
+ <class>org.eclipse.persistence.jpars.test.model.auction.StaticAddress</class>
+ <class>org.eclipse.persistence.jpars.test.model.multitenant.Account</class>
+ <exclude-unlisted-classes/>
+ <properties>
+ <property name="eclipselink.logging.level" value="INFO"/>
+ <property name="eclipselink.logging.level.jpars" value="FINEST"/>
+ <property name="eclipselink.logging.parameters" value="true"/>
+ <property name="javax.persistence.jdbc.url" value="@DB_URL@"/>
+ <property name="javax.persistence.jdbc.password" value="@DB_PWD@"/>
+ <property name="javax.persistence.jdbc.driver" value="@DB_DRIVER@"/>
+ <property name="javax.persistence.jdbc.user" value="@DB_USER@"/>
+ </properties>
+ </persistence-unit>
+
+ <persistence-unit name="jpars_auction" transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.eclipse.persistence.jpars.test.model.dynamic.auction.User</class>
+ <class>org.eclipse.persistence.jpars.test.model.dynamic.auction.Auction</class>
+ <class>org.eclipse.persistence.jpars.test.model.dynamic.auction.Bid</class>
+ <exclude-unlisted-classes/>
+ <properties>
+ <property name="eclipselink.metadata-source" value="XML"/>
+ <property name="eclipselink.weaving" value="static"/>
+ <property name="eclipselink.metadata-source.xml.file" value="META-INF/auction-orm.xml"/>
+ <property name="javax.persistence.jdbc.url" value="@DB_URL@"/>
+ <property name="javax.persistence.jdbc.password" value="@DB_PWD@"/>
+ <property name="javax.persistence.jdbc.driver" value="@DB_DRIVER@"/>
+ <property name="javax.persistence.jdbc.user" value="@DB_USER@"/>
+ </properties>
+ </persistence-unit>
+
+ <persistence-unit name="jpars_phonebook" transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.eclipse.persistence.jpars.test.model.dynamic.phonebook.Person</class>
+ <exclude-unlisted-classes/>
+ <properties>
+ <property name="eclipselink.metadata-source" value="XML"/>
+ <property name="eclipselink.weaving" value="static"/>
+ <property name="eclipselink.metadata-source.xml.file" value="META-INF/phonebook-orm.xml"/>
+ <property name="javax.persistence.jdbc.url" value="@DB_URL@"/>
+ <property name="javax.persistence.jdbc.password" value="@DB_PWD@"/>
+ <property name="javax.persistence.jdbc.driver" value="@DB_DRIVER@"/>
+ <property name="javax.persistence.jdbc.user" value="@DB_USER@"/>
+ </properties>
+ </persistence-unit>
+
+ <persistence-unit name="jpars_employee-static" transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.eclipse.persistence.jpars.test.model.employee.Employee</class>
+ <class>org.eclipse.persistence.jpars.test.model.employee.EmployeeAddress</class>
+ <class>org.eclipse.persistence.jpars.test.model.employee.EmploymentPeriod</class>
+ <class>org.eclipse.persistence.jpars.test.model.employee.LargeProject</class>
+ <class>org.eclipse.persistence.jpars.test.model.employee.PhoneNumber</class>
+ <class>org.eclipse.persistence.jpars.test.model.employee.Project</class>
+ <class>org.eclipse.persistence.jpars.test.model.employee.SmallProject</class>
+ <class>org.eclipse.persistence.jpars.test.model.employee.Expertise</class>
+ <class>org.eclipse.persistence.jpars.test.model.employee.Office</class>
+ <class>org.eclipse.persistence.jpars.test.model.employee.Certification</class>
+ <exclude-unlisted-classes/>
+ <properties>
+ <property name="javax.persistence.nonJtaDataSource" value="jdbc/ELNonJTADS"/>
+ <property name="eclipselink.logging.level" value="INFO"/>
+ <property name="eclipselink.logging.level.jpars" value="FINEST"/>
+ <property name="eclipselink.logging.parameters" value="true"/>
+ <property name="eclipselink.target-server" value="Glassfish"/>
+ </properties>
+ </persistence-unit>
+
<persistence-unit name="jpars_basket-static" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>org.eclipse.persistence.jpars.test.model.basket.Basket</class>
@@ -94,79 +97,81 @@
<exclude-unlisted-classes/>
<properties>
<property name="javax.persistence.nonJtaDataSource" value="jdbc/ELNonJTADS"/>
- <property name="eclipselink.logging.level" value="SEVERE"/>
+ <property name="eclipselink.logging.level" value="INFO"/>
+ <property name="eclipselink.logging.level.jpars" value="FINEST"/>
<property name="eclipselink.logging.parameters" value="true"/>
</properties>
</persistence-unit>
- <persistence-unit name="jpars_traveler-static" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.eclipse.persistence.jpars.test.model.traveler.Traveler</class>
- <class>org.eclipse.persistence.jpars.test.model.traveler.Reservation</class>
- <exclude-unlisted-classes/>
- <properties>
- <property name="javax.persistence.nonJtaDataSource" value="jdbc/ELNonJTADS"/>
- <property name="eclipselink.logging.level" value="SEVERE"/>
- <property name="eclipselink.logging.parameters" value="true"/>
- <property name="eclipselink.target-server" value="Glassfish"/>
- </properties>
- </persistence-unit>
-
-
- <!-- persistence-unit name="jpars_place" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.eclipse.persistence.jpars.test.model.dynamic.place.Place</class>
- <exclude-unlisted-classes>true</exclude-unlisted-classes>
- <properties>
- <property name="eclipselink.metadata-source" value="XML"/>
- <property name="eclipselink.weaving" value="static"/>
- <property name="eclipselink.metadata-source.xml.file" value="META-INF/place-orm.xml"/>
- <property name="eclipselink.target-database" value="org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform"/>
- <property name="eclipselink.nosql.connection-spec" value="org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec"/>
- <property name="eclipselink.nosql.property.mongo.port" value="27017"/>
- <property name="eclipselink.nosql.property.mongo.host" value="localhost"/>
- <property name="eclipselink.nosql.property.mongo.db" value="place_db"/>
- <property name="eclipselink.logging.level" value="SEVERE"/>
- <property name="javax.persistence.jdbc.user" value="test"/>
- <property name="javax.persistence.jdbc.password" value="test"/>
- </properties>
- </persistence-unit>
-
- <persistence-unit name="jpars_zip" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.eclipse.persistence.jpars.test.model.dynamic.place.Zips</class>
- <exclude-unlisted-classes>true</exclude-unlisted-classes>
- <properties>
- <property name="eclipselink.metadata-source" value="XML"/>
- <property name="eclipselink.weaving" value="static"/>
- <property name="eclipselink.metadata-source.xml.file" value="META-INF/zip-orm.xml"/>
- <property name="eclipselink.target-database" value="org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform"/>
- <property name="eclipselink.nosql.connection-spec" value="org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec"/>
- <property name="eclipselink.nosql.property.mongo.port" value="27017"/>
- <property name="eclipselink.nosql.property.mongo.host" value="localhost"/>
- <property name="eclipselink.nosql.property.mongo.db" value="place_db"/>
- <property name="eclipselink.logging.level" value="SEVERE"/>
- <property name="javax.persistence.jdbc.user" value="test"/>
- <property name="javax.persistence.jdbc.password" value="test"/>
- </properties>
- </persistence-unit>
-
- <persistence-unit name="jpars_person" transaction-type="RESOURCE_LOCAL">
- <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
- <class>org.eclipse.persistence.jpars.test.model.dynamic.Person</class>
- <exclude-unlisted-classes>true</exclude-unlisted-classes>
- <properties>
- <property name="eclipselink.metadata-source" value="XML"/>
- <property name="eclipselink.weaving" value="static"/>
- <property name="eclipselink.metadata-source.xml.file" value="META-INF/complex-orm.xml"/>
- <property name="eclipselink.target-database" value="org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform"/>
- <property name="eclipselink.nosql.connection-spec" value="org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec"/>
- <property name="eclipselink.nosql.property.mongo.port" value="27017"/>
- <property name="eclipselink.nosql.property.mongo.host" value="localhost"/>
- <property name="eclipselink.nosql.property.mongo.db" value="person_db"/>
- <property name="eclipselink.logging.level" value="SEVERE"/>
- <property name="javax.persistence.jdbc.user" value="test"/>
- <property name="javax.persistence.jdbc.password" value="test"/>
- </properties>
- </persistence-unit-->
-</persistence>
+ <persistence-unit name="jpars_traveler-static" transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.eclipse.persistence.jpars.test.model.traveler.Traveler</class>
+ <class>org.eclipse.persistence.jpars.test.model.traveler.Reservation</class>
+ <exclude-unlisted-classes/>
+ <properties>
+ <property name="javax.persistence.nonJtaDataSource" value="jdbc/ELNonJTADS"/>
+ <property name="eclipselink.logging.level" value="INFO"/>
+ <property name="eclipselink.logging.level.jpars" value="FINEST"/>
+ <property name="eclipselink.logging.parameters" value="true"/>
+ <property name="eclipselink.target-server" value="Glassfish"/>
+ </properties>
+ </persistence-unit>
+
+
+ <!-- persistence-unit name="jpars_place" transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.eclipse.persistence.jpars.test.model.dynamic.place.Place</class>
+ <exclude-unlisted-classes>true</exclude-unlisted-classes>
+ <properties>
+ <property name="eclipselink.metadata-source" value="XML"/>
+ <property name="eclipselink.weaving" value="static"/>
+ <property name="eclipselink.metadata-source.xml.file" value="META-INF/place-orm.xml"/>
+ <property name="eclipselink.target-database" value="org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform"/>
+ <property name="eclipselink.nosql.connection-spec" value="org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec"/>
+ <property name="eclipselink.nosql.property.mongo.port" value="27017"/>
+ <property name="eclipselink.nosql.property.mongo.host" value="localhost"/>
+ <property name="eclipselink.nosql.property.mongo.db" value="place_db"/>
+ <property name="eclipselink.logging.level" value="SEVERE"/>
+ <property name="javax.persistence.jdbc.user" value="test"/>
+ <property name="javax.persistence.jdbc.password" value="test"/>
+ </properties>
+ </persistence-unit>
+
+ <persistence-unit name="jpars_zip" transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.eclipse.persistence.jpars.test.model.dynamic.place.Zips</class>
+ <exclude-unlisted-classes>true</exclude-unlisted-classes>
+ <properties>
+ <property name="eclipselink.metadata-source" value="XML"/>
+ <property name="eclipselink.weaving" value="static"/>
+ <property name="eclipselink.metadata-source.xml.file" value="META-INF/zip-orm.xml"/>
+ <property name="eclipselink.target-database" value="org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform"/>
+ <property name="eclipselink.nosql.connection-spec" value="org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec"/>
+ <property name="eclipselink.nosql.property.mongo.port" value="27017"/>
+ <property name="eclipselink.nosql.property.mongo.host" value="localhost"/>
+ <property name="eclipselink.nosql.property.mongo.db" value="place_db"/>
+ <property name="eclipselink.logging.level" value="SEVERE"/>
+ <property name="javax.persistence.jdbc.user" value="test"/>
+ <property name="javax.persistence.jdbc.password" value="test"/>
+ </properties>
+ </persistence-unit>
+
+ <persistence-unit name="jpars_person" transaction-type="RESOURCE_LOCAL">
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <class>org.eclipse.persistence.jpars.test.model.dynamic.Person</class>
+ <exclude-unlisted-classes>true</exclude-unlisted-classes>
+ <properties>
+ <property name="eclipselink.metadata-source" value="XML"/>
+ <property name="eclipselink.weaving" value="static"/>
+ <property name="eclipselink.metadata-source.xml.file" value="META-INF/complex-orm.xml"/>
+ <property name="eclipselink.target-database" value="org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform"/>
+ <property name="eclipselink.nosql.connection-spec" value="org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec"/>
+ <property name="eclipselink.nosql.property.mongo.port" value="27017"/>
+ <property name="eclipselink.nosql.property.mongo.host" value="localhost"/>
+ <property name="eclipselink.nosql.property.mongo.db" value="person_db"/>
+ <property name="eclipselink.logging.level" value="SEVERE"/>
+ <property name="javax.persistence.jdbc.user" value="test"/>
+ <property name="javax.persistence.jdbc.password" value="test"/>
+ </properties>
+ </persistence-unit-->
+</persistence>
diff --git a/jpa/eclipselink.jpars.test/test.properties b/jpa/eclipselink.jpars.test/test.properties
index eb363f1..aa7e3e8 100644
--- a/jpa/eclipselink.jpars.test/test.properties
+++ b/jpa/eclipselink.jpars.test/test.properties
@@ -69,14 +69,15 @@
eclipselink.jdbc.read-connections.min=1
eclipselink.jdbc.write-connections.min=1
-eclipselink.logging.level=FINE
+eclipselink.logging.level=INFO
eclipselink.logging.connection=false
eclipselink.logging.timestamp=false
eclipselink.logging.thread=false
eclipselink.logging.session=false
eclipselink.logging.exceptions=true
eclipselink.logging.level.sql=FINE
-eclipselink.logging.level.ejb_or_metadata=FINE
+eclipselink.logging.level.jpars=FINEST
+eclipselink.logging.level.metadata=FINE
eclipselink.target-server=NONE
diff --git a/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/BeanValidationHelper.java b/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/BeanValidationHelper.java
index 2b4bef4..2049fb1 100644
--- a/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/BeanValidationHelper.java
+++ b/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/BeanValidationHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
@@ -40,9 +40,9 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import org.eclipse.persistence.logging.AbstractSessionLog;
+import org.eclipse.persistence.logging.SessionLog;
/**
* INTERNAL:
*
@@ -53,8 +53,6 @@
*/
final public class BeanValidationHelper {
- private static final Logger LOGGER = Logger.getLogger(BeanValidationHelper.class.getName());
-
private Future<Map<Class<?>, Boolean>> future;
/**
@@ -139,7 +137,8 @@
constraintsOnClasses = future.get();
} catch (InterruptedException | ExecutionException e) {
// For some reason the async parsing attempt failed. Call it synchronously.
- LOGGER.log(Level.WARNING, "Error parsing validation.xml the async way", e);
+ AbstractSessionLog.getLog().log(SessionLog.WARNING, SessionLog.MOXY, "Error parsing validation.xml the async way", new Object[0], false);
+ AbstractSessionLog.getLog().logThrowable(SessionLog.WARNING, SessionLog.MOXY, e);
constraintsOnClasses = parseValidationXml();
}
}
@@ -158,7 +157,8 @@
} catch (Throwable e) {
// In the rare cases submitting a task throws OutOfMemoryError. In this case we call validation.xml
// parsing lazily when requested
- LOGGER.log(Level.WARNING, "Error creating/submitting async validation.xml parsing task.", e);
+ AbstractSessionLog.getLog().log(SessionLog.WARNING, SessionLog.MOXY, "Error creating/submitting async validation.xml parsing task.", new Object[0], false);
+ AbstractSessionLog.getLog().logThrowable(SessionLog.WARNING, SessionLog.MOXY, e);
future = null;
} finally {
// Shutdown is needed only for JDK executor
@@ -177,7 +177,8 @@
try {
result = reader.call();
} catch (Exception e) {
- LOGGER.log(Level.WARNING, "Error parsing validation.xml synchronously", e);
+ AbstractSessionLog.getLog().log(SessionLog.WARNING, SessionLog.MOXY, "Error parsing validation.xml synchronously", new Object[0], false);
+ AbstractSessionLog.getLog().logThrowable(SessionLog.WARNING, SessionLog.MOXY, e);
result = new HashMap<>();
}
return result;
@@ -271,4 +272,4 @@
this.shutdownNeeded = shutdownNeeded;
}
}
-}
\ No newline at end of file
+}
diff --git a/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/Generator.java b/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/Generator.java
index 068d275..39041ee 100644
--- a/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/Generator.java
+++ b/moxy/org.eclipse.persistence.moxy/src/org/eclipse/persistence/jaxb/compiler/Generator.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation from Oracle TopLink
- ******************************************************************************/
-package org.eclipse.persistence.jaxb.compiler;
-
-import java.io.File;
-import java.io.FileNotFoundException;
+/*******************************************************************************
+ * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation from Oracle TopLink
+ ******************************************************************************/
+package org.eclipse.persistence.jaxb.compiler;
+
+import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Type;
@@ -24,56 +24,58 @@
import javax.xml.bind.SchemaOutputResolver;
import javax.xml.namespace.QName;
-import org.eclipse.persistence.core.sessions.CoreProject;
-import org.eclipse.persistence.internal.oxm.Constants;
-import org.eclipse.persistence.internal.oxm.mappings.Descriptor;
-import org.eclipse.persistence.internal.oxm.schema.SchemaModelProject;
-import org.eclipse.persistence.internal.oxm.schema.model.Schema;
-import org.eclipse.persistence.jaxb.TypeMappingInfo;
+import org.eclipse.persistence.core.sessions.CoreProject;
+import org.eclipse.persistence.internal.oxm.Constants;
+import org.eclipse.persistence.internal.oxm.mappings.Descriptor;
+import org.eclipse.persistence.internal.oxm.schema.SchemaModelProject;
+import org.eclipse.persistence.internal.oxm.schema.model.Schema;
+import org.eclipse.persistence.jaxb.TypeMappingInfo;
import org.eclipse.persistence.jaxb.javamodel.Helper;
import org.eclipse.persistence.jaxb.javamodel.JavaClass;
import org.eclipse.persistence.jaxb.javamodel.JavaModelInput;
import org.eclipse.persistence.jaxb.javamodel.reflection.JavaModelInputImpl;
import org.eclipse.persistence.jaxb.xmlmodel.XmlBindings;
+import org.eclipse.persistence.logging.AbstractSessionLog;
+import org.eclipse.persistence.logging.SessionLog;
import org.eclipse.persistence.oxm.NamespaceResolver;
import org.eclipse.persistence.oxm.XMLContext;
-import org.eclipse.persistence.oxm.XMLMarshaller;
-import org.eclipse.persistence.sessions.Project;
-
-/**
- * INTERNAL:
- * <p><b>Purpose:</b>The purpose of this class is to act as an entry point into the
- * TopLink JAXB 2.0 Generation framework
- * <p><b>Responsibilities:</b><ul>
- * <li>Run initial processing on a list of classes to create TypeInfo meta data</li>
- * <li>Provide API to generate Schema Files</li>
- * <li>Provide API to generate a TopLink Project</li>
- * <li>Act as an integration point with WebServices</li>
- * </ul>
- * <p> This class acts as an entry point into JAXB 2.0 Generation. A Generator is created with a
- * specific set of JAXB 2.0 Annotated classes and then performs actions on those, such as
- * generating schema files, or generating TopLink Projects. Additional information is returned
- * from the schema generation methods as a means of integration with WebServices.
- *
- * @author mmacivor
- * @since Oracle TopLink 11.1.1.0.0
- * @see AnnotationsProcessor
- * @see MappingsGenerator
- * @see SchemaGenerator
- */
-public class Generator {
- private AnnotationsProcessor annotationsProcessor;
- private SchemaGenerator schemaGenerator;
- private MappingsGenerator mappingsGenerator;
- private Helper helper;
- private Map<Type, TypeMappingInfo> typeToTypeMappingInfo;
-
- /**
- * This is the preferred constructor.
- * This constructor creates a Helper using the JavaModelInput
- * instance's JavaModel. Annotations are processed here as well.
- *
- * @param jModelInput
+import org.eclipse.persistence.oxm.XMLMarshaller;
+import org.eclipse.persistence.sessions.Project;
+
+/**
+ * INTERNAL:
+ * <p><b>Purpose:</b>The purpose of this class is to act as an entry point into the
+ * TopLink JAXB 2.0 Generation framework
+ * <p><b>Responsibilities:</b><ul>
+ * <li>Run initial processing on a list of classes to create TypeInfo meta data</li>
+ * <li>Provide API to generate Schema Files</li>
+ * <li>Provide API to generate a TopLink Project</li>
+ * <li>Act as an integration point with WebServices</li>
+ * </ul>
+ * <p> This class acts as an entry point into JAXB 2.0 Generation. A Generator is created with a
+ * specific set of JAXB 2.0 Annotated classes and then performs actions on those, such as
+ * generating schema files, or generating TopLink Projects. Additional information is returned
+ * from the schema generation methods as a means of integration with WebServices.
+ *
+ * @author mmacivor
+ * @since Oracle TopLink 11.1.1.0.0
+ * @see AnnotationsProcessor
+ * @see MappingsGenerator
+ * @see SchemaGenerator
+ */
+public class Generator {
+ private AnnotationsProcessor annotationsProcessor;
+ private SchemaGenerator schemaGenerator;
+ private MappingsGenerator mappingsGenerator;
+ private Helper helper;
+ private Map<Type, TypeMappingInfo> typeToTypeMappingInfo;
+
+ /**
+ * This is the preferred constructor.
+ * This constructor creates a Helper using the JavaModelInput
+ * instance's JavaModel. Annotations are processed here as well.
+ *
+ * @param jModelInput
*/
public Generator(JavaModelInput jModelInput) {
helper = new Helper(jModelInput.getJavaModel());
@@ -81,24 +83,24 @@
annotationsProcessor = new AnnotationsProcessor(helper);
schemaGenerator = new SchemaGenerator(helper);
mappingsGenerator = new MappingsGenerator(helper);
- annotationsProcessor.processClassesAndProperties(jModelInput.getJavaClasses(), null);
- }
-
- /**
- * This constructor will process and apply the given XmlBindings as appropriate. Classes
- * declared in the bindings will be amalgamated with any classes in the JavaModelInput.
- *
- * If xmlBindings is null or empty, AnnotationsProcessor will be used to process
- * annotations as per usual.
- *
- * @param jModelInput
- * @param xmlBindings map of XmlBindings keyed on package name
- * @param cLoader
- */
- public Generator(JavaModelInput jModelInput, Map<String, XmlBindings> xmlBindings, ClassLoader cLoader, String defaultTargetNamespace, boolean enableXmlAccessorFactory) {
- helper = new Helper(jModelInput.getJavaModel());
- annotationsProcessor = new AnnotationsProcessor(helper);
- annotationsProcessor.setXmlAccessorFactorySupport(enableXmlAccessorFactory);
+ annotationsProcessor.processClassesAndProperties(jModelInput.getJavaClasses(), null);
+ }
+
+ /**
+ * This constructor will process and apply the given XmlBindings as appropriate. Classes
+ * declared in the bindings will be amalgamated with any classes in the JavaModelInput.
+ *
+ * If xmlBindings is null or empty, AnnotationsProcessor will be used to process
+ * annotations as per usual.
+ *
+ * @param jModelInput
+ * @param xmlBindings map of XmlBindings keyed on package name
+ * @param cLoader
+ */
+ public Generator(JavaModelInput jModelInput, Map<String, XmlBindings> xmlBindings, ClassLoader cLoader, String defaultTargetNamespace, boolean enableXmlAccessorFactory) {
+ helper = new Helper(jModelInput.getJavaModel());
+ annotationsProcessor = new AnnotationsProcessor(helper);
+ annotationsProcessor.setXmlAccessorFactorySupport(enableXmlAccessorFactory);
annotationsProcessor.setDefaultTargetNamespace(defaultTargetNamespace);
schemaGenerator = new SchemaGenerator(helper);
mappingsGenerator = new MappingsGenerator(helper);
@@ -106,31 +108,31 @@
new XMLProcessor(xmlBindings).processXML(annotationsProcessor, jModelInput, null, null);
} else {
annotationsProcessor.processClassesAndProperties(jModelInput.getJavaClasses(), null);
- }
- }
-
- /**
- * This constructor creates a Helper using the JavaModelInput
- * instance's JavaModel and a map of javaclasses that were generated from Type objects.
- * Annotations are processed here as well.
- *
- * @param jModelInput
- */
- public Generator(JavaModelInput jModelInput, TypeMappingInfo[] typeMappingInfos, JavaClass[] javaClasses, Map<Type, TypeMappingInfo> typeToTypeMappingInfo, String defaultTargetNamespace) {
- helper = new Helper(jModelInput.getJavaModel());
- annotationsProcessor = new AnnotationsProcessor(helper);
- annotationsProcessor.setDefaultTargetNamespace(defaultTargetNamespace);
- schemaGenerator = new SchemaGenerator(helper);
- mappingsGenerator = new MappingsGenerator(helper);
- this.typeToTypeMappingInfo = typeToTypeMappingInfo;
- annotationsProcessor.processClassesAndProperties(javaClasses, typeMappingInfos);
- }
-
- /**
- * This constructor will process and apply the given XmlBindings as appropriate. Classes
- * declared in the bindings will be amalgamated with any classes in the JavaModelInput.
- *
- * If xmlBindings is null or empty, AnnotationsProcessor will be used to process
+ }
+ }
+
+ /**
+ * This constructor creates a Helper using the JavaModelInput
+ * instance's JavaModel and a map of javaclasses that were generated from Type objects.
+ * Annotations are processed here as well.
+ *
+ * @param jModelInput
+ */
+ public Generator(JavaModelInput jModelInput, TypeMappingInfo[] typeMappingInfos, JavaClass[] javaClasses, Map<Type, TypeMappingInfo> typeToTypeMappingInfo, String defaultTargetNamespace) {
+ helper = new Helper(jModelInput.getJavaModel());
+ annotationsProcessor = new AnnotationsProcessor(helper);
+ annotationsProcessor.setDefaultTargetNamespace(defaultTargetNamespace);
+ schemaGenerator = new SchemaGenerator(helper);
+ mappingsGenerator = new MappingsGenerator(helper);
+ this.typeToTypeMappingInfo = typeToTypeMappingInfo;
+ annotationsProcessor.processClassesAndProperties(javaClasses, typeMappingInfos);
+ }
+
+ /**
+ * This constructor will process and apply the given XmlBindings as appropriate. Classes
+ * declared in the bindings will be amalgamated with any classes in the JavaModelInput.
+ *
+ * If xmlBindings is null or empty, AnnotationsProcessor will be used to process
* annotations as per usual.
*
* @param jModelInput
@@ -142,11 +144,11 @@
* @param xmlBindings map of XmlBindings keyed on package name
* @param cLoader
*/
- public Generator(JavaModelInput jModelInput, TypeMappingInfo[] typeMappingInfos, JavaClass[] javaClasses, Map<Type, TypeMappingInfo> typeToTypeMappingInfo, Map<String, XmlBindings> xmlBindings, ClassLoader cLoader, String defaultTargetNamespace, boolean enableXmlAccessorFactory) {
- helper = new Helper(jModelInput.getJavaModel());
- annotationsProcessor = new AnnotationsProcessor(helper);
- annotationsProcessor.setXmlAccessorFactorySupport(enableXmlAccessorFactory);
- annotationsProcessor.setDefaultTargetNamespace(defaultTargetNamespace);
+ public Generator(JavaModelInput jModelInput, TypeMappingInfo[] typeMappingInfos, JavaClass[] javaClasses, Map<Type, TypeMappingInfo> typeToTypeMappingInfo, Map<String, XmlBindings> xmlBindings, ClassLoader cLoader, String defaultTargetNamespace, boolean enableXmlAccessorFactory) {
+ helper = new Helper(jModelInput.getJavaModel());
+ annotationsProcessor = new AnnotationsProcessor(helper);
+ annotationsProcessor.setXmlAccessorFactorySupport(enableXmlAccessorFactory);
+ annotationsProcessor.setDefaultTargetNamespace(defaultTargetNamespace);
schemaGenerator = new SchemaGenerator(helper);
mappingsGenerator = new MappingsGenerator(helper);
this.typeToTypeMappingInfo = typeToTypeMappingInfo;
@@ -154,21 +156,21 @@
new XMLProcessor(xmlBindings).processXML(annotationsProcessor, jModelInput, typeMappingInfos, javaClasses);
} else {
annotationsProcessor.processClassesAndProperties(javaClasses, typeMappingInfos);
- }
- }
-
- /**
- * This event is called when mappings generation is completed,
- * and provides a chance to deference anything that is no longer
- * needed (to reduce the memory footprint of this object).
- */
- public void postInitialize() {
- mappingsGenerator = null;
- annotationsProcessor.postInitialize();
- schemaGenerator = null;
- }
-
- /**
+ }
+ }
+
+ /**
+ * This event is called when mappings generation is completed,
+ * and provides a chance to deference anything that is no longer
+ * needed (to reduce the memory footprint of this object).
+ */
+ public void postInitialize() {
+ mappingsGenerator = null;
+ annotationsProcessor.postInitialize();
+ schemaGenerator = null;
+ }
+
+ /**
*
*/
public boolean hasMarshalCallbacks() {
@@ -199,9 +201,9 @@
CoreProject proj = new SchemaModelProject();
XMLContext context = new XMLContext((Project)proj);
XMLMarshaller marshaller = context.createMarshaller();
- Descriptor schemaDescriptor = (Descriptor)proj.getDescriptor(Schema.class);
-
- java.util.Collection<Schema> schemas = schemaGenerator.getAllSchemas();
+ Descriptor schemaDescriptor = (Descriptor)proj.getDescriptor(Schema.class);
+
+ java.util.Collection<Schema> schemas = schemaGenerator.getAllSchemas();
for(Schema schema : schemas) {
File file = new File(schemaPath + "/" + schema.getName());
NamespaceResolver schemaNamespaces = schema.getNamespaceResolver();
@@ -220,10 +222,10 @@
CoreProject proj = new SchemaModelProject();
XMLContext context = new XMLContext((Project)proj);
XMLMarshaller marshaller = context.createMarshaller();
-
- Descriptor schemaDescriptor = (Descriptor)proj.getDescriptor(Schema.class);
-
- java.util.Collection<Schema> schemas = schemaGenerator.getAllSchemas();
+
+ Descriptor schemaDescriptor = (Descriptor)proj.getDescriptor(Schema.class);
+
+ java.util.Collection<Schema> schemas = schemaGenerator.getAllSchemas();
for(Schema schema : schemas) {
try {
NamespaceResolver schemaNamespaces = schema.getNamespaceResolver();
@@ -231,38 +233,38 @@
schemaDescriptor.setNamespaceResolver(schemaNamespaces);
// make sure we don't call into the provided output resolver more than once
javax.xml.transform.Result target;
- if (schema.hasResult()) {
- target = schema.getResult();
- } else {
- target = outputResolver.createOutput(schema.getTargetNamespace(), schema.getName());
- }
- marshaller.marshal(schema, target);
- } catch (IOException ex) {
- ex.printStackTrace();
- }
- }
- return schemaGenerator.getSchemaTypeInfo();
- }
-
- /**
- * Convenience method that processes a given map of QName-Type entries. For each an ElementDeclaration
- * is created and added to the given AnnotationsProcessor instance's map of global elements.
- *
- * It is assumed that the map of QName-Type entries contains Type instances that are either a Class or
- * a ParameterizedType.
- *
- * @param additionalGlobalElements
- * @param annotationsProcessor
- */
- private void processAdditionalElements(Map<QName, Type> additionalGlobalElements, AnnotationsProcessor annotationsProcessor) {
- if (additionalGlobalElements != null) {
- ElementDeclaration declaration;
- for(Entry<QName, Type> entry : additionalGlobalElements.entrySet()) {
- QName key = entry.getKey();
- Type type = entry.getValue();
- TypeMappingInfo tmi = null;
- if(this.typeToTypeMappingInfo != null) {
- tmi = this.typeToTypeMappingInfo.get(type);
+ if (schema.hasResult()) {
+ target = schema.getResult();
+ } else {
+ target = outputResolver.createOutput(schema.getTargetNamespace(), schema.getName());
+ }
+ marshaller.marshal(schema, target);
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ return schemaGenerator.getSchemaTypeInfo();
+ }
+
+ /**
+ * Convenience method that processes a given map of QName-Type entries. For each an ElementDeclaration
+ * is created and added to the given AnnotationsProcessor instance's map of global elements.
+ *
+ * It is assumed that the map of QName-Type entries contains Type instances that are either a Class or
+ * a ParameterizedType.
+ *
+ * @param additionalGlobalElements
+ * @param annotationsProcessor
+ */
+ private void processAdditionalElements(Map<QName, Type> additionalGlobalElements, AnnotationsProcessor annotationsProcessor) {
+ if (additionalGlobalElements != null) {
+ ElementDeclaration declaration;
+ for(Entry<QName, Type> entry : additionalGlobalElements.entrySet()) {
+ QName key = entry.getKey();
+ Type type = entry.getValue();
+ TypeMappingInfo tmi = null;
+ if(this.typeToTypeMappingInfo != null) {
+ tmi = this.typeToTypeMappingInfo.get(type);
}
if(tmi != null) {
@@ -271,16 +273,16 @@
}
}
JavaClass jClass = null;
- if (type instanceof Class) {
- Class tClass = (Class) type;
- jClass = helper.getJavaClass(tClass);
- }
- // if no type is available don't do anything
- if (jClass != null) {
- declaration = new ElementDeclaration(key, jClass, jClass.getQualifiedName(), false);
- annotationsProcessor.getGlobalElements().put(key, declaration);
- }
- }
+ if (type instanceof Class) {
+ Class tClass = (Class) type;
+ jClass = helper.getJavaClass(tClass);
+ }
+ // if no type is available don't do anything
+ if (jClass != null) {
+ declaration = new ElementDeclaration(key, jClass, jClass.getQualifiedName(), false);
+ annotationsProcessor.getGlobalElements().put(key, declaration);
+ }
+ }
}
}
@@ -292,20 +294,20 @@
return annotationsProcessor.getMarshalCallbacks();
}
- public MappingsGenerator getMappingsGenerator() {
- return this.mappingsGenerator;
- }
-
- public AnnotationsProcessor getAnnotationsProcessor() {
- return annotationsProcessor;
- }
-
- public void setTypeToTypeMappingInfo(Map<Type, TypeMappingInfo> typesToTypeMapping) {
- this.typeToTypeMappingInfo = typesToTypeMapping;
- }
-
- public Map<Type, TypeMappingInfo> getTypeToTypeMappingInfo() {
- return this.typeToTypeMappingInfo;
- }
-
-}
\ No newline at end of file
+ public MappingsGenerator getMappingsGenerator() {
+ return this.mappingsGenerator;
+ }
+
+ public AnnotationsProcessor getAnnotationsProcessor() {
+ return annotationsProcessor;
+ }
+
+ public void setTypeToTypeMappingInfo(Map<Type, TypeMappingInfo> typesToTypeMapping) {
+ this.typeToTypeMappingInfo = typesToTypeMapping;
+ }
+
+ public Map<Type, TypeMappingInfo> getTypeToTypeMappingInfo() {
+ return this.typeToTypeMappingInfo;
+ }
+
+}