Package org.apache.tapestry.vlib

Examples of org.apache.tapestry.vlib.VirtualLibraryEngine


        // An error, from a validation field, may already have occured.

        if (delegate.getHasErrors())
            return;

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();

        int i = 0;
        while (true)
        {
            try
            {
                IOperations operations = vengine.getOperations();

                Person person = operations.login(getEmail(), password);

                loginUser(person, cycle);

                break;

            }
            catch (LoginException ex)
            {
                String fieldName = ex.isPasswordError() ? "inputPassword" : "inputEmail";

                setErrorField(fieldName, ex.getMessage());
                return;
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure("Remote exception validating user.", ex, i++);
            }
        }
    }
View Full Code Here


                if (i++ == 0)
                    getListener().actionTriggered(this, page.getRequestCycle());
                else
                {
                    VirtualLibraryEngine vengine = (VirtualLibraryEngine) page.getEngine();
                    vengine.rmiFailure("Unable to retrieve query results.", ex, i);
                }

            }
        }
View Full Code Here

        // An error, from a validation field, may already have occured.

        if (delegate.getHasErrors())
            return;

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();

        int i = 0;
        while (true)
        {
            try
            {
                IOperations operations = vengine.getOperations();

                Person person = operations.login(getEmail(), password);

                loginUser(person, cycle);

                break;

            }
            catch (LoginException ex)
            {
                String fieldName = ex.isPasswordError() ? "inputPassword" : "inputEmail";

                setErrorField(fieldName, ex.getMessage());
                return;
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure("Remote exception validating user.", ex, i++);
            }
        }
    }
View Full Code Here

     **/

    public void activate(IRequestCycle cycle)
    {
        Visit visit = (Visit) getVisit();
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) cycle.getEngine();

        Integer userId = visit.getUserId();
        Map attributes = null;

        int i = 0;
        while (true)
        {
            try
            {
                IOperations operations = vengine.getOperations();

                attributes = operations.getPersonAttributes(userId);

                break;
            }
            catch (FinderException ex)
            {
                throw new ApplicationRuntimeException(ex);
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure("Remote exception reading user.", ex, i++);
            }
        }

        attributes.remove("password");
        setAttributes(attributes);
View Full Code Here

            attributes.put("password", password1);
        }

        Visit visit = (Visit) getVisit();
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) cycle.getEngine();
        Integer userId = visit.getUserId();

        int i = 0;
        while (true)
        {
            try
            {
                /**
                 *  Note:  this allows the user to change thier e-mail
                 *  such that it conflicts with another user!  Need yet-another
                 *  IOperations method to perform the update!
                 *
                 **/

                IOperations operations = vengine.getOperations();

                operations.updatePerson(userId, attributes);
                break;
            }
            catch (FinderException ex)
            {
                throw new ApplicationRuntimeException(ex);
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure("Remote exception updating user attributes.", ex, i++);
            }
        }

        vengine.clearCache();

        MyLibrary myLibrary = (MyLibrary) cycle.getPage("MyLibrary");
        myLibrary.activate(cycle);
    }
View Full Code Here

        cycle.activate(loginPage);
    }

    public void logout(IRequestCycle cycle)
    {
        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getPage().getEngine();

        vengine.logout();

        IMessageProperty home = (IMessageProperty) cycle.getPage("Home");

        home.setMessage(getMessage("goodbye"));
View Full Code Here

    public void selectBook(Integer bookId, IRequestCycle cycle)
    {
        setBookId(bookId);

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();

        int i = 0;
        while (true)
        {
            try
            {
                IOperations operations = vengine.getOperations();
                Book book = operations.getBook(bookId);

                setBookTitle(book.getTitle());

                break;
            }
            catch (FinderException ex)
            {
                throw new ApplicationRuntimeException(ex);
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure("Remote exception reading read book #" + bookId + ".", ex, i++);
            }
        }

        cycle.activate(this);
    }
View Full Code Here

    public void deleteBook(IRequestCycle cycle)
    {
        Object[] parameters = cycle.getServiceParameters();
        Integer bookPK = (Integer) parameters[0];

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
        Book book = null;

        int i = 0;
        while (true)
        {
            try
            {
                IOperations operations = vengine.getOperations();

                book = operations.deleteBook(bookPK);

                break;
            }
            catch (RemoveException ex)
            {
                throw new ApplicationRuntimeException(ex);
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure("Remote exception deleting book #" + bookPK + ".", ex, i++);
            }
        }

        MyLibrary myLibrary = (MyLibrary) cycle.getPage("MyLibrary");
View Full Code Here

    private void runQuery()
    {
        Visit visit = (Visit) getVisit();
        Integer userPK = visit.getUserId();

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();

        SortOrdering ordering = new SortOrdering(getSortColumn(), isDescending());

        int i = 0;
        while (true)
        {
            try
            {
                IBookQuery query = getBorrowedQuery();

                if (query == null)
                {
                    query = vengine.createNewQuery();
                    setBorrowedQuery(query);
                }

                int count = query.borrowerQuery(userPK, ordering);

                if (count != _browser.getResultCount())
                    _browser.initializeForResultCount(count);

                break;
            }
            catch (RemoteException ex)
            {
                vengine.rmiFailure("Remote exception finding borrowed books.", ex, i++);

                setBorrowedQuery(null);
            }
        }
    }
View Full Code Here

    public void returnBook(IRequestCycle cycle)
    {
        Object[] parameters = cycle.getServiceParameters();
        Integer bookPK = (Integer) parameters[0];

        VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
        IOperations operations = vengine.getOperations();

        try
        {
            Book book = operations.returnBook(bookPK);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.vlib.VirtualLibraryEngine

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.