Near the top of the method, here is the code that sets the properties dcterms:identifier, dcterms:title, and oslc_cm:status properties from (respectively) the ID, Summary, and Status of the Bugzilla bug: BugzillaChangeRequest changeRequest = new BugzillaChangeRequest() ĬtIdentifier(bug.getID()) ĬtTitle(bug.getSummary()) ĬtStatus(bug.getStatus()) īugzilla bugs also have attributes that do not map to any OSLC Change Management properties but that are required for Bugzilla. In the BugzillaChangeRequest class, the fromBug() method sets these properties. (* Prefix may be different depending on namespace prefix declaration in the XML) The following attributes line up fairly clearly: ![]() To represent a Bugzilla bug as an RDF/XML document for an OSLC Change Management resource, we must map Bugzilla bug attributes to OSLC-CM ChangeRequest properties. Mapping Bugzilla attributes to OSLC-CM properties Open the file BugzillaChangeRequest.java in the 4j.bugzilla.resources package and explore the variables and methods for the Bugzilla-specific attributes.Īs with the ChangeRequest class, the various getter methods (for example, getVersion()) have OSLC annotations. Look for other attributes with the annotation for examples of attributes that are not strings.Įxtending ChangeRequest with Bugzilla attributes indicates this attribute should appear in the resource shape as read onlyīecause the default type in OSLC4J is a string, there is no type annotation.providers the namespace qualified attribute name.provides the cardinality of the attribute.These are used to not only automatically create OSLC resource shape documents, service provider documents, and service provider catalogs, but also assist with the serialization of Java objects to RDF or JSON: Note the OSLC-specific annotations before the method. Not intended for end-user + String getIdentifier() Assigned by the service provider when a resource is created. For example, here’s the getIdentifier() method: unique identifier for a resource. Private final Set blocksTestExecutionRecords = new HashSet() įurther down are the primitive attributes of a Change Request: private Boolean approved įurther down, each attribute has an associated getter method. Private final Set affectsTestResults = new HashSet() Private final Set affectsRequirements = new HashSet() Private final Set affectsPlanItems = new HashSet() Here are first several, which represent the relationships between Change Requests and other OSLC artifacts: private final Set affectedByDefects = new HashSet() These are the attributes of an OSLC CM V2.0 Change Request. For reference, here is the definition of a Change Request in the OSLC Change Management specification.įirst, observe the private variables at the top of the ChangeRequest class. Open the file ChangeRequest.java in the 4j.bugzilla.resources package and explore the variables and methods. The OSLC4J Bugzilla adapter includes that class ( ChangeRequest) and extends it with Bugzilla-specific attributes (for example, “Product”, “Platform”, or other attributes that are not part of the OSLC CM specification) this extended change request is called a BugzillaChangeRequest. OSLC4J comes with a sample Change Management application that includes the OSLC4J-annotated Java class representing a Change Request (as defined in the OSLC Change Management v2 specification). OSLC resources can be modeled with plain old Java objects (POJOs) which are annotated to provide the information OSLC4J needs to create resource shapes, service provider documents, and to serialize/de-serialize OSLC resources from Java to representations such as RDF or JSON. OSLC4J, part of the Eclipse Lyo project, is a Java SDK for developing OSLC provider or consumer implementations. Then we’ll make Bugzilla Bugs available as OSLC Change Management resources in a variety of formats. In this section, we’ll look more closely at how OSLC4J defines OSLC resources. ![]() In the previous section we noted that we used OSLC4J to transform Plain Old Java Object (POJO) representations of OSLC resources into RDF, XML, and JSON formats.
0 Comments
Leave a Reply. |