本文整理汇总了Java中org.apache.sling.jcr.api.SlingRepository类的典型用法代码示例。如果您正苦于以下问题:Java SlingRepository类的具体用法?Java SlingRepository怎么用?Java SlingRepository使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SlingRepository类属于org.apache.sling.jcr.api包,在下文中一共展示了SlingRepository类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pathExists
import org.apache.sling.jcr.api.SlingRepository; //导入依赖的package包/类
@Test
public void pathExists() throws RepositoryException {
final SlingRepository repo = teleporter.getService(SlingRepository.class);
final Session s = repo.loginAdministrative(null);
try {
assertTrue(s.nodeExists("/repoinit/provisioningModelTest"));
} finally {
s.logout();
}
}
开发者ID:apache,项目名称:sling-org-apache-sling-launchpad-integration-tests,代码行数:11,代码来源:RepoinitPathTest.java
示例2: assertSystemUser
import org.apache.sling.jcr.api.SlingRepository; //导入依赖的package包/类
private void assertSystemUser(String name) throws RepositoryException {
final SlingRepository repo = teleporter.getService(SlingRepository.class);
final Session s = repo.loginAdministrative(null);
try {
final Credentials creds = new SimpleCredentials(name, new char[] {});
try {
s.impersonate(creds);
} catch(RepositoryException rex) {
fail("Impersonation as " + name + " failed: " + rex.toString());
}
} finally {
s.logout();
}
}
开发者ID:apache,项目名称:sling-org-apache-sling-launchpad-integration-tests,代码行数:15,代码来源:SystemUsersTest.java
示例3: createGroups
import org.apache.sling.jcr.api.SlingRepository; //导入依赖的package包/类
/**
* Create user groups for authors and testers.
*
* @param bundleContext The bundle context provided by the component.
*/
private void createGroups(BundleContext bundleContext){
ServiceReference SlingRepositoryFactoryReference = bundleContext.getServiceReference(SlingRepository.class.getName());
SlingRepository repository = (SlingRepository)bundleContext.getService(SlingRepositoryFactoryReference);
Session session = null;
if (repository != null) {
try {
session = repository.loginAdministrative(null);
if (session != null && session instanceof JackrabbitSession) {
UserManager userManager = ((JackrabbitSession)session).getUserManager();
ValueFactory valueFactory = session.getValueFactory();
Authorizable authors = userManager.getAuthorizable(PublickConstants.GROUP_ID_AUTHORS);
if (authors == null) {
authors = userManager.createGroup(PublickConstants.GROUP_ID_AUTHORS);
authors.setProperty(GROUP_DISPLAY_NAME, valueFactory.createValue(PublickConstants.GROUP_DISPLAY_AUTHORS));
}
Authorizable testers = userManager.getAuthorizable(PublickConstants.GROUP_ID_TESTERS);
if (testers == null) {
testers = userManager.createGroup(PublickConstants.GROUP_ID_TESTERS);
testers.setProperty(GROUP_DISPLAY_NAME, valueFactory.createValue(PublickConstants.GROUP_DISPLAY_TESTERS));
}
}
} catch (RepositoryException e) {
LOGGER.error("Could not get session", e);
} finally {
if (session != null && session.isLive()) {
session.logout();
session = null;
}
}
}
}
示例4: build
import org.apache.sling.jcr.api.SlingRepository; //导入依赖的package包/类
public SlingRepository build() {
SlingRepositoryImpl repository = new SlingRepositoryImpl();
try {
for (NodeBuilder nodeBuilder : nodeBuilders)
((NodeBuilderImpl)nodeBuilder).build(repository.login().getRootNode());
}
catch (RepositoryException re) {
throw new SlingRepositoryException(re);
}
return repository;
}
示例5: ResourceResolverImpl
import org.apache.sling.jcr.api.SlingRepository; //导入依赖的package包/类
@SuppressWarnings("ConstantConditions")
public ResourceResolverImpl(@Nonnull SlingRepository repository) {
if (repository == null) throw new IllegalArgumentException("Repository cannot be null.");
try {
this.session = repository.login();
}
catch (RepositoryException re) {
throw new SlingRepositoryException(re);
}
}
示例6: SimpleResourceResolverFactory
import org.apache.sling.jcr.api.SlingRepository; //导入依赖的package包/类
public SimpleResourceResolverFactory(@Nonnull SlingRepository repository) {
this.resourceResolver = new ResourceResolverImpl(repository);
}
示例7: isOak
import org.apache.sling.jcr.api.SlingRepository; //导入依赖的package包/类
@Override
public final boolean isOak() throws RepositoryException {
final String repositoryName = slingRepository.getDescriptorValue(SlingRepository.REP_NAME_DESC).getString();
return StringUtils.equalsIgnoreCase("Apache Jackrabbit Oak", repositoryName);
}
示例8: setRepository
import org.apache.sling.jcr.api.SlingRepository; //导入依赖的package包/类
public void setRepository(SlingRepository repository) {
this.repository = repository;
}
示例9: getRepository
import org.apache.sling.jcr.api.SlingRepository; //导入依赖的package包/类
/** Returns the JCR repository used by this service. */
protected SlingRepository getRepository() {
return repository;
}
示例10: build
import org.apache.sling.jcr.api.SlingRepository; //导入依赖的package包/类
public SlingRepository build();