コード例 #1
0
 /** {@inheritDoc} */
 @Override
 public XblUserProfile getXblUserProfile(String xblUsername) throws ServiceException {
   XblUserProfileParser parser = new XblUserProfileParser();
   String userProfileUrl = Configuration.INSTANCE.getStringProperty(PropertyKey.USER_PROFILE_URL);
   String url = MessageFormat.format(userProfileUrl, xblUsername);
   BaseRetriever retriever = new BaseRetriever(url);
   try {
     XblUserProfile result = (XblUserProfile) parser.parse(retriever.retrieve().getBody());
     return result;
   } catch (Exception e) {
     logger.error(ExceptionUtil.getFullStackTrace(e));
     throw new ServiceException(
         "Failed to get user profile for user: [" + xblUsername + "]. Caused by: " + e);
   }
 }
コード例 #2
0
 /** {@inheritDoc} */
 @Override
 public List<XblUserGame> getXblUserGameList(String xblUsername) throws ServiceException {
   XblUserGameListParser parser = new XblUserGameListParser();
   String userGameListUrl =
       Configuration.INSTANCE.getStringProperty(PropertyKey.USER_GAME_LIST_URL);
   String url = MessageFormat.format(userGameListUrl, xblUsername);
   BaseRetriever retriever = new BaseRetriever(url);
   try {
     List<XblUserGame> result = parser.parse(retriever.retrieve().getBody());
     return result;
   } catch (Exception e) {
     logger.error(ExceptionUtil.getFullStackTrace(e));
     throw new ServiceException(
         "Failed to get user's game list for user: [" + xblUsername + "]. Caused by: " + e);
   }
 }