Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ianj-als/omtc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Johnson <ian.johnson@appliedlanguage.com>2013-02-26 20:30:25 +0400
committerIan Johnson <ian.johnson@appliedlanguage.com>2013-02-26 20:30:25 +0400
commit9d90f83efd8698b8ac47741c5c694fafd0eaa147 (patch)
tree6e2e8c1769e513b3d454bc0ccebc1fcb090a054a
parent86a40e13f4e6b1439d43558ae3f46ce44bd87732 (diff)
Version 1.3: Addition of an translator interface, and changes due to this. Typo fixes to documentation v0.6.1-DRAFT.
-rw-r--r--documentation/omtc.v0.6.1-DRAFT.pdf (renamed from documentation/omtc.v0.6.0-DRAFT.pdf)bin430228 -> 430277 bytes
-rw-r--r--pom.xml2
-rw-r--r--src/main/java/com/capitati/omtc/core/scheduling/TranslationTicket.java8
-rw-r--r--src/main/java/com/capitati/omtc/core/session/IEngineAssignableSession.java10
-rw-r--r--src/main/java/com/capitati/omtc/core/translation/ITranslator.java113
-rw-r--r--src/main/java/com/capitati/omtc/core/translation/Translator.java59
6 files changed, 124 insertions, 68 deletions
diff --git a/documentation/omtc.v0.6.0-DRAFT.pdf b/documentation/omtc.v0.6.1-DRAFT.pdf
index 816ffa7..a734116 100644
--- a/documentation/omtc.v0.6.0-DRAFT.pdf
+++ b/documentation/omtc.v0.6.1-DRAFT.pdf
Binary files differ
diff --git a/pom.xml b/pom.xml
index 08b3a19..395fc71 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
<groupId>com.capitati.omtc</groupId>
<artifactId>omtc-core</artifactId>
- <version>1.2</version>
+ <version>1.3</version>
<packaging>jar</packaging>
<name>omtc</name>
diff --git a/src/main/java/com/capitati/omtc/core/scheduling/TranslationTicket.java b/src/main/java/com/capitati/omtc/core/scheduling/TranslationTicket.java
index 34d2475..4211f84 100644
--- a/src/main/java/com/capitati/omtc/core/scheduling/TranslationTicket.java
+++ b/src/main/java/com/capitati/omtc/core/scheduling/TranslationTicket.java
@@ -23,23 +23,23 @@ import java.util.UUID;
import com.capitati.omtc.core.resources.IPrimaryResource;
import com.capitati.omtc.core.session.ISession;
-import com.capitati.omtc.core.translation.Translator;
+import com.capitati.omtc.core.translation.ITranslator;
public class TranslationTicket<V, T extends IPrimaryResource, G extends IPrimaryResource>
extends Ticket<V> {
- private final Translator<V, T, G> translator;
+ private final ITranslator<V, T, G> translator;
public TranslationTicket(
final UUID theIdentifier,
final Date theStartDate,
final ISession theSession,
final V thePriority,
- final Translator<V, T, G> theTranslator) {
+ final ITranslator<V, T, G> theTranslator) {
super(theIdentifier, theStartDate, theSession, thePriority);
translator = theTranslator;
}
- public Translator<V, T, G> getTranslator() {
+ public ITranslator<V, T, G> getTranslator() {
return translator;
}
}
diff --git a/src/main/java/com/capitati/omtc/core/session/IEngineAssignableSession.java b/src/main/java/com/capitati/omtc/core/session/IEngineAssignableSession.java
index d838e72..b8950b2 100644
--- a/src/main/java/com/capitati/omtc/core/session/IEngineAssignableSession.java
+++ b/src/main/java/com/capitati/omtc/core/session/IEngineAssignableSession.java
@@ -34,9 +34,9 @@ public interface IEngineAssignableSession
extends IEngineRetrievableSession, IUserRetrievableSession {
/**
* Associate a user with an engine. This association should allow the user
- * to use the engine for a {@link com.capitati.omtc.core.translation.Translator}
- * object. Optionally, the implementation should back this association to some
- * persistent backing store.
+ * to use the engine for a {@link com.capitati.omtc.core.translation.ITranslator}
+ * implementation. Optionally, the implementation should back this association
+ * to some persistent backing store.
*
* @param engine - the engine to grant.
* @param theUser - the grantee.
@@ -46,8 +46,8 @@ extends IEngineRetrievableSession, IUserRetrievableSession {
/**
* Dissociate a user from an engine. The user shall no longer be able to use
- * an engine to build a {@link com.capitati.omtc.core.translation.Translator}
- * object. Whether the existing translator objects, that use the engine,
+ * an engine to build a {@link com.capitati.omtc.core.translation.ITranslator}
+ * implementation. Whether the existing translator objects, that use the engine,
* shall be destroyed immediately, or that the engine is no longer available
* for use in a translator is to implementation defined. Optionally, the
* implementation should back the dissociation to a persistent backing store.
diff --git a/src/main/java/com/capitati/omtc/core/translation/ITranslator.java b/src/main/java/com/capitati/omtc/core/translation/ITranslator.java
new file mode 100644
index 0000000..9a30069
--- /dev/null
+++ b/src/main/java/com/capitati/omtc/core/translation/ITranslator.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright Capita Translation and Interpreting 2013
+ *
+ * This file is part of OMTC.
+ *
+ * OMTC is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OMTC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with OMTC. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.capitati.omtc.core.translation;
+
+import java.util.Set;
+
+import com.capitati.omtc.core.engine.IEngine;
+import com.capitati.omtc.core.resources.IDerivedResource;
+import com.capitati.omtc.core.resources.IPrimaryResource;
+import com.capitati.omtc.core.scheduling.IPriority;
+import com.capitati.omtc.core.scheduling.ITicketObserver;
+import com.capitati.omtc.core.scheduling.TranslationTicket;
+import com.capitati.omtc.core.session.ISession;
+import com.google.common.base.Predicate;
+
+public interface ITranslator<V,
+ T extends IPrimaryResource,
+ G extends IPrimaryResource>
+extends IDerivedResource {
+ /**
+ * Retrieve the MT engine used with this translator.
+ *
+ * @return A {@link com.capitati.omtc.core.engine.IEngine} object, otherwise
+ * null if no MT engine is required for this translator.
+ */
+ IEngine getEngine();
+
+ /**
+ * Retrieve the set of glossaries being used with this translator.
+ *
+ * @return A {@link java.util.Set} of
+ * objects implementing the
+ * {@link com.capitati.omtc.core.resources.IPrimaryResource} interface,
+ * otherwise an empty set if no glossaries are employed.
+ */
+ Set<G> getGlossaries();
+
+ /**
+ * Retrieve the set of translation memories being used with the translator.
+ *
+ * @return A {@link java.util.Set} of objects implementing the
+ * {@link com.capitati.omtc.core.resources.IPrimaryResource} interface,
+ * otherwise an empty set if no translation memories are used.
+ */
+ Set<T> getTranslationMemories();
+
+ /**
+ * Schedule a translation for a primary resource. It is implementation
+ * defined which kind of primary resources shall be translated.
+ *
+ * @param session - the invoking session.
+ * @param resourceToTranslate - the primary resource to translate.
+ * @param thePriority - the requested priority.
+ * @param translationObserver - the observer that listens for the translation
+ * task to starting and complete.
+ * @return A translation ticket.
+ * @throws Exception On a scheduling error.
+ */
+ TranslationTicket<V, T, G> scheduleTranslation(
+ ISession session,
+ IPrimaryResource resourceToTranslate,
+ IPriority<V> thePriority,
+ ITicketObserver<TranslationTicket<V, T, G>, V> translationObserver)
+ throws Exception;
+
+ /**
+ * Schedule a translation for a single sentence.
+ *
+ * @param session - the invoking session.
+ * @param sourceSentence - the sentence to translate.
+ * @param thePriority - the requested priority.
+ * @param translationObserver - the observer that listens for the translation
+ * task to starting and complete.
+ * @return A translation ticket.
+ * @throws Exception On a scheduling error.
+ */
+ TranslationTicket<V, T, G> scheduleTranslation(
+ ISession session,
+ String sourceSentence,
+ IPriority<V> thePriority,
+ ITicketObserver<TranslationTicket<V, T, G>, V> translationObserver)
+ throws Exception;
+
+ /**
+ * Retrieve the dispensed translation tickets.
+ *
+ * @param session - the invoking session.
+ * @param filter - a predicate used to filter the translation tickets.
+ * @return A {@link java.util.Set} of currently scheduled translation
+ * tickets. It is the implementations responsibility to manage the in-flight
+ * collection of tickets.
+ * @throws Exception On error retrieving translations.
+ */
+ Set<TranslationTicket<V, T, G>> retrieveTranslations(
+ ISession session,
+ Predicate<TranslationTicket<V, T, G>> filter) throws Exception;
+}
diff --git a/src/main/java/com/capitati/omtc/core/translation/Translator.java b/src/main/java/com/capitati/omtc/core/translation/Translator.java
index 08335d4..5e62ad9 100644
--- a/src/main/java/com/capitati/omtc/core/translation/Translator.java
+++ b/src/main/java/com/capitati/omtc/core/translation/Translator.java
@@ -25,14 +25,8 @@ import java.util.Set;
import java.util.UUID;
import com.capitati.omtc.core.engine.IEngine;
-import com.capitati.omtc.core.resources.IDerivedResource;
import com.capitati.omtc.core.resources.IPrimaryResource;
import com.capitati.omtc.core.resources.IResource;
-import com.capitati.omtc.core.scheduling.IPriority;
-import com.capitati.omtc.core.scheduling.ITicketObserver;
-import com.capitati.omtc.core.scheduling.TranslationTicket;
-import com.capitati.omtc.core.session.ISession;
-import com.google.common.base.Predicate;
/**
* An associative class that brings together an engine, glossaries and
@@ -45,7 +39,7 @@ import com.google.common.base.Predicate;
public abstract class Translator<V,
T extends IPrimaryResource,
G extends IPrimaryResource>
-implements IDerivedResource {
+implements ITranslator<V, T, G> {
private final UUID identifier;
private final URI location;
private final Date birthDate;
@@ -112,55 +106,4 @@ implements IDerivedResource {
public Set<T> getTranslationMemories() {
return new HashSet<T>(translationMemories);
}
-
- /**
- * Schedule a translation for a primary resource. It is implementation
- * defined which kind of primary resources shall be translated.
- *
- * @param session - the invoking session.
- * @param resourceToTranslate - the primary resource to translate.
- * @param thePriority - the requested priority.
- * @param translationObserver - the observer that listens for the translation
- * task to starting and complete.
- * @return A translation ticket.
- * @throws Exception On a scheduling error.
- */
- public abstract TranslationTicket<V, T, G> scheduleTranslation(
- ISession session,
- IPrimaryResource resourceToTranslate,
- IPriority<V> thePriority,
- ITicketObserver<TranslationTicket<V, T, G>, V> translationObserver)
- throws Exception;
-
- /**
- * Schedule a translation for a single sentence.
- *
- * @param session - the invoking session.
- * @param sourceSentence - the sentence to translate.
- * @param thePriority - the requested priority.
- * @param translationObserver - the observer that listens for the translation
- * task to starting and complete.
- * @return A translation ticket.
- * @throws Exception On a scheduling error.
- */
- public abstract TranslationTicket<V, T, G> scheduleTranslation(
- ISession session,
- String sourceSentence,
- IPriority<V> thePriority,
- ITicketObserver<TranslationTicket<V, T, G>, V> translationObserver)
- throws Exception;
-
- /**
- * Retrieve the dispensed translation tickets.
- *
- * @param session - the invoking session.
- * @param filter - a predicate used to filter the translation tickets.
- * @return A {@link java.util.Set} of currently scheduled translation
- * tickets. It is the implementations responsibility to manage the in-flight
- * collection of tickets.
- * @throws Exception On error retrieving translations.
- */
- public abstract Set<TranslationTicket<V, T, G>> retrieveTranslations(
- ISession session,
- Predicate<TranslationTicket<V, T, G>> filter) throws Exception;
}