/*
 *  Copyright (C) 2006  Takashi Kasuya <kasuya@sfc.keio.ac.jp>
 *
 * This library is free software; you can redistribute it and/or
 *　modify it under the terms of the GNU Lesser General Public
 *　License as published by the Free Software Foundation; either
 *　version 2.1 of the License, or (at your option) any later version.
 *　This library 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
 *　Lesser General Public License for more details.
 *
 *　You should have received a copy of the GNU Lesser General Public
 *　License along with this library; if not, write to the Free Software
 *　Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

package jp.ac.naka.ec.entity;

import javax.sdp.SessionDescription;
import javax.sip.address.SipURI;

import jp.ac.naka.ec.Location;
import jp.ac.naka.ec.sensor.SensorData;

/**
 * 
 * @author Takashi Kasuya
 * 
 */
public interface Entity extends EntityListener {

	/**
	 * SDPを指定してセッションのリクエスト
	 * 
	 * @param sdp
	 * @param target
	 * @return
	 */
	public boolean sendOffer(SessionDescription sdp, Entity target);

	/**
	 * SDPを指定せずにリクエスト、相手のSDPによるフォーマットの指定に従う。
	 * 
	 * @param target
	 * @return
	 */
	public boolean sendOffer(Entity target);

	/**
	 * メッセージを全てのリスナに対して配信
	 * 
	 * @param msg
	 */
	public boolean sendMessage(String msg);

	
	/**
	 * ターゲットを指定してメッセージの送信
	 * 
	 * @param msg
	 * @param targetName
	 */
	public boolean sendMessage(String msg, Entity target);

	/**
	 * BYEメッセージの送信
	 * 
	 * @param target
	 * @return
	 */
	public boolean sendBye(Entity target);

	/**
	 * EntityTypeの取得
	 * 
	 * @return
	 */
	public EntityType getEntityType();

	/**
	 * 
	 * @param type
	 */
	public void setEntityType(EntityType type);

	/**
	 * 所属するEntityContainerの取得
	 * 
	 * @return
	 */
	public EntityContainer getContainer();
	public void setEntityContainer(EntityContainer impl);
	public void setDescrpition(String description);
	public String getDescription();
	public void setName(String name);
	public String getName();
	public void setLocal(boolean b);
	public void addKeyword(String str);
	public String[] getKeywords();


	/**
	 * SUBSCRIBE送信
	 * 
	 * 
	 */
	public boolean subscribe(Entity target);
	public boolean unsubscribe(Entity target);
	
	public Location getLocation();
	public void setLocation (Location location);

	/**
	 * ローカルにあるEntityかどうか。
	 * 
	 * @return
	 */
	public boolean isLocal();

	/**
	 * 
	 * @param uri
	 */
	public void setURI(SipURI uri);

	/**
	 * 
	 * @return
	 */
	public SipURI getURI();

	public SipURI getContactURI();
	public void setContactURI(SipURI uri);
	
	public String createPIDF();

	public boolean removeSensorData(SensorData sensor);
	public void addSensorData(SensorData sensor);
	public SensorData[] getSensors();

}
