• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ApplicationContextHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.alfresco.util.ApplicationContextHelper的典型用法代码示例。如果您正苦于以下问题:Java ApplicationContextHelper类的具体用法?Java ApplicationContextHelper怎么用?Java ApplicationContextHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ApplicationContextHelper类属于org.alfresco.util包,在下文中一共展示了ApplicationContextHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setUp

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
@Before
public void setUp() throws Exception
{
    ctx = ApplicationContextHelper.getApplicationContext();
    this.modelValidator = (ModelValidator)ctx.getBean("modelValidator");
    this.dictionaryDAO = (DictionaryDAO)ctx.getBean("dictionaryDAO");
    this.qnameDAO = (QNameDAO)ctx.getBean("qnameDAO");
    this.namespaceDAO = (NamespaceDAO)ctx.getBean("namespaceDAO");
    this.nodeService = (NodeService)ctx.getBean("NodeService");
    this.fileFolderService = (FileFolderService)ctx.getBean("FileFolderService");
    this.contentService = (ContentService)ctx.getBean("contentService");
    this.versionService = (VersionService)ctx.getBean("VersionService");
    this.transactionService = (TransactionService)ctx.getBean("TransactionService");
    this.nodeArchiveService = (NodeArchiveService)ctx.getBean("nodeArchiveService");

    this.modelName = "modelvalidatortest" + System.currentTimeMillis();
    addModel();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:ModelValidatorTest.java


示例2: beforeClass

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws Exception
{
    ApplicationContext ctx = ApplicationContextHelper.getApplicationContext(contextLocations);
    DefaultChildApplicationContextManager childApplicationContextManager = (DefaultChildApplicationContextManager) ctx.getBean("Authentication");
    remoteUserAuthenticatorFactory = (RemoteUserAuthenticatorFactory) ctx.getBean("webscripts.authenticator.remoteuser");
    personService = (PersonService)ctx.getBean("PersonService");
    transactionService = (TransactionService)ctx.getBean("TransactionService");
    authenticationDAO = (MutableAuthenticationDao)ctx.getBean("authenticationDao");

    childApplicationContextManager.stop();
    childApplicationContextManager.setProperty("chain", "external1:external");
    ChildApplicationContextFactory childApplicationContextFactory = childApplicationContextManager.getChildApplicationContextFactory("external1");
    childApplicationContextFactory.stop();
    childApplicationContextFactory.setProperty("external.authentication.proxyUserName", "");
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:RemoteAuthenticatorFactoryTest.java


示例3: getCtxAndSetBeans

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
private void getCtxAndSetBeans()
{
    ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
    this.customModelService = ctx.getBean("customModelService", CustomModelService.class);
    this.transactionHelper = ctx.getBean("retryingTransactionHelper", RetryingTransactionHelper.class);
    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:CustomModelRepoRestartTest.java


示例4: setUp

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
@Before
public void setUp() throws Exception
{
    applicationContext = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS);

    processes = (Processes) applicationContext.getBean(PROCESSES_BEAN_NAME);

    ServiceRegistry registry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
    workflowService = registry.getWorkflowService();
    personService = registry.getPersonService();

    transaction = registry.getTransactionService().getUserTransaction();
    transaction.begin();

    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
    AuthenticationUtil.setRunAsUser(AuthenticationUtil.getAdminUserName());

    NodeRef adminUserNodeRef = personService.getPerson(AuthenticationUtil.getAdminUserName());

    WorkflowDefinition workflowDefinition = findAppropriateWorkflowDefinitionId();

    for (int i = 0; i < ACTIVE_WORKFLOWS_INITIAL_AMOUNT; i++)
    {
        startWorkflow(workflowDefinition, adminUserNodeRef);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:27,代码来源:ProcessesImplTest.java


示例5: setUp

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
@Before
public void setUp() throws Exception
{
    applicationContext = ApplicationContextHelper.getApplicationContext();
    ServiceRegistry registry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
    davHelper = (WebDAVHelper) applicationContext.getBean(WebDAVHelper.BEAN_NAME);
    auditRegistry = (AuditModelRegistryImpl) applicationContext.getBean(AUDIT_REGISTRY_BEAN_NAME);

    auditService = registry.getAuditService();
    fileFolderService = registry.getFileFolderService();
    transactionService = registry.getTransactionService();

    testingMethod = new GetMethod();
    mockResponse = new MockHttpServletResponse();

    restartTransaction(TransactionActionEnum.ACTION_NONE);
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());

    companyHomeNodeRef = registry.getNodeLocatorService().getNode(CompanyHomeNodeLocator.NAME, null, null);
    rootTestFolder = fileFolderService.create(companyHomeNodeRef, ROOT_TEST_FOLDER_NAME, ContentModel.TYPE_FOLDER).getNodeRef();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:22,代码来源:GetMethodRegressionTest.java


示例6: main

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
/**
 * Create a bunch of files and folders in a folder and then run multi-threaded directory
 * listings against it.
 * 
 * @param args         <x> <y> where 'x' is the number of files in a folder and 'y' is the 
 *                     number of threads to list
 */
public static void main(String ... args)
{
    ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) ApplicationContextHelper.getApplicationContext();

    try
    {
        run(ctx, args);
    }
    catch (Throwable e)
    {
        System.out.println("Failed to run FileFolder performance test");
        e.printStackTrace();
    }
    finally
    {
        ctx.close();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:FileFolderPerformanceTester.java


示例7: initContextAndCreateUser

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
public  void initContextAndCreateUser()
{
    appContext = ApplicationContextHelper.getApplicationContext();

    authenticationService = (MutableAuthenticationService) appContext.getBean("AuthenticationService");
    contentService = (ContentService) appContext.getBean("ContentService");
    nodeService = (NodeService) appContext.getBean("NodeService");
    permissionService = (PermissionService) appContext.getBean("PermissionService");
    personService = (PersonService) appContext.getBean("PersonService");
    renditionService = (RenditionService) appContext.getBean("RenditionService");
    repositoryHelper = (Repository) appContext.getBean("repositoryHelper");
    transactionService = (TransactionService) appContext.getBean("TransactionService");
    txnHelper = transactionService.getRetryingTransactionHelper();
    ownableService = (OwnableService) appContext.getBean("ownableService");

    ADMIN_USER = AuthenticationUtil.getAdminUserName();
    
    // Create a nonAdminUser
    createUser(NON_ADMIN_USER);

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:MultiUserRenditionTest.java


示例8: setUp

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
    ctx = ApplicationContextHelper.getApplicationContext();
    if (AlfrescoTransactionSupport.isActualTransactionActive())
    {
        fail("Test started with transaction in progress");
    }
    
    transactionService = (TransactionService) ctx.getBean("transactionComponent");
    repoUsageComponent = (RepoUsageComponent) ctx.getBean("repoUsageComponent");
    jobLockService = (JobLockService) ctx.getBean("jobLockService");
    
    AuthenticationUtil.setRunAsUserSystem();
    
    txn = transactionService.getUserTransaction();
    txn.begin();
    
    restrictionsBefore = repoUsageComponent.getRestrictions();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:RepoUsageComponentTest.java


示例9: setUp

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
@Override
public void setUp() throws Exception
{
    ctx = ApplicationContextHelper.getApplicationContext(CONTEXTS);
    // Get the required services
    transactionService = (TransactionService) ctx.getBean("TransactionService");
    subscriptionService = (SubscriptionService) ctx.getBean("SubscriptionService");
    personService = (PersonService) ctx.getBean("PersonService");
    nodeService = (NodeService) ctx.getBean("NodeService");
    searchService = (SearchService) ctx.getBean("SearchService");
    repositoryHelper = (Repository) ctx.getBean("repositoryHelper");

    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());

    txn = transactionService.getNonPropagatingUserTransaction(false);
    txn.begin();

    createPerson(USER_BOB);
    createPerson(USER_TOM);
    createPerson(USER_LISA);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:SubscriptionServiceImplTest.java


示例10: setUpApplicationContext

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
protected void setUpApplicationContext()
{
    ApplicationContext appContext = ApplicationContextHelper.getApplicationContext(new String[]
            {
                    "classpath:alfresco/application-context.xml", "classpath:alfresco/web-scripts-application-context.xml",
                    "classpath:alfresco/remote-api-context.xml"
            });

    this.nodeService = (NodeService) appContext.getBean("NodeService");
    this.searchService = (SearchService) appContext.getBean("SearchService");
    this.namespaceService = (NamespaceService) appContext.getBean("NamespaceService");
    this.tenantService = (TenantService) appContext.getBean("tenantService");
    this.transactionService = (TransactionService) appContext.getBean("transactionService");
    this.webDAVHelper = (WebDAVHelper) appContext.getBean("webDAVHelper");
    this.tenantAdminService = (TenantAdminService) appContext.getBean("tenantAdminService");

    // Authenticate as system to create initial test data set
    AuthenticationComponent authenticationComponent = (AuthenticationComponent) appContext.getBean("authenticationComponent");
    authenticationComponent.setSystemUserAsCurrentUser();
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:21,代码来源:WebDAVMethodTest.java


示例11: setUp

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
protected void setUp() throws Exception
{
    super.setUp();
    ctx = ApplicationContextHelper.getApplicationContext();
    transactionService = (TransactionService)ctx.getBean("transactionComponent");
    contentService = (ContentService)ctx.getBean("contentService");
    nodeService = (NodeService)ctx.getBean("nodeService");
    scriptService = (ScriptService)ctx.getBean("scriptService");
    serviceRegistry = (ServiceRegistry)ctx.getBean("ServiceRegistry");
    
    this.authenticationComponent = (AuthenticationComponent)ctx.getBean("authenticationComponent");
    this.authenticationComponent.setSystemUserAsCurrentUser();
    
    DictionaryDAO dictionaryDao = (DictionaryDAO)ctx.getBean("dictionaryDAO");
    
    // load the system model
    ClassLoader cl = BaseNodeServiceTest.class.getClassLoader();
    InputStream modelStream = cl.getResourceAsStream("alfresco/model/contentModel.xml");
    assertNotNull(modelStream);
    M2Model model = M2Model.createModel(modelStream);
    dictionaryDao.putModel(model);
    
    // load the test model
    modelStream = cl.getResourceAsStream("org/alfresco/repo/node/BaseNodeServiceTest_model.xml");
    assertNotNull(modelStream);
    model = M2Model.createModel(modelStream);
    dictionaryDao.putModel(model);
    
    DictionaryComponent dictionary = new DictionaryComponent();
    dictionary.setDictionaryDAO(dictionaryDao);
    BaseNodeServiceTest.loadModel(ctx);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:RhinoScriptTest.java


示例12: setUp

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
@Before
public void setUp()
{
    appCtx = ApplicationContextHelper.getApplicationContext();
    // The user that will create locks, this should be different from the user that queries them (ALF-19465)
    lockOwner = "jbloggs";
    // The 'current' user.
    userName = AuthenticationUtil.getAdminUserName();
    AuthenticationUtil.setFullyAuthenticatedUser(userName);
    transactionService = (TransactionService) appCtx.getBean("TransactionService");
    nodeService = (NodeService) appCtx.getBean("NodeService");
    rawNodeService = (NodeService) appCtx.getBean("dbNodeService");
    lockStore = (LockStore) appCtx.getBean("lockStore");
    rootNode = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
    interceptor = (LockableAspectInterceptor) appCtx.getBean("lockableAspectInterceptor");
    lockService = (LockService)appCtx.getBean("lockService");
    fileFolderService = (FileFolderService) appCtx.getBean("FileFolderService");
    actionService = (ActionService) appCtx.getBean("ActionService");
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:LockableAspectInterceptorTest.java


示例13: setUp

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
@Override
public void setUp() throws Exception
{
    ctx = ApplicationContextHelper.getApplicationContext();
    ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
    transactionService = serviceRegistry.getTransactionService();
    txnHelper = transactionService.getRetryingTransactionHelper();
    
    jobLockService = (JobLockService) ctx.getBean("jobLockService");
    
    // Get the test name
    String testName = getName();
    // Build lock names for the test
    lockA = QName.createQName(NAMESPACE, "a-" + testName);
    lockAA = QName.createQName(NAMESPACE, "a-" + testName + ".a-" + testName);
    lockAAA = QName.createQName(NAMESPACE, "a-" + testName + ".a-" + testName + ".a-" + testName);
    lockAAB = QName.createQName(NAMESPACE, "a-" + testName + ".a-" + testName + ".b-" + testName);
    lockAAC = QName.createQName(NAMESPACE, "a-" + testName + ".a-" + testName + ".c-" + testName);
    lockAB = QName.createQName(NAMESPACE, "a-" + testName + ".b-" + testName);
    lockABA = QName.createQName(NAMESPACE, "a-" + testName + ".b-" + testName + ".a-" + testName);
    lockABB = QName.createQName(NAMESPACE, "a-" + testName + ".b-" + testName + ".b-" + testName);
    lockABC = QName.createQName(NAMESPACE, "a-" + testName + ".b-" + testName + ".c-" + testName);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:JobLockServiceTest.java


示例14: main

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
/**
 * @see #testPerformance()
 */
public static void main(String ... args)
{
    try
    {
        CacheTest test = new CacheTest();
        test.setUp();
        System.out.println("Press any key to run initialization test ...");
        System.in.read();
        test.testInitializationPerformance();
        System.out.println("Press any key to run performance test ...");
        System.in.read();
        test.testPerformance();
        System.out.println("Press any key to shutdown ...");
        System.in.read();
        test.tearDown();
    }
    catch (Throwable e)
    {
        e.printStackTrace();
    }
    finally
    {
        ApplicationContextHelper.closeApplicationContext();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:29,代码来源:CacheTest.java


示例15: setUp

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
public void setUp()
{
    ctx = ApplicationContextHelper.getApplicationContext();
    serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);

    nodeService = serviceRegistry.getNodeService();
    searchService = serviceRegistry.getSearchService();
    dictionaryService = serviceRegistry.getDictionaryService();
    contentService = serviceRegistry.getContentService();
    authenticationService = (MutableAuthenticationService) ctx.getBean("authenticationService");
    authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
    permissionService = serviceRegistry.getPermissionService();
    mimetypeService = serviceRegistry.getMimetypeService();
    namespaceService = serviceRegistry.getNamespaceService();
    transactionService = serviceRegistry.getTransactionService();

    authenticationComponent.setSystemUserAsCurrentUser();
    StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
    rootNodeRef = nodeService.getRootNode(storeRef);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:FileImporterTest.java


示例16: setUp

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
@Override
public void setUp() throws Exception
{
    ctx = ApplicationContextHelper.getApplicationContext();
    ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry");
    nodeService = serviceRegistry.getNodeService();
    fileFolderService = serviceRegistry.getFileFolderService();
    nodeArchiveService = (NodeArchiveService) ctx.getBean("nodeArchiveService");
    authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
    transactionService = serviceRegistry.getTransactionService();
    
    try
    {
        authenticationComponent.setSystemUserAsCurrentUser();
        
        // create a test store
        StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
        rootNodeRef = nodeService.getRootNode(storeRef);
    }
    finally
    {
        authenticationComponent.clearCurrentSecurityContext();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:LargeArchiveAndRestoreTest.java


示例17: setUp

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
@Before
@Override
public void setUp() throws Exception
{
    applicationContext = ApplicationContextHelper.getApplicationContext();
    this.registry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);

    initializeScheduler();

    AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();

    transaction = registry.getTransactionService().getUserTransaction(false);
    transaction.begin();

    createTestContent();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:CronScheduledQueryBasedTemplateActionDefinitionTest.java


示例18: setUp

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
@Override
public void setUp() throws Exception
{
    ctx = ApplicationContextHelper.getApplicationContext();
    ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
    txnHelper = serviceRegistry.getTransactionService().getRetryingTransactionHelper();
    fileFolderService = serviceRegistry.getFileFolderService();
    repository = (Repository) ctx.getBean("repositoryHelper");
    fixedAclUpdater = (FixedAclUpdater) ctx.getBean("fixedAclUpdater");
    permissionsDaoComponent = (PermissionsDaoComponent) ctx.getBean("admPermissionsDaoComponent");
    permissionService = (PermissionService) ctx.getBean("permissionService");
    nodeDAO = (NodeDAO) ctx.getBean("nodeDAO");

    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());

    NodeRef home = repository.getCompanyHome();
    // create a folder hierarchy for which will change permission inheritance
    int[] filesPerLevel = { 5, 5, 10 };
    RetryingTransactionCallback<NodeRef> cb = createFolderHierchyCallback(home, fileFolderService, "ROOT", filesPerLevel);
    folderNodeRef = txnHelper.doInTransaction(cb);

    // change setFixedAclMaxTransactionTime to lower value so setInheritParentPermissions on created folder hierarchy require async call
    setFixedAclMaxTransactionTime(permissionsDaoComponent, home, 50);

}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:FixedAclUpdaterTest.java


示例19: main

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
/**
 * Create a folder hierarchy and start FixedAclUpdater. See {@link #getUsage()} for usage parameters 
 */
public static void main(String... args)
{
    ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) ApplicationContextHelper.getApplicationContext();
    try
    {
        run(ctx, args);
    }
    catch (Exception e)
    {
        System.out.println("Failed to run FixedAclUpdaterTest  test");
        e.printStackTrace();
    }
    finally
    {
        ctx.close();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:FixedAclUpdaterTest.java


示例20: main

import org.alfresco.util.ApplicationContextHelper; //导入依赖的package包/类
public static void main(String[] args)
{
    try
    {
        AuditDAOTest test = new AuditDAOTest();
        test.setUp();
        System.out.println("Press any key to run performance test.");
        System.in.read();
        test.scriptCanDeleteOrphanedPropsPerformance();
        System.out.println("Press any key to shutdown.");
        System.in.read();
        test.tearDown();
    }
    catch (Throwable e)
    {
        e.printStackTrace();
    }
    finally
    {
        ApplicationContextHelper.closeApplicationContext();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:AuditDAOTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AppsInfo类代码示例发布时间:2022-05-23
下一篇:
Java TopicViewMBean类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap