Search in sources :

Example 1 with Service

use of org.apache.woden.wsdl20.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 org.apache.woden.wsdl20.Service in project netvirt by opendaylight.

the class PolicyAceFlowProgrammer method getPolicyAceFlowWrapper.

private Optional<PolicyAceFlowWrapper> getPolicyAceFlowWrapper(Matches matches) {
    IngressInterface ingressInterface = matches.getAugmentation(IngressInterface.class);
    if (ingressInterface != null) {
        Optional<PolicyAceFlowWrapper> interfaceFlowOpt = getIngressInterfaceFlow(ingressInterface);
        if (interfaceFlowOpt.isPresent()) {
            return interfaceFlowOpt;
        }
    }
    Service service = matches.getAugmentation(Service.class);
    if (service != null) {
        Optional<PolicyAceFlowWrapper> serviceFlowOpt = getPolicyServiceFlow(service);
        if (serviceFlowOpt.isPresent()) {
            return serviceFlowOpt;
        }
    }
    return Optional.absent();
}
Also used : IngressInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.IngressInterface) Service(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.Service)

Example 3 with Service

use of org.apache.woden.wsdl20.Service in project webtools.servertools by eclipse.

the class Tomcat85Configuration method modifyServerPort.

/**
 * Modify the port with the given id.
 *
 * @param id java.lang.String
 * @param port int
 */
public void modifyServerPort(String id, int port) {
    try {
        if ("server".equals(id)) {
            server.setPort(port + "");
            isServerDirty = true;
            firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
            return;
        }
        int i = id.indexOf("/");
        // If a connector in the instance Service
        if (i < 0) {
            int connNum = Integer.parseInt(id);
            Connector connector = serverInstance.getConnector(connNum);
            if (connector != null) {
                connector.setPort(port + "");
                isServerDirty = true;
                firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
            }
        } else // Else a connector in another Service
        {
            int servNum = Integer.parseInt(id.substring(0, i));
            int connNum = Integer.parseInt(id.substring(i + 1));
            Service service = server.getService(servNum);
            Connector connector = service.getConnector(connNum);
            connector.setPort(port + "");
            isServerDirty = true;
            firePropertyChangeEvent(MODIFY_PORT_PROPERTY, id, new Integer(port));
        }
    } catch (Exception e) {
        Trace.trace(Trace.SEVERE, "Error modifying server port " + id, e);
    }
}
Also used : Connector(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector) Service(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service) CoreException(org.eclipse.core.runtime.CoreException)

Example 4 with Service

use of org.apache.woden.wsdl20.Service in project webtools.servertools by eclipse.

the class Tomcat85Configuration method getServerPorts.

/**
 * Returns a list of ServerPorts that this configuration uses.
 *
 * @return java.util.List
 */
public List getServerPorts() {
    List<ServerPort> ports = new ArrayList<ServerPort>();
    // first add server port
    try {
        int port = Integer.parseInt(server.getPort());
        ports.add(new ServerPort("server", Messages.portServer, port, "TCPIP"));
    } catch (Exception e) {
    // ignore
    }
    // add connectors
    try {
        String instanceServiceName = serverInstance.getService().getName();
        int size = server.getServiceCount();
        for (int i = 0; i < size; i++) {
            Service service = server.getService(i);
            int size2 = service.getConnectorCount();
            for (int j = 0; j < size2; j++) {
                Connector connector = service.getConnector(j);
                String name = "HTTP/1.1";
                String protocol2 = "HTTP";
                boolean advanced = true;
                String[] contentTypes = null;
                int port = -1;
                try {
                    port = Integer.parseInt(connector.getPort());
                } catch (Exception e) {
                // ignore
                }
                String protocol = connector.getProtocol();
                if (protocol != null && protocol.length() > 0) {
                    if (protocol.startsWith("HTTP")) {
                        name = protocol;
                    } else if (protocol.startsWith("AJP")) {
                        name = protocol;
                        protocol2 = "AJP";
                    } else {
                        // Get Tomcat equivalent name if protocol handler class specified
                        name = protocolHandlerMap.get(protocol);
                        if (name != null) {
                            // Prepare simple protocol string for ServerPort protocol
                            int index = name.indexOf('/');
                            if (index > 0)
                                protocol2 = name.substring(0, index);
                            else
                                protocol2 = name;
                        } else // Specified protocol is unknown, just use as is
                        {
                            name = protocol;
                            protocol2 = protocol;
                        }
                    }
                }
                if (protocol2.toLowerCase().equals("http"))
                    contentTypes = new String[] { "web", "webservices" };
                String secure = connector.getSecure();
                if (secure != null && secure.length() > 0) {
                    name = "SSL";
                    protocol2 = "SSL";
                } else
                    advanced = false;
                String portId;
                if (instanceServiceName != null && instanceServiceName.equals(service.getName()))
                    portId = Integer.toString(j);
                else
                    portId = i + "/" + j;
                ports.add(new ServerPort(portId, name, port, protocol2, contentTypes, advanced));
            }
        }
    } catch (Exception e) {
        Trace.trace(Trace.SEVERE, "Error getting server ports", e);
    }
    return ports;
}
Also used : Connector(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector) ArrayList(java.util.ArrayList) Service(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service) ServerPort(org.eclipse.wst.server.core.ServerPort) CoreException(org.eclipse.core.runtime.CoreException)

