submarine.connectors
Class FileSystemConnector

java.lang.Object
  |
  +--submarine.connectors.FileSystemConnector
All Implemented Interfaces:
PoolingFunction, PoolingFunctionWithContext, WritingFunction, XMLConfigurable

public class FileSystemConnector
extends java.lang.Object
implements WritingFunction, PoolingFunctionWithContext


Field Summary
private  int currentFile
           
private  java.lang.String encoding
           
private  java.io.File[] fileList
           
 java.lang.String fileName
           
private  org.w3c.dom.Element fileNameElem
           
 java.lang.String filePath
           
 java.lang.String fileTemp
           
 long frequency
           
private  int mode
           
private  java.lang.String objectType
           
private  java.io.File path
           
 RouteInfos route
           
private  java.io.File tempPath
           
 
Constructor Summary
FileSystemConnector()
           
 
Method Summary
 long getFrequency()
          Fournit La durée pendant laquelle l'EAIsystem doit attendre avant de renouveller les appels.
 java.lang.Object getNextDocument()
          Retourne le document suivant de la liste initialisé lors de l'appel à hasNewDocument().
L'implémentation de cette méthode ne doit pas être bloquante.
 java.lang.Object getNextDocument(Message.MsgContext context)
          Return the next object file.
 RouteInfos getRouteInfos()
          Fournit les informations de routage pour le dernier document lu par getNextDocument.
 boolean hasNewDocument()
          La PoolingFunction a-elle de nouveaux documents à soumettre au Systeme EAI ?
 void init(org.w3c.dom.Element xml)
           
 void notifyResponse(java.lang.Object doc, java.lang.Object response, boolean ok)
          appelé a la fin si la soumission est synchrone et juste après la soumission si c'est asyncrhone
 boolean putDocument(Message.MsgContext context, java.lang.Object doc)
           
 java.lang.Object putSyncDocument(Message.MsgContext context, java.lang.Object doc)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

mode

private int mode

fileName

public java.lang.String fileName

fileNameElem

private org.w3c.dom.Element fileNameElem

filePath

public java.lang.String filePath

fileTemp

public java.lang.String fileTemp

frequency

public long frequency

route

public RouteInfos route

path

private java.io.File path

tempPath

private java.io.File tempPath

encoding

private java.lang.String encoding

objectType

private java.lang.String objectType

fileList

private java.io.File[] fileList

currentFile

private int currentFile
Constructor Detail

FileSystemConnector

public FileSystemConnector()
Method Detail

putSyncDocument

public java.lang.Object putSyncDocument(Message.MsgContext context,
                                        java.lang.Object doc)
                                 throws java.lang.Exception
Specified by:
putSyncDocument in interface WritingFunction
Following copied from interface: submarine.core.WritingFunction
Parameters:
doc -  
context -  
Returns:
java.lang.Object
Throws:
java.lang.Exception -  

putDocument

public boolean putDocument(Message.MsgContext context,
                           java.lang.Object doc)
                    throws java.lang.Exception
Specified by:
putDocument in interface WritingFunction
Following copied from interface: submarine.core.WritingFunction
Parameters:
doc -  
context -  
Returns:
boolean
Throws:
java.lang.Exception -  

init

public void init(org.w3c.dom.Element xml)
Specified by:
init in interface XMLConfigurable
Following copied from interface: submarine.core.XMLConfigurable
Parameters:
xml -  
Throws:
java.lang.Exception -  

hasNewDocument

public boolean hasNewDocument()
Description copied from interface: PoolingFunction
La PoolingFunction a-elle de nouveaux documents à soumettre au Systeme EAI ?
Appelée après chaque réveil de la PoolingFunction, l'implémentation de cette méthode doit permettre de vérifier auprès du tiers si des documents sont disponibles.
Specified by:
hasNewDocument in interface PoolingFunction
Following copied from interface: submarine.core.PoolingFunction
Returns:
boolean Retourne Vrai si et seulement si au moins un appel à getNextDocument() ne retournera pas null.

getNextDocument

public java.lang.Object getNextDocument(Message.MsgContext context)
                                 throws java.lang.Exception
Return the next object file. Set also three context attributes: fileNameThe simple name of the file, without the parent pathfilePathThe relative path of the fileabsoluteFilePathThe absolute path of the file
Specified by:
getNextDocument in interface PoolingFunctionWithContext

getNextDocument

public java.lang.Object getNextDocument()
                                 throws java.lang.Exception
Description copied from interface: PoolingFunction
Retourne le document suivant de la liste initialisé lors de l'appel à hasNewDocument().
L'implémentation de cette méthode ne doit pas être bloquante.
Specified by:
getNextDocument in interface PoolingFunction
Following copied from interface: submarine.core.PoolingFunction
Returns:
java.lang.Object Retourne le nouvel objet java représentant le message. Retourne null si le dernier message a déjà été lu.
Throws:
java.lang.Exception - Si une exception est levée lors de l'exécution de cette méthode, le processus d'interrogation s'interrompt.

notifyResponse

public void notifyResponse(java.lang.Object doc,
                           java.lang.Object response,
                           boolean ok)
appelé a la fin si la soumission est synchrone et juste après la soumission si c'est asyncrhone
Specified by:
notifyResponse in interface PoolingFunction
Following copied from interface: submarine.core.PoolingFunction
Parameters:
doc - L'objet Java ayant été retourné par le précedent appel à getNextDocument.
response - La réponse de la soumission du message au Systeme EAI. Voir EAISystem.submit(java.lang.Object, submarine.core.RouteInfos, submarine.core.Message.MsgContext).
ok - Vrai si la soumission s'est passée sans erreur, et faut si une exception s'est produite. Si la soumission était asynchrone, ok n'indique pas si le traitement du message s'est bien passé mais seulement qu'il a bien été inséré dans la file d'attente.

getFrequency

public long getFrequency()
Description copied from interface: PoolingFunction
Fournit La durée pendant laquelle l'EAIsystem doit attendre avant de renouveller les appels.
Cette fréquence peut être fixe ou bien variable selon le besoin du connecteur.
Specified by:
getFrequency in interface PoolingFunction
Following copied from interface: submarine.core.PoolingFunction
Returns:
long La durée pendant laquelle l'EAISystem va attendre en millisecondes.

getRouteInfos

public RouteInfos getRouteInfos()
Description copied from interface: PoolingFunction
Fournit les informations de routage pour le dernier document lu par getNextDocument.
Ces informations peuvent être systématiquement identique, dans ce cas, la même instance de RouteInfos peut être utilisée. Si ces informations dépendent du message (routage en fonction du contenu), une instance spécifique devra être fournie.
Specified by:
getRouteInfos in interface PoolingFunction
Following copied from interface: submarine.core.PoolingFunction
Returns:
submarine.core.RouteInfos Les informations de routage.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Submarine project. free distribution of this software must include the opensource licence.
Guénolé de Cadoudal.