Package org.apache.lenya.transaction

Examples of org.apache.lenya.transaction.TransactionException


            source = (TransactionableSource) resolver.resolveURI(sourceUri);

            source.lock();

        } catch (Exception e) {
            throw new TransactionException(e);
        } finally {
            if (resolver != null) {
                if (source != null) {
                    resolver.release(source);
                }
View Full Code Here


            source = (TransactionableSource) resolver.resolveURI(sourceUri);

            source.unlock();

        } catch (Exception e) {
            throw new TransactionException(e);
        } finally {
            if (resolver != null) {
                if (source != null) {
                    resolver.release(source);
                }
View Full Code Here

                collectionElement.appendChild(documentElement);
            }
            DocumentHelper.writeDocument(helper.getDocument(), getFile());

        } catch (Exception e) {
            throw new TransactionException(e);
        }
    }
View Full Code Here

    /**
     * @see org.apache.lenya.transaction.Transactionable#checkin()
     */
    public void checkin() throws TransactionException {
        if (!isCheckedOut()) {
            throw new TransactionException("Cannot check in node [" + this.sourceURI
                    + "]: not checked out!");
        }

        try {
            String userName = getUserId();
            boolean newVersion = this.identityMap.getUnitOfWork().isDirty(this);
            getRevisionController().reservedCheckIn(getRCPath(), userName, true, newVersion);
        } catch (Exception e) {
            throw new TransactionException(e);
        }
    }
View Full Code Here

        try {
            return getRevisionController().isCheckedOut(getRCPath());
        } catch (TransactionException e) {
            throw e;
        } catch (Exception e) {
            throw new TransactionException(e);
        }
    }
View Full Code Here

        if (!isCheckedOut()) {
            try {
                getRevisionController().reservedCheckOut(getRCPath(), getUserId());
            } catch (Exception e) {
                throw new TransactionException(e);
            }
        }
    }
View Full Code Here

                        + "]: not checked out!");
            } else {
                SourceUtil.delete(getRealSourceURI(), this.manager);
            }
        } catch (Exception e) {
            throw new TransactionException(e);
        }
    }
View Full Code Here

                        this.manager.release(resolver);
                    }
                }

            } catch (Exception e) {
                throw new TransactionException(e);
            }
        }
        return this.revisionController;
    }
View Full Code Here

        try {
            int currentVersion = getRevisionController().getLatestVersion(getRCPath());
            int lockVersion = getLock().getVersion();
            return currentVersion > lockVersion;
        } catch (Exception e) {
            throw new TransactionException(e);
        }
    }
View Full Code Here

    /**
     * @see org.apache.lenya.transaction.Transactionable#saveTransactionable()
     */
    public synchronized void saveTransactionable() throws TransactionException {
        if (!isCheckedOut()) {
            throw new TransactionException("Cannot save node [" + this.sourceURI
                    + "]: not checked out!");
        }
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Saving [" + this + "] to source [" + getRealSourceURI() + "]");
        }

        if (this.data != null) {
            SourceResolver resolver = null;
            ModifiableSource source = null;
            InputStream in = null;
            OutputStream out = null;
            try {

                resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
                source = (ModifiableSource) resolver.resolveURI(getRealSourceURI());

                out = source.getOutputStream();

                byte[] buf = new byte[4096];
                in = new ByteArrayInputStream(this.data);
                int read = in.read(buf);

                while (read > 0) {
                    out.write(buf, 0, read);
                    read = in.read(buf);
                }

            } catch (Exception e) {
                throw new TransactionException(e);
            } finally {

                try {
                    if (in != null) {
                        in.close();
View Full Code Here

TOP

Related Classes of org.apache.lenya.transaction.TransactionException

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.