Examples of CdoUnitBuilder


Examples of com.buschmais.cdo.api.bootstrap.CdoUnitBuilder

        if (providerName == null) {
            throw new ConfigurationException(CdoUnitParameter.PROVIDER.getKey(), "Property missing");
        }
        Class<? extends CdoDatastoreProvider> provider = ClassHelper.getType(providerName);

        CdoUnitBuilder builder;
        try {
            builder = CdoUnitBuilder.create(url, provider, types.toArray(new Class[] {}));
        } catch (URISyntaxException e) {
            throw new ConfigurationException(CdoUnitParameter.URL.getKey(), "Could not convert '" + url + "' to url", e);
        }

        // optional: name
        String name = (String) properties.get(CdoUnitParameter.NAME.getKey());
        builder.name(name);

        // optional: description
        String description = (String) properties.get(CdoUnitParameter.DESCRIPTION.getKey());
        builder.description(description);

        // optional: listeners
        Collection<String> listenerNames = (Collection<String>) properties.get(CdoUnitParameter.INSTANCE_LISTENERS.getKey());
        if (listenerNames != null) {
            Collection<Class<?>> instanceListeners = ClassHelper.getTypes(listenerNames);
            builder.instanceListenerTypes(instanceListeners.toArray(new Class[] {}));
        }

        // optional: concurrency
        String concurrencyMode = (String) properties.get(CdoUnitParameter.CONCURRENCY_MODE.getKey());
        builder.concurrencyMode(concurrencyMode);

        // optional: validation
        String validationMode = (String) properties.get(CdoUnitParameter.VALIDATION_MODE.getKey());
        builder.validationMode(validationMode);

        // optional: transaction
        String transactionMode = (String) properties.get(CdoUnitParameter.TRANSACTION_ATTRIBUTE.getKey());
        builder.transactionAttribute(transactionMode);

        return builder.create();
    }
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.