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.Constructor and Description |
---|
PInfranetAppControllerImpl()
Initializes this application controller without a connection pool.
|
PInfranetAppControllerImpl(PortalContext ctx)
Initialize PInfranetAppContollerImpl using an existing PortalContext
|
Modifier and Type | Method and Description |
---|---|
void |
close(boolean logout)
Closes the connection to the Portal server.
|
void |
cmreconnected(CMConnectionEvent event)
Implementation for CMConnectionListener.
|
PControllerBean |
createController(String controllerClass)
Registers the client portion of a component with the server.
|
PModelHandle |
createNewModel(String type)
Creates a new, empty data model.
|
PInfranetAppController |
duplicate()
Duplicates the application controller.
|
PInfranetAppController |
duplicate(PortalContext ctx)
Duplicates the application controller, but instead of opening a new
connection to Portal uses the one passed in.
|
PModelHandle |
getAccountHandle() |
String |
getAppName()
Gets the application name.
|
Locale |
getClientLocale()
Get the client application's locale.
|
PCachedContext |
getConnection()
Returns the current connection context.
|
PortalContext |
getContext()
Get the internal PortalContext.
|
EventListener |
getEventListener(Object handle)
Gets an event listener, given a handle generated by
postEventListener . |
Object |
getModelField(PModelHandle data,
String desc)
Gets a field from a model.
|
Object |
getOtherData()
Gets any other data sent by the client application.
|
boolean |
getPermissionFor(String componentName)
Gets permission to use a component.
|
PPermission |
getPermissions()
Gets a
PPermission object. |
PRestriction |
getRestrictionOn(String fieldSpecification)
Gets the restrictions for a field.
|
PModelHandle |
getServiceHandle() |
Properties |
getUserPreferences()
Gets the user's UI preferences.
|
boolean |
isBrandingEnabled()
Returns true if Portal is brand-enabled.
|
void |
login(String user,
String password,
String url)
Logs
user into the Portal server specified by
url . |
PControllerImpl |
lookupController(PControllerBean comp)
Looks up a controller for a given component.
|
Object |
postEventListener(Object src,
EventListener l)
Posts an
EventListener and returns a handle for it. |
void |
registerApp(String appName,
Locale locale,
Object data)
Registers the application with the server.
|
void |
registerComponent(PRemoteComponent comp,
String controllerClass)
Deprecated.
As of Release 6.1, replaced by
createController and
registerController . |
void |
registerController(PControllerBean comp,
PControllerImpl impl)
Registers the client portion of a component with the server.
|
void |
releaseConnection(PCachedContext ctx)
Releases the connection retrieved by
getConnection() . |
void |
releaseContext(PortalContext ctx)
Release the PortalContext to the pool if one exists.
|
void |
removeEventListener(Object handle)
Removes a posted event listener.
|
void |
saveUserPreferences()
Save user preferences Properties object to PIN_FLD_USER_PREFS
field in /service/admin_client.
|
void |
setBrandContext(Poid brandPoid)
Sets the brand scope of this user session to the account represented by
brandPoid . |
void |
setConnection(PCachedContext conn)
Sets a connection object for application use.
|
void |
setModelField(PModelHandle data,
String desc,
Object val)
Sets a field in a model to a new value.
|
void |
setUserPreferences(Properties userPrefs)
Deprecated.
Don't pass a Properties object explicitly. Use
saveUserPreferences() instead and have this class
manage the preferences.
|
protected void |
storeUserPrefs(Properties userPrefs)
Save preferences Properties object to PIN_FLD_USER_PREFS
field in /service/admin_client.
|
void |
throwInfranetException(EBufException e)
A utility method that retrieves message information from an
EBufException , and uses it to build a PInfranetException ,
which is then thrown. |
void |
unregisterComponent(PRemoteComponent comp)
Deprecated.
As of Release 6.1, replaced by
unregisterController . |
void |
unregisterController(PControllerImpl impl)
Unregisters a component.
|
void |
unregisterControllers()
Unregisters the client portion of a component's controller with the server.
|
void |
unsetBrandContext()
Reverts the brand scope of this user session to the account of the user
who logged in.
|
void |
verifyAndSwitchToUser(String user,
String password,
String service)
Calls Portal to authenticate
user , and sets the brand
scope of this session to user 's account if authentication
succeeds. |
protected Hashtable mCompMap
public PInfranetAppControllerImpl() throws RemoteException
RemoteException
public PInfranetAppControllerImpl(PortalContext ctx) throws Exception
PortalContext
- whose connection to Portal BAS will use
internally. Note that the PortalContext is reset to its default
values after being used.Exception
public PInfranetAppController duplicate(PortalContext ctx) throws RemoteException
duplicate
in interface PInfranetAppController
ctx
- The connection to be used by the new PInfranetAppControllerRemoteException
- thrown for errorspublic PInfranetAppController duplicate() throws RemoteException
duplicate
in interface PInfranetAppController
RemoteException
- thrown for errorspublic void login(String user, String password, String url) throws RemoteException
user
into the Portal server specified by
url
.login
in interface PInfranetConnection
user
- the usernamepassword
- user's passwordurl
- a string containing connection information in URL format,
e.g., pcp://host:portRemoteException
- if login fails.public void close(boolean logout) throws RemoteException
close
in interface PInfranetConnection
logout
- if true, logs out before closing the connectionRemoteException
- thrown for errorspublic boolean getPermissionFor(String componentName) throws RemoteException
getPermissionFor
in interface PInfranetConnection
componentName
- the name of the component to get permissions forRemoteException
- thrown for errorspublic PRestriction getRestrictionOn(String fieldSpecification) throws RemoteException
getRestrictionOn
in interface PInfranetConnection
fieldSpecification
- a String
with the field's specificationPRestriction
object.RemoteException
- thrown for errorspublic void registerApp(String appName, Locale locale, Object data) throws RemoteException
registerApp
in interface PInfranetConnection
appName
- the application namelocale
- the client's localedata
- other application-specific dataRemoteException
- thrown for errorspublic PControllerBean createController(String controllerClass) throws RemoteException
createController
in interface PInfranetConnection
controllerClass
- the class name of the component's controllerRemoteException
- thrown in case of failurepublic void registerComponent(PRemoteComponent comp, String controllerClass) throws RemoteException
createController
and
registerController
.registerComponent
in interface PInfranetConnection
comp
- the component to registercontrollerClass
- the class name of the component controllerRemoteException
- thrown in case of failurepublic void unregisterComponent(PRemoteComponent comp) throws RemoteException
unregisterController
.unregisterComponent
in interface PInfranetConnection
comp
- the component to unregisterRemoteException
- thrown in case of failurepublic void registerController(PControllerBean comp, PControllerImpl impl) throws RemoteException
registerController
is 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.
registerController
in interface PInfranetAppController
comp
- a remote component stubimpl
- the component to registerRemoteException
- thrown in case of failurepublic void unregisterController(PControllerImpl impl) throws RemoteException
unregisterController
in interface PInfranetAppController
impl
- the component to unregisterRemoteException
- thrown in case of failurepublic PModelHandle createNewModel(String type) throws RemoteException
createNewModel
in interface PInfranetConnection
type
- a String
that defines the type of
model to createRemoteException
- thrown for errorspublic Object getModelField(PModelHandle data, String desc) throws RemoteException
PModelHandle
only 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.getModelField
in interface PInfranetConnection
data
- the model from which to get a fielddesc
- a description of which field(s) to getPModelHandle
.RemoteException
- thrown for errorspublic void setModelField(PModelHandle data, String desc, Object val) throws RemoteException
PModelHandle
.setModelField
in interface PInfranetConnection
data
- the model to set a field indesc
- a description of which field to setval
- the new value to be setRemoteException
- thrown for errorspublic Properties getUserPreferences() throws RemoteException
PIN_FLD_USER_PREFS
field in /service/admin_client
is returned.getUserPreferences
in interface PInfranetConnection
Properties
object that contains the user's
preferences, or null for errors or if no preferences
were retrieved from the server.RemoteException
- thrown for errorspublic void saveUserPreferences() throws RemoteException
saveUserPreferences
in interface PInfranetConnection
RemoteException
public void setUserPreferences(Properties userPrefs) throws RemoteException
Properties
object
to the PIN_FLD_USER_PREFS
field in /service/admin_client
.setUserPreferences
in interface PInfranetConnection
userPrefs
- the Properties
object that contains the
user's preferences; must not be nullRemoteException
- thrown for errorspublic void cmreconnected(CMConnectionEvent event)
cmreconnected
in interface CMConnectionListener
protected void storeUserPrefs(Properties userPrefs) throws RemoteException
A
- non-null Properties object containing the users preferences.RemoteException
public PControllerImpl lookupController(PControllerBean comp) throws RemoteException
lookupController
in interface PInfranetAppController
comp
- a remote component stubRemoteException
- thrown for errorspublic Object postEventListener(Object src, EventListener l) throws RemoteException
EventListener
and 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.postEventListener
in interface PInfranetAppController
src
- the source of the eventl
- an EventListener
RemoteException
- thrown for errorspublic EventListener getEventListener(Object handle) throws RemoteException
postEventListener
.getEventListener
in interface PInfranetAppController
handle
- a token generated by the postEventListener
classRemoteException
- thrown for errorspublic void removeEventListener(Object handle)
removeEventListener
in interface PInfranetAppController
handle
- the event listener's handlepublic void setConnection(PCachedContext conn) throws RemoteException
setConnection
in interface PInfranetAppController
conn
- a new, cached context objectRemoteException
- thrown for errorspublic PCachedContext getConnection() throws RemoteException
getConnection()
there must be a corresponding call to
releaseConnection()
.getConnection
in interface PInfranetAppController
PCachedContext
object, or null.RemoteException
- thrown for errorsreleaseConnection(com.portal.bas.PCachedContext)
public void releaseConnection(PCachedContext ctx) throws RemoteException
getConnection()
. For
every call to getConnection()
there must be a corresponding
call to releaseConnection()
. This method doesn't do
anything if there is no connection pool.releaseConnection
in interface PInfranetAppController
ctx
- the connection to be released.RemoteException
getConnection()
public PortalContext getContext()
getContext
in interface PInfranetConnection
PInfranetConnection.releaseContext(com.portal.pcm.PortalContext)
public void releaseContext(PortalContext ctx)
releaseContext
in interface PInfranetConnection
ctx
- the portal context to be released.PInfranetConnection.getContext()
public boolean isBrandingEnabled() throws RemoteException
isBrandingEnabled
in interface PInfranetAppController
RemoteException
public void verifyAndSwitchToUser(String user, String password, String service) throws RemoteException
user
, and sets the brand
scope of this session to user
's account if authentication
succeeds.verifyAndSwitchToUser
in interface PInfranetAppController
user
- the usernamepassword
- service
- the service type, e.g., "/service/email"RemoteException
- if authentication fails.public PModelHandle getServiceHandle() throws RemoteException
getServiceHandle
in interface PInfranetAppController
RemoteException
public PModelHandle getAccountHandle() throws RemoteException
getAccountHandle
in interface PInfranetAppController
RemoteException
public void setBrandContext(Poid brandPoid) throws RemoteException
brandPoid
.setBrandContext
in interface PInfranetAppController
brandPoid
- the Poid
of a user accountRemoteException
public void unsetBrandContext() throws RemoteException
RemoteException
public PPermission getPermissions() throws RemoteException
PPermission
object.getPermissions
in interface PInfranetAppController
PPermission
object.RemoteException
- thrown for remote errorspublic String getAppName() throws RemoteException
getAppName
in interface PInfranetAppController
String
that contains the
application name.RemoteException
- thrown for errorspublic Locale getClientLocale() throws RemoteException
getClientLocale
in interface PInfranetAppController
RemoteException
- thrown for errorspublic Object getOtherData() throws RemoteException
getOtherData
in interface PInfranetAppController
RemoteException
- thrown for errorspublic void throwInfranetException(EBufException e) throws PInfranetException
EBufException
, and uses it to build a PInfranetException
,
which is then thrown.e
- an EBufException
PInfranetException
- thrown for Portal errorspublic void unregisterControllers()
unregisterControllers
in interface PInfranetAppController
Copyright © 2003, 2023, Oracle and/or its affiliates.