T
- The type of the Record
instances managed by the
Logger
.P
- The type of the Column
's value used for partitioning the
Logger
.public class PartedTrimLoggerImpl<T,P extends T> extends Object implements org.refcodes.component.CompositeComponent
PartedTrimLoggerImpl
is a ready to use implementation of a parted
TrimLogger
extending the AbstractPartedTrimLogger
.org.refcodes.component.CompositeComponent.ExtendedCompositeComponent<CTX,CON>
org.refcodes.component.LifeCycleComponent.LifeCycleAutomaton, org.refcodes.component.LifeCycleComponent.UncheckedLifeCycleComponent
org.refcodes.component.Initializable.InitializeAutomaton, org.refcodes.component.Initializable.InitializeBuilder<B extends org.refcodes.component.Initializable.InitializeBuilder<B>>, org.refcodes.component.Initializable.UncheckedInitializable
org.refcodes.component.Startable.StartAutomaton, org.refcodes.component.Startable.StartBuilder<B extends org.refcodes.component.Startable.StartBuilder<B>>, org.refcodes.component.Startable.UncheckedStartable
org.refcodes.component.Pausable.PauseAutomaton, org.refcodes.component.Pausable.PauseBuilder<B extends org.refcodes.component.Pausable.PauseBuilder<B>>, org.refcodes.component.Pausable.UncheckedPausable
org.refcodes.component.Resumable.ResumeAutomaton, org.refcodes.component.Resumable.ResumeBuilder<B extends org.refcodes.component.Resumable.ResumeBuilder<B>>, org.refcodes.component.Resumable.UncheckedResumable
org.refcodes.component.Stoppable.StopAutomaton, org.refcodes.component.Stoppable.StopBuilder<B extends org.refcodes.component.Stoppable.StopBuilder<B>>, org.refcodes.component.Stoppable.UncheckedStoppable
org.refcodes.component.Destroyable.DestroyAutomaton
org.refcodes.component.LinkComponent.LinkAutomaton, org.refcodes.component.LinkComponent.LinkComponentBuilder<B extends org.refcodes.component.LinkComponent.LinkComponentBuilder<B>>
org.refcodes.component.Openable.OpenAutomaton, org.refcodes.component.Openable.OpenBuilder<B extends org.refcodes.component.Openable.OpenBuilder<B>>
org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
org.refcodes.component.Flushable.FlushBuilder<B extends org.refcodes.component.Flushable.FlushBuilder<B>>
Modifier and Type | Field and Description |
---|---|
protected static RuntimeLogger |
LOGGER |
Constructor and Description |
---|
PartedTrimLoggerImpl(org.refcodes.tabular.Column<P> aPartitionColumn,
LoggerFactory<TrimLogger<T>> aLoggerFactory,
boolean isPartitionAutoInitialize)
Instantiates a new parted trim logger impl.
|
PartedTrimLoggerImpl(org.refcodes.tabular.Column<P> aPartitionColumn,
String aDefaultLoggerName,
LoggerFactory<TrimLogger<T>> aLoggerFactory,
boolean isPartitionAutoInitialize)
Instantiates a new parted trim logger impl.
|
PartedTrimLoggerImpl(org.refcodes.controlflow.ExecutionStrategy aComponentExecutionStrategy,
org.refcodes.tabular.Column<P> aPartitionColumn,
LoggerFactory<TrimLogger<T>> aLoggerFactory,
boolean isPartitionAutoInitialize)
Similar to the
PartedTrimLoggerImpl(Column, LoggerFactory, boolean) constructor
with the additional option of determining the execution strategy of the
state change request calls for the encapsulated TrimLogger
instances (as of CompositeComponent ). |
PartedTrimLoggerImpl(org.refcodes.controlflow.ExecutionStrategy aComponentExecutionStrategy,
org.refcodes.tabular.Column<P> aPartitionColumn,
String aDefaultLoggerName,
LoggerFactory<TrimLogger<T>> aLoggerFactory,
boolean isPartitionAutoInitialize)
Similar to the
PartedTrimLoggerImpl(Column, LoggerFactory, boolean) constructor
with the additional option of determining the execution strategy of the
state change request calls for the encapsulated TrimLogger
instances (as of CompositeComponent ). |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
close() |
void |
decompose() |
void |
decomposePartition(P aPartition)
Decomposes the given partition.
|
void |
deleteLogs(org.refcodes.criteria.Criteria aCriteria)
Deletes logged
Record instances according to the provided
Criteria . |
void |
destroy() |
void |
destroyPartition(P aPartition)
Destroys the given partition.
|
void |
dispose() |
org.refcodes.tabular.Records<T> |
findLogs()
Retrieves all available
Record instances being logged. |
org.refcodes.tabular.Records<T> |
findLogs(org.refcodes.criteria.Criteria aCriteria)
Retrieves all available
Record instances being logged matching
the given criteria and restrictions. |
org.refcodes.tabular.Records<T> |
findLogs(org.refcodes.criteria.Criteria aCriteria,
org.refcodes.tabular.Header<T> aHeader)
Retrieves all available
Record instances being logged matching
the given criteria and restrictions. |
org.refcodes.tabular.Records<T> |
findLogs(org.refcodes.criteria.Criteria aCriteria,
org.refcodes.tabular.Header<T> aHeader,
int aLimit)
Retrieves all available
Record instances being logged matching
the given criteria and restrictions. |
org.refcodes.tabular.Records<T> |
findLogs(org.refcodes.criteria.Criteria aCriteria,
int aLimit)
Retrieves all available
Record instances being logged matching
the given criteria and restrictions. |
org.refcodes.tabular.Records<T> |
findLogs(org.refcodes.tabular.Header<T> aHeader,
int aLimit)
Retrieves all available
Record instances being logged matching
the given criteria and restrictions. |
org.refcodes.tabular.Records<T> |
findLogs(int aLimit)
Retrieves all available
Record instances being logged matching
the given criteria and restrictions. |
void |
flush() |
void |
flushPartition(P aPartition)
Flushes the given partition, all buffered data is to be forwarded to the
physical data sink.
|
protected L |
getFallbackLogger()
Returns the fallback
Logger . |
protected Collection<L> |
getLoggers()
Provides access to the partitions managed by the
AbstractPartedLogger . |
protected org.refcodes.tabular.Column<P> |
getPartitionColumn()
Provides access to the
Column used to identify partitions. |
protected L |
getPartitionLogger(P aPartition)
Returns the
Logger being responsible for the given partition. |
protected Collection<L> |
getPartitionLoggers(Set<P> aPartitions)
Retrieves a collection with
Logger instances managing the
provided partitions. |
protected String |
getPartitionUid(P aPartition)
Depending whether the partition object provides a universal ID or not we
return the string representation of the partition's object or the UID.
|
boolean |
hasPartition(P aPartition)
Tests whether the provided partition exists.
|
void |
initialize() |
L |
initPartition(P aPartition)
Initializes the given partition.
|
void |
log(org.refcodes.tabular.Record<? extends T> aRecord)
Logs a
Record . |
void |
open() |
void |
pause() |
void |
reset() |
void |
resume() |
void |
start() |
void |
stop() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
closeIn, closeQuietly, closeUnchecked
findLogs, findLogs, findLogs, findLogs, findLogs, findLogs, findLogs
log, printSeparator
protected static RuntimeLogger LOGGER
public PartedTrimLoggerImpl(org.refcodes.tabular.Column<P> aPartitionColumn, LoggerFactory<TrimLogger<T>> aLoggerFactory, boolean isPartitionAutoInitialize)
aPartitionColumn
- the a partition columnaLoggerFactory
- the a logger factoryisPartitionAutoInitialize
- the is partition auto initializepublic PartedTrimLoggerImpl(org.refcodes.tabular.Column<P> aPartitionColumn, String aDefaultLoggerName, LoggerFactory<TrimLogger<T>> aLoggerFactory, boolean isPartitionAutoInitialize)
aPartitionColumn
- the a partition columnaDefaultLoggerName
- the a default logger nameaLoggerFactory
- the a logger factoryisPartitionAutoInitialize
- the is partition auto initializepublic PartedTrimLoggerImpl(org.refcodes.controlflow.ExecutionStrategy aComponentExecutionStrategy, org.refcodes.tabular.Column<P> aPartitionColumn, LoggerFactory<TrimLogger<T>> aLoggerFactory, boolean isPartitionAutoInitialize)
PartedTrimLoggerImpl(Column, LoggerFactory, boolean)
constructor
with the additional option of determining the execution strategy of the
state change request calls for the encapsulated TrimLogger
instances (as of CompositeComponent
).
aComponentExecutionStrategy
- The strategy to be used when invoking
a component's (encapsulated TrimLogger
instance's) state
change request call (as of CompositeComponent
).public PartedTrimLoggerImpl(org.refcodes.controlflow.ExecutionStrategy aComponentExecutionStrategy, org.refcodes.tabular.Column<P> aPartitionColumn, String aDefaultLoggerName, LoggerFactory<TrimLogger<T>> aLoggerFactory, boolean isPartitionAutoInitialize)
PartedTrimLoggerImpl(Column, LoggerFactory, boolean)
constructor
with the additional option of determining the execution strategy of the
state change request calls for the encapsulated TrimLogger
instances (as of CompositeComponent
).
aComponentExecutionStrategy
- The strategy to be used when invoking
a component's (encapsulated TrimLogger
instance's) state
change request call (as of CompositeComponent
).public void initialize() throws org.refcodes.component.InitializeException
initialize
in interface org.refcodes.component.Initializable
org.refcodes.component.InitializeException
public void start() throws org.refcodes.component.StartException
start
in interface org.refcodes.component.Startable
org.refcodes.component.StartException
public void pause() throws org.refcodes.component.PauseException
pause
in interface org.refcodes.component.Pausable
org.refcodes.component.PauseException
public void resume() throws org.refcodes.component.ResumeException
resume
in interface org.refcodes.component.Resumable
org.refcodes.component.ResumeException
public void stop() throws org.refcodes.component.StopException
stop
in interface org.refcodes.component.Stoppable
org.refcodes.component.StopException
public void decompose()
decompose
in interface org.refcodes.component.Decomposeable
public void flush() throws org.refcodes.component.OpenException
public void destroy()
destroy
in interface org.refcodes.component.Destroyable
public void reset()
reset
in interface org.refcodes.component.Resetable
public void open() throws org.refcodes.component.OpenException
open
in interface org.refcodes.component.Openable
org.refcodes.component.OpenException
public void close()
close
in interface org.refcodes.component.Closable
public void dispose()
dispose
in interface org.refcodes.mixin.Disposable
public void deleteLogs(org.refcodes.criteria.Criteria aCriteria)
Record
instances according to the provided
Criteria
.deleteLogs
in interface TrimLogger<T>
aCriteria
- The Criteria
to be applied when deleting
previously logged Record
instances.public void clear()
clear
in interface org.refcodes.structure.Clearable
public org.refcodes.tabular.Records<T> findLogs()
Record
instances being logged.findLogs
in interface QueryLogger<T>
Records
instance containing all available
Record
instances being logged.public org.refcodes.tabular.Records<T> findLogs(int aLimit)
Record
instances being logged matching
the given criteria and restrictions.findLogs
in interface QueryLogger<T>
aLimit
- The maximum Record
instances contained in the
returned Records
instance; there may be more
Record
instances which are not contained in the
Records
instance in case the Records
instance's
size is that of the specified limit.Records
instance containing all available
Record
instances being logged matching the given criteria
and restrictions.public org.refcodes.tabular.Records<T> findLogs(org.refcodes.criteria.Criteria aCriteria)
Record
instances being logged matching
the given criteria and restrictions.findLogs
in interface QueryLogger<T>
aCriteria
- The Criteria
to be applied to the Record
instancesRecords
instance containing all available
Record
instances being logged matching the given criteria
and restrictions.public org.refcodes.tabular.Records<T> findLogs(org.refcodes.tabular.Header<T> aHeader, int aLimit)
Record
instances being logged matching
the given criteria and restrictions.findLogs
in interface QueryLogger<T>
aHeader
- The Header
used to restrict the "columns"
(key/value entries) in the retrieved Record
instances
(provided by the Records
instance).aLimit
- The maximum Record
instances contained in the
returned Records
instance; there may be more
Record
instances which are not contained in the
Records
instance in case the Records
instance's
size is that of the specified limit.Records
instance containing all available
Record
instances being logged matching the given criteria
and restrictions.public org.refcodes.tabular.Records<T> findLogs(org.refcodes.criteria.Criteria aCriteria, int aLimit)
Record
instances being logged matching
the given criteria and restrictions.findLogs
in interface QueryLogger<T>
aCriteria
- The Criteria
to be applied to the Record
instancesaLimit
- The maximum Record
instances contained in the
returned Records
instance; there may be more
Record
instances which are not contained in the
Records
instance in case the Records
instance's
size is that of the specified limit.Records
instance containing all available
Record
instances being logged matching the given criteria
and restrictions.public org.refcodes.tabular.Records<T> findLogs(org.refcodes.criteria.Criteria aCriteria, org.refcodes.tabular.Header<T> aHeader)
Record
instances being logged matching
the given criteria and restrictions.findLogs
in interface QueryLogger<T>
aCriteria
- The Criteria
to be applied to the Record
instancesaHeader
- The Header
used to restrict the "columns"
(key/value entries) in the retrieved Record
instances
(provided by the Records
instance).Records
instance containing all available
Record
instances being logged matching the given criteria
and restrictions.public org.refcodes.tabular.Records<T> findLogs(org.refcodes.criteria.Criteria aCriteria, org.refcodes.tabular.Header<T> aHeader, int aLimit)
Record
instances being logged matching
the given criteria and restrictions.findLogs
in interface QueryLogger<T>
aCriteria
- The Criteria
to be applied to the Record
instancesaHeader
- The Header
used to restrict the "columns"
(key/value entries) in the retrieved Record
instances
(provided by the Records
instance).aLimit
- The maximum Record
instances contained in the
returned Records
instance; there may be more
Record
instances which are not contained in the
Records
instance in case the Records
instance's
size is that of the specified limit.Records
instance containing all available
Record
instances being logged matching the given criteria
and restrictions.protected Collection<L> getPartitionLoggers(Set<P> aPartitions)
Logger
instances managing the
provided partitions.aPartitions
- The partitions for which to get the Logger
instances.Collection
with none to many Logger
instancespublic void log(org.refcodes.tabular.Record<? extends T> aRecord) throws IllegalRecordRuntimeException, UnexpectedLogRuntimeException
Record
. The targeted data sink for the Record
instances (where them are physically stored) depends on the
implementation of the Logger
. It can be a console, a file, a
stream or a database.log
in interface Logger<T>
aRecord
- The Record
to be logged.IllegalRecordRuntimeException
- Thrown in case the record cannot be
logged as a specific implementation might expect some dedicated
Column
instances to be contained in the provided Record.UnexpectedLogRuntimeException
- Thrown in case some other problems
regarding logging occurred, e.g. the data sink (physical system
where to log to) experiences problems.public boolean hasPartition(P aPartition)
aPartition
- The value of the Column
in a Record
specifying the partition which is to be addressed (or even auto
initialized).public L initPartition(P aPartition) throws org.refcodes.component.InitializeException
aPartition
- The value of the Column
in a Record
specifying the partition which is to be auto initialized.org.refcodes.component.InitializeException
- in case initialization failed e.g. when the
partition already exists or the system was not able to create the
required amount of endpoints.public void destroyPartition(P aPartition)
aPartition
- the a partitionpublic void flushPartition(P aPartition) throws IOException
aPartition
- The partition to be flushed.IOException
- in case there were problems when flushing, e.g.
there is none such partition.public void decomposePartition(P aPartition)
aPartition
- The partition to be decomposed.protected Collection<L> getLoggers()
AbstractPartedLogger
. This is especially useful for extensions of
this class such as the AbstractPartedQueryLogger
or the
AbstractPartedTrimLogger
.Logger
instances managed by the
AbstractPartedLogger
instance.protected String getPartitionUid(P aPartition)
aPartition
- The partition for which to get the identifierprotected org.refcodes.tabular.Column<P> getPartitionColumn()
Column
used to identify partitions.Column
identifying partitions.protected L getPartitionLogger(P aPartition)
Logger
being responsible for the given partition.protected L getFallbackLogger()
Logger
.Copyright © 2018. All rights reserved.