org.nakedobjects.runtime.persistence.adaptermanager
Interface AdapterManager

All Superinterfaces:
AdapterManagerLookup, Injectable
All Known Subinterfaces:
AdapterManagerBackdoor, AdapterManagerExtended
All Known Implementing Classes:
AdapterManagerAbstract, AdapterManagerDefault

public interface AdapterManager
extends AdapterManagerLookup, Injectable

Responsible for managing the adapters and identities for each and every POJO that is being used by the framework.

It provides a consistent set of adapters in memory, providing an adapter for the POJOs that are in use ensuring that the same object is not loaded twice into memory.

Each POJO is given an adapter so that the framework can work with the POJOs even though it does not understand their types. Each POJO maps to an adapter and these are reused.


Method Summary
 NakedObject adapterFor(java.lang.Object pojo)
          Either returns an existing adapter (as per AdapterManagerLookup.getAdapterFor(Object)), otherwise creates either a transient root or a standalone adapter for the supplied domain object, depending on its NakedObjectSpecification.
 NakedObject adapterFor(java.lang.Object pojo, NakedObject ownerAdapter, Identified identified)
          Either returns an existing adapter (as per AdapterManagerLookup.getAdapterFor(Object)), otherwise creates either a transient, standalone or aggregated adapter for the supplied domain object, depending on its NakedObjectSpecification and the context arguments provided.
 void removeAdapter(NakedObject adapter)
          Removes the specified adapter from the identity maps.
 void removeAdapter(Oid oid)
          Removes the adapter identified by the specified Oid.
 
Methods inherited from interface org.nakedobjects.runtime.persistence.adaptermanager.AdapterManagerLookup
getAdapterFor, getAdapterFor
 
Methods inherited from interface org.nakedobjects.metamodel.commons.component.Injectable
injectInto
 

Method Detail

adapterFor

NakedObject adapterFor(java.lang.Object pojo,
                       NakedObject ownerAdapter,
                       Identified identified)
Either returns an existing adapter (as per AdapterManagerLookup.getAdapterFor(Object)), otherwise creates either a transient, standalone or aggregated adapter for the supplied domain object, depending on its NakedObjectSpecification and the context arguments provided.

If no adapter is found for the provided pojo, then the rules for creating the adapter are as follows:

Parameters:
pojo - - pojo to adapt
ownerAdapter - - only used if aggregated
identifier - - only used if aggregated

adapterFor

NakedObject adapterFor(java.lang.Object pojo)
Either returns an existing adapter (as per AdapterManagerLookup.getAdapterFor(Object)), otherwise creates either a transient root or a standalone adapter for the supplied domain object, depending on its NakedObjectSpecification.

The rules for creating a standalone vs transient root adapter are as for adapterFor(Object, NakedObject, Identified).

Historical notes: previously called createAdapterForTransient, though this name wasn't quite right.


removeAdapter

void removeAdapter(NakedObject adapter)
Removes the specified adapter from the identity maps.


removeAdapter

void removeAdapter(Oid oid)
Removes the adapter identified by the specified Oid.

Should be same as AdapterManagerLookup.getAdapterFor(Oid) followed by removeAdapter(NakedObject).



Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.