Class CommandAdapter

java.lang.Object
org.serviceconnector.cmd.sc.CommandAdapter
All Implemented Interfaces:
ICommand
Direct Known Subclasses:
AttachCommand, CheckRegistrationCommand, ClnChangeSubscriptionCommand, ClnCreateSessionCommand, ClnDeleteSessionCommand, ClnExecuteCommand, ClnSubscribeCommand, ClnUnsubscribeCommand, CscAbortSubscriptionCommand, CscChangeSubscriptionCommand, CscCreateSessionCommand, CscDeleteSessionCommand, CscExecuteCommand, CscSubscribeCommand, CscUnsubscribeCommand, DeRegisterServerCommand, DetachCommand, EchoCommand, FileDownloadCommand, FileListCommand, FileUploadCommand, InspectCommand, ManageCommand, PublishCommand, ReceivePublicationCommand, RegisterServerCommand

public abstract class CommandAdapter extends Object implements ICommand
The Class CommandAdapter. Adapter for every kind of command. Provides basic functions that is used by executions of commands.
Author:
JTraber
  • Field Details

    • sessionRegistry

      protected SessionRegistry sessionRegistry
      The session registry.
    • subscriptionRegistry

      protected SubscriptionRegistry subscriptionRegistry
      The subscription registry.
    • serverRegistry

      protected ServerRegistry serverRegistry
      The server registry.
    • serviceRegistry

      protected ServiceRegistry serviceRegistry
      The service registry.
    • basicConf

      protected BasicConfiguration basicConf
      The basic conf.
  • Constructor Details

    • CommandAdapter

      public CommandAdapter()
  • Method Details

    • getSessionById

      protected Session getSessionById(String sessionId) throws SCMPCommandException
      Gets the session by id. Checks properness of session, if session is null given session id is wrong - no session found.
      Parameters:
      sessionId - the session id
      Returns:
      the session by id
      Throws:
      SCMPCommandException - session is not in registry, invalid session id
    • getSubscriptionById

      protected Subscription getSubscriptionById(String subscriptionId) throws SCMPCommandException
      Gets the subscription by id.
      Parameters:
      subscriptionId - the subscription id
      Returns:
      the subscription by id
      Throws:
      SCMPCommandException - the sCMP command exception
    • getPublishMessageQueueById

      protected PublishMessageQueue<SCMPMessage> getPublishMessageQueueById(Subscription subscription) throws Exception
      Gets the publish message queue by id.
      Parameters:
      subscription - the subscription
      Returns:
      the publish message queue by id
      Throws:
      Exception - the exception
    • getService

      protected Service getService(String serviceName) throws SCMPCommandException
      Gets the service.
      Parameters:
      serviceName - the service name
      Returns:
      the service
      Throws:
      SCMPCommandException - the SCMP command exception
    • validatePublishService

      protected PublishService validatePublishService(String serviceName) throws SCMPCommandException
      Validate publish service.
      Parameters:
      serviceName - the service name
      Returns:
      the publish service
      Throws:
      SCMPCommandException - the SCMP command exception
    • validatePublishService

      protected PublishService validatePublishService(Service service) throws SCMPCommandException
      Validate publish service.
      Parameters:
      service - the service
      Returns:
      the publish service
      Throws:
      SCMPCommandException - the SCMP command exception
    • validateFileService

      protected FileService validateFileService(String serviceName) throws SCMPCommandException
      Validate file service.
      Parameters:
      serviceName - the service name
      Returns:
      the publish service
      Throws:
      SCMPCommandException - the SCMP command exception
    • getStatefulService

      protected StatefulService getStatefulService(String serviceName) throws SCMPCommandException
      Gets the stateful service. This method does not control the state of the service.
      Parameters:
      serviceName - the service name
      Returns:
      the stateful service
      Throws:
      SCMPCommandException - the SCMP command exception
    • resetServerTimeout

      public void resetServerTimeout(String serviceName, InetSocketAddress socketAddress)
      Reset server timeout. Gets server from the registry and refreshes server timeouts.
      Parameters:
      serviceName - the service name
      socketAddress - the socket address
    • validate

      public void validate(IRequest request) throws Exception
      Validate request.
      Specified by:
      validate in interface ICommand
      Parameters:
      request - the request
      Throws:
      Exception - the exception
    • isPassThroughPartMsg

      public boolean isPassThroughPartMsg()
      Checks if command passes through message parts.
      Specified by:
      isPassThroughPartMsg in interface ICommand
      Returns:
      true, if is pass through part msg
    • getKey

      public abstract SCMPMsgType getKey()
      Gets the key.
      Specified by:
      getKey in interface ICommand
      Returns:
      the key