From 473a4c9523fec98437a2a68be56482bbcd3cda7a Mon Sep 17 00:00:00 2001 From: Benjamin Pross Date: Tue, 4 Dec 2018 08:28:22 +0100 Subject: [PATCH 1/4] First version of self describing algorithm --- .../AbstractSelfDescribingAlgorithm.java | 753 ++++++++++++++++++ .../algorithm/LocalAlgorithmRepository.java | 4 + pom.xml | 2 +- 3 files changed, 758 insertions(+), 1 deletion(-) create mode 100644 engine/src/main/java/org/n52/javaps/algorithm/AbstractSelfDescribingAlgorithm.java diff --git a/engine/src/main/java/org/n52/javaps/algorithm/AbstractSelfDescribingAlgorithm.java b/engine/src/main/java/org/n52/javaps/algorithm/AbstractSelfDescribingAlgorithm.java new file mode 100644 index 00000000..e79fce6a --- /dev/null +++ b/engine/src/main/java/org/n52/javaps/algorithm/AbstractSelfDescribingAlgorithm.java @@ -0,0 +1,753 @@ +/* + * Copyright 2016-2018 52°North Initiative for Geospatial Open Source + * Software GmbH + * + * 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.n52.javaps.algorithm; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import javax.inject.Inject; + +import org.n52.javaps.algorithm.AbstractAlgorithm; +import org.n52.javaps.commons.observerpattern.IObserver; +import org.n52.javaps.commons.observerpattern.ISubject; +import org.n52.javaps.description.TypedComplexInputDescription; +import org.n52.javaps.description.TypedComplexOutputDescription; +import org.n52.javaps.description.TypedLiteralInputDescription; +import org.n52.javaps.description.TypedProcessDescription; +import org.n52.javaps.description.impl.TypedComplexOutputDescriptionImpl; +import org.n52.javaps.description.impl.TypedProcessDescriptionFactory; +import org.n52.javaps.io.InputHandlerRepository; +import org.n52.javaps.io.OutputHandlerRepository; +import org.n52.javaps.io.complex.ComplexData; +import org.n52.javaps.io.literal.LiteralType; +import org.n52.shetland.ogc.ows.OwsAllowedValues; +import org.n52.shetland.ogc.ows.OwsAnyValue; +import org.n52.shetland.ogc.ows.OwsCode; +import org.n52.shetland.ogc.ows.OwsKeyword; +import org.n52.shetland.ogc.ows.OwsLanguageString; +import org.n52.shetland.ogc.ows.OwsMetadata; +import org.n52.shetland.ogc.ows.OwsValue; +import org.n52.shetland.ogc.wps.Format; +import org.n52.shetland.ogc.wps.description.ProcessInputDescription; +import org.n52.shetland.ogc.wps.description.ProcessOutputDescription; + +public abstract class AbstractSelfDescribingAlgorithm extends AbstractAlgorithm implements ISubject { + + private String title; + + private String _abstract; + + private String version; + + private boolean storeSupported; + + private boolean statusSupported; + + private Collection inputs = new ArrayList<>(); + + private Collection outputs = new ArrayList<>(); + + private TypedProcessDescriptionFactory descriptionFactory = new TypedProcessDescriptionFactory(); + + private List observers = new ArrayList(); + + private Object state = null; + + private OutputHandlerRepository generatorRepository; + + private InputHandlerRepository parserRepository; + + private OwsMetadata metadata; + + private String getTitle() { + return title; + } + + protected void setTitle(String title) { + this.title = title; + } + + private String getAbstract() { + return _abstract; + } + + protected void setAbstract(String _abstract) { + this._abstract = _abstract; + } + + private String getVersion() { + return version; + } + + protected void setVersion(String version) { + this.version = version; + } + + @Override + protected TypedProcessDescription createDescription() { + + TypedProcessDescription description = new TypedProcessDescriptionFactory().process().withIdentifier(this + .getClass().getName()).withTitle(getTitle()).withAbstract(getAbstract()) + .withMetadata(getMetadata()) + .withInput(getInputs())// TODO process could have no inputs + .withOutput(getOutputs()).withVersion(getVersion()).statusSupported(getStatusSupported()) + .storeSupported(getStoreSupported()).build(); + + return description; + + // ProcessDescriptionsDocument document = + // ProcessDescriptionsDocument.Factory.newInstance(); + // ProcessDescriptions processDescriptions = + // document.addNewProcessDescriptions(); + // ProcessDescriptionType processDescription = + // processDescriptions.addNewProcessDescription(); + // processDescription.setStatusSupported(getStatusSupported()); + // processDescription.setStoreSupported(getStoreSupported()); + // processDescription.setProcessVersion("1.0.0"); + // + // //1. Identifier + // processDescription.addNewIdentifier().setStringValue(this.getClass().getName()); + // processDescription.addNewTitle().setStringValue(this.getClass().getCanonicalName()); + // + // //2. Inputs + // List identifiers = this.getInputIdentifiers(); + // DataInputs dataInputs = null; + // if(identifiers.size()>0){ + // dataInputs = processDescription.addNewDataInputs(); + // } + // + // for(String identifier : identifiers){ + // InputDescriptionType dataInput = dataInputs.addNewInput(); + // dataInput.setMinOccurs(getMinOccurs(identifier)); + // dataInput.setMaxOccurs(getMaxOccurs(identifier)); + // dataInput.addNewIdentifier().setStringValue(identifier); + // dataInput.addNewTitle().setStringValue(identifier); + // + // Class inputDataTypeClass = this.getInputDataType(identifier); + // Class[] interfaces = inputDataTypeClass.getInterfaces(); + // + // //we have to add this because of the new AbstractLiteralDataBinding + // class + // if(interfaces.length == 0){ + // interfaces = inputDataTypeClass.getSuperclass().getInterfaces(); + // } + // + // for(Class implementedInterface : interfaces){ + // if(implementedInterface.equals(ILiteralData.class)){ + // LiteralInputType literalData = dataInput.addNewLiteralData(); + // String inputClassType = ""; + // + // Constructor[] constructors = inputDataTypeClass.getConstructors(); + // for(Constructor constructor : constructors){ + // Class[] parameters = constructor.getParameterTypes(); + // if(parameters.length==1){ + // inputClassType = parameters[0].getSimpleName(); + // } + // } + // + // if(inputClassType.length()>0){ + // DomainMetadataType datatype = literalData.addNewDataType(); + // datatype.setReference("xs:"+inputClassType.toLowerCase()); + // literalData.addNewAnyValue(); + // } + // }else if(implementedInterface.equals(IBBOXData.class)){ + // SupportedCRSsType bboxData = dataInput.addNewBoundingBoxData(); + // String[] supportedCRSAray = getSupportedCRSForBBOXInput(identifier); + // for(int i = 0; i parsers = ParserFactory.getInstance().getAllParsers(); + // List foundParsers = new ArrayList(); + // for(IParser parser : parsers) { + // Class[] supportedClasses = parser.getSupportedDataBindings(); + // for(Class clazz : supportedClasses){ + // if(clazz.equals(inputDataTypeClass)){ + // foundParsers.add(parser); + // } + // + // } + // } + // + // addInputFormats(complexData, foundParsers); + // + // } + // } + // } + // + // //3. Outputs + // ProcessOutputs dataOutputs = + // processDescription.addNewProcessOutputs(); + // List outputIdentifiers = this.getOutputIdentifiers(); + // for(String identifier : outputIdentifiers){ + // OutputDescriptionType dataOutput = dataOutputs.addNewOutput(); + // + // + // dataOutput.addNewIdentifier().setStringValue(identifier); + // dataOutput.addNewTitle().setStringValue(identifier); + // dataOutput.addNewAbstract().setStringValue(identifier); + // + // Class outputDataTypeClass = this.getOutputDataType(identifier); + // Class[] interfaces = outputDataTypeClass.getInterfaces(); + // + // //we have to add this because of the new AbstractLiteralDataBinding + // class + // if(interfaces.length == 0){ + // interfaces = outputDataTypeClass.getSuperclass().getInterfaces(); + // } + // for(Class implementedInterface : interfaces){ + // + // + // if(implementedInterface.equals(ILiteralData.class)){ + // LiteralOutputType literalData = dataOutput.addNewLiteralOutput(); + // String outputClassType = ""; + // + // Constructor[] constructors = + // outputDataTypeClass.getConstructors(); + // for(Constructor constructor : constructors){ + // Class[] parameters = constructor.getParameterTypes(); + // if(parameters.length==1){ + // outputClassType = parameters[0].getSimpleName(); + // } + // } + // + // if(outputClassType.length()>0){ + // literalData.addNewDataType().setReference("xs:"+outputClassType.toLowerCase()); + // } + // + // }else if(implementedInterface.equals(IBBOXData.class)){ + // SupportedCRSsType bboxData = dataOutput.addNewBoundingBoxOutput(); + // String[] supportedCRSAray = getSupportedCRSForBBOXOutput(identifier); + // for(int i = 0; i generators = + // GeneratorFactory.getInstance().getAllGenerators(); + // List foundGenerators = new ArrayList(); + // for(IGenerator generator : generators) { + // Class[] supportedClasses = generator.getSupportedDataBindings(); + // for(Class clazz : supportedClasses){ + // if(clazz.equals(outputDataTypeClass)){ + // foundGenerators.add(generator); + // } + // + // } + // } + // + // addOutputFormats(complexData, foundGenerators); + // + // } + // } + // } + // + // ProcessDescription superProcessDescription = new + // ProcessDescription(); + // + // superProcessDescription.addProcessDescriptionForVersion(document.getProcessDescriptions().getProcessDescriptionArray(0), + // "1.0.0"); + // + // return superProcessDescription; + } + + protected void addComplexInputDescription(String id, + String title, + String _abstract, + List keywordList, + Set metadata, + Format defaultFormat, + Set supportedFormats, + BigInteger maximumMegaBytes, + BigInteger minOccurs, + BigInteger maxOccurs, + Class> dataBinding) { + + List keywords = new ArrayList<>(); + + for (String keyword : keywordList) { + OwsKeyword owsKeyword = new OwsKeyword(keyword); + keywords.add(owsKeyword); + } + + TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() + .withIdentifier(id).withAbstract(_abstract).withTitle(title).withMinimalOccurence(minOccurs) + .withKeywords(keywords).withMetadata(metadata.iterator().next())// FIXME + .withMaximalOccurence(maxOccurs).withMaximumMegabytes(maximumMegaBytes).withDefaultFormat(defaultFormat) + .withSupportedFormat(supportedFormats).withType(dataBinding).build(); + + inputs.add(inputDescription); + } + + protected void addComplexInputDescription(String id, + String title, + String _abstract, + Set metadata, + Format defaultFormat, + Set supportedFormats, + BigInteger maximumMegaBytes, + BigInteger minOccurs, + BigInteger maxOccurs, + Class> dataBinding) { + + TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() + .withIdentifier(id).withAbstract(_abstract).withTitle(title).withMinimalOccurence(minOccurs) + .withMetadata(metadata.iterator().next())// FIXME + .withMaximalOccurence(maxOccurs).withMaximumMegabytes(maximumMegaBytes).withDefaultFormat(defaultFormat) + .withSupportedFormat(supportedFormats).withType(dataBinding).build(); + + inputs.add(inputDescription); + } + + protected void addComplexInputDescription(String id, + String title, + String _abstract, + Set metadata, + Format defaultFormat, + Set supportedFormats, + BigInteger maxOccurs, + Class> dataBinding) { + + TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() + .withIdentifier(id).withAbstract(_abstract).withTitle(title) + .withMetadata(metadata.iterator().next())// FIXME + .withMaximalOccurence(maxOccurs).withDefaultFormat(defaultFormat) + .withSupportedFormat(supportedFormats).withType(dataBinding).build(); + + inputs.add(inputDescription); + } + + protected void addComplexInputDescription(String id, + String title, + String _abstract, + Format defaultFormat, + Set supportedFormats, + BigInteger maximumMegaBytes, + BigInteger minOccurs, + BigInteger maxOccurs, + Class> dataBinding) { + + TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() + .withIdentifier(id).withAbstract(_abstract).withTitle(title).withMinimalOccurence(minOccurs) + .withMaximalOccurence(maxOccurs).withMaximumMegabytes(maximumMegaBytes).withDefaultFormat(defaultFormat) + .withSupportedFormat(supportedFormats).withType(dataBinding).build(); + + inputs.add(inputDescription); + } + + protected void addComplexInputDescription(String id, + String title, + String _abstract, + Format defaultFormat, + Set supportedFormats, + BigInteger maximumMegaBytes, + BigInteger maxOccurs, + Class> dataBinding) { + + TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() + .withIdentifier(id).withAbstract(_abstract).withTitle(title).withMaximalOccurence(maxOccurs) + .withMaximumMegabytes(maximumMegaBytes).withDefaultFormat(defaultFormat).withSupportedFormat( + supportedFormats).withType(dataBinding).build(); + + inputs.add(inputDescription); + } + + protected void addComplexInputDescription(String id, + String title, + String _abstract, + Format defaultFormat, + Set supportedFormats, + BigInteger maxOccurs, + Class> dataBinding) { + + TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() + .withIdentifier(id).withAbstract(_abstract).withTitle(title).withMaximalOccurence(maxOccurs) + .withDefaultFormat(defaultFormat).withSupportedFormat(supportedFormats).withType(dataBinding).build(); + + inputs.add(inputDescription); + } + + protected void addComplexInputDescription(String id, + String title, + String _abstract, + Format defaultFormat, + Set supportedFormats, + Class> dataBinding) { + + TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() + .withIdentifier(id).withAbstract(_abstract).withTitle(title).withDefaultFormat(defaultFormat) + .withSupportedFormat(supportedFormats).withType(dataBinding).build(); + + inputs.add(inputDescription); + } + + protected void addComplexInputDescription(String id, + Format defaultFormat, + Set supportedFormats, + Class> dataBinding) { + + TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() + .withIdentifier(id).withAbstract(_abstract).withTitle(title).withDefaultFormat(defaultFormat) + .withSupportedFormat(supportedFormats).withType(dataBinding).build(); + + inputs.add(inputDescription); + } + + protected void addComplexInputDescription(String id, + Class> dataBinding) { + + Set supportedFormats = this.parserRepository.getSupportedFormats(dataBinding); + Format defaultFormat = this.parserRepository.getDefaultFormat(dataBinding).orElse(null); + + TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() + .withIdentifier(id).withAbstract(_abstract).withTitle(title).withDefaultFormat(defaultFormat) + .withSupportedFormat(supportedFormats).withType(dataBinding).build(); + + inputs.add(inputDescription); + } + + protected void addLiteralInputDescription(String id, + List allowedValues, + LiteralType dataBinding) { + + TypedLiteralInputDescription inputDescription = descriptionFactory.literalInput().withIdentifier(id).withType( + dataBinding).withDefaultLiteralDataDomain(descriptionFactory.literalDataDomain().withValueDescription( + allowedValues.isEmpty() ? OwsAnyValue.instance() + : new OwsAllowedValues(allowedValues.stream().map(OwsValue::new))).withDataType( + dataBinding.getDataType())).build(); + + inputs.add(inputDescription); + } + + protected void addLiteralInputDescription(String id, + List allowedValues, + BigInteger minOccurs, + BigInteger maxOccurs, + LiteralType dataBinding) { + + TypedLiteralInputDescription inputDescription = descriptionFactory.literalInput().withIdentifier(id) + .withMinimalOccurence(minOccurs).withMaximalOccurence(maxOccurs).withType(dataBinding) + .withDefaultLiteralDataDomain(descriptionFactory.literalDataDomain().withValueDescription(allowedValues + .isEmpty() ? OwsAnyValue.instance() + : new OwsAllowedValues(allowedValues.stream().map(OwsValue::new))).withDataType( + dataBinding.getDataType())).build(); + + inputs.add(inputDescription); + } + + protected void addComplexOutputDescription(String id, + String title, + String _abstract, + List keywords, + Set metadata, + Format defaultFormat, + Set supportedFormats, + BigInteger maximumMegabytes, + Class> dataBinding) { + + TypedComplexOutputDescription outputDescription = new TypedComplexOutputDescriptionImpl(new OwsCode(id), + new OwsLanguageString(title), new OwsLanguageString(_abstract), null, metadata, defaultFormat, + supportedFormats, maximumMegabytes, dataBinding); + + outputs.add(outputDescription); + } + + protected void addComplexOutputDescription(String id, + String title, + String _abstract, + Format defaultFormat, + Set supportedFormats, + Class> dataBinding) { + + TypedComplexOutputDescription outputDescription = descriptionFactory.complexOutput().withIdentifier(id) + .withAbstract(_abstract).withTitle(title).withDefaultFormat(defaultFormat).withSupportedFormat( + supportedFormats).withType(dataBinding).build(); + + outputs.add(outputDescription); + } + + private Collection getOutputs() { + return outputs; + } + + private Collection getInputs() { + return inputs; + } + + private OwsMetadata getMetadata() { + return this.metadata; + } + + protected void setMetadata(OwsMetadata metadata) { + this.metadata = metadata; + } + + private boolean getStoreSupported() { + return storeSupported; + } + + private boolean getStatusSupported() { + return statusSupported; + } + + protected void setStoreSupported(boolean storeSupported) { + this.storeSupported = storeSupported; + } + + protected void setStatusSupported(boolean statusSupported) { + this.statusSupported = statusSupported; + } + + /** + * Override this class for BBOX input data to set supported mime types. The + * first one in the resulting array will be the default one. + * + * @param identifier + * ID of the input BBOXType + * @return an array containing Strings representing the supported CRSs for + * inputs + */ + public String[] getSupportedCRSForBBOXInput(String identifier) { + return new String[0]; + } + + /** + * Override this class for BBOX output data to set supported mime types. The + * first one in the resulting array will be the default one. + * + * @param identifier + * ID of the input BBOXType + * @return an array containing Strings representing the supported CRSs for + * outputs + */ + public String[] getSupportedCRSForBBOXOutput(String identifier) { + return new String[0]; + } + + public BigInteger getMinOccurs(String identifier) { + return new BigInteger("1"); + } + + public BigInteger getMaxOccurs(String identifier) { + return new BigInteger("1"); + } + + public abstract List getInputIdentifiers(); + + public abstract List getOutputIdentifiers(); + + public Object getState() { + return state; + } + + public void update(Object state) { + this.state = state; + notifyObservers(); + } + + public void addObserver(IObserver o) { + observers.add(o); + } + + public void removeObserver(IObserver o) { + observers.remove(o); + } + + public void notifyObservers() { + Iterator i = observers.iterator(); + while (i.hasNext()) { + IObserver o = (IObserver) i.next(); + o.update(this); + } + } + + @Override + public List getErrors() { + List errors = new ArrayList(); + return errors; + } + + public void setParserRepository(InputHandlerRepository parserRepository) { + this.parserRepository = parserRepository; + + } + + public void setGeneratorRepository(OutputHandlerRepository generatorRepository) { + this.generatorRepository = generatorRepository; + } + + // private void addInputFormats(SupportedComplexDataInputType complexData, + // List foundParsers) { + // ComplexDataCombinationsType supportedInputFormat = complexData + // .addNewSupported(); + // + // for (int i = 0; i < foundParsers.size(); i++) { + // IParser parser = foundParsers.get(i); + // + // List supportedFullFormats = + // parser.getSupportedFullFormats(); + // + // if (complexData.getDefault() == null) { + // ComplexDataCombinationType defaultInputFormat = complexData + // .addNewDefault(); + // /* + // * default format will be the first config format + // */ + // FormatEntry format = supportedFullFormats.get(0); + // ComplexDataDescriptionType defaultFormat = defaultInputFormat + // .addNewFormat(); + // defaultFormat.setMimeType(format.getMimeType()); + // + // String encoding = format.getEncoding(); + // + // if (encoding != null && !encoding.equals("")) { + // defaultFormat.setEncoding(encoding); + // } + // + // String schema = format.getSchema(); + // + // if (schema != null && !schema.equals("")) { + // defaultFormat.setSchema(schema); + // } + // + // } + // + // for (int j = 0; j < supportedFullFormats.size(); j++) { + // /* + // * create supportedFormat for each mimetype, encoding, schema + // * composition mimetypes can have several encodings and schemas + // */ + // FormatEntry format1 = supportedFullFormats.get(j); + // + // /* + // * add one format for this mimetype + // */ + // ComplexDataDescriptionType supportedFormat = supportedInputFormat + // .addNewFormat(); + // supportedFormat.setMimeType(format1.getMimeType()); + // if (format1.getEncoding() != null) { + // supportedFormat.setEncoding(format1.getEncoding()); + // } + // if (format1.getSchema() != null) { + // supportedFormat.setSchema(format1.getSchema()); + // } + // } + // } + // } + // + // private void addOutputFormats(SupportedComplexDataType complexData, + // List foundGenerators) { + // ComplexDataCombinationsType supportedOutputFormat = complexData + // .addNewSupported(); + // + // for (int i = 0; i < foundGenerators.size(); i++) { + // IGenerator generator = foundGenerators.get(i); + // + // List supportedFullFormats = + // generator.getSupportedFullFormats(); + // + // if (complexData.getDefault() == null) { + // ComplexDataCombinationType defaultInputFormat = complexData + // .addNewDefault(); + // /* + // * default format will be the first config format + // */ + // FormatEntry format = supportedFullFormats.get(0); + // ComplexDataDescriptionType defaultFormat = defaultInputFormat + // .addNewFormat(); + // defaultFormat.setMimeType(format.getMimeType()); + // + // String encoding = format.getEncoding(); + // + // if (encoding != null && !encoding.equals("")) { + // defaultFormat.setEncoding(encoding); + // } + // + // String schema = format.getSchema(); + // + // if (schema != null && !schema.equals("")) { + // defaultFormat.setSchema(schema); + // } + // + // } + // + // for (int j = 0; j < supportedFullFormats.size(); j++) { + // /* + // * create supportedFormat for each mimetype, encoding, schema + // * composition mimetypes can have several encodings and schemas + // */ + // FormatEntry format1 = supportedFullFormats.get(j); + // + // /* + // * add one format for this mimetype + // */ + // ComplexDataDescriptionType supportedFormat = supportedOutputFormat + // .addNewFormat(); + // supportedFormat.setMimeType(format1.getMimeType()); + // if (format1.getEncoding() != null) { + // supportedFormat.setEncoding(format1.getEncoding()); + // } + // if (format1.getSchema() != null) { + // supportedFormat.setSchema(format1.getSchema()); + // } + // } + // } + // } + +} diff --git a/engine/src/main/java/org/n52/javaps/algorithm/LocalAlgorithmRepository.java b/engine/src/main/java/org/n52/javaps/algorithm/LocalAlgorithmRepository.java index 472467cc..7307d574 100644 --- a/engine/src/main/java/org/n52/javaps/algorithm/LocalAlgorithmRepository.java +++ b/engine/src/main/java/org/n52/javaps/algorithm/LocalAlgorithmRepository.java @@ -124,6 +124,10 @@ public void addAlgorithm(IAlgorithm instance) { LOG.warn(duplicateAlgorithmId, description.getId()); } this.algorithms.put(description.getId(), () -> instance); + if(instance instanceof AbstractSelfDescribingAlgorithm) { + ((AbstractSelfDescribingAlgorithm)instance).setParserRepository(parserRepository); + ((AbstractSelfDescribingAlgorithm)instance).setGeneratorRepository(generatorRepository); + } LOG.info("Algorithm {} with id {} registered", instance, description.getId()); } diff --git a/pom.xml b/pom.xml index 11d4504f..67f02e58 100644 --- a/pom.xml +++ b/pom.xml @@ -94,7 +94,7 @@ 5.1.3.RELEASE 1.7.25 2.3 - 5.1.0 + 5.2.0-SNAPSHOT From 410a5e57055f68f8e9ca49331b5989dc31ffeeae Mon Sep 17 00:00:00 2001 From: Benjamin Pross Date: Thu, 6 Dec 2018 12:26:58 +0100 Subject: [PATCH 2/4] Add bounding box input --- .../AbstractSelfDescribingAlgorithm.java | 396 +++--------------- .../algorithm/LocalAlgorithmRepository.java | 6 +- 2 files changed, 66 insertions(+), 336 deletions(-) diff --git a/engine/src/main/java/org/n52/javaps/algorithm/AbstractSelfDescribingAlgorithm.java b/engine/src/main/java/org/n52/javaps/algorithm/AbstractSelfDescribingAlgorithm.java index e79fce6a..539d1430 100644 --- a/engine/src/main/java/org/n52/javaps/algorithm/AbstractSelfDescribingAlgorithm.java +++ b/engine/src/main/java/org/n52/javaps/algorithm/AbstractSelfDescribingAlgorithm.java @@ -23,11 +23,9 @@ import java.util.List; import java.util.Set; -import javax.inject.Inject; - -import org.n52.javaps.algorithm.AbstractAlgorithm; import org.n52.javaps.commons.observerpattern.IObserver; import org.n52.javaps.commons.observerpattern.ISubject; +import org.n52.javaps.description.TypedBoundingBoxInputDescription; import org.n52.javaps.description.TypedComplexInputDescription; import org.n52.javaps.description.TypedComplexOutputDescription; import org.n52.javaps.description.TypedLiteralInputDescription; @@ -40,6 +38,7 @@ import org.n52.javaps.io.literal.LiteralType; import org.n52.shetland.ogc.ows.OwsAllowedValues; import org.n52.shetland.ogc.ows.OwsAnyValue; +import org.n52.shetland.ogc.ows.OwsCRS; import org.n52.shetland.ogc.ows.OwsCode; import org.n52.shetland.ogc.ows.OwsKeyword; import org.n52.shetland.ogc.ows.OwsLanguageString; @@ -69,7 +68,7 @@ public abstract class AbstractSelfDescribingAlgorithm extends AbstractAlgorithm private List observers = new ArrayList(); - private Object state = null; + private Object state; private OutputHandlerRepository generatorRepository; @@ -105,206 +104,12 @@ protected void setVersion(String version) { protected TypedProcessDescription createDescription() { TypedProcessDescription description = new TypedProcessDescriptionFactory().process().withIdentifier(this - .getClass().getName()).withTitle(getTitle()).withAbstract(getAbstract()) - .withMetadata(getMetadata()) - .withInput(getInputs())// TODO process could have no inputs - .withOutput(getOutputs()).withVersion(getVersion()).statusSupported(getStatusSupported()) - .storeSupported(getStoreSupported()).build(); + .getClass().getName()).withTitle(getTitle()).withAbstract(getAbstract()).withMetadata(getMetadata()) + // TODO process could have no inputs + .withInput(getInputs()).withOutput(getOutputs()).withVersion(getVersion()).statusSupported( + getStatusSupported()).storeSupported(getStoreSupported()).build(); return description; - - // ProcessDescriptionsDocument document = - // ProcessDescriptionsDocument.Factory.newInstance(); - // ProcessDescriptions processDescriptions = - // document.addNewProcessDescriptions(); - // ProcessDescriptionType processDescription = - // processDescriptions.addNewProcessDescription(); - // processDescription.setStatusSupported(getStatusSupported()); - // processDescription.setStoreSupported(getStoreSupported()); - // processDescription.setProcessVersion("1.0.0"); - // - // //1. Identifier - // processDescription.addNewIdentifier().setStringValue(this.getClass().getName()); - // processDescription.addNewTitle().setStringValue(this.getClass().getCanonicalName()); - // - // //2. Inputs - // List identifiers = this.getInputIdentifiers(); - // DataInputs dataInputs = null; - // if(identifiers.size()>0){ - // dataInputs = processDescription.addNewDataInputs(); - // } - // - // for(String identifier : identifiers){ - // InputDescriptionType dataInput = dataInputs.addNewInput(); - // dataInput.setMinOccurs(getMinOccurs(identifier)); - // dataInput.setMaxOccurs(getMaxOccurs(identifier)); - // dataInput.addNewIdentifier().setStringValue(identifier); - // dataInput.addNewTitle().setStringValue(identifier); - // - // Class inputDataTypeClass = this.getInputDataType(identifier); - // Class[] interfaces = inputDataTypeClass.getInterfaces(); - // - // //we have to add this because of the new AbstractLiteralDataBinding - // class - // if(interfaces.length == 0){ - // interfaces = inputDataTypeClass.getSuperclass().getInterfaces(); - // } - // - // for(Class implementedInterface : interfaces){ - // if(implementedInterface.equals(ILiteralData.class)){ - // LiteralInputType literalData = dataInput.addNewLiteralData(); - // String inputClassType = ""; - // - // Constructor[] constructors = inputDataTypeClass.getConstructors(); - // for(Constructor constructor : constructors){ - // Class[] parameters = constructor.getParameterTypes(); - // if(parameters.length==1){ - // inputClassType = parameters[0].getSimpleName(); - // } - // } - // - // if(inputClassType.length()>0){ - // DomainMetadataType datatype = literalData.addNewDataType(); - // datatype.setReference("xs:"+inputClassType.toLowerCase()); - // literalData.addNewAnyValue(); - // } - // }else if(implementedInterface.equals(IBBOXData.class)){ - // SupportedCRSsType bboxData = dataInput.addNewBoundingBoxData(); - // String[] supportedCRSAray = getSupportedCRSForBBOXInput(identifier); - // for(int i = 0; i parsers = ParserFactory.getInstance().getAllParsers(); - // List foundParsers = new ArrayList(); - // for(IParser parser : parsers) { - // Class[] supportedClasses = parser.getSupportedDataBindings(); - // for(Class clazz : supportedClasses){ - // if(clazz.equals(inputDataTypeClass)){ - // foundParsers.add(parser); - // } - // - // } - // } - // - // addInputFormats(complexData, foundParsers); - // - // } - // } - // } - // - // //3. Outputs - // ProcessOutputs dataOutputs = - // processDescription.addNewProcessOutputs(); - // List outputIdentifiers = this.getOutputIdentifiers(); - // for(String identifier : outputIdentifiers){ - // OutputDescriptionType dataOutput = dataOutputs.addNewOutput(); - // - // - // dataOutput.addNewIdentifier().setStringValue(identifier); - // dataOutput.addNewTitle().setStringValue(identifier); - // dataOutput.addNewAbstract().setStringValue(identifier); - // - // Class outputDataTypeClass = this.getOutputDataType(identifier); - // Class[] interfaces = outputDataTypeClass.getInterfaces(); - // - // //we have to add this because of the new AbstractLiteralDataBinding - // class - // if(interfaces.length == 0){ - // interfaces = outputDataTypeClass.getSuperclass().getInterfaces(); - // } - // for(Class implementedInterface : interfaces){ - // - // - // if(implementedInterface.equals(ILiteralData.class)){ - // LiteralOutputType literalData = dataOutput.addNewLiteralOutput(); - // String outputClassType = ""; - // - // Constructor[] constructors = - // outputDataTypeClass.getConstructors(); - // for(Constructor constructor : constructors){ - // Class[] parameters = constructor.getParameterTypes(); - // if(parameters.length==1){ - // outputClassType = parameters[0].getSimpleName(); - // } - // } - // - // if(outputClassType.length()>0){ - // literalData.addNewDataType().setReference("xs:"+outputClassType.toLowerCase()); - // } - // - // }else if(implementedInterface.equals(IBBOXData.class)){ - // SupportedCRSsType bboxData = dataOutput.addNewBoundingBoxOutput(); - // String[] supportedCRSAray = getSupportedCRSForBBOXOutput(identifier); - // for(int i = 0; i generators = - // GeneratorFactory.getInstance().getAllGenerators(); - // List foundGenerators = new ArrayList(); - // for(IGenerator generator : generators) { - // Class[] supportedClasses = generator.getSupportedDataBindings(); - // for(Class clazz : supportedClasses){ - // if(clazz.equals(outputDataTypeClass)){ - // foundGenerators.add(generator); - // } - // - // } - // } - // - // addOutputFormats(complexData, foundGenerators); - // - // } - // } - // } - // - // ProcessDescription superProcessDescription = new - // ProcessDescription(); - // - // superProcessDescription.addProcessDescriptionForVersion(document.getProcessDescriptions().getProcessDescriptionArray(0), - // "1.0.0"); - // - // return superProcessDescription; } protected void addComplexInputDescription(String id, @@ -328,13 +133,15 @@ protected void addComplexInputDescription(String id, TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() .withIdentifier(id).withAbstract(_abstract).withTitle(title).withMinimalOccurence(minOccurs) - .withKeywords(keywords).withMetadata(metadata.iterator().next())// FIXME + .withKeywords(keywords). + // FIXME + withMetadata(metadata.iterator().next()) .withMaximalOccurence(maxOccurs).withMaximumMegabytes(maximumMegaBytes).withDefaultFormat(defaultFormat) .withSupportedFormat(supportedFormats).withType(dataBinding).build(); inputs.add(inputDescription); } - + protected void addComplexInputDescription(String id, String title, String _abstract, @@ -345,16 +152,17 @@ protected void addComplexInputDescription(String id, BigInteger minOccurs, BigInteger maxOccurs, Class> dataBinding) { - + TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() .withIdentifier(id).withAbstract(_abstract).withTitle(title).withMinimalOccurence(minOccurs) - .withMetadata(metadata.iterator().next())// FIXME + // FIXME + .withMetadata(metadata.iterator().next()) .withMaximalOccurence(maxOccurs).withMaximumMegabytes(maximumMegaBytes).withDefaultFormat(defaultFormat) .withSupportedFormat(supportedFormats).withType(dataBinding).build(); - + inputs.add(inputDescription); } - + protected void addComplexInputDescription(String id, String title, String _abstract, @@ -363,13 +171,14 @@ protected void addComplexInputDescription(String id, Set supportedFormats, BigInteger maxOccurs, Class> dataBinding) { - + TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() - .withIdentifier(id).withAbstract(_abstract).withTitle(title) - .withMetadata(metadata.iterator().next())// FIXME - .withMaximalOccurence(maxOccurs).withDefaultFormat(defaultFormat) - .withSupportedFormat(supportedFormats).withType(dataBinding).build(); - + .withIdentifier(id).withAbstract(_abstract).withTitle(title). + // FIXME + withMetadata(metadata.iterator().next()) + .withMaximalOccurence(maxOccurs).withDefaultFormat(defaultFormat).withSupportedFormat(supportedFormats) + .withType(dataBinding).build(); + inputs.add(inputDescription); } @@ -491,6 +300,30 @@ protected void addLiteralInputDescription(String id, inputs.add(inputDescription); } + protected void addBoundingBoxInputDescription(String id, + BigInteger minOccurs, + BigInteger maxOccurs, + OwsCRS defaultCRS, + List supportedCRSs) { + + TypedBoundingBoxInputDescription inputDescription = descriptionFactory.boundingBoxInput().withIdentifier(id) + .withMinimalOccurence(minOccurs).withMaximalOccurence(maxOccurs).withDefaultCRS(defaultCRS) + .withSupportedCRS(supportedCRSs).build(); + + inputs.add(inputDescription); + } + + protected void addBoundingBoxInputDescription(String id, + BigInteger minOccurs, + BigInteger maxOccurs, + OwsCRS defaultCRS) { + + TypedBoundingBoxInputDescription inputDescription = descriptionFactory.boundingBoxInput().withIdentifier(id) + .withMinimalOccurence(minOccurs).withMaximalOccurence(maxOccurs).withDefaultCRS(defaultCRS).build(); + + inputs.add(inputDescription); + } + protected void addComplexOutputDescription(String id, String title, String _abstract, @@ -522,6 +355,21 @@ protected void addComplexOutputDescription(String id, outputs.add(outputDescription); } + protected void addComplexOutputDescription(String id, + String title, + String _abstract, + Class> dataBinding) { + + Set supportedFormats = this.generatorRepository.getSupportedFormats(dataBinding); + Format defaultFormat = this.generatorRepository.getDefaultFormat(dataBinding).orElse(null); + + TypedComplexOutputDescription outputDescription = descriptionFactory.complexOutput().withIdentifier(id) + .withAbstract(_abstract).withTitle(title).withDefaultFormat(defaultFormat).withSupportedFormat( + supportedFormats).withType(dataBinding).build(); + + outputs.add(outputDescription); + } + private Collection getOutputs() { return outputs; } @@ -530,7 +378,7 @@ private Collection getInputs() { return inputs; } - private OwsMetadata getMetadata() { + private OwsMetadata getMetadata() { return this.metadata; } @@ -632,122 +480,4 @@ public void setGeneratorRepository(OutputHandlerRepository generatorRepository) this.generatorRepository = generatorRepository; } - // private void addInputFormats(SupportedComplexDataInputType complexData, - // List foundParsers) { - // ComplexDataCombinationsType supportedInputFormat = complexData - // .addNewSupported(); - // - // for (int i = 0; i < foundParsers.size(); i++) { - // IParser parser = foundParsers.get(i); - // - // List supportedFullFormats = - // parser.getSupportedFullFormats(); - // - // if (complexData.getDefault() == null) { - // ComplexDataCombinationType defaultInputFormat = complexData - // .addNewDefault(); - // /* - // * default format will be the first config format - // */ - // FormatEntry format = supportedFullFormats.get(0); - // ComplexDataDescriptionType defaultFormat = defaultInputFormat - // .addNewFormat(); - // defaultFormat.setMimeType(format.getMimeType()); - // - // String encoding = format.getEncoding(); - // - // if (encoding != null && !encoding.equals("")) { - // defaultFormat.setEncoding(encoding); - // } - // - // String schema = format.getSchema(); - // - // if (schema != null && !schema.equals("")) { - // defaultFormat.setSchema(schema); - // } - // - // } - // - // for (int j = 0; j < supportedFullFormats.size(); j++) { - // /* - // * create supportedFormat for each mimetype, encoding, schema - // * composition mimetypes can have several encodings and schemas - // */ - // FormatEntry format1 = supportedFullFormats.get(j); - // - // /* - // * add one format for this mimetype - // */ - // ComplexDataDescriptionType supportedFormat = supportedInputFormat - // .addNewFormat(); - // supportedFormat.setMimeType(format1.getMimeType()); - // if (format1.getEncoding() != null) { - // supportedFormat.setEncoding(format1.getEncoding()); - // } - // if (format1.getSchema() != null) { - // supportedFormat.setSchema(format1.getSchema()); - // } - // } - // } - // } - // - // private void addOutputFormats(SupportedComplexDataType complexData, - // List foundGenerators) { - // ComplexDataCombinationsType supportedOutputFormat = complexData - // .addNewSupported(); - // - // for (int i = 0; i < foundGenerators.size(); i++) { - // IGenerator generator = foundGenerators.get(i); - // - // List supportedFullFormats = - // generator.getSupportedFullFormats(); - // - // if (complexData.getDefault() == null) { - // ComplexDataCombinationType defaultInputFormat = complexData - // .addNewDefault(); - // /* - // * default format will be the first config format - // */ - // FormatEntry format = supportedFullFormats.get(0); - // ComplexDataDescriptionType defaultFormat = defaultInputFormat - // .addNewFormat(); - // defaultFormat.setMimeType(format.getMimeType()); - // - // String encoding = format.getEncoding(); - // - // if (encoding != null && !encoding.equals("")) { - // defaultFormat.setEncoding(encoding); - // } - // - // String schema = format.getSchema(); - // - // if (schema != null && !schema.equals("")) { - // defaultFormat.setSchema(schema); - // } - // - // } - // - // for (int j = 0; j < supportedFullFormats.size(); j++) { - // /* - // * create supportedFormat for each mimetype, encoding, schema - // * composition mimetypes can have several encodings and schemas - // */ - // FormatEntry format1 = supportedFullFormats.get(j); - // - // /* - // * add one format for this mimetype - // */ - // ComplexDataDescriptionType supportedFormat = supportedOutputFormat - // .addNewFormat(); - // supportedFormat.setMimeType(format1.getMimeType()); - // if (format1.getEncoding() != null) { - // supportedFormat.setEncoding(format1.getEncoding()); - // } - // if (format1.getSchema() != null) { - // supportedFormat.setSchema(format1.getSchema()); - // } - // } - // } - // } - } diff --git a/engine/src/main/java/org/n52/javaps/algorithm/LocalAlgorithmRepository.java b/engine/src/main/java/org/n52/javaps/algorithm/LocalAlgorithmRepository.java index 7307d574..acc6ae9b 100644 --- a/engine/src/main/java/org/n52/javaps/algorithm/LocalAlgorithmRepository.java +++ b/engine/src/main/java/org/n52/javaps/algorithm/LocalAlgorithmRepository.java @@ -124,9 +124,9 @@ public void addAlgorithm(IAlgorithm instance) { LOG.warn(duplicateAlgorithmId, description.getId()); } this.algorithms.put(description.getId(), () -> instance); - if(instance instanceof AbstractSelfDescribingAlgorithm) { - ((AbstractSelfDescribingAlgorithm)instance).setParserRepository(parserRepository); - ((AbstractSelfDescribingAlgorithm)instance).setGeneratorRepository(generatorRepository); + if (instance instanceof AbstractSelfDescribingAlgorithm) { + ((AbstractSelfDescribingAlgorithm) instance).setParserRepository(parserRepository); + ((AbstractSelfDescribingAlgorithm) instance).setGeneratorRepository(generatorRepository); } LOG.info("Algorithm {} with id {} registered", instance, description.getId()); } From 8a2ed7d45a5908c752ef2f59b1238c6e1efec7d1 Mon Sep 17 00:00:00 2001 From: Benjamin Pross Date: Thu, 17 Jan 2019 09:44:39 +0100 Subject: [PATCH 3/4] tmp --- .../AbstractSelfDescribingAlgorithm.java | 84 ++++++++++++++----- .../algorithm/LocalAlgorithmRepository.java | 8 +- 2 files changed, 67 insertions(+), 25 deletions(-) diff --git a/engine/src/main/java/org/n52/javaps/algorithm/AbstractSelfDescribingAlgorithm.java b/engine/src/main/java/org/n52/javaps/algorithm/AbstractSelfDescribingAlgorithm.java index 539d1430..649ce048 100644 --- a/engine/src/main/java/org/n52/javaps/algorithm/AbstractSelfDescribingAlgorithm.java +++ b/engine/src/main/java/org/n52/javaps/algorithm/AbstractSelfDescribingAlgorithm.java @@ -23,6 +23,8 @@ import java.util.List; import java.util.Set; +import javax.inject.Inject; + import org.n52.javaps.commons.observerpattern.IObserver; import org.n52.javaps.commons.observerpattern.ISubject; import org.n52.javaps.description.TypedBoundingBoxInputDescription; @@ -70,9 +72,11 @@ public abstract class AbstractSelfDescribingAlgorithm extends AbstractAlgorithm private Object state; - private OutputHandlerRepository generatorRepository; - - private InputHandlerRepository parserRepository; +// @Inject +// private OutputHandlerRepository generatorRepository; +// +// @Inject +// private InputHandlerRepository parserRepository; private OwsMetadata metadata; @@ -104,7 +108,8 @@ protected void setVersion(String version) { protected TypedProcessDescription createDescription() { TypedProcessDescription description = new TypedProcessDescriptionFactory().process().withIdentifier(this - .getClass().getName()).withTitle(getTitle()).withAbstract(getAbstract()).withMetadata(getMetadata()) + .getClass().getName()).withTitle(getTitle()).withAbstract(getAbstract()) +// .withMetadata(getMetadata()) // TODO process could have no inputs .withInput(getInputs()).withOutput(getOutputs()).withVersion(getVersion()).statusSupported( getStatusSupported()).storeSupported(getStoreSupported()).build(); @@ -247,30 +252,54 @@ protected void addComplexInputDescription(String id, } protected void addComplexInputDescription(String id, - Format defaultFormat, + String title, + String _abstract, Set supportedFormats, Class> dataBinding) { TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() - .withIdentifier(id).withAbstract(_abstract).withTitle(title).withDefaultFormat(defaultFormat) + .withIdentifier(id).withAbstract(_abstract).withTitle(title) .withSupportedFormat(supportedFormats).withType(dataBinding).build(); inputs.add(inputDescription); } protected void addComplexInputDescription(String id, + Format defaultFormat, + Set supportedFormats, Class> dataBinding) { - Set supportedFormats = this.parserRepository.getSupportedFormats(dataBinding); - Format defaultFormat = this.parserRepository.getDefaultFormat(dataBinding).orElse(null); + TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() + .withIdentifier(id).withDefaultFormat(defaultFormat) + .withSupportedFormat(supportedFormats).withType(dataBinding).build(); + + inputs.add(inputDescription); + } + + protected void addComplexInputDescription(String id, + Set supportedFormats, + Class> dataBinding) { TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() - .withIdentifier(id).withAbstract(_abstract).withTitle(title).withDefaultFormat(defaultFormat) + .withIdentifier(id).withDefaultFormat(supportedFormats.iterator().next()) .withSupportedFormat(supportedFormats).withType(dataBinding).build(); inputs.add(inputDescription); } +// protected void addComplexInputDescription(String id, +// Class> dataBinding) { +// +// Set supportedFormats = this.parserRepository.getSupportedFormats(dataBinding); +// Format defaultFormat = this.parserRepository.getDefaultFormat(dataBinding).orElse(null); +// +// TypedComplexInputDescription inputDescription = new TypedProcessDescriptionFactory().complexInput() +// .withIdentifier(id).withAbstract(_abstract).withTitle(title).withDefaultFormat(defaultFormat) +// .withSupportedFormat(supportedFormats).withType(dataBinding).build(); +// +// inputs.add(inputDescription); +// } + protected void addLiteralInputDescription(String id, List allowedValues, LiteralType dataBinding) { @@ -358,18 +387,31 @@ protected void addComplexOutputDescription(String id, protected void addComplexOutputDescription(String id, String title, String _abstract, + Set supportedFormats, Class> dataBinding) { - Set supportedFormats = this.generatorRepository.getSupportedFormats(dataBinding); - Format defaultFormat = this.generatorRepository.getDefaultFormat(dataBinding).orElse(null); - TypedComplexOutputDescription outputDescription = descriptionFactory.complexOutput().withIdentifier(id) - .withAbstract(_abstract).withTitle(title).withDefaultFormat(defaultFormat).withSupportedFormat( + .withAbstract(_abstract).withTitle(title).withDefaultFormat(supportedFormats.iterator().next()).withSupportedFormat( supportedFormats).withType(dataBinding).build(); outputs.add(outputDescription); } +// protected void addComplexOutputDescription(String id, +// String title, +// String _abstract, +// Class> dataBinding) { +// +// Set supportedFormats = this.generatorRepository.getSupportedFormats(dataBinding); +// Format defaultFormat = this.generatorRepository.getDefaultFormat(dataBinding).orElse(null); +// +// TypedComplexOutputDescription outputDescription = descriptionFactory.complexOutput().withIdentifier(id) +// .withAbstract(_abstract).withTitle(title).withDefaultFormat(defaultFormat).withSupportedFormat( +// supportedFormats).withType(dataBinding).build(); +// +// outputs.add(outputDescription); +// } + private Collection getOutputs() { return outputs; } @@ -471,13 +513,13 @@ public List getErrors() { return errors; } - public void setParserRepository(InputHandlerRepository parserRepository) { - this.parserRepository = parserRepository; - - } - - public void setGeneratorRepository(OutputHandlerRepository generatorRepository) { - this.generatorRepository = generatorRepository; - } +// public void setParserRepository(InputHandlerRepository parserRepository) { +// this.parserRepository = parserRepository; +// +// } +// +// public void setGeneratorRepository(OutputHandlerRepository generatorRepository) { +// this.generatorRepository = generatorRepository; +// } } diff --git a/engine/src/main/java/org/n52/javaps/algorithm/LocalAlgorithmRepository.java b/engine/src/main/java/org/n52/javaps/algorithm/LocalAlgorithmRepository.java index acc6ae9b..dc799985 100644 --- a/engine/src/main/java/org/n52/javaps/algorithm/LocalAlgorithmRepository.java +++ b/engine/src/main/java/org/n52/javaps/algorithm/LocalAlgorithmRepository.java @@ -124,10 +124,10 @@ public void addAlgorithm(IAlgorithm instance) { LOG.warn(duplicateAlgorithmId, description.getId()); } this.algorithms.put(description.getId(), () -> instance); - if (instance instanceof AbstractSelfDescribingAlgorithm) { - ((AbstractSelfDescribingAlgorithm) instance).setParserRepository(parserRepository); - ((AbstractSelfDescribingAlgorithm) instance).setGeneratorRepository(generatorRepository); - } +// if (instance instanceof AbstractSelfDescribingAlgorithm) { +// ((AbstractSelfDescribingAlgorithm) instance).setParserRepository(parserRepository); +// ((AbstractSelfDescribingAlgorithm) instance).setGeneratorRepository(generatorRepository); +// } LOG.info("Algorithm {} with id {} registered", instance, description.getId()); } From d3da4bbe44fb038f77e22bb9c5701b4aefcf6b09 Mon Sep 17 00:00:00 2001 From: Benjamin Pross Date: Tue, 29 Jan 2019 10:29:34 +0100 Subject: [PATCH 4/4] Remove warnings --- .../algorithm/annotation/LiteralOutputAnnotationParser.java | 1 - .../description/impl/TypedBoundingBoxInputDescriptionImpl.java | 3 +-- .../org/n52/javaps/engine/impl/StaticURLOutputReferencer.java | 1 + 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/engine/src/main/java/org/n52/javaps/algorithm/annotation/LiteralOutputAnnotationParser.java b/engine/src/main/java/org/n52/javaps/algorithm/annotation/LiteralOutputAnnotationParser.java index 2a84621b..aefc8d38 100644 --- a/engine/src/main/java/org/n52/javaps/algorithm/annotation/LiteralOutputAnnotationParser.java +++ b/engine/src/main/java/org/n52/javaps/algorithm/annotation/LiteralOutputAnnotationParser.java @@ -55,7 +55,6 @@ public LiteralType getLiteralType(LiteralOutput annotation, } @Override - @SuppressWarnings("unchecked") public TypedLiteralOutputDescription createDescription(LiteralOutput annotation, B binding) { LiteralType bindingType = getLiteralType(annotation, binding); diff --git a/engine/src/main/java/org/n52/javaps/description/impl/TypedBoundingBoxInputDescriptionImpl.java b/engine/src/main/java/org/n52/javaps/description/impl/TypedBoundingBoxInputDescriptionImpl.java index c4c0e23d..2610ec9e 100644 --- a/engine/src/main/java/org/n52/javaps/description/impl/TypedBoundingBoxInputDescriptionImpl.java +++ b/engine/src/main/java/org/n52/javaps/description/impl/TypedBoundingBoxInputDescriptionImpl.java @@ -18,6 +18,7 @@ import java.util.Set; +import org.n52.javaps.description.TypedBoundingBoxInputDescription; import org.n52.shetland.ogc.ows.OwsCRS; import org.n52.shetland.ogc.ows.OwsCode; import org.n52.shetland.ogc.ows.OwsKeyword; @@ -25,8 +26,6 @@ import org.n52.shetland.ogc.ows.OwsMetadata; import org.n52.shetland.ogc.wps.InputOccurence; import org.n52.shetland.ogc.wps.description.impl.BoundingBoxInputDescriptionImpl; -import org.n52.shetland.ogc.wps.description.impl.BoundingBoxInputDescriptionImpl.AbstractBuilder; -import org.n52.javaps.description.TypedBoundingBoxInputDescription; public class TypedBoundingBoxInputDescriptionImpl extends BoundingBoxInputDescriptionImpl implements TypedBoundingBoxInputDescription { diff --git a/engine/src/main/java/org/n52/javaps/engine/impl/StaticURLOutputReferencer.java b/engine/src/main/java/org/n52/javaps/engine/impl/StaticURLOutputReferencer.java index d12c879a..9defc711 100644 --- a/engine/src/main/java/org/n52/javaps/engine/impl/StaticURLOutputReferencer.java +++ b/engine/src/main/java/org/n52/javaps/engine/impl/StaticURLOutputReferencer.java @@ -62,6 +62,7 @@ public URI reference(OutputReference identifier) { @Override public OutputReference dereference(URI uri) throws IllegalArgumentException { + LOG.info("Dereferencing URI: " + uri); UriComponents build; this.lock.readLock().lock(); try {