Created
March 3, 2016 14:09
-
-
Save drhanlau/f1f59ddddda12d9b6029 to your computer and use it in GitHub Desktop.
File Server of Facade Pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FileServer(Server): | |
def __init__(self): | |
'''actions required for initializing the file server''' | |
self.name = 'FileServer' | |
self.state = State.new | |
def boot(self): | |
print('booting the {}'.format(self)) | |
'''actions required for booting the file server''' | |
self.state = State.running | |
def kill(self, restart=True): | |
print('Killing {}'.format(self)) | |
'''actions required for killing the file server''' | |
self.state = State.restart if restart else State.zombie | |
def create_file(self, user, name, permissions): | |
'''check validity of permissions, user rights, etc.''' | |
print("trying to create the file '{}' for user '{}' with permissions {}".format(name, user, permissions)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment