Examples of MutableConfiguration


Examples of com.anthonyeden.lib.config.MutableConfiguration

  public void exportGroups(BGContext context, File fExportFile) {
    if (context == null) return; // nothing to do... says Florian.
    Dom4jConfiguration root = new Dom4jConfiguration(EXPORT_KEY_ROOT);

    // export areas
    MutableConfiguration confAreas = root.addChild(EXPORT_KEY_AREA_COLLECTION);
    BGAreaManager am = BGAreaManagerImpl.getInstance();
    List areas = am.findBGAreasOfBGContext(context);
    for (Iterator iter = areas.iterator(); iter.hasNext();) {
      BGArea area = (BGArea) iter.next();
      MutableConfiguration newArea = confAreas.addChild(EXPORT_KEY_AREA);
      newArea.addAttribute(EXPORT_ATTR_NAME, area.getName());
      newArea.addChild(EXPORT_KEY_DESCRIPTION, area.getDescription());
    }

    // TODO fg: export group rights

    // export groups
    MutableConfiguration confGroups = root.addChild(EXPORT_KEY_GROUP_COLLECTION);
    BGContextManager cm = BGContextManagerImpl.getInstance();
    List groups = cm.getGroupsOfBGContext(context);
    for (Iterator iter = groups.iterator(); iter.hasNext();) {
      BusinessGroup group = (BusinessGroup) iter.next();
      exportGroup(fExportFile, confGroups, group);
View Full Code Here

Examples of com.anthonyeden.lib.config.MutableConfiguration

    saveGroupConfiguration(fExportFile, root);
  }

  public void exportGroup(BusinessGroup group, File fExportFile) {
    Dom4jConfiguration root = new Dom4jConfiguration(EXPORT_KEY_ROOT);
    MutableConfiguration confGroups = root.addChild(EXPORT_KEY_GROUP_COLLECTION);
    exportGroup(fExportFile, confGroups, group);
    saveGroupConfiguration(fExportFile, root);
  }
View Full Code Here

Examples of com.anthonyeden.lib.config.MutableConfiguration

    exportGroup(fExportFile, confGroups, group);
    saveGroupConfiguration(fExportFile, root);
  }

  private void exportGroup(File fExportFile, MutableConfiguration confGroups, BusinessGroup group) {
    MutableConfiguration newGroup = confGroups.addChild(EXPORT_KEY_GROUP);
    newGroup.addAttribute(EXPORT_ATTR_NAME, group.getName());
    if (group.getMinParticipants() != null) newGroup.addAttribute(EXPORT_ATTR_MIN_PARTICIPATS, group.getMinParticipants());
    if (group.getMaxParticipants() != null) newGroup.addAttribute(EXPORT_ATTR_MAX_PARTICIPATS, group.getMaxParticipants());     
    if (group.getWaitingListEnabled() != null) newGroup.addAttribute(EXPORT_ATTR_WAITING_LIST, group.getWaitingListEnabled());
    if (group.getAutoCloseRanksEnabled() != null) newGroup.addAttribute(EXPORT_ATTR_AUTO_CLOSE_RANKS, group.getAutoCloseRanksEnabled());
    newGroup.addChild(EXPORT_KEY_DESCRIPTION, group.getDescription());
    // collab tools
    MutableConfiguration toolsConfig = newGroup.addChild(EXPORT_KEY_COLLABTOOLS);
    CollaborationTools ct = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(group);
    for (int i = 0; i < CollaborationTools.TOOLS.length; i++) {
      toolsConfig.addAttribute(CollaborationTools.TOOLS[i], ct.isToolEnabled(CollaborationTools.TOOLS[i]) ? "true" : "false");
    }
    Long calendarAccess = ct.lookupCalendarAccess();
    if (calendarAccess != null) {
      newGroup.addAttribute(EXPORT_KEY_CALENDAR_ACCESS,calendarAccess);     
    }
    String info = ct.lookupNews();
    if(info!=null && !info.trim().equals("")) {
      newGroup.addAttribute(EXPORT_KEY_NEWS,info.trim());     
    }   
   
    Tracing.logDebug("fExportFile.getParent()=" + fExportFile.getParent(), this.getClass());
    ct.archive(fExportFile.getParent());
    // export membership
    List bgAreas = BGAreaManagerImpl.getInstance().findBGAreasOfBusinessGroup(group);
    for (Iterator iterator = bgAreas.iterator(); iterator.hasNext();) {
      BGArea areaRelation = (BGArea) iterator.next();
      MutableConfiguration newGroupAreaRel = newGroup.addChild(EXPORT_KEY_AREA_RELATION);
      newGroupAreaRel.setValue(areaRelation.getName());
    }
    //export properties
    BusinessGroupPropertyManager bgPropertyManager = new BusinessGroupPropertyManager(group);
    boolean showOwners = bgPropertyManager.showOwners();
    boolean showParticipants = bgPropertyManager.showPartips();
View Full Code Here

Examples of javax.cache.configuration.MutableConfiguration

    @Test
    public void testCaches_NotEmpty() {
        CacheManager cacheManager = cachingProvider1.getCacheManager();

        ArrayList<String> caches1 = new ArrayList<String>();
        cacheManager.createCache("c1", new MutableConfiguration());
        cacheManager.createCache("c2", new MutableConfiguration());
        cacheManager.createCache("c3", new MutableConfiguration());
        caches1.add(cacheManager.getCache("c1").getName());
        caches1.add(cacheManager.getCache("c2").getName());
        caches1.add(cacheManager.getCache("c3").getName());

        Iterable<String> cacheNames = cacheManager.getCacheNames();
View Full Code Here

Examples of javax.cache.configuration.MutableConfiguration

    @Test
    public void testCachesDestroy() {
        CacheManager cacheManager = cachingProvider1.getCacheManager();
        CacheManager cacheManager2 = cachingProvider2.getCacheManager();
        MutableConfiguration configuration = new MutableConfiguration();
        final Cache c1 = cacheManager.createCache("c1", configuration);
        final Cache c2 = cacheManager2.getCache("c1");
        c1.put("key", "value");
        cacheManager.destroyCache("c1");
        assertTrueEventually(new AssertTask() {
View Full Code Here

Examples of javax.cache.configuration.MutableConfiguration

    @Test
    public void testCachesDestroyFromOtherManagers() {
        CacheManager cacheManager = cachingProvider1.getCacheManager();
        CacheManager cacheManager2 = cachingProvider2.getCacheManager();
        MutableConfiguration configuration = new MutableConfiguration();
        final Cache c1 = cacheManager.createCache("c1", configuration);
        final Cache c2 = cacheManager2.createCache("c2", configuration);
        c1.put("key", "value");
        c2.put("key", "value");
        cacheManager.close();
View Full Code Here

Examples of javax.cache.configuration.MutableConfiguration

    CachingProvider cachingProvider = Caching.getCachingProvider();
    CacheManager cacheManager = cachingProvider.getCacheManager();

    //configure the cache
    String cacheName = "sampleCache";
    MutableConfiguration config = new MutableConfiguration();
    config.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(ONE_HOUR))
    .setStatisticsEnabled(true);

    //create the cache
    cacheManager.createCache(cacheName, config);
View Full Code Here

Examples of org.apache.avalon.framework.configuration.MutableConfiguration

        }
    }
   
    public void testMutable() throws Exception  
    {  
        MutableConfiguration root = new DefaultConfiguration( "root", "-" );  
        root.setAttribute( "root1", "root1" );  
        root.setAttribute( "root2", "root2" );  
        root.getMutableChild( "child1" ).setAttribute( "child1-attr1", "child1-attr1" );  
        root.getMutableChild( "child1" ).setAttribute( "child1-attr2", "child1-attr2" );  
        root.getMutableChild( "child2" ).setAttribute( "child2-attr1", "child2-attr1" );  
        root.getMutableChild( "child2" ).setAttribute( "child2-attr2", "child2-attr2" );  
       
        assertEquals( "root1", root.getAttribute( "root1" ) );  
        assertEquals( "root2", root.getAttribute( "root2" ) );  
        assertEquals( "child1-attr1", root.getChild( "child1" ).getAttribute( "child1-attr1" ) );  
        assertEquals( "child1-attr2", root.getChild( "child1" ).getAttribute( "child1-attr2" ) );  
        assertEquals( "child2-attr1", root.getChild( "child2" ).getAttribute( "child2-attr1" ) );  
        assertEquals( "child2-attr2", root.getChild( "child2" ).getAttribute( "child2-attr2" ) );  
       
        assertEquals( null, root.getMutableChild( "child3", false ) );  
       
        assertEquals( 2, root.getChildren().length );  
       
        assertEquals( 2, root.getMutableChildren().length );  
        assertEquals( 1, root.getMutableChildren( "child1" ).length );  
        assertEquals( 1, root.getMutableChildren( "child2" ).length );  
        assertTrue( root.getMutableChildren( "child1" )[0] == root.getChild( "child1" ) );  
       
        // Add an immutable child.  
        DefaultConfiguration immutableChild = new DefaultConfiguration( "immutable-child", "-" );  
        immutableChild.makeReadOnly();  
       
        try  
        {  
            immutableChild.setAttribute( "attr", "attr" );  
            fail( "Read-only DefaultConfiguration wasn't read-only!" );  
        }  
        catch (IllegalStateException ise)  
        {  
            // expected  
        }  
       
        root.addChild( immutableChild );  
       
        // OK, ask to have it back.  
        root.getMutableChild( "immutable-child" ).setAttribute( "attr", "attr" );  
       
        assertEquals( 1, root.getChildren( "immutable-child" ).length );  
        assertEquals( "attr", root.getChild( "immutable-child" ).getAttribute( "attr" ) );  
    }    
View Full Code Here

Examples of org.apache.avalon.framework.configuration.MutableConfiguration

        }
    }
   
    public void testMutable() throws Exception  
    {  
        MutableConfiguration root = new DefaultConfiguration( "root", "-" );  
        root.setAttribute( "root1", "root1" );  
        root.setAttribute( "root2", "root2" );  
        root.getMutableChild( "child1" ).setAttribute( "child1-attr1", "child1-attr1" );  
        root.getMutableChild( "child1" ).setAttribute( "child1-attr2", "child1-attr2" );  
        root.getMutableChild( "child2" ).setAttribute( "child2-attr1", "child2-attr1" );  
        root.getMutableChild( "child2" ).setAttribute( "child2-attr2", "child2-attr2" );  
       
        assertEquals( "root1", root.getAttribute( "root1" ) );  
        assertEquals( "root2", root.getAttribute( "root2" ) );  
        assertEquals( "child1-attr1", root.getChild( "child1" ).getAttribute( "child1-attr1" ) );  
        assertEquals( "child1-attr2", root.getChild( "child1" ).getAttribute( "child1-attr2" ) );  
        assertEquals( "child2-attr1", root.getChild( "child2" ).getAttribute( "child2-attr1" ) );  
        assertEquals( "child2-attr2", root.getChild( "child2" ).getAttribute( "child2-attr2" ) );  
       
        assertEquals( null, root.getMutableChild( "child3", false ) );  
       
        assertEquals( 2, root.getChildren().length );  
       
        assertEquals( 2, root.getMutableChildren().length );  
        assertEquals( 1, root.getMutableChildren( "child1" ).length );  
        assertEquals( 1, root.getMutableChildren( "child2" ).length );  
        assertTrue( root.getMutableChildren( "child1" )[0] == root.getChild( "child1" ) );  
       
        // Add an immutable child.  
        DefaultConfiguration immutableChild = new DefaultConfiguration( "immutable-child", "-" );  
        immutableChild.makeReadOnly();  
       
        try  
        {  
            immutableChild.setAttribute( "attr", "attr" );  
            fail( "Read-only DefaultConfiguration wasn't read-only!" );  
        }  
        catch (IllegalStateException ise)  
        {  
            // expected  
        }  
       
        root.addChild( immutableChild );  
       
        // OK, ask to have it back.  
        root.getMutableChild( "immutable-child" ).setAttribute( "attr", "attr" );  
       
        assertEquals( 1, root.getChildren( "immutable-child" ).length );  
        assertEquals( "attr", root.getChild( "immutable-child" ).getAttribute( "attr" ) );  
    }    
View Full Code Here

Examples of org.apache.avalon.framework.configuration.MutableConfiguration

        }
    }
   
    public void testMutable() throws Exception  
    {  
        MutableConfiguration root = new DefaultConfiguration( "root", "-" );  
        root.setAttribute( "root1", "root1" );  
        root.setAttribute( "root2", "root2" );  
        root.getMutableChild( "child1" ).setAttribute( "child1-attr1", "child1-attr1" );  
        root.getMutableChild( "child1" ).setAttribute( "child1-attr2", "child1-attr2" );  
        root.getMutableChild( "child2" ).setAttribute( "child2-attr1", "child2-attr1" );  
        root.getMutableChild( "child2" ).setAttribute( "child2-attr2", "child2-attr2" );  
       
        assertEquals( "root1", root.getAttribute( "root1" ) );  
        assertEquals( "root2", root.getAttribute( "root2" ) );  
        assertEquals( "child1-attr1", root.getChild( "child1" ).getAttribute( "child1-attr1" ) );  
        assertEquals( "child1-attr2", root.getChild( "child1" ).getAttribute( "child1-attr2" ) );  
        assertEquals( "child2-attr1", root.getChild( "child2" ).getAttribute( "child2-attr1" ) );  
        assertEquals( "child2-attr2", root.getChild( "child2" ).getAttribute( "child2-attr2" ) );  
       
        assertEquals( null, root.getMutableChild( "child3", false ) );  
       
        assertEquals( 2, root.getChildren().length );  
       
        assertEquals( 2, root.getMutableChildren().length );  
        assertEquals( 1, root.getMutableChildren( "child1" ).length );  
        assertEquals( 1, root.getMutableChildren( "child2" ).length );  
        assertTrue( root.getMutableChildren( "child1" )[0] == root.getChild( "child1" ) );  
       
        // Add an immutable child.  
        DefaultConfiguration immutableChild = new DefaultConfiguration( "immutable-child", "-" );  
        immutableChild.makeReadOnly();  
       
        try  
        {  
            immutableChild.setAttribute( "attr", "attr" );  
            fail( "Read-only DefaultConfiguration wasn't read-only!" );  
        }  
        catch (IllegalStateException ise)  
        {  
            // expected  
        }  
       
        root.addChild( immutableChild );  
       
        // OK, ask to have it back.  
        root.getMutableChild( "immutable-child" ).setAttribute( "attr", "attr" );  
       
        assertEquals( 1, root.getChildren( "immutable-child" ).length );  
        assertEquals( "attr", root.getChild( "immutable-child" ).getAttribute( "attr" ) );  
    }    
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.