Non-Nucleus ShareableType
components allow you to create sharing groups that contain sites that share an abstract concept or some other type of non-Nucleus object.
At any given time in an Oracle Commerce Platform application, there is a current site. Non-Nucleus shareable types let you determine what other sites share a particular concept with the current site. For example, if your store has a sharing group that includes the Store US and Store Germany sites, along with the Related Regional Stores
shareable type, indicating that Store US and Store Germany are regional peers.
Use the /atg/dynamo/droplet/multisite/SharingSitesDroplet
to determine which other sites are in a Related Regional Stores
sharing group with the current site. When Store US is the current site, this droplet returns Store Germany and vice versa. This approach allows you to implement one generic piece of JSP code that renders a widget that allows shoppers to switch among regional peer sites, as shown in this excerpt from store.war/navigation/gadgets/regions.jsp
:
<dsp:page> <dsp:importbean bean="/atg/dynamo/droplet/ComponentExists" /> <dsp:importbean bean="/atg/dynamo/droplet/ForEach" /> <dsp:importbean bean="/atg/dynamo/droplet/multisite/SharingSitesDroplet" /> <dsp:importbean bean="/atg/multisite/Site" var="currentSite" /> <dsp:importbean bean="/atg/store/droplet/DisplayCountryDroplet" /> <%-- ComponentExists droplet conditionally renders one of its output parameters depending on whether or not a specified Nucleus path currently refers to a non-null object. It it used to query whether a particular component has been instantiated, in this case the InternationalStore. If the InternationalStore component has been instantiated then we render the alternate regions. --%> <dsp:droplet name="ComponentExists" path="/atg/modules/InternationalStore"> <dsp:oparam name="true"> <%-- SharingSitesDroplet returns all the sharing sites within the given site group. If the siteId is not provided as an input parameter, it is retrieved from the SiteContext. Similarly, the ShareableTypeId may be provided as an optional input parameter. The droplet is used here to return all the sites which share the crs.RelatedRegionalStores shareable type with the current site. These are the related regional stores. --%> <dsp:droplet name="SharingSitesDroplet" shareableTypeId="crs.RelatedRegionalStores" var="sharingSites"> <dsp:oparam name="output"> <dsp:getvalueof var="sites" param="sites"/> <%-- Ensure we have stores in different regions --%> <c:if test="${fn:length(sharingSites.sites) > 1}"> <dl id="atg_store_regions"> <%-- Display the Country text --%> <dt> <fmt:message key="navigation_internationalStores.RegionsTitle"/> <fmt:message key="common.labelSeparator"/> </dt> <%-- ForEach droplet renders the open parameter output for each element in its array input parameter. For every regional site, render a link to it. --%> <dsp:droplet name="ForEach" array="${sharingSites.sites}" var="current"> <dsp:oparam name="output"> <dsp:setvalue param="site" value="${current.element}"/> <dsp:getvalueof var="siteName" param="site.name"/> <dsp:getvalueof var="siteId" param="site.id"/> <dsp:getvalueof var="siteDefaultCountry" param="site.defaultCountry"/> <dsp:getvalueof var="siteDefaultLanguage" param="site.defaultLanguage"/> <%-- DisplayCountryDroplet takes a locale language key and country code and returns the corresponding country display name in the user's locale. --%> <dsp:droplet name="DisplayCountryDroplet" countryCode="${siteDefaultCountry}" language="${siteDefaultLanguage}" var="siteCountry"> <dsp:oparam name="output"> <c:set var="countryName" value="${siteCountry.displayCountryName}"/> </dsp:oparam> </dsp:droplet> <%-- Display a link to the related regional store --%> <dd class="<crs:listClass count="${current.count}" size="${current.size}" selected="${siteId == currentSite.id}" />"> <c:choose> <%-- Display the current region name as text --%> <c:when test="${siteId == currentSite.id}"> <dsp:valueof value="${countryName}" /> </c:when> <%-- Otherwise generate a link to the related store --%> <c:otherwise> <dsp:include page="/global/gadgets/crossSiteLinkGenerator.jsp"> <dsp:param name="siteId" value="${siteId}"/> <dsp:param name="customUrl" value="/"/> </dsp:include> <dsp:a href="${siteLinkUrl}" title="${countryName}"> <c:out value="${countryName}"/> </dsp:a> </c:otherwise> </c:choose> </dd> </dsp:oparam> </dsp:droplet> </dl> </c:if> </dsp:oparam> </dsp:droplet> </dsp:oparam> </dsp:droplet> </dsp:page>
This code renders the following area of the UI:

Using regional peers eliminates the need for site-specific JSP code that says “If site A is the current site, render widgets for sites B and C; if site B is the current site, render widgets for sites A and C, and so on.” Adding a new site to a group of regional peers only requires adding the site to the Related Regional Stores
sharing group in Site Administration. No JSP code needs to change in order to retrieve and render the additional regional peer (although presentation code may need to change if there is not enough room for the additional site to appear in the UI).
Note: For details on creating non-Nucleus shareable type components, see the Multisite Request Processing chapter of the Platform Programming Guide.
Note: If you are working in a stateless environment, it is recommended that you do not use shareables. For additional information on statelessness, refer to the Web Services Guide.