SVCS - English Documentation
Loading...
Searching...
No Matches
svcs::server::cli::ServerBaseCommand Class Referenceabstract

Abstract base class for all server administration commands. More...

#include <ServerBaseCommand.hxx>

Inheritance diagram for svcs::server::cli::ServerBaseCommand:
svcs::cli::ICommand svcs::server::cli::HubCommand svcs::server::cli::RepoCommand

Public Member Functions

 ServerBaseCommand (std::shared_ptr< ISubject > event_bus, std::shared_ptr< RepositoryManager > repo_manager)
 Constructs a ServerBaseCommand with necessary dependencies.
virtual ~ServerBaseCommand ()=default
 Virtual destructor for proper cleanup of derived classes.
virtual std::string getName () const override=0
 Pure virtual method to get the command name.
virtual std::string getDescription () const override=0
 Pure virtual method to get the command description.
virtual std::string getUsage () const override=0
 Pure virtual method to get the command usage syntax.
virtual bool execute (const std::vector< std::string > &args) override=0
 Pure virtual method to execute the command logic.
virtual void showHelp () const override=0
 Pure virtual method to display detailed help information.
Public Member Functions inherited from svcs::cli::ICommand
virtual ~ICommand ()=default
 Virtual destructor.

Protected Member Functions

void notifyInfo (const std::string &message) const
 Sends an informational notification via the event bus.
void notifyError (const std::string &message) const
 Sends an error notification via the event bus.

Protected Attributes

std::shared_ptr< ISubjectevent_bus_
 Shared pointer to the event bus for system notifications.
std::shared_ptr< RepositoryManagerrepo_manager_
 Shared pointer to the repository manager for repository operations.

Detailed Description

Abstract base class for all server administration commands.

Inherits from ICommand and provides common infrastructure for server management operations including event notification and repository management. All server-specific commands should derive from this class.

Constructor & Destructor Documentation

◆ ServerBaseCommand()

svcs::server::cli::ServerBaseCommand::ServerBaseCommand ( std::shared_ptr< ISubject > event_bus,
std::shared_ptr< RepositoryManager > repo_manager )

Constructs a ServerBaseCommand with necessary dependencies.

Parameters
event_busShared pointer to the event bus for system notifications.
repo_managerShared pointer to the repository manager for repository operations.

Member Function Documentation

◆ execute()

virtual bool svcs::server::cli::ServerBaseCommand::execute ( const std::vector< std::string > & args)
overridepure virtual

Pure virtual method to execute the command logic.

Parameters
argsVector of string arguments passed to the command.
Returns
true if command execution was successful, false otherwise.

Must be implemented by derived classes to provide command-specific logic.

Implements svcs::cli::ICommand.

Implemented in svcs::server::cli::HubCommand, and svcs::server::cli::RepoCommand.

◆ getDescription()

virtual std::string svcs::server::cli::ServerBaseCommand::getDescription ( ) const
nodiscardoverridepure virtual

Pure virtual method to get the command description.

Returns
Command description as string.

Must be implemented by derived classes to describe command functionality.

Implements svcs::cli::ICommand.

Implemented in svcs::server::cli::HubCommand, and svcs::server::cli::RepoCommand.

◆ getName()

virtual std::string svcs::server::cli::ServerBaseCommand::getName ( ) const
nodiscardoverridepure virtual

Pure virtual method to get the command name.

Returns
Command name as string.

Must be implemented by derived classes to provide unique command identifier.

Implements svcs::cli::ICommand.

Implemented in svcs::server::cli::HubCommand, and svcs::server::cli::RepoCommand.

◆ getUsage()

virtual std::string svcs::server::cli::ServerBaseCommand::getUsage ( ) const
nodiscardoverridepure virtual

Pure virtual method to get the command usage syntax.

Returns
Command usage syntax as string.

Must be implemented by derived classes to show proper command usage.

Implements svcs::cli::ICommand.

Implemented in svcs::server::cli::HubCommand, and svcs::server::cli::RepoCommand.

◆ notifyError()

void svcs::server::cli::ServerBaseCommand::notifyError ( const std::string & message) const
protected

Sends an error notification via the event bus.

Parameters
messageThe error message to send.

Utility method for derived classes to send error notifications.

◆ notifyInfo()

void svcs::server::cli::ServerBaseCommand::notifyInfo ( const std::string & message) const
protected

Sends an informational notification via the event bus.

Parameters
messageThe informational message to send.

Utility method for derived classes to send info notifications.

◆ showHelp()

virtual void svcs::server::cli::ServerBaseCommand::showHelp ( ) const
overridepure virtual

Pure virtual method to display detailed help information.

Must be implemented by derived classes to show command-specific help.

Implements svcs::cli::ICommand.

Implemented in svcs::server::cli::HubCommand, and svcs::server::cli::RepoCommand.


The documentation for this class was generated from the following files: