Data Hub CLASSPATH Configuration Files and Recipes

Data Hub relies on configuration files and property files. Your recipe can create and properly place these files.

Configuring CLASSPATH Resources

A typical Data Hub deployment requires some resources that are placed on the application classpath. All resources can be configured inside a resources element within the Data Hub configuration clause. Here is how you can do that

Property Files

Use the propertyFile configuration element to create a property file on the Data Hub application classpath.
def datahubCfg = { 
		resources { 
			propertyFile "local", { 
				property 'datahub.extension.exportURL', 'https://localhost:9002/datahubadapter' 
				property 'datahub.encryption.key.path', 'encryption-key.txt' 
				property 'datahub.server.url', "https://localhost:8443/datahub-webapp/v1" 
			} 
		} 
}
This sample configuration creates a local.properties file containing properties specified inside thepropertyFile element. File extension .properties is default, so for that reason you don't have to explicitly specify it. We put only "local" for the file name after the propertyFile element. Properties inside the propertyFile element can be defined by following this convention: property '<property_name>', '<property_value>'.

Non-Existent Files with Arbitrary Content

Sometimes you place other resource files besides properties on the classpath. For instance, in the previous properties exampledatahub.encryption.key.path property refers to the encryption-key.txt file containing an encryption key used by your deployment. The file does not exist in the Data Hub application. Let's create it in the resource configuration section:
resources { 
		resource 'encryption-key.txt', content: "8fae27b02e4e64dfb79f18947743b6f9" 
}
The content attribute specifies text to be written into the file (encryption-key.txt).

Existing File Resources

It's possible the resource file(s) already exist somewhere on your workstation. So, instead of retyping their content in the configuration section, you just want to include them into the Data Hub deployment. Here's how the resource element can be used to include them.
resources { 
	resource 'C:\\keys\\encryption-key.txt' 
	resource installerHome + '/../hybris/config/local.properties' 
	resource file(suiteHome, 'hybris/config/local.properties') 
	resource 'META-INF/MANIFEST.MF', path: "$System.env.HOME/templates/dev/manifiest" 
}
The example demonstrates multiple ways of using the resource configuration element.
  • Line 2: Refers to an existing file by its absolute path on your workstation. encryption-key.txt is copied with the same name into the root of the application classpath.
  • Line 3: Refers to a path relative to the directory where installer is located. local.properties file is copied into the application classpath root.
  • Line 4: Does exactly the same thing as line 3, but refers suiteHome location and file function instead of a string concatenation to build the path..
  • Line 5: Demonstrates how the <HOME> environment variable can be referred in the recipe script. This line copies a manifest file existing on the local file system into the META-INF directory on the application classpath. It also renames the original file to MANIFEST.MF. The full path on the classpath can be specified in exactly the same way for propertyFile and resource with content attribute elements.