Package puremvc :: Module core :: Class Model
[hide private]
[frames] | no frames]

Class Model

source code

       object --+    
                |    
interfaces.IModel --+
                    |
                   Model

A Multiton IModel implementation.

In PureMVC, the Model class provides access to model objects (Proxies) by named lookup.

The Model assumes these responsibilities:

Your application must register IProxy instances with the Model. Typically, you use an ICommand to create and register IProxy instances once the Facade has initialized the Core actors.


See Also:
Proxy, IProxy
Instance Methods [hide private]
 
__init__(self, key)
Constructor.
source code
 
initializeModel(self)
Initialize the Model instance.
source code
 
registerProxy(self, proxy)
Register an IProxy with the Model.
source code
 
retrieveProxy(self, proxyName)
Retrieve an IProxy from the Model.
source code
 
hasProxy(self, proxyName)
Check if a Proxy is registered
source code
 
removeProxy(self, proxyName)
Remove an IProxy from the Model.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
removeModel(cls, key)
Remove an IModel instance.
source code
 
getInstance(cls, key)
Model Multiton Factory method.
source code
Class Variables [hide private]
  instanceMap = {}
Multiton error message
  MULTITON_MSG = 'Model multiton instance for this key is alread...
Instance Variables [hide private]
  proxyMap
The Multiton Key for this Core
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

removeModel(cls, key)
Class Method

source code 

Remove an IModel instance.

Parameters:
  • key - of IModel instance to remove

getInstance(cls, key)
Class Method

source code 

Model Multiton Factory method.

Returns:
the instance for this Multiton key

__init__(self, key)
(Constructor)

source code 

Constructor.

This IModel implementation is a Multiton, so you should not call the constructor directly, but instead call the static Multiton Factory method Model.getInstance( multitonKey )

Raises:
  • MultitonError - if instance for this Multiton key instance has already been constructed
Overrides: object.__init__

initializeModel(self)

source code 

Initialize the Model instance.

Called automatically by the constructor, this is your opportunity to initialize the Singleton instance in your subclass without overriding the constructor.

registerProxy(self, proxy)

source code 

Register an IProxy with the Model.

Parameters:
  • proxy - an IProxy to be held by the Model.
Overrides: interfaces.IModel.registerProxy

retrieveProxy(self, proxyName)

source code 

Retrieve an IProxy from the Model.

Parameters:
  • proxyName - the name of the IProxy
Returns:
the IProxy instance previously registered with the given proxyName.
Overrides: interfaces.IModel.retrieveProxy

hasProxy(self, proxyName)

source code 

Check if a Proxy is registered

Parameters:
  • proxyName - the name of the IProxy
Returns:
whether a Proxy is currently registered with the given proxyName.
Overrides: interfaces.IModel.hasProxy

removeProxy(self, proxyName)

source code 

Remove an IProxy from the Model.

Parameters:
  • proxyName - name of the IProxy instance to be removed.
Returns:
the IProxy that was removed from the Model
Overrides: interfaces.IModel.removeProxy

Class Variable Details [hide private]

MULTITON_MSG

Value:
'Model multiton instance for this key is already constructed!'