Package com.buschmais.xo.api

Examples of com.buschmais.xo.api.XOException


    @Override
    public <QL extends Annotation> DatastoreQuery<QL> createQuery(Class<QL> queryLanguage) {
        if (Cypher.class.equals(queryLanguage)) {
            return (DatastoreQuery<QL>) new EmbeddedNeo4jCypherQuery();
        }
        throw new XOException("Unsupported query language: " + queryLanguage.getName());
    }
View Full Code Here


        private Transaction transaction;

        @Override
        public void begin() {
            if (transaction != null) {
                throw new XOException("There is already an existing transaction.");
            }
            transaction = getGraphDatabaseService().beginTx();
        }
View Full Code Here

            return transaction != null;
        }

        private void ensureTransaction() {
            if (transaction == null) {
                throw new XOException("There is no existing transaction.");
            }
        }
View Full Code Here

                    return result;
                }

                @Override
                public void remove() {
                    throw new XOException("Remove operation is not supported for query results.");
                }

                @Override
                public void close() {
                    resourceIterator.close();
View Full Code Here

        URI uri = xoUnit.getUri();
        DatastoreFactory datastoreFactory = lookupFactory(uri);
        try {
            return datastoreFactory.createGraphDatabaseService(uri, xoUnit.getProperties());
        } catch (MalformedURLException e) {
            throw new XOException("Cannot create datastore.", e);
        }
    }
View Full Code Here

        LOG.debug("try to lookup provider-class {}", factoryClass);

        try {
            return ((Class<? extends DatastoreFactory>) Class.forName(factoryClass)).newInstance();
        } catch (ReflectiveOperationException e) {
            throw new XOException("Cannot create datastore factory.", e);
        }
    }
View Full Code Here

    @Override
    public GraphDbNeo4jDatastore createGraphDatabaseService(URI uri, Properties properties) throws MalformedURLException {
        String graphDbPropertyName = GraphDatabaseService.class.getName();
        GraphDatabaseService graphDatabaseService = (GraphDatabaseService) properties.get(graphDbPropertyName);
        if (graphDatabaseService == null) {
            throw new XOException("Property " + graphDbPropertyName + " is not specified.");
        }
        return new GraphDbNeo4jDatastore(graphDatabaseService);
    }
View Full Code Here

        IndexedPropertyMethodMetadata<?> indexedProperty = entityTypeMetadata.getDatastoreMetadata().getIndexedProperty();
        if (indexedProperty == null) {
            indexedProperty = entityTypeMetadata.getIndexedProperty();
        }
        if (indexedProperty == null) {
            throw new XOException("Type " + entityTypeMetadata.getAnnotatedType().getAnnotatedElement().getName() + " has no indexed property.");
        }
        PrimitivePropertyMethodMetadata<PropertyMetadata> propertyMethodMetadata = indexedProperty.getPropertyMethodMetadata();
        ResourceIterable<Node> nodesByLabelAndProperty = getGraphDatabaseService().findNodesByLabelAndProperty(discriminator, propertyMethodMetadata.getDatastoreMetadata().getName(), value);
        ResourceIterator<Node> iterator = nodesByLabelAndProperty.iterator();
        return new ResourceResultIterator(iterator);
View Full Code Here

            return (String) expression;
        } else if (expression instanceof AnnotatedElement) {
            AnnotatedElement typeExpression = (AnnotatedElement) expression;
            Cypher cypher = typeExpression.getAnnotation(Cypher.class);
            if (cypher == null) {
                throw new XOException(typeExpression + " must be annotated with " + Cypher.class.getName());
            }
            return cypher.value();
        }
        throw new XOException("Unsupported query expression " + expression);
    }
View Full Code Here

        URI uri = xoUnit.getUri();
        DatastoreFactory datastoreFactory = lookupFactory(uri);
        try {
            return datastoreFactory.createGraphDatabaseService(uri);
        } catch (MalformedURLException e) {
            throw new XOException("Cannot create datastore.", e);
        }

    }
View Full Code Here

TOP

Related Classes of com.buschmais.xo.api.XOException

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.