Permalink
Browse files

Uses streamline-api v1.2.0

  • Loading branch information...
joeha480 committed May 8, 2018
1 parent fb2d5db commit 30041649e5220e34a12eb19b601fc8c6bd5df466
View
@@ -73,7 +73,7 @@ jar.doFirst {
repositories {
mavenCentral()
//mavenLocal()
mavenLocal()
//maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url "https://oss.sonatype.org/content/groups/staging" }
}
@@ -88,19 +88,19 @@ dependencies {
}
compile 'org.daisy.dotify:dotify.api:4.2.0'
compile 'org.daisy.dotify:dotify.common:4.2.0'
compile ('org.daisy.streamline:streamline-engine:1.0.0') {
compile ('org.daisy.streamline:streamline-engine:1.2.0') {
exclude module: 'streamline-api'
}
compile 'org.daisy.streamline:streamline-api:1.1.0'
compile 'org.daisy.streamline:streamline-api:1.2.0'
runtime 'org.daisy.braille:braille-utils.impl:4.1.0'
runtime ('org.daisy.dotify:dotify.formatter.impl:4.2.1') {
runtime ('org.daisy.dotify:dotify.formatter.impl:4.3.0') {
exclude module: 'Saxon-HE'
}
runtime 'org.daisy.dotify:dotify.hyphenator.impl:4.0.0'
runtime 'org.daisy.dotify:dotify.text.impl:4.0.0'
runtime 'org.daisy.dotify:dotify.translator.impl:4.0.0'
runtime ('org.daisy.dotify:dotify.task.impl:4.3.0') {
runtime ('org.daisy.dotify:dotify.task.impl:4.4.0') {
exclude module: 'Saxon-HE'
exclude module: 'streamline-api'
}
@@ -65,7 +65,7 @@ public static Option dotifyTranslator() {
}
static Option streamlineApi() {
return MavenRepo.CENTRAL.get("org.daisy.streamline", "streamline-api", "1.1.0");
return MavenRepo.SONATYPE_STAGING.get("org.daisy.streamline", "streamline-api", "1.2.0");
}
static Option jing() {
@@ -89,13 +89,14 @@ static Option wstx() {
}
public static Option dotifyFormatter() {
return composite(
return composite(
streamlineApi(),
dotifyText(),
dotifyHyphenator(),
dotifyTranslator(),
wstx(),
saxon(),
MavenRepo.SONATYPE_STAGING.get("org.daisy.dotify", "dotify.formatter.impl", "4.2.1")
MavenRepo.SONATYPE_STAGING.get("org.daisy.dotify", "dotify.formatter.impl", "4.3.0")
);
}
@@ -106,15 +107,15 @@ public static Option dotifyTasks() {
dotifyCommon(),
jing(),
saxon(),
MavenRepo.CENTRAL.get("org.daisy.dotify", "dotify.task.impl", "4.3.0")
MavenRepo.SONATYPE_STAGING.get("org.daisy.dotify", "dotify.task.impl", "4.4.0")
);
}
public static Option streamlineEngine() {
return composite(
dotifyCommon(),
streamlineApi(),
MavenRepo.CENTRAL.get("org.daisy.streamline", "streamline-engine", "1.0.0")
MavenRepo.SONATYPE_STAGING.get("org.daisy.streamline", "streamline-engine", "1.2.0")
);
}
@@ -14,7 +14,6 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.logging.Logger;
import org.daisy.dotify.common.text.FilterLocale;
@@ -25,12 +24,11 @@
import org.daisy.streamline.api.identity.IdentityProvider;
import org.daisy.streamline.api.media.AnnotatedFile;
import org.daisy.streamline.api.media.DefaultAnnotatedFile;
import org.daisy.streamline.api.media.FormatIdentifier;
import org.daisy.streamline.api.option.UserOption;
import org.daisy.streamline.api.option.UserOptionValue;
import org.daisy.streamline.api.tasks.CompiledTaskSystem;
import org.daisy.streamline.api.tasks.InternalTaskException;
import org.daisy.streamline.api.tasks.TaskGroupFactoryMaker;
import org.daisy.streamline.api.tasks.TaskGroupInformation;
import org.daisy.streamline.api.tasks.TaskSystem;
import org.daisy.streamline.api.tasks.TaskSystemException;
import org.daisy.streamline.api.tasks.TaskSystemFactoryException;
@@ -83,7 +81,7 @@ public static void run(File inputFile, File output, FilterLocale context, Map<St
params.remove("cols");
}
Set<TaskGroupInformation> specs = TaskGroupFactoryMaker.newInstance().listAll();
TaskSystemFactoryMaker specs = TaskSystemFactoryMaker.newInstance();
HashMap<String, String> map = new HashMap<String, String>();
map.putAll(params);
@@ -93,7 +91,7 @@ public static void run(File inputFile, File output, FilterLocale context, Map<St
String inputFormat = getFormatString(ai);
if (inputFormat!=null) {
if (!supportsInputFormat(inputFormat, specs)) {
if (!supportsInputFormat(FormatIdentifier.with(inputFormat), specs)) {
logger.warning("No input factory for " + inputFormat);
logger.fine("Note, the following detection code has been deprected. In future versions, an exception will be thrown if this point is reached."
+ " To avoid this, use the IdentifierFactory interface to implement a detector for the file type.");
@@ -119,7 +117,7 @@ public static void run(File inputFile, File output, FilterLocale context, Map<St
int indx = output.getName().lastIndexOf('.');
if (indx>-1) {
String ext = output.getName().substring(indx+1).toLowerCase();
if (supportsOutputFormat(ext, specs)) {
if (supportsOutputFormat(FormatIdentifier.with(ext), specs)) {
outputformat = ext;
} else {
outputformat = extensionBindings.get(ext);
@@ -199,22 +197,12 @@ private static String getFormatString(AnnotatedFile f) {
}
}
private static boolean supportsInputFormat(String inputFormat, Set<TaskGroupInformation> specs) {
for (TaskGroupInformation s : specs) {
if (s.getInputFormat().equals(inputFormat)) {
return true;
}
}
return false;
private static boolean supportsInputFormat(FormatIdentifier inputFormat, TaskSystemFactoryMaker specs) {
return specs.listInputs().stream().filter(v->v.equals(inputFormat)).findAny().isPresent();
}
private static boolean supportsOutputFormat(String outputFormat, Set<TaskGroupInformation> specs) {
for (TaskGroupInformation s : specs) {
if (s.getOutputFormat().equals(outputFormat)) {
return true;
}
}
return false;
private static boolean supportsOutputFormat(FormatIdentifier outputFormat, TaskSystemFactoryMaker specs) {
return specs.listOutputs().stream().filter(v->v.equals(outputFormat)).findAny().isPresent();
}
private Map<String, Object> loadSetup(Map<String, String> guiParams, String setup) {
@@ -6,7 +6,6 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
@@ -30,8 +29,7 @@
import org.daisy.streamline.api.identity.IdentityProvider;
import org.daisy.streamline.api.media.AnnotatedFile;
import org.daisy.streamline.api.tasks.InternalTaskException;
import org.daisy.streamline.api.tasks.TaskGroupFactoryMaker;
import org.daisy.streamline.api.tasks.TaskGroupInformation;
import org.daisy.streamline.api.tasks.TaskSystemFactoryMaker;
import org.daisy.streamline.api.validity.Validator;
import org.daisy.streamline.api.validity.ValidatorFactoryMaker;
import org.daisy.streamline.cli.Argument;
@@ -273,13 +271,10 @@ public String getDescription() {
@Override
public List<Argument> getRequiredArguments() {
if (reqArgs.isEmpty()) {
Set<TaskGroupInformation> specs = TaskGroupFactoryMaker.newInstance().listAll();
Set<String> inputFormats = new HashSet<>();
Set<String> outputFormats = new HashSet<>();
for (TaskGroupInformation spec : specs) {
inputFormats.add(spec.getInputFormat());
outputFormats.add(spec.getOutputFormat());
}
TaskSystemFactoryMaker fm = TaskSystemFactoryMaker.newInstance();
//TODO: map identifiers to file formats
Set<String> inputFormats = fm.listInputs().stream().map(v->v.getIdentifier()).collect(Collectors.toSet());
Set<String> outputFormats = fm.listOutputs().stream().map(v->v.getIdentifier()).collect(Collectors.toSet());
reqArgs.add(new Argument("path_to_input", "Path to the input file " + inputFormats));
reqArgs.add(new Argument("path_to_output", "Path to the output file " + outputFormats));
}

0 comments on commit 3004164

Please sign in to comment.