Examples of XOUnit


Examples of com.buschmais.xo.api.bootstrap.XOUnit

     * @return The collection of {@link com.buschmais.xo.api.bootstrap.XOUnit}s.
     */
    protected static Collection<Object[]> xoUnits(List<? extends Database> databases, List<? extends Class<?>> types, List<? extends Class<?>> instanceListenerTypes, ValidationMode validationMode, ConcurrencyMode concurrencyMode, Transaction.TransactionAttribute transactionAttribute) {
        List<Object[]> xoUnits = new ArrayList<>(databases.size());
        for (Database database : databases) {
            XOUnit unit = xoUnit(database, types, instanceListenerTypes, validationMode, concurrencyMode, transactionAttribute);
            xoUnits.add(new Object[]{unit});
        }
        return xoUnits;
    }
View Full Code Here

Examples of com.buschmais.xo.api.bootstrap.XOUnit

     * @param concurrencyMode       The concurrency mode to use.
     * @param transactionAttribute  The transaction attribute to use.
     * @return The {@link com.buschmais.xo.api.bootstrap.XOUnit}.
     */
    protected static XOUnit xoUnit(Database database, List<? extends Class<?>> types, List<? extends Class<?>> instanceListenerTypes, ValidationMode validationMode, ConcurrencyMode concurrencyMode, Transaction.TransactionAttribute transactionAttribute) {
        return new XOUnit("default", "Default XO unit", database.getUri(), database.getProvider(), new HashSet<>(types), instanceListenerTypes, validationMode, concurrencyMode, transactionAttribute, new Properties());
    }
View Full Code Here

Examples of com.buschmais.xo.api.bootstrap.XOUnit

        this.xoUnits = readXODescriptors();
    }

    @Override
    public XOManagerFactory createXOManagerFactory(String name) {
        XOUnit xoUnit = xoUnits.get(name);
        if (xoUnit == null) {
            throw new XOException("XO unit with name '" + name + "' does not exist.");
        }
        return createXOManagerFactory(xoUnit);
    }
View Full Code Here

Examples of com.buschmais.xo.api.bootstrap.XOUnit

        try {
            Enumeration<URL> resources = classLoader.getResources(XO_DESCRIPTOR_RESOURCE);
            while (resources.hasMoreElements()) {
                URL url = resources.nextElement();
                for (XOUnit xoUnit : xoUnitFactory.getXOUnits(url)) {
                    XOUnit existingXOUnit = result.put(xoUnit.getName(), xoUnit);
                    if (existingXOUnit != null) {
                        throw new XOException("Found more than one XO unit with name '" + xoUnit.getName() + "'.");
                    }
                }
            }
View Full Code Here

Examples of com.buschmais.xo.api.bootstrap.XOUnit

            if (propertiesType != null) {
                for (PropertyType propertyType : propertiesType.getProperty()) {
                    properties.setProperty(propertyType.getName(), propertyType.getValue());
                }
            }
            XOUnit xoUnit = new XOUnit(name, description, uri, provider, types, instanceListeners, validationMode, concurrencyMode, defaultTransactionAttribute, properties);
            xoUnits.add(xoUnit);
        }
        return xoUnits;
    }
View Full Code Here

Examples of com.buschmais.xo.api.bootstrap.XOUnit

        return this.componentName;
    }

    @Override
    public void updated(String pid, Dictionary<String, ?> properties) throws ConfigurationException {
        XOUnit xoUnit;
        try {
            xoUnit = getXOUnit(properties);
        } catch (XOException e) {
            throw new ConfigurationException(XOUnitParameter.NAME.getKey(), e.getMessage(), e);
        }
        if (registeredXOUnits.contains(xoUnit.getName())) {
            LOGGER.debug("Update not yet supported {}", pid);
            return;
        }
        XOManagerFactory xoManagerFactory = new XOManagerFactoryImpl(xoUnit);

        Dictionary<String, Object> p = new Hashtable<>();
        p.put("name", xoUnit.getName());
        ServiceRegistration<XOManagerFactory> serviceRegistration = componentContext.getBundleContext().registerService(XOManagerFactory.class, xoManagerFactory, p);

        registeredXOUnits.add(xoUnit.getName());
        pidsToFactories.put(pid, xoManagerFactory);
        pidsToServiceRegistrations.put(pid, serviceRegistration);
    }
View Full Code Here

Examples of com.buschmais.xo.api.bootstrap.XOUnit

            if (propertiesType != null) {
                for (PropertyType propertyType : propertiesType.getProperty()) {
                    properties.setProperty(propertyType.getName(), propertyType.getValue());
                }
            }
            XOUnit xoUnit = new XOUnit(name, description, uri, provider, types, instanceListeners, validationMode, concurrencyMode, defaultTransactionAttribute, properties);
            xoUnits.add(xoUnit);
        }
        return xoUnits;
    }
View Full Code Here

Examples of com.buschmais.xo.api.bootstrap.XOUnit

        return (GraphDatabaseAPI) graphDatabaseService;
    }

    @Override
    protected XOManagerFactory createXOManagerFactory(Collection<Class<?>> types) {
        XOUnit xoUnit;
        try {
            xoUnit = XOUnitBuilder.create("graphDb:///", Neo4jXOProvider.class, types.toArray(new Class<?>[0])).property(GraphDatabaseService.class.getName(), graphDatabaseService).create();
        } catch (URISyntaxException e) {
            throw new IllegalStateException("Cannot create graph store", e);
        }
View Full Code Here

Examples of com.buschmais.xo.api.bootstrap.XOUnit

    }

    @Override
    protected XOManagerFactory createXOManagerFactory(Collection<Class<?>> types) {
        File database = new File(databaseDirectory);
        XOUnit xoUnit = XOUnitBuilder.create(database.toURI(), Neo4jXOProvider.class, types.toArray(new Class<?>[0])).create();
        return XO.createXOManagerFactory(xoUnit);
    }
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.