|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.sap.ip.collaboration.gw.impl.transport.file.filesystem.FileTransport
This is a transport class which uses filesystem as groupware server instead of a groupware server. Title: TestCalendarTransport.java Description: Copyright: Copyright (c) 2002 Company: SAP Labs India
| Inner Class Summary | |
(package private) class |
FileTransport.AvailData
Class used to represent Availability information. |
| Field Summary | |
private java.lang.String |
ADDRESS_SEPARATOR
email addresses seperator in to,cc & bcc lists. |
private java.lang.String |
aliasName
System's Name. |
private java.io.File |
appDirectory
File object holding the appointment directory. |
private java.lang.String |
APPOINTMENTS
folder in which the appointments are stored & it is relative to startLocation. |
private java.lang.String |
ATTACHMENT
attachements to groupware items are stored with the extension .attachment |
private java.lang.String |
AVAILABILITY
folder in which the availability information is stored & it is relative to startLocation. |
private java.io.File |
availDirectory
File object holding the availability directory. |
private java.util.Calendar |
calendar
|
private java.util.List |
configuration
|
private java.text.SimpleDateFormat |
formatter
|
private IGroupwareManager |
gwManager
Groupware Manager. |
private static IGWObjectsFactoryService |
gwObjFactory
|
private java.lang.String |
id
|
private int |
idCounter
Count of the calendar items in cache. |
private java.util.Map |
idStore
|
private java.util.Map |
itemStore
cache to store calendar items. |
private java.lang.String |
SEPARATOR
files which represent groupware items. |
private java.lang.String |
startLocation
Starting Location of the file transport. |
| Constructor Summary | |
FileTransport()
|
|
| Method Summary | |
private void |
addAvailabilityInfoForUser(java.lang.String user,
java.util.Properties properties)
Adds the user availability information to availability file. |
private void |
addToCache(ICalendarItem item)
Stores the given Calendar item in Cache. |
private java.lang.String |
addToFileSystem(ICalendarItem pItem,
java.util.Properties props,
boolean reflect)
It Creates or saves file corresponding to given calendar item. |
private java.io.File |
calendarSaveItem(java.lang.String id)
Method to return the file representing the calendar item. |
private java.io.File |
calendarStoreItem(java.util.Date date,
java.lang.StringBuffer pSb)
Creates file to store appointment information based on date value. |
private void |
cleanDirs(java.io.File dir)
Deletes all the files under a given directory. |
private java.util.Date |
clearHourTimeSecond(java.util.Date date)
Sets the hour,minutes,seconds of an date object to 0 |
private void |
computeAvailabilityInfo(java.util.Hashtable availableAppointments,
java.util.List slots,
java.lang.String user,
java.util.Map map)
Scans the all existing appointments in file system and depending on time slots it calculates the availability status. |
private void |
convertToAvailabilityInfoImpl(java.util.Map map,
IDateRange range,
int interval)
Stores Availability info for given date range & interval in its implementation object. |
private void |
convertValuesToAvailData(java.util.Hashtable pHt)
Stores the Availability info for the existing appointments using the (Inner Class) AvailData |
private void |
createActualAttachment(java.io.File dir,
IAttachment attachment)
Creates the attachment file for a given attachment. |
private void |
createAttachments(java.io.File calendarStoreFile,
ICalendarItem item,
java.util.Properties props)
|
private ICalendarItem |
createCalendarItem(java.util.Properties props,
java.io.File file)
Creates the calendar item from Calendar item properties and attachements if any from the file directory associated the item. |
private java.io.File |
createDirectory(java.lang.String tempLocation)
Creates the directory if it is not already present. |
private void |
createItem(ICalendarItem item,
boolean reflect)
Creates a file for the given CalendarItem Object. |
private void |
fillInAttendees(java.util.Set set,
java.lang.String addresses)
Extracts the list of email addresses from the String containg the email addresses seperated by seperator. |
private java.lang.String[] |
findResultantDirNames(java.util.Date startDate,
java.util.Date endDate)
Constructs the directory name's (in the format yyyy-MM-dd) list from startdate to enddate. |
IAttachment |
getAttachmentContent(java.lang.String id,
java.lang.String attachmentId,
IGroupwareCredentials credentials)
Returns content of the attachment based on the id specified. |
private java.io.File |
getAttachmentDir(java.lang.String id)
It gets the attachment directory of the given calendar item id. |
private IAttachment |
getAttachmentFromFileSystem(java.io.File attachmentDir,
java.lang.String attachmentId,
java.lang.String attachmentFileName)
Reads the attachment from the given attachment directory and file name & wraps it into IAttachment object. |
private IAvailabilityInfo |
getAvailabilityImpl(java.lang.String data,
IDateRange range,
int interval)
Creates the availability info implementaion with the given availability info. |
java.util.Map |
getAvailabilityInfo(IDateRange range,
int timeInterval,
java.util.List addresses,
IGroupwareCredentials credential)
Returns the availability information for a list of users. |
private ICalendarItem |
getCalendarItem(java.io.File file)
Loads the Calendar item from the file. |
java.lang.String |
getContent(java.lang.String id,
IGroupwareCredentials credential)
Returns content of the groupware item based on the id specified. |
private java.util.Date |
getDateFromString(java.lang.String pFormattedDate)
Converts string representation of date to date object. |
private java.util.Date |
getDateFromString(java.lang.String formattedDate,
java.lang.String format)
converts datestring of format yy-MM-dd-HH-mm to date object. |
IGroupwareItem |
getItem(java.lang.String id,
IGroupwareCredentials credential)
Returns a groupware item from the transport based on the id specified. |
java.util.List |
getItemList(IDateRange range,
IGroupwareCredentials credential)
Returns all items from the transport for the specified date range |
java.util.List |
getItemList(IDateRange range,
java.util.Properties searchCriteria,
IGroupwareCredentials credentials)
Returns all items from the transport for the specified date range and search criteria. |
java.lang.String |
getServerAlias()
Returns the alias name of the server used by the transport. |
private java.lang.String |
getStringFromDate(java.util.Date date,
java.lang.String format)
Method to create string representation of Date object of given format. |
GroupwareItemType |
getSupportedItemType()
Returns the groupware item type supported by the transport i.e Mail, Calendar, Task etc. |
private int |
getTotalTimeSlots(IDateRange range,
int timeInterval,
java.util.List list)
Constructs the timeslots within given date range & time interval. |
java.lang.String |
getTransportDescription(java.util.Locale locale)
Returns the description of the groupware transport. |
java.lang.String |
getTransportName()
Returns the name of the groupware transport. |
TransportType |
getTransportType()
Returns the transport type of the groupware transport i.e. |
private void |
initFileSystemDetails()
Initializes the Filesystem details like the default appointment and availability directories. |
private void |
initGWObjectsFactory()
Initializes the Groupware Service. |
void |
initialize(IGroupwareManager gwManager,
java.util.List configuration)
Initializes the groupware transport with different congiguration properties. |
private void |
loadItemFromFile(java.lang.String absolutePath,
java.lang.String fileName,
java.util.List result)
Loads the calendar item from file |
private void |
loadItemsFromDirectory(java.lang.String subDirectoryName,
java.util.List result)
Load all the calendar items from a given directory. |
private void |
loadItemsFromFiles(java.lang.String[] files,
java.util.List result,
java.lang.String absolutePath)
Loads the calendar items from a given list of files. |
private void |
readAttachmentsIfAny(java.util.Properties props,
java.io.File file,
ICalendarItem item)
Method to attach attachments for a given calendar item. |
void |
remove(java.lang.String id,
IGroupwareCredentials credentials)
Removes the groupware item based on the id specified. |
private void |
removeAttachmentsIfAny(java.lang.String id)
removes all the attachments with a given calendar item. |
private void |
removeAvailableInfo(java.io.File calendarStoreFile,
java.lang.String id)
Find the users go to their respective folders delete the availability info and save it. |
private void |
removeFromUserAppointment(java.lang.String user,
java.lang.String id)
deletes the appointment entry from the user availability info. |
private void |
removeItem(java.lang.String id)
It deletes file associated with a calendar item from file system & updates the cache & availability information |
java.lang.String |
save(IGroupwareItem item,
IGroupwareCredentials credential)
Saves the groupware item using the credentials specified. |
java.lang.String |
send(IGroupwareItem item,
IGroupwareCredentials credential)
Sends the groupware item to the intended recipient list. |
private java.lang.String |
send(IGroupwareItem item,
IGroupwareCredentials credential,
boolean reflect)
Sends or saves a given calendar item depending on its status(existing/new). |
private void |
swapDatesAfterComparison(java.util.Date pStartDate,
java.util.Date pEndDate)
compares the 2 dates and swaps the dates in case second date is greater than first date. |
void |
terminate()
Terminates the groupware transport. |
private void |
transferContent(IAttachment attachment,
java.io.File attachmentFile)
writes the attachment file with its content. |
private void |
updateAvailableInfo(java.lang.String fileName,
ICalendarItem item,
java.util.Properties properties,
boolean reflect)
Updates the availability info of all the attenedees of the appointment. |
private int |
updateStatus(char actual,
boolean isFree,
FileTransport.AvailData appointmentData)
Compares the current status & new status and updates with current status of higher degree. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private java.lang.String ADDRESS_SEPARATOR
private java.lang.String aliasName
private java.io.File appDirectory
private java.lang.String APPOINTMENTS
private java.lang.String ATTACHMENT
private java.lang.String AVAILABILITY
private java.io.File availDirectory
private java.util.Calendar calendar
private java.util.List configuration
private java.text.SimpleDateFormat formatter
private IGroupwareManager gwManager
private static IGWObjectsFactoryService gwObjFactory
private java.lang.String id
private int idCounter
private java.util.Map idStore
private java.util.Map itemStore
private java.lang.String SEPARATOR
private java.lang.String startLocation
| Constructor Detail |
public FileTransport()
| Method Detail |
private void addAvailabilityInfoForUser(java.lang.String user,
java.util.Properties properties)
throws GroupwareException
user - properties - GroupwareException -
private void addToCache(ICalendarItem item)
throws GroupwareException
item - GroupwareException -
private java.lang.String addToFileSystem(ICalendarItem pItem,
java.util.Properties props,
boolean reflect)
throws GroupwareException
pItem - Calendar Item objectprops - Property Object used to write the Calendar Item Object file.reflect - GroupwareException -
private java.io.File calendarSaveItem(java.lang.String id)
throws GroupwareException
id - Groupware item id.GroupwareException -
private java.io.File calendarStoreItem(java.util.Date date,
java.lang.StringBuffer pSb)
throws GroupwareException
date - Apponintment start date.pSb - Stores the generated appointment file name.GroupwareException - private void cleanDirs(java.io.File dir)
dir - private java.util.Date clearHourTimeSecond(java.util.Date date)
date - Date object.
private void computeAvailabilityInfo(java.util.Hashtable availableAppointments,
java.util.List slots,
java.lang.String user,
java.util.Map map)
availableAppointments - slots - user - map -
private void convertToAvailabilityInfoImpl(java.util.Map map,
IDateRange range,
int interval)
throws GroupwareException
map - private void convertValuesToAvailData(java.util.Hashtable pHt)
ht - Existing appointments.
private void createActualAttachment(java.io.File dir,
IAttachment attachment)
throws GroupwareException
dir - Attachment directory.attachment - Attachment Object.GroupwareException -
private void createAttachments(java.io.File calendarStoreFile,
ICalendarItem item,
java.util.Properties props)
throws GroupwareException
calendarStoreFile - item - props - GroupwareException -
private ICalendarItem createCalendarItem(java.util.Properties props,
java.io.File file)
throws GroupwareException
props - Calendar Item Properties.file - directory in which the Calendar item is stored.
private java.io.File createDirectory(java.lang.String tempLocation)
throws GroupwareException
tempLocation - Location in which the directory needs to be created.GroupwareException -
private void createItem(ICalendarItem item,
boolean reflect)
throws GroupwareException
item - reflect - GroupwareException -
private void fillInAttendees(java.util.Set set,
java.lang.String addresses)
set - contains the list of email addresses.addresses - String containing email addresses seperated by seperator.
private java.lang.String[] findResultantDirNames(java.util.Date startDate,
java.util.Date endDate)
startDate - Start DateendDate - End Date
public IAttachment getAttachmentContent(java.lang.String id,
java.lang.String attachmentId,
IGroupwareCredentials credentials)
throws GroupwareException
IReadTransportgetAttachmentContent in interface IReadTransportcom.sap.ip.collaboration.gw.api.framework.groupware.IReadTransportId - id of the groupware itemattachmentId - id of the attchment idIGroupwareCredentials - groupware credentialsGroupwareException -
private java.io.File getAttachmentDir(java.lang.String id)
throws GroupwareException
id - Calendar item id.GroupwareException -
private IAttachment getAttachmentFromFileSystem(java.io.File attachmentDir,
java.lang.String attachmentId,
java.lang.String attachmentFileName)
throws GroupwareException
attachmentDir - attachmentId - attachmentFileName - GroupwareException -
private IAvailabilityInfo getAvailabilityImpl(java.lang.String data,
IDateRange range,
int interval)
throws GroupwareException
data - Avaialability info.range - Date range.interval - Time Interval.GroupwareException -
public java.util.Map getAvailabilityInfo(IDateRange range,
int timeInterval,
java.util.List addresses,
IGroupwareCredentials credential)
throws GroupwareException
ICalendarReadTransportgetAvailabilityInfo in interface ICalendarReadTransportcom.sap.ip.collaboration.gw.api.framework.groupware.ICalendarReadTransportDateRange - range date rangeint - timeIntervalList - addresses list of e-mailId of usersIGroupwareCredentials - groupware credentialsGroupwareException - private ICalendarItem getCalendarItem(java.io.File file)
file - object representing the calendar item.
public java.lang.String getContent(java.lang.String id,
IGroupwareCredentials credential)
throws GroupwareException
IReadTransportgetContent in interface IReadTransportcom.sap.ip.collaboration.gw.api.framework.groupware.IReadTransportId - id of the groupware itemIGroupwareCredentials - groupware credentialsGroupwareException - private java.util.Date getDateFromString(java.lang.String pFormattedDate)
string - Input Date object in the form of string.
private java.util.Date getDateFromString(java.lang.String formattedDate,
java.lang.String format)
formattedDate - datestring.format - date format yy-MM-dd-HH-mm
public IGroupwareItem getItem(java.lang.String id,
IGroupwareCredentials credential)
throws GroupwareException
IReadTransportgetItem in interface IReadTransportcom.sap.ip.collaboration.gw.api.framework.groupware.IReadTransportId - id of the groupware itemIGroupwareCredentials - groupware credentialsGroupwareException -
public java.util.List getItemList(IDateRange range,
IGroupwareCredentials credential)
throws GroupwareException
IReadTransportgetItemList in interface IReadTransportcom.sap.ip.collaboration.gw.api.framework.groupware.IReadTransportDateRange - date range for which the groupware items are fetchedIGroupwareCredentials - groupware credentialsGroupwareException -
public java.util.List getItemList(IDateRange range,
java.util.Properties searchCriteria,
IGroupwareCredentials credentials)
throws GroupwareException
IReadTransportgetItemList in interface IReadTransportcom.sap.ip.collaboration.gw.api.framework.groupware.IReadTransportDateRange - date range for which the groupware items are fetchedIGroupwareCredentials - groupware credentialsGroupwareException - public java.lang.String getServerAlias()
ITransportgetServerAlias in interface ITransportcom.sap.ip.collaboration.gw.api.framework.groupware.ITransport
private java.lang.String getStringFromDate(java.util.Date date,
java.lang.String format)
startDate - Date object.format - Dateformat representation.public GroupwareItemType getSupportedItemType()
ITransportgetSupportedItemType in interface ITransportcom.sap.ip.collaboration.gw.api.framework.groupware.ITransport
private int getTotalTimeSlots(IDateRange range,
int timeInterval,
java.util.List list)
range - Date rangetimeInterval - Time interval.list - stores the time slots.public java.lang.String getTransportDescription(java.util.Locale locale)
ITransportgetTransportDescription in interface ITransportcom.sap.ip.collaboration.gw.api.framework.groupware.ITransportlocale - public java.lang.String getTransportName()
ITransportgetTransportName in interface ITransportcom.sap.ip.collaboration.gw.api.framework.groupware.ITransportpublic TransportType getTransportType()
ITransportgetTransportType in interface ITransportcom.sap.ip.collaboration.gw.api.framework.groupware.ITransport
private void initFileSystemDetails()
throws GroupwareException
GroupwareException -
private void initGWObjectsFactory()
throws com.sapportals.wcm.repository.ResourceException,
com.sapportals.wcm.repository.ResourceException
ResourceException - com.sapportals.wcm.repository.ResourceException -
public void initialize(IGroupwareManager gwManager,
java.util.List configuration)
throws GroupwareException
ITransportinitialize in interface ITransportcom.sap.ip.collaboration.gw.api.framework.groupware.ITransportGroupwareManager - groupware manager class intializing the transportlist - list of configuration propertiesGroupwareException -
private void loadItemFromFile(java.lang.String absolutePath,
java.lang.String fileName,
java.util.List result)
absolutePath - fileName - result -
private void loadItemsFromDirectory(java.lang.String subDirectoryName,
java.util.List result)
subDirectoryName - directory name from which the items to be loaded.result - List of items loaded from a given directory.
private void loadItemsFromFiles(java.lang.String[] files,
java.util.List result,
java.lang.String absolutePath)
files - result - absolutePath -
private void readAttachmentsIfAny(java.util.Properties props,
java.io.File file,
ICalendarItem item)
throws GroupwareException
props - file - directory where the attachements are for a given calendar item present.item - groupware item like mail or appointment.GroupwareException - if the attachment associated with groupware item is missing from.
public void remove(java.lang.String id,
IGroupwareCredentials credentials)
throws GroupwareException
ISendTransportremove in interface ISendTransportcom.sap.ip.collaboration.gw.api.framework.groupware.ISendTransportString - idIGroupwareCredentials - groupware credentialsGroupwareException -
private void removeAttachmentsIfAny(java.lang.String id)
throws GroupwareException
id - GroupwareException -
private void removeAvailableInfo(java.io.File calendarStoreFile,
java.lang.String id)
throws GroupwareException
calendarStoreFile - id -
private void removeFromUserAppointment(java.lang.String user,
java.lang.String id)
throws GroupwareException
user - id -
private void removeItem(java.lang.String id)
throws GroupwareException
id - Calendar item Identifier.GroupwareException -
public java.lang.String save(IGroupwareItem item,
IGroupwareCredentials credential)
throws GroupwareException
ISendTransportsave in interface ISendTransportcom.sap.ip.collaboration.gw.api.framework.groupware.ISendTransportitem - groupware itemcredentials - groupware credentialsGroupwareException -
public java.lang.String send(IGroupwareItem item,
IGroupwareCredentials credential)
throws GroupwareException
ISendTransportsend in interface ISendTransportcom.sap.ip.collaboration.gw.api.framework.groupware.ISendTransportitem - groupware itemcredentials - groupware credentialsGroupwareException -
private java.lang.String send(IGroupwareItem item,
IGroupwareCredentials credential,
boolean reflect)
throws GroupwareException
item - Calendar Item Object.credential - User Credential Object.reflect - boolean indication for send or save operation.GroupwareException -
private void swapDatesAfterComparison(java.util.Date pStartDate,
java.util.Date pEndDate)
pStartDate - first datepEndDate - second date
public void terminate()
throws GroupwareException
ITransportterminate in interface ITransportcom.sap.ip.collaboration.gw.api.framework.groupware.ITransportGroupwareException -
private void transferContent(IAttachment attachment,
java.io.File attachmentFile)
throws GroupwareException
attachment - attachmentFile -
private void updateAvailableInfo(java.lang.String fileName,
ICalendarItem item,
java.util.Properties properties,
boolean reflect)
throws GroupwareException
fileName - item - properties - reflect - GroupwareException -
private int updateStatus(char actual,
boolean isFree,
FileTransport.AvailData appointmentData)
c - new statusisFree - Current Free/Busy status .appointmentData -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||