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


Java RepositoryException类代码示例

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


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

示例1: createRoom

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
public void createRoom(Room room) throws RepositoryException {
	try {
		repository.setData(mucConfig.getServiceName(), ROOMS_KEY + room.getRoomJID(), CREATION_DATE_KEY,
				String.valueOf(room.getCreationDate().getTime()));
		repository.setData(mucConfig.getServiceName(), ROOMS_KEY + room.getRoomJID(), CREATOR_JID_KEY,
				room.getCreatorJid().toString());
		repository.setData(mucConfig.getServiceName(), ROOMS_KEY + room.getRoomJID(), LAST_ACCESS_DATE_KEY,
				String.valueOf((new Date()).getTime()));

		room.getConfig().write(repository, mucConfig, ROOMS_KEY + room.getRoomJID() + "/config");

		for (BareJID affJid : room.getAffiliations()) {
			final Affiliation a = room.getAffiliation(affJid);
			setAffiliation(room.getRoomJID(), affJid, a);
		}

	} catch (Exception e) {
		e.printStackTrace();
		throw new RepositoryException("Room creation error", e);
	}
}
 
开发者ID:QuickBlox,项目名称:QuickBlox-Tigase-CustomFeatures,代码行数:22,代码来源:MucDAO.java

示例2: destroyRoom

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
@Override
  public void destroyRoom(BareJID roomJID, Element destroyElement) throws RepositoryException {
      if (log.isLoggable(Level.FINE)) {
          log.fine("Destroying room '" + roomJID);
      }
      this.rooms.remove(roomJID);

//
//
      final BareJID owner = getRoomOwner(roomJID);
      if(owner != null) {
          final Integer appID = QBChatUtils.getApplicationIDAndUserIDFromUserJIDLocalPart(owner.getLocalpart())[0];
          ConcurrentHashMap<BareJID, InternalRoom> applicationRooms = allRooms.get(appID);
          if (applicationRooms != null) {
              applicationRooms.remove(roomJID);
          }
      }

      dao.destroyRoom(roomJID);
  }
 
开发者ID:QuickBlox,项目名称:QuickBlox-Tigase-CustomFeatures,代码行数:21,代码来源:InMemoryMucRepositoryWithSplitRoomsByApps.java

示例3: getPublicVisibleRoomsIdList

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
@Override
public BareJID[] getPublicVisibleRoomsIdList(Integer appID) throws RepositoryException{
    List<BareJID> result = new ArrayList<BareJID>();

    // get rooms for particular application
    ConcurrentHashMap<BareJID, InternalRoom> applicationRooms = this.allRooms.get(appID);
    if(applicationRooms == null){
        applicationRooms = new ConcurrentHashMap<BareJID, InternalRoom>();
    }

    for (Entry<BareJID, InternalRoom> entry : applicationRooms.entrySet()) {
        if (entry.getValue().listPublic) {
            result.add(entry.getKey());
        }
    }

    return result.toArray(new BareJID[] {});
}
 
开发者ID:QuickBlox,项目名称:QuickBlox-Tigase-CustomFeatures,代码行数:19,代码来源:InMemoryMucRepositoryWithSplitRoomsByApps.java

示例4: getRoomOwner

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
public BareJID getRoomOwner(BareJID roomJid) throws RepositoryException {
    try {
        Room room = this.rooms.get(BareJID.bareJIDInstance(roomJid.toString()));
        if (room == null) {
            // Hmm...check in database
            String owner = dao.getRoomOwner(roomJid.toString());
            return owner == null ? null : BareJID.bareJIDInstance(owner);
        }
        return room.getCreatorJid();
    } catch (Exception e) {
        if (log.isLoggable(Level.FINE)) {
            log.fine("Exception: " + e.toString());
        }
        return null;
    }
}
 
开发者ID:QuickBlox,项目名称:QuickBlox-Tigase-CustomFeatures,代码行数:17,代码来源:InMemoryMucRepositoryWithSplitRoomsByApps.java

