wt.com
Class WindchillComponentImpl

java.lang.Object
  extended bywt.com.WindchillComponentImpl
All Implemented Interfaces:
WindchillComponentIfc

public class WindchillComponentImpl
extends Object
implements WindchillComponentIfc


Field Summary
private static WTProperties localProperties
           
private  Hashtable objectCache
           
private  String password
           
private  RemoteMethodServer rms
           
private static WTProperties serverProperties
           
private  String username
           
private static boolean VERBOSE
           
 
Constructor Summary
WindchillComponentImpl()
           
 
Method Summary
 boolean getProperty(String key, boolean def)
          Get a property from the local windchill properties list.
 int getProperty(String key, int def)
          Get a property from the local windchill properties list.
 String getProperty(String key, String def)
          Get a property from the local windchill properties list.
 boolean getServerProperty(String key, boolean def)
          Get a property from the server's windchill properties list.
 int getServerProperty(String key, int def)
          Get a property from the server's windchill properties list.
 String getServerProperty(String key, String def)
          Get a property from the server's windchill properties list.
 String getUsername()
          Returns the username currently being used for method invocation.
 Object invoke(String targetMethod, String targetClass, Integer targetObjectHandle, Class[] argTypes, Object[] newArgs)
          This method wraps RemoteMethodServer.invoke for Win32 applications to access transparently.
 void setPassword(String password)
          Set the password for authentication.
 void setUsername(String username)
          Sets the username for all transactions with Windchill.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localProperties

private static WTProperties localProperties

serverProperties

private static WTProperties serverProperties

VERBOSE

private static boolean VERBOSE

username

private String username

password

private String password

rms

private RemoteMethodServer rms

objectCache

private Hashtable objectCache
Constructor Detail

WindchillComponentImpl

public WindchillComponentImpl()
Method Detail

invoke

public Object invoke(String targetMethod,
                     String targetClass,
                     Integer targetObjectHandle,
                     Class[] argTypes,
                     Object[] newArgs)
              throws RemoteException,
                     InvocationTargetException
This method wraps RemoteMethodServer.invoke for Win32 applications to access transparently. Arguments to the invoked method may be any of the following primitive types or a String. Arguments are passed and results are returned through Variants. Supported types are: Any other types of input arguments or return values will cause an error (via ComFailException) with one exception: if the value returned from a method invocation is not one of the supported types, WindchillComponent will store the object and pass back a handle to it. This handle can be passed to future calls to invoke to use the saved object as the context for invocation. The saved object will be destroyed only when the component instance is destroyed.

The handle is passed back as an int (VT_I4) in a Variant. Passing 0 (zero) in for the handle will ignore the object store.

Specified by:
invoke in interface WindchillComponentIfc
Parameters:
targetMethod - The method to invoke.
targetClass - The class that contains the method.
targetObjectHandle - A handle to an object instance to invoke the method from, or 0 (zero).
Returns:
A Variant containing either the result of the method invocation or a handle to an object instance, stored for use in subsequent calls.
Throws:
RemoteException
InvocationTargetException

setUsername

public void setUsername(String username)
Sets the username for all transactions with Windchill. The username is set into the RemoteMethodServer along with the password for authentication. It it not recommended to try to use a single instance of this component with multiple users at the same time.

Specified by:
setUsername in interface WindchillComponentIfc
Parameters:
username - The username to authenticate as.

getUsername

public String getUsername()
Returns the username currently being used for method invocation.

Specified by:
getUsername in interface WindchillComponentIfc
Returns:
The username currently being used.

setPassword

public void setPassword(String password)
Set the password for authentication. The password is set into the RemoteMethodServer instance. It is not recommended to try to use a single instance of this component with multiple users at the same time.

Specified by:
setPassword in interface WindchillComponentIfc
Parameters:
password - The password for the current user.

getProperty

public boolean getProperty(String key,
                           boolean def)
Get a property from the local windchill properties list. The type of the property returned depends on the type of the default value passed in. Supported types are:

Specified by:
getProperty in interface WindchillComponentIfc
Parameters:
key - The property key to look up.
def - The default value to return if the property is not found.
Returns:
The value stored in the property or the default value.

getProperty

public int getProperty(String key,
                       int def)
Get a property from the local windchill properties list. The type of the property returned depends on the type of the default value passed in. Supported types are:

Specified by:
getProperty in interface WindchillComponentIfc
Parameters:
key - The property key to look up.
def - The default value to return if the property is not found.
Returns:
The value stored in the property or the default value.

getProperty

public String getProperty(String key,
                          String def)
Get a property from the local windchill properties list. The type of the property returned depends on the type of the default value passed in. Supported types are:

Specified by:
getProperty in interface WindchillComponentIfc
Parameters:
key - The property key to look up.
def - The default value to return if the property is not found.
Returns:
The value stored in the property or the default value.

getServerProperty

public boolean getServerProperty(String key,
                                 boolean def)
Get a property from the server's windchill properties list. The type of the property returned depends on the type of the default value passed in. Supported types are:

Specified by:
getServerProperty in interface WindchillComponentIfc
Parameters:
key - The property key to look up.
def - The default value to return if the property is not found.
Returns:
The value stored in the property or the default value.

getServerProperty

public int getServerProperty(String key,
                             int def)
Get a property from the server's windchill properties list. The type of the property returned depends on the type of the default value passed in. Supported types are:

Specified by:
getServerProperty in interface WindchillComponentIfc
Parameters:
key - The property key to look up.
def - The default value to return if the property is not found.
Returns:
The value stored in the property or the default value.

getServerProperty

public String getServerProperty(String key,
                                String def)
Get a property from the server's windchill properties list. The type of the property returned depends on the type of the default value passed in. Supported types are:

Specified by:
getServerProperty in interface WindchillComponentIfc
Parameters:
key - The property key to look up.
def - The default value to return if the property is not found.
Returns:
The value stored in the property or the default value.