Services, which are automatically injected into any domain object that needs them, are just ordinary domain objects but with an getId() identity method. The method recognised is:
public String getId()
This identity method is currently used only by perspectives, when registering services. (Strictly speaking the getId() method is optional; if not present then the fully qualified class name is used as the Id).
All the other methods are processed as for domain objects, as described in a previous section.
To simplify the process of writing service objects the following abstract classes are available from within the application library:
In addition there are classes within the framework that assist building services that need to integrate with the framework.
Services are registered with the Framework at startup via the properties file, using the services properties. The services property itself dictates which service classes are to be instantiated at startup, for example:
nakedobjects.services = bom.BookingFactory, bom.CustomerFactoryAndRepository, \ bom.LocationFactoryAndRepository
The prefix property allows you to specify the common package once and, hence omit them from the classes in the list. The following set of properties is therefore equivalent to the previous example.
nakedobjects.services.prefix = bom nakedobjects.services = BookingFactory, CustomerFactoryAndRepository, \ LocationFactoryAndRepository
As well as services defined programmatically, it is possible to use a repository provided by the framework that will, for a configured object type, provide methods to:
To register such a service prefix the class name with 'repository#', for example:
nakedobjects.services = repository#bom.Booking
TODO
TODO