Project: stp

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

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

public class Utilities
extends Object

A collection of static utility methods supporting the CM API examples


Nested Class Summary
(package private) static class Utilities.UnPw
          A simple Authentication object in which the username and password obtained from the user is cached for use by the CM API.
 
Field Summary
private static javax.wvcm.ProviderFactory.Callback g_callback
           
static String g_pass
          Password used by static callback
static String g_user
          User name used by static callback
 
Constructor Summary
Utilities()
           
 
Method Summary
(package private) static void exception(java.awt.Component frame, String title, Throwable ex)
          Displays a Swing dialog containing the messages associated with a given Throwable.
(package private) static com.ibm.rational.wvcm.stp.StpProvider getProvider()
          Constructs an instance of the CM API provider with or without an authenticator.
static CqProvider getStaticProvider()
           
(package private) static javax.wvcm.ResourceList<CqUserDb> getUserDbList(CqProvider provider, javax.wvcm.PropertyRequestItem.PropertyRequest feedback)
           
(package private) static boolean isListOfResources(Object val)
           
private static Object messages(Throwable ex)
          Extracts the message content from a Throwable and returns it as a hierarchical array of Strings capturing the nesting of the Throwable's message components.
(package private) static String resourceType(javax.wvcm.Resource resource)
          Returns a String suitable for displaying the type of resource as determined by its proxy class.
(package private) static javax.wvcm.ResourceList<? extends com.ibm.rational.wvcm.stp.StpResource> toResourceList(com.ibm.rational.wvcm.stp.StpProvider provider, List list)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

g_pass

public static String g_pass
Password used by static callback


g_user

public static String g_user
User name used by static callback


g_callback

private static javax.wvcm.ProviderFactory.Callback g_callback
Constructor Detail

Utilities

public Utilities()
Method Detail

getStaticProvider

public static CqProvider getStaticProvider()
                                    throws Exception
Throws:
Exception

getProvider

static com.ibm.rational.wvcm.stp.StpProvider getProvider()
                                                  throws Exception
Constructs an instance of the CM API provider with or without an authenticator.

Returns:
The instantiated Provider object
Throws:
Exception - If the Provider could not be instantiated

getUserDbList

static javax.wvcm.ResourceList<CqUserDb> getUserDbList(CqProvider provider,
                                                       javax.wvcm.PropertyRequestItem.PropertyRequest feedback)
                                                throws javax.wvcm.WvcmException
Throws:
javax.wvcm.WvcmException

messages

private static Object messages(Throwable ex)
Extracts the message content from a Throwable and returns it as a hierarchical array of Strings capturing the nesting of the Throwable's message components. This structure formats reasonably in a SWING showMessageDialog invocation.

Parameters:
ex - The Throwable object whose message content is to be extracted.
Returns:
If the given Throwable has nested components, an array consisting of the Throwable's message and an array of the nested messages.

exception

static void exception(java.awt.Component frame,
                      String title,
                      Throwable ex)
Displays a Swing dialog containing the messages associated with a given Throwable.

Parameters:
frame - The parent frame for the message dialog.
title - The title to appear in the dialog window.
ex - The throwable whose messages are to be displayed.

resourceType

static String resourceType(javax.wvcm.Resource resource)
Returns a String suitable for displaying the type of resource as determined by its proxy class.

Parameters:
resource - A Resource proxy from which the type of resource will be determined.
Returns:
A String containing the simple name of the most derived CM API interface implemented by the given proxy.

isListOfResources

static boolean isListOfResources(Object val)

toResourceList

static javax.wvcm.ResourceList<? extends com.ibm.rational.wvcm.stp.StpResource> toResourceList(com.ibm.rational.wvcm.stp.StpProvider provider,
                                                                                               List list)

Generated Fri 3-Oct-2014 01:31 AM

Copyright © IBM 2014. All rights reserved.