use of com.axway.ats.rbv.model.RbvStorageException in project ats-framework by Axway.
the class FileSystemFolder method open.
public void open() throws RbvStorageException {
//first check if the folder is already open
if (isOpen) {
throw new MatchableAlreadyOpenException("File system folder is already open");
}
try {
//get the name of the OS
this.osType = this.systemOperations.getOperatingSystemType();
// provide path valid for the target host
this.path = IoUtils.normalizeDirPath(path, this.osType);
} catch (Exception e) {
throw new RbvStorageException("Could not open " + getDescription(), e);
}
isOpen = true;
}
use of com.axway.ats.rbv.model.RbvStorageException in project ats-framework by Axway.
the class FileModtimeRule method performMatch.
@Override
public boolean performMatch(MetaData metaData) throws RbvException {
boolean actualResult = false;
if (metaData instanceof FileSystemMetaData) {
//get the file from the meta data
FilePackage file = ((FileSystemMetaData) metaData).getFilePackage();
try {
//get destination file's size
long destModtime = file.getModTime();
actualResult = destModtime == this.srcModtime;
} catch (PackageException pe) {
throw new RbvStorageException(pe);
}
}
return actualResult;
}
use of com.axway.ats.rbv.model.RbvStorageException in project ats-framework by Axway.
the class ImapFolder method getNewMetaData.
public List<MetaData> getNewMetaData() throws RbvException {
//first check if the folder is open
if (!isOpen) {
throw new MatchableNotOpenException(getDescription() + " is not open");
}
if (isInitialPass) {
isInitialPass = false;
return getAllMetaData();
}
try {
newMetaDataList.clear();
Message[] imapMessages = folder.getMessages();
for (Message imapMessage : imapMessages) {
if (!imapMessage.getFlags().contains(Flags.Flag.FLAGGED)) {
imapMessage.setFlag(Flags.Flag.FLAGGED, true);
ImapMetaData currentMeta = createImapMetaData((MimeMessage) imapMessage);
if (currentMeta != null) {
allMetaDataList.add(currentMeta);
newMetaDataList.add(currentMeta);
}
}
}
} catch (MessagingException me) {
throw new RbvStorageException("Could not get meta data from " + getDescription(), me);
}
return newMetaDataList;
}
use of com.axway.ats.rbv.model.RbvStorageException in project ats-framework by Axway.
the class ImapFolder method expunge.
/**
* Cleans up the associated IMAP folder
* @throws RbvStorageException
*/
@PublicAtsApi
public void expunge() throws RbvStorageException {
//first check if the folder is open
if (!isOpen) {
throw new MatchableNotOpenException(getDescription() + " is not open");
}
try {
folder.setFlags(folder.getMessages(), new Flags(Flags.Flag.DELETED), true);
folder.expunge();
} catch (MessagingException me) {
throw new RbvStorageException(me);
}
log.info("Expunged " + getDescription());
}
use of com.axway.ats.rbv.model.RbvStorageException in project ats-framework by Axway.
the class ImapFolder method close.
/**
* Closes the IMAP folder
* @see com.axway.ats.rbv.storage.Matchable#close()
*/
@PublicAtsApi
public void close() throws RbvStorageException {
//first check if the folder is open
if (!isOpen) {
throw new MatchableNotOpenException(getDescription() + " is not open");
}
try {
if (store.isConnected()) {
folder.close(true);
store.close();
log.info("Closed " + getDescription());
}
isOpen = false;
} catch (MessagingException me) {
throw new RbvStorageException("Could not close " + getDescription(), me);
}
}
Aggregations