Skip to content
Snippets Groups Projects
Commit b043b877 authored by Christian Wulf's avatar Christian Wulf
Browse files

Merge remote-tracking branch 'origin/javadoc'

Conflicts:
	pom.xml
parents 5de43cd7 9182d94b
No related branches found
No related tags found
No related merge requests found
Showing with 156 additions and 64 deletions
#FindBugs User Preferences
#Fri Oct 17 09:51:45 CEST 2014
#Fri Oct 17 09:58:28 CEST 2014
detector_threshold=3
effort=max
excludefilter0=.fbExcludeFilterFile|true
......
......@@ -7,14 +7,52 @@
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>teetime</name>
<url>http://maven.apache.org</url>
<name>TeeTime</name>
<description>TeeTime is a Pipes-and-Filters framework for Java</description>
<url>http://teetime.sourceforge.org</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.6</java.version>
</properties>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<developers>
<developer>
<id>chw</id>
<name>Christian Wulf</name>
<email>chw@informatik.uni-kiel.de</email>
</developer>
<developer>
<id>ntd</id>
<name>Nelson Tavares de Sousa</name>
<email>ntd@informatik.uni-kiel.de</email>
</developer>
</developers>
<scm>
<connection>scm:git:https://build.se.informatik.uni-kiel.de/gitlab/chw/teetime.git</connection>
<developerConnection>scm:git:ssh://gitlab@build.se.informatik.uni-kiel.de:chw/teetime.git</developerConnection>
<url>http://teetime.sourceforge.net</url>
</scm>
<repositories>
<repository>
<!-- kieker:1.10-SNAPSHOT -->
......@@ -102,7 +140,60 @@
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<!-- <plugin> -->
<!-- <groupId>org.apache.maven.plugins</groupId> -->
......
......@@ -14,4 +14,5 @@
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="teetime.examples.ComparisonMethodcallWithPorts"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="teetime"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
</launchConfiguration>
......@@ -5,26 +5,48 @@ import teetime.framework.OutputPort;
import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering;
import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication;
/**
* Represents the interface, which is must be defined in every PipeFactory
*/
public interface IPipeFactory {
@Deprecated
IPipe create(int capacity);
/**
* with the default capacity
* Connects two stages with a pipe of default capacity.
*
* @param sourcePort
* OutputPort of the stage, which produces data.
* @param targetPort
* @return
* Input port of the receiving stage.
* @return The connecting pipe.
*/
<T> IPipe create(OutputPort<? extends T> sourcePort, InputPort<T> targetPort);
/**
* Connects two stages with a pipe.
*
* @param sourcePort
* OutputPort of the stage, which produces data.
* @param targetPort
* Input port of the receiving stage.
* @param capacity
* Number of elements the pipe can carry.
* @return The connecting pipe.
*/
<T> IPipe create(OutputPort<? extends T> sourcePort, InputPort<T> targetPort, int capacity);
/**
* @return Type of ThreadCommunication, which is used by the created pipes.
*/
ThreadCommunication getThreadCommunication();
/**
* @return Ordering type, which is used by the created pipes.
*/
PipeOrdering getOrdering();
/**
* @return Wether or not the created pipes are growable
*/
boolean isGrowable();
}
......@@ -7,11 +7,6 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication;
public class OrderedGrowableArrayPipeFactory implements IPipeFactory {
@Override
public IPipe create(final int capacity) {
return create(null, null, capacity);
}
@Override
public <T> IPipe create(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) {
return create(sourcePort, targetPort, 4);
......
......@@ -8,14 +8,27 @@ import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Represents a Registry which provides PipeFactories that are used to create pipes.
* The instance of this singleton class is saved in {@link PipeFactoryRegistry#INSTANCE}.
* <p>
* To get a PipeFactory instance, call {@link #getPipeFactory(ThreadCommunication, PipeOrdering, boolean)}.
*
*/
public class PipeFactoryRegistry {
private static final Logger LOGGER = LoggerFactory.getLogger(PipeFactoryRegistry.class);
/**
* Represent a communication type between two connected stages
*/
public enum ThreadCommunication {
INTER, INTRA
}
/**
* Represents the ordering behavior of a pipe
*/
public enum PipeOrdering {
/**
* FIFO
......@@ -30,6 +43,9 @@ public class PipeFactoryRegistry {
private final Map<String, IPipeFactory> pipeFactories = new HashMap<String, IPipeFactory>();
/**
* The singleton instance of PipeFactoryRegistry
*/
public static PipeFactoryRegistry INSTANCE = new PipeFactoryRegistry();
private PipeFactoryRegistry() {
......@@ -43,23 +59,17 @@ public class PipeFactoryRegistry {
}
}
@Deprecated
public IPipe create(final ThreadCommunication tc, final PipeOrdering ordering, final boolean growable, final int capacity) {
IPipeFactory pipeFactory = getPipeFactory(tc, ordering, growable);
return pipeFactory.create(capacity);
}
/**
* Returns a PipeFactory Instance
* Returns a PipeFactory Instance.
*
* @param tc
* Communication type between two connected stages
* Communication type between two connected stages. These are defined in PipeFactoryRegistry.ThreadCommunication
* @param ordering
* Specifies the ordering behavior of the pipe
* Specifies the ordering behavior of the pipe. See PipeFactoryRegistry.PipeOrdering
* @param growable
* Whether the queue size is fixed or not
* Whether the queue size is fixed or not.
* @return
* A PipeFactory, which provides suitable pipes
* A PipeFactory, which provides suitable pipes.
*/
public IPipeFactory getPipeFactory(final ThreadCommunication tc, final PipeOrdering ordering, final boolean growable) {
String key = this.buildKey(tc, ordering, growable);
......@@ -71,8 +81,12 @@ public class PipeFactoryRegistry {
}
/**
* Adds a new PipeFactory to the registry.<br />
* The new PipeFactory will be automatically selected by the Registry, if it is the most suitable Factory
* corresponding to the requirements.
*
* @param pipeFactory
* A PipeFactory which will be added to the registry
*/
public void register(final IPipeFactory pipeFactory) {
String key = this.buildKey(pipeFactory.getThreadCommunication(), pipeFactory.getOrdering(), pipeFactory.isGrowable());
......@@ -80,13 +94,6 @@ public class PipeFactoryRegistry {
LOGGER.info("Registered pipe factory: " + pipeFactory.getClass().getCanonicalName());
}
/**
*
* @param tc
* @param ordering
* @param growable
* @return
*/
private String buildKey(final ThreadCommunication tc, final PipeOrdering ordering, final boolean growable) {
return tc.toString() + ordering.toString() + growable;
}
......
......@@ -7,14 +7,6 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication;
public class SingleElementPipeFactory implements IPipeFactory {
/**
* Hint: The capacity for this pipe implementation is ignored
*/
@Override
public IPipe create(final int capacity) {
return create(null, null);
}
@Override
public <T> IPipe create(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) {
return create(sourcePort, targetPort, 1);
......
......@@ -7,11 +7,6 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication;
public class SpScPipeFactory implements IPipeFactory {
@Override
public IPipe create(final int capacity) {
return create(null, null, capacity);
}
@Override
public <T> IPipe create(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) {
return create(sourcePort, targetPort, 4);
......
......@@ -7,14 +7,6 @@ import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication;
public class UnorderedGrowablePipeFactory implements IPipeFactory {
/**
* Hint: The capacity for this pipe implementation is ignored
*/
@Override
public IPipe create(final int capacity) {
return create(null, null, capacity);
}
@Override
public <T> IPipe create(final OutputPort<? extends T> sourcePort, final InputPort<T> targetPort) {
return create(sourcePort, targetPort, 4);
......
......@@ -3,6 +3,7 @@ package teetime.examples.cipher;
import java.io.File;
import teetime.framework.AnalysisConfiguration;
import teetime.framework.pipe.IPipeFactory;
import teetime.framework.pipe.PipeFactoryRegistry.PipeOrdering;
import teetime.framework.pipe.PipeFactoryRegistry.ThreadCommunication;
import teetime.stage.CipherByteArray;
......@@ -27,18 +28,14 @@ public class CipherConfiguration extends AnalysisConfiguration {
CipherByteArray decrypt = new CipherByteArray(password, CipherMode.DECRYPT);
ByteArrayFileWriter writer = new ByteArrayFileWriter(output);
PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false)
.create(init.getOutputPort(), f2b.getInputPort());
PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false)
.create(f2b.getOutputPort(), enc.getInputPort());
PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false)
.create(enc.getOutputPort(), comp.getInputPort());
PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false)
.create(comp.getOutputPort(), decomp.getInputPort());
PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false)
.create(decomp.getOutputPort(), decrypt.getInputPort());
PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false)
.create(decrypt.getOutputPort(), writer.getInputPort());
IPipeFactory factory = PIPE_FACTORY_REGISTRY.getPipeFactory(ThreadCommunication.INTRA, PipeOrdering.ARBITRARY, false);
factory.create(init.getOutputPort(), f2b.getInputPort());
factory.create(f2b.getOutputPort(), enc.getInputPort());
factory.create(enc.getOutputPort(), comp.getInputPort());
factory.create(comp.getOutputPort(), decomp.getInputPort());
factory.create(decomp.getOutputPort(), decrypt.getInputPort());
factory.create(decrypt.getOutputPort(), writer.getInputPort());
this.getFiniteProducerStages().add(init);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment