Package com.google.feedserver.config

Examples of com.google.feedserver.config.NamespacedAdapterConfiguration


        NAMESPACE, feedConfiguration.getFeedId(), null));
  }

  public void testGetAdatperConfigWithoutImpliciMixins() throws Exception {

    NamespacedAdapterConfiguration adapterConfig =
        (NamespacedAdapterConfiguration) feedStoreBasedFeedConfigStore.getAdapterConfiguration(
            NAMESPACE, TestUtil.TEST_ADAPTER_WITH_WRAPPER);
    assertEquals(TestUtil.SAMPLE_ADAPTER_CLASS, adapterConfig.getAdapterType());
    assertEquals(TestUtil.TEST_ADAPTER_WITH_WRAPPER, adapterConfig.getAdapterName());
    assertEquals(TestUtil.ADAPTER_CONFIGURATION, adapterConfig.getConfigData());

  }
View Full Code Here


  }

  public void testGetAdatperConfigWithImpliciMixins() throws Exception {

    NamespacedAdapterConfiguration adapterConfig =
        (NamespacedAdapterConfiguration) feedStoreBasedFeedConfigStore.getAdapterConfiguration(
            NAMESPACE, TestUtil.SAMPLE_ADAPTER_WITH_IMPLICIT_MIXINS);
    assertEquals(TestUtil.SAMPLE_ADAPTER_CLASS, adapterConfig.getAdapterType());
    assertEquals(TestUtil.SAMPLE_ADAPTER_WITH_IMPLICIT_MIXINS, adapterConfig.getAdapterName());
    assertEquals(TestUtil.ADAPTER_CONFIGURATION, adapterConfig.getConfigData());

    MixinConfiguration[] implicitMixins = adapterConfig.getImplicitMixins();
    assertNotNull(implicitMixins);
    assertEquals(3, implicitMixins.length);
    assertEquals(TestUtil.WRAPPER_CLASS, implicitMixins[0].getWrapperName());
    assertEquals(TestUtil.WRAPPER_CLASS, implicitMixins[1].getWrapperName());
    assertEquals(TestUtil.WRAPPER_CLASS, implicitMixins[2].getWrapperName());
View Full Code Here

  protected static FileAdapterConfig getFileAdapterConfig(XmlUtil xmlUtil, FeedConfiguration config)
      throws IntrospectionException, IllegalAccessException, InvocationTargetException,
      SAXException, IOException, ParserConfigurationException, IllegalArgumentException,
      ParseException {
    NamespacedAdapterConfiguration adapterConfig =
        (NamespacedAdapterConfiguration) config.getAdapterConfiguration();
    String fileAdapterConfigValue =
        (String) adapterConfig.getProperty(FeedServerConfiguration.CONFIG_VALUE_KEY);
    FileAdapterConfig fileAdapterConfig = new FileAdapterConfig();
    xmlUtil.convertXmlToBean(fileAdapterConfigValue, fileAdapterConfig);
    return fileAdapterConfig;
  }
View Full Code Here

  /**
   * Sets the feed db config details for the given feed as sqlMap resource
   */
  private void setFeedDBResourcesToAdapterConfig() {
    NamespacedAdapterConfiguration adapterConfig = getConfiguration().getAdapterConfiguration();

    // Read the adapter config value. This will be
    // <sqlMapConfig>...</sqlMapConfig>
    String sqlMapConfig = adapterConfig.getConfigData();

    // Get the feed config value to be set as sqlMap resource
    String sqlMapFeedUrl = getFeedConfigData();

    Document adapterConfigDocument =
        FeedServerUtil.parseDocument(sqlMapConfig, new SqlMapClasspathEntityResolver());
    if (null == adapterConfigDocument) {
      String message = "adapter config document is null";
      RuntimeException e = new RuntimeException(message);
      logger.log(Level.SEVERE, message, e);
      throw e;
    }
    Element adapterParentNode = adapterConfigDocument.getDocumentElement();
    if (!adapterParentNode.getNodeName().equals("sqlMapConfig")) {
      String message = "adapter config document element not <sqlMapConfig>";
      RuntimeException e = new RuntimeException(message);
      logger.log(Level.SEVERE, message, e);
      throw e;
    }
    Element node = adapterConfigDocument.createElement(NODE_SQL_MAP_NAME);
    node.setAttribute(ATTRIBUTE_RESOURCE, sqlMapFeedUrl);
    adapterParentNode.appendChild(node);
    try {
      adapterConfig.setConfigData(SQLMAP_DOCTYPE_STRING
          + FeedServerUtil.getDocumentAsXml(adapterConfigDocument));
    } catch (TransformerException e) {
      logger.log(Level.SEVERE, e.getMessage(), e);
      throw new RuntimeException("invalid configuration: " + e.getMessage());
    }
View Full Code Here

    // as
    // adpaternames and get the adapter configurations for the same
    for (String adapterConfigFileName : adapterConfigDir.list()) {
      String adapterName =
          adapterConfigFileName.substring(0, adapterConfigFileName.lastIndexOf("."));
      NamespacedAdapterConfiguration adapterConfiguration = null;

      try {
        adapterConfiguration = getAdapterConfig(namespace, adapterName);
      } catch (FeedConfigStoreException e) {
        logger.log(Level.SEVERE, "Unable to retrieve adapter configuration with adapterName : "
View Full Code Here

    // Create the namespace and adapter config directories if they are not
    // present
    createNamespaceAndAdapterConfigDir(namespace);

    // Type cast to the instance with namespace adapter configuration
    NamespacedAdapterConfiguration namespaceAdapterConfig = (NamespacedAdapterConfiguration) config;

    // Get the adapter config file
    File adapaterFile = getAdapterConfigFile(namespace, namespaceAdapterConfig.getAdapterName());

    // Check if the adapter configuration already exists
    if (adapaterFile.exists()) {
      logger.log(Level.WARNING, "Adapter configuration already exists!!");
      throw new FeedConfigStoreException(Reason.INVALID_ADAPTER_CONFIGURATION,
View Full Code Here

    propertiesMap.put(FeedServerConfiguration.FEED_TYPE_CONFIG_KEY, prop
        .get(FeedServerConfiguration.FEED_TYPE_CONFIG_KEY));
    propertiesMap.put(FeedConfiguration.PROP_SUB_URI_NAME, subUri);

    // Get the adapter configuration
    NamespacedAdapterConfiguration adapterConfig = getAdapterConfig(namespace, adapterName);

    NamespacedFeedConfiguration feedConfig =
        new NamespacedFeedConfiguration(propertiesMap, adapterConfig,
            getNamesapceServerConfiguration(namespace));
View Full Code Here

        adapterProperties.remove(FeedServerConfiguration.CONFIG_VALUE_KEY);
        adapterProperties.remove(FeedServerConfiguration.CONFIG_VALUE_TYPE_KEY);
      }
      adapterConfigProperties.putAll(adapterProperties);

      NamespacedAdapterConfiguration adapterConfiguration =
          new NamespacedAdapterConfiguration(adapterConfigProperties,
              getNamesapceServerConfiguration(namespace));
      return adapterConfiguration;
    } catch (FileNotFoundException e) {
      throw new FeedConfigStoreException(Reason.ADAPTER_CONFIG_DOES_NOT_EXIST,
          "No adapter configuration exists with the given name : " + adapterName);
View Full Code Here

      throws FeedConfigStoreException {
    List<MixinConfiguration> mixinConfigs = new ArrayList<MixinConfiguration>();
    MapMixinConfiguration mixinConfig = new MapMixinConfiguration();
    if (null == mixin.getWrapperConfig()) {
      // This has to be a mixin with config stored seperately.
      NamespacedAdapterConfiguration adapterConfiguration =
          (NamespacedAdapterConfiguration) getAdapterConfiguration(namespace, mixin
              .getWrapperName());
      mixinConfig.setWrapperConfig(adapterConfiguration.getConfigData());
      for (MixinConfiguration adapterMixinConfig : adapterConfiguration.getMixins()) {
        mixinConfigs.add(adapterMixinConfig);
      }
      mixinConfig.setWrapperName(adapterConfiguration.getAdapterType());
    } else {
      // Just load the adapter config properties and use the adapter class name
      // as mixin wrapper name
      Map<String, Object> adapterWrapper = getAdapter(namespace, mixin.getWrapperName());
      mixinConfig.setWrapperName((String) adapterWrapper.get(ADAPTER_CLASS_NAME));
View Full Code Here

      throwApplyingWrapperError(config);
    }
  }

  protected MixinConfiguration[] getImplicitAdapterWrappers() {
    NamespacedAdapterConfiguration adapterConfig =
        targetAdapter.getConfiguration().getAdapterConfiguration();
    return adapterConfig.getImplicitMixins();
  }
View Full Code Here

TOP

Related Classes of com.google.feedserver.config.NamespacedAdapterConfiguration

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.