Project: stp

com.ibm.rational.stp.client.samples
Class CcBrowser

Object
  extended by com.ibm.rational.stp.client.samples.CcBrowser
All Implemented Interfaces:
BrowserDataModel.Operations

public class CcBrowser
extends Object
implements BrowserDataModel.Operations

An extension of the Browser example demonstrating application of ClearCase operations to the displayed resource


Field Summary
private static String BAR
          The line of text used to separate the Element Rules from the Load Rules in a Config Spec.
private static String CHECKIN_OP
           
private static String CHECKOUT_OP
           
private static String CONTROL_OP
           
private static String DELETE_OP
           
private static String EDIT_OP
           
private static String EDITCS_OP
           
private static String[] fileOps
          The operations supported on Files
private static String[] folderOps
          The operations supported on Folders
private static String LOAD_OP
           
(package private)  com.ibm.rational.wvcm.stp.StpResource m_resource
          A proxy for the resource being displayed by this Browser window
private static String MKACT_OP
           
private static String MKDIR_OP
           
private static String MKFILE_OP
           
private static String MKSTREAM_OP
           
private static String MKVIEW_OP
           
private static String[] otherOps
          The operations supported on all resources
private static String REFRESH_OP
           
private static String UNCHECKOUT_OP
           
private static String VIEWCS_OP
           
private static String[] viewOps
          The operations supported on views
 
Constructor Summary
CcBrowser(com.ibm.rational.wvcm.stp.StpResource res)
           
 
Method Summary
 void execute(Object op, BrowserDataModel model)
          Supports the operations implemented in the 7.1 CM API VOB properties Get CQ CqUserDb from Project (Translate CLEARQUEST_USER_DB property from CqUserDbRef to CqUserDb (ref.getUserDb)) Create Stream(parent stream, is-read-only, is-integration-stream) Create Activity(headline, comment) Get CQ record for an activity (Translate MY_ACTIVITY_LIST to Record list via CqRecordRef.getRecord().)
(package private)  String[] getArgs(String[] names)
          Obtains a list of parameter values from the user.
(package private)  void getArgs(String[] names, String[] result)
          Displays a list of parameters to the user with default values and then allows the user to add or modify values.
 Vector<String> getList()
          Returns the operations supported by the type of ClearCase resource being displayed in this window.
static void main(String[] args)
          Starts the ClearCase version of the Browser using the CcBrower class as the source for resource operations.
(package private)  CcActivity mkActivity(javax.wvcm.Resource context)
          Creates an activity based on input from the user.
(package private)  CcFile mkDir(javax.wvcm.Resource parent)
          Creates a new directory after obtaining its name from the user
(package private)  CcFile mkFile(javax.wvcm.Resource dir)
          Creates a new file after getting its name from the user.
(package private)  CcStream mkStream(javax.wvcm.Resource context)
          Creates a new UCM Stream after obtaining parameters from user.
(package private)  CcView mkView(javax.wvcm.Resource context)
          Creates a ClearCase view after getting creation parameters from the user.
private  void showConfigSpec(CcView view, boolean allowEdit)
          Displays the Config Spec for a specified ClearCase View and, optionally, allows the user to edit it.
(package private)  void showResource(String name, CcResource res)
          A convenience method for invoking Browser.showResource on a given resource only if it is not null.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BAR

private static final String BAR
The line of text used to separate the Element Rules from the Load Rules in a Config Spec.

See Also:
Constant Field Values

CHECKOUT_OP

private static final String CHECKOUT_OP
See Also:
Constant Field Values

CHECKIN_OP

private static final String CHECKIN_OP
See Also:
Constant Field Values

UNCHECKOUT_OP

private static final String UNCHECKOUT_OP
See Also:
Constant Field Values

CONTROL_OP

private static final String CONTROL_OP
See Also:
Constant Field Values

REFRESH_OP

private static final String REFRESH_OP
See Also:
Constant Field Values

LOAD_OP

private static final String LOAD_OP
See Also:
Constant Field Values

EDIT_OP

private static final String EDIT_OP
See Also:
Constant Field Values

DELETE_OP

private static final String DELETE_OP
See Also:
Constant Field Values

VIEWCS_OP

private static final String VIEWCS_OP
See Also:
Constant Field Values

EDITCS_OP

private static final String EDITCS_OP
See Also:
Constant Field Values

MKDIR_OP

private static final String MKDIR_OP
See Also:
Constant Field Values

MKFILE_OP

