Reply
PNS
Explorer
Posts: 38
Registered: ‎05-20-2014

Value substitution in included command

Hi...

 

Is it possible to make a value substitution visible to a command compiled "internally" (inn Java) compiled command?

 

Normally, an "include" statement at the top of a morphline file, can be used to import settings (e.g., constant values) from another file, as per the HOPCON manual:

However, if the morphline uses an "external" command that is compiled in Java from another file (e.g., using the buildCommand() method of the AbstractCommand class), the values defined in the "include" statement are not visible in the external command file, resulting in a compilation exception.

 

For example, the main file is something like

 

 

      include "file:///path/to/morphlines/global.conf"

      id: ${record_type}_Morphline

      importCommands: ["org.kitesdk.**", "org.apache.solr.**"]

      morphlines : [
        {
          commands: [ # Start commands
            // Commands
          ] # End commands
        }

 

One of the commands compiles, in Java, from another file, an "external" command, like this:

 

pipe {
  
  id : external_commands

  commands : [
    {
// Commands } ] }

 

 

The problem is that, the values defined in global.conf, are not visible inside the above "external" command file, even if the statement

 

include "file:///path/to/morphlines/global.conf"

is also placed in that "external" file.

 

Can the values be made visible at compile time in the "external" command file, without tricks like saving them to the Record object from within the main file.

 

 

 

 

Announcements
The Kite SDK is a collection of docs, sample code, APIs, and tools to make Hadoop application development faster. Learn more at http://kitesdk.org.