![]() ![]() ![]() ![]() |
State Factories |
Here are some examples of how state factories are used in the examples from Storing Objects in the Directory
lesson and this lesson.
- Reference example
. Fruit is a Referenceable
object. The service provider extracts its reference by using Referenceable.getReference
and stores the reference into the directory. No state factory is used.
- Attributes example
. Drink is a DirContext
object. The service provider extracts its attributes by using DirContext.getAttributes()
and stores the attributes into the directory. No state factory is used.
- Serialization example
No state factory is used. The service provider serializes the java.awt.Button object and stores its serialized form into the directory.
- Remote reference example
. The service provider stores the Reference
into the directory. No state factory is used.
- Remote object example
. A state factory (bundled with the service provider) turns the java.rmi.Remote object into a marshalled object, which is then stored by the service provider into the directory.
- CORBA example
. A state factory (bundled with the service provider) turns the CORBA object into a stringified CORBA object reference, which is then stored by the service provider into the directory.
- Custom object example
. The state factory PersonStateFactory turns a Person object into a set of attributes, which are then stored by the service provider into the directory. PersonStateFactory is identified in the application resource file used by the client program (CustomObj).
The rest of this lesson describes the state factory PersonStateFactory.
![]() ![]() ![]() ![]() |
State Factories |