[java-plugin-storage-jdbc] 02/02: OSJ-342 Investigate Strategies to end of life our use of Hibernate in V5
Rod Widdowson
rdw at steadingsoftware.com
Thu May 26 19:08:32 UTC 2022
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-plugin-storage-jdbc.
View the commit online:
http://git.shibboleth.net/view/?p=java-plugin-storage-jdbc.git;a=commit;h=abc86fddebe1ccb3ccc2565e7d8fd2e70a291a46
commit abc86fddebe1ccb3ccc2565e7d8fd2e70a291a46
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed May 25 11:46:57 2022 +0100
OSJ-342 Investigate Strategies to end of life our use of Hibernate in V5
https://shibboleth.atlassian.net/browse/OSJ-342
Add, enable and enforce checkstyle for the java modules (with longer file length
than usual)
---
checkstyle.xml | 9 ++--
jdbc-storage-api/.checkstyle | 12 +++++
.../shibboleth/plugin/storage/jdbc/Version.java | 16 ++++++
jdbc-storage-impl/.checkstyle | 12 +++++
.../storage/jdbc/impl/JDBCStorageModule.java | 16 ++++++
.../storage/jdbc/impl/JDBCStoragePlugin.java | 16 ++++++
.../storage/jdbc/impl/JDBCStorageService.java | 57 +++++++++++++---------
7 files changed, 111 insertions(+), 27 deletions(-)
diff --git a/checkstyle.xml b/checkstyle.xml
index f3f13f6..1398b2d 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
This configuration file was written by the eclipse-cs plugin configuration editor
@@ -11,10 +11,9 @@
<module name="Checker">
<property name="severity" value="warning"/>
<module name="TreeWalker">
- <property name="tabWidth" value="4"/>
<module name="JavadocMethod"/>
<module name="JavadocType">
- <property name="allowUnknownTags" value="true"/>
+ <property name="allowUnknownTags" value="true"/>
</module>
<module name="JavadocVariable"/>
<module name="JavadocStyle">
@@ -90,8 +89,8 @@
<property name="tokens" value="METHOD_DEF,CTOR_DEF,LITERAL_CATCH"/>
</module>
<module name="FinalLocalVariable">
- <property name="tokens" value="PARAMETER_DEF,VARIABLE_DEF"/>
<property name="validateEnhancedForLoopVariable" value="true"/>
+ <property name="tokens" value="PARAMETER_DEF,VARIABLE_DEF"/>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="\bCheck[Ss]tyle:\s*([\w|]+)\s+OFF\b"/>
@@ -105,7 +104,7 @@
</module>
<module name="FileTabCharacter"/>
<module name="FileLength">
- <property name="max" value="1000"/>
+ <property name="max" value="1200"/>
</module>
<module name="Header">
<property name="header" value="/*\n * Licensed to the University Corporation for Advanced Internet Development,\n * Inc. (UCAID) under one or more contributor license agreements. See the\n * NOTICE file distributed with this work for additional information regarding\n * copyright ownership. The UCAID licenses this file to You under the Apache\n * License, Version 2.0 (the "License"); you may not use this file except in\n * compliance with the License. You may obtain a cop [...]
diff --git a/jdbc-storage-api/.checkstyle b/jdbc-storage-api/.checkstyle
new file mode 100644
index 0000000..fd9fc93
--- /dev/null
+++ b/jdbc-storage-api/.checkstyle
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <local-check-config name="Shibboleth Checkstyle" location="/jdbc-storage-parent/checkstyle.xml" type="project" description="">
+ <additional-data name="cache-props-file-location" value="null_1312636288299_cache.properties"/>
+ <additional-data name="cache-file-location" value="null_1312636288299_cache.xml"/>
+ <additional-data name="protect-config-file" value="false"/>
+ </local-check-config>
+ <fileset name="all" enabled="true" check-config-name="Shibboleth Checkstyle" local="true">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+</fileset-config>
diff --git a/jdbc-storage-api/src/main/java/net/shibboleth/plugin/storage/jdbc/Version.java b/jdbc-storage-api/src/main/java/net/shibboleth/plugin/storage/jdbc/Version.java
index 7dc236e..644ac15 100644
--- a/jdbc-storage-api/src/main/java/net/shibboleth/plugin/storage/jdbc/Version.java
+++ b/jdbc-storage-api/src/main/java/net/shibboleth/plugin/storage/jdbc/Version.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You 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.
+ */
package net.shibboleth.plugin.storage.jdbc;
import javax.annotation.Nullable;
diff --git a/jdbc-storage-impl/.checkstyle b/jdbc-storage-impl/.checkstyle
new file mode 100644
index 0000000..fd9fc93
--- /dev/null
+++ b/jdbc-storage-impl/.checkstyle
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <local-check-config name="Shibboleth Checkstyle" location="/jdbc-storage-parent/checkstyle.xml" type="project" description="">
+ <additional-data name="cache-props-file-location" value="null_1312636288299_cache.properties"/>
+ <additional-data name="cache-file-location" value="null_1312636288299_cache.xml"/>
+ <additional-data name="protect-config-file" value="false"/>
+ </local-check-config>
+ <fileset name="all" enabled="true" check-config-name="Shibboleth Checkstyle" local="true">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+</fileset-config>
diff --git a/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageModule.java b/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageModule.java
index 3e6978d..ff460bd 100644
--- a/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageModule.java
+++ b/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageModule.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You 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.
+ */
package net.shibboleth.plugin.storage.jdbc.impl;
import java.io.IOException;
diff --git a/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStoragePlugin.java b/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStoragePlugin.java
index 3b7498b..a17829a 100644
--- a/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStoragePlugin.java
+++ b/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStoragePlugin.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You 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.
+ */
package net.shibboleth.plugin.storage.jdbc.impl;
import java.io.IOException;
diff --git a/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java b/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java
index 18d9f76..5ecf6bf 100644
--- a/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java
+++ b/jdbc-storage-impl/src/main/java/net/shibboleth/plugin/storage/jdbc/impl/JDBCStorageService.java
@@ -1,4 +1,3 @@
-// Checkstyle: FileLength|Header OFF
/*
* Licensed to the University Corporation for Advanced Internet Development,
* Inc. (UCAID) under one or more contributor license agreements. See the
@@ -59,7 +58,7 @@ import net.shibboleth.utilities.java.support.primitive.StringSupport;
/**
- * Implementation of {@link org.opensaml.storage.StorageService} that uses native JDBC to persist to a database.
+ * Implementation of {@link org.opensaml.storage.StorageService} that uses native JDBC to persist to a database.
*/
public final class JDBCStorageService extends AbstractStorageService implements StorageCapabilitiesEx {
@@ -255,9 +254,9 @@ public final class JDBCStorageService extends AbstractStorageService implements
*/
public void setTransactionIsolation(final int what) {
Constraint.isTrue(what == Connection.TRANSACTION_READ_COMMITTED ||
- what == Connection.TRANSACTION_READ_UNCOMMITTED ||
- what == Connection.TRANSACTION_REPEATABLE_READ ||
- what == Connection.TRANSACTION_SERIALIZABLE,
+ what == Connection.TRANSACTION_READ_UNCOMMITTED ||
+ what == Connection.TRANSACTION_REPEATABLE_READ ||
+ what == Connection.TRANSACTION_SERIALIZABLE,
"Invalid value for TransactionIsolation");
transactionIsolation = what;
}
@@ -499,8 +498,10 @@ public final class JDBCStorageService extends AbstractStorageService implements
/** {@inheritDoc} */
// Checkstyle: CyclomaticComplexity OFF
- public boolean create(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key,
- @Nonnull @NotEmpty final String value, @Nullable @Positive final Long expiration) throws IOException {
+ public boolean create(@Nonnull @NotEmpty final String context,
+ @Nonnull @NotEmpty final String key,
+ @Nonnull @NotEmpty final String value,
+ @Nullable @Positive final Long expiration) throws IOException {
Constraint.isNotEmpty(Constraint.isNotNull(context, "create: context must not be null"),
"create: context must not be empty");
Constraint.isNotEmpty(Constraint.isNotNull(value, "create: value must not be null"),
@@ -575,8 +576,9 @@ public final class JDBCStorageService extends AbstractStorageService implements
}
/** {@inheritDoc} */
- @Override @Nonnull public <T> Pair<Long, StorageRecord<T>> read(@Nonnull @NotEmpty final String context,
- @Nonnull @NotEmpty final String key, @Positive final long version) throws IOException {
+ @Override @Nonnull public <T> Pair<Long, StorageRecord<T>>
+ read(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key,
+ @Positive final long version) throws IOException {
return readImpl(context, key, version);
}
@@ -594,7 +596,8 @@ public final class JDBCStorageService extends AbstractStorageService implements
*/
// Checkstyle: CyclomaticComplexity OFF
@Nonnull protected <T> Pair<Long, StorageRecord<T>> readImpl(@Nonnull @NotEmpty final String context,
- @Nonnull @NotEmpty final String key, @Positive @Nullable final Long version) throws IOException {
+ @Nonnull @NotEmpty final String key,
+ @Positive @Nullable final Long version) throws IOException {
Constraint.isNotEmpty(Constraint.isNotNull(context, "read: context must not be null"),
"read: context must not be empty");
@@ -657,8 +660,10 @@ public final class JDBCStorageService extends AbstractStorageService implements
// Checkstyle: CyclomaticComplexity ON
/** {@inheritDoc} */
- @Override public boolean update(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key,
- @Nonnull @NotEmpty final String value, @Nullable @Positive final Long expiration) throws IOException {
+ @Override public boolean update(@Nonnull @NotEmpty final String context,
+ @Nonnull @NotEmpty final String key,
+ @Nonnull @NotEmpty final String value,
+ @Nullable @Positive final Long expiration) throws IOException {
try {
return updateImpl(null, context, key, value, expiration) != null;
} catch (final VersionMismatchException e) {
@@ -668,15 +673,18 @@ public final class JDBCStorageService extends AbstractStorageService implements
/** {@inheritDoc} */
@Override @Nullable public Long updateWithVersion(@Positive final long version,
- @Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key,
- @Nonnull @NotEmpty final String value, @Nullable @Positive final Long expiration) throws IOException,
- VersionMismatchException {
+ @Nonnull @NotEmpty final String context,
+ @Nonnull @NotEmpty final String key,
+ @Nonnull @NotEmpty final String value,
+ @Nullable @Positive final Long expiration)
+ throws IOException, VersionMismatchException {
return updateImpl(version, context, key, value, expiration);
}
/** {@inheritDoc} */
@Override public boolean updateExpiration(@Nonnull @NotEmpty final String context,
- @Nonnull @NotEmpty final String key, @Nullable @Positive final Long expiration) throws IOException {
+ @Nonnull @NotEmpty final String key,
+ @Nullable @Positive final Long expiration) throws IOException {
try {
return updateImpl(null, context, key, null, expiration) != null;
} catch (final VersionMismatchException e) {
@@ -698,9 +706,12 @@ public final class JDBCStorageService extends AbstractStorageService implements
* @throws VersionMismatchException if the record found contains a version that does not match the parameter
*/
// Checkstyle: CyclomaticComplexity OFF
- @Nullable protected Long updateImpl(@Nullable final Long version, @Nonnull @NotEmpty final String context,
- @Nonnull @NotEmpty final String key, @Nonnull @NotEmpty final String value,
- @Nullable @Positive final Long expires) throws IOException, VersionMismatchException {
+ @Nullable protected Long updateImpl(@Nullable final Long version,
+ @Nonnull @NotEmpty final String context,
+ @Nonnull @NotEmpty final String key,
+ @Nonnull @NotEmpty final String value,
+ @Nullable @Positive final Long expires)
+ throws IOException, VersionMismatchException {
Constraint.isNotEmpty(Constraint.isNotNull(context, "update: context must not be null"),
"update: context must not be empty");
@@ -770,8 +781,10 @@ public final class JDBCStorageService extends AbstractStorageService implements
// Checkstyle: CyclomaticComplexity ON
/** {@inheritDoc} */
- @Override public boolean deleteWithVersion(@Positive final long version, @Nonnull @NotEmpty final String context,
- @Nonnull @NotEmpty final String key) throws IOException, VersionMismatchException {
+ @Override public boolean deleteWithVersion(@Positive final long version,
+ @Nonnull @NotEmpty final String context,
+ @Nonnull @NotEmpty final String key)
+ throws IOException, VersionMismatchException {
return deleteImpl(version, context, key);
}
@@ -1098,7 +1111,7 @@ public final class JDBCStorageService extends AbstractStorageService implements
}
}
- /** Delegated operation to the encapsulated {@link Connection}.
+ /** Delegated operation to the encapsulated {@link Connection}.
* @param sql what to prepare
* @return what the encapsulated {@link Connection} returns
* @throws SQLException if encapsulated {@link Connection} does
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list