This document provides a look and guide to the Common Metadata Repository (CMR) from the perspective of the Client Partner.
Programming examples use a fixed width font, have upper/lower lines separating them
from the rest of the text, and are in this color font.
Comments (denoted by // within examples)
Best practices or warnings appear in italicized, boxed text.
The primary reason for designing the CMR was to increase access to Earth Science data and services by providing a system with a machine-to-machine interface, that is, an Application Programming Interface (API). The CMR functions as a metadata clearinghouse of Earth Science metadata for a wide variety of partners, enabling the science community to exchange information. Data Partners provide the Earth Science community with metadata representing their Earth Science data holdings. CMR technology in turn provides services for Client Partners and Data Partners and supports efficient discovery and access to Earth science data. The CMR also functions as an order broker for the data, and offers services applied to that data. The CMR provides a portal on the internet where CMR clients can search the metadata for information they wish to order. The CMR also functions as an internet portal where CMR clients can search the metadata for information they wish to retrieve.
Client applications can access data holdings via order distribution or online access. Data Partners retain complete control over what metadata are represented in the CMR including inserting new metadata, modifying existing metadata and removing old metadata, and controlling access to their metadata.
Usually performed in the order shown below:
In Chapter 4
In Chapter 7
In Chapter 8
Since the CMR uses platform-independent web service definitions for its API, there are no requirements for a client programming language. All examples in this document are in snippets of Java code; however, the code samples provided could be translated to any web service capable language.
As a CMR Data Partner, you need to be familiar with basic software development and Service Oriented Architecture (SOA) concepts such as:
As a REST-API user, you will need:
As a SOAP-API user, you will need:
NASA's Earth Science Data and Information System (ESDIS) has built the CMR based on Extensible Markup Language (XML) and Web Service technologies. The CMR interfaces with clients and users through its series of Application Program Interfaces (APIs). The CMR is an open system with published APIs available to the CMR Development and User community.
As the CMR is a middleware application, interacting with it means interacting with the CMR API. There is typically a user-focused client application interacting with CMR's API on behalf of an end user. This client may be a generic, query and order-based client, or may be specific to an end user's research, mission, or general area of interest. The CMR incorporates a Universal Description, Discovery, and Integration (UDDI) registry to facilitate registration, discovery, and invocation of services related to the CMR holdings.
Internally, the CMR specifies APIs and provides middleware components, including data and service search and access functions, in a layered architecture. The figure below depicts the CMR system context in relation to its public APIs.
All CMR metadata are stored in an Oracle database with spatial extensions. The metadata model is derived primarily from that used by the Earth Observing System Data and Information System (EOSDIS) Core System (ECS). For more details about the CMR model, refer to the Earth Science Metadata Model chapter of the Data Partner Guide
Key features of the CMR architecture are:
Oracle enables the the CMR system to interact with spatially enabled Earth science metadata by use of spatial extensions into the system and business logic within the system that understands how to interact with that metadata. In addition, a second CMR interface (Ingest) allows metadata updates to go directly into the database, bypassing the message-passing API. The File Transfer Protocol (FTP) server is configured to receive these update files, which are expressed in XML conforming to three schemas, one for granules (or inventory), one for collections (or datasets), and one for browse. Note: For ECHO 10.0 and later, these formats are schemas; for legacy ECHO, these formats are DTDs.
The schemas are defined on the ECHO 10.10 Ingest DTD/Schemas page of the ECHO website: http://api.echo.nasa.gov/echo/apis.html
Oracle's spatial capabilities support queries for CMR metadata whose spatial extents are described within the system. A Data Partner can define the spatial extent of a granule or a collection with different spatial constructs (for example: point and polygon). A Client Partner can then construct a search using a point, a line, or a polygon (or multiple polygon) spatial type, and the CMR responds with data whose spatial regions intersect the described region. The CMR provides services for interacting with its Catalog of metadata. Queries can be performed in a number of ways; result formats can be specified, and the resulting data sets can be incrementally accessed so that large return sets can be handled gracefully. The CMR also supports constructing, submitting, and tracking orders for the data that the metadata represents. The CMR supports both an embedding of a Uniform Resource Locator (URL) within the metadata for accessing the data (which the client simply accesses via Hypertext Transfer Protocol [HTTP]), and a more complicated order process in which quotes and order options are accommodated.
The CMR incorporates the ECS concept of granules and collections and defines separate DTDs for updating each, under the assumption that granules will indicate which collection is considered their ―primary‖ collection. ―Primary collection‖ "primary collection." "Primary Collection" means the collection that owns the granule.
A collection is a grouping of granules that all come from the same source, such as a modeling group or institution. Collections have information that is common across all the granules they "own" and a template for describing additional attributes not already part of the metadata model.
A granule is the smallest aggregation of data that can be independently managed (described, inventoried, and retrieved). Granules have their own metadata model and support values associated with the additional attributes defined by the owning collection.
A third type of metadata is browse metadata, which provide a high-level view of granule or collection metadata and cross-referencing to other granules or collections. Browse metadata are not spatially enabled but are still useful.
The CMR system supports Secure Sockets Layer (SSL)-based communication, which a client must use to pass passwords or other sensitive information securely. Internally, the systems are firewalled to prevent unintended access.
The CMR system supports clients capable of initiating an HTTP connection from a variety of programming languages
The CMR provides an infrastructure that allows various communities to share tools, services, and metadata. As a metadata clearinghouse, it supports many data access paradigms such as navigation and discovery. As an order broker, the CMR forwards orders for data discovered through the metadata query process to the appropriate Data Partners for order fulfillment. As a service broker, the CMR decentralizes end user functionality and supports interoperability of distributed functions.
Although this Guide focuses on the needs of Client Partners, the CMR supports the following different, nonexclusive types of Partners:
To address the CMR system vision, the CMR has responded to a set of system drivers, that is, reasons for upgrading. These drivers, derived from functional, organizational, and operational concerns expressed by the user community, determined the architectural approach and the types of technical solutions used in building the CMR system.
The primary goal of the CMR is to enable organizations to participate in making their resources and capabilities available to the Earth Science community. To facilitate participation by these organizations, the CMR has:
While aggressive in the capabilities it is targeted to support, the CMR minimizes the Cost to Field by continually evaluating performance and functionality against costs, for example, licensing of Commercial Off-the-Shelf (COTS) applications, amount of custom code required, hardware platform requirements, and complexity of networking and installation.
Once fielded, the CMR seeks to minimize the cost to operate the system by making it easier to use, thereby minimizing the load on operations staff.
The CMR is being built with long-term extensibility foremost in mind. To enable emerging techniques and strategies for Earth Science research, the CMR has:
There are three CMR Systems that you, as a Client Partner, have access to:
CMR Operations: This is the current operational system for the CMR and is available to all users.
Location: http://api.cmr.nasa.gov/cmr/index.html
CMR Partner Test: This is an operational system used only by the CMR partners where they can test their data and services prior to making the final changes in the operational system.
Location: http://api-test.cmr.nasa.gov/cmr/index.html
CMR Testbed: This is a test system area used by partners and CMR testers to test before changes to the CMR system go operational.
This section contains information and examples that are common to most CMR client applications, such as basic Login and Logout and creation and management of user accounts.
There are two types of users in the CMR: registered users and guests. LBN: Is this still valid or is URS now required? Registered users can have access to restricted data and services but requires the creation of a URS profile. Guest users do not require a URS profile but their access is limited in some areas.
CMR tokens are generated whenever a user interacts with a CMR API. A token is a transient representation of either your URS credentials or your guest status.
In both CMR-REST and CMR-SOAP LBN: Does CMR have a SOAP API? APIs registered access requires the creation of a CMR token and then use of that token throughout your interaction with the CMR.
In the case of CMR-REST, guest token creation is carried out behind the scenes of the API. In the case of CMR-SOAP a client must manually create their token to interact with the API.
Create your user credentials in URS and use them to interact with the CMR using your user name and password.
When using the Web Services API, you need to request a CMR token for all but CMR-REST guest access.
This token acts as your session key and must be passed to all other CMR operations. All clients interfacing with the system are required to pass client identifier information to the CMR. The client identifier is a short description and/or name of the client. Client developers are encouraged to keep this information as concise as possible and to work with the CMR Operations Group to create an appropriate identifier.
A token is obtained when logging into the CMR (see Logging Into the CMR). This is also done when setting user and provider context.
When done working in the CMR, be sure to logoff (see Logging Out of the CMR).
NOTE: If client identifier information is not provided, submitted orders will fail.
Create a token via a POST to the token resource
Creating a CMR token for a user
Request headers: Content-Type: application/xml Request: POST https: //api.cmr.nasa.gov/cmr-rest/tokens Request body: <token> <username>Your URS username</username> <password>Your URS password</password> <client_id>An arbitrary ID to identify yourself</client_id> <user_ip_address>Your IP address</user_ip_address> </token> |
If you want to perform operations as a provider then you need the provider id and the credentials of a user that has provider privileges
Creating a CMR token for a provider
Request headers: Content-Type: application/xml Request: POST https: //api.cmr.nasa.gov/cmr-rest/tokens Request body: <token> <username>Your URS username</username> <password>Your URS password</password> <client_id>An arbitrary ID to identify yourself</client_id> <user_ip_address>Your IP address</user_ip_address> <behalfOfProvider>Your provider ID</behalfOfProvider> </token> |
The CMR token will be returned to you as follows in the response body,
CMR Token response
<?xml version= "1.0" encoding= "UTF-8" ?> <token> <id>CMR-TOKEN-ID</id> <username>Your URS username</username> <client_id>An arbitrary ID to identify yourself</client_id> <user_ip_address>Your IP address</user_ip_address> </token> |
You will use the value of CMR-TOKEN-ID to interact with the CMR REST API.
To obtain a token, call the Login operation of the Authentication Service. A new token is created and returned each time Login is invoked. Code Listing 1 is an example of logging in to the CMR and creating a session token for a guest user.
Parameters:
A Security Token is returned that is used for all subsequent calls to the CMR using the same Token profile.
Code listing 1: Logging in as Guest
// Client information is optional information provided by the // client to the CMR when a user logs in ClientInformation clientInfo = new ClientInformation(); clientInfo.setClientId( "A Client" ); clientInfo.setUserIpAddress( "192.168.1.1" ); // Call login with guest as username, email as password, and // client information |
Code Listing 2 is an example of logging in to the CMR and creating a session token for a guest user.
Code Listing 2: Logging In as a Registered User
// Client information is optional information provided by the // client to CMR when a user logs in ClientInformation clientInfo = new ClientInformation(); clientInfo.setClientId( "A Client" ); clientInfo.setUserIpAddress( "192.168.1.1" ); // Call login with jdoe as username, mypass as password, and // client information String token = authenticationService.login( "jdoe" , "mypass" , clientInfo, null , null ); |
To logout of your session simply delete your CMR token.
Logging out - deleting a CMR token
When you are finished with a token, for example, you have finished a session with the CMR; destroy the token using the Logout operation.
Parameter(s):
Code Listing 3: Logging out of the CMR
// Logout and set token to null because it is not useful anymore authenticationService.logout(token); token = null ; |
You do not need to destroy a token after each call; you may reuse a token until it is destroyed with the Logout operation or the token expires. Because the token is used to track your session, it must be protected by client applications with the same level of security that you use for your login name and password.
You can interact with any CMR-REST resource using guest by simply GETing, POSTing, PUTing or DELETEing the resource. Some of these operations will fail if guest does not have the authority to perform them. In cases, where you want to use a registered user you should acquire a CMR token above and attach it as a header to the request you make. For example,
Getting a list of providers with a CMR token
Request headers: Content-Type: application/xml CMR-Token: CMR-TOKEN-ID Request: GET https: //api.cmr.nasa.gov/cmr-rest/providers Response headers: Status Code: 200 OK Response Body: <?xml version= "1.0" encoding= "UTF-8" ?> <providers type= "array" > <provider> ... </provider> </providers> |
Interacting with the rest of the CMR API follows the same pattern as logging in and logging out except that it requires that you pass a valid CMR token to each operation. The following example shows logging in, retrieving the version number of the CMR system and logging back out.
Code Listing 4: Getting the CMR Version Number
// Login
String token = authenticationService.login(
"jdoe"
,
"mypass"
,
new
ClientInformation(
"A Client"
,
"192.168.1.1"
),
null
,
null
);
// Print out CMR version number.
System.out.println(
"CMR's version number: "
+ authenticationService.getCMRVersion(token));
// Logout using token from previous login
authenticationService.logout(token);
token =
null
;