- java.lang.Object
-
- org.refcodes.archetype.C2Helper
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
C2Helper.Builder
Builder to buildC2Helper
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static C2Helper.Builder
builder()
Creates builder to buildC2Helper
.void
deleteLockFile(boolean isVerbose)
Manually deletes the lockfile in case an orphaned lockfile is in the way.String
getInstanceAlias()
Returns the instance alias assigned to thisC2Helper
instance.String
getLockFileName()
org.refcodes.properties.Properties
readLockFile(boolean isVerbose)
Reads the lockfile and returns its content as aProperties
instance.void
writeLockFile(org.refcodes.properties.Properties aProperties, boolean isVerbose)
Writes the lockfile with the content of the providedProperties
instance.
-
-
-
Constructor Detail
-
C2Helper
public C2Helper(String aInstanceAlias, Class<?> aResourceLocator, boolean isVerbose, org.refcodes.logger.RuntimeLogger aLogger) throws IOException
Instantiates a new c 2 helper.- Parameters:
aInstanceAlias
- The alias identifying the invoking application's instance.aResourceLocator
- The application'sClass
which to use when loading resources (of the according module) by invokingClass.getResourceAsStream(String)
.isVerbose
- True to be more verbose.aLogger
- The application's logger.- Throws:
IOException
- thrown in I/O problems occurred building theC2Helper
.
-
-
Method Detail
-
getLockFileName
public String getLockFileName()
-
deleteLockFile
public void deleteLockFile(boolean isVerbose) throws IOException
Manually deletes the lockfile in case an orphaned lockfile is in the way.- Parameters:
isVerbose
- Be more verbose.- Throws:
IOException
- in case there were I/O problems reading the lock file.
-
readLockFile
public org.refcodes.properties.Properties readLockFile(boolean isVerbose) throws IOException, ParseException
Reads the lockfile and returns its content as aProperties
instance. The properties in the lockfiles are expected to be in TOML notation (as ofTomlProperties
).- Parameters:
isVerbose
- Be more verbose.- Returns:
- The lockfile's
Properties
. - Throws:
IOException
- in case there were I/O problems reading the lock file.ParseException
- thrown in case parsing the lockfile's properties failed.
-
writeLockFile
public void writeLockFile(org.refcodes.properties.Properties aProperties, boolean isVerbose) throws IOException
Writes the lockfile with the content of the providedProperties
instance. The properties in the lockfiles are being written in TOML notation (as ofTomlProperties
).- Parameters:
isVerbose
- Be more verbose.aProperties
- The lockfile'sProperties
.- Throws:
IOException
- in case there were I/O problems reading the file.
-
getInstanceAlias
public String getInstanceAlias()
Returns the instance alias assigned to thisC2Helper
instance.- Returns:
- the according instance alias.
-
builder
public static C2Helper.Builder builder()
Creates builder to buildC2Helper
.- Returns:
- created builder
-
-