Exemplo n.º 1
0
	def __init__(self, id, medium):
		"""
		Constructor for the class.

		@param id: The identifier of this server, must be a non-empty string.
		@param medium: The medium of the server, can be either LOCAL or REMOTE.

		@raise ServerIdentifierExistsError: If the identifier has already been used by another Server.
		@raise InvalidParameterError: If the value of medium is invalid.
		@raise DepFileParsingError: This class cannot be directly instantiated.
		"""

		if Server == self.__class__:
			raise DepFileParsingError()

		if False == Validator.validate_variable_name(id):
			raise InvalidParameterError("id", 'The server ID "%s" is invalid.' % (id))
		else:
			Server.__add_server_id(id)
			self.id = id

		if Server.LOCAL != medium and Server.REMOTE != medium:
			raise InvalidParameterError("medium", "Medium can be either LOCAL or REMOTE")
		else:
			self.medium = medium
Exemplo n.º 2
0
	def __init__(self, id, host, port = 3306, username = "", password = "", webserver = ""):
		"""
		Constructor for the class.

		@param id: The identifier of this server, must be a non-empty string.
		@param host: host of the MySQL server.
		@param port: port of the MySQL server.
		@param username: user on the MySQL server.
		@param password: user's password.
		@param webserver: Identifier of the webserver this FTP server stores files for.
		"""

		if 0 != len(webserver) and False == Validator.validate_variable_name(webserver):
			raise InvalidParameterError("webserver", 'The webserver ID "%s" is invalid.' % (webserver))
		else:
			self.__webserver = webserver

		Server.__init__(self, id, Server.REMOTE)
		MysqlClient.__init__(self, host, port, username, password)
Exemplo n.º 3
0
	def __init__(self, id, platform, host, port, username, password, root = "", webserver = ""):
		"""
		Constructor for the class.

		@param id: The identifier of this server, must be a non-empty string.
		@param host: The host of the ftp server.
		@param port: The port of the server.
		@param username: Username.
		@param password: Password.
		@param root: The root to assume for all relative paths.
		@param webserver: Identifier of the webserver this FTP server stores files for.
		"""

		if 0 != len(webserver) and False == Validator.validate_variable_name(webserver):
			raise InvalidParameterError("webserver", 'The webserver ID "%s" is invalid.' % (webserver))
		else:
			self.__webserver = webserver

		Server.__init__(self, id, Server.REMOTE)
		SftpClient.__init__(self, platform, host, username, password, port, root)