All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.granite.client.messaging.channel.Channel Maven / Gradle / Ivy

The newest version!
/*
  GRANITE DATA SERVICES
  Copyright (C) 2012 GRANITE DATA SERVICES S.A.S.

  This file is part of Granite Data Services.

  Granite Data Services is free software; you can redistribute it and/or modify
  it under the terms of the GNU Library General Public License as published by
  the Free Software Foundation; either version 2 of the License, or (at your
  option) any later version.

  Granite Data Services is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
  for more details.

  You should have received a copy of the GNU Library General Public License
  along with this library; if not, see .
*/

package org.granite.client.messaging.channel;

import java.io.InputStream;
import java.net.URI;

import org.granite.client.messaging.ResponseListener;
import org.granite.client.messaging.messages.RequestMessage;
import org.granite.client.messaging.transport.Transport;
import org.granite.client.messaging.transport.TransportMessage;

/**
 * @author Franck WOLFF
 */
public interface Channel {
	
    public static final String RECONNECT_INTERVAL_MS_KEY = "reconnect-interval-ms";
    public static final String RECONNECT_MAX_ATTEMPTS_KEY = "reconnect-max-attempts";
    
    public static final String BYTEARRAY_BODY_HEADER = "GDS_BYTEARRAY_BODY";    

	Transport getTransport();
	String getId();
	URI getUri();
	String getClientId();
	
	boolean start();
	boolean isStarted();
	boolean stop();
	
	void setCredentials(Credentials credentials);
	Credentials getCredentials();
	boolean isAuthenticated();
	
	ResponseMessageFuture send(RequestMessage request, ResponseListener... listeners);
	ResponseMessageFuture logout(ResponseListener... listeners);
	
	 D getTransportData();
	void setTransportData(Object data);

	void onMessage(InputStream is);
	void onError(TransportMessage message, Exception e);
	void onCancelled(TransportMessage message);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy