= Application Layer API

:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
:page-partial:


Domain service APIs for the application layer allow the domain objects to control aspects of the application layer, such as sending info messages back to the end-user.


.Application Layer API
[cols="2m,4a",options="header"]
|===

|API
|Description


|xref:refguide:applib:index/services/command/CommandExecutorService.adoc[CommandExecutorService]
|Service used to execute a specified xref:refguide:applib:index/services/command/Command.adoc[Command].
One use case is in support of async commands (using xref:refguide:applib:index/services/wrapper/WrapperFactory.adoc[WrapperFactory] ).

// commandreplay moved to incubator for the time being
//Another is to replay commands from a primary onto a secondary (see xref:userguide:commandreplay:about.adoc[Command Replay] ; another is


|xref:refguide:applib:index/services/user/ImpersonateMenu.adoc[ImpersonateMenu]
|Provides a UI to allow the current user to be impersonated as some other user.

The actions in this menu are restricted to non-production use only.



|xref:refguide:applib:index/services/iactn/InteractionProvider.adoc[InteractionProvider]
|Request-scoped access to the current member execution (action invocation or property edit), represented as the xref:refguide:applib:index/services/iactn/Interaction.adoc[Interaction] context.

|xref:refguide:applib:index/services/iactnlayer/InteractionLayerTracker.adoc[InteractionLayerTracker]
|Access to the current xref:refguide:applib:index/services/iactnlayer/InteractionLayer.adoc[InteractionLayer], where the lowest layer is in effect a short-lived session connected to the database, with a xref:refguide:applib:index/services/xactn/TransactionService.adoc#currentTransactionId_[transaction] started automatically.


|xref:refguide:applib:index/services/iactnlayer/InteractionService.adoc[InteractionService]
|Extends xref:refguide:applib:index/services/iactnlayer/InteractionLayerTracker.adoc[InteractionLayerTracker], providing additional "session" management capabilities.

In particular, can be used to open new xref:refguide:applib:index/services/iactnlayer/InteractionLayer.adoc[InteractionLayer layer]s (= "session"), similar to an "su" command in Unix, with the user or clock etc. temporarily altered.
Can also be used to close all layers (= "close the session"), which commits the transaction.

More precisely: provides access to the current xref:refguide:applib:index/services/iactn/Interaction.adoc[Interaction] / xref:refguide:applib:index/services/iactnlayer/InteractionLayer.adoc[InteractionLayer], with the ability to



|xref:refguide:applib:index/services/message/MessageService.adoc[MessageService]
|Methods to inform or warn the user, or to raise errors.


|xref:refguide:applib:index/services/sudo/SudoService.adoc[SudoService]
|Typically for use in testing while running fixture scripts, allows a block of code to run as a specified user account.



|xref:refguide:applib:index/services/title/TitleService.adoc[TitleService]
|Methods to programmatically obtain the title or icon of a domain object.



|xref:refguide:applib:index/services/xactn/TransactionalProcessor.adoc[TransactionalProcessor]
|Provides the ability to submit work within a transaction, specifying whether that transaction should be nested or new (suspending the current).


|xref:refguide:applib:index/services/xactn/TransactionService.adoc[TransactionService]
|Extends xref:refguide:applib:index/services/xactn/TransactionalProcessor.adoc[TransactionalProcessor] to provide the ability to query the current transaction state and to flush the current transaction.



|xref:refguide:applib:index/services/wrapper/WrapperFactory.adoc[WrapperFactory]
|Interact with another domain object "as if" through the UI (enforcing business rules, firing domain events).
It can also be used to dispatch actions asynchronously, to be run through a `java.util.concurrent.ExecutorService`.



|===

