All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.webcohesion.enunciate.modules.jaxws.api.impl.ServiceGroupImpl Maven / Gradle / Ivy

There is a newer version: 2.18.1
Show newest version
package com.webcohesion.enunciate.modules.jaxws.api.impl;

import com.webcohesion.enunciate.api.ApiRegistrationContext;
import com.webcohesion.enunciate.api.InterfaceDescriptionFile;
import com.webcohesion.enunciate.api.services.Service;
import com.webcohesion.enunciate.api.services.ServiceGroup;
import com.webcohesion.enunciate.facets.FacetFilter;
import com.webcohesion.enunciate.modules.jaxws.WsdlInfo;
import com.webcohesion.enunciate.modules.jaxws.model.EndpointInterface;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * @author Ryan Heaton
 */
public class ServiceGroupImpl implements ServiceGroup {

  private final WsdlInfo wsdlInfo;
  private final ApiRegistrationContext registrationContext;

  public ServiceGroupImpl(WsdlInfo wsdlInfo, ApiRegistrationContext registrationContext) {
    this.wsdlInfo = wsdlInfo;
    this.registrationContext = registrationContext;
  }

  @Override
  public String getNamespace() {
    return this.wsdlInfo.getTargetNamespace();
  }

  @Override
  public InterfaceDescriptionFile getWsdlFile() {
    return this.wsdlInfo.getWsdlFile();
  }

  @Override
  public List getServices() {
    ArrayList services = new ArrayList();
    FacetFilter facetFilter = this.wsdlInfo.getContext().getContext().getConfiguration().getFacetFilter();
    for (EndpointInterface endpointInterface : this.wsdlInfo.getEndpointInterfaces()) {
      if (!facetFilter.accept(endpointInterface)) {
        continue;
      }

      services.add(new ServiceImpl(endpointInterface, "", registrationContext));
    }
    Collections.sort(services, new Comparator() {
      @Override
      public int compare(Service o1, Service o2) {
        return o1.getLabel().compareTo(o2.getLabel());
      }
    });
    return services;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy