* cleaned up folder structure
* OSGiyfied artifact names * polished poms a little * edited Eclipse project names to align artifact id git-svn-id: svn+ssh://svn.synyx.de/var/svn/synyx/opensource/hera/trunk@6618 5a64d73e-33d6-4ccc-9058-23f8668ecac9
This commit is contained in:
8
metadata/.classpath
Normal file
8
metadata/.classpath
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
36
metadata/.project
Normal file
36
metadata/.project
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.synyx.hera.metadata</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
12
metadata/.settings/org.eclipse.jdt.core.prefs
Normal file
12
metadata/.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,12 @@
|
||||
#Mon Oct 06 19:06:04 CEST 2008
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
6
metadata/.settings/org.eclipse.wst.common.component
Normal file
6
metadata/.settings/org.eclipse.wst.common.component
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="hera-metadata">
|
||||
<wb-resource deploy-path="/" source-path="/src/main/java"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<installed facet="jst.java" version="5.0"/>
|
||||
<installed facet="jst.utility" version="1.0"/>
|
||||
</faceted-project>
|
||||
9
metadata/.settings/org.maven.ide.eclipse.prefs
Normal file
9
metadata/.settings/org.maven.ide.eclipse.prefs
Normal file
@@ -0,0 +1,9 @@
|
||||
#Wed Jan 21 07:28:26 CET 2009
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
fullBuildGoals=process-test-resources
|
||||
includeModules=false
|
||||
resolveWorkspaceProjects=true
|
||||
resourceFilterGoals=process-resources resources\:testResources
|
||||
skipCompilerPlugin=true
|
||||
version=1
|
||||
28
metadata/pom.xml
Normal file
28
metadata/pom.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>org.synyx.hera.metadata</artifactId>
|
||||
|
||||
<name>Hera Metadata Extension</name>
|
||||
<description>Extension package for metadata based plugins</description>
|
||||
|
||||
<parent>
|
||||
<artifactId>org.synyx.hera</artifactId>
|
||||
<groupId>org.synyx.hera</groupId>
|
||||
<version>0.5-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.synyx.hera</groupId>
|
||||
<artifactId>hera-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
55
metadata/src/doc/metadata.xml
Normal file
55
metadata/src/doc/metadata.xml
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<chapter id="metadata">
|
||||
<title>Metadata</title>
|
||||
|
||||
<para>For plugin architectures it is essential to capture metadata
|
||||
information about plugin instances. A very core set of metadata (name,
|
||||
version) also serves as identifier of a plugin and thus can be used. The
|
||||
Hera metadata module provides support to capture metadata.</para>
|
||||
|
||||
<section id="metadata.core-concepts">
|
||||
<title>Core concepts</title>
|
||||
|
||||
<para>The metadata module actually builds around two core interfaces,
|
||||
<interfacename>PluginMetadata</interfacename> and
|
||||
<interfacename>MetadataProvider</interfacename>:</para>
|
||||
|
||||
<example>
|
||||
<title>Core concepts</title>
|
||||
|
||||
<programlisting language="java">public interface PluginMetadata {
|
||||
|
||||
String getName();
|
||||
|
||||
String getVersion();
|
||||
}
|
||||
|
||||
|
||||
public interface MetadataProvider {
|
||||
|
||||
PluginMetadata getMetadata();
|
||||
}</programlisting>
|
||||
</example>
|
||||
|
||||
<para>The <interfacename>PluginMetadata</interfacename> interface captures
|
||||
the required properties to define an identifyable plugin. This means, that
|
||||
implementations should ensure uniqueness through these two properties.
|
||||
With <classname>SimplePluginMetadata</classname> Hera provides a Java bean
|
||||
style class to capture metadata. Of course applications can and should
|
||||
provide extended metadata information according to their needs. The very
|
||||
narrow interface is only targeted at integrating the metadata concept with
|
||||
the <classname>PluginRegistry</classname> (see <xref
|
||||
linkend="core.plugin-registry" />) without bothering developers with too
|
||||
much information required.</para>
|
||||
|
||||
<para>The <interfacename>MetadataProvider</interfacename> interface is to
|
||||
be used in application plugin interfaces to indicate that they can provide
|
||||
metadata. To ease plugin implementation we provide
|
||||
<classname>AbstractMetadataBasedPlugin</classname> that uses the internal
|
||||
metadata to implement <methodname>supports(..)</methodname> method of
|
||||
<interfacename>Plugin</interfacename>. Extending this base class plugins
|
||||
with metadata as selection criteria can easily be build. This way you
|
||||
could store the metadata in user specific configuration files and use this
|
||||
to select a distinct plugin specific to a given user.</para>
|
||||
</section>
|
||||
</chapter>
|
||||
3
metadata/src/main/java/META-INF/MANIFEST.MF
Normal file
3
metadata/src/main/java/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Class-Path:
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright 2002-2008 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
|
||||
*
|
||||
* 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 org.synyx.hera.metadata;
|
||||
|
||||
import org.synyx.hera.core.Plugin;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract base class for plugins based on {@code PluginMetadata}. Plugins
|
||||
* based on this class can be selected from the {@code PluginRegistry} via an
|
||||
* instance of {@code PluginMetadata}. Therefore you can regard this as a role
|
||||
* model implementation of a base class for certain delimiter implmentations.
|
||||
*
|
||||
* @author Oliver Gierke - gierke@synyx.de
|
||||
*/
|
||||
public abstract class AbstractMetadataBasedPlugin implements
|
||||
Plugin<PluginMetadata>, MetadataProvider {
|
||||
|
||||
private PluginMetadata metadata;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance of {@code AbstractMetadataBasedPlugin}.
|
||||
*
|
||||
* @param name
|
||||
* @param version
|
||||
*/
|
||||
public AbstractMetadataBasedPlugin(String name, String version) {
|
||||
|
||||
this.metadata = new SimplePluginMetadata(name, version);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.synyx.minos.core.plugin.Plugin#supports(java.lang.Object)
|
||||
*/
|
||||
public boolean supports(PluginMetadata delimiter) {
|
||||
|
||||
return getMetadata().equals(delimiter);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.synyx.minos.core.plugin.MetadataProvider#getMetadata()
|
||||
*/
|
||||
public PluginMetadata getMetadata() {
|
||||
|
||||
return metadata;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2008 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
|
||||
*
|
||||
* 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 org.synyx.hera.metadata;
|
||||
|
||||
/**
|
||||
* Interface for plugins providing metadata information. Usually the plugins
|
||||
* will implement this interface themselves.
|
||||
*
|
||||
* @author Oliver Gierke - gierke@synyx.de
|
||||
*/
|
||||
public interface MetadataProvider {
|
||||
|
||||
/**
|
||||
* Returns the plugins metadata.
|
||||
*
|
||||
* @return the plugins metadata
|
||||
*/
|
||||
public PluginMetadata getMetadata();
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2002-2008 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
|
||||
*
|
||||
* 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 org.synyx.hera.metadata;
|
||||
|
||||
/**
|
||||
* Basic interface to define a set of metadata information for plugins.
|
||||
*
|
||||
* @author Oliver Gierke - gierke@synyx.de
|
||||
*/
|
||||
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();
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright 2002-2008 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
|
||||
*
|
||||
* 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 org.synyx.hera.metadata;
|
||||
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
|
||||
/**
|
||||
* Value object style implementation of {@code PluginMetadata}.
|
||||
*
|
||||
* @author Oliver Gierke - gierke@synyx.de
|
||||
*/
|
||||
public class SimplePluginMetadata implements PluginMetadata {
|
||||
|
||||
private String name;
|
||||
private String version;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance of {@code SimplePluginMetadata}.
|
||||
*
|
||||
* @param name
|
||||
* @param version
|
||||
*/
|
||||
public SimplePluginMetadata(String name, String version) {
|
||||
|
||||
this.name = name;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.synyx.minos.core.plugin.PluginMetadata#getName()
|
||||
*/
|
||||
public String getName() {
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.synyx.minos.core.plugin.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 (!(obj instanceof PluginMetadata)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PluginMetadata that = (PluginMetadata) obj;
|
||||
|
||||
boolean sameName = StringUtils.equals(this.getName(), that.getName());
|
||||
boolean sameVersion =
|
||||
StringUtils.equals(this.getName(), that.getName());
|
||||
|
||||
return sameName && sameVersion;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
return ObjectUtils.hashCode(name) + ObjectUtils.hashCode(version);
|
||||
}
|
||||
}
|
||||
17
metadata/target/classes/META-INF/MANIFEST.MF
Normal file
17
metadata/target/classes/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,17 @@
|
||||
Manifest-Version: 1.0
|
||||
Export-Package: org.synyx.hera.metadata;uses:="org.synyx.hera.core,org
|
||||
.apache.commons.lang";version="0.5.0.SNAPSHOT"
|
||||
Tool: Bnd-0.0.255
|
||||
Bundle-Name: Hera Metadata Extension
|
||||
Created-By: 1.6.0_13 (Apple Inc.)
|
||||
Bundle-Vendor: Synyx GmbH & Co. KG
|
||||
Bundle-Version: 0.5.0.SNAPSHOT
|
||||
Bnd-LastModified: 1249492303701
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Description: Extension package for metadata based plugins
|
||||
Import-Package: org.apache.commons.lang;version="2.4",org.synyx.hera.c
|
||||
ore;version="0.5.0.SNAPSHOT",org.synyx.hera.metadata;version="0.5.0.S
|
||||
NAPSHOT"
|
||||
Bundle-SymbolicName: org.synyx.hera
|
||||
Bundle-DocURL: http://www.synyx.org
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5
metadata/target/maven-archiver/pom.properties
Normal file
5
metadata/target/maven-archiver/pom.properties
Normal file
@@ -0,0 +1,5 @@
|
||||
#Generated by Maven
|
||||
#Wed Aug 05 19:11:43 CEST 2009
|
||||
version=0.5-SNAPSHOT
|
||||
groupId=org.synyx.hera
|
||||
artifactId=org.synyx.hera.metadata
|
||||
BIN
metadata/target/org.synyx.hera.metadata-0.5-SNAPSHOT-sources.jar
Normal file
BIN
metadata/target/org.synyx.hera.metadata-0.5-SNAPSHOT-sources.jar
Normal file
Binary file not shown.
BIN
metadata/target/org.synyx.hera.metadata-0.5-SNAPSHOT.jar
Normal file
BIN
metadata/target/org.synyx.hera.metadata-0.5-SNAPSHOT.jar
Normal file
Binary file not shown.
Reference in New Issue
Block a user