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. Commerce Reference Store implements the first case, a sharing group of sites that are related by an abstract concept.

At any given time in an Oracle ATG Web Commerce 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, Commerce Reference Store implements a ShareableType component called Related Regional Stores that represents the concept of regional peers of the same store. Commerce Reference Store has a sharing group that includes the ATG Store US and ATG Store Germany sites, along with the Related Regional Stores shareable type, indicating that ATG Store US and ATG Store Germany are regional peers.

Commerce Reference Store JSP code uses the /atg/dynamo/droplet/multisite/
SharingSitesDroplet
to determine which other sites are in a Related Regional Stores sharing group with the current site. When ATG Store US is the current site, this droplet returns ATG Store Germany and vice versa. This approach allows Commerce Reference Store
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 Commerce Reference Store UI:

The Commerce Reference Store approach to 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).

The Related Regional Stores shareable type component is defined in the /atg/store/RelatedRegionalStoresShareableType.properties file found in Commerce Reference Store’s Store.Estore.International module. Its definition looks like this:

$class=atg.multisite.ShareableType

# The shareable type ID used by application code
id=crs.RelatedRegionalStores

# Information used to find strings appropriate for localized UIs
displayNameResource=relatedRegionsShareableTypeName

resourceBundleName=
atg.projects.store.multisite.InternationalStoreSiteRepositoryTemplateResources

Note: For details on creating non-Nucleus shareable type components, see the Multisite Request Processing chapter of the ATG Platform Programming Guide.