Skip Headers
Oracle® Fusion Middleware Integration Guide for Oracle Enterprise Repository
11g Release 1 (11.1.1.7)

Part Number E15754-15
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

14 ArtifactStore API

This chapter provides a use case for the ArtifactStore API that describes how to create a missing ArtifactStore in Oracle Enterprise Repository.

This chapter includes the following sections:

14.1 Overview

The ArtifactStore subsystem provides a web services-based mechanism that is used to query and create Oracle Enterprise Repository ArtifactStores.

14.2 Use Case

This section describes the use case using the Artifact Store API. It contains the following topics:

14.2.1 Use Case: Create Missing ArtifactStore

Description

This use case describes how to create a missing artifactstore.

Sample Code

Example 14-1 Use Case: Create Missing ArtifactStore

package com.flashline.sample.artifactstoreapi;
import java.net.URL;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import com.flashline.registry.openapi.base.OpenAPIException;
import com.flashline.registry.openapi.entity.ArtifactStoreBean;
import com.flashline.registry.openapi.entity.AuthToken;
import com.flashline.registry.openapi.query.ArtifactStoreCriteria;
import com.flashline.registry.openapi.service.v300.FlashlineRegistry;
import
 com.flashline.registry.openapi.service.v300.FlashlineRegistryServiceLocator;
public class ArtifactStores {
  public static void main(String pArgs[]) throws OpenAPIException,
 RemoteException,
  ServiceException {
    try {
      ///////////////////////////////////////////////////////////
      // Connect to Oracle Enterprise Repository
      ///////////////////////////////////////////////////////////
      URL lURL = null;
      lURL = new URL(pArgs[0]);
      FlashlineRegistry repository = new
 FlashlineRegistryServiceLocator().getFlashlineRegistry(lURL);
      // //////////////////////////////
      // Authenticate with OER
      // //////////////////////////////
      AuthToken authToken = repository.authTokenCreate(pArgs[1], pArgs[2]);
      // -----------------------------------------
      // query for an artifact store
      ArtifactStoreCriteria lArtifactStoreCriteria = null;
      ArtifactStoreBean[] lArtifactStoreBeans = null;
      ArtifactStoreBean lArtifactStoreBean = null;
      lArtifactStoreCriteria = new ArtifactStoreCriteria();
      lArtifactStoreCriteria.setHostCriteria("existing-artifact-store.com");
      lArtifactStoreCriteria.setBasepathCriteria("/");
      lArtifactStoreBeans = repository.artifactStoreQuery(authToken,
 lArtifactStoreCriteria, false);
      // create a missing artifact store if missing and based on the criteria
      lArtifactStoreCriteria = new ArtifactStoreCriteria();
      lArtifactStoreCriteria.setHostCriteria("missing-artifact-store.com");
      lArtifactStoreCriteria.setBasepathCriteria("/");
      // a new artifact store is created
      lArtifactStoreBeans = repository.artifactStoreQuery(authToken,
 lArtifactStoreCriteria, true);
      lArtifactStoreBean = lArtifactStoreBeans[0];
    } catch(Exception e) {
      throw new RuntimeException(e.getMessage());
    }
  }
}