Package com.portal.bas
Class PInfranetAppControllerImpl
java.lang.Object
com.portal.bas.PInfranetAppControllerImpl
- All Implemented Interfaces:
PInfranetAppController,PInfranetConnection,CMConnectionListener,Remote
- Direct Known Subclasses:
PInfranetConnectionImpl
public class PInfranetAppControllerImpl
extends Object
implements PInfranetConnection, PInfranetAppController, CMConnectionListener
PInfranetAppControllerImpl is the implementation of
PInfranetAppController and PInfranetConnection interfaces.
See that class for more details on usage and purpose.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInitializes this application controller without a connection pool.Initialize PInfranetAppContollerImpl using an existing PortalContext -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(boolean logout) Closes the connection to the Portal server.voidcmreconnected(CMConnectionEvent event) Implementation for CMConnectionListener.createController(String controllerClass) Registers the client portion of a component with the server.createNewModel(String type) Creates a new, empty data model.Duplicates the application controller.duplicate(PortalContext ctx) Duplicates the application controller, but instead of opening a new connection to Portal uses the one passed in.Gets the application name.Get the client application's locale.Returns the current connection context.Get the internal PortalContext.getEventListener(Object handle) Gets an event listener, given a handle generated bypostEventListener.getModelField(PModelHandle data, String desc) Gets a field from a model.Gets any other data sent by the client application.booleangetPermissionFor(String componentName) Gets permission to use a component.Gets aPPermissionobject.getRestrictionOn(String fieldSpecification) Gets the restrictions for a field.Gets the user's UI preferences.booleanReturns true if Portal is brand-enabled.voidLogsuserinto the Portal server specified byurl.Looks up a controller for a given component.postEventListener(Object src, EventListener l) Posts anEventListenerand returns a handle for it.voidregisterApp(String appName, Locale locale, Object data) Registers the application with the server.voidregisterComponent(PRemoteComponent comp, String controllerClass) Deprecated.voidregisterController(PControllerBean comp, PControllerImpl impl) Registers the client portion of a component with the server.voidReleases the connection retrieved bygetConnection().voidRelease the PortalContext to the pool if one exists.voidremoveEventListener(Object handle) Removes a posted event listener.voidSave user preferences Properties object to PIN_FLD_USER_PREFS field in /service/admin_client.voidsetBrandContext(Poid brandPoid) Sets the brand scope of this user session to the account represented bybrandPoid.voidsetConnection(PCachedContext conn) Sets a connection object for application use.voidsetModelField(PModelHandle data, String desc, Object val) Sets a field in a model to a new value.voidsetUserPreferences(Properties userPrefs) Deprecated.Don't pass a Properties object explicitly.protected voidstoreUserPrefs(Properties userPrefs) Save preferences Properties object to PIN_FLD_USER_PREFS field in /service/admin_client.voidA utility method that retrieves message information from anEBufException, and uses it to build aPInfranetException, which is then thrown.voidDeprecated.As of Release 6.1, replaced byunregisterController.voidUnregisters a component.voidUnregisters the client portion of a component's controller with the server.voidReverts the brand scope of this user session to the account of the user who logged in.voidverifyAndSwitchToUser(String user, String password, String service) Calls Portal to authenticateuser, and sets the brand scope of this session touser's account if authentication succeeds.
-
Field Details
-
mCompMap
-
-
Constructor Details
-
PInfranetAppControllerImpl
Initializes this application controller without a connection pool.- Throws:
RemoteException
-
PInfranetAppControllerImpl
Initialize PInfranetAppContollerImpl using an existing PortalContext- Parameters:
PortalContext- whose connection to Portal BAS will use internally. Note that the PortalContext is reset to its default values after being used.- Throws:
Exception
-
-
Method Details
-
duplicate
Duplicates the application controller, but instead of opening a new connection to Portal uses the one passed in. It is not the same as cloning, because the new and original application controllers share most features. It makes a shallow copy of the application controller that contains unique contexts.- Specified by:
duplicatein interfacePInfranetAppController- Parameters:
ctx- The connection to be used by the new PInfranetAppController- Throws:
RemoteException- thrown for errors
-
duplicate
Duplicates the application controller. It is not the same as cloning, because the new and original application controllers share most features. It makes a shallow copy of the application controller that contains unique contexts.- Specified by:
duplicatein interfacePInfranetAppController- Returns:
- A duplicate application controller.
- Throws:
RemoteException- thrown for errors
-
login
Logsuserinto the Portal server specified byurl.- Specified by:
loginin interfacePInfranetConnection- Parameters:
user- the usernamepassword- user's passwordurl- a string containing connection information in URL format, e.g., pcp://host:port- Throws:
RemoteException- if login fails.
-
close
Closes the connection to the Portal server.- Specified by:
closein interfacePInfranetConnection- Parameters:
logout- if true, logs out before closing the connection- Throws:
RemoteException- thrown for errors- Since:
- Release 6.2
-
getPermissionFor
Gets permission to use a component.- Specified by:
getPermissionForin interfacePInfranetConnection- Parameters:
componentName- the name of the component to get permissions for- Returns:
- True, if permitted; false otherwise.
- Throws:
RemoteException- thrown for errors
-
getRestrictionOn
Gets the restrictions for a field.- Specified by:
getRestrictionOnin interfacePInfranetConnection- Parameters:
fieldSpecification- aStringwith the field's specification- Returns:
- A
PRestrictionobject. - Throws:
RemoteException- thrown for errors
-
registerApp
Registers the application with the server. This gives the server-side components access to the application name and client locale.- Specified by:
registerAppin interfacePInfranetConnection- Parameters:
appName- the application namelocale- the client's localedata- other application-specific data- Throws:
RemoteException- thrown for errors
-
createController
Registers the client portion of a component with the server.- Specified by:
createControllerin interfacePInfranetConnection- Parameters:
controllerClass- the class name of the component's controller- Returns:
- A controller.
- Throws:
RemoteException- thrown in case of failure
-
registerComponent
Deprecated.As of Release 6.1, replaced bycreateControllerandregisterController.Registers the client portion of a component with the server.- Specified by:
registerComponentin interfacePInfranetConnection- Parameters:
comp- the component to registercontrollerClass- the class name of the component controller- Throws:
RemoteException- thrown in case of failure
-
unregisterComponent
Deprecated.As of Release 6.1, replaced byunregisterController.Unregisters a component.- Specified by:
unregisterComponentin interfacePInfranetConnection- Parameters:
comp- the component to unregister- Throws:
RemoteException- thrown in case of failure
-
registerController
Registers the client portion of a component with the server. This essentially sends the stub back to the server.registerControlleris used to associate the RMI stub class with the actual implementation class, which gets the implementation later when the stub is passed as a parameter. This is useful in implementing remote event listeners.The framework calls this automatically when a new controller is created.
- Specified by:
registerControllerin interfacePInfranetAppController- Parameters:
comp- a remote component stubimpl- the component to register- Throws:
RemoteException- thrown in case of failure
-
unregisterController
Unregisters a component. This frees it for garbage collection.- Specified by:
unregisterControllerin interfacePInfranetAppController- Parameters:
impl- the component to unregister- Throws:
RemoteException- thrown in case of failure
-
createNewModel
Creates a new, empty data model.- Specified by:
createNewModelin interfacePInfranetConnection- Parameters:
type- aStringthat defines the type of model to create- Returns:
- A new model handle.
- Throws:
RemoteException- thrown for errors
-
getModelField
Gets a field from a model. This version returns aPModelHandleonly for a field that is itself a model. Use this method when the returned field data will be sent to the client. For compound specifications, an object array is returned.- Specified by:
getModelFieldin interfacePInfranetConnection- Parameters:
data- the model from which to get a fielddesc- a description of which field(s) to get- Returns:
- The contents of the field. This is an Integer,
BigDecimal, Date, Double, byte array, String,
or
PModelHandle. - Throws:
RemoteException- thrown for errors
-
setModelField
Sets a field in a model to a new value. This version handles the case where the new value is aPModelHandle.- Specified by:
setModelFieldin interfacePInfranetConnection- Parameters:
data- the model to set a field indesc- a description of which field to setval- the new value to be set- Throws:
RemoteException- thrown for errors
-
getUserPreferences
Gets the user's UI preferences. If user preferences have already been cached in this class, that instance is returned. Otherwise data from thePIN_FLD_USER_PREFSfield in/service/admin_clientis returned.- Specified by:
getUserPreferencesin interfacePInfranetConnection- Returns:
- A
Propertiesobject that contains the user's preferences, or null for errors or if no preferences were retrieved from the server. - Throws:
RemoteException- thrown for errors
-
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.- Specified by:
saveUserPreferencesin interfacePInfranetConnection- Throws:
RemoteException
-
setUserPreferences
Deprecated.Don't pass a Properties object explicitly. Use saveUserPreferences() instead and have this class manage the preferences.Saves changes to the user's UI preferencesPropertiesobject to thePIN_FLD_USER_PREFSfield in/service/admin_client.- Specified by:
setUserPreferencesin interfacePInfranetConnection- Parameters:
userPrefs- thePropertiesobject that contains the user's preferences; must not be null- Throws:
RemoteException- thrown for errors
-
cmreconnected
Implementation for CMConnectionListener. Sets the cached scope to the reset connection- Specified by:
cmreconnectedin interfaceCMConnectionListener
-
storeUserPrefs
Save preferences Properties object to PIN_FLD_USER_PREFS field in /service/admin_client. This actually writes it to the db.- Parameters:
A- non-null Properties object containing the users preferences.- Throws:
RemoteException
-
lookupController
Looks up a controller for a given component.- Specified by:
lookupControllerin interfacePInfranetAppController- Parameters:
comp- a remote component stub- Returns:
- The controller, if any, associated with the component.
- Throws:
RemoteException- thrown for errors
-
postEventListener
Posts anEventListenerand returns a handle for it. This is used for passing events, where the events are passed on the server side but the listeners are registered on the client side.- Specified by:
postEventListenerin interfacePInfranetAppController- Parameters:
src- the source of the eventl- anEventListener- Returns:
- A handle to pass to the client.
- Throws:
RemoteException- thrown for errors
-
getEventListener
Gets an event listener, given a handle generated bypostEventListener.- Specified by:
getEventListenerin interfacePInfranetAppController- Parameters:
handle- a token generated by thepostEventListenerclass- Returns:
- The posted listener for the handle, or null.
- Throws:
RemoteException- thrown for errors
-
removeEventListener
Removes a posted event listener.- Specified by:
removeEventListenerin interfacePInfranetAppController- Parameters:
handle- the event listener's handle
-
setConnection
Sets a connection object for application use.- Specified by:
setConnectionin interfacePInfranetAppController- Parameters:
conn- a new, cached context object- Throws:
RemoteException- thrown for errors
-
getConnection
Returns the current connection context. May be null if no connection to Portal has been made. For every call togetConnection()there must be a corresponding call toreleaseConnection().- Specified by:
getConnectionin interfacePInfranetAppController- Returns:
- A
PCachedContextobject, or null. - Throws:
RemoteException- thrown for errors- See Also:
-
releaseConnection
Releases the connection retrieved bygetConnection(). For every call togetConnection()there must be a corresponding call toreleaseConnection(). This method doesn't do anything if there is no connection pool.- Specified by:
releaseConnectionin interfacePInfranetAppController- Parameters:
ctx- the connection to be released.- Throws:
RemoteException- See Also:
-
getContext
Get the internal PortalContext. This is a semi-private function and MUST only be used by classes that want to cache Portal data and intentionally bypass the BAS cache.- Specified by:
getContextin interfacePInfranetConnection- Returns:
- The portal context used internally.
- See Also:
-
releaseContext
Release the PortalContext to the pool if one exists.- Specified by:
releaseContextin interfacePInfranetConnection- Parameters:
ctx- the portal context to be released.- See Also:
-
isBrandingEnabled
Returns true if Portal is brand-enabled.- Specified by:
isBrandingEnabledin interfacePInfranetAppController- Throws:
RemoteException
-
verifyAndSwitchToUser
public void verifyAndSwitchToUser(String user, String password, String service) throws RemoteException Calls Portal to authenticateuser, and sets the brand scope of this session touser's account if authentication succeeds.- Specified by:
verifyAndSwitchToUserin interfacePInfranetAppController- Parameters:
user- the usernamepassword-service- the service type, e.g., "/service/email"- Throws:
RemoteException- if authentication fails.
-
getServiceHandle
- Specified by:
getServiceHandlein interfacePInfranetAppController- Throws:
RemoteException
-
getAccountHandle
- Specified by:
getAccountHandlein interfacePInfranetAppController- Throws:
RemoteException
-
setBrandContext
Sets the brand scope of this user session to the account represented bybrandPoid.- Specified by:
setBrandContextin interfacePInfranetAppController- Parameters:
brandPoid- thePoidof a user account- Throws:
RemoteException
-
unsetBrandContext
Reverts the brand scope of this user session to the account of the user who logged in.- Throws:
RemoteException
-
getPermissions
Gets aPPermissionobject.- Specified by:
getPermissionsin interfacePInfranetAppController- Returns:
- A
PPermissionobject. - Throws:
RemoteException- thrown for remote errors
-
getAppName
Gets the application name.- Specified by:
getAppNamein interfacePInfranetAppController- Returns:
- A
Stringthat contains the application name. - Throws:
RemoteException- thrown for errors
-
getClientLocale
Get the client application's locale.- Specified by:
getClientLocalein interfacePInfranetAppController- Returns:
- The client's locale.
- Throws:
RemoteException- thrown for errors
-
getOtherData
Gets any other data sent by the client application.- Specified by:
getOtherDatain interfacePInfranetAppController- Returns:
- An object that contains application-specific data.
- Throws:
RemoteException- thrown for errors
-
throwInfranetException
A utility method that retrieves message information from anEBufException, and uses it to build aPInfranetException, which is then thrown.- Parameters:
e- anEBufException- Throws:
PInfranetException- thrown for Portal errors
-
unregisterControllers
public void unregisterControllers()Unregisters the client portion of a component's controller with the server. This frees it for garbage collection.- Specified by:
unregisterControllersin interfacePInfranetAppController
-
createControllerandregisterController.