|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.xbus.technical.file.FileBase net.sf.xbus.technical.file.FileSender
public class FileSender
FileSender
manages writing a text file on a mounted file
system.
Configuration:
Chapter | Section | Key | Content |
---|---|---|---|
System | Interface | Filename | File path name on the mounted-system |
System | Interface | ConflictResolution | Three actions must be possible when a file already exists append, overwrite or error |
System | Interface | Encoding | Specified character encoding of the interface (Optional) |
Field Summary | |
---|---|
protected java.lang.String[] |
mBackupFilename
Path name for the backup copy Array for broadcasting |
protected FileSenderConfiguration |
mConfiguration
|
protected java.lang.String[] |
mTempFilename
Path name of the temporary file to be write Array for broadcasting |
protected boolean |
senderExecuted
Indicates wether execute has been called, used in commit and rollback |
Constructor Summary | |
---|---|
FileSender(XBUSSystem system)
Constructs a FileSender object giving all necessary data from the standard configuration, checking file permissions and registering current resource by the TAManager . |
Method Summary | |
---|---|
void |
close()
Is not implemented for file system |
void |
commit()
Implemented method commit from TAResource interface. |
java.lang.String |
execute(java.lang.String function,
java.lang.String callData)
Implemented method execute from TextSender sends the given
string callData to the neighbor-system. |
java.lang.String |
getType()
A Sender can send data either as a String
or as an Object to the neighboring system. |
void |
open()
Is not implemented for file system |
protected void |
prepareWriteFile(java.lang.String fileName,
int fileNo)
|
protected java.io.BufferedWriter |
prepareWriter(java.lang.String fileName,
int fileNo)
|
void |
rollback()
Implemented method rollback from TAResource ignores all
changes have made since the beginning of the process (transaction). |
Methods inherited from class net.sf.xbus.technical.file.FileBase |
---|
copyFile, deleteFile, getEncoding, getFileLength, getLastByteOfFile, renameFile |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected FileSenderConfiguration mConfiguration
protected java.lang.String[] mTempFilename
protected java.lang.String[] mBackupFilename
protected boolean senderExecuted
Constructor Detail |
---|
public FileSender(XBUSSystem system) throws XException
TAManager
.
system
- destination of the message
XException
- if an error occursMethod Detail |
---|
public java.lang.String execute(java.lang.String function, java.lang.String callData) throws XException
execute
from TextSender sends the given
string callData to the neighbor-system. Three actions must be
taking into account when a file already exists:
Append |
append new data to the existing file | |
Overwrite |
overwrite existing file with the new data | |
Error |
throw XException |
execute
in interface TextSender
function
- Name of the interfacecallData
- String to be written
XException
- if any error occursprotected java.io.BufferedWriter prepareWriter(java.lang.String fileName, int fileNo) throws XException
XException
protected void prepareWriteFile(java.lang.String fileName, int fileNo) throws XException
XException
public void commit() throws XException
commit
from TAResource interface. The
purpose of commit actions is to remove any backup information that had
been created during process (tansaction).
Undepending on the ConflictResolution, the following acts commit all actions.
commit
in interface TAResource
XException
- if any error occursTAResource.commit()
public void rollback() throws XException
rollback
from TAResource ignores all
changes have made since the beginning of the process (transaction).
Undepending on the ConflictResolution, the following acts roll back all
modifications that have been made in the file system associated with this
FileSender
:
rollback
in interface TAResource
XException
- if any error occursTAResource.rollback()
public void open()
open
in interface TAResource
public void close()
close
in interface TAResource
public java.lang.String getType()
Sender
Sender
can send data either as a String
or as an Object
to the neighboring system.Strings
the Sender must fulfill two
preconditions:
getType
returns Constants.TYPE_TEXT
TextSender
Objects
the Sender must also fulfill two
preconditions:
getType
returns Constants.TYPE_OBJECT
ObjectSender
getType
in interface Sender
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |