Oracle ATG Web Commerce has several components for creating a connection to an Endeca Workbench application. The Workbench connection components can vary depending on whether your environment has a single Workbench application or multiple applications (for example, to support multiple languages). Here is a brief overview of the process:
On startup, the
/atg/endeca/assembler/cartridge/manager/DefaultWorkbenchContentSourcecomponent is instantiated. This component contains host name and port information for the Workbench application to connect to by default. TheDefaultWorkbenchContentSourcecomponent gets its host and port values from theAssemblerApplicationConfiguration.workbenchHostNameandAssemblerApplicationConfiguration.workbenchPortproperties, respectively. It gets the Endeca application name from theApplicationConfiguration.defaultApplicationNameproperty.If the environment has more than one Endeca application (for example, because it supports multiple languages with one language per Endeca application), the
AssemblerApplicationConfigurationcomponent creates globally-scoped,WorkbenchContentSource_Endeca-application-keycomponents for each application. Each component has a suffix that identifies which Endeca application the component is for, for example,WorkbenchContentSource_enandWorkbenchContentSource_de.The
NucleusAssemblerresolves the/atg/endeca/assembler/cartridge/manager/WorkbenchContentSourcecomponent. This component in turn resolves either the/atg/endeca/assembler/cartridge/manager/DefaultWorkbenchContentSourcecomponent or the/atg/endeca/assembler/cartridge/manager/PerApplicationWorkbenchContentSourceResolveras theWorkbenchContentSourcefor the current request.If the
DefaultWorkbenchContentSourceis resolved, the host, port, and Endeca application defined by this component are used to connect to the default Workbench application.If the
PerApplicationWorkbenchContentSourceResolveris resolved, the component relies on theAssemblerApplicationConfigurationto determine what the current Endeca application is and then it references the correct Endeca application-specificWorkbenchContentSourcethat theAssemblerApplicationConfigurationcomponent has already created.
The remaining sections provide more details on the individual Workbench-related components.
WorkbenchContentSource
The /atg/endeca/assembler/cartridge/manager/WorkbenchContentSource component represents the current application’s connection to the Workbench. The NucleusAssembler class uses this component to connect to the correct Workbench application.
Out of the box, the WorkbenchContentSource component uses a $basedOn property set to the /atg/endeca/assembler/cartridge/manager/PerApplicationWorkbenchContentSourceResolver, which is a request-scoped component that determines which Workbench application to connect to, based on the current request. This default configuration is primarily intended to support environments that have multiple applications, although it works for single-application environments as well.
The WorkbenchContentSource properties file also includes some configuration, which has been commented out, that is more efficient for environments that always have a single Endeca application:
# $class=atg.nucleus.GenericReference
# $scope=global
# componentPath=DefaultWorkbenchContentSource
This configuration creates a globally-scoped WorkbenchContentSource component that gets its connection details from the /atg/endeca/assembler/cartridge/manager/DefaultWorkbenchContentSource component. This approach is more efficient for a single-application environment because it avoids having to resolve the WorkbenchContentSource for every request. If you have a single-application environment, you can use this configuration instead.
The following sections provide some additional details on the DefaultWorkbenchContentSource and PerApplicationWorkbenchContentSource components that provide the connection details stored in a WorkbenchContentSource component.
DefaultWorkbenchContentSource
The /atg/endeca/assembler/cartridge/manager/DefaultWorkbenchContentSource component, of class atg.endeca.assembler.content.ExtendedWorkbenchContentSource, is a globally-scoped component that includes properties for connecting to a default Workbench application. Out of the box, this property is included in the initialServices property of the /initial component, to ensure that it is created on start up.
initialServices+=\ /atg/endeca/assembler/AssemblerPipelineServlet,\ /atg/endeca/assembler/cartridge/manager/DefaultWorkbenchContentSource
In a single application environment, the DefaultWorkbenchContentSource component provides connection details to the single globally-scoped Workbench application that should be used for all requests. In a multi-application environment, this component provides connection details to a default Workbench application in case that the PerApplicationWorkbenchContentSourceResolver cannot resolve an Endeca application-specific WorkbenchContentSource.
The DefaultWorkbenchContentSource component has a set of properties that represent the constructor arguments that are used to create the WorkbenchContentSource. The DefaultWorkbenchContentSource component gets the values for these properties from the ApplicationConfiguration and AssemblerApplicationConfiguration components. It is the responsibility of these other two components to calculate the correct Endeca application and Workbench connection to use. The DefaultWorkbenchContentSource properties include:
# Arg1 - Workbench app name: This property provides the first constructor argument for
WorkbenchContentSourceand it points to the Endeca application. The default property setting is:$constructor.param[1].value^=/atg/endeca/ApplicationConfiguration.defaultApplicationName# Arg3 - Workbench host: This property provides the third constructor argument for
WorkbenchContentSourceand it points to the host that the Workbench is installed on. The default property setting is:$constructor.param[3].value=../../AssemblerApplicationConfiguration.workbenchHostName# Arg 4 - Workbench port: This property provides the fourth constructor argument for
WorkbenchContentSourceand it points to the port that the Workbench is using. The default property setting is:$constructor.param[4].value^=../../AssemblerApplicationConfiguration.workbenchPort
PerApplicationWorkbenchContentSourceResolver
In an environment that has multiple Workbench applications, it is the /atg/endeca/assembler/cartridge/manager/PerApplicationWorkbenchContentSourceResolver component’s responsibility to determine the correct globally-scoped, Endeca application-specific WorkbenchContentSource component to use for the current request. This component also defines a default WorkbenchContentSource component to use if an Endeca application-specific version cannot be found. PerApplicationWorkbenchContentSourceResolver is of class atg.endeca.assembler.configuration.PerEndecaApplicationGenericReference, which extends the atg.nucleus.GenericReference class to calculate the correct component to reference based on the Endeca application key of the current request.
Note that PerApplicationWorkbenchContentSourceResolver is request-scoped. This means that the globally-scoped WorkbenchContentSource component that it resolves and references gets inserted into the request scope as an alias. This effectively allows the application to resolve the WorkbenchContentSource component on a per-request basis.
To perform its tasks, the PerApplicationWorkbenchContentSourceResolver component has the following properties:
defaultComponentPath: The Nucleus path of theWorkbenchContentSourcecomponent to default to if an Endeca application-specific version cannot be resolved. Defaults to/atg/endeca/assembler/cartridge/manager/DefaultWorkbenchContentSource.componentBasePath: The base path for the Endeca application-specificWorkbenchContentSourcecomponents.PerApplicationWorkbenchContentSourceResolveradds the Endeca application keys, such as_enand_es, as suffixes to this path to resolve the correctWorkbenchContentSourceto reference. Defaults to/atg/endeca/assembler/cartridge/manager/WorkbenchContentSource.assemblerApplicationConfiguration: The Nucleus path to theAssemblerApplicationConfigurationcomponent, where thePerApplicationWorkbenchContentSourceResolvergets the application keys. Defaults to../../AssemblerApplicationConfiguration.useDefaultIfSingleApplication: Indicates that thePerApplicationWorkbenchContentSourceResolvershould use theDefaultWorkbenchContentSourceif there is only one Endeca application and avoid resolving an Endeca application-specificWorkbenchContentSource.
Manually Adding Application-specific WorkbenchContentSource Components
It is an Endeca requirement that the WorkbenchContentSource component used to communicate with any given Workbench application be globally scoped and started up front, before any requests are made. To accommodate this requirement, the ApplicationAssemblerConfiguration component automatically creates Endeca application-specific WorkbenchContentSource components on application start up.
If the automatically-created WorkbenchContentSource components are not sufficient for your needs, you can manually create .properties files for other Endeca application-specific WorkbenchContentSource components, for example:
$basedOn=DefaultWorkbenchContentSource # Arg1 - Workbench app name $constructor.param[1].value=Endeca-application-name# Arg3 - Workbench host $constructor.param[3].value=Workbench-host-name# Arg 4 - Workbench port $constructor.param[4].value=Workbench-host-port
After creating the Endeca application-specific WorkbenchContentSource components, you must add them to the intialServices property of the /initial component so that they are started on application start-up, for example:
initialServices+=\
/atg/endeca/assembler/cartridge/manager/WorkbenchContentSource_application-key
