[java-support] 01/02: IDP-1595 Make PluginDescription an interface
Rod Widdowson
rdw at steadingsoftware.com
Sun Jul 5 13:43:59 UTC 2020
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch master
in repository java-support.
View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=291ec92499cf5347acc6064ee91a19e45bbaf37d
commit 291ec92499cf5347acc6064ee91a19e45bbaf37d
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Jul 5 13:33:28 2020 +0100
IDP-1595 Make PluginDescription an interface
https://issues.shibboleth.net/jira/browse/IDP-1595
And introduce a new abstract class. That should make future
proofing easier.
---
.../support/plugin/AbstractPluginDescription.java | 63 ++++++++++++
.../java/support/plugin/PluginDescription.java | 34 +++----
.../java/support/plugin/PluginInstaller.java | 113 ---------------------
3 files changed, 76 insertions(+), 134 deletions(-)
diff --git a/src/main/java/net/shibboleth/utilities/java/support/plugin/AbstractPluginDescription.java b/src/main/java/net/shibboleth/utilities/java/support/plugin/AbstractPluginDescription.java
new file mode 100644
index 0000000..b4f5474
--- /dev/null
+++ b/src/main/java/net/shibboleth/utilities/java/support/plugin/AbstractPluginDescription.java
@@ -0,0 +1,63 @@
+/*
+ * 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.utilities.java.support.plugin;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.Collections;
+import java.util.List;
+
+import javax.annotation.Nonnegative;
+import javax.annotation.Nonnull;
+
+import com.google.common.annotations.Beta;
+
+import net.shibboleth.utilities.java.support.collection.Pair;
+import net.shibboleth.utilities.java.support.resource.Resource;
+
+/**
+ * This class is exported (via the service API) by every plugin.
+ */
+ at Beta
+public abstract class AbstractPluginDescription implements PluginDescription {
+
+ /** {@inheritDoc} */
+ @Nonnull public List<String> getAdditionalPropertyFiles() {
+ return Collections.emptyList();
+ }
+
+ /** {@inheritDoc} */
+ @Nonnull public List<Path> getFilePathsToCopy() {
+ return Collections.emptyList();
+ }
+
+ /** {@inheritDoc} */
+ @Nonnull public List<Pair<Resource, Path>> getExternalFilePathsToCopy() throws IOException {
+ return Collections.emptyList();
+ }
+
+ /** {@inheritDoc} */
+ @Nonnull public List<Pair<Path, List<String>>> getPropertyMerges() {
+ return Collections.emptyList();
+ }
+
+ /** {@inheritDoc} */
+ @Nonnegative public int getPatchVersion() {
+ return 0;
+ }
+}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/plugin/PluginDescription.java b/src/main/java/net/shibboleth/utilities/java/support/plugin/PluginDescription.java
index 7641346..70b602d 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/plugin/PluginDescription.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/plugin/PluginDescription.java
@@ -19,12 +19,13 @@ package net.shibboleth.utilities.java.support.plugin;
import java.io.IOException;
import java.nio.file.Path;
-import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
+import com.google.common.annotations.Beta;
+
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
import net.shibboleth.utilities.java.support.annotation.constraint.Positive;
@@ -34,7 +35,8 @@ import net.shibboleth.utilities.java.support.resource.Resource;
/**
* This class is exported (via the service API) by every plugin.
*/
-public abstract class PluginDescription {
+ at Beta
+public interface PluginDescription {
/** Return the unique identifier for the plugin. This name <em>MUST</em> be
* <ul>
@@ -45,15 +47,13 @@ public abstract class PluginDescription {
*
* @return The id of this plugin.
*/
- @Nonnull @NotEmpty public abstract String getPluginId();
+ @Nonnull @NotEmpty public String getPluginId();
/** Return the list of file names to be appended to
* <code>idp.additional.properties</code>.
* @return The list of names, potentially empty.
*/
- @Nonnull public List<String> getAdditionalPropertyFiles() {
- return Collections.emptyList();
- }
+ @Nonnull public List<String> getAdditionalPropertyFiles();
/** Return the list of (idp.home) relative paths (of files, <em>not directories </em>)
* to copy from the distribution into the IdP installation.
@@ -66,9 +66,7 @@ public abstract class PluginDescription {
*
* @return The list of paths.
*/
- @Nonnull public List<Path> getFilePathsToCopy() {
- return Collections.emptyList();
- }
+ @Nonnull public List<Path> getFilePathsToCopy();
/** <p>Return the list of files <em>not directories </em> to get from 'external'
* sources. This allows external content to be downloaded during installation.</p>
@@ -81,9 +79,7 @@ public abstract class PluginDescription {
* @return The list.
* @throws IOException if the resource construction failed.
*/
- @Nonnull public List<Pair<Resource, Path>> getExternalFilePathsToCopy() throws IOException {
- return Collections.emptyList();
- }
+ @Nonnull public List<Pair<Resource, Path>> getExternalFilePathsToCopy() throws IOException;
/** Return the places to look for updates for this plugin package.
* The format of the paths below this point is fixed.
@@ -91,7 +87,7 @@ public abstract class PluginDescription {
* @return At least one Resource.
* @throws IOException if the resource construction failed.
*/
- @Nonnull @NotEmpty @NonnullElements public abstract List<Resource> getUpdateResources() throws IOException;
+ @Nonnull @NotEmpty @NonnullElements public List<Resource> getUpdateResources() throws IOException;
/** Return this properties that require list merging.
*
@@ -104,30 +100,26 @@ public abstract class PluginDescription {
* @return A list of pairs, the first element of the pair is the (relative) path of the property file
* and the second is a list of property names to edit within that file.
*/
- @Nonnull public List<Pair<Path, List<String>>> getPropertyMerges() {
- return Collections.emptyList();
- }
+ @Nonnull public List<Pair<Path, List<String>>> getPropertyMerges();
/** Return the major version, (as defined by the
* <a href="https://wiki.shibboleth.net/confluence/display/DEV/Java+Product+Version+Policy">
* Java Product Version Policy</a>.
* @return The major version.
*/
- @Positive public abstract int getMajorVersion();
+ @Positive public int getMajorVersion();
/** Return the minor version, (as defined by the
* <a href="https://wiki.shibboleth.net/confluence/display/DEV/Java+Product+Version+Policy">
* Java Product Version Policy</a>.
* @return The minor version.
*/
- @Nonnegative public abstract int getMinorVersion();
+ @Nonnegative public int getMinorVersion();
/** Return The patch version, (as defined by the
* <a href="https://wiki.shibboleth.net/confluence/display/DEV/Java+Product+Version+Policy">
* Java Product Version Policy</a>.
* @return The patch version.
*/
- @Nonnegative public int getPatchVersion() {
- return 0;
- }
+ @Nonnegative public int getPatchVersion();
}
diff --git a/src/main/java/net/shibboleth/utilities/java/support/plugin/PluginInstaller.java b/src/main/java/net/shibboleth/utilities/java/support/plugin/PluginInstaller.java
deleted file mode 100644
index f4c6ad3..0000000
--- a/src/main/java/net/shibboleth/utilities/java/support/plugin/PluginInstaller.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.utilities.java.support.plugin;
-
-import java.net.URL;
-import java.nio.file.Path;
-import java.util.Collections;
-import java.util.List;
-
-import javax.annotation.Nonnegative;
-import javax.annotation.Nonnull;
-
-import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
-import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
-import net.shibboleth.utilities.java.support.annotation.constraint.Positive;
-import net.shibboleth.utilities.java.support.collection.Pair;
-
-/**
- * This class is exported (via the service API) by every plugin.
- */
-public abstract class PluginInstaller {
-
- /** Return the unique identifier for the plugin. This name <em>MUST</em> be
- * <ul>
- * <li> renderable in all file systems (for instance alphanumerics, '-' and '.' only)</li>
- * <li> unique. This is best done using java module guidance</li>
- * </ul>
- * For instance <code>org.example.plugins.myplugin</code>
- *
- * @return The id of this plugin.
- */
- @Nonnull @NotEmpty abstract String getPluginId();
-
- /** Return the list of file names to be appended to
- * <code>idp.additional.properties</code>.
- * @return The list of names, potentially empty.
- */
- @Nonnull List<String> getAdditionalPropertyFiles() {
- return Collections.emptyList();
- }
-
- /** Return the list of (idp.home) relative paths (of files, <em>not directories </em>)
- * to copy from the distribution into the IdP installation.<p>
- *
- * These files are copied non-destructively (if the file already exists
- * then it is not copied). Some paths are disallowed (for instance dist and system).</p>
- * <p>
- * The dist folder is always copied, so no files from it should be included.</p>
- * @return The list of paths.
- */
- @Nonnull List<Path> getFilePathsToCopy() {
- return Collections.emptyList();
- }
-
- /** Return the places to look for updates for this plugin package.
- * The format of the paths below this URL is fixed.
- * @return At least one URL.
- */
- @Nonnull @NotEmpty @NonnullElements abstract List<URL> getUpdateURLs();
-
- /** Return this properties that require list merging.
- *
- * <p>Given
- * an property called (say) <code>idp.service.foo</code> in file <code>services.property</code>
- * and an init setting of <code>idp.service.foo.bar</code>, the output would be:</p>
- * <pre> idp.service.foo = BEAN.idp.service.foo.plugin-id.net.shibboleth.foo
- * idp.service.foo.OLD.plugin-id = shibboleth.AttributeFilterResources</pre>
- *
- * @return A list of pairs, the first element of the pair is the (relative) path of the property file
- * and the second is a list of property names to edit within that file.
- */
- @Nonnull List<Pair<Path, List<String>>> getPropertyMerges() {
- return Collections.emptyList();
- }
-
- /** Return the major version, (as defined by the
- * <a href="https://wiki.shibboleth.net/confluence/display/DEV/Java+Product+Version+Policy">
- * Java Product Version Policy</a>.
- * @return The major version.
- */
- @Positive abstract int getMajorVersion();
-
- /** Return the minor version, (as defined by the
- * <a href="https://wiki.shibboleth.net/confluence/display/DEV/Java+Product+Version+Policy">
- * Java Product Version Policy</a>.
- * @return The minor version.
- */
- @Nonnegative abstract int getMinorVersion();
-
- /** Return The patch version, (as defined by the
- * <a href="https://wiki.shibboleth.net/confluence/display/DEV/Java+Product+Version+Policy">
- * Java Product Version Policy</a>.
- * @return The patch version.
- */
- @Nonnegative int getPatchVersion() {
- return 0;
- }
-}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list