Java Coding Tutorial
Write a Service from scratch
- Decide which CORBA interface out of
dwarf/idl/DWARF/Service.idl
is the most suitable (e.g. PickyService)
- Open a new directory for the service (see DwarfCVSStructureTutorial)
- Write your class implementing the
startService
and stopService
methods. These must register a handler object for all needs and abilities (e.g. SvcProtPushSupplier
,see Communication Interfaces (Protocols)
on page DwarfDocumentation)
Write a Service using the TemplateService (recommended)
For implementing a Service by use of the
TemplateService do the following: Use Eclispe or pure shell tools
In case of
Eclipse do the following:
- Open a new directory for the service (see DwarfCVSStructureTutorial)
- Open a corresponding project in Eclipse
- Create a new class in this project by extending from the TemplateService to generate your own service class. Name this class
&
In case of
Pure shell:
- Go to the directory
dwarf/src/templates/javaservice
and read the README
file first.
- Execute the
create_files.sh
script. You will be asked for serveral informations, that will be inserted in the generated Service's files.
- Move the generated directory to
dwarf/src/services
In Both cases do finally:
- Override the generated method bodies in the only class you find. In the two create[Ability|Need]Object methods must return instances that inherit from the corresponding interface of the [Ability|Need]Description, e.g.
SvcProtPushSupplier
(see Communication Interfaces (Protocols)
on page DwarfDocumentation). The last line of the method must be return <YOUR_OBJECT>._this(orb);
in order to return a valid CORBA object.
- Let the thread in the
runThread
die if you need no extra executions (like reading from a Socket connection)
- now see the DwarfIntegrationTutorial for further steps
Write a Service using the BaseService
This is currently under development.
--
MarcusToennis - 04 Jan 2006