Project: stp

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

Object
  extended by com.ibm.rational.stp.client.samples.Browser

public class Browser
extends Object

This is a SWING application that reads and displays the properties of a resource using the generic Resource/Property interfaces of the CM API. Starting from the name or type of a resource, a user can read and display resource properties, following references from one resource to the next.

The user can start browsing either by entering the object selector for the resource to be viewed or the user can select a resource type and ask the API for all known folders containing that resource type.

In the latter case, the list of folders is displayed by Browser.showResourceList. By selecting an entry in the display for a Resource, ResourceList or Property.List value, the user can traverse to that object or list of objects and display them.

In the former case, the user types in the object selector for a specific resource he is interested in, such as a specific record. All properties of this record are then displayed by Browser.showResource The Property.List property Record.ALL_FIELD_VALUES contains all the schema-defined fields of the record and could be selected to view those fields.

If a resource has content, that data can be displayed using BrowserDataModel.showContent().


Field Summary
private static String CLEAR_CASE_WORKSPACES
          Drop-down entry for requesting local ClearCase views
private static String CLEAR_QUEST_DB_SETS
          Drop-down entry for requesting ClearQuest connections
(package private) static Class<?> g_operationsClass
          The class to use for Operations if supported by the application using the Browser class.
private static com.ibm.rational.wvcm.stp.StpProvider g_provider
          The Provider instance used by all instances of the Browser in a process
(package private) static javax.wvcm.PropertyRequestItem.PropertyRequest META_PROPS
          Meta-properties to be displayed for each property Also the properties requested for property-valued properties
private static javax.wvcm.PropertyRequestItem.PropertyRequest PROPS
          Properties to be displayed for elements of a ResourceList Also the properties requested for resource-valued properties.
private static com.ibm.rational.wvcm.stp.StpProperty.MetaPropertyName<Object> VALUE_AS_OBJECT
           
 
Constructor Summary
Browser()
           
 
Method Summary
(package private) static Object exceptionImage(Throwable ex, Object obj)
          Generates a short string to identify a given throwable
private static BrowserDataModel.Operations getOperations(com.ibm.rational.wvcm.stp.StpResource res)
          If the g_operationsClass variable is set, returns a new instance of that class initialized with the given Resource proxy.
(package private) static boolean getUrl(String defaultURL)
           
static void main(String[] args)
          Starts browsing at a user-supplied resource location or in the folders designated for a user-supplied type of resource.
(package private) static javax.swing.JFrame showPropertyList(String title, com.ibm.rational.wvcm.stp.StpResource resource, javax.wvcm.PropertyNameList.PropertyName<com.ibm.rational.wvcm.stp.StpProperty.List<com.ibm.rational.wvcm.stp.StpProperty<?>>> property, javax.wvcm.PropertyRequestItem.NestedPropertyName<?>[] metaProperties, boolean validOnly)
          Retrieves the value of a Property.List-valued property from a given resource and displays the results in a table.
(package private) static javax.swing.JFrame showResource(String title, com.ibm.rational.wvcm.stp.StpResource res, javax.wvcm.PropertyRequestItem.NestedPropertyName<?>[] metaProperties, boolean validOnly)
          Retrieves all properties of a given resource and displays them in a table.
(package private) static javax.swing.JFrame showResourceList(String title, javax.wvcm.ResourceList<? extends com.ibm.rational.wvcm.stp.StpResource> resources, javax.wvcm.PropertyRequestItem.NestedPropertyName<?>[] properties, boolean validOnly)
          Displays the elements of a ResourceList in a table.
(package private) static void showRoot(String name)
          Displays a list of folders in which are found resources of a specified type or a resource at a given location.
(package private) static Object typeImage(Object obj)
          Generates the unqualified name of the type of a given object
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALUE_AS_OBJECT

private static final com.ibm.rational.wvcm.stp.StpProperty.MetaPropertyName<Object> VALUE_AS_OBJECT

PROPS

private static final javax.wvcm.PropertyRequestItem.PropertyRequest PROPS
Properties to be displayed for elements of a ResourceList Also the properties requested for resource-valued properties.


META_PROPS

static final javax.wvcm.PropertyRequestItem.PropertyRequest META_PROPS
Meta-properties to be displayed for each property Also the properties requested for property-valued properties


CLEAR_QUEST_DB_SETS

private static final String CLEAR_QUEST_DB_SETS
Drop-down entry for requesting ClearQuest connections

See Also:
Constant Field Values

