Package org.apache.lucene.gdata.server

Examples of org.apache.lucene.gdata.server.ServiceException


     *      org.apache.lucene.gdata.data.GDataAccount)
     */
    public void createFeed(final ServerBaseFeed feed, final GDataAccount account)
            throws ServiceException {
        if (feed == null)
            throw new ServiceException("Can not create feed -- feed is null",
                    GDataResponse.BAD_REQUEST);
        if (account == null)
            throw new ServiceException(
                    "Can not create feed -- account is null",
                    GDataResponse.UNAUTHORIZED);
        if (feed.getId() == null)
            throw new ServiceException("Feed ID is null can not create feed",
                    GDataResponse.BAD_REQUEST);
        if (account.getName() == null)
            throw new ServiceException(
                    "Account name is null -- can't create feed",
                    GDataResponse.UNAUTHORIZED);
        try {
            feed.setUpdated(getCurrentDateTime());
            feed.setAccount(account);
            this.storage.storeFeed(feed, account.getName());
        } catch (StorageException e) {
            if (LOG.isInfoEnabled())
                LOG.info("Can not save feed -- " + e.getMessage(), e);
            throw new ServiceException("Can not save feed", e,
                    GDataResponse.BAD_REQUEST);
        }

    }
View Full Code Here


     *      org.apache.lucene.gdata.data.GDataAccount)
     */
    public void updateFeed(ServerBaseFeed feed, GDataAccount account)
            throws ServiceException {
        if (feed == null)
            throw new ServiceException("Can not update null feed",
                    GDataResponse.BAD_REQUEST);
        if (account == null)
            throw new ServiceException(
                    "Can not update feed -- account is null",
                    GDataResponse.UNAUTHORIZED);
        if (feed.getId() == null)
            throw new ServiceException("Feed ID is null can not update feed",
                    GDataResponse.BAD_REQUEST);
        if (account.getName() == null)
            throw new ServiceException(
                    "Account name is null -- can't update feed",
                    GDataResponse.UNAUTHORIZED);
        try {
            feed.setAccount(account);
            feed.setUpdated(getCurrentDateTime());
            this.storage.updateFeed(feed, account.getName());
        } catch (StorageException e) {
            if (LOG.isInfoEnabled())
                LOG.info("Can not update feed -- " + e.getMessage(), e);
            throw new ServiceException("Can not update feed", e,
                    GDataResponse.BAD_REQUEST);
        }

    }
