ibi.broker.api.cci
Class PasswordCredential

java.lang.Object
  extended by ibi.broker.api.cci.PasswordCredential
All Implemented Interfaces:
Credential, java.io.Serializable, javax.resource.cci.ConnectionSpec

public final class PasswordCredential
extends java.lang.Object
implements Credential, java.io.Serializable

 THis class is used to pass user name and password information to the 
 CasterConnectionFactory.getConnection() method.
 The code below illustrates how the CasterConnectionFactory class is 
 used. This sample code below is taken from the samples packaged with the product.

 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++      
 +  Copyright (c) 2004 Information Builders, Inc. All  Rights Reserved.     +      
 +                                                                          +      
 +  Information Builders offers sample API programs as a heuristic device.  +      
 +  They are not intended, as is, for production use. Licensed users are    +      
 +  welcome to alter and extend these samples and deploy them in other      +      
 +  environments, or alternate configurations, as they see fit.             +      
 +  Information Builders will support the documented functionality of       +      
 +  its API classes and methods. However, Information Builders is not       +      
 +  responsible for functionality or behavior of products built with        +      
 +  its API unless the documented behavior of its discrete classes and      +      
 +  methods is different than the actual results.                           +      
 +                                                                          +      
 +  Redistributions of IBI source code and documentation must be within     +      
 +  the scope of the Information Builders Software License Agreement.       +      
 +                                                                          +      
 + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   

 package ibi.broker.api.samples;

import ibi.broker.api.CasterManagedConnectionFactory;
import ibi.broker.api.cci.CasterConnection;
import ibi.broker.api.cci.CasterConnectionFactory;
import ibi.broker.api.cci.PasswordCredential;

import java.util.ResourceBundle;

import javax.resource.cci.ConnectionSpec;

public class Util 
{
        public static CasterConnection createCasterConnection() throws Exception
        {
                ResourceBundle bundle = null;
                String host = "localhost";
                String port = "8200";
                String user = "admin";
                String password = "";

                try
                {
                        bundle = ResourceBundle.getBundle("ibi.broker.api.samples.samples");
                        host = bundle.getString("host");
                        port = bundle.getString("port");
                        user = bundle.getString("user");
                        password = bundle.getString("password");
                        
                }
                catch(Exception ex){}
                CasterManagedConnectionFactory managedConnectionFactory = new CasterManagedConnectionFactory();
                managedConnectionFactory.setServerName(host);
                managedConnectionFactory.setPortNumber(port);
                CasterConnectionFactory connectionFactory = (CasterConnectionFactory)managedConnectionFactory.createConnectionFactory();
                ConnectionSpec credential = new PasswordCredential(user, password.toCharArray());
                return ((CasterConnection)connectionFactory.getConnection(credential));
        }
          

Author:
unxyxc
See Also:
Serialized Form

Constructor Summary
PasswordCredential()
          Constructor of PasswordCredential.
PasswordCredential(java.lang.String userName, char[] password)
          Constructor of PasswordCredential.
 
Method Summary
 char[] getPassword()
          Returns the password as a character Array.
 java.lang.String getUserName()
          Retrieves this user's name.
 void setPassword(char[] password)
          Sets this password, as a character Array, to this PasswordCredential.
 void setUserName(java.lang.String username)
          Set user name to PasswordCredential.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PasswordCredential

public PasswordCredential()
Constructor of PasswordCredential.


PasswordCredential

public PasswordCredential(java.lang.String userName,
                          char[] password)
Constructor of PasswordCredential.

Parameters:
userName - String A String representing the user name.
password - char[] A character Array representing the password.
Method Detail

getPassword

public char[] getPassword()
Returns the password as a character Array.

Returns:
char[] A character array representing the password.

getUserName

public java.lang.String getUserName()
Retrieves this user's name.

Specified by:
getUserName in interface Credential
Returns:
String A string representing the user's name.

setPassword

public void setPassword(char[] password)
Sets this password, as a character Array, to this PasswordCredential.

Parameters:
password - A character Array representing this password.

setUserName

public void setUserName(java.lang.String username)
Set user name to PasswordCredential.

Parameters:
username - A String representing this user name.


Copyright © 2006 Information Builders, Incorporated.