本文整理汇总了Java中org.jivesoftware.openfire.group.GroupNotFoundException类的典型用法代码示例。如果您正苦于以下问题:Java GroupNotFoundException类的具体用法?Java GroupNotFoundException怎么用?Java GroupNotFoundException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GroupNotFoundException类属于org.jivesoftware.openfire.group包,在下文中一共展示了GroupNotFoundException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getGroup
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
public Group getGroup(String groupName) throws GroupNotFoundException {
LdapContext ctx = null;
try {
String groupDN = manager.findGroupDN(groupName);
// Load record.
ctx = manager.getContext(manager.getGroupsBaseDN(groupName));
Attributes attrs = ctx.getAttributes(groupDN, standardAttributes);
return processGroup(ctx, attrs);
}
catch (Exception e) {
Log.error(e.getMessage(), e);
throw new GroupNotFoundException("Group with name " + groupName + " not found.", e);
}
finally {
try {
if (ctx != null) {
ctx.setRequestControls(null);
ctx.close();
}
}
catch (Exception ignored) {
// Ignore.
}
}
}
开发者ID:coodeer,项目名称:g3server,代码行数:27,代码来源:LdapGroupProvider.java
示例2: execute
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
@Override
public void execute(SessionData data, Element command) {
Element note = command.addElement("note");
// Check if groups cannot be modified (backend is read-only)
if (GroupManager.getInstance().isReadOnly()) {
note.addAttribute("type", "error");
note.setText("Groups are read only");
return;
}
// Get requested group
Group group;
try {
group = GroupManager.getInstance().getGroup(data.getData().get("group").get(0));
} catch (GroupNotFoundException e) {
// Group not found
note.addAttribute("type", "error");
note.setText("Group name does not exist");
return;
}
GroupManager.getInstance().deleteGroup(group);
note.addAttribute("type", "info");
note.setText("Operation finished successfully");
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:26,代码来源:DeleteGroup.java
示例3: getGroup
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
@Override
public Group getGroup(String name) throws GroupNotFoundException {
try {
Cache<String, org.jivesoftware.openfire.crowd.jaxb.Group> groupCache = CacheFactory.createLocalCache(GROUP_CACHE_NAME);
org.jivesoftware.openfire.crowd.jaxb.Group group = groupCache.get(name);
if (group == null) {
group = manager.getGroup(name);
groupCache.put(name, group);
}
Collection<JID> members = getGroupMembers(name);
Collection<JID> admins = Collections.emptyList();
return new Group(name, group.description, members, admins);
} catch (RemoteException re) {
LOG.error("Failure to load group:" + String.valueOf(name), re);
throw new GroupNotFoundException(re);
}
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:19,代码来源:CrowdGroupProvider.java
示例4: isBookmarkForJID
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
/**
* True if the specified bookmark should be appended to the users list of
* bookmarks.
*
* @param jid the jid of the user.
* @param bookmark the bookmark.
* @return true if bookmark should be appended.
*/
private static boolean isBookmarkForJID(JID jid, Bookmark bookmark) {
String username = jid.getNode();
if (bookmark.getUsers().contains(username)) {
return true;
}
Collection<String> groups = bookmark.getGroups();
if (groups != null && !groups.isEmpty()) {
GroupManager groupManager = GroupManager.getInstance();
for (String groupName : groups) {
try {
Group group = groupManager.getGroup(groupName);
if (group.isUser(jid.getNode())) {
return true;
}
}
catch (GroupNotFoundException e) {
Log.debug(e.getMessage(), e);
}
}
}
return false;
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:34,代码来源:BookmarkInterceptor.java
示例5: packetToFromGroup
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
private boolean packetToFromGroup(String rulegroup, JID packetToFrom) {
Group group = null;
boolean result = false;
try {
group = GroupManager.getInstance().getGroup(rulegroup);
} catch (GroupNotFoundException e) {
if (PacketFilterConstants.ANY_GROUP.equals(rulegroup)) {
if (!GroupManager.getInstance().getGroups(packetToFrom).isEmpty()) {
result = true;
}
} else {
e.printStackTrace();
}
}
if (group != null) {
if (group.isUser(packetToFrom)) {
result = true;
}
}
return result;
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:22,代码来源:PacketFilter.java
示例6: getGroup
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
/**
* Gets the group.
*
* @param groupName
* the group name
* @return the group
* @throws ServiceException
* the service exception
*/
public GroupEntity getGroup(String groupName) throws ServiceException {
Group group;
try {
group = GroupManager.getInstance().getGroup(groupName);
} catch (GroupNotFoundException e) {
throw new ServiceException("Could not find group", groupName, ExceptionType.GROUP_NOT_FOUND,
Response.Status.NOT_FOUND, e);
}
GroupEntity groupEntity = new GroupEntity(group.getName(), group.getDescription());
groupEntity.setAdmins(MUCRoomUtils.convertJIDsToStringList(group.getAdmins()));
groupEntity.setMembers(MUCRoomUtils.convertJIDsToStringList(group.getMembers()));
return groupEntity;
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:25,代码来源:GroupController.java
示例7: updateGroup
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
/**
* Update group.
*
* @param groupName the group name
* @param groupEntity the group entity
* @return the group
* @throws ServiceException the service exception
*/
public Group updateGroup(String groupName, GroupEntity groupEntity) throws ServiceException {
Group group;
if (groupEntity != null && !groupEntity.getName().isEmpty()) {
if (groupName.equals(groupEntity.getName())) {
try {
group = GroupManager.getInstance().getGroup(groupName);
group.setDescription(groupEntity.getDescription());
} catch (GroupNotFoundException e) {
throw new ServiceException("Could not find group", groupName, ExceptionType.GROUP_NOT_FOUND,
Response.Status.NOT_FOUND, e);
}
} else {
throw new ServiceException(
"Could not update the group. The group name is different to the payload group name.", groupName + " != " + groupEntity.getName(),
ExceptionType.ILLEGAL_ARGUMENT_EXCEPTION, Response.Status.BAD_REQUEST);
}
} else {
throw new ServiceException("Could not update new group", "groups",
ExceptionType.ILLEGAL_ARGUMENT_EXCEPTION, Response.Status.BAD_REQUEST);
}
return group;
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:31,代码来源:GroupController.java
示例8: execute
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
@Override
public void execute(SessionData data, Element command) {
Element note = command.addElement("note");
// Check if groups cannot be modified (backend is read-only)
if (GroupManager.getInstance().isReadOnly()) {
note.addAttribute("type", "error");
note.setText("Groups are read only");
return;
}
// Get requested group
Group group;
try {
group = GroupManager.getInstance().getGroup(data.getData().get("group").get(0));
} catch (GroupNotFoundException e) {
// Group not found
note.addAttribute("type", "error");
note.setText("Group name does not exist");
return;
}
GroupManager.getInstance().deleteGroup(group);
note.addAttribute("type", "info");
note.setText("Operation finished successfully");
}
开发者ID:coodeer,项目名称:g3server,代码行数:26,代码来源:DeleteGroup.java
示例9: getGroupID
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
/**
* Returns the Clearspace group id of the group.
*
* @param groupname Name of the group to retrieve ID of.
* @return The ID number of the group in Clearspace.
* @throws org.jivesoftware.openfire.group.GroupNotFoundException
* If the group was not found.
*/
protected long getGroupID(String groupname) throws GroupNotFoundException {
if (groupIDCache.containsKey(groupname)) {
return groupIDCache.get(groupname);
}
try {
// Encode potentially non-ASCII characters
groupname = URLUTF8Encoder.encode(groupname);
String path = ClearspaceGroupProvider.URL_PREFIX + "groups/" + groupname;
Element element = executeRequest(org.jivesoftware.openfire.clearspace.ClearspaceManager.HttpType.GET, path);
Long id = Long.valueOf(WSUtils.getElementText(element.selectSingleNode("return"), "ID"));
// Saves it into the cache
groupIDCache.put(groupname, id);
return id;
} catch (GroupNotFoundException gnfe) {
// It is a supported exception, throw it again
throw gnfe;
} catch (Exception e) {
// It is not a supported exception, wrap it into a GroupNotFoundException
throw new GroupNotFoundException("Unexpected error", e);
}
}
开发者ID:coodeer,项目名称:g3server,代码行数:32,代码来源:ClearspaceManager.java
示例10: packetToFromGroup
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
private boolean packetToFromGroup(String rulegroup, JID packetToFrom) {
Group group = null;
try {
group = GroupManager.getInstance().getGroup(rulegroup);
} catch (GroupNotFoundException e) {
e.printStackTrace();
}
if (group == null) {
return false;
} else {
if (group.isUser(packetToFrom)) {
return true;
}
}
return false;
}
开发者ID:coodeer,项目名称:g3server,代码行数:17,代码来源:PacketFilter.java
示例11: createUser
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
public void createUser(String username, String password, String name, String email, String groupNames)
throws UserAlreadyExistsException
{
userManager.createUser(username, password, name, email);
if (groupNames != null) {
Collection<Group> groups = new ArrayList<Group>();
StringTokenizer tkn = new StringTokenizer(groupNames, ",");
while (tkn.hasMoreTokens()) {
try {
groups.add(GroupManager.getInstance().getGroup(tkn.nextToken()));
} catch (GroupNotFoundException e) {
// Ignore this group
}
}
for (Group group : groups) {
group.getMembers().add(server.createJID(username, null));
}
}
}
开发者ID:coodeer,项目名称:g3server,代码行数:21,代码来源:UserServicePlugin.java
示例12: getGroup
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
public Group getGroup(String name) throws GroupNotFoundException {
try {
Cache<String, org.jivesoftware.openfire.crowd.jaxb.Group> groupCache = CacheFactory.createLocalCache(GROUP_CACHE_NAME);
org.jivesoftware.openfire.crowd.jaxb.Group group = groupCache.get(name);
if (group == null) {
group = manager.getGroup(name);
groupCache.put(name, group);
}
Collection<JID> members = getGroupMembers(name);
Collection<JID> admins = Collections.emptyList();
return new Group(name, group.description, members, admins);
} catch (RemoteException re) {
LOG.error("Failure to load group:" + String.valueOf(name), re);
throw new GroupNotFoundException(re);
}
}
开发者ID:idwanglu2010,项目名称:openfire,代码行数:18,代码来源:CrowdGroupProvider.java
示例13: packetToFromGroup
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
private boolean packetToFromGroup(String rulegroup, JID packetToFrom) {
Group group = null;
boolean result = false;
try {
group = GroupManager.getInstance().getGroup(rulegroup);
} catch (GroupNotFoundException e) {
if (PacketFilterConstants.ANY_GROUP.equals(rulegroup)) {
if (!GroupManager.getInstance().getGroups(packetToFrom).isEmpty()) {
result = true;
}
} else {
e.printStackTrace();
}
}
if (group != null) {
if (group.isUser(packetToFrom)) {
result = true;
}
}
return result;
}
开发者ID:idwanglu2010,项目名称:openfire,代码行数:22,代码来源:PacketFilter.java
示例14: execute
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
@Override
public void execute(SessionData sessionData, Element command) {
Element note = command.addElement("note");
Map<String, List<String>> data = sessionData.getData();
// Get the group name
String groupname;
try {
groupname = get(data, "groupName", 0);
}
catch (NullPointerException npe) {
note.addAttribute("type", "error");
note.setText("Group name required parameter.");
return;
}
// Sends the event
Group group;
try {
group = GroupManager.getInstance().getGroup(groupname, true);
// Fire event.
Map<String, Object> params = Collections.emptyMap();
GroupEventDispatcher.dispatchEvent(group, GroupEventDispatcher.EventType.group_created, params);
} catch (GroupNotFoundException e) {
note.addAttribute("type", "error");
note.setText("Group not found.");
}
// Answer that the operation was successful
note.addAttribute("type", "info");
note.setText("Operation finished successfully");
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:36,代码来源:GroupCreated.java
示例15: execute
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
@Override
public void execute(SessionData sessionData, Element command) {
Element note = command.addElement("note");
Map<String, List<String>> data = sessionData.getData();
// Get the group name
String groupname;
try {
groupname = get(data, "groupName", 0);
}
catch (NullPointerException npe) {
note.addAttribute("type", "error");
note.setText("Group name required parameter.");
return;
}
// Sends the event
Group group;
try {
group = GroupManager.getInstance().getGroup(groupname, true);
// Fire event.
Map<String, Object> params = Collections.emptyMap();
GroupEventDispatcher.dispatchEvent(group, GroupEventDispatcher.EventType.group_deleting, params);
} catch (GroupNotFoundException e) {
note.addAttribute("type", "error");
note.setText("Group not found.");
}
// Answer that the operation was successful
note.addAttribute("type", "info");
note.setText("Operation finished successfully");
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:36,代码来源:GroupDeleting.java
示例16: isValidGroup
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
public boolean isValidGroup(String groupName) {
if (groupName != null && !groupName.isEmpty()) {
try {
Group group = groupManager.getGroup(groupName);
if (group != null) {
return true;
}
} catch (GroupNotFoundException e) {
}
}
return false;
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:13,代码来源:PubSubServiceInfo.java
示例17: canSubscribe
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
@Override
public boolean canSubscribe(Node node, JID owner, JID subscriber) {
// Let node owners and sysadmins always subscribe to the node
if (node.isAdmin(owner)) {
return true;
}
for (JID nodeOwner : node.getOwners()) {
if (nodeOwner.equals(owner)) {
return true;
}
}
// Check that the subscriber is a local user
XMPPServer server = XMPPServer.getInstance();
if (server.isLocal(owner)) {
GroupManager gMgr = GroupManager.getInstance();
Collection<String> nodeGroups = node.getRosterGroupsAllowed();
for (String groupName : nodeGroups) {
try {
Group group = gMgr.getGroup(groupName);
// access allowed if the node group is visible to the subscriber
if (server.getRosterManager().isGroupVisible(group, owner)) {
return true;
}
} catch (GroupNotFoundException gnfe){
// ignore
}
}
}
else {
// Subscriber is a remote user. This should never happen.
Log.warn("Node with access model Roster has a remote user as subscriber: " +
node.getNodeID());
}
return false;
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:36,代码来源:RosterAccess.java
示例18: getAdmins
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
@Override
public List<JID> getAdmins() {
List<JID> results = new ArrayList<>();
GroupProvider provider = GroupManager.getInstance().getProvider();
String groups = JiveGlobals.getProperty(JIVE_AUTHORIZED_GROUPS);
groups = (groups == null || groups.trim().length() == 0) ? "" : groups;
JiveGlobals.setProperty(JIVE_AUTHORIZED_GROUPS, groups); // make sure the property is created
StringTokenizer tokenizer = new StringTokenizer(groups, ",");
while (tokenizer.hasMoreTokens()) {
String groupName = tokenizer.nextToken().trim().toLowerCase();
if (groupName != null && groupName.length() > 0) {
try {
LOG.info("Adding admin users from group: " + groupName);
Group group = provider.getGroup(groupName);
if (group != null) {
results.addAll(group.getMembers());
}
} catch (GroupNotFoundException gnfe) {
LOG.error("Error when trying to load the members of group:" + String.valueOf(groupName), gnfe);
}
}
}
if (results.isEmpty()) {
// Add default admin account when none was specified
results.add(new JID("admin", XMPPServer.getInstance().getServerInfo().getXMPPDomain(), null, true));
}
if (LOG.isDebugEnabled()) {
LOG.debug("admin users: " + results.toString());
}
return results;
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:40,代码来源:CrowdAdminProvider.java
示例19: getSharedGroups
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
/**
* Returns the shared groups for the item.
*
* @return The shared groups this item belongs to.
*/
public Collection<Group> getSharedGroups() {
Collection<Group> groups = new ArrayList<>(sharedGroups.size());
for (String groupName : sharedGroups) {
try {
groups.add(GroupManager.getInstance().getGroup(groupName));
}
catch (GroupNotFoundException e) {
// Do nothing
}
}
return groups;
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:18,代码来源:RosterItem.java
示例20: getInvisibleSharedGroups
import org.jivesoftware.openfire.group.GroupNotFoundException; //导入依赖的package包/类
/**
* Returns the invisible shared groups for the item. These groups are for internal use
* and help track the reason why a roster item has a presence subscription of type FROM
* when using shared groups.
*
* @return The shared groups this item belongs to.
*/
public Collection<Group> getInvisibleSharedGroups() {
Collection<Group> groups = new ArrayList<>(invisibleSharedGroups.size());
for (String groupName : invisibleSharedGroups) {
try {
groups.add(GroupManager.getInstance().getGroup(groupName));
}
catch (GroupNotFoundException e) {
// Do nothing
}
}
return groups;
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:20,代码来源:RosterItem.java
注:本文中的org.jivesoftware.openfire.group.GroupNotFoundException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论