
com.adobe.aemds.guide.utils.GuideContainerThreadLocal Maven / Gradle / Ivy
/*
*
* ADOBE CONFIDENTIAL
* Copyright 2014 Adobe Systems Incorporated All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains the property of
* Adobe Systems Incorporated and its suppliers, if any. The intellectual and
* technical concepts contained herein are proprietary to Adobe Systems
* Incorporated and its suppliers and may be covered by U.S. and Foreign
* Patents, patents in process, and are protected by trade secret or copyright
* law. Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained from
* Adobe Systems Incorporated.
*/
/**
* Adds a ThreadLocal instance for thread specific operations for storing context for fragment's children.
*/
package com.adobe.aemds.guide.utils;
import com.day.cq.i18n.I18n;
/**
* @pad.exclude Exclude from Published API.
*/
public class GuideContainerThreadLocal {
private static ThreadLocal tl = new ThreadLocal();
public static GuideFragmentHolder getGuideFragmentHolder() {
return tl.get();
}
public static void setGuideFragmentHolder(String fragPrefixID, String bindRefPrefixForFragment, String fragmentModelRoot, I18n i18n) {
GuideFragmentHolder guideFragmentHolder = new GuideFragmentHolder(fragPrefixID, bindRefPrefixForFragment, fragmentModelRoot, i18n);
tl.set(guideFragmentHolder);
}
//Thread local used to store the guide container path and thus also the name.
private static ThreadLocal guideContainerThreadLocal = new ThreadLocal();
public static String getGuideContainerName() {
String containerName = guideContainerThreadLocal.get();
if(containerName != null && containerName.contains("/")) {
containerName = containerName.substring(containerName.lastIndexOf("/")+1);
//append the extension (if any - normally HTML)
if(containerName.contains(".")) {
containerName = containerName.substring(0 , containerName.lastIndexOf("."));
}
}
return containerName;
}
public static String getGuideContainerPath() {
return guideContainerThreadLocal.get();
}
public static void setGuideContainerPath(String guideContainerPath) {
guideContainerThreadLocal.set(guideContainerPath);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy