wt.federation.reference
Class Client

java.lang.Object
  extended bywt.federation.reference.Client

public class Client
extends Object

Simple line-mode client.

This simple client serves as an example and reference implementation. It uses the Windchill Federated Task Dispatcher to execute task delegates that provide basic CRUD operations. The Task Dispatcher and task delegates provide an abstraction layer that allows the client to be independent of the types and network locations of the underlying information systems. The client simply applies abstract actions against business objects having abstract types and system-independent schema. Business objects are conveyed and represented as lightweight containers of attributes.

This simple client also demonstrates how to integrate with an LDAP directory service to discover the information systems that are registered in it. Whenever the client prompts for the name of a directory service, the wildcard character "*" may be entered. This will cause the client to search the directory for all registered information systems and direct queries to all of them.


Field Summary
private static String ADD_CONTENT_ITEMS
           
private static String CREATE
           
private static String DELETE
           
private  String directorySearchBase
           
private  DirectoryService ds
           
private static String EXPAND
           
private static String GET_CONTENT_ITEMS
           
private static String LINK
           
private  String linkType
           
private static String LIST_CONTENT_ITEMS
           
private  String objectFilter
           
private  String objectFilter2
           
private static String QUERY
           
private  BufferedReader reader
           
private  String repositoryNames
           
private  String repositoryNames2
           
private  String roleName
           
private  String targetType
           
private  String targetType2
           
private  boolean xmlDisplay
           
 
Constructor Summary
Client()
           
 
Method Summary
private  void displayObjects(Group objects)
           
private  void displayTree(Element parent, String name, String linktype, String role, int depth)
           
private  String dnToDomain(String dn)
           
private  void doAddContentItems()
          Upload a content item, a file in the local file system, to a content holder object where the content holder object is identified by a target type, a Windchill query specification, and an indication of the repository to which to send the request.
private  void doCreate()
          Create a business object given a target type, a set of attributes, and the repository in which to create the object.
private  void doDelete()
          Delete business objects based upon a target type, a Windchill query specification, and an indication of the repositories to which to send the request.
private  void doExpand()
          Expand trees of business objects based upon the target type of a set of base objects, a Windchill query specification identifying the base objects, an indication of the repositories to which to send the request, the link type identifying the type of association to expand, and the name of the role played by the base object(s) in the association.
private  void doGetContentItems()
          Download a content item to a file in the local file system.
private  void doLink()
          Create an association between two business objects.
private  void doListContentItems()
          List the content items associated with a set of content holder objects where the content holder objects are identified by a target type, a Windchill query specification, and an indication of the repositories to which to send the request.
private  void doQuery()
          Query for business objects based upon a target type, a Windchill query specification, and an indication of the repositories to which to send the query.
private  String getResponse(String prompt, String dflt)
           
private  boolean isServiceUnavailable(WTException e)
           
static void main(String[] args)
           
private  Enumeration resolveRepositories(String names)
           
 void run()
           
private  void setDisplayMode()
          Set the object display mode to one of XML or PLAIN.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADD_CONTENT_ITEMS

private static final String ADD_CONTENT_ITEMS
See Also:
Constant Field Values

CREATE

private static final String CREATE
See Also:
Constant Field Values

DELETE

private static final String DELETE
See Also:
Constant Field Values

EXPAND

private static final String EXPAND
See Also:
Constant Field Values

GET_CONTENT_ITEMS

private static final String GET_CONTENT_ITEMS
See Also:
Constant Field Values

LINK

private static final String LINK
See Also:
Constant Field Values

LIST_CONTENT_ITEMS

private static final String LIST_CONTENT_ITEMS
See Also:
Constant Field Values

QUERY

private static final String QUERY
See Also:
Constant Field Values

directorySearchBase

private String directorySearchBase

ds

private DirectoryService ds

linkType

private String linkType

roleName

private String roleName

objectFilter

private String objectFilter

objectFilter2

private String objectFilter2

targetType

private String targetType

targetType2

private String targetType2

repositoryNames

private String repositoryNames

repositoryNames2

private String repositoryNames2

xmlDisplay

private boolean xmlDisplay

reader

private BufferedReader reader
Constructor Detail

Client

public Client()
       throws WTException,
              IEException,
              IOException
Method Detail

run

public void run()

doQuery

private void doQuery()
Query for business objects based upon a target type, a Windchill query specification, and an indication of the repositories to which to send the query.


doCreate

private void doCreate()
Create a business object given a target type, a set of attributes, and the repository in which to create the object.


doDelete

private void doDelete()
Delete business objects based upon a target type, a Windchill query specification, and an indication of the repositories to which to send the request.


doLink

private void doLink()
Create an association between two business objects. First, queries are executed to locate the two objects that will be linked. Then, an association is created between the two based upon a specified link type.


doExpand

private void doExpand()
Expand trees of business objects based upon the target type of a set of base objects, a Windchill query specification identifying the base objects, an indication of the repositories to which to send the request, the link type identifying the type of association to expand, and the name of the role played by the base object(s) in the association.


doListContentItems

private void doListContentItems()
List the content items associated with a set of content holder objects where the content holder objects are identified by a target type, a Windchill query specification, and an indication of the repositories to which to send the request.


doAddContentItems

private void doAddContentItems()
Upload a content item, a file in the local file system, to a content holder object where the content holder object is identified by a target type, a Windchill query specification, and an indication of the repository to which to send the request.


doGetContentItems

private void doGetContentItems()
Download a content item to a file in the local file system. The content holder object is identified by a target type, a Windchill query specification, and an indication of the repository to which to send the request.


setDisplayMode

private void setDisplayMode()
Set the object display mode to one of XML or PLAIN.


getResponse

private String getResponse(String prompt,
                           String dflt)

resolveRepositories

private Enumeration resolveRepositories(String names)
                                 throws IEException
Throws:
IEException

dnToDomain

private String dnToDomain(String dn)

displayObjects

private void displayObjects(Group objects)

displayTree

private void displayTree(Element parent,
                         String name,
                         String linktype,
                         String role,
                         int depth)
                  throws WTException
Throws:
WTException

isServiceUnavailable

private boolean isServiceUnavailable(WTException e)

main

public static void main(String[] args)