FileDocCategorySizeDatePackage
GDataAdminService.javaAPI DocApache Lucene 2.1.09398Wed Feb 14 10:46:06 GMT 2007org.apache.lucene.gdata.server.administration

GDataAdminService

public class GDataAdminService extends org.apache.lucene.gdata.server.GDataService implements AdminService
default implementation of the {@link org.apache.lucene.gdata.server.administration.AdminService} interface.
author
Simon Willnauer

Fields Summary
private static final Log
LOG
Constructors Summary
public GDataAdminService()

throws
ServiceException


           
        
        super();

    
Methods Summary
public voidcreateAccount(org.apache.lucene.gdata.data.GDataAccount account)

see
org.apache.lucene.gdata.server.administration.AdminService#createAccount(org.apache.lucene.gdata.data.GDataAccount)

        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);
        }
    
public voidcreateFeed(org.apache.lucene.gdata.data.ServerBaseFeed feed, org.apache.lucene.gdata.data.GDataAccount account)

see
org.apache.lucene.gdata.server.administration.AdminService#createFeed(org.apache.lucene.gdata.data.ServerBaseFeed, org.apache.lucene.gdata.data.GDataAccount)

        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);
        }

    
public voiddeleteAccount(org.apache.lucene.gdata.data.GDataAccount account)

see
org.apache.lucene.gdata.server.administration.AdminService#deleteAccount(org.apache.lucene.gdata.data.GDataAccount)

        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);
        }
    
public voiddeleteFeed(org.apache.lucene.gdata.data.ServerBaseFeed feed)

see
org.apache.lucene.gdata.server.administration.AdminService#deleteFeed(org.apache.lucene.gdata.data.ServerBaseFeed)

        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);

    
public org.apache.lucene.gdata.data.GDataAccountgetAccount(java.lang.String accountName)

see
org.apache.lucene.gdata.server.administration.AdminService#getAccount(java.lang.String)

        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);
        }

    
public org.apache.lucene.gdata.data.GDataAccountgetFeedOwningAccount(java.lang.String feedId)

see
org.apache.lucene.gdata.server.administration.AdminService#getFeedOwningAccount(java.lang.String)

        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);
        }
    
public voidupdateAccount(org.apache.lucene.gdata.data.GDataAccount account)

see
org.apache.lucene.gdata.server.administration.AdminService#updateAccount(org.apache.lucene.gdata.data.GDataAccount)

        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);
        }
    
public voidupdateFeed(org.apache.lucene.gdata.data.ServerBaseFeed feed, org.apache.lucene.gdata.data.GDataAccount account)

see
org.apache.lucene.gdata.server.administration.AdminService#updateFeed(org.apache.lucene.gdata.data.ServerBaseFeed, org.apache.lucene.gdata.data.GDataAccount)

        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);
        }