示例5: processDiscoInfo

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
@Override
protected void processDiscoInfo(Packet packet, JID jid, String node, JID senderJID) throws ComponentException,
		RepositoryException {
	if (jid.getResource() == null) {
		super.processDiscoInfo(packet, jid, node, senderJID);
	} else if (jid.getResource() != null && context.getKernel().getInstance(jid.getResource()) != null) {
		final Object taskInstance = context.getKernel().getInstance(jid.getResource());

		Element resultQuery = new Element("query", new String[] { "xmlns" }, new String[] { DISCO_INFO_XMLNS });
		Packet resultIq = packet.okResult(resultQuery, 0);

		resultQuery.addChild(new Element("identity", new String[] { "category", "type", "name" }, new String[] {
				"automation", "task", "Task " + jid.getResource() }));

		if (isAdHocCompatible(taskInstance)) {
			resultQuery.addChild(new Element("feature", new String[] { "var" }, new String[] { Command.XMLNS }));
		}

		write(resultIq);
	} else
		throw new ComponentException(Authorization.ITEM_NOT_FOUND);

}
 
开发者ID:kontalk,项目名称:tigase-server,代码行数:24,代码来源:DiscoveryMonitorModule.java

示例6: processGetAffiliations

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
private void processGetAffiliations(final Packet iq, final Room room, final Affiliation filter) throws RepositoryException,
		MUCException {
	Element responseQuery = new Element("query", new String[] { "xmlns" },
			new String[] { "http://jabber.org/protocol/muc#admin" });

	for (BareJID jid : room.getAffiliations()) {
		final Affiliation affiliation = room.getAffiliation(jid);
		if (affiliation == filter) {
			Element ir = new Element("item", new String[] { "affiliation", "jid" }, new String[] { affiliation.name(),
					jid.toString() });
			responseQuery.addChild(ir);
		}
	}

	writer.write(iq.okResult(responseQuery, 0));
}
 
开发者ID:Smartupz,项目名称:tigase-muc,代码行数:17,代码来源:ModeratorModule.java

示例7: processGetRoles

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
private void processGetRoles(final Packet iq, final Room room, final Role filterRole) throws RepositoryException,
		MUCException {
	Element responseQuery = new Element("query", new String[] { "xmlns" },
			new String[] { "http://jabber.org/protocol/muc#admin" });
	for (String occupantNickname : room.getOccupantsNicknames()) {
		final Role role = room.getRole(occupantNickname);
		final BareJID occupantBareJid = room.getOccupantsJidByNickname(occupantNickname);
		if (role == filterRole) {
			final Affiliation affiliation = room.getAffiliation(occupantBareJid);
			Element ir = new Element("item", new String[] { "affiliation", "nick", "role" }, new String[] {
					affiliation.name(), occupantNickname, role.name() });
			if (room.getConfig().getRoomAnonymity() != Anonymity.fullanonymous) {
				ir.setAttribute("jid", occupantBareJid.toString());
			}
			responseQuery.addChild(ir);
		}
	}
	writer.write(iq.okResult(responseQuery, 0));
}
 
开发者ID:Smartupz,项目名称:tigase-muc,代码行数:20,代码来源:ModeratorModule.java

示例8: destroy

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
private void destroy(Room room, Element destroyElement) throws TigaseStringprepException, RepositoryException {
	for (String occupantNickname : room.getOccupantsNicknames()) {
		for (JID occupantJid : room.getOccupantsJidsByNickname(occupantNickname)) {
			final Element p = new Element("presence");
			p.addAttribute("type", "unavailable");

			PresenceWrapper presence = PresenceModule.preparePresenceW(room, occupantJid, p, occupantJid.getBareJID(),
					occupantNickname, Affiliation.none, Role.none);
			presence.x.addChild(destroyElement);

			writer.write(presence.packet);
		}
	}

	// XXX TODO
	// throw new
	// MUCException(Authorization.FEATURE_NOT_IMPLEMENTED);

	repository.destroyRoom(room);
	if (historyProvider != null)
		historyProvider.removeHistory(room);
}
 
开发者ID:Smartupz,项目名称:tigase-muc,代码行数:23,代码来源:RoomConfigurationModule.java

示例9: processGet

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
private void processGet(final Packet element) throws RepositoryException, MUCException {
	try {
		final BareJID roomJID = BareJID.bareJIDInstance(element.getAttribute("to"));
		JID senderJID = JID.jidInstance(element.getAttribute("from"));
		Room room = repository.getRoom(roomJID);

		if (room == null) {
			writer.write(Packet.packetInstance(makeConfigFormIq(element.getElement(), repository.getDefaultRoomConfig())));
		}
		if (room.getAffiliation(senderJID.getBareJID()) != Affiliation.owner) {
			throw new MUCException(Authorization.FORBIDDEN);
		}

		final Element response = makeConfigFormIq(element.getElement(), room.getConfig());
		writer.write(Packet.packetInstance(response));

	} catch (TigaseStringprepException e) {
		throw new MUCException(Authorization.BAD_REQUEST);
	}
}
 
