Package org.apache.oodt.cas.product.jaxrs.configurations

Examples of org.apache.oodt.cas.product.jaxrs.configurations.RdfConfiguration


          try
          {
            if ("rdf".equals(format))
            {
              RdfConfiguration configuration = new RdfConfiguration();
              configuration.initialize(new File(value));
              rdfConfigurations.put(name, configuration);
            }
            else if ("rss".equals(format))
            {
              RssConfiguration configuration = new RssConfiguration();
              configuration.initialize(new File(value));
              rssConfigurations.put(name, configuration);
            }
          }
          catch (IOException e)
          {
View Full Code Here


      throws IOException, WebApplicationException
  {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);

    RdfConfiguration configuration = getConfiguration();

    try
    {
      Document doc = factory.newDocumentBuilder().newDocument();

      Element rdf = XMLUtils.addNode(doc, doc, "rdf:RDF");
      XMLUtils.addAttribute(doc, rdf, RDF_NAMESPACE_NAME, RDF_NAMESPACE_VALUE);

      if (configuration != null)
      {
        Map<String, String> namespaceMap = configuration.getNamespaces();
        for (Entry<String, String> entry : namespaceMap.entrySet())
        {
          XMLUtils.addAttribute(doc, rdf, "xmlns:" + entry.getKey(),
            entry.getValue());
        }
      }
      else
      {
        XMLUtils.addAttribute(doc, rdf, CAS_NAMESPACE_NAME,
          CAS_NAMESPACE_VALUE);
      }

      for (ProductResource productResource : resource.getProductResources())
      {
        String productTypeName = productResource.getProductTypeName();
        String productId = productResource.getProductId();
        String productNs = configuration != null
          ? configuration.getTypeNamespace(productTypeName)
          : CAS_NAMESPACE_PREFIX;
        Element productRdf = XMLUtils.addNode(doc, rdf,
          productNs + ":" + productTypeName);

        XMLUtils.addAttribute(doc, productRdf, "rdf:about",
          getBaseUri() + "product?productId=" + productId);

        if (configuration != null)
        {
          MetadataResource metadataResource = productResource
            .getMetadataResource();
          for (MetadataEntry entry : metadataResource.getMetadataEntries())
          {
            for (String value : entry.getValues())
            {
              Element metaElement = configuration.createElement(entry.getKey(),
                value, doc);
              productRdf.appendChild(metaElement);
            }
          }
        }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.product.jaxrs.configurations.RdfConfiguration

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.