Author: tomdz
Date: Fri Nov 4 11:43:27 2005
New Revision: 330874
URL: http://svn.apache.org/viewcvs?rev=330874&view=rev
Log:
Fix for DDLUTILS-41
Javadoc fix
Modified:
db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DataWriter.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Command.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/ConvertingDatabaseCommand.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseCommand.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DropDatabaseCommand.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDtdToFileCommand.java
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToFileCommand.java
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DataWriter.java
URL:
http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DataWriter.java?rev=330874&r1=330873&r2=330874&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DataWriter.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DataWriter.java Fri Nov
4 11:43:27 2005
@@ -157,6 +157,8 @@
/**
* Prints the indentation if we're pretty-printing.
+ *
+ * @param level The indentation level
*/
private void indentIfPrettyPrinting(int level) throws DataWriterException
{
Modified:
db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java
URL:
http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java?rev=330874&r1=330873&r2=330874&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java
(original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/SqlBuilder.java Fri
Nov 4 11:43:27 2005
@@ -48,7 +48,7 @@
* it requires. Though often that can be quite complex when attempting to
reuse code across many databases.
* Hopefully only a small amount code needs to be changed on a per database
basis.
*
- * TODO: It might be useful to add foreignkey analysis for creation/dropping
of tables
+ * TODO: It might be useful to add foreignkey analysis for creation/dropping
of tables
*
* @author James Strachan
* @author John Marshall/Connectria
Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Command.java
URL:
http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Command.java?rev=330874&r1=330873&r2=330874&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Command.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/Command.java Fri Nov 4
11:43:27 2005
@@ -29,6 +29,14 @@
public interface Command
{
/**
+ * Specifies whether this command requires a model, i.e. whether the second
+ * argument in [EMAIL PROTECTED] #execute(Task, Database)} cannot be
<code>null</code>.
+ *
+ * @return <code>true</code> if this command requires a model
+ */
+ public boolean isRequiringModel();
+
+ /**
* Executes this command.
*
* @param task The executing task
Modified:
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/ConvertingDatabaseCommand.java
URL:
http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/ConvertingDatabaseCommand.java?rev=330874&r1=330873&r2=330874&view=diff
==============================================================================
---
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/ConvertingDatabaseCommand.java
(original)
+++
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/ConvertingDatabaseCommand.java
Fri Nov 4 11:43:27 2005
@@ -1,5 +1,21 @@
package org.apache.ddlutils.task;
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
import java.util.ArrayList;
import java.util.Iterator;
Modified:
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java
URL:
http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java?rev=330874&r1=330873&r2=330874&view=diff
==============================================================================
---
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java
(original)
+++
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java
Fri Nov 4 11:43:27 2005
@@ -51,6 +51,14 @@
/**
* [EMAIL PROTECTED]
*/
+ public boolean isRequiringModel()
+ {
+ return false;
+ }
+
+ /**
+ * [EMAIL PROTECTED]
+ */
public void execute(Task task, Database model) throws BuildException
{
BasicDataSource dataSource = getDataSource();
Modified:
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseCommand.java
URL:
http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseCommand.java?rev=330874&r1=330873&r2=330874&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseCommand.java
(original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseCommand.java
Fri Nov 4 11:43:27 2005
@@ -93,4 +93,12 @@
{
return _platformConf.getPlatform();
}
+
+ /**
+ * [EMAIL PROTECTED]
+ */
+ public boolean isRequiringModel()
+ {
+ return true;
+ }
}
Modified:
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java
URL:
http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java?rev=330874&r1=330873&r2=330874&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java
(original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java
Fri Nov 4 11:43:27 2005
@@ -142,12 +142,16 @@
*
* @param model The database model
*/
- protected void executeCommands(Database model)
+ protected void executeCommands(Database model) throws BuildException
{
for (Iterator it = _commands.iterator(); it.hasNext();)
{
Command cmd = (Command)it.next();
+ if (cmd.isRequiringModel() && (model == null))
+ {
+ throw new BuildException("No database model specified");
+ }
if (cmd instanceof DatabaseCommand)
{
((DatabaseCommand)cmd).setPlatformConfiguration(_platformConf);
@@ -176,14 +180,7 @@
try
{
- Database model = readModel();
-
- if (model == null)
- {
- log("No schemas read, so there is nothing to do.",
Project.MSG_INFO);
- return;
- }
- executeCommands(model);
+ executeCommands(readModel());
}
finally
{
Modified:
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DropDatabaseCommand.java
URL:
http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DropDatabaseCommand.java?rev=330874&r1=330873&r2=330874&view=diff
==============================================================================
---
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DropDatabaseCommand.java
(original)
+++
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DropDatabaseCommand.java
Fri Nov 4 11:43:27 2005
@@ -34,6 +34,14 @@
/**
* [EMAIL PROTECTED]
*/
+ public boolean isRequiringModel()
+ {
+ return false;
+ }
+
+ /**
+ * [EMAIL PROTECTED]
+ */
public void execute(Task task, Database model) throws BuildException
{
BasicDataSource dataSource = getDataSource();
Modified:
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDtdToFileCommand.java
URL:
http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDtdToFileCommand.java?rev=330874&r1=330873&r2=330874&view=diff
==============================================================================
---
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDtdToFileCommand.java
(original)
+++
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDtdToFileCommand.java
Fri Nov 4 11:43:27 2005
@@ -49,6 +49,14 @@
/**
* [EMAIL PROTECTED]
*/
+ public boolean isRequiringModel()
+ {
+ return true;
+ }
+
+ /**
+ * [EMAIL PROTECTED]
+ */
public void execute(Task task, Database model) throws BuildException
{
if (_outputFile == null)
Modified:
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToFileCommand.java
URL:
http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToFileCommand.java?rev=330874&r1=330873&r2=330874&view=diff
==============================================================================
---
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToFileCommand.java
(original)
+++
db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteSchemaToFileCommand.java
Fri Nov 4 11:43:27 2005
@@ -49,6 +49,14 @@
/**
* [EMAIL PROTECTED]
*/
+ public boolean isRequiringModel()
+ {
+ return true;
+ }
+
+ /**
+ * [EMAIL PROTECTED]
+ */
public void execute(Task task, Database model) throws BuildException
{
if (_outputFile == null)