この章では、アーティファクト・ストアAPIのユースケースについて説明します。このユースケースで、欠落しているアーティファクト・ストアをOracle Enterprise Repositoryに作成する方法について解説します。
この章では、次の項目について説明します。
アーティファクト・ストア・サブシステムは、Oracle Enterprise Repositoryのアーティファクト・ストアに問い合せたり、これを作成したりする場合に使用する、Webサービス・ベースのメカニズムを提供します。
この項では、アーティファクト・ストアAPIを使用するユースケースについて説明します。内容は次のとおりです。
説明
このユースケースでは、欠落しているアーティファクト・ストアの作成方法について説明します。
サンプル・コード
例14-1 ユースケース: 欠落しているアーティファクト・ストアの作成
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());
}
}
}