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 classThe Class DownloadRepository.final classThe Class ECproxyCallback.final classThe Class FileDescriptor. -
Field Summary
Fields inherited from class RemoteObject
ref -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheck(long ticket) Check.booleanclose(DataTransfer transfer) Close.voidClose all incoming connections.booleancloseDataTransfer(DataTransfer transfer) Close.booleanClose incoming connection.long[][]computeVolumeUsage(int volumeIndexMax) Compute the used and total capacity for each volume in the data repository.booleanDel.voiddel(DataTransfer transfer, String fileName) Del.booleanDel.voidDel.Download.Execute.Filter.Gets the.Gets the.Allow getting a ProxySocket to retrieve a file on a target host.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.intGet the number of client connected to the MQTT broker.Gets the MQTT interface.Gets the password.Gets the report.Gets the report.static StringGets 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) List as byte array.String[]listAsStringArray(Host host, String directory, String pattern) List as string array.voidMkdir.voidMove.voidpublishToMQTTBroker(String topic, int qos, long expiryInterval, String contentType, String clientId, String payload, boolean retain) Publish a notification to the registered MQTT service (if any).voidpurge()Request from the JMX interface.voidpurge(Host proxyHost, List<ExistingStorageDirectory> directories) Purge.voidpurge(List<ExistingStorageDirectory> directories) Purge.put(Host[] hostsForSource, DataTransfer transfer, String targetName, long localPosn, long remotePosn) Puts the.Allow getting a ProxySocket to upload a file on a target host.voidremoveFromMQTTBroker(String topic) Remove a retained notification from the MQTT broker.Replicate.voidIs called whenever the DataMover lost the connection with its MasterServer.voidRmdir.booleansetAttribute(String name, Object value) Sets the attribute.voidsetMQTTInterface(MQTTInterface mqttInterface) Sets the MQTT interface.voidsetRESTProvider(RESTProvider restProvider) Sets the REST provider.voidshutdown()Shutdown.longsize(DataTransfer transfer, String fileName) Size.longSize.Methods inherited from class StarterServer
exit, getGraceful, getInstance, getInstance, getMBeanCenter, getPluginContainer, getPluginInfos, getRemoteCnf, getRestart, getStartDate, handle, handle, handleNotification, shutdownMethods inherited from class CallBackObject
createOrGetRegistry, getPort, unexportMethods inherited from class UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, exportObject, unexportObjectMethods inherited from class RemoteServer
getClientHost, getLog, setLogMethods inherited from interface 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
-
computeVolumeUsage
Compute the used and total capacity for each volume in the data repository.Returns two parallel arrays of length
volumeIndexMax + 1:result[0][i]— bytes used in volumeiresult[1][i]— total bytes available for volumei
Dedicated-disk volumes (the volume directory resides on a filesystem shared with no other volume): raw
statvfsstats are used — O(1) per volume.Shared-disk volumes (two or more volume directories reside on the same physical filesystem, e.g. a single-machine test setup or a small production environment where all volumes live on one disk): a virtual per-volume quota is applied to give the load balancer meaningful differentiation:
- virtual total per volume =
diskTotal / numberOfVolumesOnThisDisk - virtual used per volume = recursive byte sum of the volume directory (
listSize())
- Specified by:
computeVolumeUsagein interfaceMoverInterface- Parameters:
volumeIndexMax- highest volume index to include (inclusive); volumes 0..volumeIndexMax are reported- Returns:
- a 2-element array:
[usedPerVolume[], maxCapacityPerVolume[]]each of lengthvolumeIndexMax + 1 - Throws:
RemoteException- the remote exception
-
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.- Specified by:
getECproxyAddressAndPortin interfaceMoverInterface- Returns:
- the ECproxyPlugin address and port
-
getIncomingConnectionIds
Gets the incoming connection ids.- Specified by:
getIncomingConnectionIdsin interfaceMoverInterface- Returns:
- the incoming connection ids
-
getIncomingConnections
Gets the incoming connections.- Specified by:
getIncomingConnectionsin interfaceMoverInterface- Returns:
- the incoming connections
-
closeIncomingConnection
Close incoming connection.- Specified by:
closeIncomingConnectionin interfaceMoverInterface- Parameters:
id- the id- Returns:
- true, if successful
-
closeAllIncomingConnections
public void closeAllIncomingConnections()Close all incoming connections.- Specified by:
closeAllIncomingConnectionsin interfaceMoverInterface
-
publishToMQTTBroker
public void publishToMQTTBroker(String topic, int qos, long expiryInterval, String contentType, String clientId, String payload, boolean retain) Publish a notification to the registered MQTT service (if any).- Specified by:
publishToMQTTBrokerin 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.- Specified by:
removeFromMQTTBrokerin interfaceMoverInterface- Parameters:
topic- the topic
-
getMQTTClientsCount
public int getMQTTClientsCount()Get the number of client connected to the MQTT broker.- Specified by:
getMQTTClientsCountin interfaceMoverInterface- Returns:
- the MQTT clients count
-
getRepository
-
getRoot
Gets the root.- Specified by:
getRootin interfaceClientInterface- Returns:
- the root
-
getService
Gets the service.- Specified by:
getServicein interfaceClientInterface- Returns:
- the service
-
getPassword
Gets the password.- Specified by:
getPasswordin interfaceClientInterface- Returns:
- the password
-
getVersion
Gets the version.- Specified by:
getVersionin classStarterServer- Returns:
- the version
-
getMBeanInfo
Gets the MBean info.- Specified by:
getMBeanInfoin interfaceMBeanService- Overrides:
getMBeanInfoin classStarterServer- Returns:
- the MBean info
-
setAttribute
public boolean setAttribute(String name, Object value) throws InvalidAttributeValueException, MBeanException Sets the attribute.- Specified by:
setAttributein interfaceMBeanService- Overrides:
setAttributein 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.- Specified by:
getAttributein interfaceMBeanService- Overrides:
getAttributein 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.- Specified by:
invokein interfaceMBeanService- Overrides:
invokein 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.- Specified by:
checkin interfaceMoverInterface- Parameters:
ticket- the ticket- Throws:
IOException- Signals that an I/O exception has occurred.RemoteException
-
size
Size.- Specified by:
sizein interfaceMoverInterface- Parameters:
transfer- the transferfileName- the file name- Returns:
- the long
- Throws:
ECtransException- the ectrans exceptionIOException- Signals that an I/O exception has occurred.RemoteException
-
del
Del.- Specified by:
delin interfaceMoverInterface- Parameters:
transfer- the transferfileName- the file name- Throws:
ECtransException- the ectrans exceptionIOException- Signals that an I/O exception has occurred.RemoteException
-
filter
Filter.- Specified by:
filterin interfaceMoverInterface- Parameters:
dataFile- the data fileremove- the remove- Returns:
- the data file
- Throws:
IOException- Signals that an I/O exception has occurred.RemoteException
-
replicate
public DataFile replicate(DataFile dataFile, Host targetHost, Host[] hostsForSource) throws RemoteException Replicate.- Specified by:
replicatein 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.RemoteException
-
getMoverReport
Gets the mover report.- Specified by:
getMoverReportin interfaceMoverInterface- Parameters:
proxyHost- the proxy host- Returns:
- the mover report
- Throws:
IOException- Signals that an I/O exception has occurred.RemoteException
-
getHostReport
Gets the host report.- Specified by:
getHostReportin interfaceMoverInterface- Parameters:
proxyHost- the proxy hosthost- the host- Returns:
- the host report
- Throws:
IOException- Signals that an I/O exception has occurred.RemoteException
-
getReport
Gets the report.- Specified by:
getReportin interfaceMoverInterface- Returns:
- the report
- Throws:
IOException- Signals that an I/O exception has occurred.RemoteException
-
getReport
Gets the report.- Specified by:
getReportin interfaceMoverInterface- Parameters:
host- the host- Returns:
- the report
- Throws:
IOException- Signals that an I/O exception has occurred.RemoteException
-
download
Download.- Specified by:
downloadin 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.RemoteException
-
purge
Purge.- Specified by:
purgein interfaceMoverInterface- Parameters:
proxyHost- the proxy hostdirectories- the directories- Throws:
RemoteException- the remote exception
-
purge
Purge.- Specified by:
purgein interfaceMoverInterface- Parameters:
directories- the directories- Throws:
RemoteException- the remote exception
-
purge
public void purge()Request from the JMX interface. -
del
Del.- Specified by:
delin 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.RemoteException
-
del
Del.- Specified by:
delin interfaceMoverInterface- Parameters:
dataFile- the data file- Returns:
- true, if successful
- Throws:
ECtransException- the ectrans exceptionIOException- Signals that an I/O exception has occurred.RemoteException
-
put
public DataTransfer put(Host[] hostsForSource, DataTransfer transfer, String targetName, long localPosn, long remotePosn) throws RemoteException Puts the.- Specified by:
putin interfaceMoverInterface- Parameters:
hostsForSource- the hosts for sourcetransfer- the transfertargetName- the target 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.RemoteException
-
put
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:
putin 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.RemoteException
-
get
public ProxySocket get(Host host, String source, long remotePosn, boolean removeOriginal) throws RemoteException 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:
getin 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.RemoteException
-
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 RemoteException Gets the.- Specified by:
getin 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.RemoteException
-
get
public ProxySocket get(DataFile dataFile, Host[] hostsForSource, long remotePosn, long length) throws RemoteException Gets the.- Specified by:
getin interfaceMoverInterface- Parameters:
dataFile- the data filehostsForSource- the hosts 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.RemoteException
-
size
Size.- Specified by:
sizein interfaceMoverInterface- Parameters:
host- the hostsource- the source- Returns:
- the long
- Throws:
ECtransException- the ectrans exceptionIOException- Signals that an I/O exception has occurred.RemoteException
-
listAsStringArray
public String[] listAsStringArray(Host host, String directory, String pattern) throws RemoteException List as string array.- Specified by:
listAsStringArrayin interfaceMoverInterface- Parameters:
host- the hostdirectory- the directorypattern- the pattern- Returns:
- the string[]
- Throws:
ECtransException- the ectrans exceptionIOException- Signals that an I/O exception has occurred.RemoteException
-
listAsByteArray
public RemoteInputStream listAsByteArray(Host host, String directory, String pattern, boolean synchronous) throws RemoteException List as byte array.- Specified by:
listAsByteArrayin 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.RemoteException
-
execute
Execute.- Specified by:
executein interfaceMoverInterface- Parameters:
script- the script- Returns:
- the remote input stream
- Throws:
ScriptException- the script exceptionIOException- Signals that an I/O exception has occurred.RemoteException
-
del
Del.- Specified by:
delin interfaceMoverInterface- Parameters:
host- the hostsource- the source- Throws:
ECtransException- the ectrans exceptionIOException- Signals that an I/O exception has occurred.RemoteException
-
mkdir
Mkdir.- Specified by:
mkdirin interfaceMoverInterface- Parameters:
host- the hostdir- the dir- Throws:
ECtransException- the ectrans exceptionIOException- Signals that an I/O exception has occurred.RemoteException
-
rmdir
Rmdir.- Specified by:
rmdirin interfaceMoverInterface- Parameters:
host- the hostdir- the dir- Throws:
ECtransException- the ectrans exceptionIOException- Signals that an I/O exception has occurred.RemoteException
-
move
Move.- Specified by:
movein interfaceMoverInterface- Parameters:
host- the hostsource- the sourcetarget- the target- Throws:
ECtransException- the ectrans exceptionIOException- Signals that an I/O exception has occurred.RemoteException
-
closeDataTransfer
Close.- Parameters:
transfer- the transfer- Returns:
- true, if successful
- Throws:
ECtransException- the ectrans exceptionIOException- Signals that an I/O exception has occurred.
-
close
Close.- Specified by:
closein interfaceMoverInterface- Parameters:
transfer- the transfer- Returns:
- true, if successful
- Throws:
ECtransException- the ectrans exceptionIOException- Signals that an I/O exception has occurred.RemoteException
-
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.- Specified by:
shutdownin interfaceToBeStarted- Overrides:
shutdownin classStarterServer
-