From c55d8e6cff9a530e073cb7fc94c5d5ffa008f4a2 Mon Sep 17 00:00:00 2001 From: Seva Safris Date: Tue, 27 Feb 2024 11:48:45 +0700 Subject: [PATCH] Apply auto-formatting, re #8 --- README.md | 130 +++++++++--------- .../java/org/openjax/dbcp/DataSources.java | 48 ++++--- .../org/openjax/dbcp/DelegateDataSource.java | 2 +- 3 files changed, 93 insertions(+), 87 deletions(-) diff --git a/README.md b/README.md index 37e1ad4..326c138 100644 --- a/README.md +++ b/README.md @@ -28,71 +28,71 @@ OpenJAX DBCP is based on a [XML Schema][dbcp-schema] used to specify the formal 1. Create a `dbcp.xml` in `src/main/resources/`. ```xml - - - jdbc:derby:memory:example;create=true - org.apache.derby.jdbc.EmbeddedDriver - - - catalog - true - false - 300000 - READ_UNCOMMITTED - - - - - - - - SELECT 1 FROM SYSIBM.SYSDUMMY1 - SELECT 1 FROM SYSIBM.SYSDUMMY1 - - - - 0 - 8 - 8 - 0 - INDEFINITE - - - lifo - false - INDEFINITE - INDEFINITE - true - true - - true - false - - 300000 - 3 - 1800000 - INDEFINITE - org.openjax.dbcp.MockEvictionPolicy - - - - SELECT 1 FROM SYSIBM.SYSDUMMY1 - false - false - false - - 42X01 42X02 42X03 - - - - INFO - true - true - - + + + jdbc:derby:memory:example;create=true + org.apache.derby.jdbc.EmbeddedDriver + + + catalog + true + false + 300000 + READ_UNCOMMITTED + + + + + + + + SELECT 1 FROM SYSIBM.SYSDUMMY1 + SELECT 1 FROM SYSIBM.SYSDUMMY1 + + + + 0 + 8 + 8 + 0 + + + + lifo + false + INDEFINITE + INDEFINITE + true + true + + true + false + + 300000 + 3 + 1800000 + INDEFINITE + org.openjax.dbcp.MockEvictionPolicy + + + + SELECT 1 FROM SYSIBM.SYSDUMMY1 + false + false + false + + 42X01 42X02 42X03 + + + + INFO + true + true + + ``` 1. Add `org.openjax:dbcp` dependency to the POM. diff --git a/src/main/java/org/openjax/dbcp/DataSources.java b/src/main/java/org/openjax/dbcp/DataSources.java index 81aa306..33662ee 100644 --- a/src/main/java/org/openjax/dbcp/DataSources.java +++ b/src/main/java/org/openjax/dbcp/DataSources.java @@ -121,9 +121,9 @@ public static BasicDataSource createDataSource(final URL url, final ClassLoader } /** - * Create a {@link BasicDataSource} from the configuration supplied by the array of {@link Dbcp dbcp} JAX-B bindings that match - * the specified {@code id}. {@link ClassLoader#getSystemClassLoader()} will be used by the {@link BasicDataSource} when it loads - * the JDBC driver. + * Create a {@link BasicDataSource} from the configuration supplied by the array of {@link Dbcp dbcp} JAX-B bindings that match the + * specified {@code id}. {@link ClassLoader#getSystemClassLoader()} will be used by the {@link BasicDataSource} when it loads the + * JDBC driver. * * @param id The id of the {@link Dbcp dbcp} bindings to match, or {@code null} to match all bindings. * @param dbcps Array of {@link Dbcp} JAX-B bindings. @@ -136,9 +136,8 @@ public static BasicDataSource createDataSource(final String id, final Dbcp ... d } /** - * Create a {@link BasicDataSource} from the configuration supplied by the array of {@link Dbcp dbcp} JAX-B bindings that match - * any {@code id}. {@link ClassLoader#getSystemClassLoader()} will be used by the {@link BasicDataSource} when it loads the JDBC - * driver. + * Create a {@link BasicDataSource} from the configuration supplied by the array of {@link Dbcp dbcp} JAX-B bindings that match any + * {@code id}. {@link ClassLoader#getSystemClassLoader()} will be used by the {@link BasicDataSource} when it loads the JDBC driver. * * @param dbcps Array of {@link Dbcp} JAX-B bindings. * @return The {@link BasicDataSource} instance. @@ -181,8 +180,8 @@ public static BasicDataSource createDataSource(final $Dbcp ... dbcps) { /** * Create a {@link BasicDataSource} from the configuration supplied by the {@code /dbcp:dbcp} child elements of the provided - * {@link org.openjax.dbcp_1_2.Dbcps} JAX-B binding that match the specified {@code id}. - * {@link ClassLoader#getSystemClassLoader()} will be used by the {@link BasicDataSource} when it loads the JDBC driver. + * {@link org.openjax.dbcp_1_2.Dbcps} JAX-B binding that match the specified {@code id}. {@link ClassLoader#getSystemClassLoader()} + * will be used by the {@link BasicDataSource} when it loads the JDBC driver. * * @param id The id of the {@code /dbcp:dbcp} child elements of the provided {@link org.openjax.dbcp_1_2.Dbcps} to match, or * {@code null} to match all child elements. @@ -213,8 +212,8 @@ public static BasicDataSource createDataSource(final org.openjax.dbcp_1_2.Dbcps /** * Create a {@link BasicDataSource} from the configuration supplied by the {@code /dbcp:dbcp} child elements of the provided - * {@link Dbcps} JAX-SB binding that match the specified {@code id}. {@link ClassLoader#getSystemClassLoader()} will be used by - * the {@link BasicDataSource} when it loads the JDBC driver. + * {@link Dbcps} JAX-SB binding that match the specified {@code id}. {@link ClassLoader#getSystemClassLoader()} will be used by the + * {@link BasicDataSource} when it loads the JDBC driver. * * @param id The id of the {@code /dbcp:dbcp} child elements of the provided {@link Dbcps} to match, or {@code null} to match all * child elements. @@ -336,9 +335,9 @@ public static BasicDataSource createDataSource(final ClassLoader driverClassLoad } /** - * Create a {@link BasicDataSource} from the configuration supplied by the array of {@link Dbcp dbcp} JAX-B bindings that that - * match any {@code id}. {@link ClassLoader#getSystemClassLoader()} will be used by the {@link BasicDataSource} when it loads the - * JDBC driver. + * Create a {@link BasicDataSource} from the configuration supplied by the array of {@link Dbcp dbcp} JAX-B bindings that that match + * any {@code id}. {@link ClassLoader#getSystemClassLoader()} will be used by the {@link BasicDataSource} when it loads the JDBC + * driver. * * @param dbcp The {@link Dbcp} JAX-B bindings providing the configuration. * @return The {@link BasicDataSource} instance. @@ -413,8 +412,8 @@ public static BasicDataSource createDataSource(final $Dbcp dbcp) { private boolean logAbandoned = false; /** - * Create a {@link BasicDataSource} from the configuration supplied by the array of {@link Dbcp dbcp} JAX-B bindings that match - * the specified {@code id}. + * Create a {@link BasicDataSource} from the configuration supplied by the array of {@link Dbcp dbcp} JAX-B bindings that match the + * specified {@code id}. * * @param id The id of the {@link Dbcp dbcp} bindings to match, or {@code null} to match all bindings. * @param driverClassLoader Class loader to be used by the {@link BasicDataSource} when it loads the JDBC driver. @@ -493,7 +492,8 @@ private DataSources(final String id, final ClassLoader driverClassLoader, final final int i$ = properties.size(); if (i$ > 0) { if (CollectionUtil.isRandomAccess(properties)) { - int i = 0; do { // [RA] + int i = 0; + do { // [RA] final Dbcp.Connection.Properties.Property property = properties.get(i); final String name = property.getName(); final String value = property.getValue(); @@ -503,7 +503,8 @@ private DataSources(final String id, final ClassLoader driverClassLoader, final while (++i < i$); } else { - final Iterator it = properties.iterator(); do { // [I] + final Iterator it = properties.iterator(); + do { // [I] final Dbcp.Connection.Properties.Property property = it.next(); final String name = property.getName(); final String value = property.getValue(); @@ -730,7 +731,8 @@ private DataSources(final String id, final ClassLoader driverClassLoader, final final int i$ = properties.size(); if (i$ > 0) { if (CollectionUtil.isRandomAccess(properties)) { - int i = 0; do { // [RA] + int i = 0; + do { // [RA] final $Dbcp.Connection.Properties.Property property = properties.get(i); final $Dbcp.Connection.Properties.Property.Name$ name = property.getName$(); final $Dbcp.Connection.Properties.Property.Value$ value = property.getValue$(); @@ -740,7 +742,8 @@ private DataSources(final String id, final ClassLoader driverClassLoader, final while (++i < i$); } else { - final Iterator<$Dbcp.Connection.Properties.Property> it = properties.iterator(); do { // [I] + final Iterator<$Dbcp.Connection.Properties.Property> it = properties.iterator(); + do { // [I] final $Dbcp.Connection.Properties.Property property = it.next(); final $Dbcp.Connection.Properties.Property.Name$ name = property.getName$(); final $Dbcp.Connection.Properties.Property.Value$ value = property.getValue$(); @@ -758,12 +761,15 @@ private DataSources(final String id, final ClassLoader driverClassLoader, final if (initSqls != null && (size = (sqls = initSqls.getInitSql()).size()) > 0) { final String[] sql = new String[size]; if (CollectionUtil.isRandomAccess(sqls)) { - int i = 0; do // [RA] + int i = 0; + do // [RA] sql[i] = sqls.get(i).text(); while (++i < size); } else { - int i = -1; final Iterator<$StringNonEmpty> it = sqls.iterator(); do // [I] + int i = -1; + final Iterator<$StringNonEmpty> it = sqls.iterator(); + do // [I] sql[++i] = it.next().text(); while (it.hasNext()); } diff --git a/src/main/java/org/openjax/dbcp/DelegateDataSource.java b/src/main/java/org/openjax/dbcp/DelegateDataSource.java index f81d6d1..57e32ce 100644 --- a/src/main/java/org/openjax/dbcp/DelegateDataSource.java +++ b/src/main/java/org/openjax/dbcp/DelegateDataSource.java @@ -77,7 +77,7 @@ public Logger getParentLogger() throws SQLFeatureNotSupportedException { } @Override - public T unwrap(final Class iface) throws SQLException { + public T unwrap(final Class iface) throws SQLException { return target.unwrap(iface); }