A JAXR client views the registry as a set of objects whose types are defined in the
javax.xml.registry.infomodel
package. The information model is based on the one defined by the ebXML registry/repository specification, with some minor differences. A JAXR provider for a particular registry is required to
Figure 7-6 shows a small part of the complete JAXR registry model, illustrating the elements that are of greatest importance to most JAXR clients. The first thing to note about this diagram is that it contains only Java interfaces. In fact, ignoring exceptions, the JAXR API contains only one class that is not an interface. The use of interfaces allows a JAXR provider to supply its own implementation classes for each element of the information model without exposing them to application code. From the client application's point of view, this has the effect that objects within the registry cannot be created directly ” instead, they are obtained from using factory
A business that submits information to the registry is represented by an
Organization
object. Associated with each
Organization
is a distinguished person called the primary contact, represented by a
An organization usually enters itself into a registry in order to advertise its services. Each such service is represented by a
Service
object. In the JAXR information model, a
Service
object is bound to an organization and therefore organizations offering identical services cannot share the same registry entries for those services.
Service
is actually a simple container object that references one or more
ServiceBinding
s. A
ServiceBinding
contains the information that a client might need to use a service, including the URI at which the service can be reached, and,
In the case of a UDDI registry, a WSDL definition for a service is referenced using its URI, whereas an ebXML registry might actually contain a copy of the definition itself. This illustrates an important difference between these two registry types: a UDDI registry is a pure registry and contains only metadata, whereas the ebXML registry is also a repository, allowing the storage of objects as well as metadata. In terms of the JAXR API, the repository functionality is
A class hierarchy diagram covering most of the interfaces that form the JAXR registry information model is shown in Figure 7-7. The complete set of interfaces, together with a brief description of their function, is listed in Table 7-1. More detailed descriptions will be found later in this chapter. The presence of a
symbol in the "Level 0 methods" column indicates that the interface includes at least one method that can be used with a level 0 JAXR provider. If this column is empty, then the interface is (at least currently) of use only with a level 1 provider. When a
symbol appears in both the "Level 0 methods" and "Level 1 methods"
|
Interface |
Level 0 methods |
Level 1 methods |
Description |
|---|---|---|---|
|
Association |
|
Represents an association between two entities in the registry. An association has a type, which reflects the kind of relationship being described. An example of this is
Replaces
, which could be used to
|
|
|
AuditableEvent |
|
An entry in the audit trail for an object in the registry. Only level 1 registries provide auditing, which is described in Section 7.5.9.4, later in this chapter. |
|
|
Classification |
|
Represents a classification that can be applied to a registry object. Applying one or more classifications to an object can make it much easier for clients to locate businesses and services of interest. See Section 7.4.4, later in this chapter. |
|
|
ClassificationScheme |
|
|
A scheme used to classify registry objects. See Section 7.4.4 later in this chapter for further information. |
|
Concept |
|
A facet of the JAXR registry model that maps onto several different features of the UDDI and ebXML registries. Concepts are typically used to represent nodes in a classification scheme or elements of an enumerated type. |
|
|
EmailAddress |
|
Represents an email address associated with a User object. A User may have any number of email addresses. |
|
|
ExtensibleObject |
|
The base interface for all objects within the registry. ExtensibleObject provides methods that allow arbitrary attributes to be added to a registry object without the need for an additional API. See Section 7.4.3 later in this chapter for a description of this interface. |
|
|
ExternalIdentifier |
|
A string value that may be attached to a registry object to provide additional identification information for that object. See Section 7.4.2 later in this chapter for further information. |
|
|
ExternalLink |
|
Used to associate a link to additional information with a registry object. The most common use of an external link is to include a reference to the home page of the organization that submitted the registry object. |
|
|
ExtrinsicObject |
|
Represents stored data that is not of a type that the registry can handle directly, such as a document or an image file. ExtrinsicObject s can only be used with a level 1 registry provider. See Section 7.5.9.1 later in this chapter for an example of the use of this facility. |
|
|
InternationalString |
|
U sed in the JAXR API where a string that may need to be localized is required. It contains a LocalizedString instance for each locale for which a representation of the string has been supplied. |
|
|
Key |
|
Each object in the registry is assigned a unique identifier when it is created. The value of this identifier is held within the RegistryObject as a Key object. The key can be used to fetch the object at a later time, or to delete it. See Section 7.4.2 for further information. |
|
|
LocalizedString |
|
A localized version of a string, together with its associated locale and character set. LocalizedString s are wrapped within InternationalString s. |
|
|
Organization |
|
|
Represents a business within the registry. See Section 7.5.5.1, later in this chapter. |
|
PersonName |
|
|
Represents the name of a registry user. See Section 7.5.5.1, later in this chapter. |
|
PostalAddress |
|
Represents the address of a user or (for a level 1 registry) an organization. Unfortunately, as described in Section 7.5.7, later in this chapter, this is not as simple a topic as you might expect. |
|
|
RegistryEntry |
|
A subinterface of RegistryObject from which a small number of objects in the registry information model are derived. See Section 7.4.2 later in this chapter for more information. |
|
|
RegistryObject |
|
|
Defines the attributes and methods that form part of every object stored in the registry. See Section 7.4.2 later in this chapter for a more complete description. |
|
RegistryPackage |
|
A container class that allows registry objects to be grouped together. Holding a set of objects in a RegistryPackage makes it simple to get a list of them all at a later time, perhaps in order to remove them all. RegistryPackage s are supported only by level 1 providers. |
|
|
Service |
|
Represents a service advertised by an organization. A Service contains one or more ServiceBindings . |
|
|
ServiceBinding |
|
Contains the information necessary for a client to invoke an instance of a service and may also refer, via SpecificationLink s, to technical information regarding the service. See Section 7.5.5.2 later in this chapter for details. |
|
|
Slot |
|
Used to attach additional attributes to ExtensibleObject s as described in Section 7.4.3, later in this chapter. |
|
|
SpecificationLink |
|
Used to add a reference to a technical description to a ServiceBinding . The link may be a URI or, in the case of a level 1 registry, may refer to an ExtrinsicObject in the repository. |
|
|
TelephoneNumber |
|
|
Represents a telephone number for a registry user. See Section 7.5.5.1 later in this chapter. |
|
URIValidator |
|
A
n interface implemented by other objects that contain a URI and that may optionally be
|
|
|
User |
|
|
Represents a user of the registry. References to User objects also appear in the audit trail maintained by level 1 registries. See Section 7.5.5.1 and Section 7.5.9.4 later in this chapter for further details. |
|
Versionable |
|
An interface implemented by objects that might have associated version
|
RegistryObject is the base interface from which almost all of the other interfaces that represent entities stored in the registry are derived. RegistryObject is itself derived from ExtensibleObject , a simple interface that makes it possible to add additional attributes to any object in the registry, as described later in Section 7.4.3. Only very simple objects that exist as part of other entities in the registry, such as PersonName , EMailAddress , and TelephoneNumber , are not derived from RegistryObject .
Every RegistryObject has a set of basic attributes, which are shown in the class diagram in Figure 7-8 and described in the following paragraphs.
The name of the RegistryObject is of type InternationalString , reflecting the fact that it might need to be localized. This field typically contains the name of an Organization or the title of a Service . Registry searches can be performed based on the value of this attribute.
Like the name attribute, the description is also an InternationalString . It is intended to contain localized text that will help a potential client searching the registry to determine whether the corresponding Organization or Service is what he requires.
Each entry in the registry has a unique identifier that can be used to locate it without requiring a search based on the name or other criteria. The key is assigned by the registry when the entry is created and never changes. Both the ebXML and UDDI registries assign 128-bit DCE unique identifiers (UUIDs) to newly created objects, which the JAXR provider wraps in a
Key
object. UUIDs are
[3] The specification for the UUID generation algorithm is available for purchase or online viewing (following registration) at http://www.opengroup.org/
publications /catalog/c706.htm.
Identifies the type of the registry object. The values that may appear in this field are Concept s defined in a classification scheme called ObjectType , which will be described later in Section 7.4.4. This attribute is valid only for RegistryObject s in a level 1 registry.
Identifies the Organization that submitted this object to the registry.
A collection containing the associations between this object and other objects within the registry. Associations are discussed later in this chapter. Although this attribute is common to all RegistryObject s, there may be limitations on its applicability. In the case of the UDDI registry, for example, the JAXR provider allows associations to be made only between Organization s.
A collection of ExternalLink objects containing links to information held outside the registry.
A collection of ExternalIdentifier objects. An ExternalIdentifier can be used to associate with a RegistryObject an identifier that is assigned by a recognized agency and that might be useful to registry clients. An example of this is the nine-digit Dun and Bradstreet D-U-N-S number (see http://www.dnb.com) that uniquely identifies a registered company. External identifiers are scoped by a classification scheme that acts as a namespace for the actual value. The D and B numbering scheme, for example, is represented by a classification scheme with a UUID value of 8609C81E-EE1F-4D5A-B202-3EB13AD01823.
A collection of
Classification
objects that apply to the
RegistryObject
. Unlike external identifiers that
A collection of AuditableEvent objects that record operations performed on the RegistryObject that caused changes to its state. Auditing, described later in this chapter, is supported only by level 1 registries.
Slots are inherited from
ExtensibleObject
and are described in the
Four interfaces in the JAXR information model ( Service , ClassificationScheme , ExtrinsicObject , and RegistryPackage ) are based on a derived interface of RegistryObject called RegistryEntry . RegistryEntry has the following additional attributes that are meaningful only when the object is stored in a level 1-compatible registry (such as an ebXML registry):
A RegistryEntry has three version-related attributes that can be managed using the methods of the Versionable interface, from which it is derived. The major and minor version numbers are both integers, the initial values for which are set by the registry when the object is first created. The values may be explicitly changed using the methods of the Versionable interface, and may also be changed by the registry if the RegistryEntry is modified in any way. There is also a user version, which is a string value that can be set and read by application code. It is intended to be the version of the object as seen by registry users and is not modified by the registry itself.
This attribute indicates whether the content of the
RegistryEntry
may change. The value
RegistryEntry.STABILITY_STATIC
means that the content will not change;
RegistryEntry.STABILITY_DYNAMIC_COMPATIBLE
implies that although the content might change, its new value will be
The expiration attribute is a java.util.Date object that indicates the time up to which the value of the stability attribute is valid. If it has the value null , then the stability attribute is valid indefinitely. Otherwise, the stability of the entry is effectively RegistryEntry.STABILITY_DYNAMIC once the expiration time has passed.
This attribute corresponds to the state of the RegistryEntry within its overall life cycle. When initially created, the object has the state RegistryEntry.STATE_SUBMITTED . The state may then change to RegistryEntry.STATE_APPROVED , RegistryEntry.STATE_WITHDRAWN , or RegistryEntry.STATE_DEPRECATED . The JAXR API allows a client application to deprecate an object, but there is currently no provision for an object to be approved or withdrawn. Nevertheless, these states may be seen because they may be set in the registry by clients using more capable APIs.
All RegistryObject s implement the ExtensibleObject interface, which allows arbitrary attributes to be added to any object in the registry without requiring a change to the registry API. Each such attribute is represented by a Slot , which has three properties:
The name property can be used to retrieve a given
Slot
from its associated
ExtensibleObject
. There cannot be more than one
Slot
with the same name attached to an
ExtensibleObject
. The JAXR specification does not describe what should happen if this rule is ignored. In the reference implementation for the UDDI registry, adding a
Slot
with the same name as an existing
Slot
causes the old instance to be
A string that specifies the type of the Slot . There is no predefined set of valid types. This attribute has value null by default.
A collection of values associated with the Slot . Each value must be a unique String .
A registry application can use a Slot to associate additional information with a RegistryObject . The ebXML registry model specification suggests that a submitting organization might use a Slot to mark all of its RegistryObject s with a copyright notice. Obviously, registry applications must have prior knowledge of the existence and meaning of specific Slot s in order to make use of them.
The mapping of the JAXR API to the UDDI registry model defined in the JAXR specification does not describe how Slot s should be stored in the registry, and, in fact, the reference implementation does not store them at all. Therefore, JAXR applications that need to work with a UDDI registry cannot, in general, create Slot s and expect them to be saved in the registry. One specific exception to this rule is the sortCode attribute of the UDDI equivalent of the JAXR PostalAddress object, which can be set by application code using a Slot , as described in Section 7.5.7, later in this chapter.
A registry implementation can attach Slot s to a RegistryObject to expose attributes available from the registry itself that are not mapped in the JAXR information model. There are several examples of this in the case of the UDDI registry:
The operator and authorizedName fields of the registry objects that represent JAXR Organizations and ClassificationSchemes are available in Slots , called Slot.OPERATOR_SLOT and Slot.AUTHORIZED_NAME_SLOT , respectively.
A slot is defined for use by the PostalAddress object when a mapping to the UDDI postal address scheme has not been defined. See Section 7.5.7 later in this chapter for details.
All
RegistryObject
s have a name that can be used when searching the registry. You can, for example, locate the
Organization
object for Amazon.com by searching on the full name or by using a wildcard search with a wildcard such as
%mazon%
. However, when searching for potential business
[4] The JAXR specification uses the terms "classification scheme" and "taxonomy" interchangeably. For the sake of clarity and consistency with the JAXR API (which calls the relevant interface ClassificationScheme ), I'll use only the
term "classification scheme" in this chapter.
A registry can, in theory, support any number of different classification schemes, and the JAXR specification requires that it be possible to add user-defined schemes to a registry, a topic that is covered in Section 7.5.6, later in this chapter. It also requires that all registries support at least three standard classification schemes:
Classifies organizations according to the type of service that they provide. Examples of classifications from this scheme include "Book Publisher" and "Book, Periodical, and Music Stores." See http://www.ntis.gov/product/naics.htm for details.
Classifies by geographical location. Organizations can categorize
This scheme is intended to provide classifications that are
You can inspect the classifications provided by these three schemes by starting the UDDI registry browser provided by the reference implementation (using the jaxr_browser.bat or jaxr_browser.sh script in the bin directory), selecting a registry in the Registry Location field, or entering the URL for a specific registry (such as http://localhost:8000/RegistryServer for the test registry server provided by the JWSDP and the reference implementation of the J2EE 1.4 platform) [5] , and then selecting Classifications in the Find by field. This results in the set of classifications supported by the registry being displayed in a tree control in the bottom left of the browser window. To see the classifications provided by a particular scheme, double-click on its name.
[5] Note that the registry browser was not included in the beta version of J2EE 1.4.
All three of the standard classification schemes are hierarchical. The NAICS scheme, for example, includes a top-level classification called
Information
, below which is another classification called
Publishing Industries
. Within this classification, there is
Newspaper
,
Periodical
,
Book
and
Database
Publishers
, and within that,
Book
Publishers
.
This search works because the
Organization
object representing O'Reilly & Associates in the registry has the
Book Publishers
classification from the NAICS classification scheme attached to it. It also has a geographical classification that indicates that it is based in the USA, as you can
As previously noted, classification schemes are hierarchical. Figure 7-10 shows a very small portion of the logical hierarchy tree that makes up the standard NAICS classification. The box at the top of the figure represents the classification scheme itself. In terms of the JAXR registry information model, this would be an instance of the javax.xml.registry.infomodel.ClassificationScheme interface. The nodes below this can all be used to categorize other entries in the registry. The relationship between these nodes reflects the granularity of the categorization so that, for example, a Book Publisher is a member of the set of Newspaper, Periodical, Book and Database publishers. Logically speaking, these nodes all represent elements of the classification scheme hierarchy and could therefore be used as possible classification values, but in the JAXR registry model, they would not be instances of the javax.xml.registry.infomodel.Classification interface. How these nodes map onto the JAXR information model depends on whether the classification scheme is internal or external.
A JAXR UDDI provider is required to provide the NAICS, ISO 3166, and UNSPSC schemes as internal classification schemes. In the case of an internal classification scheme, both the root ClassificationScheme object and the complete hierarchy of nodes that represent classification scheme elements are known and available within the provider implementation. The nodes themselves are instances of javax.xml.registry.infomodel.Concept , an interface that has several different uses within the JAXR API. A Concept is a RegistryObject that has the following attributes (among others):
A name (inherited from its parent interface, RegistryObject ).
A value, which is of type String .
A ClassificationScheme with which it is associated. Not all Concept s represent nodes in a classification scheme hierarchy; for those that do not, this attribute has the value null .
A list of child Concept s and a reference to a parent Concept . These attributes allow Concept s to be linked together in the hierarchical structure shown in Figure 7-10.
An internal classification scheme, then, is represented as a linked hierarchy of
Concept
s, rooted at a
ClassificationScheme
object. The actual
Concept
hierarchy for the part of the NAICS classification scheme
Notice that this diagram shows both the name and value attributes for each Concept . The name is used only for display purposes; it is the value attribute that determines which element of the classification scheme hierarchy the Concept represents. In the case of the NAICS classification scheme, the values are all numbers, where the number of digits is an indicator of the position of the value within the overall scheme. For example, the Information node has the value "51." The values associated with all of the nodes located below this point will start with "51," with an extra digit added for each additional level of nesting. Hence, the Concept representing Book Publishers has the value "51113" and is therefore three levels below the Information node, while the Concept for Newspaper Publishers, at the same level, has the value 51111. A complete list of the names and values for all of the Concept s in this classification scheme and the others that the JAXR provider is required to support can be found in the following files, which are in the jaxr-ri.jar file in the JAXR reference implementation:
|
NAICS: |
com/sun/xml/registry/common/tools/resources/naics.xml |
|
ISO 3166: |
com/sun/xml/registry/common/tools/resources/iso3166.xml |
|
UNSPSC: |
com/sun/xml/registry/common/tools/resources/unspsc.xml |
An external classification scheme is one for which the element hierarchy is not known to the JAXR registry provider ” only the ClassificationScheme node itself is registered. It is obviously easier to create an external classification scheme because there is only one item to install in the registry provider, whereas an internal scheme might require many hundreds of Concept s to completely describe it. However, there are advantages to using an internal scheme:
Since the JAXR provider has a record of which Concept values exist within the classification scheme, it can check whether a proposed classification is actually valid before applying it to a registry object.
Application code can use the linkage between Concept nodes to browse the hierarchy of an internal classification scheme to discover (and perhaps offer to the user) valid classification values. In the case of an external scheme, the application must either know all legal values by some external means or trust the user to supply only correct values.
Using an internal scheme, it is possible to search the registry for objects that are
|
In order to add a classification to a RegistryObject , you need an instance of a Classification object. As with classification schemes, there are two types of classification: internal and external.
An internal classification is created by referencing a Concept from the node hierarchy of an internal classification scheme. A Classification object for an internal classification representing Book Publisher in the NAICS classification scheme is shown in Figure 7-12.
An internal classification is very easy to create once you have the associated
Concept
. It is known to be valid since it refers to a node in the
An
external
Classification
object, by contrast, contains a reference to its parent
ClassificationScheme
and a name and value that
Another use for Concept s and classification schemes is to provide a means of creating enumerated types that can then be used as arguments to JAXR API method calls. An enumeration is created by defining a ClassificationScheme and attaching a Concept that represents each possible value within the enumeration. There are several such enumerations defined by the JAXR specification that every JAXR provider must recognize. One such enumeration, called ObjectType , contains distinguished values for each type of RegistryObject , plus a few other commonly used object types. This enumeration actually consists of a ClassificationScheme called ObjectType and a set of Concepts , whose value fields are listed here:
|
Association |
AuditableEvent |
Classification |
|
Concept |
ExternalIdentifier |
ExternalLink |
|
ExtrinsicObject |
Organization |
Package |
|
Service |
ServiceBinding |
User |
|
CPP |
CPA |
Process |
|
WSDL |
In order to use one of these values when making API calls, it is necessary to get a reference to the
Concept
that represents it. One way to do this involves using the
findConceptByPath( )
method of the
javax.xml.registry.BusinessQueryManager
interface, which will be discussed in the next section. This method requires a
Concept service = bqm.findConceptByPath("/ObjectType/Service");
As shown in Section 7.5.6, later in this chapter, it is possible to define your own enumerations.
|
|
|