Search in sources :

Example 31 with Service

use of org.apache.woden.wsdl20.Service in project openstack4j by ContainX.

the class KeystoneToken method getAggregatedCatalog.

/**
 * {@inheritDoc}
 */
@Override
@JsonIgnore
public SortedSetMultimap<String, Service> getAggregatedCatalog() {
    if (aggregatedCatalog == null) {
        synchronized (this) {
            if (aggregatedCatalog == null) {
                aggregatedCatalog = TreeMultimap.create();
                for (Service sc : catalog) {
                    String nameKey = TYPE_WITHOUT_VERSION.apply(sc.getName());
                    String typeKey = TYPE_WITHOUT_VERSION.apply(sc.getType());
                    aggregatedCatalog.put(nameKey, sc);
                    aggregatedCatalog.put(typeKey, sc);
                }
            }
        }
    }
    return aggregatedCatalog;
}
Also used : Service(org.openstack4j.model.identity.v3.Service) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore)

Example 32 with Service

use of org.apache.woden.wsdl20.Service in project carbon-apimgt by wso2.

the class APIMWSDLReader method setServiceDefinitionForWSDL2.

private void setServiceDefinitionForWSDL2(org.apache.woden.wsdl20.Description definition, API api) throws APIManagementException {
    org.apache.woden.wsdl20.Service[] serviceMap = definition.getServices();
    String organization = api.getOrganization();
    // URL addressURI;
    try {
        for (org.apache.woden.wsdl20.Service svc : serviceMap) {
            Endpoint[] portMap = svc.getEndpoints();
            for (Endpoint endpoint : portMap) {
                EndpointElement element = endpoint.toElement();
                // addressURI = endpoint.getAddress().toURL();
                // if (addressURI == null) {
                // break;
                // } else {
                String endpointTransport = determineURLTransport(endpoint.getAddress().getScheme(), api.getTransports());
                setAddressUrl(element, new URI(APIUtil.getGatewayendpoint(endpointTransport, organization) + api.getContext() + '/' + api.getId().getVersion()));
            // }
            }
        }
    } catch (Exception e) {
        String errorMsg = "Error occurred while getting the wsdl address location";
        log.error(errorMsg, e);
        throw new APIManagementException(errorMsg, e);
    }
}
Also used : Service(javax.wsdl.Service) EndpointElement(org.apache.woden.wsdl20.xml.EndpointElement) URI(java.net.URI) APIUtil.handleException(org.wso2.carbon.apimgt.impl.utils.APIUtil.handleException) APIMgtWSDLException(org.wso2.carbon.apimgt.impl.wsdl.exceptions.APIMgtWSDLException) SAXException(org.xml.sax.SAXException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) WSDLException(javax.wsdl.WSDLException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) Endpoint(org.apache.woden.wsdl20.Endpoint) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException)

Example 33 with Service

use of org.apache.woden.wsdl20.Service in project cloudbreak by hortonworks.

the class OpenStackClient method getRegion.

public Set<String> getRegion(CloudCredential cloudCredential) {
    Access access = createAccess(cloudCredential);
    Token token = createToken(cloudCredential);
    Set<String> regions = new HashSet<>();
    if (token == null && access == null) {
        throw new CloudConnectorException("Unsupported keystone version");
    } else if (token != null) {
        for (Service service : token.getCatalog()) {
            for (Endpoint endpoint : service.getEndpoints()) {
                regions.add(endpoint.getRegion());
            }
        }
    } else {
        for (Access.Service service : access.getServiceCatalog()) {
            for (org.openstack4j.model.identity.v2.Endpoint endpoint : service.getEndpoints()) {
                regions.add(endpoint.getRegion());
            }
        }
    }
    LOGGER.info("regions from openstack: {}", regions);
    return regions;
}
Also used : Endpoint(org.openstack4j.model.identity.v3.Endpoint) CloudConnectorException(com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException) Access(org.openstack4j.model.identity.v2.Access) Service(org.openstack4j.model.identity.v3.Service) Token(org.openstack4j.model.identity.v3.Token) HashSet(java.util.HashSet)

Example 34 with Service

use of org.apache.woden.wsdl20.Service in project seldon-core by SeldonIO.

the class SeldonDeploymentOperatorImpl method createResources.

