Package org.wildfly.prospero.metadata
Class ProsperoMetadataUtils
- java.lang.Object
-
- org.wildfly.prospero.metadata.ProsperoMetadataUtils
-
public class ProsperoMetadataUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringCURRENT_VERSION_FILEstatic StringINSTALLER_CHANNELS_FILE_NAMEName of the file containing list of channels the server is subscribed to.static StringMANIFEST_FILE_NAMEName of the file containing channel manifest generated during provisioning.static StringMAVEN_OPTS_FILEstatic StringMETADATA_DIRFolder containing Prospero metadata inside the provisioned server.static StringREADME_FILE_NAME
-
Constructor Summary
Constructors Constructor Description ProsperoMetadataUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PathconfigurationPath(Path serverDir)static voidgenerate(Path serverDir, List<org.wildfly.channel.Channel> channels, org.wildfly.channel.ChannelManifest manifest, ManifestVersionRecord versionRecord)Generate installer metadata insideserverDir.static PathmanifestPath(Path serverDir)static voidwriteChannelsConfiguration(Path channelPath, List<org.wildfly.channel.Channel> channels)recordchannelsto the file at .static voidwriteManifest(Path manifestPath, org.wildfly.channel.ChannelManifest manifest)recordChannelManifestto the file at .protected static voidwriteToFile(Path path, String text)static voidwriteVersionRecord(Path versionsPath, ManifestVersionRecord versionRecord)recordManifestVersionRecordto the file at .static voidwriteWarningReadme(Path readmeFile)
-
-
-
Field Detail
-
METADATA_DIR
public static final String METADATA_DIR
Folder containing Prospero metadata inside the provisioned server.- See Also:
- Constant Field Values
-
MANIFEST_FILE_NAME
public static final String MANIFEST_FILE_NAME
Name of the file containing channel manifest generated during provisioning.- See Also:
- Constant Field Values
-
INSTALLER_CHANNELS_FILE_NAME
public static final String INSTALLER_CHANNELS_FILE_NAME
Name of the file containing list of channels the server is subscribed to.- See Also:
- Constant Field Values
-
MAVEN_OPTS_FILE
public static final String MAVEN_OPTS_FILE
- See Also:
- Constant Field Values
-
CURRENT_VERSION_FILE
public static final String CURRENT_VERSION_FILE
- See Also:
- Constant Field Values
-
README_FILE_NAME
public static final String README_FILE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
generate
public static void generate(Path serverDir, List<org.wildfly.channel.Channel> channels, org.wildfly.channel.ChannelManifest manifest, ManifestVersionRecord versionRecord) throws IOException
Generate installer metadata insideserverDir. The generated metadata files allow the server to be managed by Prospero. The metadata directory must not contain any metadata files.- Parameters:
serverDir- - base path of the provisioned serverschannels- - list of channels the server should be subscribed tomanifest- - channel manifest containing streams used to provision a server.versionRecord- - provisioned versions of manifests. Can benull- Throws:
IOException- - if unable to write the metadata filesIllegalArgumentException- - if any of metadata files are already present.
-
writeChannelsConfiguration
public static void writeChannelsConfiguration(Path channelPath, List<org.wildfly.channel.Channel> channels) throws IOException
recordchannelsto the file at . If the file already exist, it will be overwritten. If the file doesn't exist, the parent directory needs to be present, otherwise an exception is thrown.- Parameters:
channelPath- -Pathwhere the data should be savedchannels- -Channels to record- Throws:
IOException- - if unable to write the fileIllegalArgumentException- - if the parent folder does not exist.
-
writeManifest
public static void writeManifest(Path manifestPath, org.wildfly.channel.ChannelManifest manifest) throws IOException
recordChannelManifestto the file at . If the file already exist, it will be overwritten. If the file doesn't exist, the parent directory needs to be present, otherwise an exception is thrown.- Parameters:
manifestPath- -Pathwhere the data should be savedmanifest- -ChannelManifestto record- Throws:
IOException- - if unable to write the fileIllegalArgumentException- - if the parent folder does not exist.
-
writeVersionRecord
public static void writeVersionRecord(Path versionsPath, ManifestVersionRecord versionRecord) throws IOException
recordManifestVersionRecordto the file at . If the file already exist, it will be overwritten. If the file doesn't exist, the parent directory needs to be present, otherwise an exception is thrown.- Parameters:
versionsPath- -Pathwhere the data should be savedversionRecord- -ManifestVersionRecordto record- Throws:
IOException- - if unable to write the fileIllegalArgumentException- - if the parent folder does not exist.
-
writeWarningReadme
public static void writeWarningReadme(Path readmeFile) throws IOException
- Throws:
IOException
-
writeToFile
protected static void writeToFile(Path path, String text) throws IOException
- Throws:
IOException
-
-