Package org.castor.core.util

Examples of org.castor.core.util.AbstractProperties


     * have not been overwritten by the user.
     *
     * @return Properties instance for Castor CPA modul.
     */
    public static AbstractProperties newInstance() {
        AbstractProperties core = new CoreProperties();
        AbstractProperties cpa = new CPAProperties(core);
        AbstractProperties xml = new XMLProperties(cpa);
        AbstractProperties castor = new CastorProperties(xml);
        return castor;
    }
View Full Code Here


     * @param app Classloader to be used for all classes of Castor and its required libraries.
     * @param domain Classloader to be used for all domain objects.
     * @return Properties instance for Castor CPA modul.
     */
    public static AbstractProperties newInstance(final ClassLoader app, final ClassLoader domain) {
        AbstractProperties core = new CoreProperties(app, domain);
        AbstractProperties cpa = new CPAProperties(core);
        AbstractProperties xml = new XMLProperties(cpa);
        AbstractProperties castor = new CastorProperties(xml);
        return castor;
    }
View Full Code Here

   
    /**
     * Get a JDO database
     */
    public void setUp() throws PersistenceException, SQLException {
        AbstractProperties properties = CPAProperties.getInstance();
        _oldProperty = properties.getObject(CPAProperties.TX_SYNCHRONIZABLE);
        properties.put(CPAProperties.TX_SYNCHRONIZABLE, SynchronizableImpl.class.getName());

        _db = _category.getDatabase();
    }
View Full Code Here

    public void tearDown() throws PersistenceException {
        _synchronizables.clear();
        _db.close();
       
        AbstractProperties properties = CPAProperties.getInstance();
        if (_oldProperty != null) {
            properties.put(CPAProperties.TX_SYNCHRONIZABLE, _oldProperty);
        } else {
            properties.remove(CPAProperties.TX_SYNCHRONIZABLE);
        }
    }
View Full Code Here

    /**
     * Load the key generators from the properties file, if not loaded before.
     */
    private static synchronized void load() {
        if (_factories.isEmpty()) {
            AbstractProperties properties = CPAProperties.getInstance();
            Object[] objects = properties.getObjectArray(
                    CPAProperties.KEYGENERATOR_FACTORIES,
                    properties.getApplicationClassLoader());
            for (int i = 0; i < objects.length; i++) {
                KeyGeneratorFactory factory = (KeyGeneratorFactory) objects[i];
                _factories.put(factory.getName(), factory);
            }
        }
View Full Code Here

                    //-- do nothing
                }
            }
        }

        AbstractProperties rtconf =  XMLProperties.newInstance();

        // Parse XML namespace and package list from both castor.properties and
        // castorbuilder.properties
        processNamespacePackageMappings(rtconf.getString(Property.NAMESPACE_PACKAGES_OLD, ""));
        processNamespacePackageMappings(rtconf.getString(Property.NAMESPACE_PACKAGES, ""));
        processNamespacePackageMappings(_defaultProps.getProperty(
                Property.NAMESPACE_PACKAGES_OLD, ""));
        processNamespacePackageMappings(_defaultProps.getProperty(
                Property.NAMESPACE_PACKAGES, ""));
View Full Code Here

    public String getFactoryName() {
        return "sql-server";
    }

    public QueryExpression getQueryExpression() {
        AbstractProperties properties = CPAProperties.getInstance();
        boolean useNewSyntaxForSQLServer = properties.getBoolean(
                CPAProperties.MSSQL_ANSI_COMPLIANT, false);
       
        if (useNewSyntaxForSQLServer) {
            return new JDBCQueryExpression(this);
        }
View Full Code Here

        Logger logger = Logger.getLogger(CacheFactoryRegistry.class);
        Level level = logger.getLevel();

        assertEquals("org.castor.cache.Factories", CPAProperties.CACHE_FACTORIES);
       
        AbstractProperties properties = CPAProperties.newInstance();
        String memF = properties.getString(CPAProperties.CACHE_FACTORIES);
       
        properties.remove(CPAProperties.CACHE_FACTORIES);
        new CacheFactoryRegistry(properties);
       
        properties.put(CPAProperties.CACHE_FACTORIES, "");
        new CacheFactoryRegistry(properties);
       
        properties.put(CPAProperties.CACHE_FACTORIES, UnlimitedFactory.class.getName());
        new CacheFactoryRegistry(properties);
       
        if (DISABLE_LOGGING) { logger.setLevel(Level.FATAL); }

        properties.put(CPAProperties.CACHE_FACTORIES, "org.castor.cache.simple.UnknownFactory");
        try {
            new CacheFactoryRegistry(properties);
            fail("Should have failed to create unknown class.");
        } catch (PropertiesException ex) {
            assertTrue(true);
        }
       
        logger.setLevel(level);

        properties.put(CPAProperties.CACHE_FACTORIES, memF);
    }
View Full Code Here

        properties.put(CPAProperties.CACHE_FACTORIES, memF);
    }

    public void testGetCacheNames() {
        AbstractProperties properties = CPAProperties.newInstance();
        Collection col = new CacheFactoryRegistry(properties).getCacheNames();
        assertEquals(13, col.size());
        assertTrue(col.contains(CountLimited.TYPE));
        assertTrue(col.contains(NoCache.TYPE));
        assertTrue(col.contains(TimeLimited.TYPE));
View Full Code Here

        assertTrue(col.contains(EHCache.TYPE));
        assertTrue(col.contains(GigaspacesCache.TYPE));
    }

    public void testGetCacheFactories() {
        AbstractProperties properties = CPAProperties.newInstance();
        Collection col = new CacheFactoryRegistry(properties).getCacheFactories();
        assertEquals(13, col.size());
        assertTrue(containsInstanceOf(col, CountLimitedFactory.class));
        assertTrue(containsInstanceOf(col, NoCacheFactory.class));
        assertTrue(containsInstanceOf(col, TimeLimitedFactory.class));
View Full Code Here

TOP

Related Classes of org.castor.core.util.AbstractProperties

Copyright © 2018 www.massapicom. 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.