@Override
public DeploymentResources createResources(SeldonDeployment mlDep) throws SeldonDeploymentException {
    OwnerReference ownerRef = getOwnerReference(mlDep);
    List<Deployment> deployments = new ArrayList<>();
    // for each predictor Create/replace deployment
    String serviceLabel = mlDep.getSpec().getName();
    for (PredictorSpec p : mlDep.getSpec().getPredictorsList()) {
        String depName = getKubernetesDeploymentName(mlDep.getSpec().getName(), p.getName());
        PodTemplateSpec.Builder podSpecBuilder = PodTemplateSpec.newBuilder(p.getComponentSpec());
        podSpecBuilder.getSpecBuilder().addContainers(createEngineContainer(mlDep, p)).setTerminationGracePeriodSeconds(20);
        podSpecBuilder.getMetadataBuilder().putAnnotations("prometheus.io/path", "/prometheus").putAnnotations("prometheus.io/port", "" + clusterManagerProperites.getEngineContainerPort()).putAnnotations("prometheus.io/scrape", "true");
        Deployment deployment = V1beta1Extensions.Deployment.newBuilder().setMetadata(ObjectMeta.newBuilder().setName(depName).putLabels(SeldonDeploymentOperatorImpl.LABEL_SELDON_APP, serviceLabel).putLabels(Constants.LABEL_SELDON_ID, mlDep.getSpec().getName()).putLabels("app", depName).putLabels("version", // FIXME
        "v1").putLabels(SeldonDeploymentOperatorImpl.LABEL_SELDON_TYPE_KEY, SeldonDeploymentOperatorImpl.LABEL_SELDON_TYPE_VAL).addOwnerReferences(ownerRef)).setSpec(DeploymentSpec.newBuilder().setTemplate(podSpecBuilder.build()).setStrategy(DeploymentStrategy.newBuilder().setRollingUpdate(RollingUpdateDeployment.newBuilder().setMaxUnavailable(IntOrString.newBuilder().setType(1).setStrVal("10%")))).setReplicas(p.getReplicas())).build();
        deployments.add(deployment);
    }
    final String serviceName = mlDep.getSpec().getName();
    Service s = Service.newBuilder().setMetadata(ObjectMeta.newBuilder().setName(serviceName).putLabels(SeldonDeploymentOperatorImpl.LABEL_SELDON_APP, serviceLabel).putLabels("seldon-deployment-id", mlDep.getSpec().getName()).addOwnerReferences(ownerRef).putAnnotations("getambassador.io/config", getAmbassadorAnnotation(mlDep, serviceName))).setSpec(ServiceSpec.newBuilder().addPorts(ServicePort.newBuilder().setProtocol("TCP").setPort(clusterManagerProperites.getEngineContainerPort()).setTargetPort(IntOrString.newBuilder().setIntVal(clusterManagerProperites.getEngineContainerPort())).setName("http")).addPorts(ServicePort.newBuilder().setProtocol("TCP").setPort(clusterManagerProperites.getEngineGrpcContainerPort()).setTargetPort(IntOrString.newBuilder().setIntVal(clusterManagerProperites.getEngineGrpcContainerPort())).setName("grpc")).setType("ClusterIP").putSelector(SeldonDeploymentOperatorImpl.LABEL_SELDON_APP, serviceLabel)).build();
    // Create service for deployment
    return new DeploymentResources(deployments, s);
}
Also used : V1OwnerReference(io.kubernetes.client.models.V1OwnerReference) OwnerReference(io.kubernetes.client.proto.Meta.OwnerReference) PodTemplateSpec(io.kubernetes.client.proto.V1.PodTemplateSpec) ArrayList(java.util.ArrayList) SeldonDeployment(io.seldon.protos.DeploymentProtos.SeldonDeployment) Deployment(io.kubernetes.client.proto.V1beta1Extensions.Deployment) RollingUpdateDeployment(io.kubernetes.client.proto.V1beta1Extensions.RollingUpdateDeployment) Service(io.kubernetes.client.proto.V1.Service) IntOrString(io.kubernetes.client.proto.IntStr.IntOrString) PredictorSpec(io.seldon.protos.DeploymentProtos.PredictorSpec)

Aggregations

Connector (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector)22 Service (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service)22 CoreException (org.eclipse.core.runtime.CoreException)18 ArrayList (java.util.ArrayList)10 ServerPort (org.eclipse.wst.server.core.ServerPort)9 Endpoint (org.apache.woden.wsdl20.Endpoint)4 Engine (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Engine)4 Host (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Host)4 Listener (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Listener)4 Server (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Server)4 MalformedURLException (java.net.MalformedURLException)3 Service (org.apache.woden.wsdl20.Service)3 EndpointElement (org.apache.woden.wsdl20.xml.EndpointElement)3 Service (org.openstack4j.model.identity.v3.Service)3 Element (org.w3c.dom.Element)3 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)3 APIMgtWSDLException (org.wso2.carbon.apimgt.impl.wsdl.exceptions.APIMgtWSDLException)3 IOException (java.io.IOException)2 URI (java.net.URI)2 HashMap (java.util.HashMap)2