private static final String MKFILE_OP
See Also:
Constant Field Values

MKVIEW_OP

private static final String MKVIEW_OP
See Also:
Constant Field Values

MKACT_OP

private static final String MKACT_OP
See Also:
Constant Field Values

MKSTREAM_OP

private static final String MKSTREAM_OP
See Also:
Constant Field Values

folderOps

private static final String[] folderOps
The operations supported on Folders


fileOps

private static final String[] fileOps
The operations supported on Files


viewOps

private static final String[] viewOps
The operations supported on views


otherOps

private static final String[] otherOps
The operations supported on all resources


m_resource

com.ibm.rational.wvcm.stp.StpResource m_resource
A proxy for the resource being displayed by this Browser window

Constructor Detail

CcBrowser

public CcBrowser(com.ibm.rational.wvcm.stp.StpResource res)
Method Detail

getList

public Vector<String> getList()
Returns the operations supported by the type of ClearCase resource being displayed in this window.

Specified by:
getList in interface BrowserDataModel.Operations
Returns:
A list of possible operations for the resource. If null, no operations combo-box will be displayed.
See Also:
BrowserDataModel.Operations.getList()

execute

public void execute(Object op,
                    BrowserDataModel model)
Supports the operations implemented in the 7.1 CM API

Specified by:
execute in interface BrowserDataModel.Operations
Parameters:
op - One of the operations supplied in the list returned by resourceOperations.

showConfigSpec

private void showConfigSpec(CcView view,
                            boolean allowEdit)
                     throws javax.wvcm.WvcmException
Displays the Config Spec for a specified ClearCase View and, optionally, allows the user to edit it.

Parameters:
view - The Workspace proxy for the ClearCase view whose ConfigSpec is to be displayed. Must not be null and must define the CONFIG_SPEC property.
allowEdit - If true, the displayed Config Spec is made editable and a button is added to the window for the user to click to commit the modified Config Spec.
Throws:
javax.wvcm.WvcmException - thrown if the required properties are not defined by the given proxy.

showResource

void showResource(String name,
                  CcResource res)
            throws javax.wvcm.WvcmException
A convenience method for invoking Browser.showResource on a given resource only if it is not null.

Parameters:
name - A brief description of the resource type for inclusion in the title of window that will be used to display the resource
res - The resource to be displayed. May be null.
Throws:
javax.wvcm.WvcmException - If there are problems viewing a non-null resource.

mkFile

CcFile mkFile(javax.wvcm.Resource dir)
Creates a new file after getting its name from the user.

Parameters:
dir - The directory in which to create the new file.
Returns:
A ControllableResource proxy representing the newly created file.

mkDir

CcFile mkDir(javax.wvcm.Resource parent)
Creates a new directory after obtaining its name from the user

Parameters:
parent - The default context in which the directory will be constructed. May be changed by user.
Returns:
A ControllableFolder for the newly constructed directory.

mkView

CcView mkView(javax.wvcm.Resource context)
Creates a ClearCase view after getting creation parameters from the user.

Parameters:
context - The Default context in which the view is to be created. May be modified by the user.
Returns:
A Workspace proxy for the created view. Will be null if the view was not created.

mkStream

CcStream mkStream(javax.wvcm.Resource context)
Creates a new UCM Stream after obtaining parameters from user.

Parameters:
context - The default context in which to create the new UCM Stream. May be modified by the user.
Returns:
A UcmStream proxy for the new stream; null if the stream was not created.

mkActivity

CcActivity mkActivity(javax.wvcm.Resource context)
Creates an activity based on input from the user.

Parameters:
context - The context in which the activity will be created, which may be ignored by the user.
Returns:
A UcmActivity proxy for the newly created activity; null if the activity was not created.

getArgs

void getArgs(String[] names,
             String[] result)
Displays a list of parameters to the user with default values and then allows the user to add or modify values.

Parameters:
names - The names of the parameters to be obtained from the user.
result - On input, the default values to display in the dialog; on output, contains the values entered by the user.

getArgs

String[] getArgs(String[] names)
Obtains a list of parameter values from the user.

Parameters:
names - The names of the parameters that user is supposed to provide.
Returns:
A String array contain the user's input for each parameter.

main

public static void main(String[] args)
                 throws Exception
Starts the ClearCase version of the Browser using the CcBrower class as the source for resource operations.

Parameters:
args - Not used in this application
Throws:
Exception

Generated Tue 15-Mar-2011 10:55 AM

Copyright © IBM 2011. All rights reserved.