Package com.buschmais.xo.api

Examples of com.buschmais.xo.api.XOException


        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


            case FROM:
                return source.createRelationshipTo(target, metadata.getDatastoreMetadata().getDiscriminator());
            case TO:
                return target.createRelationshipTo(source, metadata.getDatastoreMetadata().getDiscriminator());
            default:
                throw new XOException("Unsupported direction " + direction);
        }
    }
View Full Code Here

            case FROM:
                return Direction.OUTGOING;
            case TO:
                return Direction.INCOMING;
            default:
                throw new XOException("Unsupported direction " + direction);
        }
    }
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

    }

    public <T> T removeInterceptor(T instance) {
        InvocationHandler invocationHandler = Proxy.getInvocationHandler(instance);
        if (!InterceptorInvocationHandler.class.isAssignableFrom(invocationHandler.getClass())) {
            throw new XOException(invocationHandler + " implementing " + Arrays.asList(invocationHandler.getClass().getInterfaces()) + " is not of expected type " + InterceptorInvocationHandler.class.getName());
        }
        return (T) ((InterceptorInvocationHandler) invocationHandler).getInstance();
    }
View Full Code Here

    public static <T> Class<T> getType(String name) {
        Class<T> type;
        try {
            type = (Class<T>) Class.forName(name);
        } catch (ClassNotFoundException e) {
            throw new XOException("Cannot find class with name '" + name + "'", e);
        }
        return type;
    }
View Full Code Here

    public static <T> T newInstance(Class<T> type) {
        try {
            return type.newInstance();
        } catch (InstantiationException e) {
            throw new XOException("Cannot create instance of type '" + type.getName() + "'", e);
        } catch (IllegalAccessException e) {
            throw new XOException("Access denied to type '" + type.getName() + "'", e);
        }
    }
View Full Code Here

     * @param type   The type of the property.
     */
    public SetPropertyMethod(Method setter, GetPropertyMethod getter, String name, Class<?> type, Type genericType) {
        super(setter, name, type, genericType);
        if (getter == null) {
            throw new XOException("No getter defined for property '" + name + "' of type '" + type.getName() + "' in type '" + setter.getDeclaringClass().getName() + "'.");
        }
        this.getter = getter;
    }
View Full Code Here

        List<Class<?>> allClasses = DependencyResolver.newInstance(types, classDependencyProvider).resolve();
        LOGGER.debug("Processing types {}", allClasses);
        this.annotatedMethods = new HashMap<>();
        for (Class<?> currentClass : allClasses) {
            if (!currentClass.isInterface()) {
                throw new XOException("Type " + currentClass.getName() + " is not an interface.");
            }
            annotatedMethods.put(currentClass, BeanMethodProvider.newInstance().getMethods(currentClass));
        }
        for (Class<?> currentClass : allClasses) {
            getOrCreateTypeMetadata(currentClass);
View Full Code Here

        if (sourceTypes.contains(relationMetadata.getFromType()) && targetTypes.contains(relationMetadata.getToType())) {
            return Direction.FROM;
        } else if (targetTypes.contains(relationMetadata.getFromType()) && sourceTypes.contains(relationMetadata.getToType())) {
            return Direction.TO;
        }
        throw new XOException("The relation '" + relationMetadata + "' is not defined for the instances.");
    }
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.