Skip to content

Commit 3f78af7

Browse files
committed
Merge branch 'features/python-support'
# Conflicts: # Plugin-Manager/src/main/java/org/ohnlp/backbone/pluginmanager/PluginManager.java
2 parents b188747 + 5c19811 commit 3f78af7

33 files changed

+1351
-117
lines changed

API/pom.xml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,43 @@
3131
<parent>
3232
<groupId>org.ohnlp.backbone</groupId>
3333
<artifactId>backbone-parent</artifactId>
34-
<version>3.0.7</version>
34+
<version>3.0.8</version>
3535
</parent>
3636

3737
<artifactId>api</artifactId>
3838

3939
<description>
4040
Application Programming Interface for OHNLP Backbone Components
4141
</description>
42+
43+
<dependencies>
44+
<dependency>
45+
<groupId>net.sf.py4j</groupId>
46+
<artifactId>py4j</artifactId>
47+
<version>0.10.9.7</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.apache.commons</groupId>
51+
<artifactId>commons-exec</artifactId>
52+
<version>1.3</version>
53+
<scope>compile</scope>
54+
</dependency>
55+
<dependency>
56+
<groupId>commons-codec</groupId>
57+
<artifactId>commons-codec</artifactId>
58+
<version>1.15</version>
59+
<scope>compile</scope>
60+
</dependency>
61+
<dependency>
62+
<groupId>org.codehaus.plexus</groupId>
63+
<artifactId>plexus-archiver</artifactId>
64+
<version>4.7.1</version>
65+
</dependency>
66+
<dependency>
67+
<groupId>com.fasterxml.jackson.datatype</groupId>
68+
<artifactId>jackson-datatype-joda</artifactId>
69+
<version>2.13.0</version>
70+
<scope>compile</scope>
71+
</dependency>
72+
</dependencies>
4273
</project>

API/src/main/java/org/ohnlp/backbone/api/BackbonePipelineComponent.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ public abstract class BackbonePipelineComponent<I extends PInput, O extends POut
3131
* @throws ValidationError if a validation error occurs.
3232
*/
3333
public abstract void validate() throws ValidationError;
34+
35+
public void teardown() {}
3436
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package org.ohnlp.backbone.api;
2+
3+
public enum ComponentLang {
4+
JAVA,
5+
PYTHON
6+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package org.ohnlp.backbone.api.components;
2+
3+
import com.fasterxml.jackson.databind.JsonNode;
4+
import org.ohnlp.backbone.api.BackbonePipelineComponent;
5+
6+
/**
7+
* Defines that this component is a cross-language component
8+
* <br/>
9+
* This interface is used as cross-language components do not support injection of configuration values, meaning that
10+
* external injection of the config JSON is necessary before {@link BackbonePipelineComponent#init()} is called
11+
*/
12+
public interface XLangComponent {
13+
void injectConfig(JsonNode config);
14+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.ohnlp.backbone.api.components.xlang.python;
2+
3+
import java.util.List;
4+
import java.util.Map;
5+
6+
public interface PythonBackbonePipelineComponent extends PythonStructureProxy {
7+
/**
8+
* Initialize the component with config json
9+
*/
10+
void init(String json);
11+
12+
/**
13+
* @return A String-based JSON config to pass to the DoFn on init
14+
*/
15+
String to_do_fn_config();
16+
17+
/**
18+
* @return A Tag describing the expected input
19+
*/
20+
String get_input_tag();
21+
22+
/**
23+
* @return A list of one or more labels/tags for expected outputs
24+
*/
25+
List<String> proxied_get_output_tags();
26+
27+
/**
28+
* @param input_schemas The schemas being input
29+
* @return A derived output schema from the supplied input schema
30+
*/
31+
Map<String, PythonSchema> proxied_calculate_output_schema(Map<String, PythonSchema> input_schemas);
32+
}

0 commit comments

Comments
 (0)