-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
296 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
.../src/main/java/org/integratedmodelling/klab/api/services/resources/adapters/Exporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.integratedmodelling.klab.api.services.resources.adapters; | ||
|
||
import org.integratedmodelling.klab.api.knowledge.KlabAsset; | ||
import org.integratedmodelling.klab.api.services.runtime.extension.KlabFunction; | ||
|
||
import java.lang.annotation.*; | ||
|
||
/** | ||
* Annotates methods that implement (and possibly define) an export schema specified through | ||
* {@link org.integratedmodelling.klab.api.services.resources.ResourceTransport} beans. The methods can be in | ||
* a class annotated with {@link org.integratedmodelling.klab.api.services.runtime.extension.Library} or | ||
* {@link ResourceAdapter}. | ||
* <p> | ||
* Recognized method parameters should include an {@link org.integratedmodelling.klab.api.knowledge.Urn} or | ||
* directly a Resource for resources with parameters, a scope, and possibly a String for a media type that | ||
* should be part of the annotation and established through content negotiation. The method must return an | ||
* {@link org.integratedmodelling.klab.api.knowledge.Urn} or a {@link String} that encodes one. | ||
*/ | ||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.METHOD, ElementType.TYPE}) | ||
public @interface Exporter { | ||
|
||
/** | ||
* The unique ID of the import schema this implements. This is the complete ID as a dot-separated path, | ||
* whose leading path is the "class" of the import and the last element specifies the import source or | ||
* method (e.g. <code>component.jar</code>). | ||
* | ||
* @return | ||
*/ | ||
String schema(); | ||
|
||
|
||
KlabAsset.KnowledgeClass knowledgeClass(); | ||
|
||
/** | ||
* If specified, these define the schema's properties which will be passed as a | ||
* {@link org.integratedmodelling.klab.api.collections.Parameters} object. If not, the schema will expect | ||
* binary content as a File, URL or InputStream. | ||
* | ||
* @return | ||
*/ | ||
KlabFunction.Argument[] properties() default {}; | ||
|
||
/** | ||
* Mandatory media type that will be sent along with the exported byte stream. | ||
* | ||
* @return | ||
*/ | ||
String mediaType(); | ||
|
||
String[] fileExtensions() default {}; | ||
|
||
String description(); | ||
} |
60 changes: 60 additions & 0 deletions
60
.../src/main/java/org/integratedmodelling/klab/api/services/resources/adapters/Importer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package org.integratedmodelling.klab.api.services.resources.adapters; | ||
|
||
import org.integratedmodelling.klab.api.knowledge.KlabAsset; | ||
import org.integratedmodelling.klab.api.services.runtime.extension.KlabFunction; | ||
|
||
import java.lang.annotation.*; | ||
|
||
/** | ||
* Annotates methods that implement (and possibly define) an import schema specified through | ||
* {@link org.integratedmodelling.klab.api.services.resources.ResourceTransport} beans. The methods can be in | ||
* a class annotated with {@link org.integratedmodelling.klab.api.services.runtime.extension.Library} or | ||
* {@link ResourceAdapter} (if the latter, the import will be expected to produce a Resource adopting that | ||
* same adapter). | ||
* <p> | ||
* Recognized method parameters can be {@link java.io.File}, {@link java.net.URL} or | ||
* {@link java.io.InputStream} for binary content, | ||
* {@link org.integratedmodelling.klab.api.collections.Parameters} for property-specified content, Resource | ||
* for resources with parameters, and scopes. An {@link org.integratedmodelling.klab.api.knowledge.Urn} may be | ||
* added which will be paired to a suggested URN if the caller has supplied one (the method may modify it). | ||
* The method must return an {@link org.integratedmodelling.klab.api.knowledge.Urn} or a {@link String} that | ||
* encodes one, which will be the final, unique URN. | ||
*/ | ||
@Documented | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.METHOD, ElementType.TYPE}) | ||
public @interface Importer { | ||
|
||
/** | ||
* The unique ID of the import schema this implements. This is the complete ID as a dot-separated path, | ||
* whose leading path is the "class" of the import and the last element specifies the import source or | ||
* method (e.g. <code>component.jar</code>). | ||
* | ||
* @return | ||
*/ | ||
String schema(); | ||
|
||
KlabAsset.KnowledgeClass knowledgeClass(); | ||
|
||
/** | ||
* If specified, these define the schema's properties which will be passed as a | ||
* {@link org.integratedmodelling.klab.api.collections.Parameters} object. If not, the schema will expect | ||
* binary content as a File, URL or InputStream. | ||
* | ||
* @return | ||
*/ | ||
KlabFunction.Argument[] properties() default {}; | ||
|
||
/** | ||
* Optional media type that will be matched to the input's in case multiple schemata are possible for | ||
* different media types. | ||
* | ||
* @return | ||
*/ | ||
String mediaType() default ""; | ||
|
||
String[] fileExtensions() default {}; | ||
|
||
String description(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.