Example 5 with Service

use of org.apache.woden.wsdl20.Service in project webtools.servertools by eclipse.

the class Tomcat50Configuration method getServerPorts.

/**
 * Returns a list of ServerPorts that this configuration uses.
 *
 * @return java.util.List
 */
public List getServerPorts() {
    List<ServerPort> ports = new ArrayList<ServerPort>();
    // first add server port
    try {
        int port = Integer.parseInt(server.getPort());
        ports.add(new ServerPort("server", Messages.portServer, port, "TCPIP"));
    } catch (Exception e) {
    // ignore
    }
    // add connectors
    try {
        String instanceServiceName = serverInstance.getService().getName();
        int size = server.getServiceCount();
        for (int i = 0; i < size; i++) {
            Service service = server.getService(i);
            int size2 = service.getConnectorCount();
            for (int j = 0; j < size2; j++) {
                Connector connector = service.getConnector(j);
                String name = "HTTP/1.1";
                String protocol2 = "HTTP";
                boolean advanced = true;
                String[] contentTypes = null;
                int port = -1;
                try {
                    port = Integer.parseInt(connector.getPort());
                } catch (Exception e) {
                // ignore
                }
                String protocol = connector.getProtocol();
                if (protocol != null && protocol.length() > 0) {
                    if (protocol.startsWith("HTTP")) {
                        name = protocol;
                    } else if (protocol.startsWith("AJP")) {
                        name = protocol;
                        protocol2 = "AJP";
                    } else {
                        // Get Tomcat equivalent name if protocol handler class specified
                        name = protocolHandlerMap.get(protocol);
                        if (name != null) {
                            // Prepare simple protocol string for ServerPort protocol
                            int index = name.indexOf('/');
                            if (index > 0)
                                protocol2 = name.substring(0, index);
                            else
                                protocol2 = name;
                        } else // Specified protocol is unknown, just use as is
                        {
                            name = protocol;
                            protocol2 = protocol;
                        }
                    }
                }
                if (protocol2.toLowerCase().equals("http"))
                    contentTypes = new String[] { "web", "webservices" };
                String secure = connector.getSecure();
                if (secure != null && secure.length() > 0) {
                    name = "SSL";
                    protocol2 = "SSL";
                } else
                    advanced = false;
                String portId;
                if (instanceServiceName != null && instanceServiceName.equals(service.getName()))
                    portId = Integer.toString(j);
                else
                    portId = i + "/" + j;
                ports.add(new ServerPort(portId, name, port, protocol2, contentTypes, advanced));
            }
        }
    } catch (Exception e) {
        Trace.trace(Trace.SEVERE, "Error getting server ports", e);
    }
    return ports;
}
Also used : Connector(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Connector) ArrayList(java.util.ArrayList) Service(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Service) ServerPort(org.eclipse.wst.server.core.ServerPort) CoreException(org.eclipse.core.runtime.CoreException)

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