Moved project to SpringSource.

This commit is contained in:
Oliver Gierke
2012-02-21 16:04:32 +01:00
parent 49b6dea1f4
commit b4a036b66a
73 changed files with 248 additions and 300 deletions

View File

@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter>
<title>Core</title>
@@ -80,13 +82,13 @@ public class HostImpl implements Host {
<title>Collecting Spring beans dynamically</title>
<para>With the <classname>BeanListBeanFactory</classname>
<productname>Hera</productname> provides a Spring container extension,
that allows to lookup beans of a given type in the current
<productname>Spring Plugin</productname> provides a Spring container
extension, that allows to lookup beans of a given type in the current
<interfacename>ApplicationContext</interfacename> and register them as
list under a given name. Take a look at the configuration now:</para>
<example>
<title>Host and plugin configuration with Hera support</title>
<title>Host and plugin configuration with Spring Plugin support</title>
<programlisting lang="" language="xml">&lt;import resource="classpath*:com/acme/**/plugins.xml" /&gt;
@@ -94,7 +96,7 @@ public class HostImpl implements Host {
&lt;property name="plugins" ref="plugins" /&gt;
&lt;/bean&gt;
&lt;bean class="org.synyx.hera.plugin.support.BeanListBeanFactory"&gt;
&lt;bean class="org.springframework.plugin.support.BeanListBeanFactory"&gt;
&lt;property name="lists"&gt;
&lt;map&gt;
&lt;entry key="plugins" value="org.acme.MyPluginInterface" /&gt;
@@ -141,10 +143,10 @@ public class HostImpl implements Host {
<title>Host configuration using the plugin namespace</title>
<programlisting language="xml">&lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:plugin="http://schemas.synyx.org/hera"
xmlns:plugin="http://www.springframework.org/schema/plugin"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://schemas.synyx.org/hera http://schemas.synyx.org/hera/hera.xsd"&gt;
http://www.springframework.org/schema/plugin http://www.springframework.org/schema/plugin/spring-plugin.xsd"&gt;
&lt;import resource="classpath*:com/acme/**/plugins.xml" /&gt;
@@ -237,7 +239,7 @@ public interface ProductProcessor extends Plugin&lt;ProductType&gt; {
<para>Using a <interfacename>List</interfacename> as plugin container as
well as the <interfacename>Plugin</interfacename> interface you can now
select plugins supporting the given delimiter. To not reimplement the
lookup logic for common cases Hera provides a
lookup logic for common cases Spring Plugin provides a
<classname>PluginRegistry&lt;T extends Plugin&lt;S&gt;,
S&gt;</classname> interface that provides sophisticated methods to
access certain plugins:</para>
@@ -268,9 +270,9 @@ registry.getPluginsFor(ProductType.HARDWARE, new MyException("Damn!");</programl
<title>Configuration and namespace</title>
<para>Similar to the <classname>BeanListBeanFactory</classname>
described in <xref linkend="core.collecting-beans" /> Hera provides a
<classname>PluginRegistryBeanFactory</classname> to automatically lookup
beans of a dedicated type to be aggregated in a
described in <xref linkend="core.collecting-beans" /> Spring Plugin
provides a <classname>PluginRegistryBeanFactory</classname> to
automatically lookup beans of a dedicated type to be aggregated in a
<classname>PluginRegistry</classname>. Note that the type has to be
assignable to <interfacename>Plugin</interfacename> to let the registry
work as expected.</para>
@@ -305,11 +307,11 @@ registry.getPluginsFor(ProductType.HARDWARE, new MyException("Damn!");</programl
the <ulink url="???">section on this topic in the Spring reference
documentation</ulink>.</para>
<para>Using the Hera namespace you will get a
<para>Using the Spring Plugin namespace you will get a
<interfacename>PluginRegistry</interfacename> instance that is capable
of preserving the order defined by the mentioned means. Using Hera
programatically use
of preserving the order defined by the mentioned means. Using Spring
Plugin programatically use
<classname>OrderAwarePluginRegistry</classname>.</para>
</simplesect>
</section>
</chapter>
</chapter>

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core;
package org.springframework.plugin.core;
/**
* Extension of {@link PluginRegistry} with additional methods to modify the registry.

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core;
package org.springframework.plugin.core;
import java.util.ArrayList;
import java.util.Collections;
@@ -142,7 +142,7 @@ public class OrderAwarePluginRegistry<T extends Plugin<S>, S> extends SimplePlug
/*
* (non-Javadoc)
* @see org.synyx.hera.core.SimplePluginRegistry#addPlugin(org.synyx.hera.core.Plugin)
* @see org.springframework.plugin.core.SimplePluginRegistry#addPlugin(org.springframework.plugin.core.Plugin)
*/
@Override
public OrderAwarePluginRegistry<T, S> addPlugin(T plugin) {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core;
package org.springframework.plugin.core;
/**
* Central interface for plugins for the system. This interface is meant to be extended by concrete plugin interfaces.

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core;
package org.springframework.plugin.core;
import java.util.List;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core;
package org.springframework.plugin.core;
import java.util.ArrayList;
import java.util.Collections;
@@ -66,7 +66,7 @@ public class SimplePluginRegistry<T extends Plugin<S>, S> implements MutablePlug
/*
* (non-Javadoc)
* @see org.synyx.hera.core.MutablePluginRegistry#addPlugin(org.synyx.hera.core.Plugin)
* @see org.springframework.plugin.core.MutablePluginRegistry#addPlugin(org.springframework.plugin.core.Plugin)
*/
public SimplePluginRegistry<T, S> addPlugin(T plugin) {
@@ -79,7 +79,7 @@ public class SimplePluginRegistry<T extends Plugin<S>, S> implements MutablePlug
/*
* (non-Javadoc)
* @see org.synyx.hera.core.MutablePluginRegistry#removePlugin(org.synyx.hera.core.Plugin)
* @see org.springframework.plugin.core.MutablePluginRegistry#removePlugin(org.springframework.plugin.core.Plugin)
*/
public boolean removePlugin(T plugin) {
@@ -88,7 +88,7 @@ public class SimplePluginRegistry<T extends Plugin<S>, S> implements MutablePlug
/*
* (non-Javadoc)
* @see org.synyx.hera.core.PluginRegistry#getPluginFor(java.lang.Object)
* @see org.springframework.plugin.core.PluginRegistry#getPluginFor(java.lang.Object)
*/
public T getPluginFor(S delimiter) {
@@ -103,7 +103,7 @@ public class SimplePluginRegistry<T extends Plugin<S>, S> implements MutablePlug
/*
* (non-Javadoc)
* @see org.synyx.hera.core.PluginRegistry#getPluginsFor(java.lang.Object)
* @see org.springframework.plugin.core.PluginRegistry#getPluginsFor(java.lang.Object)
*/
public List<T> getPluginsFor(S delimiter) {
@@ -120,7 +120,7 @@ public class SimplePluginRegistry<T extends Plugin<S>, S> implements MutablePlug
/*
* (non-Javadoc)
* @see org.synyx.hera.core.PluginRegistry#getPluginFor(java.lang.Object, java.lang.Exception)
* @see org.springframework.plugin.core.PluginRegistry#getPluginFor(java.lang.Object, java.lang.Exception)
*/
public <E extends Exception> T getPluginFor(S delimiter, E ex) throws E {
@@ -135,7 +135,7 @@ public class SimplePluginRegistry<T extends Plugin<S>, S> implements MutablePlug
/*
* (non-Javadoc)
* @see org.synyx.hera.core.PluginRegistry#getPluginsFor(java.lang.Object, java.lang.Exception)
* @see org.springframework.plugin.core.PluginRegistry#getPluginsFor(java.lang.Object, java.lang.Exception)
*/
public <E extends Exception> List<T> getPluginsFor(S delimiter, E ex) throws E {
@@ -150,7 +150,7 @@ public class SimplePluginRegistry<T extends Plugin<S>, S> implements MutablePlug
/*
* (non-Javadoc)
* @see org.synyx.hera.core.PluginRegistry#getPluginFor(java.lang.Object, org.synyx.hera.core.Plugin)
* @see org.springframework.plugin.core.PluginRegistry#getPluginFor(java.lang.Object, org.springframework.plugin.core.Plugin)
*/
public T getPluginFor(S delimiter, T plugin) {
@@ -161,7 +161,7 @@ public class SimplePluginRegistry<T extends Plugin<S>, S> implements MutablePlug
/*
* (non-Javadoc)
* @see org.synyx.hera.core.PluginRegistry#getPluginsFor(java.lang.Object, java.util.List)
* @see org.springframework.plugin.core.PluginRegistry#getPluginsFor(java.lang.Object, java.util.List)
*/
public List<T> getPluginsFor(S delimiter, List<? extends T> plugins) {
@@ -172,7 +172,7 @@ public class SimplePluginRegistry<T extends Plugin<S>, S> implements MutablePlug
/*
* (non-Javadoc)
* @see org.synyx.hera.core.PluginRegistry#countPlugins()
* @see org.springframework.plugin.core.PluginRegistry#countPlugins()
*/
public int countPlugins() {
@@ -192,7 +192,7 @@ public class SimplePluginRegistry<T extends Plugin<S>, S> implements MutablePlug
/*
* (non-Javadoc)
* @see org.synyx.hera.core.PluginRegistry#contains(org.synyx.hera.core.Plugin)
* @see org.springframework.plugin.core.PluginRegistry#contains(org.springframework.plugin.core.Plugin)
*/
public boolean contains(T plugin) {
return this.plugins.contains(plugin);
@@ -200,7 +200,7 @@ public class SimplePluginRegistry<T extends Plugin<S>, S> implements MutablePlug
/*
* (non-Javadoc)
* @see org.synyx.hera.core.PluginRegistry#hasPluginFor(java.lang.Object)
* @see org.springframework.plugin.core.PluginRegistry#hasPluginFor(java.lang.Object)
*/
public boolean hasPluginFor(S delimter) {
return null != getPluginFor(delimter);

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core.config;
package org.springframework.plugin.core.config;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
@@ -28,7 +28,7 @@ import org.w3c.dom.Element;
*/
public class PluginListDefinitionParser extends AbstractBeanDefinitionParser {
protected static final String PACKAGE = "org.synyx.hera.core.support.";
protected static final String PACKAGE = "org.springframework.plugin.core.support.";
/**
* Returns the name of the {@link org.springframework.beans.factory.config.BeanFactoryPostProcessor} to be registered.

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core.config;
package org.springframework.plugin.core.config;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core.config;
package org.springframework.plugin.core.config;
/**
@@ -26,7 +26,7 @@ public class PluginRegistryDefinitionParser extends PluginListDefinitionParser {
/*
* (non-Javadoc)
* @see org.synyx.hera.core.config.PluginListDefinitionParser#getPostProcessorName()
* @see org.springframework.plugin.core.config.PluginListDefinitionParser#getPostProcessorName()
*/
@Override
protected String getPostProcessorName() {

View File

@@ -1,5 +1,5 @@
/**
* This package contains configuration support classes to ease registry configuration with Spring namespaces.
*/
package org.synyx.hera.core.config;
package org.springframework.plugin.core.config;

View File

@@ -1,5 +1,5 @@
/**
* This package contains the core plugin API. It allows other modules implementing components that extend functionality defined by a plugin interface. Plugin clients can be equipped with plugin implementations.
*/
package org.synyx.hera.core;
package org.springframework.plugin.core;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core.support;
package org.springframework.plugin.core.support;
import java.util.ArrayList;
import java.util.Collection;

View File

@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.synyx.hera.core.support;
package org.springframework.plugin.core.support;
import java.util.Collections;
import java.util.Comparator;

View File

@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core.support;
package org.springframework.plugin.core.support;
import org.springframework.beans.factory.FactoryBean;
import org.synyx.hera.core.OrderAwarePluginRegistry;
import org.synyx.hera.core.Plugin;
import org.synyx.hera.core.PluginRegistry;
import org.springframework.plugin.core.OrderAwarePluginRegistry;
import org.springframework.plugin.core.Plugin;
import org.springframework.plugin.core.PluginRegistry;
/**
* {@link FactoryBean} to create {@link PluginRegistry} instances. Wraps a {@link BeanListFactoryBean}.

View File

@@ -1,5 +1,5 @@
/**
* This package contains support classes to create bean lists or plugin registry instances out of beans implementing a certain interface.
*/
package org.synyx.hera.core.support;
package org.springframework.plugin.core.support;

View File

@@ -1 +1 @@
http\://schemas.synyx.org/hera=org.synyx.hera.core.config.PluginNamespaceHandler
http\://www.springframework.org/schema/plugin=org.springframework.plugin.core.config.PluginNamespaceHandler

View File

@@ -1 +1 @@
http\://schemas.synyx.org/hera/hera.xsd=org/synyx/hera/core/config/hera.xsd
http\://www.springframework.org/schema/plugin/spring-plugin.xsd=org/springframework/plugin/core/config/spring-plugin.xsd

View File

@@ -1,4 +1,4 @@
# Tooling related information for the Hera namespace
http\://schemas.synyx.org/hera@name=Hera Namespace
http\://schemas.synyx.org/hera@prefix=hera
http\://schemas.synyx.org/hera@icon=org/springframework/beans/factory/xml/spring-beans.gif
# Tooling related information for the Spring Plugin namespace
http\://www.springframework.org/schema/plugin@name=Spring Plugin Namespace
http\://www.springframework.org/schema/plugin@prefix=plugin
http\://www.springframework.org/schema/plugin@icon=org/springframework/beans/factory/xml/spring-beans.gif

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns="http://schemas.synyx.org/hera" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<xsd:schema xmlns="http://www.springframework.org/schema/plugin" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:tool="http://www.springframework.org/schema/tool"
targetNamespace="http://schemas.synyx.org/hera" elementFormDefault="qualified"
targetNamespace="http://www.springframework.org/schema/plugin" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:import namespace="http://www.springframework.org/schema/tool" />

View File

@@ -13,12 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core;
package org.springframework.plugin.core;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.plugin.core.MutablePluginRegistry;
/**
* Unit test for implementations of {@link MutablePluginRegistry}.

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core;
package org.springframework.plugin.core;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
@@ -25,6 +25,10 @@ import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.core.annotation.Order;
import org.springframework.plugin.core.MutablePluginRegistry;
import org.springframework.plugin.core.OrderAwarePluginRegistry;
import org.springframework.plugin.core.Plugin;
import org.springframework.plugin.core.PluginRegistry;
/**
* Unit test for {@link OrderAwarePluginRegistry} that especially concentrates on testing ordering functionality.
@@ -104,7 +108,7 @@ public class OrderAwarePluginRegistryUnitTest extends SimplePluginRegistryUnitTe
/*
* (non-Javadoc)
*
* @see org.synyx.hera.core.Plugin#supports(java.lang.Object)
* @see org.springframework.plugin.core.Plugin#supports(java.lang.Object)
*/
public boolean supports(String delimiter) {
@@ -118,7 +122,7 @@ public class OrderAwarePluginRegistryUnitTest extends SimplePluginRegistryUnitTe
/*
* (non-Javadoc)
*
* @see org.synyx.hera.core.Plugin#supports(java.lang.Object)
* @see org.springframework.plugin.core.Plugin#supports(java.lang.Object)
*/
public boolean supports(String delimiter) {

View File

@@ -13,7 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core;
package org.springframework.plugin.core;
import org.springframework.plugin.core.Plugin;
/**
* @author Oliver Gierke

View File

@@ -13,7 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core;
package org.springframework.plugin.core;
import org.springframework.plugin.core.PluginRegistry;
import org.springframework.plugin.core.SimplePluginRegistry;
/**
* @author Oliver Gierke

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core;
package org.springframework.plugin.core;
/**
* @author Oliver Gierke
@@ -22,7 +22,7 @@ public class SamplePluginImplementation implements SamplePlugin {
/*
* (non-Javadoc)
* @see org.synyx.hera.core.Plugin#supports(java.lang.Object)
* @see org.springframework.plugin.core.Plugin#supports(java.lang.Object)
*/
public boolean supports(String delimiter) {
return "FOO".equals(delimiter);
@@ -30,7 +30,7 @@ public class SamplePluginImplementation implements SamplePlugin {
/*
* (non-Javadoc)
* @see org.synyx.hera.core.SamplePlugin#pluginMethod()
* @see org.springframework.plugin.core.SamplePlugin#pluginMethod()
*/
public void pluginMethod() {

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.synyx.hera.core;
package org.springframework.plugin.core;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
@@ -24,6 +24,9 @@ import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.springframework.plugin.core.MutablePluginRegistry;
import org.springframework.plugin.core.Plugin;
import org.springframework.plugin.core.SimplePluginRegistry;
/**
* Unit test for {@link SimplePluginRegistry}.
@@ -48,7 +51,7 @@ public class SimplePluginRegistryUnitTest extends AbstractMutablePluginRegistryU
/*
* (non-Javadoc)
* @see org.synyx.hera.core.AbstractMutablePluginRegistryUnitTest#getRegistry()
* @see org.springframework.plugin.core.AbstractMutablePluginRegistryUnitTest#getRegistry()
*/
@Override
protected MutablePluginRegistry<SamplePlugin, String> getRegistry() {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core.config;
package org.springframework.plugin.core.config;
import static org.junit.Assert.*;
@@ -23,11 +23,11 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.plugin.core.PluginRegistry;
import org.springframework.plugin.core.SamplePlugin;
import org.springframework.plugin.core.SamplePluginHost;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.synyx.hera.core.PluginRegistry;
import org.synyx.hera.core.SamplePlugin;
import org.synyx.hera.core.SamplePluginHost;
/**
* Integration test to simply check if the configuration gets parsed correctly.

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.synyx.hera.core.support;
package org.springframework.plugin.core.support;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
@@ -29,6 +29,7 @@ import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.core.Ordered;
import org.springframework.plugin.core.support.BeanListFactoryBean;
/**
* Unit test for {@link BeanListFactoryBean}.

View File

@@ -1,23 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:plugin="http://schemas.synyx.org/hera"
xmlns:plugin="http://www.springframework.org/schema/plugin"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://schemas.synyx.org/hera http://schemas.synyx.org/hera/hera.xsd">
http://www.springframework.org/schema/plugin http://www.springframework.org/schema/plugin/spring-plugin.xsd">
<plugin:list id="foo" class="org.synyx.hera.core.SamplePlugin" />
<plugin:list id="foo" class="org.springframework.plugin.core.SamplePlugin" />
<plugin:registry id="bar" class="org.synyx.hera.core.SamplePlugin" />
<plugin:registry id="bar" class="org.springframework.plugin.core.SamplePlugin" />
<bean class="org.synyx.hera.core.SamplePluginImplementation" />
<bean class="org.springframework.plugin.core.SamplePluginImplementation" />
<bean id="host" class="org.synyx.hera.core.SamplePluginHost">
<bean id="host" class="org.springframework.plugin.core.SamplePluginHost">
<property name="registry" ref="bar" />
</bean>
<bean id="otherHost" class="org.synyx.hera.core.SamplePluginHost">
<bean id="otherHost" class="org.springframework.plugin.core.SamplePluginHost">
<property name="registry">
<plugin:registry id="tadaa" class="org.synyx.hera.core.SamplePlugin" />
<plugin:registry id="tadaa" class="org.springframework.plugin.core.SamplePlugin" />
</property>
</bean>

View File

@@ -9,4 +9,4 @@ log4j.rootLogger=WARN, stdout
# Hibernate logging options (INFO only shows startup messages)
log4j.logger.org.springframework=INFO
log4j.logger.org.synyx.hera=DEBUG
log4j.logger.org.springframework.plugin=DEBUG