Search in sources :

Example 1 with Port

use of org.eclipse.jst.server.generic.servertype.definition.Port in project webtools.servertools by eclipse.

the class GenericServer method getServerPorts.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.wst.server.core.model.IMonitorableServer#getServerPorts()
	 */
public org.eclipse.wst.server.core.ServerPort[] getServerPorts() {
    List<ServerPort> ports = new ArrayList<ServerPort>();
    Iterator pIter = this.getServerDefinition().getPort().iterator();
    while (pIter.hasNext()) {
        Port element = (Port) pIter.next();
        int port = Integer.parseInt(getServerDefinition().getResolver().resolveProperties(element.getNo()));
        // $NON-NLS-1$
        ports.add(new ServerPort("server", element.getName(), port, element.getProtocol()));
    }
    return ports.toArray(new org.eclipse.wst.server.core.ServerPort[ports.size()]);
}
Also used : Port(org.eclipse.jst.server.generic.servertype.definition.Port) ServerPort(org.eclipse.wst.server.core.ServerPort) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ServerPort(org.eclipse.wst.server.core.ServerPort)

Example 2 with Port

use of org.eclipse.jst.server.generic.servertype.definition.Port in project webtools.servertools by eclipse.

the class GenericServer method getHttpPort.

/**
 * Return http port
 * @return port
 */
protected int getHttpPort() {
    int port = -1;
    Iterator pIter = this.getServerDefinition().getPort().iterator();
    while (pIter.hasNext()) {
        Port aPort = (Port) pIter.next();
        if (port == -1)
            port = Integer.parseInt(getServerDefinition().getResolver().resolveProperties(aPort.getNo()));
        else if (// $NON-NLS-1$
        "http".equals(aPort.getProtocol()))
            port = Integer.parseInt(aPort.getNo());
    }
    if (port == -1)
        port = 8080;
    return port;
}
Also used : Port(org.eclipse.jst.server.generic.servertype.definition.Port) ServerPort(org.eclipse.wst.server.core.ServerPort) Iterator(java.util.Iterator)

Example 3 with Port

use of org.eclipse.jst.server.generic.servertype.definition.Port in project webtools.servertools by eclipse.

the class ServerTypeDefinitionModelTest method testPort.

public void testPort() {
    Port port = (Port) subject.getPort().get(0);
    assertNotNull(port);
    assertNotNull(port.getName());
    assertTrue(port.getNo() != null && port.getNo().length() > 0);
    assertTrue(port.getProtocol() != null && port.getProtocol().length() > 0);
}
Also used : Port(org.eclipse.jst.server.generic.servertype.definition.Port)

Aggregations

Port (org.eclipse.jst.server.generic.servertype.definition.Port)3 Iterator (java.util.Iterator)2 ServerPort (org.eclipse.wst.server.core.ServerPort)2 ArrayList (java.util.ArrayList)1