Search in sources :

Example 1 with Service

use of com.google.cloud.servicedirectory.v1.Service in project carbon-apimgt by wso2.

the class WSDL20ProcessorImpl method getEndpoints.

/**
 * Get endpoints defined in the provided WSDL description.
 *
 * @param description WSDL 2.0 description
 * @return a Map of endpoint names and their URIs.
 * @throws APIMgtWSDLException if error occurs while reading endpoints
 */
private Map<String, String> getEndpoints(Description description) throws APIMgtWSDLException {
    Service[] services = description.getServices();
    Map<String, String> serviceEndpointMap = new HashMap<>();
    for (Service service : services) {
        Endpoint[] endpoints = service.getEndpoints();
        for (Endpoint endpoint : endpoints) {
            serviceEndpointMap.put(endpoint.getName().toString(), endpoint.getAddress().toString());
        }
    }
    return serviceEndpointMap;
}
Also used : Endpoint(org.apache.woden.wsdl20.Endpoint) HashMap(java.util.HashMap) Service(org.apache.woden.wsdl20.Service)

Example 2 with Service

use of com.google.cloud.servicedirectory.v1.Service in project api-snippets by TwilioDevEd.

the class Example method main.

public static void main(String[] args) {
    // Authenticate with Twilio
    Twilio.init(API_KEY, API_SECRET, ACCOUNT_SID);
    // Update the service webhooks
    String newMessageTemplate = "A New message in ${CHANNEL} from ${USER}: " + "${MESSAGE}";
    Service service = Service.updater(SERVICE_SID).setNotificationsNewMessageEnabled(true).setNotificationsNewMessageTemplate(newMessageTemplate).setNotificationsNewMessageSound("default").update();
    System.out.println(service.getSid());
}
Also used : Service(com.twilio.rest.chat.v2.Service)

Example 3 with Service

use of com.google.cloud.servicedirectory.v1.Service in project openstack4j by ContainX.

the class BaseOpenStackService method getServiceVersion.

@SuppressWarnings("rawtypes")
protected int getServiceVersion() {
    OSClientSession session = OSClientSession.getCurrent();
    if (session.getAuthVersion() == AuthVersion.V3) {
        SortedSet<? extends Service> services = ((OSClientSession.OSClientSessionV3) session).getToken().getAggregatedCatalog().get(serviceType.getType());
        Service service = ((OSClientSession.OSClientSessionV3) session).getToken().getAggregatedCatalog().get(serviceType.getType()).first();
        if (services.isEmpty()) {
            return 1;
        }
        return service.getVersion();
    } else {
        SortedSet<? extends Access.Service> services = ((OSClientSession.OSClientSessionV2) session).getAccess().getAggregatedCatalog().get(serviceType.getType());
        Access.Service service = ((OSClientSession.OSClientSessionV2) session).getAccess().getAggregatedCatalog().get(serviceType.getType()).first();
        if (services.isEmpty()) {
            return 1;
        }
        return service.getVersion();
    }
}
Also used : Access(org.openstack4j.model.identity.v2.Access) Service(org.openstack4j.model.identity.v3.Service)

Example 4 with Service

use of com.google.cloud.servicedirectory.v1.Service in project carbon-apimgt by wso2.

the class WSDL20ProcessorImpl method updateEndpointsOfSingleWSDL.

/**
 * Update the endpoint information of the provided WSDL definition when an API and the environment details are
 * provided
 *
 * @param api API
 * @param environmentName name of the gateway environment
 * @param environmentType type of the gateway environment
 * @param wsdlDescription WSDL 2.0 definition
 * @throws APIMgtWSDLException when error occurred while updating the endpoints
 */
private void updateEndpointsOfSingleWSDL(API api, String environmentName, String environmentType, Description wsdlDescription) throws APIMgtWSDLException {
    Service[] serviceMap = wsdlDescription.getServices();
    String organization = api.getOrganization();
    try {
        for (Service svc : serviceMap) {
            Endpoint[] portMap = svc.getEndpoints();
            for (Endpoint endpoint : portMap) {
                EndpointElement element = endpoint.toElement();
                String endpointTransport = determineURLTransport(endpoint.getAddress().getScheme(), api.getTransports());
                setAddressUrl(element, new URI(APIUtil.getGatewayEndpoint(endpointTransport, environmentName, environmentType, organization) + api.getContext()));
            }
        }
    } catch (URISyntaxException | APIManagementException e) {
        throw new APIMgtWSDLException("Error while setting gateway access URLs in the WSDL", e);
    }
}
Also used : Endpoint(org.apache.woden.wsdl20.Endpoint) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) APIMgtWSDLException(org.wso2.carbon.apimgt.impl.wsdl.exceptions.APIMgtWSDLException) Service(org.apache.woden.wsdl20.Service) URISyntaxException(java.net.URISyntaxException) EndpointElement(org.apache.woden.wsdl20.xml.EndpointElement) URI(java.net.URI)

Example 5 with Service

use of com.google.cloud.servicedirectory.v1.Service in project carbon-apimgt by wso2.

the class WSDL20ProcessorImpl method getEndpoints.

/**
 * Get endpoints defined in the provided WSDL description.
 *
 * @param description WSDL 2.0 description
 * @return a Map of endpoint names and their URIs.
 * @throws APIMgtWSDLException if error occurs while reading endpoints
 */
private Map<String, String> getEndpoints(Description description) throws APIMgtWSDLException {
    Service[] services = description.getServices();
    Map<String, String> serviceEndpointMap = new HashMap<>();
    for (Service service : services) {
        Endpoint[] endpoints = service.getEndpoints();
        for (Endpoint endpoint : endpoints) {
            serviceEndpointMap.put(endpoint.getName().toString(), endpoint.getAddress().toString());
        }
    }
    return serviceEndpointMap;
}
Also used : Endpoint(org.apache.woden.wsdl20.Endpoint) HashMap(java.util.HashMap) Service(org.apache.woden.wsdl20.Service)

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 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 RegistrationServiceClient (com.google.cloud.servicedirectory.v1.RegistrationServiceClient)3 ServiceName (com.google.cloud.servicedirectory.v1.ServiceName)3 AbstractMessage (com.google.protobuf.AbstractMessage)3 Endpoint (org.apache.woden.wsdl20.Endpoint)3 Service (org.apache.woden.wsdl20.Service)3 Test (org.junit.Test)3 Service (org.openstack4j.model.identity.v3.Service)3 MockGrpcService (com.google.api.gax.grpc.testing.MockGrpcService)2 Endpoint (com.google.cloud.servicedirectory.v1.Endpoint)2 ListServicesPagedResponse (com.google.cloud.servicedirectory.v1.RegistrationServiceClient.ListServicesPagedResponse)2 HashMap (java.util.HashMap)2