background image

Adding Services and Service Bindings

<< Adding Classifications | Publishing an Organization >>
<< Adding Classifications | Publishing an Organization >>
M
ANAGING
R
EGISTRY
D
ATA
189
Adding Services and Service Bindings to an
Organization
Most organizations add themselves to a registry in order to offer services, so the
JAXR API has facilities to add services and service bindings to an organization.
Like an
Organization
object, a
Service
object has a name, a description, and a
unique key that is generated by the registry when the service is registered. It may
also have classifications associated with it.
A service also commonly has service bindings, which provide information about
how to access the service. A
ServiceBinding
object normally has a description,
an access URI, and a specification link, which provides the linkage between a
service binding and a technical specification that describes how to use the ser-
vice by using the service binding.
The following code fragment shows how to create a collection of services, add
service bindings to a service, and then add the services to the organization. It
specifies an access URI but not a specification link. Because the access URI is
not real and because JAXR by default checks for the validity of any published
URI, the binding sets its
validateURI
property to false.
// Create services and service
Collection<Service> services = new ArrayList<Service>();
InternationalString s =
blcm.createInternationalString("My Service Name"));
Service service = blcm.createService(s);
s = blcm.createInternationalString("My Service Description");
service.setDescription(is);
// Create service bindings
Collection<ServiceBinding> serviceBindings =
new ArrayList<ServiceBinding>();
ServiceBinding binding = blcm.createServiceBinding();
s = blcm.createInternationalString("My Service Binding " +
"Description");
binding.setDescription(is);
// allow us to publish a fictitious URI without an error
binding.setValidateURI(false);
binding.setAccessURI("http://TheCoffeeBreak.com:8080/sb/");
serviceBindings.add(binding);
// Add service bindings to service
service.addServiceBindings(serviceBindings);