@IntegrationFeature(clazz=FileStoreFeature.class, name="file-store") public final class FileStoreFeatureImpl extends org.adroitlogic.x.api.AbstractIntegrationFeature implements FileStoreFeature
GenericObjectPool
This implementation facilitates to configure initialSize(defaults to 200), warnThreshold(defaults to 6144) and
stopThreshold(defaults to 8192) for the file cached entries in the pool. If it exceeds the warnThreshold, warn log will
be created to notify to the user, if it exceeds the stop threshold, NoSuchElementException
exception
will be thrown by the object pool.Constructor and Description |
---|
FileStoreFeatureImpl() |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
XMessageFileEntity |
getFileEntity(UUID messageUuid)
Deprecated.
|
XMessageFileEntity |
getTempFileEntity(org.adroitlogic.x.api.XMessage xMessage)
Use this api to get a temp
XMessageFileEntity from the file store. |
void |
init(org.springframework.context.ApplicationContext context) |
void |
releaseFile(XMessageFileEntity messageFileEntity)
Use this api to release a specific message entity from the file store,
this call will either delete the actual file from the file system or
released to the file pool depending on the
FileStoreFeature
implementation. |
void |
resetPayloadToFileBackedFormat(org.adroitlogic.x.api.XMessage xMessage)
Use this api to reset a payload of a message to a new instance of
MessageFileFormat
which is consist of a new XMessageFileEntity . |
public void init(org.springframework.context.ApplicationContext context)
init
in interface org.adroitlogic.x.api.dec.Initializable
init
in class org.adroitlogic.x.api.AbstractIntegrationFeature
public void destroy()
destroy
in interface org.adroitlogic.x.api.dec.Initializable
destroy
in class org.adroitlogic.x.api.AbstractIntegrationFeature
@Deprecated public XMessageFileEntity getFileEntity(UUID messageUuid) throws org.adroitlogic.x.api.IntegrationRuntimeException
XMessageFileEntity
from file store.
Note: this file not be released by the framework unless it
used in a constructor of a XMessage
, thus it should
be released at the end of use by calling releaseFile(XMessageFileEntity)
Method has been marked as deprecated since it is not encourage
to use this method in order to get a temp file, instead use
getTempFileEntity(XMessage)
messageUuid
- the uuid of the messageXMessageFile
instanceorg.adroitlogic.x.api.IntegrationRuntimeException
- in case of a failure to get the file entitypublic XMessageFileEntity getTempFileEntity(org.adroitlogic.x.api.XMessage xMessage) throws org.adroitlogic.x.api.IntegrationRuntimeException
FileStoreFeature
XMessageFileEntity
from the file store.
The returned entity will be naturally deleted at the end of the given
message's end of life.getTempFileEntity
in interface FileStoreFeature
xMessage
- Message for attaching the release hookXMessageFileEntity
org.adroitlogic.x.api.IntegrationRuntimeException
- If couldn't create a message filepublic void resetPayloadToFileBackedFormat(org.adroitlogic.x.api.XMessage xMessage) throws org.adroitlogic.x.api.IntegrationRuntimeException
FileStoreFeature
MessageFileFormat
which is consist of a new XMessageFileEntity
.
Created XMessageFileEntity
will be naturally released at the end
of the given XMessage
's life.resetPayloadToFileBackedFormat
in interface FileStoreFeature
xMessage
- XMessage
instance for reset payloadorg.adroitlogic.x.api.IntegrationRuntimeException
- If couldn't create a message filepublic final void releaseFile(XMessageFileEntity messageFileEntity) throws org.adroitlogic.x.api.IntegrationRuntimeException
FileStoreFeature
FileStoreFeature
implementation.releaseFile
in interface FileStoreFeature
messageFileEntity
- XMessageFileEntity
instance to be releasedorg.adroitlogic.x.api.IntegrationRuntimeException
- If couldn't release the messageFile
or delete underlying fileCopyright © 2016–2019 AdroitLogic. All rights reserved.