org.openptk.connection
Class Setup

java.lang.Object
  extended by org.openptk.connection.Setup
All Implemented Interfaces:
SetupIF

public class Setup
extends java.lang.Object
implements SetupIF

Boot-straps the connection to the Server.
A client-side Properties file is used to determine relationship between the server and a client. The Properties file must contain the following information:


openptk.connection.clientid=_CLIENT_ID_
openptk.connection.sharedsecret=_SHARED_SECRET_
openptk.connection.uri=http://localhost:8080/openptk

The clientid and sharedsecret are used to establish a trust between the client and the server.
In addition to this data, a userid and password may be used to obtain the "connection".

Author:
Scott Fehrman, Sun Microsystems, Inc.

Field Summary
 
Fields inherited from interface org.openptk.connection.SetupIF
CLASSNAME_CONNECTION, CLASSNAME_CONVERTER, CONNECTION_MODE_SESSIONID, CONNECTION_MODE_TOKEN, CONNECTION_MODE_USERPASS, NAMESPACE, PKG_CONNECTION, PKG_CONVERTER, PROP_CONNECTION_CLIENTID, PROP_CONNECTION_MODE, PROP_CONNECTION_PASSWORD, PROP_CONNECTION_SESSIONID, PROP_CONNECTION_SHAREDSECRET, PROP_CONNECTION_TOKEN, PROP_CONNECTION_URI, PROP_CONNECTION_USER, PROP_DEBUG, PROP_LOGFILE, SESSION_ID, URI_LOGIN, URI_LOGOUT, URI_RESOURCES
 
Constructor Summary
Setup(java.lang.String propertyFile)
           Create a new Setup object using the specified Property file.
 
Method Summary
 ConnectionIF getConnection()
          Returns a connection, no user name, no user password.
 ConnectionIF getConnection(java.lang.String token)
          Returns a connection, only token
 ConnectionIF getConnection(java.lang.String user, java.lang.String password)
          Returns a connection, authenticates with user name and user password.
 boolean isDebug()
          Get the debug flag.
 ConnectionIF useConnection(java.lang.String sessionId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Setup

public Setup(java.lang.String propertyFile)
      throws ConnectionException

Create a new Setup object using the specified Property file.

Setup setup = new Setup("openptk_client");

Parameters:
propertyFile - name of the Property file
Throws:
java.lang.Exception
ConnectionException
Method Detail

getConnection

public final ConnectionIF getConnection()
                                 throws ConnectionException,
                                        AuthenticationException
Returns a connection, no user name, no user password.

Specified by:
getConnection in interface SetupIF
Returns:
ConnectionIF
Throws:
java.lang.Exception
ConnectionException
AuthenticationException

getConnection

public final ConnectionIF getConnection(java.lang.String token)
                                 throws ConnectionException,
                                        AuthenticationException
Returns a connection, only token

Specified by:
getConnection in interface SetupIF
Parameters:
token - unique value
Returns:
ConnectionIF
Throws:
java.lang.Exception
ConnectionException
AuthenticationException

getConnection

public final ConnectionIF getConnection(java.lang.String user,
                                        java.lang.String password)
                                 throws ConnectionException,
                                        AuthenticationException
Returns a connection, authenticates with user name and user password.

Specified by:
getConnection in interface SetupIF
Parameters:
user - unique id for the end-user
password - authenticate the end-user
Returns:
ConnectionIF
Throws:
java.lang.Exception
ConnectionException
AuthenticationException

isDebug

public final boolean isDebug()
Description copied from interface: SetupIF
Get the debug flag.

Specified by:
isDebug in interface SetupIF
Returns:
boolean

useConnection

public final ConnectionIF useConnection(java.lang.String sessionId)
                                 throws ConnectionException,
                                        AuthenticationException
Specified by:
useConnection in interface SetupIF
Parameters:
sessionId - String a current and valid session id
Returns:
ConnectionIF a connection
Throws:
ConnectionException
AuthenticationException


View/submit a bug or feature

For further API reference and developer documentation, see www.openptk.org. That documentation contains more detailed, developer-targeted descriptions, definitions of terms, workarounds, and working code examples.

Copyright (C) 2008-2012, Project OpenPTK. All Rights Reserved