|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nitido.nim.Nugget
public abstract class Nugget
The Nugget class is the base class for all Nugget objects. Nuggets provide entities access to authenticated or non-authenticated back-end services. It is important to remember that Nuggets can only be instantiated through the createNugget() method on Entity. This ensures the all nugget instances are associated to an entity in the system.
Nuggets are used to access different types of services and as such different Nugget classes may have very different programming interfaces. This class provides the base Nugget interface.
Starting from NiM 2.3, all Nugget implementation should extends from the classes CachableNugget and NonCachableNugget instead of this class.
A CachableNugget will instantiated and attached to the associated Entity object. It will not be instantiated again unless the invoker explicitly release the Nugget instance from the Entity.
On the other hand, a NonCachableNugget will be instantiated everytime that getEntity() is invoked. A NonCachableNugget is usually used by Nugget implementations that are not thread safe. For example, a Nugget that needs to manages transaction that involves multiple method calls.
Field Summary | |
---|---|
protected Entity |
_entity
The entity this nugget is associated to. |
protected NiM |
_nim
Reference to the NiM object |
protected java.lang.String |
_nuggetName
The name associated with the Nugget. |
protected java.util.Hashtable |
_settings
The settings used to initialize this nugget. |
Constructor Summary | |
---|---|
Nugget(NuggetVisa visa)
This constructor is called by the Nugget kernel service to instantiate a new Nugget instance of a concrete type. |
Method Summary | |
---|---|
protected void |
activate()
This method is called by the Entity object after that object has been deserialized. |
protected void |
deactivate()
This method is called by the Entity object before that object is serialized. |
protected void |
destroy()
This method is invoked by com.nitido.nim.Entity object when the Entity has been signaled as "dying". |
protected void |
destroyImpl()
This method is invoked by the destroy() method when the associated Entity has been signaled as "dying". |
abstract java.lang.String |
getDescriptor()
This method returns a reference to the Nugget Descriptor. |
Entity |
getEntity()
This method returns the reference of the Entity object that owns this Nugget instance. |
java.lang.String |
getNuggetName()
Returns the nugget name. |
java.lang.String |
getSetting(java.lang.String name)
This method returns the first value that corresponds to the named setting. |
java.util.Hashtable |
getSettings()
This method returns a copy of the settings used to initialize the Nugget. |
void |
init(java.lang.String nuggetName,
Entity entity,
java.util.Hashtable settings)
This method is the base initialization method that should be called by NuggetService after a Nugget has been instantiated successfully. |
protected abstract void |
initImpl()
This method is called by the init() method after the member variables _nuggetName, _entity and _settings are assigned. |
abstract boolean |
isCachable()
This method indicates whether the Nugget implementation is a cachable nugget. |
void |
requestBegin()
This method is used to inform the Nugget that new requests are about to start. |
void |
requestEnd()
This method is used to inform the Nugget that requests are terminated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String _nuggetName
protected Entity _entity
protected java.util.Hashtable _settings
protected transient NiM _nim
Constructor Detail |
---|
public Nugget(NuggetVisa visa) throws NiMRuntimeException
visa
- Reference to a NuggetVisa object. This parameter is
required and can not be null.
NiMRuntimeException
- If the given visa object is null.Method Detail |
---|
public final void init(java.lang.String nuggetName, Entity entity, java.util.Hashtable settings) throws InitializationFailedException, InvalidSettingException
NOTE: this method is not supposed to be invoked by the application code at all. It is declared as a public method only because it can be invoked by the NuggetService implementations.
nuggetName
- The name associated to this nugget.entity
- Reference to the entity object the nugget is associated with.settings
- Reference to the settings used to initialize the nugget.
InitializationFailedException
InvalidSettingException
protected final void destroy()
protected abstract void initImpl() throws InitializationFailedException, InvalidSettingException
InitializationFailedException
- If unable to initialize the nugget with the given parameters.
InvalidSettingException
- If any of the expected initialization settings are null.protected void destroyImpl()
For example, the WcapNugget will need to login to a backend Calendar server. The Calendar server will return a session ID that will be used by the Nugget for later operations. So, when the Nugget is "deactivate()", it does not need to logout from the Calendar Server and keep the session ID as the Nugget's persistent member. However, when the Nugget is "destroy()", the Nugget should logout the user from the backend Calendar server.
The base implementation of this method does nothing.
public final java.util.Hashtable getSettings()
public final java.lang.String getSetting(java.lang.String name)
name
- The name of the Setting to retrieve.
protected void activate() throws ActivationException
ActivationException
- If unable to activate the Nuggetprotected void deactivate() throws ActivationException
ActivationException
- If unable to deactivate the Nuggetpublic java.lang.String getNuggetName()
public abstract java.lang.String getDescriptor()
public void requestBegin()
public void requestEnd()
public abstract boolean isCachable()
public final Entity getEntity()
|
Nitido NiM 2.5 Java API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1999-2009 Nitido Inc. Proprietary and Confidential. All Rights Reserved.