* This function will usually get called by {@link #getOptions()}
* @return the Options filled with the initial values
*/
protected Options createOptions() throws MojoExecutionException
{
Options opts = new Options();
if ( toolProperties != null )
{
opts.putAll( toolProperties );
}
if ( persistenceXmlFile != null )
{
fixPersistenceXmlIfNeeded(Thread.currentThread().getContextClassLoader());
opts.put( OPTION_PROPERTIES_FILE, persistenceXmlFile );
getLog().debug("using special persistence XML file: " + persistenceXmlFile);
}
else if (!new File(classes, "META-INF/persistence.xml").exists())
{ // use default but try from classpath
persistenceXmlFile = "META-INF/persistence.xml";
if (!fixPersistenceXmlIfNeeded(Thread.currentThread().getContextClassLoader())) {
persistenceXmlFile = null;
} else {
opts.put( OPTION_PROPERTIES_FILE, persistenceXmlFile );
}
}
if ( connectionDriverName != null )
{
opts.put( OPTION_CONNECTION_DRIVER_NAME, connectionDriverName );
}
if ( connectionProperties != null )
{
opts.put( OPTION_CONNECTION_PROPERTIES, connectionProperties );
}
return opts;
}