Search in sources :

Example 11 with JcrTemplate

use of org.springframework.extensions.jcr.JcrTemplate in project pentaho-platform by pentaho.

the class UserRoleDaoIT method setApplicationContext.

public void setApplicationContext(final ApplicationContext applicationContext) throws BeansException {
    manager = (IBackingRepositoryLifecycleManager) applicationContext.getBean("backingRepositoryLifecycleManager");
    SessionFactory jcrSessionFactory = (SessionFactory) applicationContext.getBean("jcrSessionFactory");
    testJcrTemplate = new JcrTemplate(jcrSessionFactory);
    testJcrTemplate.setAllowCreate(true);
    testJcrTemplate.setExposeNativeSession(true);
    repositoryAdminUsername = (String) applicationContext.getBean("repositoryAdminUsername");
    authenticatedRoleName = (String) applicationContext.getBean("singleTenantAuthenticatedAuthorityName");
    adminRoleName = (String) applicationContext.getBean("singleTenantAdminAuthorityName");
    roleBindingDaoTarget = (IRoleAuthorizationPolicyRoleBindingDao) applicationContext.getBean("roleAuthorizationPolicyRoleBindingDaoTarget");
    sysAdminRoleName = (String) applicationContext.getBean("superAdminAuthorityName");
    sysAdminUserName = (String) applicationContext.getBean("superAdminUserName");
    authorizationPolicy = (IAuthorizationPolicy) applicationContext.getBean("authorizationPolicy");
    tenantManager = (ITenantManager) applicationContext.getBean("tenantMgrProxy");
    repositoryFileDao = (IRepositoryFileDao) applicationContext.getBean("repositoryFileDao");
    userRoleDaoProxy = (IUserRoleDao) applicationContext.getBean("userRoleDaoTxn");
    userRoleDaoTestProxy = (IUserRoleDao) applicationContext.getBean("userRoleDaoTxn");
    tenantedUserNameUtils = (ITenantedPrincipleNameResolver) applicationContext.getBean("tenantedUserNameUtils");
    tenantedRoleNameUtils = (ITenantedPrincipleNameResolver) applicationContext.getBean("tenantedRoleNameUtils");
    TestPrincipalProvider.userRoleDao = (IUserRoleDao) applicationContext.getBean("userRoleDaoTxn");
    TestPrincipalProvider.adminCredentialsStrategy = (CredentialsStrategy) applicationContext.getBean("jcrAdminCredentialsStrategy");
    TestPrincipalProvider.repository = (Repository) applicationContext.getBean("jcrRepository");
    jcrTemplate = (JcrTemplate) applicationContext.getBean("jcrTemplate");
}
Also used : SessionFactory(org.springframework.extensions.jcr.SessionFactory) JcrTemplate(org.springframework.extensions.jcr.JcrTemplate)

Example 12 with JcrTemplate

use of org.springframework.extensions.jcr.JcrTemplate in project data-access by pentaho.

the class AgileMartDatasourceLifecycleManager method getInstance.

public static AgileMartDatasourceLifecycleManager getInstance() {
    if (instance == null) {
        TransactionTemplate txnTemplate = PentahoSystem.get(TransactionTemplate.class, "jcrTransactionTemplate", PentahoSessionHolder.getSession());
        JcrTemplate adminJcrTemplate = PentahoSystem.get(JcrTemplate.class, "adminJcrTemplate", PentahoSessionHolder.getSession());
        IPathConversionHelper pathConversionHelper = PentahoSystem.get(IPathConversionHelper.class, "pathConversionHelper", PentahoSessionHolder.getSession());
        IPluginResourceLoader resLoader = PentahoSystem.get(IPluginResourceLoader.class, PentahoSessionHolder.getSession());
        IDatasourceMgmtService datasourceMgmtService = PentahoSystem.get(IDatasourceMgmtService.class, PentahoSessionHolder.getSession());
        instance = new AgileMartDatasourceLifecycleManager(txnTemplate, adminJcrTemplate, pathConversionHelper, datasourceMgmtService, resLoader);
    }
    return instance;
}
Also used : JcrTemplate(org.springframework.extensions.jcr.JcrTemplate) TransactionTemplate(org.springframework.transaction.support.TransactionTemplate) IPathConversionHelper(org.pentaho.platform.repository2.unified.jcr.IPathConversionHelper) IPluginResourceLoader(org.pentaho.platform.api.engine.IPluginResourceLoader) IDatasourceMgmtService(org.pentaho.platform.api.repository.datasource.IDatasourceMgmtService)

Aggregations

JcrTemplate (org.springframework.extensions.jcr.JcrTemplate)12 SessionFactory (org.springframework.extensions.jcr.SessionFactory)9 TransactionTemplate (org.springframework.transaction.support.TransactionTemplate)3 Session (javax.jcr.Session)2 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)2 JcrCallback (org.springframework.extensions.jcr.JcrCallback)2 BufferedOutputStream (java.io.BufferedOutputStream)1 File (java.io.File)1 IOException (java.io.IOException)1 ZipEntry (java.util.zip.ZipEntry)1 ZipOutputStream (java.util.zip.ZipOutputStream)1 AccessDeniedException (javax.jcr.AccessDeniedException)1 Node (javax.jcr.Node)1 RepositoryException (javax.jcr.RepositoryException)1 Workspace (javax.jcr.Workspace)1 VersionManagerImpl (org.apache.jackrabbit.core.VersionManagerImpl)1 Before (org.junit.Before)1 Matchers.anyString (org.mockito.Matchers.anyString)1 IAuthorizationPolicy (org.pentaho.platform.api.engine.IAuthorizationPolicy)1 IPluginResourceLoader (org.pentaho.platform.api.engine.IPluginResourceLoader)1