本文整理汇总了Java中org.jivesoftware.openfire.pubsub.PubSubService类的典型用法代码示例。如果您正苦于以下问题:Java PubSubService类的具体用法?Java PubSubService怎么用?Java PubSubService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PubSubService类属于org.jivesoftware.openfire.pubsub包,在下文中一共展示了PubSubService类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMySubscriptions
import org.jivesoftware.openfire.pubsub.PubSubService; //导入依赖的package包/类
@GET
@Path("my_subscriptions")
@Produces(MediaType.APPLICATION_JSON)
public Response getMySubscriptions(@Context HttpHeaders headers) {
TokenInfo tokenInfo = RestUtils.getAuthTokenInfo(headers);
if (tokenInfo == null) {
return RestUtils.getUnauthJAXRSResp();
}
JID from = RestUtils.createJID(tokenInfo);
JID owner = from.asBareJID();
String appId = tokenInfo.getMmxAppId();
try {
long startTime = System.nanoTime();
PubSubService service = XMPPServer.getInstance().getPubSubModule();
List<ChannelSubscription> subList = new ArrayList<ChannelSubscription>();
CollectionNode appNode = (CollectionNode) service.getNode(appId);
if (appNode != null) {
for (Node node : appNode.getNodes()) {
Collection<NodeSubscription> subscriptions = node.getSubscriptions(owner);
for (NodeSubscription sub : subscriptions) {
ChannelSubscription info = ChannelSubscription.build(sub);
subList.add(info);
}
}
}
long endTime = System.nanoTime();
LOGGER.info("Completed processing getSubscriptions in {} milliseconds",
TimeUnit.MILLISECONDS.convert((endTime - startTime), TimeUnit.NANOSECONDS));
return RestUtils.getOKJAXRSResp(subList);
} catch (WebApplicationException e) {
throw e;
} catch (Throwable t) {
LOGGER.warn("Throwable during getSubscriptionsForChannels", t);
ErrorResponse response = new ErrorResponse(ErrorCode.SEARCH_TOPIC_ISE, t
.getMessage());
return RestUtils.getInternalErrorJAXRSResp(response);
}
}
示例2: getService
import org.jivesoftware.openfire.pubsub.PubSubService; //导入依赖的package包/类
public PubSubService getService()
{
if (XMPPServer.getInstance().getPubSubModule().getServiceID().equals(serviceId))
return XMPPServer.getInstance().getPubSubModule();
else
{
PEPServiceManager serviceMgr = XMPPServer.getInstance().getIQPEPHandler().getServiceManager();
return serviceMgr.hasCachedService(new JID(serviceId)) ? serviceMgr.getPEPService(serviceId) : null;
}
}
示例3: getService
import org.jivesoftware.openfire.pubsub.PubSubService; //导入依赖的package包/类
public PubSubService getService()
{
if (Node.PUBSUB_SVC_ID.equals(serviceId))
return XMPPServer.getInstance().getPubSubModule();
else
{
PEPServiceManager serviceMgr = XMPPServer.getInstance().getIQPEPHandler().getServiceManager();
return serviceMgr.hasCachedService(new JID(serviceId)) ? serviceMgr.getPEPService(serviceId) : null;
}
}
示例4: getItemsByIds
import org.jivesoftware.openfire.pubsub.PubSubService; //导入依赖的package包/类
@Path("/byids")
@GET
@Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN})
public Response getItemsByIds(@Context HttpHeaders headers,
@PathParam(MMXServerConstants.TOPICNAME_PATH_PARAM) String topicName,
@QueryParam(ID_KEY) List<String> idList) {
try {
ErrorResponse errorResponse = isAuthenticated(headers, DBUtil.getAppDAO());
if (errorResponse != null) {
return errorResponse.toJaxRSResponse();
}
MultivaluedMap<String, String> requestHeaders = headers.getRequestHeaders();
String appId = requestHeaders.getFirst(MMXServerConstants.HTTP_HEADER_APP_ID);
if (idList == null || idList.isEmpty()) {
throw buildForBadRequest(ErrorCode.TOPIC_ITEMS_BY_ID.getCode(), ErrorMessages.ERROR_ITEM_ID_LIST_INVALID);
}
PubSubService pubSubService = getPubSubService();
String topic = TopicHelper.normalizePath(topicName);
// MMX-3207 handle user topic.
MMXTopicId topicId = TopicResource.nameToId(topicName);
String realTopic = TopicHelper.makeTopic(appId, topicId.getEscUserId(), topicId.getName());
Node node = pubSubService.getNode(realTopic);
if (node == null || node.isCollectionNode()) {
LOGGER.info("Topic with name:{} not found", topicName);
String message = String.format(ErrorMessages.ERROR_TOPIC_NOT_FOUND, topicName);
throw buildWebApplicationException(ErrorCode.TOPIC_ITEMS_BY_ID.getCode(), message, Response.Status.NOT_FOUND);
}
JID creator = node.getCreator();
MMXTopicManager topicManager = MMXTopicManager.getInstance();
TopicAction.FetchResponse itemList = topicManager.getItems(creator, appId, new TopicAction.ItemsByIdsRequest(null, topicName, idList));
return Response.status(Response.Status.OK).entity(itemList).build();
} catch (WebApplicationException e) {
throw e;
} catch (Throwable t) {
LOGGER.warn("Throwable during getItems", t);
throw new WebApplicationException(
Response
.status(Response.Status.INTERNAL_SERVER_ERROR)
.entity(new ErrorResponse(ErrorCode.SEND_PUSH_MESSAGE_ISE, t.getMessage()))
.build()
);
}
}
示例5: getPubSubService
import org.jivesoftware.openfire.pubsub.PubSubService; //导入依赖的package包/类
private PubSubService getPubSubService() {
XMPPServer mServer = XMPPServer.getInstance();
PubSubService mPubSubModule = mServer.getPubSubModule();
return mPubSubModule;
}
示例6: getNode
import org.jivesoftware.openfire.pubsub.PubSubService; //导入依赖的package包/类
public Node getNode()
{
PubSubService svc = getService();
return svc != null ? svc.getNode(nodeId) : null;
}
示例7: getNode
import org.jivesoftware.openfire.pubsub.PubSubService; //导入依赖的package包/类
public Node getNode()
{
PubSubService svc = getService();
return svc != null ? svc.getNode(nodeId) : null;
}