diff --git a/metadata/pom.xml b/metadata/pom.xml deleted file mode 100644 index 5214c4c..0000000 --- a/metadata/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - 4.0.0 - spring-plugin-metadata - - Spring Plugin - Metadata Extension - Extension package for metadata based plugins - - - org.springframework.plugin - spring-plugin - 4.0.0-SNAPSHOT - - - - spring.plugin.metadata - - - - - - ../src/main/resources - true - META-INF - - - - - - - - ${project.groupId} - spring-plugin-core - ${project.version} - - - - - diff --git a/metadata/src/main/java/org/springframework/plugin/metadata/AbstractMetadataBasedPlugin.java b/metadata/src/main/java/org/springframework/plugin/metadata/AbstractMetadataBasedPlugin.java deleted file mode 100644 index e8adc22..0000000 --- a/metadata/src/main/java/org/springframework/plugin/metadata/AbstractMetadataBasedPlugin.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2012 the original author or authors. - * - * Licensed 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 - * - * https://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 org.springframework.plugin.metadata; - -import org.springframework.plugin.core.Plugin; -import org.springframework.plugin.core.PluginRegistry; - -/** - * Abstract base class for plugins based on {@link PluginMetadata}. Plugins based on this class can be selected from the - * {@link PluginRegistry} via an instance of {@link PluginMetadata}. Therefore you can regard this as a role model - * implementation of a base class for certain delimiter implmentations. - * - * @author Oliver Gierke - */ -public abstract class AbstractMetadataBasedPlugin implements Plugin, MetadataProvider { - - private final PluginMetadata metadata; - - /** - * Creates a new instance of {@code AbstractMetadataBasedPlugin}. - * - * @param name must not be {@literal null}. - * @param version must not be {@literal null}. - */ - public AbstractMetadataBasedPlugin(String name, String version) { - this.metadata = new SimplePluginMetadata(name, version); - } - - /* - * (non-Javadoc) - * @see org.springframework.plugin.core.Plugin#supports(java.lang.Object) - */ - public boolean supports(PluginMetadata delimiter) { - return getMetadata().equals(delimiter); - } - - /* - * (non-Javadoc) - * @see org.springframework.plugin.metadata.MetadataProvider#getMetadata() - */ - public PluginMetadata getMetadata() { - return metadata; - } -} diff --git a/metadata/src/main/java/org/springframework/plugin/metadata/MetadataProvider.java b/metadata/src/main/java/org/springframework/plugin/metadata/MetadataProvider.java deleted file mode 100644 index eb754db..0000000 --- a/metadata/src/main/java/org/springframework/plugin/metadata/MetadataProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2008-2012 the original author or authors. - * - * Licensed 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 - * - * https://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 org.springframework.plugin.metadata; - -/** - * Interface for plugins providing metadata information. Usually the plugins will implement this interface themselves. - * - * @author Oliver Gierke - */ -public interface MetadataProvider { - - /** - * Returns the plugins metadata. - * - * @return the plugins metadata - */ - PluginMetadata getMetadata(); -} diff --git a/metadata/src/main/java/org/springframework/plugin/metadata/PluginMetadata.java b/metadata/src/main/java/org/springframework/plugin/metadata/PluginMetadata.java deleted file mode 100644 index 87b85ee..0000000 --- a/metadata/src/main/java/org/springframework/plugin/metadata/PluginMetadata.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2008-2012 the original author or authors. - * - * Licensed 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 - * - * https://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 org.springframework.plugin.metadata; - -/** - * Basic interface to define a set of metadata information for plugins. - * - * @author Oliver Gierke - */ -public interface PluginMetadata { - - /** - * Returns a unique plugin name. Plugins return a metadata implementation have to ensure uniqueness of this name. - * - * @return the name of the plugin - */ - String getName(); - - /** - * Returns the plugin version. This allows rudimentary versioning possibilities. - * - * @return the version of the plugin - */ - String getVersion(); -} diff --git a/metadata/src/main/java/org/springframework/plugin/metadata/SimplePluginMetadata.java b/metadata/src/main/java/org/springframework/plugin/metadata/SimplePluginMetadata.java deleted file mode 100644 index 8d83628..0000000 --- a/metadata/src/main/java/org/springframework/plugin/metadata/SimplePluginMetadata.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2008-2010 the original author or authors. - * - * Licensed 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 - * - * https://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 org.springframework.plugin.metadata; - -import static org.springframework.util.ObjectUtils.*; - -import org.springframework.util.Assert; - -/** - * Value object style implementation of {@code PluginMetadata}. - * - * @author Oliver Gierke - */ -public class SimplePluginMetadata implements PluginMetadata { - - private final String name; - private final String version; - - /** - * Creates a new instance of {@code SimplePluginMetadata}. - * - * @param name must not be {@literal null}. - * @param version must not be {@literal null}. - */ - public SimplePluginMetadata(String name, String version) { - - Assert.hasText(name, "Name must not be null or empty!"); - Assert.hasText(version, "Version must not be null or empty!"); - - this.name = name; - this.version = version; - } - - /* - * (non-Javadoc) - * @see org.springframework.plugin.metadata.PluginMetadata#getName() - */ - public String getName() { - return name; - } - - /* - * (non-Javadoc) - * @see org.springframework.plugin.metadata.PluginMetadata#getVersion() - */ - public String getVersion() { - return version; - } - - /* - * (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return String.format("%s:%s", getName(), getVersion()); - } - - /* - * (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - - if (this == obj) { - return true; - } - - if (!(obj instanceof PluginMetadata)) { - return false; - } - - PluginMetadata that = (PluginMetadata) obj; - - boolean sameName = nullSafeEquals(this.getName(), that.getName()); - boolean sameVersion = nullSafeEquals(this.getVersion(), that.getVersion()); - - return sameName && sameVersion; - } - - /* - * (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - return nullSafeHashCode(name) + nullSafeHashCode(version); - } -} diff --git a/metadata/src/test/java/org/springframework/plugin/metadata/SimplePluginMetadataUnitTest.java b/metadata/src/test/java/org/springframework/plugin/metadata/SimplePluginMetadataUnitTest.java deleted file mode 100644 index e41a99b..0000000 --- a/metadata/src/test/java/org/springframework/plugin/metadata/SimplePluginMetadataUnitTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2015-2021 the original author or authors. - * - * Licensed 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 - * - * https://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 org.springframework.plugin.metadata; - -import static org.assertj.core.api.Assertions.*; - -import org.junit.jupiter.api.Test; - -/** - * Unit tests for {@link SimplePluginMetadata}. - * - * @author Oliver Gierke - */ -class SimplePluginMetadataUnitTest { - - /** - * @see #11 - */ - @Test - void equalsIsWorkingCorrectly() { - - SimplePluginMetadata nameOneOh = new SimplePluginMetadata("Name", "1.0"); - SimplePluginMetadata sameNameOneOh = new SimplePluginMetadata("Name", "1.0"); - SimplePluginMetadata nameTwoOh = new SimplePluginMetadata("Name", "2.0"); - SimplePluginMetadata anotherNameOneOh = new SimplePluginMetadata("AnotherName", "1.0"); - - assertThat(nameOneOh).isEqualTo(nameOneOh); - assertThat(nameOneOh).isEqualTo(sameNameOneOh); - assertThat(sameNameOneOh).isEqualTo(nameOneOh); - - assertThat(nameOneOh).isNotEqualTo(nameTwoOh); - assertThat(nameTwoOh).isNotEqualTo(nameOneOh); - - assertThat(nameOneOh).isNotEqualTo(anotherNameOneOh); - assertThat(anotherNameOneOh).isNotEqualTo(nameOneOh); - } -} diff --git a/pom.xml b/pom.xml index bd9ed62..fc71d40 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,6 @@ core - metadata