• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Node类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: makePubsubPayload

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
private String makePubsubPayload(PushMessage.Action action, AppEntity ae,
                                 MMXTopicId topic, Date pubDate, Node node) {
  String pubsubPayload;
  Map<String, String> context = makeContext(ae, topic, pubDate, node);
  String body = JiveProperties.getInstance().getProperty(
      MMXConfigKeys.PUBSUB_NOTIFICATION_BODY, BODY);
  if (body != null) {
    body = Utils.eval(body, context).toString();
  }
  if (action == PushMessage.Action.PUSH) {
    // Push notification payload
    String title = JiveProperties.getInstance().getProperty(
        MMXConfigKeys.PUBSUB_NOTIFICATION_TITLE, null);
    if (title != null) {
      title = Utils.eval(title, context).toString();
    }
    pubsubPayload = GsonData.getGson().toJson(new PubSubNotification(topic,
        pubDate, title, body));
  } else {
    // Wakeup (silent) notification payload
    pubsubPayload = GsonData.getGson().toJson(new PubSubNotification(topic,
        pubDate, body));
  }
  return pubsubPayload;
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:26,代码来源:PubSubWakeupProvider.java


示例2: getTopic

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
@GET
@Path("{" + TOPIC_NAME + "}")
@Produces(MediaType.APPLICATION_JSON)
public Response getTopic(@PathParam(TOPIC_NAME) String topicName) {
  String appId = RestUtils.getAppEntity(servletRequest).getAppId();
  MMXTopicId tid = nameToId(topicName);
  String topicId = TopicHelper.makeTopic(appId, tid.getEscUserId(), tid.getName());
  MMXTopicManager topicManager = MMXTopicManager.getInstance();
  Node node = topicManager.getTopicNode(topicId);
  if(node instanceof LeafNode) {
    LeafNode leafNode = (LeafNode) node;
    TopicInfo info = new TopicInfo();
    info.setTopicName(node.getName());
    info.setPublisherType(leafNode.getPublisherModel().getName());
    info.setSubscriptionEnabled(leafNode.isSubscriptionEnabled());
    info.setMaxItems(leafNode.getMaxPublishedItems());
    info.setDescription(leafNode.getDescription());
    return Response.status(Response.Status.OK).type(MediaType.APPLICATION_JSON).entity(info).build();
  } else {
    ErrorResponse errorResponse = new ErrorResponse(ErrorCode.ILLEGAL_ARGUMENT, "Channel not found");
    return RestUtils.getJAXRSResp(Response.Status.NOT_FOUND, errorResponse);
  }
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:24,代码来源:TopicResource.java


示例3: listTopicsForAppId

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
/**
 * Get a list of Leaf Topic nodes for the passed in appId
 * (collection nodes aren't returned)
 * @param appId
 * @return
 */
public List<TopicNode> listTopicsForAppId(String appId) {
  ArrayList<TopicNode> result = new ArrayList<TopicNode>();
  CollectionNode rootNode = getRootAppTopic(appId);
  if (rootNode != null) {
    Collection<Node> nodes = rootNode.getNodes();
    for (Node node : nodes) {
      //For fixing: https://magneteng.atlassian.net/browse/MOB-833
      if (node.isCollectionNode()) {
        continue;
      }
      String identifier = node.getNodeID();
      boolean isAppTopic = TopicHelper.isAppTopic(identifier, appId);
      if (isAppTopic) {
        TopicNode tn = TopicNode.build(appId, node);
        result.add(tn);
      }
    }
  }
  return result;
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:27,代码来源:MMXTopicManager.java


示例4: getTopicInfo

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
/**
 * Get a list of Leaf Topic nodes for the passed in appId
 * (collection nodes aren't returned)
 * @param appId
 * @return
 */
public List<com.magnet.mmx.server.api.v1.protocol.TopicInfo> getTopicInfo(String appId) {
  ArrayList<com.magnet.mmx.server.api.v1.protocol.TopicInfo> result =
      new ArrayList<com.magnet.mmx.server.api.v1.protocol.TopicInfo>();
  CollectionNode rootNode = getRootAppTopic(appId);
  if (rootNode != null) {
    Collection<Node> nodes = rootNode.getNodes();
    for (Node node : nodes) {
      //For fixing: https://magneteng.atlassian.net/browse/MOB-833
      if (node.isCollectionNode()) {
        continue;
      }
      String identifier = node.getNodeID();
      boolean isAppTopic = TopicHelper.isAppTopic(identifier, appId);
      if (isAppTopic) {
        com.magnet.mmx.server.api.v1.protocol.TopicInfo info =
            getTopicInfoFromNode(appId, node);
        result.add(info);
      }
    }
  }
  return result;
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:29,代码来源:MMXTopicManager.java


示例5: getTopicInfoFromNode

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
public com.magnet.mmx.server.api.v1.protocol.TopicInfo getTopicInfoFromNode(
                String appId, Node node) {
  com.magnet.mmx.server.api.v1.protocol.TopicInfo info = new
      com.magnet.mmx.server.api.v1.protocol.TopicInfo();
  info.setDescription(node.getDescription());
  info.setTopicName(node.getName());
  if(node instanceof  LeafNode) {
    LeafNode lnode = (LeafNode) node;
    info.setSubscriptionEnabled(lnode.isSubscriptionEnabled());
    info.setMaxItems(lnode.isPersistPublishedItems() ?
        lnode.getMaxPublishedItems() : 0);
  }
  info.setTopicName(TopicHelper.parseNode(node.getNodeID()).getName());
  info.setPublisherType(node.getPublisherModel().getName());
  return info;
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:17,代码来源:MMXTopicManager.java


示例6: deleteTopic

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
/**
 * Delete a topic identified by a topic id.
 * @param appId The app ID for error message.
 * @param topicId The node ID.
 * @return
 */
public TopicActionResult deleteTopic (String appId, String topicId) {

  TopicActionResult result = new TopicActionResult();

  Node gonner = mPubSubModule.getNode(topicId);

  if (gonner == null) {
    result.setSuccess(false);
    result.setCode(TopicFailureCode.NOTFOUND);
    result.setMessage(INVALID_TOPIC_ID);
  } else {
    LOGGER.trace("Deleting topic with id:" + topicId);
    gonner.delete();
    result.setSuccess(true);
    result.setNode(TopicNode.build(appId, gonner));
    result.setMessage(INVALID_TOPIC_ID);
  }
  return result;
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:26,代码来源:MMXTopicManager.java


示例7: getTopic

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
public TopicInfo getTopic(JID from, String appId, MMXTopicId topic)
                          throws MMXException {
    String realTopic = TopicHelper.makeTopic(appId, topic.getEscUserId(),
        TopicHelper.normalizePath(topic.getName()));
    Node node = mPubSubModule.getNode(realTopic);
    if (node == null) {
      throw new MMXException(StatusCode.TOPIC_NOT_FOUND.getMessage(topic.getName()),
          StatusCode.TOPIC_NOT_FOUND.getCode());
    }
//    // A user can get the topic info if the topic is a global topic, or the owner
//    // of a user topic, or a subscriber to a user topic.
//    if (topic.isUserTopic() && !node.getOwners().contains(from.asBareJID()) &&
//        node.getSubscriptions(from.asBareJID()).size() > 0) {
//      throw new MMXException(StatusCode.FORBIDDEN.getMessage(topic.getName()),
//          StatusCode.FORBIDDEN.getCode());
//    }
    return nodeToInfo(topic.getUserId(), topic.getName(), node);
  }
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:19,代码来源:MMXTopicManager.java


示例8: retractAllFromTopic

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
public MMXStatus retractAllFromTopic(JID from, String appId,
    TopicAction.RetractAllRequest rqt) throws MMXException {
  String topic = TopicHelper.normalizePath(rqt.getTopic());
  String userId = JIDUtil.getUserId(from);
  JID owner = from.asBareJID();
  String realTopic = TopicHelper.makeTopic(appId, rqt.isPersonal() ?
      userId : null, topic);
  Node node = mPubSubModule.getNode(realTopic);
  if (node == null) {
    throw new MMXException(StatusCode.TOPIC_NOT_FOUND.getMessage(topic),
        StatusCode.TOPIC_NOT_FOUND.getCode());
  }
  if (!node.getOwners().contains(owner)) {
    throw new MMXException(StatusCode.FORBIDDEN.getMessage(topic),
        StatusCode.FORBIDDEN.getCode());
  }
  LeafNode leafNode = (LeafNode) node;
  List<PublishedItem> pubItems = leafNode.getPublishedItems();
  leafNode.deleteItems(pubItems);

  int count = (pubItems == null) ? 0 : pubItems.size();
  MMXStatus status = (new MMXStatus())
      .setCode(StatusCode.SUCCESS.getCode())
      .setMessage(count+" item"+((count==1)?" is":"s are")+" retracted");
  return status;
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:27,代码来源:MMXTopicManager.java


示例9: unsubscribeForDev

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
public MMXStatus unsubscribeForDev(JID from, String appId,
                TopicAction.UnsubscribeForDevRequest rqt) throws MMXException {
  String prefix = TopicHelper.TOPIC_DELIM + appId + TopicHelper.TOPIC_DELIM;
  int count = 0;
  JID owner = from.asBareJID();
  String devId = rqt.getDevId();
  for (Node node : mPubSubModule.getNodes()) {
    if (!node.getNodeID().startsWith(prefix)) {
      continue;
    }
    for (NodeSubscription subscription : node.getSubscriptions(owner)) {
      if (devId.equals(subscription.getJID().getResource())) {
        ++count;
        node.cancelSubscription(subscription);
      }
    }
  }
  MMXStatus status = (new MMXStatus())
      .setCode(StatusCode.SUCCESS.getCode())
      .setMessage(count+" subscription"+((count==1)?" is":"s are")+" cancelled");
  return status;
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:23,代码来源:MMXTopicManager.java


示例10: nodeToInfo

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
private TopicInfo nodeToInfo(String userId, String topic, Node node) {
  TopicInfo info = new TopicInfo(
      userId, node.getName() != null ? node.getName() : topic, node.isCollectionNode())
    .setCreationDate(node.getCreationDate())
    .setDescription(node.getDescription())
    .setModifiedDate(node.getModificationDate())
    .setCreator(node.getCreator().toString())
    .setSubscriptionEnabled(node.isSubscriptionEnabled());
  if (!node.isCollectionNode()) {
    LeafNode leafNode = (LeafNode) node;
    info.setMaxItems(leafNode.isPersistPublishedItems() ?
          leafNode.getMaxPublishedItems() : 0)
        .setMaxPayloadSize(leafNode.getMaxPayloadSize())
        .setPersistent(leafNode.isPersistPublishedItems())
        .setPublisherType(ConfigureForm.convert(leafNode.getPublisherModel()));
  } else {
    info.setMaxItems(0)
        .setMaxPayloadSize(0)
        .setPersistent(false)
        .setPublisherType(null);
  }
  return info;
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:24,代码来源:MMXTopicManager.java


示例11: removeTags

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
public MMXStatus removeTags(JID from, String appId, TopicAction.TopicTags rqt)
                    throws MMXException {
  String topic = TopicHelper.normalizePath(rqt.getTopicName());
  String realTopic = TopicHelper.makeTopic(appId, rqt.getUserId(), topic);
  Node node = mPubSubModule.getNode(realTopic);
  // No need to check for permission; just check for existing.
  if (node == null) {
    throw new MMXException(StatusCode.TOPIC_NOT_FOUND.getMessage(topic),
        StatusCode.TOPIC_NOT_FOUND.getCode());
  }
  List<String> tags = rqt.getTags();
  String serviceId = node.getService().getServiceID();
  String nodeId = node.getNodeID();

  if(!Utils.isNullOrEmpty(tags)) {
    TagDAO tagDao = DBUtil.getTagDAO();
    tagDao.deleteTagsForTopic(tags, appId, serviceId, nodeId);
  }

  MMXStatus status = (new MMXStatus())
          .setCode(StatusCode.SUCCESS.getCode())
          .setMessage(StatusCode.SUCCESS.getMessage());
  return status;
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:25,代码来源:MMXTopicManager.java


示例12: build

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
public static TopicNode build(String appId, Node node) {
  TopicNode tn = new TopicNode();
  tn.setDescription(node.getDescription());
  tn.setCollection(node.isCollectionNode());
  MMXTopicId tid = TopicHelper.parseNode(node.getNodeID());
  tn.setUserId(tid.getUserId());
  tn.setTopicName(tid.getName());
  tn.setSubscriptionCount(node.getAllSubscriptions().size());
  tn.setCollection(node.isCollectionNode());
  tn.setSubscriptionEnabled(node.isSubscriptionEnabled());
  if (!node.isCollectionNode()) {
    LeafNode leafNode = (LeafNode) node;
    tn.setMaxItems(leafNode.getMaxPublishedItems());
        tn.setMaxPayloadSize(leafNode.getMaxPayloadSize());
        tn.setPersistent(leafNode.isPersistPublishedItems());
        tn.setPublisherType(ConfigureForm.convert(leafNode.getPublisherModel()).name());
  } else {
    tn.setMaxItems(0);
    tn.setMaxPayloadSize(0);
    tn.setPersistent(false);
    tn.setPublisherType(null);
  }
  return tn;
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:25,代码来源:TopicNode.java


示例13: build

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
public static ChannelNode build(String appId, Node node) {
  ChannelNode tn = new ChannelNode();
  tn.setDescription(node.getDescription());
  tn.setCollection(node.isCollectionNode());
  MMXChannelId tid = ChannelHelper.parseNode(node.getNodeID());
  tn.setUserId(tid.getUserId());
  tn.setChannelName(tid.getName());
  tn.setSubscriptionCount(node.getAllSubscriptions().size());
  tn.setCollection(node.isCollectionNode());
  tn.setSubscriptionEnabled(node.isSubscriptionEnabled());
  if (!node.isCollectionNode()) {
    LeafNode leafNode = (LeafNode) node;
    tn.setMaxItems(leafNode.getMaxPublishedItems());
        tn.setMaxPayloadSize(leafNode.getMaxPayloadSize());
        tn.setPersistent(leafNode.isPersistPublishedItems());
        tn.setPublishPermission(ConfigureForm.convert(leafNode.getPublisherModel()).name());
  } else {
    tn.setMaxItems(0);
    tn.setMaxPayloadSize(0);
    tn.setPersistent(false);
    tn.setPublishPermission(null);
  }
  return tn;
}
 
开发者ID:magnetsystems,项目名称:message-server,代码行数:25,代码来源:ChannelNode.java


示例14: canAccessItems

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
@Override
public boolean canAccessItems(Node node, JID owner, JID subscriber) {
    // Let node owners and sysadmins always get node items
    if (node.isAdmin(owner)) {
        return true;
    }
    NodeAffiliate nodeAffiliate = node.getAffiliate(owner);
    if  (nodeAffiliate == null) {
        // This is an unknown entity to the node so deny access
        return false;
    }
    // Any subscription of this entity that was approved will give him access
    // to retrieve the node items
    for (NodeSubscription subscription : nodeAffiliate.getSubscriptions()) {
        if (subscription.isActive()) {
            return true;
        }
    }
    // No approved subscription was found so deny access
    return false;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:22,代码来源:AuthorizeAccess.java


示例15: canPublish

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
@Override
public boolean canPublish(Node node, JID entity) {
    NodeAffiliate nodeAffiliate = node.getAffiliate(entity);
    // Deny access if user does not have any relation with the node or is an outcast
    if (nodeAffiliate == null ||
            nodeAffiliate.getAffiliation() == NodeAffiliate.Affiliation.outcast) {
        return false;
    }
    // Grant access if user is an owner of publisher
    if (nodeAffiliate.getAffiliation() == NodeAffiliate.Affiliation.publisher ||
            nodeAffiliate.getAffiliation() == NodeAffiliate.Affiliation.owner) {
        return true;
    }
    // Grant access if at least one subscription of this user was approved
    for (NodeSubscription subscription : nodeAffiliate.getSubscriptions()) {
        if (subscription.isActive()) {
            return true;
        }
    }
    return false;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:22,代码来源:OnlySubscribers.java


示例16: run

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
@Override
public void run()
{
    log.debug("[TASK] Cancel Subscription : {}", toString());

    Node node = getNode();
    
    // This will only occur if a PEP service is not loaded.  We can safely do nothing in this 
    // case since any changes will get loaded from the db when it is loaded.
    if (node == null)
        return;
    
    // This method will make a db call, but it will simply do nothing since
    // the record will already be deleted.
    node.cancelSubscription(getSubscription(), false);
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:17,代码来源:CancelSubscriptionTask.java


示例17: remove

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
/**
 * Deletes the {@link PEPService} belonging to the specified owner.
 * 
 * @param owner
 *            The JID of the owner of the service to be deleted.
 */
public void remove(JID owner) {
    PEPService service = null;

    final Lock lock = CacheFactory.getLock(owner, pepServices);
    try {
        lock.lock();
        service = pepServices.remove(owner.toBareJID());
    } finally {
        lock.unlock();
    }

    if (service == null) {
        return;
    }

    // Delete the user's PEP nodes from memory and the database.
    CollectionNode rootNode = service.getRootCollectionNode();
    for (final Node node : service.getNodes()) {
        if (rootNode.isChildNode(node)) {
            node.delete();
        }
    }
    rootNode.delete();
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:31,代码来源:PEPServiceManager.java


示例18: canAccessItems

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
@Override
public boolean canAccessItems(Node node, JID owner, JID subscriber) {
       // Let node owners and sysadmins always get node items
       if (node.isAdmin(owner)) {
           return true;
       }
       NodeAffiliate nodeAffiliate = node.getAffiliate(owner);
       if  (nodeAffiliate == null) {
           // This is an unknown entity to the node so deny access
           return false;
       }
       // Any subscription of this entity that was approved will give him access
       // to retrieve the node items
       for (NodeSubscription subscription : nodeAffiliate.getSubscriptions()) {
           if (subscription.isActive()) {
               return true;
           }
       }
       // No approved subscription was found so deny access
       return false;
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:22,代码来源:AuthorizeAccess.java


示例19: canPublish

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
@Override
public boolean canPublish(Node node, JID entity) {
       NodeAffiliate nodeAffiliate = node.getAffiliate(entity);
       // Deny access if user does not have any relation with the node or is an outcast
       if (nodeAffiliate == null ||
               nodeAffiliate.getAffiliation() == NodeAffiliate.Affiliation.outcast) {
           return false;
       }
       // Grant access if user is an owner of publisher
       if (nodeAffiliate.getAffiliation() == NodeAffiliate.Affiliation.publisher ||
               nodeAffiliate.getAffiliation() == NodeAffiliate.Affiliation.owner) {
           return true;
       }
       // Grant access if at least one subscription of this user was approved
       for (NodeSubscription subscription : nodeAffiliate.getSubscriptions()) {
           if (subscription.isActive()) {
               return true;
           }
       }
       return false;
   }
 
开发者ID:coodeer,项目名称:g3server,代码行数:22,代码来源:OnlySubscribers.java


示例20: remove

import org.jivesoftware.openfire.pubsub.Node; //导入依赖的package包/类
/**
 * Deletes the {@link PEPService} belonging to the specified owner.
 * 
 * @param owner
 *            The JID of the owner of the service to be deleted.
 */
public void remove(JID owner) {
	PEPService service = null;

	final Lock lock = CacheFactory.getLock(owner, pepServices);
	try {
		lock.lock();
		service = pepServices.remove(owner.toBareJID());
	} finally {
		lock.unlock();
	}

	if (service == null) {
		return;
	}

	// Delete the user's PEP nodes from memory and the database.
	CollectionNode rootNode = service.getRootCollectionNode();
	for (final Node node : service.getNodes()) {
		if (rootNode.isChildNode(node)) {
			node.delete();
		}
	}
	rootNode.delete();
}
 
开发者ID:coodeer,项目名称:g3server,代码行数:31,代码来源:PEPServiceManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PowerDatacenterNonPowerAware类代码示例发布时间:2022-05-22
下一篇:
Java ApplicationInfoEx类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap