CcFile 및 CcDirectory 프록시 메소드

CcFile 또는 CcDirectory 자원은 Rational® ClearCase® 보기(CcView)의 파일 또는 디렉토리를 나타냅니다. 이러한 자원은 소스 제어 하에 있거나 소스 제어 하에 둘 수 있습니다. CcFile 및 CcDirectory는 Cm API의 ClearCase 특정 확장입니다. CcFile은 ControllableResource 인터페이스를 확장하고 CcDirectory는 ControllableFolder 인터페이스를 확장합니다. CcFile은 다음과 같은 여러 가지 메소드를 지원합니다.

CM API는 위 오퍼레이션이 수행되는 보기의 파일인 CcFile과 이와 관련된 기본 ClearCase 요소 및 버전(CcElement and CcVersion)을 구별합니다.

CcFile.doVersionControl() 메소드는 CcFile과 동일한 컨텐츠를 가지게 될 CcElement 자원 및 초기 CcVersion 자원을 작성합니다.

다음 코드 단편은 파일 영역에서 알려진 파일에 대한 CcFile 프록시를 빌드하고 해당 파일을 체크아웃합니다. 체크아웃 오퍼레이션 전후로 IS_CHECKED_OUT 특성을 검사합니다.
 // 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() 메소드를 호출하여 수행해야 하는 자원 작성을 구분하십시오.


피드백