Package com.portal.bas
Class PClientServices
java.lang.Object
com.portal.bas.PClientServices
- Direct Known Subclasses:
PAppletServices
,PApplicationServices
,PBuilderServices
,PClientApplicationServices
,PPooledConnectionClientServices
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.
- Author:
- Larry Lynch-Freshner
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PBAServer
protected PInfranetConnection
protected oracle.help.CSHManager
protected Properties
protected oracle.help.Help
protected oracle.help.library.helpset.HelpSet
protected ThreadPool
protected ResourceBundle
protected static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Uses login information to establish a connection with Portal and initialize BAS subsystem.createClass
(String className) Used to dynamically create instances of Customer Center beans and drilldowns and provide the ability for customers to override them.createController
(String controllerClass) Registers an Portal component with the server.createDialogClass
(String className, boolean isModal, String title) static PModelHandle
createModelHandle
(Object model, String type) Creates and returns a model handle of typetype
formodel
, which is not cached.createNewModel
(String type) Creates a non-cached FList and a model handle of typetype
that wraps it.boolean
Uses login information to establish a connection with Portal and initialize BAS subsystem.boolean
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
Displays an error dialog with the passed-in message.void
Displays an error dialog with the passed-in message.void
Displays an error dialog with the passed-in message.int
Displays an error dialog with the passed-in message and given dialog type with given set of button optionsgetClassToInstantiate
(String className) Used to determine if a class you are dynamically instantiating has been subclassed by the user.oracle.help.CSHManager
Returns aCSHManager
object, should one be needed.oracle.help.library.helpset.HelpSet
Returns aHelpSet
object, should one be needed.abstract Properties
Gets the default properties, including properties that are specified in the applet's "param" spec.oracle.help.Help
Returns aHelp
object, should one be needed.abstract Component
Retrieves the lowest accessable view for this application.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.getResource
(String base, String tag) Gets a specific resource.Gets the applet resources.getRestrictionOn
(String fieldSpec) Gets restriction for a field.abstract PBAServer
Gets a reference to thePBAServer
implementation.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
Deprecated.protected boolean
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.loadImageIcon
(String name) Loads anImageIcon
from a supplied location string.loadImageIcon
(URL loc) Loads anImageIcon
from a supplied URL.void
Serves as a debug feature.void
mergeHelp
(Properties props) Dynamically merges helpsets in the specifiedProperties
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
void
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.void
-
Field Details
-
RESKEY
- See Also:
-
mResources
-
mConnection
-
mBAServer
-
mDefaults
-
mHelpSet
protected oracle.help.library.helpset.HelpSet mHelpSet -
mHelp
protected oracle.help.Help mHelp -
mCSHManager
protected oracle.help.CSHManager mCSHManager -
mPool
-
-
Constructor Details
-
PClientServices
public PClientServices()
-
-
Method Details
-
createModelHandle
Creates and returns a model handle of typetype
formodel
, 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 backmodel
. However, the recommended method for getting a non-cached model from a handle isPModelHandle.getModel()
.- Parameters:
model
- a non-null
object to be wrapped in a handletype
- the string representation of the object type- Returns:
- A model handle that wraps
model
. - Throws:
IllegalArgumentException
- ifmodel
is null
-
getMainPane
Retrieves the lowest accessable view for this application. This view is instance-specific; at build time, it won't be able to return anything. For applications,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.- Returns:
- A component.
- See Also:
-
init
Initialize BAS subsystem using an existing PortalContext. This method may be used as an alternative to doLogin(). See class comment for additional details.- Parameters:
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.
-
doLogin
Uses login information to establish a connection with Portal and initialize BAS subsystem. This method may be used as an alternative to init(). Call this before loading controls. See class comment for additional details.- Parameters:
name
- the user's login namepassword
- the user's password- Returns:
- True if login succeeds; false if it fails.
-
doLogin
Uses login information to establish a connection with Portal and initialize BAS subsystem. This method may be used as an alternative to init(). Call this before loading controls. See class comment for additional details.- Parameters:
name
- the user's login namepassword
- the user's passwordconnectInfo
- aString
that contains connection information in URL format, for example, protocol://host:port- Returns:
- True if login succeeds, false if it fails.
-
connect
Uses login information to establish a connection with Portal and initialize BAS subsystem. This method may be used as an alternative to init(). Call this before loading controls. See class comment for additional details. This is similar to doLogin the only difference being that this will throw a Remote Exception- Parameters:
name
- the user's login namepassword
- the user's passwordconnectInfo
- aString
that contains connection information in URL format, for example, protocol://host:port- Returns:
- True if login succeeds, false if it fails.
- Throws:
RemoteException
-
doLogout
public void doLogout()Logs out of the Portal server, and closes the connection to it. -
getContext
-
releaseContext
-
isConnectedToInfranet
public boolean isConnectedToInfranet()Deprecated.Checks for an open context. Usually called from an applet to see whether a login is needed.- Returns:
- True if login occurred; false otherwise.
-
getPermissionFor
Gets permission to use a component.- Parameters:
componentName
- the name of the component to test- Returns:
- True if use is permitted; false otherwise.
-
getRestrictionOn
Gets restriction for a field.- Parameters:
fieldSpec
- the field's specification- Returns:
- An object that describes the restrictions.
-
getUserPreferences
- Returns:
- the Properties object containing the user's preferences Gets the user's UI preferences. Only valid after a successful login.
-
saveUserPreferences
public void saveUserPreferences()Save user preferences Properties object to PIN_FLD_USER_PREFS field in /service/admin_client. Saves the object managed by this class that is retrieved using getUserPreferences() method. Always use this preferred method to save user prefs. Saves user preferences to PIN_FLD_USER_PREFS field in /service/admin_client. Saves the object managed by this class that is retrieved using getUserPreferences() method. Always use this preferred method to save user preferences. -
setUserPreferences
Deprecated.Don't pass a Properties object explicitly. Use saveUserPreferences() instead and have this class manage the preferences.Save preferences Properties object to PIN_FLD_USER_PREFS field in /service/admin_client.- Parameters:
A
- non-null Properties object containing the users preferences.
-
getResources
Gets the applet resources. The resource file name can be set in the web page "param" spec. Usually called by Portal components.- Returns:
- A
ResourceBundle
object.
-
addResourceBundle
Adds resources to the internal stack. Resources added with this call go on top of the internal resource state, so they are used in preference to what is already there.- Parameters:
res
- aString
that contains the resource bundle name
-
getResource
Gets a specific resource. If not present, the resource tag is returned. This lets users specify strings that are shown directly, then replaced by real resources without having to change the code.- Parameters:
base
- the resource base string. Usually specified as a property of aPAppComponent
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.- Returns:
- The resource base string or the resource name tag.
-
initHelp
public void initHelp()Initializes the help system. This is called by the applet or other services object during initialization. -
mergeHelp
Dynamically merges helpsets in the specifiedProperties
in tags of the form: "subhelp.X" where X starts at 0 and increments by 1.- Parameters:
props
- the property file to look in- Throws:
oracle.help.library.helpset.HelpSetParseException
- thrown for helpset errors
-
getCSHManager
public oracle.help.CSHManager getCSHManager()Returns aCSHManager
object, should one be needed.- Returns:
- A
CSHManager
object.
-
getDefaultBook
public oracle.help.library.helpset.HelpSet getDefaultBook()Returns aHelpSet
object, should one be needed.- Returns:
- A
HelpSet
object.
-
getHelpObj
public oracle.help.Help getHelpObj()Returns aHelp
object, should one be needed.- Returns:
- A
Help
object.
-
registerHelpIDFor
Registers a help ID to enable context-sensitive help for a component. This should be called by all components for themselves, and for any embedded components for which context-sensitive help is provided.- Parameters:
comp
- the component to register help forhelpID
- the context help identifier
-
registerHelpButton
Enables help for help buttons, generally in dialog boxes. This adds an action listener, so no other action is needed for the help button to work.- Parameters:
button
- the help button to enablehelpID
- the help ID to associate with the button- Throws:
IllegalArgumentException
- thrown if the button is notjava.awt.Button
orjavax.swing.AbstractButton
(or a derivitive of either)
-
registerApp
Registers the application with the server. This gives the server-side components access to the application name and client locale.- Parameters:
appName
- the application namelocale
- the client's localedata
- other application-specific data- Throws:
RemoteException
- thrown for errors
-
registerComponent
Deprecated.Registers an Portal component with the server. This initializes the server-side logic. Usually called by Portal components.- Parameters:
comp
- the Portal component implementation objectcontrollerClass
- the name of the controller class for this component- Throws:
RemoteException
- thrown for errors
-
unregisterComponent
- Throws:
RemoteException
-
createController
Registers an Portal component with the server. This initializes the server-side logic. Usually called by Portal components. This method will look through global properties to determine if that class has been overridden.If overridden, you'll get back the instance of the fully qualified class name of the subclass. If not, you'll get back the instance of the same class name passed in.
The property lookup will use the name of the class passed in with ".subclass" tacked on. So to override the class com.portal.Foo a customer would create a property entry as follows
com.portal.Foo.subclass=com.mypkg.Bar
Primarily intended to be used internally.- Parameters:
controllerClass
- The name of the controller class for this component- Returns:
- A new
PControllerBean
object. - Throws:
RemoteException
- RemoteException thrown for errors
-
getDefaultProperties
Gets the default properties, including properties that are specified in the applet's "param" spec.- Returns:
- A
Properties
object.
-
errorMsg
Displays an error dialog with the passed-in message.- Parameters:
parent
- theComponent
that triggered the messagemsg
- the error message tag; loads message from the resource fileargs
- an argument list with which to formatmsg
-
errorMsg
Displays an error dialog with the passed-in message.- Parameters:
parent
- theComponent
that triggered the messagemsg
- the error message to displayfromRes
-
-
errorMsg
Displays an error dialog with the passed-in message.- Parameters:
parent
- theComponent
that triggered the messagemsg
- the error message to displayhelpID
- the context help identifierfromRes
-
-
errorMsg
Displays an error dialog with the passed-in message and given dialog type with given set of button options- Parameters:
parent
- theComponent
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 Dialog- Returns:
- an integer indicating the option selected by the user
-
confirmationMsg
Display a confirmation dialog containing the specified message and 2 choices for the user (YES or NO). The Yes button is selected by default.- Parameters:
msg
- The confirmation message to displaymsg
- The confirmation message to display- Returns:
- One of JOptionPane.YES_OPTION, JOptionPane.NO_OPTION, or JOptionPane.CLOSED_OPTION if the user cancel's the dialog Display a confirmation dialog containing the specified message and 2 choices for the user (YES or NO). The Yes button is selected by default.
-
confirmationMsg
Display a confirmation dialog containing the specified message, default title and 2 choices for the user (YES or NO).- Parameters:
msg
- The confirmation message to displayint
- The default button. Use JOptionPane.YES_OPTION or JOptionPane.NO_OPTION- Returns:
- One of JOptionPane.YES_OPTION, JOptionPane.NO_OPTION, or JOptionPane.CLOSED_OPTION if the user cancel's the dialog
-
confirmationMsg
Display a confirmation dialog containing the specified message, title and 2 choices for the user (YES or NO). The Yes button is selected by default.- Parameters:
msg
- The confirmation message to displayint
- The default button. Use JOptionPane.YES_OPTION or JOptionPane.NO_OPTION- Returns:
- One of JOptionPane.YES_OPTION, JOptionPane.NO_OPTION, or JOptionPane.CLOSED_OPTION if the user cancel's the dialog
-
confirmationMsg
Display a confirmation dialog containing the specified message, title and 2 choices for the user (YES or NO).- Parameters:
msg
- The confirmation message to displaytitle
- The title of the confirmation dialogint
- The default button. Use JOptionPane.YES_OPTION or JOptionPane.NO_OPTION- Returns:
- One of JOptionPane.YES_OPTION, JOptionPane.NO_OPTION, or JOptionPane.CLOSED_OPTION if the user cancel's the dialog
-
createNewModel
Creates a non-cached FList and a model handle of typetype
that wraps it. Iftype
is notnull
, empty, orPModelHandle.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 tolookupModel()
of the object cache to get back the FList. However, the recommended method for getting a non-cached model from a handle isPModelHandle.getModel()
.- Parameters:
type
- the string representation of an object type- Returns:
- A model handle of type
type
that wraps an FList. - Throws:
RemoteException
-
logRemote
Serves as a debug feature. Creates an entry in the server log.- Parameters:
src
- aString
that defines the message sourcemsg
- a message to log
-
getModelField
Gets the contents of a specific field of a model.- Parameters:
modl
- the model to accessdesc
- a description of the field needed- Returns:
- The field value
- Throws:
RemoteException
- thrown for all problems, including the absence of the requested field in the specified model
-
setModelField
Sets the value of a field in a model.- Parameters:
modl
- the model to set a field indesc
- a description of the field to setval
- the new field's value- Throws:
RemoteException
- thrown for all errors
-
setPropertyURL
Sets the URL of the property file to use.- Parameters:
newProps
- the new property file location
-
setPropertyURL
Sets the URL of the property file to use and the new resource file.- Parameters:
newProps
- the new property file locationres
- the resource file location override in properties
-
loadImageIcon
Loads anImageIcon
from a supplied URL.- Parameters:
loc
- the URL for the image data- Returns:
- A new
ImageIcon
.
-
loadImageIcon
Loads anImageIcon
from a supplied location string.- Parameters:
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"- Returns:
- A new
ImageIcon
.
-
createClientException
-
createClass
Used to dynamically create instances of Customer Center beans and drilldowns and provide the ability for customers to override them. Specify the fully qualified class name for the Class you wish to create. This method will look through global properties to determine if that class has been overridden. If overridden, you'll get back an instance of the customized Class. If not, you'll get back an instance of the Class you have requested.
The property lookup will use the name of the class passed in with ".subclass" tacked on. So to override the class com.portal.Foo a customer would create a property entry as follows
com.portal.Foo.subclass=com.mypkg.Bar
Primarily intended to be used internally.- Parameters:
className
- The class you want to dynamically instantiate- Throws:
ClassNotFoundException
-
createDialogClass
public Object createDialogClass(String className, boolean isModal, String title) throws ClassNotFoundException - Throws:
ClassNotFoundException
-
getClassToInstantiate
Used to determine if a class you are dynamically instantiating has been subclassed by the user. This method will look through global properties to determine if that class has been overridden. If overridden, you'll get back the fully qualified class name of the subclass. If not, you'll get back the same class name passed in.
The property lookup will use the name of the class passed in with ".subclass" tacked on. So to override the class com.portal.Foo a customer would create a property entry as follows
com.portal.Foo.subclass=com.mypkg.Bar
Primarily intended to be used internally.- Parameters:
className
- The class you want to dynamically instantiate
-
invokeInThread
Runs a task in a thread-pool managed thread.- Parameters:
toRun
- the task to run
-
invokeInThread
Runs a task in a thread-pool managed thread in priority order.- Parameters:
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.
-
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.- Returns:
- True if a connection is established; false otherwise.
- Throws:
RemoteException
- thrown for errors
-
getServer
Gets a reference to thePBAServer
implementation.- Returns:
- A stub to the BAS server.
-