CLEAR_CASE_WORKSPACES

private static final String CLEAR_CASE_WORKSPACES
Drop-down entry for requesting local ClearCase views

See Also:
Constant Field Values

g_operationsClass

static Class<?> g_operationsClass
The class to use for Operations if supported by the application using the Browser class.

See Also:
CcBrowser.main(String[])

g_provider

private static com.ibm.rational.wvcm.stp.StpProvider g_provider
The Provider instance used by all instances of the Browser in a process

Constructor Detail

Browser

public Browser()
Method Detail

showRoot

static void showRoot(String name)
Displays a list of folders in which are found resources of a specified type or a resource at a given location.

Parameters:
name - Either a String specifying the type of resource for which a folder list is to be generated or a String containing the location of the resource to be displayed. Must not be null.

showResourceList

static javax.swing.JFrame showResourceList(String title,
                                           javax.wvcm.ResourceList<? extends com.ibm.rational.wvcm.stp.StpResource> resources,
                                           javax.wvcm.PropertyRequestItem.NestedPropertyName<?>[] properties,
                                           boolean validOnly)
Displays the elements of a ResourceList in a table.

Parameters:
title - The title for the window in which the resources are displayed.
resources - The ResoureList containing the resources to be displayed.
properties - A PropertyName array containing the PropertyName's for the properties to be displayed for each Resource. These properties should be defined in the proxies in the ResourceList.
Returns:
The handle on the window in which the resource list is displayed.

showResource

static javax.swing.JFrame showResource(String title,
                                       com.ibm.rational.wvcm.stp.StpResource res,
                                       javax.wvcm.PropertyRequestItem.NestedPropertyName<?>[] metaProperties,
                                       boolean validOnly)
                                throws javax.wvcm.WvcmException
Retrieves all properties of a given resource and displays them in a table.

Parameters:
title - The title for the window in which the resource is displayed.
res - A Resource proxy for the resource to be displayed.
metaProperties - A MetaPropertyName[] containing the meta-properties to be displayed for each property of the resource.
Returns:
A handle for the window containing the display.
Throws:
javax.wvcm.WvcmException - if resource denoted by the given Resource proxy can not be read.

showPropertyList

static javax.swing.JFrame showPropertyList(String title,
                                           com.ibm.rational.wvcm.stp.StpResource resource,
                                           javax.wvcm.PropertyNameList.PropertyName<com.ibm.rational.wvcm.stp.StpProperty.List<com.ibm.rational.wvcm.stp.StpProperty<?>>> property,
                                           javax.wvcm.PropertyRequestItem.NestedPropertyName<?>[] metaProperties,
                                           boolean validOnly)
                                    throws javax.wvcm.WvcmException
Retrieves the value of a Property.List-valued property from a given resource and displays the results in a table. The display includes an option to view the content of the resource as well as the resource or resource list referenced by any of the displayed properties.

Parameters:
title - The title for the window in which the property list is displayed
resource - A proxy for the Resource whose properties are to be displayed.
property - A PropertyName specifying the Property.List-valued property of the resource that is to be retrieved and displayed.
metaProperties - The meta-properties of each Property on the list that are to be retrieved and displayed.
Returns:
A handle for the window in which the Property.List is displayed.
Throws:
javax.wvcm.WvcmException - If the specified resource or property cannot be retrieved from the repository.

main

public static void main(String[] args)
                 throws Exception
Starts browsing at a user-supplied resource location or in the folders designated for a user-supplied type of resource.

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

getUrl

static boolean getUrl(String defaultURL)

exceptionImage

static Object exceptionImage(Throwable ex,
                             Object obj)
Generates a short string to identify a given throwable

Parameters:
ex - A Throwable that is to be identified.
obj - The object that promulgated the exception.
Returns:
A short String providing, in a concise format, identification of and relevant information from the throwable.

typeImage

static Object typeImage(Object obj)
Generates the unqualified name of the type of a given object

Parameters:
obj - The object whose value is to be displayed. May be null.
Returns:
The leaf name of the type of the object.

getOperations

private static BrowserDataModel.Operations getOperations(com.ibm.rational.wvcm.stp.StpResource res)
If the g_operationsClass variable is set, returns a new instance of that class initialized with the given Resource proxy.

Parameters:
res - A Resource proxy. Must not be null.
Returns:
A new Operations object if the operations class has been assigned to g_operationsClass; otherwise null.

Generated Mon 15-Aug-2011 10:18 PM

Copyright © IBM 2011. All rights reserved.