com.guiseframework.platform
Class AbstractPlatform

java.lang.Object
  extended by com.guiseframework.platform.AbstractPlatform
All Implemented Interfaces:
Platform
Direct Known Subclasses:
AbstractWebPlatform

public abstract class AbstractPlatform
extends java.lang.Object
implements Platform

The platform on which Guise objects are being depicted.

Author:
Garret Wilson

Constructor Summary
AbstractPlatform(GuiseApplication application)
          Application constructor.
 
Method Summary
 long generateDepictID()
          Generates a new depict ID unique to this session platform.
 GuiseApplication getApplication()
           
 DepictedObject getDepictedObject(long depictedObjectID)
          Retrieves a depicted object that has been registered with the platform by the ID of the depicted object.
 java.util.concurrent.locks.Lock getDepictLock()
           
<O extends DepictedObject>
Depictor<? super O>
getDepictor(O depictedObject)
          Determines the depictor appropriate for the given depicted object.
protected
<O extends DepictedObject>
java.lang.Class<? extends Depictor<? super O>>
getDepictorClass(java.lang.Class<O> depictedObjectClass)
          Determines the depictor class appropriate for the given depicted object class.
protected
<O extends DepictedObject>
java.lang.Class<? extends Depictor<? super O>>
getRegisteredDepictorClass(java.lang.Class<? extends DepictedObject> depictedObjectClass)
          Determines the depictor class registered for the given depicted object class.
 java.util.Queue<? extends PlatformMessage> getSendMessageQueue()
           
 void registerDepictedObject(DepictedObject depictedObject)
          Registers a depicted object so that it can interact with the platform.
protected
<O extends DepictedObject>
java.lang.Class<? extends Depictor<? super O>>
registerDepictorClass(java.lang.Class<O> depictedObjectClass, java.lang.Class<?> depictorClass)
          Registers the class of a depictor to depict an object of the given class (and by default subclasses).
 void unregisterDepictedObject(DepictedObject depictedObject)
          Unregisters a depicted object so that no longer interacts with the platform.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.guiseframework.platform.Platform
getClientProduct, getDepictContext, getEnvironment, selectPlatformFiles, sendResource, sendResource, sendResource, sendResource
 

Constructor Detail

AbstractPlatform

public AbstractPlatform(GuiseApplication application)
Application constructor.

Parameters:
application - The Guise application running on this platform.
environment - The initial environment of the session.
Throws:
java.lang.NullPointerException - if the given application and/or environment is null.
Method Detail

getApplication

public GuiseApplication getApplication()
Specified by:
getApplication in interface Platform
Returns:
The Guise application running on this platform.

getDepictLock

public java.util.concurrent.locks.Lock getDepictLock()
Specified by:
getDepictLock in interface Platform
Returns:
The lock used for exclusive depiction on the platform.

registerDepictorClass

protected <O extends DepictedObject> java.lang.Class<? extends Depictor<? super O>> registerDepictorClass(java.lang.Class<O> depictedObjectClass,
                                                                                                          java.lang.Class<?> depictorClass)
Registers the class of a depictor to depict an object of the given class (and by default subclasses).

Type Parameters:
O - The type of registered depicted object class.
Parameters:
depictedObjectClass - The class of the depicted object for which the depictor should be registered.
depictorClass - The class of depictor to use for depicting the objects.
Returns:
The depictor class previously registered with the given depicted object class, or null if there was no previous registration.

getRegisteredDepictorClass

protected <O extends DepictedObject> java.lang.Class<? extends Depictor<? super O>> getRegisteredDepictorClass(java.lang.Class<? extends DepictedObject> depictedObjectClass)
Determines the depictor class registered for the given depicted object class.

Type Parameters:
O - The type of registered depicted object class.
Parameters:
depictedObjectClass - The class of depicted object that may be registered.
Returns:
The class of depictor registered to depict object of the specific class, or null if no depictor is registered.

getDepictorClass

protected <O extends DepictedObject> java.lang.Class<? extends Depictor<? super O>> getDepictorClass(java.lang.Class<O> depictedObjectClass)
Determines the depictor class appropriate for the given depicted object class. A depicted class is located by individually looking up the depicted object class hiearchy for registered depictors.

Type Parameters:
O - The type of registered depicted object class.
Parameters:
depictedObjectClass - The class of depicted object for which a depictor should be returned.
allowDefault - Whether a default depictor for the depicted object class should be accepted.
Returns:
A class of depictor for the given depicted object class, or null if no depictor is registered.

getDepictor

public <O extends DepictedObject> Depictor<? super O> getDepictor(O depictedObject)
Determines the depictor appropriate for the given depicted object. A depictor class is located by individually looking up the depicted object class hiearchy for registered depictor classes.

Specified by:
getDepictor in interface Platform
Type Parameters:
O - The type of depicted object.
Parameters:
depictedObject - The depicted object for which a depictor should be returned.
Returns:
A depictor to depict the given component, or null if no depictor is registered.
Throws:
java.lang.IllegalStateException - if the registered depictor could not be instantiated for some reason.

registerDepictedObject

public void registerDepictedObject(DepictedObject depictedObject)
Registers a depicted object so that it can interact with the platform.

Specified by:
registerDepictedObject in interface Platform
Parameters:
depictedObject - The depicted object to register.
Throws:
java.lang.NullPointerException - if the given depicted object is null.

unregisterDepictedObject

public void unregisterDepictedObject(DepictedObject depictedObject)
Unregisters a depicted object so that no longer interacts with the platform.

Specified by:
unregisterDepictedObject in interface Platform
Parameters:
depictedObject - The depicted object to unregister.
Throws:
java.lang.NullPointerException - if the given depicted object is null.

getDepictedObject

public DepictedObject getDepictedObject(long depictedObjectID)
Retrieves a depicted object that has been registered with the platform by the ID of the depicted object.

Specified by:
getDepictedObject in interface Platform
Parameters:
depictedObjectID - The ID of the depicted object to retrieve.
Returns:
The registered depicted object with the given ID, or null if there is no depicted object registered with this platform with the given ID.

generateDepictID

public long generateDepictID()
Generates a new depict ID unique to this session platform.

Specified by:
generateDepictID in interface Platform
Returns:
A new depict ID unique to this session platform.

getSendMessageQueue

public java.util.Queue<? extends PlatformMessage> getSendMessageQueue()
Specified by:
getSendMessageQueue in interface Platform
Returns:
The thread-safe queue of messages to be delivered to the platform.


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.