This is a brief explanation of the domain printer demo. 
$Id: readme,v 1.2 2001/03/20 09:47:39 jacorb Exp $

The domain printer demo serves four goals:

	1) gives a basic introduction to domains
	2) shows how to create a domain and put an object and a policy into it
	3) shows how to obtain the policy of an object via the domain interface
	4) motivates the usage of the domain browser



1) basic introduction to domains
================================

Domains   are   used   for   grouping   objects   to   form   managing
units.  Basically  a domain  is  a  container  which holds  object  and
policies. All the object members of a domain share the policies of this
domain. A  policy is  an object which  might express any  attribute or
algorithm. The only  restriction is that its interface  has to inherit
from CORBA::Policy.  The IDL  for the domain  service can be  found at
<JacORB base dir>/idl/jacorb/DomainManagement.idl


1a) demo scenario  
=================

This is just a simple demo.  So  we simply have a printer object and a
spooler object.  Print  requests are not directly sent  to the printer
but  go to  the spooler  instead.   The spooler  calculates the  price
(paper is  considered valuable) for the  print job. It  does this with
the help  of a local  version of the  domain service. And  that's what
this demo is about.


2) create a domain and put an object and policy into it
======================================================= 

The code is in Server.java. To  obtain a reference to the local domain
service,                the                orb               operation
resolve_initial_references("LocalDomainService") is used. The returned
domain is  always local the calling  process. Then a  policy object is
created. For the creation of  objects every domain implements a policy
factory interface. Afterwards some properties are put into the created
property policy.  Property policies  are just a generalization of java
properties  with the  help of  IDL. The  policy is  inserted  into the
domain by  the operation  "set_domain_policy".  The printer  object is
inserted  into  the domain  by  the operation  "insertMemberWithName".
Alternatively there is also the operation "insertMember" which inserts
with a default name. Don't worry about naming.

What  does this mean now ?

Well, the printer object is governed  by the price policy. Go on to 4)
to hear how the spooler gets this information out of the domain.


3) obtain the policy of an object
=================================

This is the  simplest thing to do. When the  spooler processes a print
request  it   calls  the   operation  "_get_policy"  on   the  printer
object. Note  that this operation is from  the CORBA::Object interface
and  can be  called on  every object.   It must  tell which  policy it
wants. To this end, every policy  has a policy unique type. The policy
type the  spooler wants is PRICE_POLICY_TYPE. The  domain service does
all that is necessary to obtain the policy associated with the printer
object.   The spooler  now  interprets  this policy  by  casting to  a
property  policy and  extracts the  value  for the  price of  printing
bytes. On this basis it calculates the price.

There  is an  alternative  way to  obtain  the policy  of the  printer
object. Just  call the operation "get_domain_managers"  on the printer
object and it will return the  one domain which has the printer object
as member and the price policy  as domain policy. To extract the price
policy from the domain call "get_domain_policy(PRICE_POLICY_TYPE).

4) motivates the usage of the domain browser
============================================

Prices  are subject to  change. To  change the  price for  the printer
object   you  can   use   a  graphical   tool,   the  domain   browser
(org.jacorb.orb.domain.gui.Browser).  Simply start it with the command
line  arguments  "-f  printerDemo_ORBDomain".   The  server  writes  a
reference to the created domain  into this file.  With the browser you
can navigate to the price policy  of the printer object and change the
prices.

What's  left ?   A lot.   You can  do various  things with  the domain
service. To  name a few, you can  have a global version  of the domain
service,  the domain  server, and  you can  have multiple  domains and
create  parent-child  relationships  between  them.   Objects  can  be
members in  multiple domains and  there is even an  adaptable conflict
resolution  mechanism  for  conflicting  policies.  There  will  be  a
thorough description  of the domain service. Unfortunately  it will be
available only in German.


 
