PageRenderTime 63ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/dumbhippo/branches/jboss-upgrade/server/src/com/dumbhippo/server/HttpMethods.java

https://gitlab.com/manoj-makkuboy/magnetism
Java | 365 lines | 240 code | 74 blank | 51 comment | 0 complexity | 1864f9c2e5c479e522fea594219961c5 MD5 | raw file
  1. package com.dumbhippo.server;
  2. import java.io.IOException;
  3. import java.io.OutputStream;
  4. import java.net.MalformedURLException;
  5. import javax.ejb.Local;
  6. import org.xml.sax.SAXException;
  7. import com.dumbhippo.XmlBuilder;
  8. import com.dumbhippo.identity20.Guid.ParseException;
  9. /**
  10. * - Methods must be named getFoo or doFoo
  11. * - the args to a method are: OutputStream,HttpResponseData pair; User
  12. * logged in user; http params
  13. * - the OutputStream,HttpResponseData can be omitted if you only return
  14. * content type NONE
  15. * - if you have the User arg then you require login for the method to work
  16. *
  17. */
  18. @Local
  19. public interface HttpMethods {
  20. @HttpContentTypes(HttpResponseData.XML)
  21. @HttpParams( { "groupId" })
  22. public void getAddableContacts(OutputStream out, HttpResponseData contentType, UserViewpoint viewpoint, String groupId)
  23. throws IOException;
  24. @HttpContentTypes(HttpResponseData.XML)
  25. @HttpParams( { })
  26. public void getContactsAndGroups(OutputStream out, HttpResponseData contentType, UserViewpoint viewpoint)
  27. throws IOException;
  28. @HttpContentTypes(HttpResponseData.XML)
  29. @HttpParams( { "email" })
  30. public void doCreateOrGetContact(OutputStream out, HttpResponseData contentType, UserViewpoint viewpoint, String email)
  31. throws IOException;
  32. @HttpContentTypes(HttpResponseData.XML)
  33. @HttpParams( { "name", "members", "secret", "description" })
  34. @HttpOptions( optionalParams = { "members", "description" } )
  35. public void doCreateGroup(OutputStream out, HttpResponseData contentType, UserViewpoint viewpoint, String name, String memberIds, boolean secret, String description)
  36. throws IOException, ParseException, NotFoundException;
  37. @HttpContentTypes(HttpResponseData.XML)
  38. @HttpParams( { "groupId", "members" })
  39. public void doAddMembers(OutputStream out, HttpResponseData contentType, UserViewpoint viewpoint, String groupId, String memberIds)
  40. throws IOException, ParseException, NotFoundException;
  41. @HttpContentTypes(HttpResponseData.XML)
  42. @HttpParams( { "title", "url", "recipients", "description", "isPublic", "postInfoXml" })
  43. @HttpOptions( optionalParams = { "postInfoXml" } )
  44. public void doShareLink(OutputStream out, HttpResponseData contentType, UserViewpoint viewpoint, String title, String url, String recipientIds, String description, boolean isPublic, String postInfoXml) throws ParseException,
  45. NotFoundException, SAXException, MalformedURLException, IOException;
  46. @HttpContentTypes(HttpResponseData.NONE)
  47. @HttpParams( { "groupId", "recipients", "description" })
  48. public void doShareGroup(UserViewpoint viewpoint, String groupId, String recipientIds, String description) throws ParseException,
  49. NotFoundException;
  50. @HttpContentTypes(HttpResponseData.NONE)
  51. @HttpParams( { "name" })
  52. @HttpOptions(invalidatesSession = true)
  53. public void doRenamePerson(UserViewpoint viewpoint, String name);
  54. @HttpContentTypes(HttpResponseData.NONE)
  55. @HttpParams( { "contactId" })
  56. public void doAddContactPerson(UserViewpoint viewpoint, String contactId);
  57. @HttpContentTypes(HttpResponseData.NONE)
  58. @HttpParams( { "contactId" })
  59. public void doRemoveContactPerson(UserViewpoint viewpoint, String contactId);
  60. @HttpContentTypes(HttpResponseData.NONE)
  61. @HttpParams( { "groupId" })
  62. public void doJoinGroup(UserViewpoint viewpoint, String groupId);
  63. @HttpContentTypes(HttpResponseData.NONE)
  64. @HttpParams( { "groupId" })
  65. public void doLeaveGroup(UserViewpoint viewpoint, String groupId);
  66. @HttpContentTypes(HttpResponseData.NONE)
  67. @HttpParams( { "groupId", "name" })
  68. public void doRenameGroup(UserViewpoint viewpoint, String groupId, String name);
  69. @HttpContentTypes(HttpResponseData.NONE)
  70. @HttpParams( { "groupId", "description" })
  71. public void doSetGroupDescription(UserViewpoint viewpoint, String groupId, String name);
  72. @HttpContentTypes(HttpResponseData.NONE)
  73. @HttpParams( { "groupId", "photo" })
  74. public void doSetGroupStockPhoto(UserViewpoint viewpoint, String groupId, String photo);
  75. @HttpContentTypes(HttpResponseData.XML)
  76. @HttpParams( { "email" })
  77. public void doAddContact(OutputStream out, HttpResponseData contentType, UserViewpoint viewpoint, String email) throws IOException;
  78. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  79. @HttpParams( { "address" })
  80. public void doSendLoginLinkEmail(XmlBuilder xml, String address) throws IOException, HumanVisibleException;
  81. @HttpContentTypes(HttpResponseData.NONE)
  82. @HttpParams( { "address" })
  83. public void doSendClaimLinkEmail(UserViewpoint viewpoint, String address) throws IOException, HumanVisibleException;
  84. @HttpContentTypes(HttpResponseData.NONE)
  85. @HttpParams( { "address" })
  86. public void doSendClaimLinkAim(UserViewpoint viewpoint, String address) throws IOException, HumanVisibleException;
  87. @HttpContentTypes(HttpResponseData.NONE)
  88. @HttpParams( { "address" })
  89. public void doRemoveClaimEmail(UserViewpoint viewpoint, String address) throws IOException, HumanVisibleException;
  90. @HttpContentTypes(HttpResponseData.NONE)
  91. @HttpParams( { "address" })
  92. public void doRemoveClaimAim(UserViewpoint viewpoint, String address) throws IOException, HumanVisibleException;
  93. @HttpContentTypes(HttpResponseData.NONE)
  94. @HttpParams( { "disabled" })
  95. @HttpOptions( allowDisabledAccount = true )
  96. public void doSetAccountDisabled(UserViewpoint viewpoint, boolean disabled) throws IOException, HumanVisibleException;
  97. @HttpContentTypes(HttpResponseData.NONE)
  98. @HttpParams( { "password" })
  99. public void doSetPassword(UserViewpoint viewpoint, String password) throws IOException, HumanVisibleException;
  100. @HttpContentTypes(HttpResponseData.NONE)
  101. @HttpParams( { "enabled" })
  102. public void doSetMusicSharingEnabled(UserViewpoint viewpoint, boolean enabled) throws IOException;
  103. @HttpContentTypes(HttpResponseData.NONE)
  104. @HttpParams( { "notify" })
  105. public void doSetNotifyPublicShares(UserViewpoint viewpoint, boolean notify) throws IOException;
  106. @HttpContentTypes(HttpResponseData.XML)
  107. @HttpParams( { "who", "theme" })
  108. @HttpOptions( optionalParams = { "theme" } )
  109. public void getNowPlaying(OutputStream out, HttpResponseData contentType, String who, String theme)
  110. throws IOException;
  111. @HttpContentTypes(HttpResponseData.TEXT)
  112. @HttpParams( { "basedOn" })
  113. @HttpOptions( optionalParams = { "basedOn" } )
  114. public void doCreateNewNowPlayingTheme(OutputStream out, HttpResponseData contentType, UserViewpoint viewpoint, String basedOn)
  115. throws IOException;
  116. @HttpContentTypes(HttpResponseData.NONE)
  117. @HttpParams( { "theme" })
  118. public void doSetNowPlayingTheme(UserViewpoint viewpoint, String themeId) throws IOException;
  119. @HttpContentTypes(HttpResponseData.NONE)
  120. @HttpParams( { "theme", "key", "value" })
  121. public void doModifyNowPlayingTheme(UserViewpoint viewpoint, String themeId, String key, String value) throws IOException;
  122. @HttpContentTypes(HttpResponseData.XML)
  123. @HttpParams( { "address", "promotion" })
  124. public void doInviteSelf(OutputStream out, HttpResponseData contentType, String address, String promotion) throws IOException;
  125. @HttpContentTypes(HttpResponseData.XML)
  126. @HttpParams( { "address", "subject", "message", "suggestedGroupIds" })
  127. public void doSendEmailInvitation(OutputStream out, HttpResponseData contentType, UserViewpoint viewpoint, String address, String subject, String message, String suggestedGroupIds) throws IOException;
  128. @HttpContentTypes(HttpResponseData.NONE)
  129. @HttpParams( { "countToInvite", "subject", "message", "suggestedGroupIds" })
  130. @HttpOptions( adminOnly = true )
  131. public void doInviteWantsIn(String countToInvite, String subject, String message, String suggestedGroupIds) throws IOException;
  132. @HttpContentTypes(HttpResponseData.XML)
  133. @HttpParams( { "groupId", "inviteeId", "inviteeAddress", "subject", "message" })
  134. @HttpOptions( optionalParams = { "inviteeId", "inviteeAddress" } )
  135. public void doSendGroupInvitation(OutputStream out, HttpResponseData contentType, UserViewpoint viewpoint, String groupId, String inviteeId, String inviteeAddress, String subject, String message) throws IOException;
  136. @HttpContentTypes(HttpResponseData.NONE)
  137. @HttpParams( { "address", "suggestedGroupIds", "desuggestedGroupIds" })
  138. public void doSuggestGroups(UserViewpoint viewpoint, String address, String suggestedGroupIds, String desuggestedGroupIds);
  139. @HttpContentTypes(HttpResponseData.NONE)
  140. @HttpParams( { "userId" })
  141. public void doSendRepairEmail(UserViewpoint viewpoint, String userId);
  142. @HttpContentTypes(HttpResponseData.NONE)
  143. @HttpParams( {} )
  144. public void doReindexAll(UserViewpoint viewpoint);
  145. @HttpContentTypes(HttpResponseData.NONE)
  146. @HttpParams( { "postId", "favorite" })
  147. public void doSetFavoritePost(UserViewpoint viewpoint, String postId, boolean favorite);
  148. @HttpContentTypes(HttpResponseData.TEXT)
  149. @HttpParams( { })
  150. public void getRandomBio(OutputStream out, HttpResponseData contentType, UserViewpoint viewpoint)
  151. throws IOException;
  152. @HttpContentTypes(HttpResponseData.TEXT)
  153. @HttpParams( { })
  154. public void getRandomMusicBio(OutputStream out, HttpResponseData contentType, UserViewpoint viewpoint)
  155. throws IOException;
  156. @HttpContentTypes(HttpResponseData.NONE)
  157. @HttpParams( { "bio" })
  158. public void doSetBio(UserViewpoint viewpoint, String bio);
  159. @HttpContentTypes(HttpResponseData.NONE)
  160. @HttpParams( { "musicbio" })
  161. public void doSetMusicBio(UserViewpoint viewpoint, String bio);
  162. @HttpContentTypes(HttpResponseData.NONE)
  163. @HttpParams( { "photo" })
  164. public void doSetStockPhoto(UserViewpoint viewpoint, String photo);
  165. @HttpContentTypes(HttpResponseData.TEXT)
  166. @HttpParams( { "userId", "size" })
  167. public void getUserPhoto(OutputStream out, HttpResponseData contentType, String userId, String size)
  168. throws IOException;
  169. @HttpContentTypes(HttpResponseData.TEXT)
  170. @HttpParams( { "groupId", "size" })
  171. public void getGroupPhoto(OutputStream out, HttpResponseData contentType, String groupId, String size)
  172. throws IOException;
  173. @HttpContentTypes(HttpResponseData.NONE)
  174. @HttpParams( {} )
  175. @HttpOptions( allowDisabledAccount = true )
  176. public void doAcceptTerms(UserViewpoint viewpoint);
  177. @HttpContentTypes(HttpResponseData.NONE)
  178. @HttpParams( { "userId", "disabled" } )
  179. @HttpOptions( adminOnly = true )
  180. public void doSetAdminDisabled(UserViewpoint viewpoint, String userId, boolean disabled);
  181. @HttpContentTypes(HttpResponseData.NONE)
  182. @HttpParams( { "newFeaturesFlag" } )
  183. @HttpOptions( adminOnly = true )
  184. public void doSetNewFeatures(UserViewpoint viewpoint, boolean newFeaturesFlag);
  185. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  186. @HttpParams( { "parseOnly", "command" } )
  187. @HttpOptions( adminOnly = true )
  188. public void doAdminShellExec(XmlBuilder xml, UserViewpoint viewpoint, boolean parseOnly, String command) throws IOException, HumanVisibleException;
  189. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  190. @HttpParams( { "url" })
  191. public void doFeedPreview(XmlBuilder xml, UserViewpoint viewpoint, String url) throws XmlMethodException;
  192. @HttpContentTypes(HttpResponseData.TEXT)
  193. @HttpParams( { "url" })
  194. public void getFeedDump(OutputStream out, HttpResponseData contentType, UserViewpoint viewpoint, String url) throws HumanVisibleException, IOException;
  195. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  196. @HttpParams( { "groupId", "url" })
  197. public void doAddGroupFeed(XmlBuilder xml, UserViewpoint viewpoint, String groupId, String url) throws XmlMethodException;
  198. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  199. @HttpParams( { "groupId", "url" })
  200. public void doRemoveGroupFeed(XmlBuilder xml, UserViewpoint viewpoint, String groupId, String url) throws XmlMethodException;
  201. /**
  202. * Mark an external account as "hated" and give an optional quip about why.
  203. * If the quip is missing or empty it's taken as "delete any quip"
  204. *
  205. * @param xml
  206. * @param viewpoint
  207. * @param type
  208. * @param quip
  209. * @throws XmlMethodException
  210. */
  211. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  212. @HttpParams( { "type", "quip" })
  213. @HttpOptions( optionalParams = { "quip" } )
  214. public void doHateExternalAccount(XmlBuilder xml, UserViewpoint viewpoint, String type, String quip) throws XmlMethodException;
  215. /**
  216. * Mark an external account as "indifferent" which effectively hides both any hate-quip or
  217. * account information from your profile. i.e. this is the same as "removing" an external account.
  218. * We don't really remove it though, i.e. the quip/account-info are remembered in case you
  219. * switch back to those states.
  220. *
  221. * @param xml
  222. * @param viewpoint
  223. * @param type
  224. * @throws XmlMethodException
  225. */
  226. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  227. @HttpParams( { "type" })
  228. public void doRemoveExternalAccount(XmlBuilder xml, UserViewpoint viewpoint, String type) throws XmlMethodException;
  229. /**
  230. * Given an email address, try to lookup the associated flickr account information.
  231. *
  232. * @param xml
  233. * @param viewpoint
  234. * @param email the flickr email address
  235. * @throws XmlMethodException
  236. */
  237. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  238. @HttpParams( { "email" })
  239. public void doFindFlickrAccount(XmlBuilder xml, UserViewpoint viewpoint, String email) throws XmlMethodException;
  240. /**
  241. * Adds a flickr account with the given nsid and Flickr email address. Automatically marks
  242. * Flickr as "loved" instead of "hated"
  243. *
  244. * To get the NSID, you would ask someone for their Flickr email address, then use it to call
  245. * FindFlickrAccount, then you have both email and nsid.
  246. *
  247. * @param xml
  248. * @param viewpoint
  249. * @param nsid
  250. * @param email
  251. * @throws XmlMethodException
  252. */
  253. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  254. @HttpParams( { "nsid", "email" })
  255. public void doSetFlickrAccount(XmlBuilder xml, UserViewpoint viewpoint, String nsid, String email) throws XmlMethodException;
  256. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  257. @HttpParams( { "name" })
  258. public void doSetMySpaceName(XmlBuilder xml, UserViewpoint viewpoint, String name) throws XmlMethodException;
  259. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  260. @HttpParams( { "urlOrName" })
  261. public void doSetLinkedInProfile(XmlBuilder xml, UserViewpoint viewpoint, String urlOrName) throws XmlMethodException;
  262. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  263. @HttpParams( { "urlOrName" })
  264. public void doSetYouTubeName(XmlBuilder xml, UserViewpoint viewpoint, String urlOrName) throws XmlMethodException;
  265. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  266. @HttpParams( { "url" })
  267. public void doSetWebsite(XmlBuilder xml, UserViewpoint viewpoint, String url) throws XmlMethodException;
  268. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  269. @HttpParams( { "url" })
  270. public void doSetRhapsodyHistoryFeed(XmlBuilder xml, UserViewpoint viewpoint, String url) throws XmlMethodException;
  271. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  272. @HttpParams( {})
  273. public void getStatisticsSets(XmlBuilder xml, UserViewpoint viewpoint) throws IOException, XmlMethodException;
  274. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  275. @HttpParams( { "filename", "columns", "start", "end", "timescale" })
  276. @HttpOptions( optionalParams = { "filename", "start", "end", "timescale" } )
  277. public void getStatistics(XmlBuilder xml, UserViewpoint viewpoint, String filename, String columns, String start, String end, String timescale) throws IOException, XmlMethodException;
  278. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  279. @HttpParams( { "userId", "lastTimestamp", "start", "count" })
  280. @HttpOptions( optionalParams = { "userId" } )
  281. public void getBlocks(XmlBuilder xml, UserViewpoint viewpoint, String userId, String lastTimestamp, String start, String count) throws XmlMethodException;
  282. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  283. @HttpParams( { "userId" })
  284. public void getMusicPersonSummary(XmlBuilder xml, UserViewpoint viewpoint, String userId) throws XmlMethodException;
  285. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  286. @HttpParams( { "groupId" })
  287. public void getGroupChatSummary(XmlBuilder xml, UserViewpoint viewpoint, String groupId) throws XmlMethodException;
  288. @HttpContentTypes(HttpResponseData.XMLMETHOD)
  289. @HttpParams( { "postId" })
  290. public void getPostSummary(XmlBuilder xml, UserViewpoint viewpoint, String postId) throws XmlMethodException;
  291. }