|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectibi.broker.api.cci.PasswordCredential
public final class PasswordCredential
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));
}
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 |
---|
public PasswordCredential()
public PasswordCredential(java.lang.String userName, char[] password)
userName
- String A String representing the user name.password
- char[] A character Array representing the password.Method Detail |
---|
public char[] getPassword()
public java.lang.String getUserName()
getUserName
in interface Credential
public void setPassword(char[] password)
password
- A character Array representing this password.public void setUserName(java.lang.String username)
username
- A String representing this user name.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |