package org.ow2.chameleon.rose.pubsubhubbub.hub;

import java.util.Map;

import org.osgi.service.remoteserviceadmin.EndpointDescription;


/**
 * Keep all informations about registered rss topics with related endpoints and
 * subscribers with related endpoints filters.
 * 
 * @author Bartek
 * 
 */
public interface Registrations {

	/**Add new topic (publisher registers topic).
	 * @param rssURL publisher rss topic url
	 * @param machineID ID of given machine
	 */
	void addTopic(final String rssURL, final String machineID);

	/**
	 * Add endpoint to topic.
	 * 
	 * @param rssUrl
	 *            publisher rss topic url
	 * @param endp
	 * {@link EndpointDescription} description to add
	 */
	void addEndpointByTopicRssUrl(final String rssUrl,
			final EndpointDescription endp);

	/**
	 * Add endpoint to topic.
	 * 
	 * @param machineID
	 *            publisher machineID
	 * @param endp
	 *            the {@link EndpointDescription} description to add
	 * @return true if new  {@link EndpointDescription} added; false otherwise 
	 */
	boolean addEndpointByMachineID(final String machineID,
			final EndpointDescription endp);

	/**
	 * Remove endpoint to topic.
	 * 
	 * @param rssUrl
	 *            publisher rss topic url
	 * @param endp
	 *            the {@link EndpointDescription} description to remove
	 */
	void removeEndpointByTopicRssUrl(final String rssUrl,
			final EndpointDescription endp);

	/**
	 * Create new subscription with endpoint filter.
	 * 
	 * @param callBackUrl
	 *            subscriber full url address to send notifications
	 * @param endpointFilter
	 *            filter to specify endpoints
	 */
	void addSubscriber(final String callBackUrl,
			final String endpointFilter);

	/**
	 * Remove subscription.
	 * 
	 * @param callBackUrl
	 *            subscriber full url address to send notifications
	 */
	void removeSubscriber(final String callBackUrl);

	/**
	 * Provides all registered @EndpointSescription with MachineID.
	 * 
	 * @return all @EndpointSescription as Map collection, key as index
	 */
	Map<EndpointDescription, String> getAllEndpoints();

	/** Removes endpoint.
	 * @param machineID publisher machineId
	 * @param endpointId Endpoint id
	 * @return if endpoints deleted
	 */
	boolean removeEndpoint(String machineID, long endpointId);
	
	/** Retrieves publishers machineID by rss url 
	 * @param publisher publisher`s RSS url
	 * @return publisher`s machineID
	 */
	String getPublisherMachineIdByRssUrl(String publisher);

}

@@ -137,18 +137,16 @@
 ion;%0D%0A%0D%0A
-%0D%0A
 /**%0D%0A * 
@@ -345,16 +345,22 @@
 %0D%0A%0D%0A%09/**
+%0D%0A%09 * 
 Add new 
@@ -395,16 +395,22 @@
 opic).%0D%0A
+%09 * %0D%0A
 %09 * @par
@@ -418,16 +418,32 @@
 m rssURL
+%0D%0A%09 *           
  publish
@@ -480,16 +480,32 @@
 achineID
+%0D%0A%09 *           
  ID of g
@@ -518,16 +518,105 @@
 achine%0D%0A
+%09 * @param callbackUrl%0D%0A%09 *            publisher full url address to send notifications%0D%0A
 %09 */%0D%0A%09v
@@ -671,16 +671,46 @@
 achineID
+,%0D%0A%09%09%09final String callbackUrl
 );%0D%0A%0D%0A%09/
@@ -826,16 +826,27 @@
 ndp%0D%0A%09 *
+           
  %7B@link 
@@ -1190,17 +1190,16 @@
  if new 
- 
 %7B@link E
@@ -1240,17 +1240,16 @@
 therwise
- 
 %0D%0A%09 */%0D%0A
@@ -1858,16 +1858,75 @@
 points%0D%0A
+%09 * @param machineID%0D%0A%09 *            subscriber machineID%0D%0A
 %09 */%0D%0A%09v
@@ -1964,29 +1964,25 @@
 callBackUrl,
-%0D%0A%09%09%09
+ 
 final String
@@ -1996,16 +1996,44 @@
 ntFilter
+,%0D%0A%09%09%09final String machineID
 );%0D%0A%0D%0A%09/
@@ -2431,16 +2431,21 @@
 %0D%0A%0D%0A%09/**
+%0D%0A%09 *
  Removes
@@ -2456,16 +2456,22 @@
 point.%0D%0A
+%09 * %0D%0A
 %09 * @par
@@ -2482,16 +2482,32 @@
 achineID
+%0D%0A%09 *           
  publish
@@ -2541,16 +2541,32 @@
 dpointId
+%0D%0A%09 *           
  Endpoin
@@ -2676,15 +2676,19 @@
 );%0D%0A
-%09
 %0D%0A%09/**
+%0D%0A%09 *
  Ret
@@ -2725,16 +2725,21 @@
  rss url
+%0D%0A%09 *
  %0D%0A%09 * @
@@ -2753,16 +2753,32 @@
 ublisher
+%0D%0A%09 *           
  publish
@@ -2892,11 +2892,249 @@
 er);%0D%0A%0D%0A
+%09/**%0D%0A%09 * @return registered subscribers, connection url and machineID%0D%0A%09 */%0D%0A%09Map%3CString, String%3E getSubscribers();%0D%0A%0D%0A%09/**%0D%0A%09 * @return registered publishers, connection url and machineID%0D%0A%09 */%0D%0A%09Map%3CString, String%3E getPublishers();%0D%0A%0D%0A
 %7D%0D%0A

fix in api