Search in sources :

Example 1 with HttpTransportManager

use of org.jumpmind.symmetric.transport.http.HttpTransportManager in project symmetric-ds by JumpMind.

the class TransportManagerFactory method create.

public ITransportManager create(String transport) {
    if (Constants.PROTOCOL_HTTP.equalsIgnoreCase(transport)) {
        String httpSslVerifiedServerNames = symmetricEngine.getParameterService().getString(ServerConstants.HTTPS_VERIFIED_SERVERS);
        // Allow self signed certs based on the parameter value.
        boolean allowSelfSignedCerts = symmetricEngine.getParameterService().is(ServerConstants.HTTPS_ALLOW_SELF_SIGNED_CERTS, false);
        initHttps(httpSslVerifiedServerNames, allowSelfSignedCerts);
        return new HttpTransportManager(symmetricEngine);
    } else if (Constants.PROTOCOL_FILE.equalsIgnoreCase(transport)) {
        return new FileTransportManager(symmetricEngine);
    } else if (Constants.PROTOCOL_INTERNAL.equalsIgnoreCase(transport)) {
        return new InternalTransportManager(symmetricEngine);
    } else {
        throw new IllegalStateException("An invalid transport type of " + transport + " was specified.");
    }
}
Also used : FileTransportManager(org.jumpmind.symmetric.transport.file.FileTransportManager) InternalTransportManager(org.jumpmind.symmetric.transport.internal.InternalTransportManager) HttpTransportManager(org.jumpmind.symmetric.transport.http.HttpTransportManager)

Example 2 with HttpTransportManager

use of org.jumpmind.symmetric.transport.http.HttpTransportManager in project symmetric-ds by JumpMind.

the class SymmetricPushClient method close.

public BatchAck close() {
    try {
        writer.end(batch, false);
        BufferedReader reader = transport.readResponse();
        String ackString = reader.readLine();
        String ackExtendedString = reader.readLine();
        log.debug("Reading ack: {}", ackString);
        log.debug("Reading extend ack: {}", ackExtendedString);
        List<BatchAck> batchAcks = new HttpTransportManager().readAcknowledgement(ackString, ackExtendedString);
        if (batchAcks.size() > 0) {
            return batchAcks.get(0);
        } else {
            return null;
        }
    } catch (IOException ex) {
        throw new IoException(ex);
    } finally {
        transport.close();
    }
}
Also used : BatchAck(org.jumpmind.symmetric.model.BatchAck) BufferedReader(java.io.BufferedReader) IoException(org.jumpmind.exception.IoException) IOException(java.io.IOException) HttpTransportManager(org.jumpmind.symmetric.transport.http.HttpTransportManager)

Aggregations

HttpTransportManager (org.jumpmind.symmetric.transport.http.HttpTransportManager)2 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 IoException (org.jumpmind.exception.IoException)1 BatchAck (org.jumpmind.symmetric.model.BatchAck)1 FileTransportManager (org.jumpmind.symmetric.transport.file.FileTransportManager)1 InternalTransportManager (org.jumpmind.symmetric.transport.internal.InternalTransportManager)1