Browse Source

Added MvC operations to wrapper as well

Yentl Van Tendeloo 8 years ago
parent
commit
95a47189f3
1 changed files with 170 additions and 5 deletions
  1. 170 5
      wrappers/modelverse.py

+ 170 - 5
wrappers/modelverse.py

@@ -42,7 +42,78 @@ class CompilationError(Exception):
 class NoSuchAttribute(Exception):
     pass
 
-# Actual functions to use for the wrapper
+class UnknownModel(Exception):
+    pass
+
+class ConnectionError(Exception):
+    pass
+
+class ModelExists(Exception):
+    pass
+
+class PermissionDenied(Exception):
+    pass
+
+# Main MvC operations
+def init():
+    """Starts up the connection to the Modelverse."""
+    pass
+    # return None
+    # raises ConnectionError
+    # raises UnknownError
+
+def login(username, password):
+    """Log in an existing user."""
+    pass
+    # return None
+    # raises UnknownError
+    # raises PermissionDenied
+
+def register(username, password):
+    """Register a new user."""
+    pass
+    # return None
+    # raises UnknownError
+    # raises UserExists
+
+def model_add(model_name, metamodel_name):
+    """Instantiate a new model."""
+    pass
+    # return None
+    # raises UnknownModel
+    # raises ModelExists
+    # raises UnknownError
+
+def model_modify(model_name):
+    """Modify an existing model."""
+    pass
+    # return is_write
+    # raises UnknownModel
+    # raises PermissionDenied
+    # raises UnknownError
+
+def model_list():
+    """List all models."""
+    pass
+    # return [(model1, metamodel1), (model2, metamodel2), ...]
+    # raises UnknownError
+
+def model_list_full():
+    """List full information on all models."""
+    pass
+    # return [(model1, metamodel1, owner1, group1, permissions1), (model2, metamodel2, owner2, group2, permissions2), ...]
+    # raises UnknownError
+
+def model_overwrite(model_name, new_model):
+    """Upload a new model and overwrite an existing model."""
+    pass
+    # return None
+    # raises UnknownModel
+    # raises PermissionDenied
+    # raises CompilationError
+    # raises UnknownError
+
+# Actual operations on the model
 def list():
     """Return a list of all IDs and the type of the element"""
     pass
@@ -68,11 +139,105 @@ def read_attrs(ID):
     # return {attr1: value1, attr2: value2, ...}
     # raises UnknownError
 
-def verify():
-    """Return the result of conformance checking (OK = conforms, otherwise error message)"""
+def transformation_add_MT_language():
+    """Create a new Model Transformation language out of a set of metamodels."""
+    raise NotImplementedError()
+
+def transformation_add_MT():
+    """Create a new model transformation."""
+    raise NotImplementedError()
+
+def transformation_add_AL():
+    """Create a new action language fragment."""
+    raise NotImplementedError()
+
+def transformation_add_MANUAL():
+    """Create a new manual model operation."""
+    raise NotImplementedError()
+
+def transformation_execute():
+    """Execute an existing model operation."""
+    raise NotImplementedError()
+
+def transformation_list():
+    """List existing model operations."""
+    raise NotImplementedError()
+
+def transformation_list_full():
+    """List detailed information on model operations."""
+    raise NotImplementedError()
+
+def transformation_detail():
+    """List full details of a a model operation."""
+    raise NotImplementedError()
+
+def transformation_RAMify():
+    """Ramify an existing metamodel."""
+    raise NotImplementedError()
+
+def process_execute():
+    """Execute a process model."""
+    raise NotImplementedError()
+
+def permission_modify():
+    """Modify permissions of a model."""
+    raise NotImplementedError()
+
+def permission_owner():
+    """Modify the owning user of a model."""
+    raise NotImplementedError()
+
+def permission_group():
+    """Modify the owning group of a model."""
+    raise NotImplementedError()
+
+def group_create():
+    """Create a new group."""
+    raise NotImplementedError()
+
+def group_delete():
+    """Delete a group of which you are an owner."""
+    raise NotImplementedError()
+
+def group_owner_add():
+    """Add a new owning user to a group you own."""
+    raise NotImplementedError()
+
+def group_owner_delete():
+    """Delete an owning user to a group you own."""
+    raise NotImplementedError()
+
+def group_join():
+    """Add a new user to a group you own."""
+    raise NotImplementedError()
+
+def group_kick():
+    """Delete a user from a group you own."""
+    raise NotImplementedError()
+
+def group_list():
+    """List existing groups."""
+    raise NotImplementedError()
+
+def admin_promote():
+    """Promote a user to admin status."""
+    raise NotImplementedError()
+
+def admin_demote():
+    """Demote a user from admin status."""
+    raise NotImplementedError()
+
+def user_logout():
+    """Log out the current user. A new login will be required afterwards."""
     pass
-    # return "OK"
-    # raises UnknownError
+    # return None
+    # raises UnknownException
+
+def user_delete():
+    """Removes the current user. A new login will be required afterwards."""
+    pass
+    # return None
+    # raises UnknownException
 
 def instantiate(typename, edge=None, ID=""):
     """Create a new instance of the specified typename, between the selected elements (if not None), and with the provided ID (if any)"""