开发者ID:Smartupz,项目名称:tigase-muc,代码行数:21,代码来源:RoomConfigurationModule.java

示例10: getRoomsJIDList

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
/**
 * @return
 * @throws RepositoryException
 */
public ArrayList<BareJID> getRoomsJIDList() throws RepositoryException {
	ArrayList<BareJID> jids = new ArrayList<BareJID>();
	BareJID serviceName = mucConfig.getServiceName();
	try {
		String[] ids = repository.getSubnodes(serviceName, ROOMS_KEY);
		if (ids != null) {
			for (String id : ids) {
				jids.add(BareJID.bareJIDInstance(id));
			}
		}
		return jids;
	} catch (Exception e) {
		e.printStackTrace();
		throw new RepositoryException("Room list reading error", e);
	}
}
 
开发者ID:Smartupz,项目名称:tigase-muc,代码行数:21,代码来源:MucDAO.java

示例11: createNewRoom

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
@Override
public Room createNewRoom(BareJID roomJID, JID senderJid) throws RepositoryException {
	if (log.isLoggable(Level.FINE))
		log.fine("Creating new room '" + roomJID + "'");

	RoomConfig rc = new RoomConfig(roomJID, this.mucConfig.isPublicLoggingEnabled());

	rc.copyFrom(getDefaultRoomConfig(), false);

	Room room = new Room(rc, new Date(), senderJid.getBareJID());
	room.getConfig().addListener(roomConfigListener);
	room.addListener(roomListener);
	this.rooms.put(roomJID, room);
	this.allRooms.put(roomJID, new InternalRoom());

	return room;
}
 
开发者ID:Smartupz,项目名称:tigase-muc,代码行数:18,代码来源:InMemoryMucRepository.java

示例12: destroyRoom

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
/**
 * @param roomJID
 * @throws RepositoryException
 */
public void destroyRoom(BareJID roomJID) throws RepositoryException {
	try {
		repository.removeSubnode(mucConfig.getServiceName(), ROOMS_KEY + roomJID);
	} catch (Exception e) {
		e.printStackTrace();
		throw new RepositoryException("Room destroing error", e);
	}
}
 
开发者ID:QuickBlox,项目名称:QuickBlox-Tigase-CustomFeatures,代码行数:13,代码来源:MucDAO.java

示例13: getCreationDate

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
public Date getCreationDate(BareJID roomJID) throws RepositoryException {
	try {
		String creationDate = repository.getData(mucConfig.getServiceName(), ROOMS_KEY + roomJID, CREATION_DATE_KEY);
		if (creationDate == null)
			return null;
		Date r = new Date(Long.valueOf(creationDate));
		return r;
	} catch (Exception e) {
		throw new RepositoryException("Creation Date reading error", e);
	}

}
 
开发者ID:QuickBlox,项目名称:QuickBlox-Tigase-CustomFeatures,代码行数:13,代码来源:MucDAO.java

示例14: getRoomName

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
/**
 * @param jid
 * @return
 * @throws RepositoryException
 */
public String getRoomName(String jid) throws RepositoryException {
	try {
		return repository.getData(mucConfig.getServiceName(), ROOMS_KEY + jid + "/config",
				RoomConfig.MUC_ROOMCONFIG_ROOMNAME_KEY);
	} catch (Exception e) {
		e.printStackTrace();
		throw new RepositoryException("Room name reading error", e);
	}
}
 
开发者ID:QuickBlox,项目名称:QuickBlox-Tigase-CustomFeatures,代码行数:15,代码来源:MucDAO.java

示例15: getRoomsJIDList

import tigase.component.exceptions.RepositoryException; //导入依赖的package包/类
/**
 * @return
 * @throws RepositoryException
 */
//
//
public String[] getRoomsJIDList() throws RepositoryException {
    BareJID serviceName = mucConfig.getServiceName();
    try {
        String[] ids = repository.getSubnodes(serviceName, ROOMS_KEY);
        return ids;
    } catch (Exception e) {
        e.printStackTrace();
        throw new RepositoryException("Room list reading error", e);
    }
}
 
开发者ID:QuickBlox,项目名称:QuickBlox-Tigase-CustomFeatures,代码行数:17,代码来源:MucDAO.java


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