Example #1
0
  public BufferModule(CallbackReceiver callbackReceiver, Properties properties) throws Exception {

    // Call parent constructor
    super(callbackReceiver, properties);

    // Add module description
    this.setDescription(
        "<html><h1>Buffer module</h1><p>Stores input until the pipe closes and only then writes it to the output.</p></html>");

    // Add module category
    this.setCategory("I/O");

    // Add property defaults (_should_ be provided for every property)
    this.getPropertyDefaultValues()
        .put(
            ModuleImpl.PROPERTYKEY_NAME,
            "Buffer Module"); // Property key for module name is defined in parent class

    // Define I/O
    /*
     * I/O is structured into separate ports (input~/output~).
     * Every port can support a range of pipe types (currently
     * byte or character pipes). Output ports can provide data
     * to multiple pipe instances at once, input ports can
     * in contrast only obtain data from one pipe instance.
     */
    InputPort inputPort1 = new InputPort(INPUT1ID, "Plain text character input.", this);
    inputPort1.addSupportedPipe(CharPipe.class);
    OutputPort outputPort = new OutputPort(OUTPUTNORMID, "Plain text character output.", this);
    outputPort.addSupportedPipe(CharPipe.class);

    // Add I/O ports to instance (don't forget...)
    super.addInputPort(inputPort1);
    super.addOutputPort(outputPort);
  }
Example #2
0
  @Override
  public void applyProperties() throws Exception {

    // Set defaults for properties not yet set
    super.setDefaultsIfMissing();

    // Apply parent object's properties (just the name variable actually)
    super.applyProperties();
  }
 /*
  * (non-Javadoc)
  *
  * @see modularization.ModuleImpl#applyProperties()
  */
 @Override
 public void applyProperties() throws Exception {
   super.setDefaultsIfMissing();
   if (this.getProperties().containsKey(PROPERTYKEY_NEO4JURI))
     this.neo4jUri = this.getProperties().getProperty(PROPERTYKEY_NEO4JURI);
   if (this.getProperties().containsKey(PROPERTYKEY_NEO4JUSR))
     this.neo4jUsr = this.getProperties().getProperty(PROPERTYKEY_NEO4JUSR);
   if (this.getProperties().containsKey(PROPERTYKEY_NEO4JPWD))
     this.neo4jPwd = this.getProperties().getProperty(PROPERTYKEY_NEO4JPWD);
   if (this.getProperties().containsKey(PROPERTYKEY_USENEO4J))
     this.useNeo4j = Boolean.parseBoolean(this.getProperties().getProperty(PROPERTYKEY_USENEO4J));
   if (this.getProperties().containsKey(PROPERTYKEY_INDIVIDUALBRANCHES))
     this.individualBranches =
         Boolean.parseBoolean(this.getProperties().getProperty(PROPERTYKEY_INDIVIDUALBRANCHES));
   if (this.getProperties().containsKey(PROPERTYKEY_INDIVIDUALROOTNODES))
     this.individualRootNodes =
         Boolean.parseBoolean(this.getProperties().getProperty(PROPERTYKEY_INDIVIDUALROOTNODES));
   super.applyProperties();
 }
  public SuffixNetBuilderModule(CallbackReceiver callbackReceiver, Properties properties)
      throws Exception {
    super(callbackReceiver, properties);

    // Define I/O
    InputPort inputPort =
        new InputPort(
            INPUTID,
            "JSON-encoded FileFinderModule-data, with the parsed contents of one source file per line.",
            this);
    inputPort.addSupportedPipe(CharPipe.class);
    OutputPort outputPort = new OutputPort(OUTPUTID, "Suffix net in binary object form.", this);
    outputPort.addSupportedPipe(BytePipe.class);
    super.addInputPort(inputPort);
    super.addOutputPort(outputPort);

    // Add description for properties
    this.getPropertyDescriptions().put(PROPERTYKEY_NEO4JURI, "URI of the Neo4j DB.");
    this.getPropertyDescriptions().put(PROPERTYKEY_NEO4JUSR, "Username for Neo4J access.");
    this.getPropertyDescriptions().put(PROPERTYKEY_NEO4JPWD, "Password for Neo4J access.");
    this.getPropertyDescriptions()
        .put(PROPERTYKEY_USENEO4J, "Write nodes and edges to Neo4J upon creation.");
    this.getPropertyDescriptions()
        .put(PROPERTYKEY_INDIVIDUALBRANCHES, "Creates individual branches for each sentence.");
    this.getPropertyDescriptions()
        .put(PROPERTYKEY_INDIVIDUALROOTNODES, "Creates individual root nodes for each sentence.");

    // Add default values
    this.getPropertyDefaultValues().put(ModuleImpl.PROPERTYKEY_NAME, "SuffixNetBuilder");
    this.getPropertyDefaultValues().put(PROPERTYKEY_NEO4JURI, "http://127.0.0.1:7474/db/data/");
    this.getPropertyDefaultValues().put(PROPERTYKEY_USENEO4J, "true");
    this.getPropertyDefaultValues().put(PROPERTYKEY_INDIVIDUALBRANCHES, "false");
    this.getPropertyDefaultValues().put(PROPERTYKEY_INDIVIDUALROOTNODES, "false");

    // Add module description
    this.setDescription(
        "Builds a suffix net from the annotated JSON output of OANCXMLParser (expects one JSON object per line).");
    // Add module category
    this.setCategory("Experimental/WiP");
  }