This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git
The following commit(s) were added to refs/heads/master by this push:
new fcb4bd894 cleanup
fcb4bd894 is described below
commit fcb4bd894e364a282007a1bee14021507623e7f7
Author: Andrus Adamchik <[email protected]>
AuthorDate: Sun Aug 16 14:19:48 2026 -0400
cleanup
---
.../java/org/apache/cayenne/tools/CayenneTask.java | 56 +++++++---------------
.../runtime/DefaultDbAdapterFactory.java | 2 +-
2 files changed, 17 insertions(+), 41 deletions(-)
diff --git
a/cayenne-ant/src/main/java/org/apache/cayenne/tools/CayenneTask.java
b/cayenne-ant/src/main/java/org/apache/cayenne/tools/CayenneTask.java
index b68a7b927..8e2483140 100644
--- a/cayenne-ant/src/main/java/org/apache/cayenne/tools/CayenneTask.java
+++ b/cayenne-ant/src/main/java/org/apache/cayenne/tools/CayenneTask.java
@@ -19,11 +19,6 @@
package org.apache.cayenne.tools;
-import java.io.File;
-import java.net.URL;
-
-import javax.sql.DataSource;
-
import org.apache.cayenne.configuration.DataMapLoader;
import org.apache.cayenne.configuration.DataNodeDescriptor;
import org.apache.cayenne.configuration.runtime.DbAdapterFactory;
@@ -35,10 +30,13 @@ import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
+import javax.sql.DataSource;
+import java.io.File;
+import java.net.URL;
+
/**
- * Base task for all Cayenne ant tasks, providing support for common
- * configuration items.
- *
+ * Base task for all Cayenne ant tasks, providing support for common
configuration items.
+ *
* @since 1.2
*/
public abstract class CayenneTask extends Task {
@@ -53,9 +51,8 @@ public abstract class CayenneTask extends Task {
/**
* Sets the classpath used by the task.
- *
- * @param path
- * The classpath to set.
+ *
+ * @param path The classpath to set.
*/
public void setClasspath(Path path) {
createClasspath().append(path);
@@ -63,19 +60,15 @@ public abstract class CayenneTask extends Task {
/**
* Sets the classpath reference used by the task.
- *
- * @param reference
- * The classpath reference to set.
+ *
+ * @param reference The classpath reference to set.
*/
public void setClasspathRef(Reference reference) {
createClasspath().setRefid(reference);
}
/**
- * Convenience method for creating a classpath instance to be used for the
- * task.
- *
- * @return The new classpath.
+ * Convenience method for creating a classpath instance to be used for the
task.
*/
private Path createClasspath() {
if (null == classpath) {
@@ -87,9 +80,6 @@ public abstract class CayenneTask extends Task {
/**
* Sets the map.
- *
- * @param map
- * The map to set
*/
public void setMap(File map) {
this.map = map;
@@ -97,9 +87,6 @@ public abstract class CayenneTask extends Task {
/**
* Sets the db adapter.
- *
- * @param adapter
- * The db adapter to set.
*/
public void setAdapter(String adapter) {
this.adapter = adapter;
@@ -107,9 +94,6 @@ public abstract class CayenneTask extends Task {
/**
* Sets the JDBC driver used to connect to the database server.
- *
- * @param driver
- * The driver to set.
*/
public void setDriver(String driver) {
this.driver = driver;
@@ -117,9 +101,6 @@ public abstract class CayenneTask extends Task {
/**
* Sets the JDBC URL used to connect to the database server.
- *
- * @param url
- * The url to set.
*/
public void setUrl(String url) {
this.url = url;
@@ -134,29 +115,24 @@ public abstract class CayenneTask extends Task {
/**
* Sets the password used to connect to the database server.
- *
- * @param password
- * The password to set.
*/
public void setPassword(String password) {
this.password = password;
}
- /** Loads and returns DataMap based on <code>map</code> attribute. */
+ /**
+ * Loads and returns DataMap based on <code>map</code> attribute.
+ */
protected DataMap loadDataMap(Injector injector) throws Exception {
DataMapLoader loader = injector.getInstance(DataMapLoader.class);
return loader.load(new URLResource(new URL(map.getCanonicalPath())));
}
- protected DbAdapter getAdapter(Injector injector, DataSource dataSource)
- throws Exception {
-
- DbAdapterFactory adapterFactory = injector
- .getInstance(DbAdapterFactory.class);
+ protected DbAdapter getAdapter(Injector injector, DataSource dataSource) {
DataNodeDescriptor nodeDescriptor = new DataNodeDescriptor();
nodeDescriptor.setAdapterType(adapter);
- return adapterFactory.createAdapter(nodeDescriptor, dataSource);
+ return
injector.getInstance(DbAdapterFactory.class).createAdapter(nodeDescriptor,
dataSource);
}
}
diff --git
a/cayenne/src/main/java/org/apache/cayenne/configuration/runtime/DefaultDbAdapterFactory.java
b/cayenne/src/main/java/org/apache/cayenne/configuration/runtime/DefaultDbAdapterFactory.java
index 0ed4dec2a..a1a20b6f0 100644
---
a/cayenne/src/main/java/org/apache/cayenne/configuration/runtime/DefaultDbAdapterFactory.java
+++
b/cayenne/src/main/java/org/apache/cayenne/configuration/runtime/DefaultDbAdapterFactory.java
@@ -72,7 +72,7 @@ public class DefaultDbAdapterFactory implements
DbAdapterFactory {
// must not create AutoAdapter via objectFactory, so treat explicit
// AutoAdapter as null and let it fall through to the default.
(explicit
- // AutoAdapter is often passed from the cdbimport pligin).
+ // AutoAdapter is often passed from the cdbimport plugin).
if (adapterType != null &&
adapterType.equals(AutoAdapter.class.getName())) {
adapterType = null;
}