public abstract class PClientServices extends Object
PClientServices
is an interface that defines methods
that must be implemented in all client classes. This interface includes methods
for getting resources, connecting to Portal, getting permissions, and so forth.
Services that are specific to the application type (applet, application, or
build-time component) are provided by specific subclasses, which are retrieved
through a factory method in PClientContext
.
BAS needs to be initalized using one of two methods: init()
or
doLogin()
. doLogin
internally creates a connection
to Portal based on the login information supplied. init()
allows initializing BAS using an existing PortalContext.
PClientContext
Modifier and Type | Field and Description |
---|---|
protected PBAServer |
mBAServer |
protected PInfranetConnection |
mConnection |
protected oracle.help.CSHManager |
mCSHManager |
protected Properties |
mDefaults |
protected oracle.help.Help |
mHelp |
protected oracle.help.library.helpset.HelpSet |
mHelpSet |
protected ThreadPool |
mPool |
protected ResourceBundle |
mResources |
protected static String |
RESKEY |
Constructor and Description |
---|
PClientServices() |
Modifier and Type | Method and Description |
---|---|
void |
addResourceBundle(String res)
Adds resources to the internal stack.
|
int |
confirmationMsg(String msg)
Display a confirmation dialog containing the specified message and
2 choices for the user (YES or NO).
|
int |
confirmationMsg(String msg,
int def)
Display a confirmation dialog containing the specified message, default
title and 2 choices for the user (YES or NO).
|
int |
confirmationMsg(String msg,
String title)
Display a confirmation dialog containing the specified message, title
and 2 choices for the user (YES or NO).
|
int |
confirmationMsg(String msg,
String title,
int def)
Display a confirmation dialog containing the specified message, title
and 2 choices for the user (YES or NO).
|
boolean |
connect(String name,
String password,
String connectInfo)
Uses login information to establish a connection with Portal and
initialize BAS subsystem.
|
Object |
createClass(String className)
Used to dynamically create instances of Customer Center beans and
drilldowns and provide the ability for customers to override them.
|
PInfranetException |
createClientException(EBufException ebuf) |
PControllerBean |
createController(String controllerClass)
Registers an Portal component with the server.
|
Object |
createDialogClass(String className,
boolean isModal,
String title) |
static PModelHandle |
createModelHandle(Object model,
String type)
Creates and returns a model handle of type
type for
model , which is not cached. |
PModelHandle |
createNewModel(String type)
Creates a non-cached FList and a model handle of type
type
that wraps it. |
boolean |
doLogin(String name,
String password)
Uses login information to establish a connection with Portal and
initialize BAS subsystem.
|
boolean |
doLogin(String name,
String password,
String connectInfo)
Uses login information to establish a connection with Portal and
initialize BAS subsystem.
|
void |
doLogout()
Logs out of the Portal server, and closes the connection to it.
|
void |
errorMsg(Component parent,
String msg,
boolean fromRes)
Displays an error dialog with the passed-in message.
|
void |
errorMsg(Component parent,
String msg,
Object[] args)
Displays an error dialog with the passed-in message.
|
void |
errorMsg(Component parent,
String msg,
String helpID,
boolean fromRes)
Displays an error dialog with the passed-in message.
|
int |
errorMsg(Component parent,
String msg,
String title,
Object[] options,
int errType)
Displays an error dialog with the passed-in message and given dialog type with given set of button
options
|
String |
getClassToInstantiate(String className)
Used to determine if a class you are dynamically instantiating has been
subclassed by the user.
|
PortalContext |
getContext() |
oracle.help.CSHManager |
getCSHManager()
Returns a
CSHManager object, should one be needed. |
oracle.help.library.helpset.HelpSet |
getDefaultBook()
Returns a
HelpSet object, should one be needed. |
abstract Properties |
getDefaultProperties()
Gets the default properties, including properties that are specified
in the applet's "param" spec.
|
oracle.help.Help |
getHelpObj()
Returns a
Help object, should one be needed. |
abstract Component |
getMainPane()
Retrieves the lowest accessable view for this application.
|
Object |
getModelField(PModelHandle modl,
String desc)
Gets the contents of a specific field of a model.
|
boolean |
getPermissionFor(String componentName)
Gets permission to use a component.
|
String |
getResource(String base,
String tag)
Gets a specific resource.
|
ResourceBundle |
getResources()
Gets the applet resources.
|
PRestriction |
getRestrictionOn(String fieldSpec)
Gets restriction for a field.
|
abstract PBAServer |
getServer()
Gets a reference to the
PBAServer implementation. |
Properties |
getUserPreferences() |
boolean |
init(PortalContext ctx)
Initialize BAS subsystem using an existing PortalContext.
|
void |
initHelp()
Initializes the help system.
|
void |
invokeInThread(Runnable toRun)
Runs a task in a thread-pool managed thread.
|
void |
invokeInThread(Runnable toRun,
int relPriority)
Runs a task in a thread-pool managed thread in priority order.
|
boolean |
isConnectedToInfranet()
Deprecated.
|
protected boolean |
lastChanceLogin()
Called to establish an RMI connection to the BAS server for this client
While this used to also be associated with logging in to Portal,
that is no longer required.
|
ImageIcon |
loadImageIcon(String name)
Loads an
ImageIcon from a supplied location string. |
ImageIcon |
loadImageIcon(URL loc)
Loads an
ImageIcon from a supplied URL. |
void |
logRemote(String src,
String msg)
Serves as a debug feature.
|
void |
mergeHelp(Properties props)
Dynamically merges helpsets in the specified
Properties in tags of the
form: "subhelp.X" where X starts at 0 and increments by 1. |
void |
registerApp(String appName,
Locale locale,
Object data)
Registers the application with the server.
|
void |
registerComponent(PRemoteComponent comp,
String controllerClass)
Deprecated.
|
void |
registerHelpButton(Component button,
String helpID)
Enables help for help buttons, generally in dialog boxes.
|
void |
registerHelpIDFor(Component comp,
String helpID)
Registers a help ID to enable context-sensitive help for a component.
|
void |
releaseContext(PortalContext ctx) |
void |
saveUserPreferences()
Save user preferences Properties object to PIN_FLD_USER_PREFS
field in /service/admin_client.
|
void |
setModelField(PModelHandle modl,
String desc,
Object val)
Sets the value of a field in a model.
|
void |
setPropertyURL(URL newProps)
Sets the URL of the property file to use.
|
void |
setPropertyURL(URL newProps,
String res)
Sets the URL of the property file to use and the new resource file.
|
void |
setUserPreferences(Properties userPrefs)
Deprecated.
Don't pass a Properties object explicitly. Use
saveUserPreferences() instead and have this class
manage the preferences.
|
void |
unregisterComponent(PRemoteComponent comp) |
protected static final String RESKEY
protected ResourceBundle mResources
protected PInfranetConnection mConnection
protected PBAServer mBAServer
protected Properties mDefaults
protected oracle.help.library.helpset.HelpSet mHelpSet
protected oracle.help.Help mHelp
protected oracle.help.CSHManager mCSHManager
protected ThreadPool mPool
public static PModelHandle createModelHandle(Object model, String type)
type
for
model
, which is not cached. Although the model is not
cached, the returned handle can still be passed to lookupModel() of the
object cache to get back model
. However, the recommended
method for getting a non-cached model from a handle is
PModelHandle.getModel()
.model
- a non-null
object to be wrapped in a handletype
- the string representation of the object typemodel
.IllegalArgumentException
- if model
is null#createNewModel, PModelHandle
public abstract Component getMainPane()
PClientServices
returns a frame. For applets,
PClientServices
returns either
the applet panel or, if the "window" param is set to "frame" in
the source HTML document, an external frame.PAppletServices
,
PBuilderServices
,
PApplicationServices
public boolean init(PortalContext ctx)
ctx
- PortalContext that has already been connected to Portal.
This PortalContext should no longer be used once it's
been used to initialize BAS--it gets reset to its default
state and looses its connection to Portal.public boolean doLogin(String name, String password)
name
- the user's login namepassword
- the user's passwordpublic boolean doLogin(String name, String password, String connectInfo)
name
- the user's login namepassword
- the user's passwordconnectInfo
- a String
that contains connection information in URL
format, for example, protocol://host:portpublic boolean connect(String name, String password, String connectInfo) throws RemoteException
name
- the user's login namepassword
- the user's passwordconnectInfo
- a String
that contains connection information in URL
format, for example, protocol://host:portRemoteException
public void doLogout()
public PortalContext getContext()
public void releaseContext(PortalContext ctx)
public boolean isConnectedToInfranet()
public boolean getPermissionFor(String componentName)
componentName
- the name of the component to testpublic PRestriction getRestrictionOn(String fieldSpec)
fieldSpec
- the field's specificationpublic Properties getUserPreferences()
public void saveUserPreferences()
public void setUserPreferences(Properties userPrefs)
A
- non-null Properties object containing the users preferences.public ResourceBundle getResources()
ResourceBundle
object.public void addResourceBundle(String res)
res
- a String
that contains the resource bundle namepublic String getResource(String base, String tag)
base
- the resource base string. Usually specified as
a property of a PAppComponent
tag
- the resource name tag. This is appended to the base
resource name, separated by a dot (.) and used to find a
a resource. If not found, it is looked for alone (not
appended to the base name), and if still not found,
it is returned itself.public void initHelp()
public void mergeHelp(Properties props) throws oracle.help.library.helpset.HelpSetParseException
Properties
in tags of the
form: "subhelp.X" where X starts at 0 and increments by 1.props
- the property file to look inoracle.help.library.helpset.HelpSetParseException
- thrown for helpset errorspublic oracle.help.CSHManager getCSHManager()
CSHManager
object, should one be needed.CSHManager
object.public oracle.help.library.helpset.HelpSet getDefaultBook()
HelpSet
object, should one be needed.HelpSet
object.public oracle.help.Help getHelpObj()
Help
object, should one be needed.Help
object.public void registerHelpIDFor(Component comp, String helpID)
comp
- the component to register help forhelpID
- the context help identifierpublic void registerHelpButton(Component button, String helpID) throws IllegalArgumentException
button
- the help button to enablehelpID
- the help ID to associate with the buttonIllegalArgumentException
- thrown if the button is not
java.awt.Button
or javax.swing.AbstractButton
(or a derivitive of either)public void registerApp(String appName, Locale locale, Object data) throws RemoteException
appName
- the application namelocale
- the client's localedata
- other application-specific dataRemoteException
- thrown for errorspublic void registerComponent(PRemoteComponent comp, String controllerClass) throws RemoteException
comp
- the Portal component implementation objectcontrollerClass
- the name of the controller class for this componentRemoteException
- thrown for errorspublic void unregisterComponent(PRemoteComponent comp) throws RemoteException
RemoteException
public PControllerBean createController(String controllerClass) throws RemoteException
controllerClass
- The name of the controller class for this componentPControllerBean
object.RemoteException
- RemoteException thrown for errorspublic abstract Properties getDefaultProperties()
Properties
object.public void errorMsg(Component parent, String msg, Object[] args)
parent
- the Component
that triggered the messagemsg
- the error message tag; loads message from the resource fileargs
- an argument list with which to format msg
public void errorMsg(Component parent, String msg, boolean fromRes)
parent
- the Component
that triggered the messagemsg
- the error message to displayfromRes
- public void errorMsg(Component parent, String msg, String helpID, boolean fromRes)
parent
- the Component
that triggered the messagemsg
- the error message to displayhelpID
- the context help identifierfromRes
- public int errorMsg(Component parent, String msg, String title, Object[] options, int errType)
parent
- the Component
that triggered the messagemsg
- the error message to displaytitle
- the title of error dialogoptions
- button options for error dialogerrType
- type of dialog
-1 : Plain Dialog
0 : Error Dialog
1 : Information Dialog
2 : Warning Dialog
3 : Question Dialogpublic int confirmationMsg(String msg)
msg
- The confirmation message to displaymsg
- The confirmation message to displaypublic int confirmationMsg(String msg, int def)
msg
- The confirmation message to displayint
- The default button. Use JOptionPane.YES_OPTION or
JOptionPane.NO_OPTIONpublic int confirmationMsg(String msg, String title)
msg
- The confirmation message to displayint
- The default button. Use JOptionPane.YES_OPTION or
JOptionPane.NO_OPTIONpublic int confirmationMsg(String msg, String title, int def)
msg
- The confirmation message to displaytitle
- The title of the confirmation dialogint
- The default button. Use JOptionPane.YES_OPTION or
JOptionPane.NO_OPTIONpublic PModelHandle createNewModel(String type) throws RemoteException
type
that wraps it. If type
is not null
, empty, or
PModelHandle.UNTYPED
, a Poid of that type and id -1 is
inserted into the FList, which is the model of the returned handle.
Although the model is not cached, the handle can still be passed to
lookupModel()
of the object cache to get back the FList.
However, the recommended method for getting a non-cached model from a
handle is PModelHandle.getModel()
.type
- the string representation of an object typetype
that wraps an FList.RemoteException
#createModelHandle, PModelHandle
public void logRemote(String src, String msg)
src
- a String
that defines the message sourcemsg
- a message to logpublic Object getModelField(PModelHandle modl, String desc) throws RemoteException
modl
- the model to accessdesc
- a description of the field neededRemoteException
- thrown for all problems, including the
absence of the requested field in the specified modelpublic void setModelField(PModelHandle modl, String desc, Object val) throws RemoteException
modl
- the model to set a field indesc
- a description of the field to setval
- the new field's valueRemoteException
- thrown for all errorspublic void setPropertyURL(URL newProps)
newProps
- the new property file locationpublic void setPropertyURL(URL newProps, String res)
newProps
- the new property file locationres
- the resource file location override in propertiespublic ImageIcon loadImageIcon(URL loc)
ImageIcon
from a supplied URL.loc
- the URL for the image dataImageIcon
.public ImageIcon loadImageIcon(String name)
ImageIcon
from a supplied location string.name
- the file name of the image data. Assumes
that this file is located with other Java resources,
so the name should be package relative, for example,
"myImage.gif" or "com/portal/myapp/myImage.gif"ImageIcon
.public PInfranetException createClientException(EBufException ebuf)
public Object createClass(String className) throws ClassNotFoundException
className
- The class you want to dynamically instantiateClassNotFoundException
public Object createDialogClass(String className, boolean isModal, String title) throws ClassNotFoundException
ClassNotFoundException
public String getClassToInstantiate(String className)
className
- The class you want to dynamically instantiatepublic void invokeInThread(Runnable toRun)
toRun
- the task to runpublic void invokeInThread(Runnable toRun, int relPriority)
toRun
- the task to runrelPriority
- the relative priority of the task.
Can be +1 to +4 to run at higher priority than
normal, and -1 to -4 for lower priority.protected boolean lastChanceLogin() throws RemoteException
RemoteException
- thrown for errorsCopyright © 2003, 2023, Oracle and/or its affiliates.