Class sap.ushell.services.ContainerModule: sap/ushell/services/Container


The Unified Shell's container which manages renderers, services, and adapters.


Since: 1.15.0.
Constructor Summary
Field Summary
addRemoteSystemAdds a system to the list of remote systems currently in use.
attachLogoutEventAttaches a listener to the logout event.
attachRendererCreatedEventAttaches a listener to the rendererCreated event.
cancelLogonCancels the logon procedure in the current frame, if any.
createRendererCreates a new renderer instance for the given renderer name.
detachLogoutEventDetaches a listener from the rendererCreated event.
getDirtyFlagReturns the isDirty flag value.
getGlobalDirtyReturns the global dirty state.
getServiceReturns a service with the given name, creating it if necessary.
logoutLogs out the current user from all relevant back-end systems, including the logon system itself.
registerDirtyStateProviderRegister the work protection dirty callback function.
setDirtyFlagSetter for the isDirty flag value.
setLogonFrameProviderDetermines the current logon frame provider for the entire Unified Shell.
Constructor Detail
new sap.ushell.services.Container()
See:
sap.ushell.bootstrap
Field Detail
addRemoteSystem
Adds a system to the list of remote systems currently in use. On logout this list is processed and performs a logout for each system via the ContainerAdapter specific for its platform.
Since:
1.15.0
attachLogoutEvent
Attaches a listener to the logout event.
Since:
1.19.1
attachRendererCreatedEvent
Attaches a listener to the rendererCreated event.
Since:
1.34.1
cancelLogon
Cancels the logon procedure in the current frame, if any. This MUST be used by the logon frame provider in case the user wants to close the logon frame for good. It will report "Authentication cancelled" and let all pending requests for the current realm fail. As a side-effect, it also calls destroy on the logon frame provider.
Since:
1.21.2
See:
sap.ushell.services.Container#setLogonFrameProvider
createRenderer
Creates a new renderer instance for the given renderer name.

Names without a dot are interpreted as package names within the default naming convention and will be expanded to "sap.ushell.renderers." + sRendererName + ".Renderer". Names containing a dot are used "as is".

The resulting name must point to a SAPUI5 object which is first required and then created (constructor call without arguments). The object must be either a control (i.e. extend sap.ui.core.Control) or a UI component (i.e. extend sap.ui.core.UIComponent), which is then automatically wrapped into a sap.ui.core.ComponentContainer control by this method. This sap.ui.core.ComponentContainer is created with height and width set to "100%" to accommodate the complete available space.

The returned renderer is supposed to be added to a direct child (for example DIV) of the BODY of the page and there should be no other parts of the page consuming space outside the renderer. Use CSS class sapUShellFullHeight at HTML, BODY and at the element to which the renderer is added to allow the renderer to use 100% height.

Since:
1.15.0
detachLogoutEvent
Detaches a listener from the rendererCreated event.
Since:
1.34.1
getDirtyFlag
Returns the isDirty flag value.
Since:
1.27.0
getGlobalDirty
Returns the global dirty state.

All open UShell browser windows for the same origin are asked about their global dirty state.

Since:
1.21.1
getService
Returns a service with the given name, creating it if necessary. Services are singleton objects identified by their (resulting) name.

Names without a dot are interpreted as service names within the default naming convention and will be expanded to "sap.ushell.services." + sServiceName. Names containing a dot are not yet supported. This name may be overridden via configuration. See example 2 below.

The resulting name must point to a constructor function which is first required as a SAPUI5 module and then called to create a service instance. The service will be passed to a corresponding service adapter for the current logon system, as well as a callback interface (of virtual type sap.ushell.services.ContainerInterface) to the container providing a method createAdapter(oSystem) to create further adapters for the same service but connected to remote systems. The third parameter will be sParameter as passed to this function. The fourth parameter will be an object with the property config supplied by the configuration. See example 2 below.

The adapter for the logon system will be created before the service. Its constructor gets three parameters. The first parameter is the logon system, the second parameter is sParameter and the third parameter is an object with the property config supplied by the configuration.

The service may declare itself adapterless by setting the property hasNoAdapter = true at the constructor function. In this case no adapter will be created and passed to the constructor and all other parameters will be shifted.

Example 1: The service sap.ushell.services.UserInfo is parameterless. It indicates this by setting sap.ushell.services.UserInfo.hasNoAdapter = true;.

Example 2: (Configuration)

window["sap-ushell-config"] = {
    services: {
        Foo: {
            module: "my.own.Foo"
            config: {header: "hidden"},
            adapter: {
                module: "my.own.FooAdapter",
                config: {foo: "bar"}
            }
        }
    }
}
oService = sap.ushell.Container.getService("Foo", "runtimeConfig");
Now oService is an instance of my.own.Foo. The third parameter of the constructor will be "runtimeConfig", the fourth parameter {config: {header: "hidden"}}. Its adapter is an instance of my.own.FooAdapter constructed with the parameters logon system, "runtimeConfig" and {config: {foo: "bar"}}.
Since:
1.15.0
See:
sap.ushell.services.ContainerInterface
logout
Logs out the current user from all relevant back-end systems, including the logon system itself.
Since:
1.15.0
registerDirtyStateProvider
Register the work protection dirty callback function. In the work protect mechanism, each platform can register their own method in order to check if data was changed during the session, and notify the container about the change

Use Function.prototype.bind() to determine the callback's this or some of its arguments.

Since:
1.31.0
setDirtyFlag
Setter for the isDirty flag value.

Default value is false

Since:
1.27.0
Default Value:
false
setLogonFrameProvider
Determines the current logon frame provider for the entire Unified Shell. Initially, a rudimentary default provider is active and should be replaced as soon as possible by the current renderer.

A logon frame provider is used to facilitate user authentication even for requests sent via XMLHttpRequest. It is called back in order to create a hidden IFRAME, to show it to the user, then to hide and destroy it. The frame must be treated as a black box by the provider; especially with respect to the source of the frame which is managed by the Unified Shell framework. Showing the frame might require user interaction and some decoration around the frame. The frame should be destroyed, not reused, to be on the safe side. Note that in typical cases with SAML2, authentication happens automatically and the frame can stay hidden.

The following order of method calls is guaranteed:

  1. The create method is called first.
  2. The show method may be called next (if there is HTML code to display).
  3. The destroy method is called last.
  4. A new cycle may start for a new logon process.
Since:
1.21.2
See:
sap.ushell.services.Container#cancelLogon