本文整理汇总了Java中org.apache.sling.api.resource.ResourceResolver.isLive方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceResolver.isLive方法的具体用法?Java ResourceResolver.isLive怎么用?Java ResourceResolver.isLive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.sling.api.resource.ResourceResolver
的用法示例。
在下文中一共展示了ResourceResolver.isLive方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: operate
import org.apache.sling.api.resource.ResourceResolver; //导入方法依赖的package包/类
/**
* Do some operation on repository (delete or update resource etc) with wrapped impersonated session
* (automatically opened and closed).
*/
public static void operate(ResourceResolverFactory factory, String userId, OperateCallback callback)
throws OperateException {
ResourceResolver resolver = null;
try {
resolver = getResourceResolverForUser(factory, userId);
callback.operate(resolver);
resolver.commit();
} catch (Exception e) {
throw new OperateException(OPERATE_ERROR_MESSAGE, e);
} finally {
if (resolver != null && resolver.isLive()) {
resolver.close();
}
}
}
示例2: resolve
import org.apache.sling.api.resource.ResourceResolver; //导入方法依赖的package包/类
/**
* Retrieve values from repository with wrapped impersonated session (automatically opened and closed).
*/
@SuppressWarnings("unchecked")
public static <T> T resolve(ResourceResolverFactory factory, String userId, ResolveCallback callback)
throws ResolveException {
ResourceResolver resolver = null;
try {
resolver = getResourceResolverForUser(factory, userId);
return (T) callback.resolve(resolver);
} catch (Exception e) {
throw new ResolveException(RESOLVE_ERROR_MESSAGE, e);
} finally {
if (resolver != null && resolver.isLive()) {
resolver.close();
}
}
}
示例3: findTag
import org.apache.sling.api.resource.ResourceResolver; //导入方法依赖的package包/类
public Tag findTag(String tagId, Asset asset, Session session) {
Tag tag = null;
ResourceResolver resourceResolver = null;
try {
resourceResolver = getResourceResolver(session);
TagManager tagManager = resourceResolver.adaptTo(TagManager.class);
tag = tagManager.resolve(tagId);
} finally {
if (null != resourceResolver && resourceResolver.isLive()) {
resourceResolver.close();
}
}
return tag;
}
示例4: findName
import org.apache.sling.api.resource.ResourceResolver; //导入方法依赖的package包/类
public String findName(final String path) {
String name = "";
ResourceResolver resourceResolver = null;
try {
resourceResolver = resourceResolverProducer.produce();
name = resourceResolver.getResource(path).getName();
} finally {
if (null != resourceResolver && resourceResolver.isLive()) {
resourceResolver.close();
}
}
return name;
}