mirror of https://github.com/apache/openjpa.git
added more details to error message; made OpenJPA startup banner configurable
git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@453932 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
34f6cb589e
commit
e61de9586c
|
@ -31,10 +31,6 @@ import java.util.StringTokenizer;
|
|||
public class OpenJPAVersion {
|
||||
|
||||
public static final String VERSION_NUMBER;
|
||||
private static final long RELEASE_SECONDS = 1147454303;
|
||||
|
||||
public static final Date RELEASE_DATE = new Date(RELEASE_SECONDS * 1000);
|
||||
|
||||
public static final String VERSION_ID;
|
||||
public static final String VENDOR_NAME = "OpenJPA";
|
||||
public static final int MAJOR_RELEASE;
|
||||
|
@ -103,13 +99,8 @@ public class OpenJPAVersion {
|
|||
|
||||
public String toString() {
|
||||
StringBuffer buf = new StringBuffer(80 * 30);
|
||||
buf.append("OpenJPA ");
|
||||
buf.append(VERSION_NUMBER);
|
||||
appendOpenJPABanner(buf);
|
||||
buf.append("\n");
|
||||
buf.append("version id: ").append(VERSION_ID);
|
||||
buf.append("\n");
|
||||
buf.append("revision: ").append(REVISION_NUMBER);
|
||||
buf.append("\n\n");
|
||||
|
||||
getProperty("os.name", buf).append("\n");
|
||||
getProperty("os.version", buf).append("\n");
|
||||
|
@ -132,6 +123,16 @@ public class OpenJPAVersion {
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
public void appendOpenJPABanner(StringBuffer buf) {
|
||||
buf.append(VENDOR_NAME).append(" ");
|
||||
buf.append(VERSION_NUMBER);
|
||||
buf.append("\n");
|
||||
buf.append("version id: ").append(VERSION_ID);
|
||||
buf.append("\n");
|
||||
buf.append("Apache svn revision: ").append(REVISION_NUMBER);
|
||||
buf.append("\n");
|
||||
}
|
||||
|
||||
private StringBuffer getProperty(String prop, StringBuffer buf) {
|
||||
buf.append(prop).append(": ").append(System.getProperty(prop));
|
||||
return buf;
|
||||
|
|
|
@ -501,8 +501,7 @@ public abstract class AbstractBrokerFactory
|
|||
|
||||
Log log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
|
||||
if (log.isInfoEnabled())
|
||||
log.info(_loc.get("factory-init",
|
||||
OpenJPAVersion.VERSION_NUMBER));
|
||||
log.info(getFactoryInitializationBanner());
|
||||
if (log.isTraceEnabled()) {
|
||||
Map props = _conf.toProperties(true);
|
||||
String lineSep = System.getProperty("line.separator");
|
||||
|
@ -538,6 +537,14 @@ public abstract class AbstractBrokerFactory
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an object to be written to the log when this broker factory
|
||||
* initializes. This happens after the configuration is fully loaded.
|
||||
*/
|
||||
protected Object getFactoryInitializationBanner() {
|
||||
return _loc.get("factory-init", OpenJPAVersion.VERSION_NUMBER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw an exception if the factory is closed.
|
||||
*/
|
||||
|
|
|
@ -273,4 +273,5 @@ no-metadatafactory: MetaDataFactory could not be configured \
|
|||
no configuration properties were found. If you are \
|
||||
using Ant, please see the <properties> or <propertiesFile> attributes \
|
||||
of the task''s nested <config> element. This can also occur if your \
|
||||
OpenJPA distribution jars are corrupt.
|
||||
OpenJPA distribution jars are corrupt, or if your security policy is \
|
||||
overly strict.
|
Loading…
Reference in New Issue