java.lang.Object
org.refcodes.archetype.C2Helper
The
C2Helper
provides means to manage launching and connecting to a
C2 server.-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic C2Helper.Builder
builder()
Creates builder to buildC2Helper
.void
deleteLockFile
(boolean isVerbose) Manually deletes the lockfile in case an orphaned lockfile is in the way.Returns the instance alias assigned to thisC2Helper
instance.Gets the lock file name.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 Details
-
C2Helper
public C2Helper(String aInstanceAlias, Class<?> aResourceLocator, boolean isVerbose, boolean isForce, org.refcodes.logger.RuntimeLogger aLogger) throws IOException Instantiates a new C2 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.isForce
- the is forceaLogger
- The application's logger.- Throws:
IOException
- thrown in I/O problems occurred building theC2Helper
.
-
-
Method Details
-
getLockFileName
Gets the lock file name.- Returns:
- the lock file name
-
deleteLockFile
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:
aProperties
- The lockfile'sProperties
.isVerbose
- Be more verbose.- Throws:
IOException
- in case there were I/O problems reading the file.
-
getInstanceAlias
Returns the instance alias assigned to thisC2Helper
instance.- Returns:
- the according instance alias.
-
builder
Creates builder to buildC2Helper
.- Returns:
- created builder
-