public class PortalContext extends Object
PortalContext
create and manage connections to
Portal.
A connection is made by opening an Portal context, which is a communication
channel between a client application and the Portal server. All data in the
Portal server is accessed by using an open context. You can open a context
through the class constructor by passing it login information, or by using
one of the open
or connect
methods. It's best to
create a default instance of PortalContext
and use one of these
methods to open the context:
connect()
connect(Properties uprops)
open(Flist flist)
Infranet.properties
file in the application
classpath.java.util.Properties
object passed in.FList
passed in.Modifier and Type | Field and Description |
---|---|
static String |
Hostname |
static int |
OPFLG_ADD_ENTRY
Opcode control flag.
|
static int |
OPFLG_CALC_ONLY
Opcode control flag.
|
static int |
OPFLG_CHACHABLE
Opcode control flag.
|
static int |
OPFLG_COUNT_ONLY
Opcode control flag.
|
static int |
OPFLG_META_ONLY
Opcode control flag.
|
static int |
OPFLG_NO_DESCEND
Opcode control flag.
|
static int |
OPFLG_NO_RESULTS
Opcode control flag.
|
static int |
OPFLG_READ_READPAST |
static int |
OPFLG_READ_RESULT
Opcode control flag.
|
static int |
OPFLG_READ_UNCOMMITTED
Opcode control flag.
|
static int |
OPFLG_REV_CHECK
Opcode control flag.
|
static int |
OPFLG_SEARCH_DB
Opcode control flag.Used by CM to skip schema search and by DMTT to
search Oracle DB.
|
static int |
OPFLG_SEARCH_ONE_PARTITION
Opcode control flag.Used by DM to enforce local search
|
static int |
OPFLG_SEARCH_PARTITIONS
Opcode control flag.Used by DM to search including all logical
partitions.
|
static int |
OPFLG_USE_POID_GIVEN
Opcode control flag.
|
static String |
ProgramName |
static int |
TRAN_OPEN_GLOBALTRANSACTION
Flag used with the
PCM_OP_TRANS_OPEN opcode to open a
multi-schema global transaction. |
static int |
TRAN_OPEN_LOCK_OBJ
Flag used with the
PCM_OP_TRANS_OPEN opcode to open a
lock-object transaction. |
static int |
TRAN_OPEN_READONLY
Flag used with the
PCM_OP_TRANS_OPEN opcode to open a
read-only transaction. |
static int |
TRAN_OPEN_READWRITE
Flag used with the
PCM_OP_TRANS_OPEN opcode to open a
read-write transaction. |
Modifier | Constructor and Description |
---|---|
|
PortalContext()
Creates a default instance of
PortalContext . |
|
PortalContext(boolean sockKeepAlive)
Creates a default instance of
PortalContext . |
|
PortalContext(Boolean pcpDebug,
boolean sockKeepAlive)
Creates a default instance of
PortalContext . |
|
PortalContext(FList login)
Creates an instance of
PortalContext , and opens a
connection. |
|
PortalContext(FList login,
Properties uprops)
Creates an instance of
PortalContext , and opens a
connection. |
|
PortalContext(FList login,
Properties props,
Boolean pcpDebug)
This constructor is added to pass PCP debug parameter outside properties
file Applications which are not passing properties file can set debug_pcp
flag to turn on the PCP level debugging
|
|
PortalContext(com.portal.pcm.PCPContext ctx) |
|
PortalContext(PCPSelector selector)
========================================================================
=================== NIO Constructors
======================================
=====================================================
|
|
PortalContext(PCPSelector selector,
FList login,
Properties uprops) |
protected |
PortalContext(PortalContext srcPortalCtx)
Allow a subclass to create an instance of PortalContext using connection
information from an existing PortalContext object.
|
|
PortalContext(Properties uprops)
Creates an instance of
PortalContext , and opens a
connection. |
Modifier and Type | Method and Description |
---|---|
void |
addConnectionListner(CMConnectionListener abc)
Adds a Listerner to the existing connection pool of listeners
|
static void |
clearThreadInfo() |
PortalContext |
cloneConnection()
/** Clones this PortalContext.
|
void |
close(boolean logout)
Closes a connection context with the server.
|
void |
connect()
Opens a connection context with the server.
|
void |
connect(Properties uprops)
Opens a connection context with the server.
|
void |
disconnect()
Disconnects from server.
|
void |
enableOpcodeLogging(boolean enable)
Enables or disables opcode logging.
|
static String |
genCorrelationId() |
static String |
genCorrelationId(int opcode) |
static String |
genCorrelationId(int opcode,
String ctxStr) |
static String |
genCorrelationId(String pName,
int opcode,
int salt) |
static String |
genCorrelationId(String pName,
int opcode,
int salt,
String ctxStr) |
com.portal.pcm.PCPContext |
getContext() |
String |
getContextInfoDetails(FList in) |
static String |
getCorrelationId() |
long |
getCurrentDB()
Retrieves the database number the current context is connected to.
|
static ErrorLog |
getDefaultLog()
Retrieves the default error-log object.
|
String |
getHost()
Retrieves the host name from the current connection.
|
InetAddress |
getInetAddress() |
InetAddress |
getLocalAddress() |
int |
getLocalPort() |
String |
getPort()
Retrieves the port number from the current connection.
|
int |
getReasonCode() |
Poid |
getSession()
Retrieves the session ID from the current connection.
|
int |
getSocketChannelHashCode() |
SocketChannelListener |
getSocketChannelListener() |
int |
getSocketChannelPort() |
int |
getTransState() |
Poid |
getUserID()
Retrieves the user ID from the current connection.
|
String |
getUserName()
Retrieves the user name from the current connection.
|
static String |
getUserProperty(String key)
Retrieves a property value from the
Infranet.properties file. |
static void |
initHostnameAndProgramName(String pName)
Initialize Hostname and Program name of corrleation id.
|
boolean |
isContextValid()
Checks if the underlying PCP Context is valid or not Called from external
programs to check if the PortalContext is useable
|
boolean |
isOpcodeLoggingEnabled()
Checks if opcode logging is enabled.
|
boolean |
isSocketChannelConnected() |
boolean |
isSocketChannelOpen() |
boolean |
isSocketChannelRegistered() |
FList |
opcode(int op,
FList in)
Sends an opcode to the server.
|
FList |
opcode(int op,
int flags,
FList in)
Sends an opcode to the server with a control flag.
|
FList |
opcodeReceive() |
FList |
opcodeReceive(long socketTimeOutVal) |
FList |
opcodeReceive(long timeOutVal,
long socketTimeOutVal) |
void |
opcodeSend(int op,
FList in) |
void |
opcodeSend(int op,
int flags,
FList in) |
void |
open(FList in)
Opens a connection context with the server.
|
static void |
parseConnectString(String cStr,
FList into)
Converts the connection string from URL format to flist format.
|
void |
reconnect()
Reconnects a closed PortalContext with the same parameters as it was last
opened with.
|
void |
reconnect(String pw)
Reconnects a closed PCPConnection with the same parameters as it was last
opened with, but with new password.
|
void |
reconnectAfterUpdatePwd(String tempPwd)
Reconnects a closed PortalContext with the updated FldPasswdClear
parameters.
|
static boolean |
recvCorrelation(FList inFlist) |
void |
removeConnectionListener(CMConnectionListener abc)
Deletes a Listerner to the existing connection pool of listeners
|
static void |
sendCorrelation(FList inFlist) |
FList |
serviceSearch(int op,
int flags,
FList in)
Performs a dual search.
|
static void |
setAppName(String appName)
Sets the application keyword to use when looking up properties.
|
static void |
setCorrelationId(String correlation) |
static void |
setLocalProperties(Properties uprops)
Deprecated.
This method is public to insure operability. It's for
internal use only.
|
void |
setSocketChannelListener(SocketChannelListener channelListener) |
static void |
setTimeout(int timeout)
Set global socket time-out, will be used when the infranet.properties
does not have timeout entry.
|
void |
setTimeoutOverrideOriginal(int timeout)
Exposing a method that is required by JCAA to override the timeout value
in case of commit and no_transaction mode
|
void |
transactionAbort()
Aborts a transaction.
|
void |
transactionCommit()
Commits a transaction.
|
void |
transactionOpen(int flags)
Opens a transaction on the current database.
|
void |
transactionOpen(int flags,
long dbNumber)
Opens a transaction on the database.
|
public static final int OPFLG_NO_DESCEND
PCM_OP_READ_OBJECT
opcode. Only reads substructs or arrays that are explicitly given on the
input filst. Use this flag when reading fields and objects.public static final int OPFLG_META_ONLY
public static final int OPFLG_REV_CHECK
public static final int OPFLG_COUNT_ONLY
public static final int OPFLG_ADD_ENTRY
public static final int OPFLG_USE_POID_GIVEN
public static final int OPFLG_CALC_ONLY
public static final int OPFLG_READ_RESULT
public static final int OPFLG_NO_RESULTS
public static final int OPFLG_CHACHABLE
public static final int OPFLG_READ_UNCOMMITTED
public static final int OPFLG_READ_READPAST
public static final int OPFLG_SEARCH_DB
public static final int OPFLG_SEARCH_PARTITIONS
public static final int OPFLG_SEARCH_ONE_PARTITION
public static final int TRAN_OPEN_READONLY
PCM_OP_TRANS_OPEN
opcode to open a
read-only transaction. Use this flag when the operation will not change
any data in the transaction. Any number of read-only transactions can be
opened against a database at once.public static final int TRAN_OPEN_READWRITE
PCM_OP_TRANS_OPEN
opcode to open a
read-write transaction. Use this flag when you write to the database.
Changes made to the data set are not final until the transaction is
committed. Any number of read-write transactions can be opened against a
database at once.public static final int TRAN_OPEN_LOCK_OBJ
PCM_OP_TRANS_OPEN
opcode to open a
lock-object transaction. This flag locks a storable object as part of the
transaction. No changes can be made to the object by other transactions
until the current transaction is closed. If this flag is specified, the
TRANS_OPEN_READWRITE
flag must also be specified.public static final int TRAN_OPEN_GLOBALTRANSACTION
PCM_OP_TRANS_OPEN
opcode to open a
multi-schema global transaction. This flag is used to indicate that the
transaction is executed in a multi-schema environment and must be
considered as a global transaction. TRANS_OPEN_READWRITE
flag must also be specified.public static String Hostname
public static String ProgramName
public PortalContext(com.portal.pcm.PCPContext ctx)
public PortalContext() throws EBufException
PortalContext
. This does not
open a connection to the server. You must open a connection using one of
the open
or connect
methods before any
transactions can be performed.EBufException
- thrown if an error occurs.public PortalContext(boolean sockKeepAlive) throws EBufException
PortalContext
. This does not
open a connection to the server. You must open a connection using one of
the open
or connect
methods before any
transactions can be performed.sockKeepAlive
- A boolean value to enable socket level parameters.EBufException
- thrown if an error occurs.public PortalContext(Boolean pcpDebug, boolean sockKeepAlive) throws EBufException
PortalContext
. This does not
open a connection to the server. You must open a connection using one of
the open
or connect
methods before any
transactions can be performed.pcpDebug
- - allows to pass a flag to turn on PCP debugsockKeepAlive
- - allows to pass a flag to turn on socket keepaliveEBufException
- thrown if an error occurs.public PortalContext(FList login) throws EBufException
PortalContext
, and opens a
connection. Configuration settings for the context are defined in the
flist passed in. The flist must be in the form:
0 PIN_FLD_POID POID [0] 0.0.0.1 /service/pcm_client 0 0 0 PIN_FLD_TYPE ENUM [0] 1 0 PIN_FLD_LOGIN STR [0] "root.0.0.0.1" 0 PIN_FLD_PASSWD_CLEAR STR [0] "password" 0 PIN_FLD_TIMEOUT_IN_MS INT [0] 30000 0 PIN_FLD_CM_PTRS ARRAY [0] allocated 1, used 1 1 PIN_FLD_CM_PTR STR [0] "ip <<I>server_hostname</I>> 11960"
For an example of opening a context using an flist passed in, see Sample Programs in the Portal online documentation.
login
- A login FList
containing configuration settings
for the context.EBufException
- thrown if an error occurs.public PortalContext(Properties uprops) throws EBufException
PortalContext
, and opens a
connection. Configuration settings for the context are defined in the
Properties
object passed in. The Properties
object requires two key/value entries:
<U> Key: Value: </U> <B>Infranet.connect</B> <I>Connection_string</I> <B>Infranet.login.type</B> 1The connection requires login, password, host, port, service and login type. The format for the connection string is:
pcp://:@:/service/adminclient 1
uprops
- A Properties
object containing configuration
settings for the context.EBufException
- thrown if an error occurs.public PortalContext(FList login, Properties props, Boolean pcpDebug) throws EBufException
login
- - props
- - pcpDebug
- - EBufException
- thrown if an error occurs.public PortalContext(FList login, Properties uprops) throws EBufException
PortalContext
, and opens a
connection. Configuration settings for the context are taken from the
flist passed in. The flist must be in the form:
0 PIN_FLD_POID POID [0] 0.0.0.1 /service/pcm_client 0 0 0 PIN_FLD_TYPE ENUM [0] 1 0 PIN_FLD_LOGIN STR [0] "root.0.0.0.1" 0 PIN_FLD_PASSWD_CLEAR STR [0] "password" 0 PIN_FLD_TIMEOUT_IN_MS INT [0] 30000 0 PIN_FLD_CM_PTRS ARRAY [0] allocated 1, used 1 1 PIN_FLD_CM_PTR STR [0] "ip <<I>server_hostname</I>> 11960"
For an example of opening a context using an flist passed in, see the Sample Programs in the Portal online documentation.
login
- A login FList
containing configuration settings
for the context.uprops
- A Properties
object for configuration settings.
Its value can be null.
NOTE: uprops
is not implemented in this
constructor; it is for future usability.
EBufException
- thrown if an error occurs.
Opcode and Flist Logging:
To enable opcode and flist logging, you will need to add
the following to your Infranet.properties file:
infranet.log.opcodes.enabled=true
infranet.log.opcodes.file=[opcode logfile]
NOTE: [opcode logfile] is the name of your logfile.
EXAMPLE: infranet.log.opcodes.file=d:/temp/opcode.log
NOTE: you cannot use backslash "\" characters in your
directory structureprotected PortalContext(PortalContext srcPortalCtx)
Important: The source PortalContext is reset do its initial state once it's used; it is no longer connected to Portal. Generally, you should refrain from using it, however, if you must, you need to reopen the connection.
srcPortalCtx
- PortalContext whose Portal connected is adopted by the
newly-created PortalContext. The source PortalContext is reset
to its default values after being used.public PortalContext(PCPSelector selector) throws EBufException
EBufException
public PortalContext(PCPSelector selector, FList login, Properties uprops) throws EBufException
EBufException
public void addConnectionListner(CMConnectionListener abc)
public void removeConnectionListener(CMConnectionListener abc)
public static void setTimeout(int timeout)
public void setTimeoutOverrideOriginal(int timeout)
timeout
- public PortalContext cloneConnection() throws EBufException
EBufException
public void transactionOpen(int flags) throws EBufException
PCM_OP_TRANS_OPEN
opcode and keeps track of
the transaction state. Only one transaction can be opened at a time on
the context. If you want to execute another transaction, you must open
another context.
The type of transaction is determined by the flags
parameter. For more information on transactions and the transaction
flags, see the PCM_OP_TRANS_OPEN
opcode in the Portal online
documentation.
flags
- Transaction flag that defines the type of transaction to open.EBufException
- is thrown if an error occurs.TRAN_OPEN_READONLY
,
TRAN_OPEN_READWRITE
,
TRAN_OPEN_LOCK_OBJ
public void transactionOpen(int flags, long dbNumber) throws EBufException
PCM_OP_TRANS_OPEN
opcode and keeps track of
the transaction state. Only one transaction can be opened at a time on
the context. If you want to execute another transaction, you must open
another context.
The type of transaction is determined by the flags
parameter. For more information on transactions and the transaction
flags, see the PCM_OP_TRANS_OPEN
opcode in the Portal online
documentation.
flags
- Transaction flag that defines the type of transaction to open.dbNumber
- The database number where transaction is being openedEBufException
- is thrown if an error occurs.TRAN_OPEN_READONLY
,
TRAN_OPEN_READWRITE
,
TRAN_OPEN_LOCK_OBJ
public void transactionCommit() throws EBufException
PCM_OP_TRANS_COMMIT
opcode. Committing a transaction causes
all data changes to take effect and closes the open transaction. For more
information, see PCM_OP_TRANS_COMMIT
in the Portal online
documentation.EBufException
- is thrown if an error occurs.transactionOpen(int)
public void transactionAbort() throws EBufException
PCM_OP_TRANS_ABORT
opcode. When a transaction is aborted,
all data changes made in the transaction are discarded and the
transaction is closed. For more information, see the
PCM_OP_TRANS_ABORT
opcode in the Portal online
documentation.EBufException
- is thrown if an error occurs.transactionOpen(int)
public void open(FList in) throws EBufException
0 PIN_FLD_POID POID [0] 0.0.0.1 /service/pcm_client 0 0 0 PIN_FLD_TYPE ENUM [0] 1 0 PIN_FLD_LOGIN STR [0] "root.0.0.0.1" 0 PIN_FLD_PASSWD_CLEAR STR [0] "password" 0 PIN_FLD_TIMEOUT_IN_MS INT [0] 30000 0 PIN_FLD_CM_PTRS ARRAY [0] allocated 1, used 1 1 PIN_FLD_CM_PTR STR [0] "ip <<I>server_hostname</I>> 11960"
For an example of opening a context using an flist passed in, see Sample Programs in the Portal online documentation.
in
- FList
containing configuration settings for the
context.EBufException
- is thrown if an error occurs.public void close(boolean logout) throws EBufException
true
.logout
- true
to logout from the server.EBufException
- is thrown if an error occurs.public boolean isContextValid()
true
if underlying pcp context is not nullpublic void disconnect() throws EBufException
EBufException
- is thrown if an error occurs.public FList serviceSearch(int op, int flags, FList in) throws EBufException
op
- An opcode to perform. For a list of opcodes, see the
PortalOp
class.flags
- Control flag for the opcode being called. See the individual
opcode descriptions for information on the flags they take.
NOTE: Most opcodes take no flags, which you enter as 0.in
- The opcode input FList
. For a list of mandatory
and optional fields for the input flist, see the relevant
opcode description, which provides a link to input flist
specifications.FList
. For a list of mandatory and
optional fields for the output flist, see the relevant opcode
description, which provides a link to output flist
specifications.EBufException
- is thrown if an error occurs.public void reconnect() throws EBufException
EBufException
- is thrown if an error occurs.public void reconnect(String pw) throws EBufException
EBufException
- is thrown if an error occurs.public void reconnectAfterUpdatePwd(String tempPwd) throws EBufException
EBufException
- is thrown if an error occurs.public void connect() throws EBufException
Infranet.properties
file. You must put a valid
Infranet.properties
file in your CLASSPATH. For
information about setting properties in the
Infranet.properties
file, see the Setting global
options section of Creating Client Applications by Using Java
PCM in the Portal online documentation.EBufException
- is thrown if an error occurs.public void connect(Properties uprops) throws EBufException
Infranet.properties
file to see if it has
been read. If the file has been read, it retrieves configuration settings
from that file. If the file has not yet been read, it retrieves settings
for the connection from the Properties
object passed in. The
Properties
object requires two key/value entries:
<U> Key: Value: </U> <B>Infranet.connect</B> <I>Connection_string</I> <B>Infranet.login.type</B> 1The connection requires login, password, host, port, service and login type. The format for the connection string is:
pcp://:@:/service/adminclient 1
uprops
- A Properties object containing configuration settings for the
context.EBufException
- is thrown if an error occurs.public void enableOpcodeLogging(boolean enable)
Infranet.properties
must have a filename entry to set
the destination log. For example:
infranet.log.opcodes.file = mylog.log
For more information, see the Setting global options section of Creating Client Applications by Using Java PCM in the Portal online documentation.
enable
- Set to true to enable opcode logging.public boolean isOpcodeLoggingEnabled()
true
if opcode logging is enabled.public FList opcode(int op, int flags, FList in) throws EBufException
PCM_OP()
opcode in the Portal online documentation.op
- An opcode to perform. For a list of opcodes, see the
PortalOp
class.flags
- Control flag for the opcode being called. See the individual
opcode descriptions for information on the flags they take.
NOTE: Most opcodes take no flags, which you enter as 0.in
- The opcode input FList
. For a list of mandatory
and optional fields for the input flist, see the relevant
opcode description, which provides a link to input flist
specifications.FList
. For a list of mandatory and
optional fields for the output flist, see the relevant opcode
description, which provides a link to output flist
specifications.EBufException
- is thrown if an error occurs.public FList opcode(int op, FList in) throws EBufException
PCM_OP()
opcode in the Portal online documentation.op
- An opcode to perform. For a list of opcodes, see the
PortalOp
class.in
- The opcode input FList
. For a list of mandatory
and optional fields for the input flist, see the relevant
opcode description, which provides a link to input flist
specifications.EBufException
- is thrown if an error occurs.public void opcodeSend(int op, FList in) throws EBufException
EBufException
public void opcodeSend(int op, int flags, FList in) throws EBufException
EBufException
public boolean isSocketChannelConnected()
public boolean isSocketChannelOpen()
public boolean isSocketChannelRegistered()
public InetAddress getInetAddress()
public InetAddress getLocalAddress()
public int getLocalPort()
public int getSocketChannelPort()
public int getSocketChannelHashCode()
public FList opcodeReceive() throws EBufException
EBufException
public FList opcodeReceive(long socketTimeOutVal) throws EBufException
EBufException
public FList opcodeReceive(long timeOutVal, long socketTimeOutVal) throws EBufException
EBufException
public Poid getUserID()
public Poid getSession()
public String getUserName()
public String getHost()
public String getPort()
public long getCurrentDB()
public static ErrorLog getDefaultLog() throws EBufException
ErrorLog
object representing the default log,
javapcm.log
.EBufException
- is thrown if an error occurs.ErrorLog
public static String getUserProperty(String key)
Infranet.properties
file.key
- The name of the property to look up.public static void setLocalProperties(Properties uprops) throws EBufException
Properties
object.uprops
- A Properties
object containing configuration
settings for the context.EBufException
- thrown if an error occurs.public static void setAppName(String appName)
PortalContext
s created in this VM.appName
- New application keyword.public static void parseConnectString(String cStr, FList into) throws ParseException, EBufException
'pcp://<username>:<password>@host:port/service/<service sub-type>'
This method can be used to convert the connection string in the
Infranet.properties
file before passing it as an
flist to the open
method.
cStr
- The connection string in URL format.into
- The FList
to parse into.EBufException
- thrown if an error occurs.ParseException
- thrown if unable to parse the string.public static void initHostnameAndProgramName(String pName)
pName
- The programe name to be used in correlation id.public static String genCorrelationId()
public static String genCorrelationId(int opcode)
public static String genCorrelationId(String pName, int opcode, int salt, String ctxStr)
public static String getCorrelationId()
public static void setCorrelationId(String correlation)
public static void sendCorrelation(FList inFlist)
public static void clearThreadInfo()
public int getReasonCode()
public static boolean recvCorrelation(FList inFlist)
public com.portal.pcm.PCPContext getContext()
public int getTransState()
public SocketChannelListener getSocketChannelListener()
public void setSocketChannelListener(SocketChannelListener channelListener)
Copyright © 2003, 2023, Oracle and/or its affiliates.