Package com.google.feedserver.adapters

Examples of com.google.feedserver.adapters.FeedServerAdapterException


      entryId = System.currentTimeMillis();
    }
    String entityFilePath = getEntityFilePath(entryId);

    if (fileUtil.exists(entityFilePath)) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.ENTRY_ALREADY_EXISTS,
          "entry " + entryId + " already exists");
    }

    try {
      fileUtil.writeFileContents(entityFilePath, entityFileContent);
      return entry;
    } catch (IOException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.IO_ERROR, e.getMessage());
    }
  }
View Full Code Here


  }

  @Override
  public void deleteEntry(RequestContext request, Object entryId) throws FeedServerAdapterException {
    if (!fileUtil.delete(getEntityFilePath(entryId))) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.ERROR_EXECUTING_ADAPTER_REQUEST,
          "entry not successfully deleted");
    }
  }
View Full Code Here

      Map<String, Object> entityProperties = xmlUtil.convertXmlToProperties(entityFileContent);
      entityProperties.put(ContentUtil.ID, entryId);
      return createEntryFromProperties(
          null, entityProperties);
    } catch (IOException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.IO_ERROR, e.getMessage());
    } catch (SAXException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.ENTITY_DATA_INVALID, e.getMessage());
    } catch (ParserConfigurationException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.FEED_CONFIGURATION_NOT_CORRECT, e.getMessage());
    }
  }
View Full Code Here

          createEntryFromProperties(feed, entityProperties);
        }
      }
      return feed;
    } catch (IOException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.IO_ERROR, e.getMessage());
    } catch (SAXException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.ENTITY_DATA_INVALID, e.getMessage());
    } catch (ParserConfigurationException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.FEED_CONFIGURATION_NOT_CORRECT, e.getMessage());
    }
  }
View Full Code Here

  @Override
  public Entry updateEntry(RequestContext request, Object entryId, Entry entry)
      throws FeedServerAdapterException {
    String entityFilePath = getEntityFilePath(entryId);
    if (!fileUtil.exists(entityFilePath)) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.ENTRY_DOES_NOT_EXIST,
          "entry " + entryId + " does not exist");
    }

    Map<String, Object> properties = getPropertyMapForEntry(entry);
    String entityFileContent = xmlUtil.convertPropertiesToXml(properties);
    try {
      fileUtil.writeFileContents(entityFilePath, entityFileContent);
      return entry;
    } catch (IOException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.IO_ERROR, e.getMessage());
    }
  }
View Full Code Here

      try {
        client =
            SqlMapClientBuilder.buildSqlMapClient(config.getAdapterConfiguration()
                .getAdapterConfigAsReader());
      } catch (IOException e) {
        throw new FeedServerAdapterException(
            FeedServerAdapterException.Reason.ADAPTER_CONFIGURATION_NOT_CORRECT, dataSourceId);
      }
      sqlMapClients.put(dataSourceId, client);
      return client;
    }
View Full Code Here

    String queryId = config.getFeedId() + "-get-feed";
    List<Map<String, Object>> rows;
    try {
      rows = client.queryForList(queryId, getRequestParams(request));
    } catch (SQLException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.ERROR_EXECUTING_ADAPTER_REQUEST, e.getMessage());
    }
    Feed feed = createFeed();
    ServerConfiguration serverConfig = config.getServerConfiguration();
    if (serverConfig.getFeedNamespacePrefix() != null
View Full Code Here

    SqlMapClient client = getSqlMapClient();
    Map<String, Object> row;
    try {
      row = (Map<String, Object>) client.queryForObject(queryId, entryId,  getRequestParams(request));
    } catch (SQLException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.ERROR_EXECUTING_ADAPTER_REQUEST, e.getMessage());
    }
    if (row == null) {
      // didn't find the entry.
      return null;
View Full Code Here

    try {
      Map<String, Object> params = getRequestParams(request);
      params.putAll(getPropertyMapForEntry(entry));
      newEntryId = client.insert(queryId, params);
    } catch (SQLException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.ERROR_EXECUTING_ADAPTER_REQUEST, e.getMessage());
    }
    return retrieveEntry(request, newEntryId);
  }
View Full Code Here

        Map<String, Object> params = getRequestParams(request);
        params.putAll(getPropertyMapForEntry(entry));
      return client.update(queryId, params) > 0 ? retrieveEntry(request,
          entryId) : null;
    } catch (SQLException e) {
      throw new FeedServerAdapterException(
          FeedServerAdapterException.Reason.ERROR_EXECUTING_ADAPTER_REQUEST, e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of com.google.feedserver.adapters.FeedServerAdapterException

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.