Class MoverServer
- All Implemented Interfaces:
ClientInterface
,RemoteServer
,MBeanListener
,MBeanService
,ToBeStarted
,MoverInterface
,Serializable
,Remote
The Class MoverServer.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal class
The Class DownloadRepository.static final class
The Class ECproxyCallback.final class
The Class FileDescriptor. -
Field Summary
Fields inherited from class java.rmi.server.RemoteObject
ref
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
check
(long ticket) Check.boolean
close
(DataTransfer transfer) Close.void
Close all incoming connections.boolean
Close incoming connection.boolean
Del.void
del
(DataTransfer transfer, String fileName) Del.boolean
Del.void
Del.Download.Execute.Filter.Gets the.Gets the.Gets the.get
(OutputStream out, Host host, String source, long remotePosn, DataFile dataFile) Allow providing an output stream to retrieve a file.getAttribute
(String attributeName) Gets the attribute.Gets the data file access interface.Gets the download repository.getECauthToken
(String user) Gets the ecauth token.Gets the ECproxy plugging listen address and port.getGenericFile
(String path) Gets the generic file.getHostReport
(Host proxyHost, Host host) Gets the host report.String[]
Gets the incoming connection ids.Gets the incoming connections.Gets the master interface.If the data mover is connected directly to its MasterServer then return a RMI interface to the Master, if the data mover is connected through a delegate data mover then return a REST interface, otherwise through an exception.Gets the MBean info.getMoverReport
(Host proxyHost) Gets the mover report.int
Get the number of client connected to the MQTT broker.Gets the MQTT interface.Gets the password.Gets the report.Gets the report.static String
Gets the repository.getRESTInterface
(String httpProxy, String httpMover, int connectTimeout) Gets the REST interface.getRoot()
Gets the root.Gets the service.Gets the ticket repository.Gets the version.Invoke.listAsByteArray
(Host host, String directory, String pattern, boolean synchronous) List2.String[]
listAsStringArray
(Host host, String directory, String pattern) List.void
Mkdir.void
Move.void
publishToMQTTBroker
(String topic, int qos, long expiryInterval, String contentType, String clientId, String payload, boolean retain) Publish a notification to the MQTT service.void
purge()
Request from the JMX interface.void
purge
(Host proxyHost, List<ExistingStorageDirectory> directories) Purge.void
purge
(List<ExistingStorageDirectory> directories) Purge.put
(Host[] hostsForSource, DataTransfer transfer, String targetName, long localPosn, long remotePosn) Puts the.Puts the.void
removeFromMQTTBroker
(String topic) Remove a retained notification from the MQTT broker.Replicate.void
Is called whenever the DataMover lost the connection with its MasterServer.void
Rmdir.boolean
setAttribute
(String name, Object value) Sets the attribute.void
setMQTTInterface
(MQTTInterface mqttInterface) Sets the MQTT interface.void
setRESTProvider
(RESTProvider restProvider) Sets the REST provider.void
shutdown()
Shutdown.long
size
(DataTransfer transfer, String fileName) Size.long
Size.Methods inherited from class ecmwf.common.ecaccess.StarterServer
exit, getGraceful, getInstance, getInstance, getMBeanCenter, getPluginContainer, getPluginInfos, getRemoteCnf, getRestart, getStartDate, handle, handle, handleNotification, shutdown
Methods inherited from class ecmwf.common.callback.CallBackObject
createOrGetRegistry, getPort
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObject
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ecmwf.ecpds.mover.MoverInterface
shutdown
-
Constructor Details
-
MoverServer
public MoverServer(Starter starter) throws IOException, InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, MalformedObjectNameException, InstanceNotFoundException, ConnectionException Instantiates a new mover server.- Parameters:
starter
- the starter- Throws:
IOException
- Signals that an I/O exception has occurred.InstanceAlreadyExistsException
- the instance already exists exceptionMBeanRegistrationException
- the MBean registration exceptionNotCompliantMBeanException
- the not compliant m bean exceptionMalformedObjectNameException
- the malformed object name exceptionInstanceNotFoundException
- the instance not found exceptionConnectionException
- the connection exception
-
-
Method Details
-
resetDataMover
public void resetDataMover()Is called whenever the DataMover lost the connection with its MasterServer. This method can be called from the MasterManager if it is connected through RMI or from the TransferRepository if it is connected through the REST interface. -
setRESTProvider
Sets the REST provider.- Parameters:
restProvider
- the new REST provider
-
getRESTInterface
public RESTInterface getRESTInterface(String httpProxy, String httpMover, int connectTimeout) throws MoverException Gets the REST interface.- Parameters:
httpProxy
- the http proxyhttpMover
- the http moverconnectTimeout
- the connect timeout- Returns:
- the REST interface
- Throws:
MoverException
- the mover exception
-
setMQTTInterface
Sets the MQTT interface.- Parameters:
mqttInterface
- the new MQTT interface
-
getMQTTInterface
Gets the MQTT interface.- Returns:
- the MQTT interface
- Throws:
MoverException
- the mover exception
-
getGenericFile
Gets the generic file.- Parameters:
path
- the path- Returns:
- the generic file
-
getDataFileAccessInterface
Gets the data file access interface.- Returns:
- the data file access interface
- Throws:
MasterException
- the master exception
-
getECproxyAddressAndPort
Gets the ECproxy plugging listen address and port. This is used by the Master Server to update the "TransferServer" entry in the database when the Mover subscribe. This address and port are used when the Master Server send the address of the allocated Mover to the ecpds command. Gets the ECproxy plugging listen address and port. This is used by the Master Server to update the "TransferServer" entry in the database when the Mover subscribe. This address and port are used when the Master Server send the address of the allocated Mover to the ecpds command.- Specified by:
getECproxyAddressAndPort
in interfaceMoverInterface
- Returns:
- the ECproxyPlugin address and port
-
getIncomingConnectionIds
Gets the incoming connection ids. Gets the incoming connection ids.- Specified by:
getIncomingConnectionIds
in interfaceMoverInterface
- Returns:
- the incoming connection ids
-
getIncomingConnections
Gets the incoming connections. Gets the incoming connections.- Specified by:
getIncomingConnections
in interfaceMoverInterface
- Returns:
- the incoming connections
-
closeIncomingConnection
Close incoming connection. Close incoming connection.- Specified by:
closeIncomingConnection
in interfaceMoverInterface
- Parameters:
id
- the id- Returns:
- true, if successful
-
closeAllIncomingConnections
public void closeAllIncomingConnections()Close all incoming connections. Close all incoming connections.- Specified by:
closeAllIncomingConnections
in interfaceMoverInterface
-
publishToMQTTBroker
public void publishToMQTTBroker(String topic, int qos, long expiryInterval, String contentType, String clientId, String payload, boolean retain) Publish a notification to the MQTT service. Publish a notification to the registered MQTT service (if any).- Specified by:
publishToMQTTBroker
in interfaceMoverInterface
- Parameters:
topic
- the topicqos
- the qosexpiryInterval
- the expiry intervalcontentType
- the content typeclientId
- the client idpayload
- the payloadretain
- the retain
-
removeFromMQTTBroker
Remove a retained notification from the MQTT broker. Remove a retained notification from the MQTT broker.- Specified by:
removeFromMQTTBroker
in interfaceMoverInterface
- Parameters:
topic
- the topic
-
getMQTTClientsCount
public int getMQTTClientsCount()Get the number of client connected to the MQTT broker. Get the number of client connected to the MQTT broker.- Specified by:
getMQTTClientsCount
in interfaceMoverInterface
- Returns:
- the MQTT clients count
-
getRepository
-
getRoot
Gets the root. Gets the root.- Specified by:
getRoot
in interfaceClientInterface
- Returns:
- the root
-
getService
Gets the service. Gets the service.- Specified by:
getService
in interfaceClientInterface
- Returns:
- the service
-
getPassword
Gets the password. Gets the password.- Specified by:
getPassword
in interfaceClientInterface
- Returns:
- the password
-
getVersion
Gets the version. Gets the version.- Specified by:
getVersion
in classStarterServer
- Returns:
- the version
-
getMBeanInfo
Gets the MBean info. Gets the MBean info. Gets the MBean info.- Specified by:
getMBeanInfo
in interfaceMBeanService
- Overrides:
getMBeanInfo
in classStarterServer
- Returns:
- the MBean info
-
setAttribute
public boolean setAttribute(String name, Object value) throws InvalidAttributeValueException, MBeanException Sets the attribute. Sets the attribute. Sets the attribute.- Specified by:
setAttribute
in interfaceMBeanService
- Overrides:
setAttribute
in classStarterServer
- Parameters:
name
- the namevalue
- the value- Returns:
- true, if successful
- Throws:
InvalidAttributeValueException
- the invalid attribute value exceptionMBeanException
- the MBean exception
-
getAttribute
Gets the attribute. Gets the attribute. Gets the attribute.- Specified by:
getAttribute
in interfaceMBeanService
- Overrides:
getAttribute
in classStarterServer
- Parameters:
attributeName
- the attribute name- Returns:
- the attribute
- Throws:
AttributeNotFoundException
- the attribute not found exceptionMBeanException
- the MBean exception
-
invoke
public Object invoke(String operationName, Object[] params, String[] signature) throws NoSuchMethodException, MBeanException Invoke. Invoke. Invoke.- Specified by:
invoke
in interfaceMBeanService
- Overrides:
invoke
in classStarterServer
- Parameters:
operationName
- the operation nameparams
- the paramssignature
- the signature- Returns:
- the object
- Throws:
NoSuchMethodException
- the no such method exceptionMBeanException
- the MBean exception
-
check
Check. Check.- Specified by:
check
in interfaceMoverInterface
- Parameters:
ticket
- the ticket- Throws:
IOException
- Signals that an I/O exception has occurred.
-
size
Size. Size.- Specified by:
size
in interfaceMoverInterface
- Parameters:
transfer
- the transferfileName
- the file name- Returns:
- the long
- Throws:
ECtransException
- the ectrans exceptionIOException
- Signals that an I/O exception has occurred.
-
del
Del. Del.- Specified by:
del
in interfaceMoverInterface
- Parameters:
transfer
- the transferfileName
- the file name- Throws:
ECtransException
- the ectrans exceptionIOException
- Signals that an I/O exception has occurred.
-
filter
Filter. Filter.- Specified by:
filter
in interfaceMoverInterface
- Parameters:
dataFile
- the data fileremove
- the remove- Returns:
- the data file
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
replicate
public DataFile replicate(DataFile dataFile, Host targetHost, Host[] hostsForSource) throws ECtransException, SourceNotAvailableException, IOException Replicate. Replicate.- Specified by:
replicate
in interfaceMoverInterface
- Parameters:
dataFile
- the data filetargetHost
- the target hosthostsForSource
- the hosts for source- Returns:
- the data file
- Throws:
ECtransException
- the ectrans exceptionSourceNotAvailableException
- the source not available exceptionIOException
- Signals that an I/O exception has occurred.
-
getMoverReport
Gets the mover report. Gets the mover report.- Specified by:
getMoverReport
in interfaceMoverInterface
- Parameters:
proxyHost
- the proxy host- Returns:
- the mover report
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getHostReport
Gets the host report. Gets the host report.- Specified by:
getHostReport
in interfaceMoverInterface
- Parameters:
proxyHost
- the proxy hosthost
- the host- Returns:
- the host report
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getReport
Gets the report. Gets the report.- Specified by:
getReport
in interfaceMoverInterface
- Returns:
- the report
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getReport
Gets the report. Gets the report.- Specified by:
getReport
in interfaceMoverInterface
- Parameters:
host
- the host- Returns:
- the report
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
download
public DataFile download(DataFile dataFile, Host hostForSource) throws SourceNotAvailableException, IOException Download. Download.- Specified by:
download
in interfaceMoverInterface
- Parameters:
dataFile
- the data filehostForSource
- the host for source- Returns:
- the data file
- Throws:
SourceNotAvailableException
- the source not available exceptionIOException
- Signals that an I/O exception has occurred.
-
purge
public void purge(Host proxyHost, List<ExistingStorageDirectory> directories) throws RemoteException Purge. Purge.- Specified by:
purge
in interfaceMoverInterface
- Parameters:
proxyHost
- the proxy hostdirectories
- the directories- Throws:
RemoteException
- the remote exception
-
purge
Purge. Purge.- Specified by:
purge
in interfaceMoverInterface
- Parameters:
directories
- the directories- Throws:
RemoteException
- the remote exception
-
purge
public void purge()Request from the JMX interface. -
del
Del. Del.- Specified by:
del
in interfaceMoverInterface
- Parameters:
proxyHost
- the proxy hostdataFile
- the data file- Returns:
- true, if successful
- Throws:
ECtransException
- the ectrans exceptionIOException
- Signals that an I/O exception has occurred.
-
del
Del. Del.- Specified by:
del
in interfaceMoverInterface
- Parameters:
dataFile
- the data file- Returns:
- true, if successful
- Throws:
ECtransException
- the ectrans exceptionIOException
- Signals that an I/O exception has occurred.
-
put
public DataTransfer put(Host[] hostsForSource, DataTransfer transfer, String targetName, long localPosn, long remotePosn) throws ECtransException, SourceNotAvailableException, IOException Puts the. Puts the.- Specified by:
put
in interfaceMoverInterface
- Parameters:
hostsForSource
- the hosts for sourcetransfer
- the transfertargetName
- the file namelocalPosn
- the local posnremotePosn
- the remote posn- Returns:
- the data transfer
- Throws:
ECtransException
- the ectrans exceptionSourceNotAvailableException
- the source not available exceptionIOException
- Signals that an I/O exception has occurred.
-
put
public ProxySocket put(Host host, String target, long remotePosn, long size) throws ECtransException, IOException Puts the. Allow getting a ProxySocket to upload a file on a target host. This method should be used only when the file is to be uploaded from a different data mover than the current one.- Specified by:
put
in interfaceMoverInterface
- Parameters:
host
- the hosttarget
- the targetremotePosn
- the remote posnsize
- the size- Returns:
- the proxy socket
- Throws:
ECtransException
- the ectrans exceptionIOException
- Signals that an I/O exception has occurred.
-
get
public ProxySocket get(Host host, String source, long remotePosn, boolean removeOriginal) throws ECtransException, IOException Gets the. Allow getting a ProxySocket to retrieve a file on a target host. This method should be used only when the file is to be retrieved from a different data mover than the current one.- Specified by:
get
in interfaceMoverInterface
- Parameters:
host
- the hostsource
- the sourceremotePosn
- the remote posnremoveOriginal
- the remove original- Returns:
- the proxy socket
- Throws:
ECtransException
- the ectrans exceptionIOException
- Signals that an I/O exception has occurred.
-
get
public MoverServer.ECproxyCallback get(OutputStream out, Host host, String source, long remotePosn, DataFile dataFile) throws ECtransException Allow providing an output stream to retrieve a file. This method should only be used when it is called from the current data mover. The retrieval is done asynchronously. If the retrieval fail then the provided Output Stream is closed.- Parameters:
out
- the output streamhost
- the hostsource
- the sourceremotePosn
- the remote posndataFile
- the data file- Returns:
- the ecproxy callback for checking the outcome of the transmission
- Throws:
ECtransException
- the ectrans exception
-
get
public ProxySocket get(DataFile dataFile, Host hostForSource, long remotePosn) throws SourceNotAvailableException, IOException Gets the. Gets the.- Specified by:
get
in interfaceMoverInterface
- Parameters:
dataFile
- the data filehostForSource
- the host for sourceremotePosn
- the remote posn- Returns:
- the proxy socket
- Throws:
SourceNotAvailableException
- the source not available exceptionIOException
- Signals that an I/O exception has occurred.
-
get
public ProxySocket get(DataFile dataFile, Host[] hostsForSource, long remotePosn, long length) throws SourceNotAvailableException, IOException Gets the. Gets the.- Specified by:
get
in interfaceMoverInterface
- Parameters:
dataFile
- the data filehostsForSource
- the host for sourceremotePosn
- the remote posnlength
- the length- Returns:
- the proxy socket
- Throws:
SourceNotAvailableException
- the source not available exceptionIOException
- Signals that an I/O exception has occurred.
-
size
Size. Size.- Specified by:
size
in interfaceMoverInterface
- Parameters:
host
- the hostsource
- the source- Returns:
- the long
- Throws:
ECtransException
- the ectrans exceptionIOException
- Signals that an I/O exception has occurred.
-
listAsStringArray
public String[] listAsStringArray(Host host, String directory, String pattern) throws ECtransException, IOException List. List as string array.- Specified by:
listAsStringArray
in interfaceMoverInterface
- Parameters:
host
- the hostdirectory
- the sourcepattern
- the pattern- Returns:
- the string[]
- Throws:
ECtransException
- the ectrans exceptionIOException
- Signals that an I/O exception has occurred.
-
listAsByteArray
public RemoteInputStream listAsByteArray(Host host, String directory, String pattern, boolean synchronous) throws ECtransException, IOException List2. List as byte array.- Specified by:
listAsByteArray
in interfaceMoverInterface
- Parameters:
host
- the hostdirectory
- the directorypattern
- the patternsynchronous
- the synchronous- Returns:
- the remote input stream
- Throws:
ECtransException
- the ectrans exceptionIOException
- Signals that an I/O exception has occurred.
-
execute
Execute. Execute.- Specified by:
execute
in interfaceMoverInterface
- Parameters:
script
- the script- Returns:
- the remote input stream
- Throws:
ScriptException
- the script exceptionIOException
- Signals that an I/O exception has occurred.
-
del
Del. Del.- Specified by:
del
in interfaceMoverInterface
- Parameters:
host
- the hostsource
- the source- Throws:
ECtransException
- the ectrans exceptionIOException
- Signals that an I/O exception has occurred.
-
mkdir
Mkdir. Mkdir.- Specified by:
mkdir
in interfaceMoverInterface
- Parameters:
host
- the hostdir
- the dir- Throws:
ECtransException
- the ectrans exceptionIOException
- Signals that an I/O exception has occurred.
-
rmdir
Rmdir. Rmdir.- Specified by:
rmdir
in interfaceMoverInterface
- Parameters:
host
- the hostdir
- the dir- Throws:
ECtransException
- the ectrans exceptionIOException
- Signals that an I/O exception has occurred.
-
move
Move. Move.- Specified by:
move
in interfaceMoverInterface
- Parameters:
host
- the hostsource
- the sourcetarget
- the target- Throws:
ECtransException
- the ectrans exceptionIOException
- Signals that an I/O exception has occurred.
-
close
Close. Close.- Specified by:
close
in interfaceMoverInterface
- Parameters:
transfer
- the transfer- Returns:
- true, if successful
- Throws:
ECtransException
- the ectrans exceptionIOException
- Signals that an I/O exception has occurred.
-
getMasterProxy
If the data mover is connected directly to its MasterServer then return a RMI interface to the Master, if the data mover is connected through a delegate data mover then return a REST interface, otherwise through an exception.- Returns:
- the master proxy
- Throws:
MoverException
- the mover exception
-
getMasterInterface
Gets the master interface.- Returns:
- the master interface
- Throws:
ConnectionException
- the connection exception
-
getECauthToken
Gets the ecauth token.- Parameters:
user
- the user- Returns:
- the ecauth token
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
getTicketRepository
Gets the ticket repository.- Returns:
- the ticket repository
-
getDownloadRepository
Gets the download repository.- Returns:
- the download repository
-
shutdown
public void shutdown()Shutdown. Shutdown. Shutdown.- Specified by:
shutdown
in interfaceToBeStarted
- Overrides:
shutdown
in classStarterServer
-