View Full Code Here

    /**
     * @see org.apache.lucene.gdata.server.administration.AdminService#deleteFeed(org.apache.lucene.gdata.data.ServerBaseFeed)
     */
    public void deleteFeed(ServerBaseFeed feed) throws ServiceException {
        if (feed == null)
            throw new ServiceException("Can not delete null feed",
                    GDataResponse.BAD_REQUEST);
        if (feed.getId() == null)
            throw new ServiceException("Feed ID is null can not delete feed",
                    GDataResponse.BAD_REQUEST);
        String serviceid = null;
        try {
            serviceid = this.storage.getServiceForFeed(feed.getId());
            this.storage.deleteFeed(feed.getId());
        } catch (StorageException e) {
            if (LOG.isInfoEnabled())
                LOG.info("Can not delete feed -- " + e.getMessage(), e);
            throw new ServiceException("Can not delete feed", e,
                    GDataResponse.BAD_REQUEST);
        }
        ProvidedService service = this.registry.getProvidedService(serviceid);
        feed.setServiceConfig(service);
        this.entryEventMediator.allEntriesDeleted(feed);
View Full Code Here

    /**
     * @see org.apache.lucene.gdata.server.administration.AdminService#createAccount(org.apache.lucene.gdata.data.GDataAccount)
     */
    public void createAccount(GDataAccount account) throws ServiceException {
        if (account == null)
            throw new ServiceException("Can not save null account",
                    GDataResponse.BAD_REQUEST);
        try {
            this.storage.storeAccount(account);
        } catch (StorageException e) {
            if (LOG.isInfoEnabled())
                LOG.info("Can not save account -- " + e.getMessage(), e);
            throw new ServiceException("Can not save account", e,
                    GDataResponse.BAD_REQUEST);
        }
    }
View Full Code Here

    /**
     * @see org.apache.lucene.gdata.server.administration.AdminService#deleteAccount(org.apache.lucene.gdata.data.GDataAccount)
     */
    public void deleteAccount(GDataAccount account) throws ServiceException {
        if (account == null)
            throw new ServiceException("Can not delete null account",
                    GDataResponse.BAD_REQUEST);
        try {
            this.storage.deleteAccount(account.getName());
        } catch (StorageException e) {
            if (LOG.isInfoEnabled())
                LOG.info("Can not save account -- " + e.getMessage(), e);
            throw new ServiceException("Can not save account", e,
                    GDataResponse.BAD_REQUEST);
        }
    }
View Full Code Here

    /**
     * @see org.apache.lucene.gdata.server.administration.AdminService#updateAccount(org.apache.lucene.gdata.data.GDataAccount)
     */
    public void updateAccount(GDataAccount account) throws ServiceException {
        if (account == null)
            throw new ServiceException("Can not update null account",
                    GDataResponse.BAD_REQUEST);
        try {
            this.storage.updateAccount(account);
        } catch (StorageException e) {
            if (LOG.isInfoEnabled())
                LOG.info("Can not save account -- " + e.getMessage(), e);
            throw new ServiceException("Can not save account", e,
                    GDataResponse.BAD_REQUEST);
        }
    }
View Full Code Here

    /**
     * @see org.apache.lucene.gdata.server.administration.AdminService#getAccount(java.lang.String)
     */
    public GDataAccount getAccount(String accountName) throws ServiceException {
        if (accountName == null)
            throw new ServiceException("Can not get null account",
                    GDataResponse.BAD_REQUEST);
        try {
            return this.storage.getAccount(accountName);
        } catch (StorageException e) {
            if (LOG.isInfoEnabled())
                LOG.info("Can not get account -- " + e.getMessage(), e);
            throw new ServiceException("Can not get account", e,
                    GDataResponse.BAD_REQUEST);
        }

    }
View Full Code Here

     * @see org.apache.lucene.gdata.server.administration.AdminService#getFeedOwningAccount(java.lang.String)
     */
    public GDataAccount getFeedOwningAccount(String feedId)
            throws ServiceException {
        if (feedId == null)
            throw new ServiceException(
                    "Can not get account - feed id must not be null",
                    GDataResponse.BAD_REQUEST);
        try {
            String accountName = this.storage.getAccountNameForFeedId(feedId);
            return this.storage.getAccount(accountName);

        } catch (StorageException e) {
            if (LOG.isInfoEnabled())
                LOG.info(
                        "Can not get account for feed Id -- " + e.getMessage(),
                        e);
            throw new ServiceException(
                    "Can not get account for the given feed id", e,
                    GDataResponse.BAD_REQUEST);
        }
    }
View Full Code Here

       
        this.requestMockControl.expectAndDefaultReturn(this.mockRequest
                .getParameter(AbstractFeedHandler.PARAMETER_ACCOUNT), this.accountName);
       
        a.setName("helloworld");
        this.adminServiceMockControl.expectAndDefaultThrow(this.adminService.getAccount(this.accountName),new ServiceException(GDataResponse.BAD_REQUEST) );
        this.requestMockControl.replay();
        this.adminServiceMockControl.replay();
         handler = new InsertFeedHandler();
        try{
           
View Full Code Here

       
        this.requestMockControl.expectAndDefaultReturn(this.mockRequest
                .getParameter(AbstractFeedHandler.PARAMETER_ACCOUNT), this.accountName);
       
        a.setName("helloworld");
        this.adminServiceMockControl.expectAndDefaultThrow(this.adminService.getAccount(this.accountName),new ServiceException(GDataResponse.BAD_REQUEST) );
        this.requestMockControl.replay();
        this.adminServiceMockControl.replay();
         handler = new InsertFeedHandler();
        try{
           
View Full Code Here

TOP

Related Classes of org.apache.lucene.gdata.server.ServiceException

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.