<commit_before>package thredds.wcs.v1_1_0;

import ucar.nc2.dt.GridDataset;

import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.net.URI;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.Namespace;

/**
 * _more_
 *
 * @author edavis
 * @since 4.0
 */
public class GetCapabilities
{
  private org.slf4j.Logger logger =
          org.slf4j.LoggerFactory.getLogger( GetCapabilities.class );

  protected static final Namespace wcsNS = Namespace.getNamespace( "http://www.opengis.net/wcs/1.1" );
  protected static final Namespace owcsNS = Namespace.getNamespace( "owcs", "http://www.opengis.net/wcs/1.1/ows" );
  protected static final Namespace owsNS = Namespace.getNamespace( "ows", "http://www.opengis.net/ows" );

  public enum Section
  {
    ServiceIdentification, ServiceProvider,
    OperationsMetadata, Contents, All
  }

  private ServiceId serviceId;
  private GridDataset dataset;

  private Document capabilitiesReport;

  public GetCapabilities( ServiceId serviceId, GridDataset dataset )
  {
    this.serviceId = serviceId;
    this.dataset = dataset;
//    serviceIdTitle = "need a title";
//    serviceIdAbstract = "need an abstract";
//    serviceIdKeywords = new ArrayList<String>();
//    serviceIdKeywords.add( "need keywords");
//    serviceType = "OGC WCS";
//    serviceTypeVersion = new ArrayList<String>();
//    serviceTypeVersion.add("1.1.0");
//    fees = "NONE";
//    accessConstraints = new ArrayList<String>();
//    accessConstraints.add( "NONE");
  }

  public Document generateCapabilities( URI serverURI, GridDataset gds, List<Section> sections )
  {
    Element capabilitiesElem = new Element( "Capabilities", wcsNS );
    capabilitiesElem.addNamespaceDeclaration( owcsNS );
    capabilitiesElem.addNamespaceDeclaration( owsNS );

    if ( sections == null || sections.size() == 0 ||
         ( sections.size() == 1 && sections.get( 0 ).equals( Section.All ) ) )
    {

    }
    else
    {
//      if ( sections.contains( Section.ServiceIdentification))
//      {
//        capabilitiesElem.addContent( generateServiceIdentification( "need a title", "need an abstract",  ));
//      }
      if ( sections.contains( Section.ServiceProvider))
      {
        capabilitiesElem.addContent( generateServiceProvider("") );
      }
      if ( sections.contains( Section.OperationsMetadata ))
      {
        capabilitiesElem.addContent( generateOperationsMetadata());
      }
      if (sections.contains( Section.Contents))
      {
        capabilitiesElem.addContent( generateContent());
      }
    }<commit_msg>More work on adding TDS support for WCS 1.1.<commit_after>package thredds.wcs.v1_1_0;

import ucar.nc2.dt.GridDataset;

import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.net.URI;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.Namespace;

/**
 * _more_
 *
 * @author edavis
 * @since 4.0
 */
public class GetCapabilities
{
  private org.slf4j.Logger logger =
          org.slf4j.LoggerFactory.getLogger( GetCapabilities.class );

  protected static final Namespace wcsNS = Namespace.getNamespace( "http://www.opengis.net/wcs/1.1" );
  protected static final Namespace owcsNS = Namespace.getNamespace( "owcs", "http://www.opengis.net/wcs/1.1/ows" );
  protected static final Namespace owsNS = Namespace.getNamespace( "ows", "http://www.opengis.net/ows" );

  public enum Section
  {
    ServiceIdentification, ServiceProvider,
    OperationsMetadata, Contents, All
  }

  private URI serverURI;

  private List<Section> sections;
  private ServiceId serviceId;
  private GridDataset dataset;

  private Document capabilitiesReport;

  public GetCapabilities( URI serverURI, List<Section> sections,
                          ServiceId serviceId,
                          GridDataset dataset )
  {
    this.serverURI = serverURI;
    this.sections = sections;
    this.serviceId = serviceId;
    this.dataset = dataset;
//    serviceIdTitle = "need a title";
//    serviceIdAbstract = "need an abstract";
//    serviceIdKeywords = new ArrayList<String>();
//    serviceIdKeywords.add( "need keywords");
//    serviceType = "OGC WCS";
//    serviceTypeVersion = new ArrayList<String>();
//    serviceTypeVersion.add("1.1.0");
//    fees = "NONE";
//    accessConstraints = new ArrayList<String>();
//    accessConstraints.add( "NONE");
  }

  public Document generateCapabilities()
  {
    Element capabilitiesElem = new Element( "Capabilities", wcsNS );
    capabilitiesElem.addNamespaceDeclaration( owcsNS );
    capabilitiesElem.addNamespaceDeclaration( owsNS );

    if ( sections == null || sections.size() == 0 ||
         ( sections.size() == 1 && sections.get( 0 ).equals( Section.All ) ) )
    {

    }
    else
    {
//      if ( sections.contains( Section.ServiceIdentification))
//      {
//        capabilitiesElem.addContent( generateServiceIdentification( "need a title", "need an abstract",  ));
//      }
      if ( sections.contains( Section.ServiceProvider))
      {
        capabilitiesElem.addContent( generateServiceProvider("") );
      }
      if ( sections.contains( Section.OperationsMetadata ))
      {
        capabilitiesElem.addContent( generateOperationsMetadata());
      }
      if (sections.contains( Section.Contents))
      {
        capabilitiesElem.addContent( generateContent());
      }
    }
{'fraction_non_alphanumeric': 0.12268346923647146, 'fraction_numerical': 0.007042253521126761, 'mean_word_length': 3.2131147540983607, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '413784', 'n_tokens_mistral': 1584, 'n_tokens_neox': 1577, 'n_words': 348}