public class UIDescriptor extends AbstractEntry
Entrythat enables a UI for a service to be associated with the service in the attribute sets of the service item.
UIDescriptorholds a marshalled UI factory object, as well as a role string, a sub-role string, and set of attributes that describe the UI generated by the factory.
|Modifier and Type||Field and Description|
An unmodifiable set of objects that describe the UI generated by the marshalled UI factory.
Gives the fully qualified name of the interface that represents the role of the UI generated by the marshalled UI factory.
|Constructor and Description|
|Modifier and Type||Method and Description|
A convenience method for unmarshalling the UI factory stored in the
clone, equals, equals, hashCode, hashCode, toString, toString
public String role
For a client program to be able to use a UI, the client has to have prior knowledge
of the UI semantics, which is defined by the UI's role type. Thus, for a client
to be able to use a UI, the client must understand the semantics
of the type whose fully qualified name is given in the
referenced from the
role field of that UI's
For example, two role types that are defined in the
package by the Jini Service UI Specification are
MainUI, for a main UI
to a Jini service, and
AdminUI, for an administration UI. Other role types
may be defined by the Jini Service UI Specification and by individual Jini service API
As the strings referenced from the
role field are Java type names, they
are intended to be manipulated by client programs only. They should not be shown to a user.
public String toolkit
Stringto facilitate searching whose value represents the main UI toolkit (for example Swing or AWT) which the produced UI makes use of. The value to which this field should be set is defined by the semantics of the factory type. (This field is intended to facilitate searches. For example, a client can search for all blender services that have Swing MainUI's.)
public Set attributes
public MarshalledObject factory
get()method of this
MarshalledObjectmust return an object that implements one or more UI factory interfaces. The actual UI factory type or types implemented by the returned object must be described by a
UIFactoryTypesattribute placed in the attributes set of this
UIDescriptorwith all fields set to
public UIDescriptor(String role, String toolkit, Set attributes, MarshalledObject factory)
UIDescriptorwith the fields set to passed values. This constructor copies the contents of the passed attributes
Setinto a serializable read-only
Setthat has a consistent serialized form across all VMs, and initializes the
attributesfield with the consistent
role- the role
toolkit- the toolkit
attributes- the attributes
factory- the factory
public final Object getUIFactory(ClassLoader parentLoader) throws IOException, ClassNotFoundException
MarshalledObjectreferenced from the
factoryfield. This method saves a reference to the current context class loader, sets the context class loader to the class loader passed as
get()on the marshalled object, then resets the context class loader to the saved reference before returning the object produced by
The class loader
parentLoader should be able to load classes
needed when the UI interacts with the
roleObject passed as the first
parameter to the factory method. For example, if the
the service item (as it is for the
roles), the class loader passed in
parentLoader could be
the class loader with which the service proxy object referenced
from the service item's
service field was loaded.
Object uiFactory = uiDescriptor.getUIFactory( serviceItem.service.getClass().getClassLoader());
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.