Author: aadamchik
Date: Wed Apr 15 05:55:34 2009
New Revision: 765056
URL: http://svn.apache.org/viewvc?rev=765056&view=rev
Log:
deprecated cdeploy
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ApplicationProjectFile.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/DataNodeConfigInfo.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/PartialProject.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigInfo.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigurator.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/project/PartialProjectTest.java
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ApplicationProjectFile.java
URL:
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ApplicationProjectFile.java?rev=765056&r1=765055&r2=765056&view=diff
==============================================================================
---
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ApplicationProjectFile.java
(original)
+++
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ApplicationProjectFile.java
Wed Apr 15 05:55:34 2009
@@ -30,7 +30,6 @@
* ApplicationProjectFile is a ProjectFile abstraction of the main project
file in a
* Cayenne project. Right now Cayenne projects can not be renamed, so all the
name
* tracking functionality is pretty much noop.
- *
*/
public class ApplicationProjectFile extends ProjectFile {
@@ -38,10 +37,6 @@
private String objectName = null;
- private ApplicationProjectFile() {
- super();
- }
-
/**
* Constructor for default ApplicationProjectFile.
*/
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/DataNodeConfigInfo.java
URL:
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/DataNodeConfigInfo.java?rev=765056&r1=765055&r2=765056&view=diff
==============================================================================
---
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/DataNodeConfigInfo.java
(original)
+++
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/DataNodeConfigInfo.java
Wed Apr 15 05:55:34 2009
@@ -27,9 +27,13 @@
/**
* Stores information necessary to reconfigure nodes of existing projects.
- *
+ *
+ * @deprecated since 3.0. {...@link ProjectConfigurator} approach turned out
to be not
+ * usable, and is in fact rarely used (if ever). It will be
removed in
+ * subsequent releases.
*/
public class DataNodeConfigInfo {
+
protected String name;
protected String domain;
protected String adapter;
@@ -37,12 +41,10 @@
protected File driverFile;
/**
- * Searches for the DataNode described by this DataNodeConfigInfo in the
- * provided configuration object. Throws ProjectException if there is no
- * matching DataNode.
+ * Searches for the DataNode described by this DataNodeConfigInfo in the
provided
+ * configuration object. Throws ProjectException if there is no matching
DataNode.
*/
- public DataNode findDataNode(Configuration config)
- throws ProjectException {
+ public DataNode findDataNode(Configuration config) throws ProjectException
{
DataDomain domainObj = null;
// domain name is either explicit, or use default domain
@@ -52,10 +54,12 @@
if (domainObj == null) {
throw new ProjectException("Can't find domain named " +
domain);
}
- } else {
+ }
+ else {
try {
domainObj = config.getDomain();
- } catch (Exception ex) {
+ }
+ catch (Exception ex) {
throw new ProjectException("Project has no default domain.",
ex);
}
@@ -66,8 +70,7 @@
DataNode node = domainObj.getNode(name);
if (node == null) {
- throw new ProjectException(
- "Domain "
+ throw new ProjectException("Domain "
+ domainObj.getName()
+ " has no node named '"
+ name
@@ -78,6 +81,7 @@
/**
* Returns the adapter.
+ *
* @return String
*/
public String getAdapter() {
@@ -86,6 +90,7 @@
/**
* Returns the dataSource.
+ *
* @return String
*/
public String getDataSource() {
@@ -94,6 +99,7 @@
/**
* Returns the domain.
+ *
* @return String
*/
public String getDomain() {
@@ -102,6 +108,7 @@
/**
* Returns the driverFile.
+ *
* @return File
*/
public File getDriverFile() {
@@ -110,6 +117,7 @@
/**
* Returns the name.
+ *
* @return String
*/
public String getName() {
@@ -118,6 +126,7 @@
/**
* Sets the adapter.
+ *
* @param adapter The adapter to set
*/
public void setAdapter(String adapter) {
@@ -126,6 +135,7 @@
/**
* Sets the dataSource.
+ *
* @param dataSource The dataSource to set
*/
public void setDataSource(String dataSource) {
@@ -134,6 +144,7 @@
/**
* Sets the domain.
+ *
* @param domain The domain to set
*/
public void setDomain(String domain) {
@@ -142,6 +153,7 @@
/**
* Sets the driverFile.
+ *
* @param driverFile The driverFile to set
*/
public void setDriverFile(File driverFile) {
@@ -150,6 +162,7 @@
/**
* Sets the name.
+ *
* @param name The name to set
*/
public void setName(String name) {
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/PartialProject.java
URL:
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/PartialProject.java?rev=765056&r1=765055&r2=765056&view=diff
==============================================================================
---
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/PartialProject.java
(original)
+++
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/PartialProject.java
Wed Apr 15 05:55:34 2009
@@ -40,6 +40,9 @@
* even when some of the resources are missing. It never instantiates Cayenne
stack
* objects, using other, lightweight, data structures instead.
*
+ * @deprecated since 3.0. {...@link ProjectConfigurator} approach turned out
to be not
+ * usable, and is in fact rarely used (if ever). It will be
removed in
+ * subsequent releases.
*/
public class PartialProject extends Project {
@@ -414,7 +417,7 @@
public String nodeFactoryName(String domainName, String nodeName) {
return (findDomain(domainName).nodes.get(nodeName)).factory;
}
-
+
public String nodeSchemaUpdateStrategyName(String domainName, String
nodeName) {
return
(findDomain(domainName).nodes.get(nodeName)).schemaUpdateStrategy;
}
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigInfo.java
URL:
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigInfo.java?rev=765056&r1=765055&r2=765056&view=diff
==============================================================================
---
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigInfo.java
(original)
+++
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigInfo.java
Wed Apr 15 05:55:34 2009
@@ -24,80 +24,92 @@
import java.util.List;
/**
- * Stores project information necessary to reconfigure existing projects.
- *
+ * Stores project information necessary to reconfigure existing projects.
+ *
+ * @deprecated since 3.0. {...@link ProjectConfigurator} approach turned out
to be not
+ * usable, and is in fact rarely used (if ever). It will be
removed in
+ * subsequent releases.
*/
public class ProjectConfigInfo {
- protected File sourceJar;
- protected File destJar;
- protected File altProjectFile;
- protected List<DataNodeConfigInfo> nodes = new
ArrayList<DataNodeConfigInfo>();
-
- public void addToNodes(DataNodeConfigInfo nodeInfo) {
- nodes.add(nodeInfo);
- }
-
- /**
- * Returns the altProjectFile.
- * @return File
- */
- public File getAltProjectFile() {
- return altProjectFile;
- }
-
- /**
- * Returns the destJar.
- * @return File
- */
- public File getDestJar() {
- return destJar;
- }
-
- /**
- * Returns the nodes.
- * @return List
- */
- public List<DataNodeConfigInfo> getNodes() {
- return nodes;
- }
-
- /**
- * Returns the sourceJar.
- * @return File
- */
- public File getSourceJar() {
- return sourceJar;
- }
-
- /**
- * Sets the altProjectFile.
- * @param altProjectFile The altProjectFile to set
- */
- public void setAltProjectFile(File altProjectFile) {
- this.altProjectFile = altProjectFile;
- }
-
- /**
- * Sets the destJar.
- * @param destJar The destJar to set
- */
- public void setDestJar(File destJar) {
- this.destJar = destJar;
- }
-
- /**
- * Sets the nodes.
- * @param nodes The nodes to set
- */
- public void setNodes(List<DataNodeConfigInfo> nodes) {
- this.nodes = nodes;
- }
-
- /**
- * Sets the sourceJar.
- * @param sourceJar The sourceJar to set
- */
- public void setSourceJar(File sourceJar) {
- this.sourceJar = sourceJar;
- }
+
+ protected File sourceJar;
+ protected File destJar;
+ protected File altProjectFile;
+ protected List<DataNodeConfigInfo> nodes = new
ArrayList<DataNodeConfigInfo>();
+
+ public void addToNodes(DataNodeConfigInfo nodeInfo) {
+ nodes.add(nodeInfo);
+ }
+
+ /**
+ * Returns the altProjectFile.
+ *
+ * @return File
+ */
+ public File getAltProjectFile() {
+ return altProjectFile;
+ }
+
+ /**
+ * Returns the destJar.
+ *
+ * @return File
+ */
+ public File getDestJar() {
+ return destJar;
+ }
+
+ /**
+ * Returns the nodes.
+ *
+ * @return List
+ */
+ public List<DataNodeConfigInfo> getNodes() {
+ return nodes;
+ }
+
+ /**
+ * Returns the sourceJar.
+ *
+ * @return File
+ */
+ public File getSourceJar() {
+ return sourceJar;
+ }
+
+ /**
+ * Sets the altProjectFile.
+ *
+ * @param altProjectFile The altProjectFile to set
+ */
+ public void setAltProjectFile(File altProjectFile) {
+ this.altProjectFile = altProjectFile;
+ }
+
+ /**
+ * Sets the destJar.
+ *
+ * @param destJar The destJar to set
+ */
+ public void setDestJar(File destJar) {
+ this.destJar = destJar;
+ }
+
+ /**
+ * Sets the nodes.
+ *
+ * @param nodes The nodes to set
+ */
+ public void setNodes(List<DataNodeConfigInfo> nodes) {
+ this.nodes = nodes;
+ }
+
+ /**
+ * Sets the sourceJar.
+ *
+ * @param sourceJar The sourceJar to set
+ */
+ public void setSourceJar(File sourceJar) {
+ this.sourceJar = sourceJar;
+ }
}
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigurator.java
URL:
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigurator.java?rev=765056&r1=765055&r2=765056&view=diff
==============================================================================
---
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigurator.java
(original)
+++
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/project/ProjectConfigurator.java
Wed Apr 15 05:55:34 2009
@@ -29,9 +29,13 @@
/**
* Performs on the fly reconfiguration of Cayenne projects.
- *
+ *
+ * @deprecated since 3.0. {...@link ProjectConfigurator} approach turned out
to be not
+ * usable, and is in fact rarely used (if ever). It will be
removed in
+ * subsequent releases.
*/
public class ProjectConfigurator {
+
protected ProjectConfigInfo info;
public ProjectConfigurator(ProjectConfigInfo info) {
@@ -47,7 +51,7 @@
File tmpDir = null;
File tmpDest = null;
try {
- // initialize default settings
+ // initialize default settings
if (info.getDestJar() == null) {
info.setDestJar(info.getSourceJar());
}
@@ -66,17 +70,20 @@
// finally, since everything goes well so far, rename temp file to
final name
if (info.getDestJar().exists() && !info.getDestJar().delete()) {
- throw new IOException(
- "Can't delete old jar file: " + info.getDestJar());
+ throw new IOException("Can't delete old jar file: " +
info.getDestJar());
}
if (!tmpDest.renameTo(info.getDestJar())) {
- throw new IOException(
- "Error renaming: " + tmpDest + " to " + info.getDestJar());
+ throw new IOException("Error renaming: "
+ + tmpDest
+ + " to "
+ + info.getDestJar());
}
- } catch (IOException ex) {
+ }
+ catch (IOException ex) {
throw new ProjectException("Error performing reconfiguration.",
ex);
- } finally {
+ }
+ finally {
if (tmpDir != null) {
cleanup(tmpDir);
}
@@ -90,18 +97,16 @@
/**
* Performs reconfiguration of the unjarred project.
*
- * @param projectDir a directory where a working copy of the project is
- * located.
+ * @param projectDir a directory where a working copy of the project is
located.
*/
- protected void reconfigureProject(File projectDir)
- throws ProjectException {
+ protected void reconfigureProject(File projectDir) throws ProjectException
{
File projectFile = new File(projectDir,
Configuration.DEFAULT_DOMAIN_FILE);
// process alternative project file
if (info.getAltProjectFile() != null) {
if (!Util.copy(info.getAltProjectFile(), projectFile)) {
- throw new ProjectException(
- "Can't copy project file: " + info.getAltProjectFile());
+ throw new ProjectException("Can't copy project file: "
+ + info.getAltProjectFile());
}
}
@@ -112,23 +117,21 @@
DataNodeConfigInfo nodeInfo = it.next();
String name = nodeInfo.getName();
- File targetDriverFile =
- new File(projectDir, name + DataNodeFile.LOCATION_SUFFIX);
+ File targetDriverFile = new File(projectDir, name
+ + DataNodeFile.LOCATION_SUFFIX);
// these are the two cases when the driver file must be deleted
- if (nodeInfo.getDataSource() != null
- || nodeInfo.getDriverFile() != null) {
+ if (nodeInfo.getDataSource() != null || nodeInfo.getDriverFile()
!= null) {
if (targetDriverFile.exists()) {
targetDriverFile.delete();
}
}
if (nodeInfo.getDriverFile() != null
- && !nodeInfo.getDriverFile().equals(targetDriverFile)) {
+ && !nodeInfo.getDriverFile().equals(targetDriverFile)) {
// need to copy file from another location
if (!Util.copy(nodeInfo.getDriverFile(), targetDriverFile)) {
- throw new ProjectException(
- "Can't copy driver file from "
+ throw new ProjectException("Can't copy driver file from "
+ nodeInfo.getDriverFile());
}
}
@@ -150,8 +153,8 @@
File destFolder = info.getDestJar().getParentFile();
if (destFolder != null && !destFolder.isDirectory()) {
if (!destFolder.mkdirs()) {
- throw new IOException(
- "Can't create directory: " +
destFolder.getCanonicalPath());
+ throw new IOException("Can't create directory: "
+ + destFolder.getCanonicalPath());
}
}
@@ -160,8 +163,7 @@
// seeting upper limit on a number of tries, though normally we would
expect
// to succeed from the first attempt...
for (int i = 0; i < 50; i++) {
- File tmpFile =
- (destFolder != null)
+ File tmpFile = (destFolder != null)
? new File(destFolder, baseName + i)
: new File(baseName + i);
if (!tmpFile.exists()) {
@@ -173,7 +175,7 @@
}
/**
- * Deletes a temporary directories and files created.
+ * Deletes a temporary directories and files created.
*/
protected void cleanup(File dir) {
Util.delete(dir.getPath(), true);
@@ -189,8 +191,8 @@
File destFolder = info.getDestJar().getParentFile();
if (destFolder != null && !destFolder.isDirectory()) {
if (!destFolder.mkdirs()) {
- throw new IOException(
- "Can't create directory: " +
destFolder.getCanonicalPath());
+ throw new IOException("Can't create directory: "
+ + destFolder.getCanonicalPath());
}
}
@@ -200,16 +202,15 @@
}
// seeting upper limit on a number of tries, though normally we would
expect
- // to succeed from the first attempt...
+ // to succeed from the first attempt...
for (int i = 0; i < 50; i++) {
- File tmpDir =
- (destFolder != null)
+ File tmpDir = (destFolder != null)
? new File(destFolder, baseName + i)
: new File(baseName + i);
if (!tmpDir.exists()) {
if (!tmpDir.mkdir()) {
- throw new IOException(
- "Can't create directory: " +
tmpDir.getCanonicalPath());
+ throw new IOException("Can't create directory: "
+ + tmpDir.getCanonicalPath());
}
return tmpDir;
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java
URL:
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java?rev=765056&r1=765055&r2=765056&view=diff
==============================================================================
---
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java
(original)
+++
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/DeploymentConfigurator.java
Wed Apr 15 05:55:34 2009
@@ -27,11 +27,14 @@
import org.apache.cayenne.project.ProjectException;
import org.apache.cayenne.util.Util;
import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
/**
* A "cdeploy" Ant task providing an Ant frontend to
* org.apache.cayenne.project.ProjectConfigurator.
*
+ * @deprecated since 3.0. This task turned out to be not usable, and is in
fact rarely
+ * used (if ever). It will be removed in subsequent releases.
*/
public class DeploymentConfigurator extends CayenneTask {
@@ -54,7 +57,11 @@
*/
@Override
public void execute() throws BuildException {
-
+
+ log(
+ "*** cdeploy is deprecated in Cayenne 3.0 and will be removed
in subsequent releases",
+ Project.MSG_WARN);
+
validateAttributes();
try {
Modified:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/project/PartialProjectTest.java
URL:
http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/project/PartialProjectTest.java?rev=765056&r1=765055&r2=765056&view=diff
==============================================================================
---
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/project/PartialProjectTest.java
(original)
+++
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/project/PartialProjectTest.java
Wed Apr 15 05:55:34 2009
@@ -27,6 +27,9 @@
import org.apache.cayenne.util.Util;
/**
+ * @deprecated since 3.0. {...@link ProjectConfigurator} approach turned out
to be not
+ * usable, and is in fact rarely used (if ever). It will be
removed in
+ * subsequent releases.
*/
public class PartialProjectTest extends CayenneCase {
@@ -85,8 +88,7 @@
}
public void testNodes() throws Exception {
- PartialProject.DomainMetaData d2 = project.domains
- .get("d2");
+ PartialProject.DomainMetaData d2 = project.domains.get("d2");
assertNotNull(d2);
assertEquals(2, d2.nodes.size());
}