当前位置: 首页>>代码示例>>Java>>正文


Java SlingRepository类代码示例

本文整理汇总了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;
            }
        }
    }
}
 
开发者ID:nateyolles,项目名称:publick-sling-blog,代码行数:44,代码来源:Activator.java

示例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;
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:12,代码来源:JCRBuilder.java

示例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);
    }
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:11,代码来源:ResourceResolverImpl.java

示例6: SimpleResourceResolverFactory

import org.apache.sling.jcr.api.SlingRepository; //导入依赖的package包/类
public SimpleResourceResolverFactory(@Nonnull SlingRepository repository) {
    this.resourceResolver = new ResourceResolverImpl(repository);
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:4,代码来源:SimpleResourceResolverFactory.java

示例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);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:6,代码来源:AemCapabilityHelperImpl.java

示例8: setRepository

import org.apache.sling.jcr.api.SlingRepository; //导入依赖的package包/类
public void setRepository(SlingRepository repository) {
	this.repository = repository;
}
 
开发者ID:bobpaulin,项目名称:sling-web-resource,代码行数:4,代码来源:BackgroundCompilerHandler.java

示例9: getRepository

import org.apache.sling.jcr.api.SlingRepository; //导入依赖的package包/类
/** Returns the JCR repository used by this service. */
protected SlingRepository getRepository() {
	return repository;
}
 
开发者ID:hlta,项目名称:playweb,代码行数:5,代码来源:CreateFieldServlet.java

示例10: build

import org.apache.sling.jcr.api.SlingRepository; //导入依赖的package包/类
public SlingRepository build(); 
开发者ID:TWCable,项目名称:jackalope,代码行数:2,代码来源:RepositoryBuilder.java


注:本文中的org.apache.sling.jcr.api.SlingRepository类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。