You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/03/07 02:24:02 UTC
svn commit: r515409 - in
/incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin:
GeneratorMojo.java SchemaFileOption.java
Author: rfeng
Date: Tue Mar 6 17:24:01 2007
New Revision: 515409
URL: http://svn.apache.org/viewvc?view=rev&rev=515409
Log:
Fix the configuration for schemaFiles
Modified:
incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java
incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/SchemaFileOption.java
Modified: incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java?view=diff&rev=515409&r1=515408&r2=515409
==============================================================================
--- incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java (original)
+++ incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/GeneratorMojo.java Tue Mar 6 17:24:01 2007
@@ -44,28 +44,32 @@
*/
public class GeneratorMojo extends AbstractMojo {
/**
- * The directory containing schema files; defaults to ${basedir}/src/main/xsd
+ * The directory containing schema files; defaults to
+ * ${basedir}/src/main/xsd
*
* @parameter expression="${basedir}/src/main/xsd"
*/
private String schemaDir;
/**
- * Name of the schema file; if omitted all files in the directory are processed
+ * Name of the schema file; if omitted all files in the directory are
+ * processed
*
* @parameter
*/
private File schemaFile;
/**
- * The Java package to generate into. By default the value is derived from the schema URI.
+ * The Java package to generate into. By default the value is derived from
+ * the schema URI.
*
* @parameter
*/
private String javaPackage;
/**
- * The directory to generate into; defaults to ${project.build.directory}/sdo-source
+ * The directory to generate into; defaults to
+ * ${project.build.directory}/sdo-source
*
* @parameter expression="${project.build.directory}/sdo-source"
*/
@@ -79,7 +83,8 @@
private String prefix;
/**
- * This option can be used to eliminate the generated interface and to generate only an implementation class.
+ * This option can be used to eliminate the generated interface and to
+ * generate only an implementation class.
*
* @parameter
*/
@@ -93,14 +98,16 @@
private Boolean noContainment;
/**
- * This option eliminates all change notification overhead in the generated classes.
+ * This option eliminates all change notification overhead in the generated
+ * classes.
*
* @parameter
*/
private Boolean noNotification;
/**
- * With this option, all generated properties will not record their unset state.
+ * With this option, all generated properties will not record their unset
+ * state.
*
* @parameter
*/
@@ -122,7 +129,6 @@
/**
* @parameter expression="${project}"
- *
* @required
*/
private MavenProject project;
@@ -133,7 +139,8 @@
private List mojos;
/**
- * With this option, generated interfaces will extend commonj.sdo.DataObject.
+ * With this option, generated interfaces will extend
+ * commonj.sdo.DataObject.
*
* @parameter
*/
@@ -148,7 +155,8 @@
public void execute() throws MojoExecutionException {
- // check for schemaFiles parameter first, if properties are not set, use global property
+ // check for schemaFiles parameter first, if properties are not set, use
+ // global property
if (null != schemaFiles) {
for (int i = 0; i < schemaFiles.length; ++i) {
SchemaFileOption sf = schemaFiles[i];
@@ -212,7 +220,7 @@
schemaFiles[i].setTargetDirectory(targetDirectory);
}
} else {
- schemaFiles = new SchemaFileOption[] { new SchemaFileOption() };
+ schemaFiles = new SchemaFileOption[] {new SchemaFileOption()};
schemaFiles[0].setFileName(schemaFile);
schemaFiles[0].setJavaPackage(javaPackage);
// schemaFiles[0].setCompilerSourceRoots(compileSourceRoots);
@@ -230,7 +238,7 @@
for (int i = 0; i < schemaFiles.length; i++) {
File file = schemaFiles[i].getFileName();
- File marker = new File(targetDirectory, ".gen#" + file.getName());
+ File marker = new File(schemaFiles[i].getTargetDirectory(), ".gen#" + file.getName());
if (file.lastModified() > marker.lastModified()) {
getLog().info("Generating SDO interfaces from " + file);
@@ -254,13 +262,17 @@
if (schemaFiles[i].isGenerateSwitch() != null && schemaFiles[i].isGenerateSwitch().booleanValue()) {
genOptions |= JavaGenerator.OPTION_GENERATE_SWITCH;
}
- if (schemaFiles[i].isInterfaceDataObject() != null
- && schemaFiles[i].isInterfaceDataObject().booleanValue()) {
+ if (schemaFiles[i].isInterfaceDataObject() != null && schemaFiles[i].isInterfaceDataObject()
+ .booleanValue()) {
genOptions |= JavaGenerator.OPTION_INTERFACE_DO;
}
- XSD2JavaGenerator.generateFromXMLSchema(file.toString(), null, targetDirectory, javaPackage, prefix,
- genOptions);
+ XSD2JavaGenerator.generateFromXMLSchema(file.toString(),
+ null,
+ schemaFiles[i].getTargetDirectory(),
+ schemaFiles[i].getJavaPackage(),
+ schemaFiles[i].getPrefix(),
+ genOptions);
}
try {
marker.createNewFile();
@@ -273,13 +285,13 @@
targetDirectory = targetDirectory.replace('/', File.separatorChar);
// FIXME: [rfeng] Workaround to figure out the current execution phase
- MojoDescriptor descriptor = (MojoDescriptor) mojos.get(0);
+ MojoDescriptor descriptor = (MojoDescriptor)mojos.get(0);
PluginDescriptor pluginDescriptor = descriptor.getPluginDescriptor();
Map pluginMap = project.getBuild().getPluginsAsMap();
- Plugin plugin = (Plugin) pluginMap.get(pluginDescriptor.getGroupId() + ":" + pluginDescriptor.getArtifactId());
+ Plugin plugin = (Plugin)pluginMap.get(pluginDescriptor.getGroupId() + ":" + pluginDescriptor.getArtifactId());
// How to get the current execution id?
for (Iterator i = plugin.getExecutions().iterator(); i.hasNext();) {
- PluginExecution execution = (PluginExecution) i.next();
+ PluginExecution execution = (PluginExecution)i.next();
String phase = execution.getPhase();
if (phase != null && phase.indexOf("-test-") != -1) {
project.addTestCompileSourceRoot(targetDirectory);
Modified: incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/SchemaFileOption.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/SchemaFileOption.java?view=diff&rev=515409&r1=515408&r2=515409
==============================================================================
--- incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/SchemaFileOption.java (original)
+++ incubator/tuscany/java/sdo/plugin/src/main/java/org/apache/tuscany/sdo/plugin/SchemaFileOption.java Tue Mar 6 17:24:01 2007
@@ -26,6 +26,7 @@
/**
* Name of the schema file
*
+ * @parameter
*/
private File fileName;
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org