GDataAdminServicepublic class GDataAdminService extends org.apache.lucene.gdata.server.GDataService implements AdminServicedefault implementation of the
{@link org.apache.lucene.gdata.server.administration.AdminService} interface. |
Fields Summary |
---|
private static final Log | LOG |
Constructors Summary |
---|
public GDataAdminService()
super();
|
Methods Summary |
---|
public void | createAccount(org.apache.lucene.gdata.data.GDataAccount account)
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 void | createFeed(org.apache.lucene.gdata.data.ServerBaseFeed feed, org.apache.lucene.gdata.data.GDataAccount account)
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 void | deleteAccount(org.apache.lucene.gdata.data.GDataAccount account)
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 void | deleteFeed(org.apache.lucene.gdata.data.ServerBaseFeed feed)
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.GDataAccount | getAccount(java.lang.String accountName)
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.GDataAccount | getFeedOwningAccount(java.lang.String feedId)
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 void | updateAccount(org.apache.lucene.gdata.data.GDataAccount account)
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 void | updateFeed(org.apache.lucene.gdata.data.ServerBaseFeed feed, org.apache.lucene.gdata.data.GDataAccount account)
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);
}
|
|