Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Value substitution in included command

Value substitution in included command

Explorer

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.

 

 

 

 

Don't have an account?
Coming from Hortonworks? Activate your account here