Search in sources :

Example 1 with RoleManager

use of org.jaffa.loader.policy.RoleManager in project jaffa-framework by jaffa-projects.

the class CheckPolicyTest method setup.

/**
 * setting the up objects/properties before a Test is run
 * @throws Exception
 */
@Before
public void setup() {
    // initialize
    BusinessFunctionManager businessFunctionManager = xmlLoaderConfig.getBean(BusinessFunctionManager.class);
    checkPolicy = new CheckPolicy();
    checkPolicy.setBusinessFunctionManager(businessFunctionManager);
    RoleManager roleManager = xmlLoaderConfig.getBean(RoleManager.class);
    policyCache.setRoleManager(roleManager);
}
Also used : BusinessFunctionManager(org.jaffa.loader.policy.BusinessFunctionManager) RoleManager(org.jaffa.loader.policy.RoleManager) Before(org.junit.Before)

Example 2 with RoleManager

use of org.jaffa.loader.policy.RoleManager in project jaffa-framework by jaffa-projects.

the class CoreLoaderConfig method roleManager.

/**
 * @return Returns a RoleManager
 */
@Bean
public RoleManager roleManager() {
    RoleManager roleManager = new RoleManager();
    PolicyCache.setRoleManager(roleManager);
    return roleManager;
}
Also used : RoleManager(org.jaffa.loader.policy.RoleManager) Bean(org.springframework.context.annotation.Bean)

Example 3 with RoleManager

use of org.jaffa.loader.policy.RoleManager in project jaffa-framework by jaffa-projects.

the class ConfigApiHelper method registerResources.

/**
 * Register configuration files in IManager implementationss, based on the source of the method call
 * @param file  The configuration file to be registered or unregistered
 * @return  Success or failure of the operation
 */
public static boolean registerResources(File file, FileContentsHelper fileContents) {
    boolean isSuccess = true;
    ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    for (IManager manager : ManagerRepositoryService.getInstance().getManagerMap().values()) {
        Resource resource = getMetaInfResource(file, resolver, manager);
        try {
            if (resource.getFile().exists()) {
                if (manager instanceof RoleManager) {
                    PolicyManager.clearCache();
                }
                manager.registerResource(resource, fileContents.getContextSalience(), fileContents.getVariationSalience());
                ManagerRepositoryService.getInstance().add(manager.getClass().getSimpleName(), manager);
                log.debug(resource.getFilename() + " was successfully registered to " + manager);
            }
        } catch (Exception e) {
            isSuccess = false;
            log.error("The resource " + resource.getFilename() + " failed to register", e);
        }
    }
    return isSuccess;
}
Also used : PathMatchingResourcePatternResolver(org.springframework.core.io.support.PathMatchingResourcePatternResolver) ResourcePatternResolver(org.springframework.core.io.support.ResourcePatternResolver) IManager(org.jaffa.loader.IManager) RoleManager(org.jaffa.loader.policy.RoleManager) Resource(org.springframework.core.io.Resource) PathMatchingResourcePatternResolver(org.springframework.core.io.support.PathMatchingResourcePatternResolver)

Example 4 with RoleManager

use of org.jaffa.loader.policy.RoleManager in project jaffa-framework by jaffa-projects.

the class RepositoryJsonServiceTest method setUp.

/**
 * This setup function registers resources to each managed repository to produce correct retrieval results
 * @throws Exception
 */
@Before
public void setUp() throws Exception {
    managerRepositoryService = ManagerRepositoryService.getInstance();
    repositoryJsonService = new RepositoryJsonService();
    testKey = new ContextKey("testKey", "file1.xml", "NULL", "1-PRODUCT");
    testManager = new SchedulerManager();
    testTask = new Task();
    // Must populate a repository element in order to retrieve data
    testTask.setAutoCreateDataBean(true);
    testTask.setDataBean("DataBeanTest");
    testTask.setType("TestType");
    testManager.registerSchedulerTask(testKey, testTask);
    // Add managers to ManagerRepositoryService
    managerRepositoryService.add("Task", testManager);
    managerRepositoryService.add("ComponentManager", new ComponentManager());
    managerRepositoryService.add("ApplicationRulesManager", new ApplicationRulesManager());
    managerRepositoryService.add("NavigationManager", new NavigationManager());
    managerRepositoryService.add("BusinessFunctionManager", new BusinessFunctionManager());
    managerRepositoryService.add("RoleManager", new RoleManager());
    managerRepositoryService.add("JndiJmsManager", new JndiJmsManager());
    managerRepositoryService.add("MessagingManager", new MessagingManager());
    managerRepositoryService.add("SoaEventManager", new SoaEventManager());
    managerRepositoryService.add("TransactionManager", new TransactionManager());
}
Also used : NavigationManager(org.jaffa.loader.navigation.NavigationManager) Task(org.jaffa.modules.scheduler.services.configdomain.Task) RoleManager(org.jaffa.loader.policy.RoleManager) JndiJmsManager(org.jaffa.loader.messaging.JndiJmsManager) MessagingManager(org.jaffa.loader.messaging.MessagingManager) SchedulerManager(org.jaffa.loader.scheduler.SchedulerManager) BusinessFunctionManager(org.jaffa.loader.policy.BusinessFunctionManager) ApplicationRulesManager(org.jaffa.loader.config.ApplicationRulesManager) SoaEventManager(org.jaffa.loader.soa.SoaEventManager) ContextKey(org.jaffa.loader.ContextKey) TransactionManager(org.jaffa.loader.transaction.TransactionManager) ComponentManager(org.jaffa.loader.components.ComponentManager) Before(org.junit.Before)

Aggregations

RoleManager (org.jaffa.loader.policy.RoleManager)4 BusinessFunctionManager (org.jaffa.loader.policy.BusinessFunctionManager)2 Before (org.junit.Before)2 ContextKey (org.jaffa.loader.ContextKey)1 IManager (org.jaffa.loader.IManager)1 ComponentManager (org.jaffa.loader.components.ComponentManager)1 ApplicationRulesManager (org.jaffa.loader.config.ApplicationRulesManager)1 JndiJmsManager (org.jaffa.loader.messaging.JndiJmsManager)1 MessagingManager (org.jaffa.loader.messaging.MessagingManager)1 NavigationManager (org.jaffa.loader.navigation.NavigationManager)1 SchedulerManager (org.jaffa.loader.scheduler.SchedulerManager)1 SoaEventManager (org.jaffa.loader.soa.SoaEventManager)1 TransactionManager (org.jaffa.loader.transaction.TransactionManager)1 Task (org.jaffa.modules.scheduler.services.configdomain.Task)1 Bean (org.springframework.context.annotation.Bean)1 Resource (org.springframework.core.io.Resource)1 PathMatchingResourcePatternResolver (org.springframework.core.io.support.PathMatchingResourcePatternResolver)1 ResourcePatternResolver (org.springframework.core.io.support.ResourcePatternResolver)1