Manifest

The {@link oaj.microservice.MicroserviceBuilder#manifest(Object)} method can be used to specify the contents or location of of the main manifest file of the executable jar.

If you do not specify the location/contents of the manifest file, the microservice will attempt to resolve it through the following methods:

1. Looking on the file system for a file at "META-INF/MANIFEST.MF". This is primarily to allow for running microservices from within eclipse workspaces where the manifest file is located in the project root.
2. Using the class loader for this class to find the file at the URL "META-INF/MANIFEST.MF".

If you do manually specify the manifest file, you can pass in any of the following types:

- {@link oaj.utils.ManifestFile} - A pre-parsed manifest file.
- {@link java.util.jar.Manifest} - A pre-parsed manifest file.
- {@link java.io.Reader} - Containing the raw contents of the manifest.
- {@link java.io.InputStream} - Containing the raw contents of the manifest.
- {@link java.io.File} - File containing the raw contents of the manifest.
- {@link java.lang.String} - Path to file containing the raw contents of the manifest.
- {@link java.lang.Class} - Finds and loads the manifest file of the jar file that the specified class is contained within.

The manifest file can be retrieved using the the {@link oaj.microservice.Microservice#getManifest()} method which provides an API for accessing manifest file entries. This method returns an instance of {@link oaj.utils.ManifestFile} which extends from {@link oaj.ObjectMap} allowing you to retrieve entries as any data types supported by that class.

##### Example:

ManifestFile mf = Microservice.getInstance().getManifest(); String mainClass = mf.getString("Main-Class"); int myInt = mf.getInt("My-Int", 123); boolean myBoolean = mf.getBoolean("My-Boolean");

The manifest is also used for the {@link oaj.svl.vars.ManifestFileVar $MF} SVL variable.

##### Examples:

// $MF used in variable resolver. VarResolver vr = Microservice.getInstance().getVarResolver(); System.out.println(vr.resolve("The main class is $MF{Main-Class}"));

// $MF used in annotation. @Rest( title="$MF{Application-Title}", ... )