Package com.buschmais.cdo.api

Examples of com.buschmais.cdo.api.CdoException


                    return invocationContext.proceed();
                } finally {
                    lock.unlock();
                }
            default:
                throw new CdoException("Unsupported concurrency mode " + concurrencyMode);
        }
    }
View Full Code Here


        DatastoreSession<?, Entity, ?, EntityDiscriminator, RelationId, Relation, ?, RelationDiscriminator> datastoreSession = sessionContext.getDatastoreSession();
        Entity source = datastoreSession.getDatastorePropertyManager().getFrom(relation);
        Entity target = datastoreSession.getDatastorePropertyManager().getTo(relation);
        RelationDiscriminator discriminator = datastoreSession.getRelationDiscriminator(relation);
        if (discriminator == null) {
            throw new CdoException("Cannot determine type discriminators for relation '" + relation + "'");
        }
        return sessionContext.getMetadataProvider().getRelationTypes(datastoreSession.getEntityDiscriminators(source), discriminator, datastoreSession.getEntityDiscriminators(target));
    }
View Full Code Here

            transactionAttribute = this.defaultTransactionAttribute;
        }
        switch (transactionAttribute) {
            case MANDATORY:
                if (!this.cdoTransaction.isActive()) {
                    throw new CdoException("An active transaction is MANDATORY when calling method '" +
                            method.getDeclaringClass().getName() + "#" + method.getName() + "'");
                }
                return context.proceed();
            case REQUIRES: {
                if (!this.cdoTransaction.isActive()) {
                    try {
                        this.cdoTransaction.begin();
                        Object result = context.proceed();
                        this.cdoTransaction.commit();
                        return result;
                    } catch (RuntimeException e) {
                        if (this.cdoTransaction.isActive()) {
                            this.cdoTransaction.rollback();
                        }
                        throw e;
                    } catch (Exception e) {
                        if (this.cdoTransaction.isActive()) {
                            this.cdoTransaction.commit();
                        }
                        throw e;
                    }
                } else {
                    return context.proceed();
                }
            }
            case NOT_SUPPORTED:
                return context.proceed();
            default: {
                throw new CdoException("Unsupported transaction attribute '" + transactionAttribute + "'");
            }
        }
    }
View Full Code Here

        BeanMethodProvider beanMethodProvider = BeanMethodProvider.newInstance();
        for (Class<?> type : types) {
            Collection<AnnotatedMethod> typeMethodsOfType = beanMethodProvider.getMethods(type);
            for (AnnotatedMethod typeMethod : typeMethodsOfType) {
                if (!(typeMethod instanceof GetPropertyMethod)) {
                    throw new CdoException("Only get methods are supported for projections: '" + typeMethod.getAnnotatedElement().getName() + "'.");
                }
                PropertyMethod propertyMethod = (PropertyMethod) typeMethod;
                GetMethod proxyMethod = new GetMethod(propertyMethod.getName(), propertyMethod.getType());
                addProxyMethod(proxyMethod, propertyMethod.getAnnotatedElement());
            }
View Full Code Here

    }

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

            CdoManagerFactory cdoManagerFactory = cdoBootstrapService.createCdoManagerFactory(name);
            if (cdoManagerFactory != null) {
                return cdoManagerFactory;
            }
        }
        throw new CdoException("Cannot bootstrap CDO implementation.");
    }
View Full Code Here

            CdoManagerFactory cdoManagerFactory = cdoBootstrapService.createCdoManagerFactory(cdoUnit);
            if (cdoManagerFactory != null) {
                return cdoManagerFactory;
            }
        }
        throw new CdoException("Cannot bootstrap CDO implementation.");
    }
View Full Code Here

    @Override
    public void delete(ObjectNode entity) {
        File file = getFile(entity);
        if (!file.exists()) {
            throw new CdoException("Cannot delete entity '" + entity + "' as it does not exist.");
        }
        file.delete();
    }
View Full Code Here

    public void flush(ObjectNode objectNode) {
        File file = getFile(objectNode);
        try {
            mapper.writeValue(new FileWriter(file), objectNode);
        } catch (IOException e) {
            throw new CdoException("Cannot write file " + file.getName());
        }
    }
View Full Code Here

    public void setProperty(ObjectNode objectNode, PrimitivePropertyMethodMetadata<JsonPrimitivePropertyMetadata> metadata, Object value) {
        Class<?> type = metadata.getAnnotateddMethod().getType();
        if (String.class.equals(type)) {
            objectNode.put(metadata.getAnnotateddMethod().getName(), (String) value);
        } else {
            throw new CdoException("Unsupported type " + type + " for property " + metadata.getAnnotateddMethod().getName());
        }
    }
View Full Code Here

TOP

Related Classes of com.buschmais.cdo.api.CdoException

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.