CM API는 위 오퍼레이션이 수행되는 보기의 파일인 CcFile과 이와 관련된 기본 ClearCase 요소 및 버전(CcElement and CcVersion)을 구별합니다.
CcFile.doVersionControl() 메소드는 CcFile과 동일한 컨텐츠를 가지게 될 CcElement 자원 및 초기 CcVersion 자원을 작성합니다.
// Get the ClearCase provider. CcProvider provider = ...; // Create a CcFile proxy for the file to be checked out. // First, create a plain old Java "File" instance from the file's path. // Then create an StpLocation instance from that file. // Finally, create a CcFile proxy from the location. File file = new File("C:/my_views/example_view/avob/example.txt"); StpLocation fileLoc = provider.filePathLocation(Domain.CLEAR_CASE, file); CcFile testFile = provider.ccFile(fileLoc); // Create a property request for the file's properties that we're // interested in. Read those properties. Note that the resulting // property values are available *only* in the CcFile proxy returned by // doReadProperties(), not in the original proxy. PropertyRequest wantedProps = new PropertyRequest( CcFile.IS_VERSION_CONTROLLED, CcFile.IS_CHECKED_OUT); testFile = (CcFile) testFile.doReadProperties(wantedProps); if ( ! testFile.getIsVersionControlled()) { // The file is not yet under version control, so control it. // At the same time, re-read the properties we're interested in. testFile = (CcFile) testFile.doVersionControl(wantedProps); } if ( ! testFile.getIsCheckedOut()) { // The file is not yet checked out, so check it out. // At the same time, re-read the properties we're interested in. testFile = testFile.doCcCheckout(null, wantedProps); } // Verify that the file is now version controlled and checked out. assert(testFile.getIsVersionControlled() == true); assert(testFile.getIsCheckedOut() == true);
로컬 웹 보기에서 자원에 대한 특정 오퍼레이션은 서버와 상호작용할 수도 있고 하지 않을 수도 있습니다. 예를 들어, 다음과 같습니다.
일부 자원은 사용자가 작성할 수 없으므로 자원 인터페이스 자체에서 기본 자원을 작성하기 위한 메소드를 제공하지 않습니다. 자원 오브젝트 인스턴스화 문제인 프록시 작성과 doCreateResource() 또는 doCreateVersionControlledResource() 메소드를 호출하여 수행해야 하는 자원 작성을 구분하십시오.