当前位置: 首页>>代码示例>>Java>>正文


Java Subscriber类代码示例

本文整理汇总了Java中org.fosstrak.ale.server.Subscriber的典型用法代码示例。如果您正苦于以下问题:Java Subscriber类的具体用法?Java Subscriber怎么用?Java Subscriber使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Subscriber类属于org.fosstrak.ale.server包,在下文中一共展示了Subscriber类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: unsubscribe

import org.fosstrak.ale.server.Subscriber; //导入依赖的package包/类
/**
 * This method unsubscribes a notification uri of a subscriber from this 
 * report generator.
 * @param notificationURI to unsubscribe
 * @throws NoSuchSubscriberException if the specified notification uri is 
 * not yet subscribed
 * @throws InvalidURIException if the notification uri is invalid
 */
@Override
public void unsubscribe(String notificationURI) throws NoSuchSubscriberException, InvalidURIException {
	// validate the URI:
	new Subscriber(notificationURI);
	
	if (subscribers.containsKey(notificationURI)) {
		subscribers.remove(notificationURI);
		LOG.debug("NotificationURI '" + notificationURI	+ "' unsubscribed from spec '" + name + "'.");
		
		if (subscribers.isEmpty() && !isPolling()) {
			setState(ReportsGeneratorState.UNREQUESTED);
		}
	} else {
		throw new NoSuchSubscriberException("there is no subscriber on the given notification URI: " + notificationURI);
	}
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:25,代码来源:ReportsGeneratorImpl.java

示例2: subscribe

import org.fosstrak.ale.server.Subscriber; //导入依赖的package包/类
/**
 * This method subscribes a notification uri of a subscriber to this 
 * report generator. 
 * @param notificationURI to subscribe
 * @throws DuplicateSubscriptionException if the specified notification uri 
 * is already subscribed
 * @throws InvalidURIException if the notification uri is invalid
 */
@Override
public void subscribe(String notificationURI) throws DuplicateSubscriptionException, InvalidURIException {
	
	Subscriber uri = new Subscriber(notificationURI);
	if (subscribers.containsKey(notificationURI)) {
		throw new DuplicateSubscriptionException(String.format("the URI is already subscribed on this specification %s, %s", name, uri));
	} else {
		subscribers.put(notificationURI, uri);
		LOG.debug("NotificationURI '" + notificationURI + "' subscribed to spec '" + name + "'.");
		if (isStateUnRequested()) {
			setState(ReportsGeneratorState.REQUESTED);
		}
	}
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:23,代码来源:ReportsGeneratorImpl.java

示例3: notifySubscribersWithFilteredReports

import org.fosstrak.ale.server.Subscriber; //导入依赖的package包/类
/**
 * once all the filtering is done eventually notify the subscribers with the reports.
 * @param reports the filtered reports.
 */
protected void notifySubscribersWithFilteredReports(ECReports reports) {
	// notify subscribers 
	for (Subscriber listener : subscribers.values()) {
		try {
			listener.notify(reports);
		} catch (Exception e) {
			LOG.error("Could not notify subscriber '" + listener.toString(), e);
		}
	}
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:15,代码来源:ReportsGeneratorImpl.java

示例4: testNotify

import org.fosstrak.ale.server.Subscriber; //导入依赖的package包/类
@Test
public void testNotify() throws InvalidURIException, ImplementationException {
	ECReports reports = ECElementsUtils.createECReports();
	SubscriberOutputChannel mock = EasyMock.createMock(SubscriberOutputChannel.class);
	EasyMock.expect(mock.notify(reports)).andReturn(true);
	EasyMock.replay(mock);
	
	Subscriber subscriber = new Subscriber("file:///dir");
	subscriber.setSubscriberOutputChannel(mock);
	subscriber.notify(reports);
	
	EasyMock.verify(mock);
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:14,代码来源:NotificationListenerTest.java

示例5: run

import org.fosstrak.ale.server.Subscriber; //导入依赖的package包/类
@Override
public void run() {
	LOG.info("notify subscribers at time "+System.currentTimeMillis());
	// notify subscribers 
	for (Subscriber listener : subscribers.values()) {
		try {
			listener.notify(reports);
		} catch (Exception e) {
			LOG.error("Could not notify subscriber '" + listener.toString(), e);
		}
	}
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:13,代码来源:ReportsGeneratorImpl.java

示例6: testHttpURIs

import org.fosstrak.ale.server.Subscriber; //导入依赖的package包/类
@Test
public void testHttpURIs() throws Exception {		
	Subscriber listener = new Subscriber("http://localhost:123456");
	Assert.assertTrue(listener.isHttp());
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:6,代码来源:NotificationListenerTest.java

示例7: testTcpURIs

import org.fosstrak.ale.server.Subscriber; //导入依赖的package包/类
@Test
public void testTcpURIs() throws Exception {		
	Subscriber listener = new Subscriber("tcp://localhost:123456");
	Assert.assertTrue(listener.isTcp());	
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:6,代码来源:NotificationListenerTest.java

示例8: testFileURIs

import org.fosstrak.ale.server.Subscriber; //导入依赖的package包/类
@Test
public void testFileURIs() throws Exception {		
	Subscriber listener = new Subscriber("file:///dir");
	Assert.assertTrue(listener.isFile());
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:6,代码来源:NotificationListenerTest.java

示例9: testInvalidURI_invalidProtocol

import org.fosstrak.ale.server.Subscriber; //导入依赖的package包/类
@Test(expected = InvalidURIException.class)
public void testInvalidURI_invalidProtocol() throws InvalidURIException {
	new Subscriber("htt://myhost.com");
}
 
开发者ID:Auto-ID-Lab-Japan,项目名称:fosstrak-fc,代码行数:5,代码来源:NotificationListenerTest.java

示例10: NotificationThread

import org.fosstrak.ale.server.Subscriber; //导入依赖的package包/类
public NotificationThread(ECReports reports, Map<String, Subscriber> subscribers) {
	this.reports = reports;
	this.subscribers = subscribers;
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:5,代码来源:ReportsGeneratorImpl.java


注:本文中的org.fosstrak.ale.server.Subscriber类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。