Class MasterServer

All Implemented Interfaces:
ClientInterface, HandlerInterface, ProviderInterface, RemoteServer, MBeanListener, MBeanService, MonitorCallback, ToBeStarted, MasterInterface, Serializable, Remote

public final class MasterServer extends ECaccessProvider implements HandlerInterface, MasterInterface
The Class MasterServer.
See Also:
  • Field Details

    • dataCache

      public final transient ECpdsBase.DataTransferCache dataCache
      The data cache. Allow getting latest update of the DataTransfer when calling method from The data cache!
  • Constructor Details

  • Method Details

    • getVersion

      public String getVersion()
      Gets the version.
      Specified by:
      getVersion in class StarterServer
      Returns:
      the version
    • getManagementInterface

      public ManagementInterface getManagementInterface()
      Gets the management interface.
      Returns:
      the management interface
    • getDataBaseInterface

      public DataBaseInterface getDataBaseInterface()
      Gets the data base interface.
      Returns:
      the data base interface
    • getAttachmentAccessInterface

      public DataAccessInterface getAttachmentAccessInterface()
      Gets the attachment access interface.
      Returns:
      the attachment access interface
    • getDataFileAccessInterface

      public DataAccessInterface getDataFileAccessInterface()
      Gets the data file access interface.
      Specified by:
      getDataFileAccessInterface in interface MasterInterface
      Returns:
      the data file access interface
    • getEventScriptContent

      public String getEventScriptContent()
      Gets the event script content.
      Returns:
      the event script content
    • getDestination

      public Destination getDestination(String name)
      Gets the destination.
      Specified by:
      getDestination in interface MasterInterface
      Parameters:
      name - the name
      Returns:
      the destination
    • isValidDataFile

      public boolean isValidDataFile(boolean isProxy, long dataFileId)
      Checks if is valid data file. This method is called by the cleaning scheduler on the DataMovers to check if a DataFile still exists and is valid? Otherwise the DataFile is removed from the DataMover storage system. In case of error, the data file is considered as valid to avoid its deletion.
      Specified by:
      isValidDataFile in interface MasterInterface
      Parameters:
      isProxy - the is proxy
      dataFileId - the data file id
      Returns:
      true, if is valid data file
    • getIncomingUserHash

      public String getIncomingUserHash(String incomingUser)
      Gets the incoming user hash.
      Specified by:
      getIncomingUserHash in interface MasterInterface
      Parameters:
      incomingUser - the incoming user
      Returns:
      the incoming user hash
    • isAnonymousIncomingUser

      public boolean isAnonymousIncomingUser(String incomingUser)
      Check whether an IncomingUser is configured for anonymous (password-free) access.
      Specified by:
      isAnonymousIncomingUser in interface MasterInterface
      Parameters:
      incomingUser - the incoming user name
      Returns:
      true if the user exists and has USER_PORTAL_ANONYMOUS set
    • getIncomingConnectionCount

      public int getIncomingConnectionCount(String incomingUser)
      Get the current number of active connections for the specified incoming user across all data movers.
      Specified by:
      getIncomingConnectionCount in interface MasterInterface
      Parameters:
      incomingUser - the incoming user name
      Returns:
      the active connection count
    • getPortalBytesUsed

      public long getPortalBytesUsed(String userId, boolean upload, long windowMs) throws RemoteException
      Returns the total bytes transferred by the given portal user within the specified rolling window (milliseconds).
      Specified by:
      getPortalBytesUsed in interface MasterInterface
      Parameters:
      userId - the user id
      upload - true for upload bytes, false for download bytes
      windowMs - the rolling window in milliseconds
      Returns:
      total bytes within the window, or 0 if none recorded
      Throws:
      RemoteException - if the call fails
    • getPortalTraffic

      public List<PortalTraffic> getPortalTraffic(String userId, int hours) throws RemoteException
      Description copied from interface: MasterInterface
      Gets portal traffic statistics. Returns minute-bucket rows for the given user (or all users if userId is empty), covering the specified number of hours back from now.
      Specified by:
      getPortalTraffic in interface MasterInterface
      Parameters:
      userId - the incoming user ID, or empty string for system-wide
      hours - how many hours of history to return
      Returns:
      list of PortalTraffic rows ordered by time descending
      Throws:
      RemoteException - the remote exception
    • getS3AuthorizationSignature

      public byte[] getS3AuthorizationSignature(String incomingUser, String prefix, String data, String algorithm)
      Gets the s 3 authorization signature.
      Specified by:
      getS3AuthorizationSignature in interface MasterInterface
      Parameters:
      incomingUser - the incoming user
      prefix - the prefix
      data - the data
      algorithm - the algorithm
      Returns:
      the s 3 authorization signature
    • releaseConnectionSlot

      public void releaseConnectionSlot(String incomingUser) throws RemoteException
      Gets the incoming profile.
      Specified by:
      releaseConnectionSlot in interface MasterInterface
      Parameters:
      incomingUser - the incoming user
      incomingPassword - the incoming password
      from - the from
      Throws:
      RemoteException - the remote exception
    • getIncomingProfile

      public IncomingProfile getIncomingProfile(String incomingUser, String incomingPassword, String from) throws RemoteException
      Gets the incoming profile.
      Specified by:
      getIncomingProfile in interface MasterInterface
      Parameters:
      incomingUser - the incoming user
      incomingPassword - the incoming password
      from - the from
      Returns:
      the incoming profile
      Throws:
      RemoteException - the remote exception
    • getIncomingProfileNoAuth

      public IncomingProfile getIncomingProfileNoAuth(String incomingUser) throws RemoteException
      Returns a fresh IncomingProfile for an already-authenticated user without re-running credential validation, TOTP, connection-count checks, or last-login updates. Returns a fresh IncomingProfile for an already-authenticated user without re-running credential validation, TOTP, connection-count checks, or last-login updates.
      Specified by:
      getIncomingProfileNoAuth in interface MasterInterface
      Parameters:
      incomingUser - the incoming user id
      Returns:
      the incoming profile
      Throws:
      RemoteException - the remote exception
    • getTransferScheduler

      public TransferScheduler getTransferScheduler() throws MasterException
      Gets the transfer scheduler.
      Returns:
      the transfer scheduler
      Throws:
      MasterException - the master exception
    • lockTransfer

      public ProgressInterface lockTransfer(String key, ProgressInterface plugin)
      Check if a lock has not yet been set on the specific key. If the lock is not set then lock on behalf of the object parameter otherwise return the object which has been used to lock the key. This method is dedicated to the ECpdsPlugin which use it to avoid having parallel requests for the same transfer request.
      Parameters:
      key - the unique key
      plugin - the plugin
      Returns:
      the ecpds plugin interface
    • lockDataFile

      public void lockDataFile(String key)
      Lock a data file. This method is used by the ECpdsPlugin to record which DataFiles are in the process of being retrieved without using a Download Scheduler.
      Parameters:
      key - the key
    • unlockTransfer

      public void unlockTransfer(String key)
      Unlock the data transfer and associated data file for the specified unique key.
      Parameters:
      key - the unique key of the data transfer
    • transferIsLocked

      public boolean transferIsLocked(String key)
      Check if the data transfer for the specified unique key is locked. This method is used by the DownloadScheduler to avoid downloading a file which is still processed by the ECpdsPlugin.
      Parameters:
      key - the unique key of the data transfer
      Returns:
      true, if successful
    • getDownloadScheduler

      public MasterServer.DownloadScheduler getDownloadScheduler(boolean acquisition) throws MasterException
      Gets the download scheduler.
      Parameters:
      acquisition - the acquisition
      Returns:
      the download scheduler
      Throws:
      MasterException - the master exception
    • getDataTransfers

      public DataTransfer[] getDataTransfers(long dataFileId) throws DataBaseException
      Gets the data transfers.
      Parameters:
      dataFileId - the data file id
      Returns:
      the data transfers
      Throws:
      DataBaseException - the data base exception
    • getDestinationSchedulerCache

      public DestinationSchedulerCache getDestinationSchedulerCache(String destinationName) throws MonitorException, MasterException, DataBaseException
      Gets the destination scheduler cache.
      Parameters:
      destinationName - the destination name
      Returns:
      the destination scheduler cache
      Throws:
      MonitorException - the monitor exception
      MasterException - the master exception
      DataBaseException - the data base exception
    • getDestinationSchedulerCache

      public DestinationSchedulerCache getDestinationSchedulerCache(String destinationName, String statusCode) throws MonitorException, MasterException, DataBaseException
      Gets the destination scheduler cache.
      Parameters:
      destinationName - the Destination name
      statusCode - the Status Code
      Returns:
      the destination scheduler cache
      Throws:
      MonitorException - the monitor exception
      MasterException - the master exception
      DataBaseException - the data base exception
    • getDestinationCaches

      Gets the destination caches.
      Returns:
      the destination caches
      Throws:
      MonitorException - the monitor exception
      MasterException - the master exception
      DataBaseException - the data base exception
    • getDestinationCache

      public DestinationCache getDestinationCache(String destinationName) throws MonitorException, MasterException, DataBaseException
      Gets the destination cache. This is called when a host or a destination is duplicated, so the calculation of the number of bad data transfers is not relevant (0 if it is a new destination and same as before in the cache if it is a new host).
      Parameters:
      destinationName - the destination name
      Returns:
      the destination cache
      Throws:
      MonitorException - the monitor exception
      MasterException - the master exception
      DataBaseException - the data base exception
    • getECpdsBase

      public ECpdsBase getECpdsBase()
      Gets the ecpds base.
      Returns:
      the ecpds base
    • getTicketRepository

      public TicketRepository getTicketRepository()
      Gets the ticket repository.
      Returns:
      the ticket repository
    • purgeDataBase

      public void purgeDataBase(long milliseconds)
      Purge data base.
      Specified by:
      purgeDataBase in class ECaccessServer
      Parameters:
      milliseconds - the milliseconds
    • publishToMQTTBroker

      public void publishToMQTTBroker(String topic, int qos, long expiryInterval, String contentType, String clientId, String payload, boolean retain)
      Publish MQTT message to all transfers servers from all transfer groups.
      Parameters:
      topic - the topic
      qos - the qos
      expiryInterval - the expiry interval
      contentType - the content type
      clientId - the client id
      payload - the payload
      retain - the retain
    • removeFromMQTTBroker

      public void removeFromMQTTBroker(String topic)
      Remove MQTT retain message from all transfers servers from all transfer groups.
      Parameters:
      topic - the topic
    • getMQTTClientsCount

      public int getMQTTClientsCount()
      Get the number of clients connected to all the MQTT brokers.
      Returns:
      the MQTT clients count
    • deleteDataFile

      public boolean deleteDataFile(DataFile file) throws DataBaseException
      Delete data file.
      Parameters:
      file - the file
      Returns:
      true, if successful
      Throws:
      DataBaseException - the data base exception
    • purgeDataFile

      public TransferScheduler.PurgeResult purgeDataFile(DataFile file, String byAndFrom) throws DataBaseException
      Purge data file.
      Parameters:
      file - the file
      byAndFrom - the by and from
      Returns:
      the purge result
      Throws:
      DataBaseException - the data base exception
    • computeFilterEfficiency

      public String computeFilterEfficiency(String destinationName, String email, String filter, long date, boolean includeStdby, String pattern) throws DataBaseException
      Compute the filter efficiency. The result is sent to the specified email address.
      Parameters:
      destinationName - the destination name
      email - the email address
      filter - the filter
      date - the date
      includeStdby - specify if should include Stdby files or not?
      pattern - specify if should include Stdby files or not?
      Returns:
      the filter efficiency
      Throws:
      DataBaseException - the data base exception
    • getMoverReport

      public String getMoverReport(Host proxyHost) throws DataBaseException, IOException
      Gets the mover report.
      Parameters:
      proxyHost - the proxy host
      Returns:
      the mover report
      Throws:
      DataBaseException - the data base exception
      IOException - Signals that an I/O exception has occurred.
    • getHostReport

      public String getHostReport(Host proxyHost, Host host) throws DataBaseException, IOException
      Gets the host report.
      Parameters:
      proxyHost - the proxy host
      host - the host
      Returns:
      the host report
      Throws:
      DataBaseException - the data base exception
      IOException - Signals that an I/O exception has occurred.
    • cleanDataWindow

      public void cleanDataWindow(Host host) throws DataBaseException, IOException
      Clean the Data Window of the selected Host.
      Parameters:
      host - the host
      Throws:
      DataBaseException - the data base exception
      IOException - Signals that an I/O exception has occurred.
    • resetHostStats

      public void resetHostStats(Host host) throws DataBaseException
      Reset the host stats of the selected Host.
      Parameters:
      host - the host
      Throws:
      DataBaseException - the data base exception
    • getReport

      Get a report for the specified Host.
      Parameters:
      host - the host
      Returns:
      the report
      Throws:
      DataBaseException - the data base exception
      IOException - Signals that an I/O exception has occurred.
      TransferServerProvider.TransferServerException
    • isAcquisitionRunning

      public boolean isAcquisitionRunning(Host host)
      Check whether the acquisition scheduler currently has a live thread running for the specified Host.
      Parameters:
      host - the host
      Returns:
      true if an acquisition thread for this host is active right now
    • triggerAcquisition

      public void triggerAcquisition(Host host) throws DataBaseException
      Trigger acquisition for the specified Host immediately by resetting the acquisition time, causing the AcquisitionScheduler to pick it up on its next cycle. Does nothing if the host is already running.
      Parameters:
      host - the host
      Throws:
      DataBaseException - if the database update fails
    • getOutput

      public RemoteInputStreamImp getOutput(Host host) throws IOException
      Get the output for the specified Host. This is used by the monitoring interface.
      Parameters:
      host - the host
      Returns:
      the output
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • execDirScript

      Execute a Directory script on the appropriate DataMover and return the GZIPped result.
      Parameters:
      host - the host whose transfer group is used to select a DataMover
      script - the script content (e.g. "python:..." or "js:...")
      Returns:
      a GZIPped input stream containing the script output
      Throws:
      IOException - Signals that an I/O exception has occurred.
      TransferServerProvider.TransferServerException - if no DataMover is available in the host's transfer group
      DataBaseException - the data base exception
    • getReport

      public String getReport(TransferServer server) throws IOException
      Get a report for the specified TransferServer.
      Parameters:
      server - the server
      Returns:
      the report
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • updateIncomingConnectionIds

      public void updateIncomingConnectionIds(String serverName, List<IncomingConnection> incomingConnections)
      Update incoming connection ids.
      Specified by:
      updateIncomingConnectionIds in interface MasterInterface
      Parameters:
      serverName - the server name
      incomingConnections - the incoming connections
    • getIncomingConnections

      public Map<String, ArrayList<IncomingConnection>> getIncomingConnections() throws DataBaseException
      Get all incoming connections from all data movers per user.
      Returns:
      the incoming connections per user
      Throws:
      DataBaseException - the data base exception
    • computeAllVolumeUsageAndMovers

      public MasterServer.VolumeUsageResult[] computeAllVolumeUsageAndMovers(TransferGroup group) throws RemoteException
      Computes aggregated volume usage for the given transfer group in a single pass over all data movers, returning one MasterServer.VolumeUsageResult per volume index.

      Contacts each data mover in the group exactly once and builds all per-volume sorted-mover lists in a single in-memory pass. The result is a VolumeUsageResult[] where index i contains the aggregated usage and the list of movers sorted by ascending used space on volume i.

      All returned MasterServer.VolumeUsageResult entries share the same aggregatedUsage array reference — it is safe to read but must not be mutated by callers.

      Parameters:
      group - the transfer group whose data movers are queried
      Returns:
      an array of MasterServer.VolumeUsageResult with one entry per volume index; may be empty if no movers responded with valid data
      Throws:
      RemoteException - if a remote communication error occurs while querying a data mover
    • getMoverVolumeSnapshot

      public Map<String,long[][]> getMoverVolumeSnapshot(String moverName)
      Returns a snapshot of the per-volume disk usage for one or all DataMovers, sourced from the in-memory cache populated by the background polling cycle.

      Each entry maps a DataMover name to the long[2][volumeCount] array last received from that mover: [0][i] = used bytes on volume i, [1][i] = total bytes.

      Parameters:
      moverName - the DataMover name to query, or null for all movers
      Returns:
      a map of mover name to long[2][volumeCount]; never null
    • getIncomingConnectionIds

      public String getIncomingConnectionIds()
      Get all incoming connections from all data movers.
      Returns:
      the incoming connection ids
      Throws:
      DataBaseException - the data base exception
    • closeAllIncomingConnections

      public void closeAllIncomingConnections() throws DataBaseException
      Close all incoming connections from all data movers.
      Throws:
      DataBaseException - the data base exception
    • closeIncomingConnection

      public boolean closeIncomingConnection(String id) throws IOException
      Close an incoming connection from its identifier.
      Parameters:
      id - the id in the format dataMoverName_id
      Returns:
      true, if successful
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • closeAllIncomingConnections

      public void closeAllIncomingConnections(String transferServerName) throws IOException
      Close all incoming connections on a data mover.
      Parameters:
      transferServerName - the transfer server name
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • updateTransferStatus

      public boolean updateTransferStatus(DataTransfer transfer, String code) throws MasterException
      Update transfer status.
      Parameters:
      transfer - the transfer
      code - the code
      Returns:
      true, if successful
      Throws:
      MasterException - the master exception
    • updateTransferStatus

      public boolean updateTransferStatus(long id, String code, boolean commit, String username, String byAndFrom, boolean synchronous, boolean reset, boolean addHistory) throws MasterException
      Update transfer status.
      Parameters:
      id - the id
      code - the code
      commit - the commit
      username - the username
      byAndFrom - the comment
      synchronous - the synchronous
      reset - the reset
      addHistory - the add history
      Returns:
      true, if successful
      Throws:
      MasterException - the master exception
    • updateTransferStatus

      public boolean updateTransferStatus(DataTransfer transfer, String code, boolean commit, String username, String byAndFrom, boolean synchronous, boolean reset, boolean addHistory) throws MasterException
      Update transfer status.
      Parameters:
      transfer - the transfer
      code - the code
      commit - the commit
      username - the username
      byAndFrom - the comment
      synchronous - the synchronous
      reset - the reset
      addHistory - the add history
      Returns:
      true, if successful
      Throws:
      MasterException - the master exception
    • reloadDestination

      public boolean reloadDestination(DataTransfer transfer) throws MasterException
      Reload destination.
      Parameters:
      transfer - the transfer
      Returns:
      true, if successful
      Throws:
      MasterException - the master exception
    • transfer

      public long transfer(byte[] bytes, TransferServer server, Host host, String target, long remotePosn, long size) throws MasterException, IOException
      Transfer.
      Parameters:
      bytes - the bytes
      server - the server
      host - the host
      target - the target
      remotePosn - the remote posn
      size - the size
      Returns:
      the long
      Throws:
      MasterException - the master exception
      IOException - Signals that an I/O exception has occurred.
    • getDataMoverInterface

      public MoverInterface getDataMoverInterface(String name)
      Gets the client interface.
      Parameters:
      name - the name
      Returns:
      the client interface
    • resetTransferServer

      public void resetTransferServer(String root, String comment)
      Reset transfer server.
      Parameters:
      root - the root
      comment - the comment
    • resetDestination

      public void resetDestination(Destination destination, String comment)
      Reset destination.
      Parameters:
      destination - the destination
      comment - the comment
    • proxyHostIsAlive

      public long proxyHostIsAlive(String name)
      Called when a ProxyHost sends an update to the Master.
      Specified by:
      proxyHostIsAlive in interface MasterInterface
      Parameters:
      name - the name
      Returns:
      the long
    • addRoot

      public void addRoot(ClientInterface access, String host, String root, String service)
      Registers a new service root.

      If the service is a DataMover or DataProxy, the corresponding TransferServer is reset to reflect a potential restart.

      For DataMover services, this method also verifies the ECproxy address and port advertised by the mover and optionally updates the database entry if a change is detected.

      Overrides:
      addRoot in class ECaccessProvider
      Parameters:
      access - the client interface used to communicate with the service
      host - the hostname from which the service is connecting
      root - the logical root name identifying the TransferServer
      service - the service type (e.g. "DataMover", "DataProxy")
    • removeExpired

      public void removeExpired(String root, String service)
      Removes the expired.
      Overrides:
      removeExpired in class ECaccessProvider
      Parameters:
      root - the root
      service - the service
    • isRegistred

      public long isRegistred(String root, String service)
      Checks if it is registred. Checks if is registred. Records a heartbeat for DataMover services in the in-memory availability buffer so the MoverAvailabilityScheduler can persist per-minute availability to the database.
      Specified by:
      isRegistred in interface ProviderInterface
      Overrides:
      isRegistred in class ECaccessProvider
      Parameters:
      root - the root
      service - the service
      Returns:
      the long
    • importECUser

      public ECUser importECUser(String uid) throws EccmdException, RemoteException
      Import EC user.
      Specified by:
      importECUser in class ECaccessServer
      Parameters:
      uid - the uid
      Returns:
      the EC user
      Throws:
      EccmdException - the eccmd exception
      RemoteException - the remote exception
    • handleECuserUpdate

      public void handleECuserUpdate(ECUser ecuser)
      Handle E cuser update. This method is called when an ECUser change is detected (when the database has just been updated with a new version from NIS).
      Overrides:
      handleECuserUpdate in class ECaccessServer
      Parameters:
      ecuser - the ecuser
    • getMBeanInfo

      public MBeanInfo getMBeanInfo()
      Gets the MBean info.
      Specified by:
      getMBeanInfo in interface MBeanService
      Overrides:
      getMBeanInfo in class ECaccessServer
      Returns:
      the MBean info
    • getAttribute

      public Object getAttribute(String attributeName) throws AttributeNotFoundException, MBeanException
      Gets the attribute.
      Specified by:
      getAttribute in interface MBeanService
      Overrides:
      getAttribute in class ECaccessServer
      Parameters:
      attributeName - the attribute name
      Returns:
      the attribute
      Throws:
      AttributeNotFoundException - the attribute not found exception
      MBeanException - the MBean exception
    • setAttribute

      public boolean setAttribute(String name, Object value) throws InvalidAttributeValueException, MBeanException
      Sets the attribute.
      Specified by:
      setAttribute in interface MBeanService
      Overrides:
      setAttribute in class ECaccessServer
      Parameters:
      name - the name
      value - the value
      Returns:
      true, if successful
      Throws:
      InvalidAttributeValueException - the invalid attribute value exception
      MBeanException - the MBean exception
    • invoke

      public Object invoke(String operationName, Object[] params, String[] signature) throws NoSuchMethodException, MBeanException
      Invoke.
      Specified by:
      invoke in interface MBeanService
      Overrides:
      invoke in class ECaccessServer
      Parameters:
      operationName - the operation name
      params - the params
      signature - the signature
      Returns:
      the object
      Throws:
      NoSuchMethodException - the no such method exception
      MBeanException - the MBean exception
    • updateDataTransfers

      public void updateDataTransfers(DataTransfer[] transfers) throws RemoteException
      Update data transfers.
      Specified by:
      updateDataTransfers in interface MasterInterface
      Parameters:
      transfers - the transfers
      Throws:
      RemoteException - the remote exception
    • updateDownloadProgress

      public DownloadProgress[] updateDownloadProgress(DownloadProgress[] progress) throws RemoteException
      Update download progress.
      Specified by:
      updateDownloadProgress in interface MasterInterface
      Parameters:
      progress - the progress
      Returns:
      the download progress[]
      Throws:
      RemoteException - the remote exception
    • checkPendingTicket

      public void checkPendingTicket(DataTransfer transfer, boolean updateRepository)
      Check pending ticket.
      Parameters:
      transfer - the transfer
      updateRepository - the update repository
    • updateDataTransfer

      public void updateDataTransfer(DataTransfer transfer)
      Update data transfer.
      Parameters:
      transfer - the transfer
    • addDataTransfer

      public void addDataTransfer(DataTransfer transfer)
      Adds the data transfer.
      Parameters:
      transfer - the transfer
    • removeDataTransfer

      public void removeDataTransfer(DataTransfer transfer)
      Removes the data transfer.
      Parameters:
      transfer - the transfer
    • removeDataFileAndDataTransfers

      public void removeDataFileAndDataTransfers(DataFile file, String username, String byAndFrom) throws MasterException, DataBaseException
      Removes the data file and data transfers.
      Parameters:
      file - the file
      username - the username
      byAndFrom - the comment
      Throws:
      MasterException - the master exception
      DataBaseException - the data base exception
    • addTransferHistory

      public void addTransferHistory(DataTransfer transfer)
      Adds the transfer history.
      Parameters:
      transfer - the transfer
    • addTransferHistory

      public void addTransferHistory(DataTransfer transfer, String code, String comment)
      Adds the transfer history.
      Parameters:
      transfer - the transfer
      code - the code
      comment - the comment
    • addTransferHistory

      public void addTransferHistory(DataTransfer transfer, Host source, String code, String comment, boolean error)
      Adds the transfer history.
      Parameters:
      transfer - the transfer
      source - source host
      code - the code
      comment - the comment
      error - is it an error?
    • getProgressInterface

      public ProgressInterface getProgressInterface(long dataFileId)
      Gets the progress interface either from the download schedulers or the ecpds plugin (depending on how the data file is retrieved).
      Parameters:
      dataFileId - the data file id
      Returns:
      the progress interface
    • getRetrieved

      public long getRetrieved(long dataFileId)
      Gets the number of bytes retrieved. If the thread is not found on both download schedulers then -1 is returned.
      Parameters:
      dataFileId - the data file id
      Returns:
      the retrieved
    • getTransferServerName

      public String getTransferServerName(long dataFileId)
      Gets the transfer server name.
      Parameters:
      dataFileId - the data file id
      Returns:
      the transfer server name
    • getDataTransferFromCache

      public DataTransfer getDataTransferFromCache(long id)
      Gets the data transfer from cache.
      Parameters:
      id - the id
      Returns:
      the data transfer from cache
    • getStatus

      public String getStatus(String destinationName)
      Gets the status.
      Parameters:
      destinationName - the Destination name
      Returns:
      the status
    • getDataTransfers

      public DataTransfer[] getDataTransfers(String destinationName)
      Gets the data transfers.
      Parameters:
      destinationName - the destination name
      Returns:
      the data transfers
    • getDataTransfer

      public DataTransfer getDataTransfer(long id)
      Gets the data transfer.
      Parameters:
      id - the id
      Returns:
      the data transfer
    • getDataTransfer

      public DataTransfer getDataTransfer(DataTransfer transfer)
      Gets the data transfer.
      Parameters:
      transfer - the transfer
      Returns:
      the data transfer
    • sendECpdsMessage

      public void sendECpdsMessage(DataTransfer transfer)
      Sends the ecpds message.
      Parameters:
      transfer - the transfer
    • sendECpdsMessage

      public void sendECpdsMessage(String to, String cc, String subject, String content, String attachmentName, String attachmentContent)
      Sends the ecpds message.
      Parameters:
      to - the to
      cc - the cc
      subject - the subject
      content - the content
      attachmentName - the attachment name
      attachmentContent - the attachment content
    • sendECpdsMessage

      public void sendECpdsMessage(String to, String subject, String content)
      Sends the ecpds message.
      Parameters:
      to - the to
      subject - the subject
      content - the content
    • isAvailable

      public long isAvailable()
      Checks if is available.
      Specified by:
      isAvailable in interface ProviderInterface
      Returns:
      the long
    • interruptAquisitionFor

      public void interruptAquisitionFor(Host host) throws DataBaseException
      This method is called to interrupt the acquisition thread activity for the specified host.
      Parameters:
      host - the host
      Throws:
      DataBaseException - the data base exception
    • updateData

      public void updateData(Host host) throws RemoteException
      Update data. This method is used from the MoverProvider on the MoverServer (updateMSUser) to update the Host. The method will make sure the Host was not updated by a newer version. If a newer version exists then this update will not be done. The only field updated in this method is the DATA.
      Specified by:
      updateData in interface MasterInterface
      Parameters:
      host - the host
      Throws:
      RemoteException - the remote exception
    • updateData

      public void updateData(String hostId, String data) throws RemoteException
      Update data. This method is used from the MoverProvider on the MoverServer (updateMSUser) to update the Host. The method will make sure the Host was not updated by a newer version. If a newer version exists then this update will not be done. The only field updated in this method is the DATA.
      Specified by:
      updateData in interface MasterInterface
      Parameters:
      hostId - the host id
      data - the data
      Throws:
      RemoteException - the remote exception
    • updateLocation

      public void updateLocation(Host host)
      Update location. This method is used from the MoverProvider on the MoverServer (getMSUser) to update the Host location. This is triggered when the MoverServer has detected a change in the IP address. It is also called from the Web monitoring and JMX interface.
      Specified by:
      updateLocation in interface MasterInterface
      Parameters:
      host - the host
    • updateHostLocations

      public int updateHostLocations()
      This method is updating the locations for every Host in the database (called from the JMX interface and at startup). It always forces a GeoIP re-resolution regardless of whether the IP has changed, so that any forced locations added to the [GeoIP] config section are picked up immediately.
      Returns:
      the number of hosts processed
    • getECauthToken

      public ECauthToken getECauthToken(String user) throws RemoteException
      Gets the ecauth token.
      Specified by:
      getECauthToken in interface MasterInterface
      Parameters:
      user - the user
      Returns:
      the ecauth token
      Throws:
      RemoteException - the remote exception
    • getETag

      public String getETag(long dataTransferId) throws RemoteException
      Gets the e tag.
      Specified by:
      getETag in interface MasterInterface
      Parameters:
      dataTransferId - the data transfer id
      Returns:
      the e tag
      Throws:
      RemoteException - the remote exception
    • copyHost

      public Host copyHost(String destinationName, String hostName) throws DataBaseException
      Copy a Host within the same Destination.
      Parameters:
      destinationName - the destination name
      hostName - the host name
      Returns:
      the host
      Throws:
      DataBaseException - the data base exception
    • copyDestination

      public Destination copyDestination(String fromDestinationName, String toDestinationName, String comment, boolean copySharedHost) throws MasterException, DataBaseException
      Copy a destination.
      Parameters:
      fromDestinationName - the from destination name
      toDestinationName - the target destination name
      comment - the comment
      copySharedHost - the copy shared host
      Returns:
      the destination
      Throws:
      MasterException - the master exception
      DataBaseException - the data base exception
    • importDestination

      public void importDestination(Destination fromDestination, Association[] linkedAssociations, boolean copySharedHost) throws RemoteException
      Import destination.
      Specified by:
      importDestination in interface MasterInterface
      Parameters:
      fromDestination - the from destination
      linkedAssociations - the linked associations
      copySharedHost - the copy shared host
      Throws:
      RemoteException - the remote exception
    • exportDestination

      public void exportDestination(String targetMaster, String fromDestination, String toDestinationName, boolean copySharedHost) throws RemoteException, DataBaseException, MalformedURLException, NotBoundException
      Export destination.
      Parameters:
      targetMaster - the target master in the form host:
      fromDestination - the from destination
      toDestinationName - the optional alternative name for the destination on the target master (empty or null to keep the source name)
      copySharedHost - the copy shared host
      Throws:
      RemoteException - the remote exception
      DataBaseException - the data base exception
      MalformedURLException - the malformed URL exception
      NotBoundException - the not bound exception
    • updateRemoteTransferStatus

      public boolean updateRemoteTransferStatus(String remoteMaster, boolean standby, String destination, String target, String uniqueKey, String status) throws RemoteException, MalformedURLException, NotBoundException
      Update data transfer status to another Master Server.
      Parameters:
      remoteMaster - the remote master
      standby - the standby flag
      destination - the destination name
      target - the target name
      uniqueKey - the unique key
      status - the status
      Returns:
      true, if successful
      Throws:
      RemoteException - the remote exception
      MalformedURLException - the malformed URL exception
      NotBoundException - the not bound exception
    • updateLocalTransferStatus

      public boolean updateLocalTransferStatus(String remoteMaster, boolean standby, String destination, String target, String uniqueKey, String status) throws RemoteException
      Update local transfer status.
      Specified by:
      updateLocalTransferStatus in interface MasterInterface
      Parameters:
      remoteMaster - the remote master
      standby - the standby
      destination - the destination
      target - the target
      uniqueKey - the unique key
      status - the status
      Returns:
      true, if successful
      Throws:
      RemoteException - the remote exception
    • getWebUser

      public WebUser getWebUser(String user, String credentials, String root) throws MasterException
      Allow getting a Web User. The credentials are checked before returning the Web User.
      Parameters:
      user - the user
      credentials - the credentials
      root - the root
      Returns:
      the web user
      Throws:
      MasterException - the master exception
      DataBaseException - the data base exception
      RemoteException - the remote exception
    • saveWebUser

      public void saveWebUser(WebUser webUser) throws MasterException, DataBaseException
      Creates the web user.
      Parameters:
      webUser - the web user
      Throws:
      MasterException - the master exception
      DataBaseException - the data base exception
    • shutdown

      public void shutdown()
      Shutdown.
      Specified by:
      shutdown in interface ToBeStarted
      Overrides:
      shutdown in class ECaccessProvider
    • handle

      public void handle(PluginEvent<?> event)
      Handle.
      Specified by:
      handle in interface HandlerInterface
      Overrides:
      handle in class StarterServer
      Parameters:
      event - the event
    • handle

      public void handle(PluginEvent<?>[] events)
      Handle.
      Specified by:
      handle in interface HandlerInterface
      Overrides:
      handle in class StarterServer
      Parameters:
      events - the events
    • getInitialDataTransferEvents

      public void getInitialDataTransferEvents(String target)
      Submit the initial data transfer events to the handler specified by its target name.
      Parameters:
      target - the target
    • getInitialProductStatusEvents

      public void getInitialProductStatusEvents(String target, String stream, String time)
      Submit the initial product status events to the handler specified by its target name and optionally stream and/or time.
      Parameters:
      target - the target
      stream - the stream
      time - the time
    • getInitialChangeHostEvents

      public void getInitialChangeHostEvents(String target)
      Submit the initial change host events to the handler specified by its target name.
      Parameters:
      target - the target
    • getRoot

      public String getRoot()
      Gets the root.
      Specified by:
      getRoot in interface ClientInterface
      Returns:
      the root
    • getService

      public String getService()
      Gets the service.
      Specified by:
      getService in interface ClientInterface
      Returns:
      the service
    • getPassword

      public String getPassword()
      Gets the password.
      Specified by:
      getPassword in interface ClientInterface
      Returns:
      the password
    • updatePluginEvents

      public void updatePluginEvents(PluginEvent<?>[] events) throws Exception
      Update plugin events.
      Parameters:
      events - the events
      Throws:
      Exception - the exception