use of org.jivesoftware.openfire.XMPPServer in project Openfire by igniterealtime.
the class ArchiveManagerImpl method archiveMessage.
public void archiveMessage(Session session, Message message, boolean incoming) {
final XMPPServer server = XMPPServer.getInstance();
final ArchivedMessage.Direction direction;
final ArchivedMessage archivedMessage;
final Conversation conversation;
final JID ownerJid;
final JID withJid;
// TODO support groupchat
if (message.getType() != Message.Type.chat && message.getType() != Message.Type.normal) {
return;
}
if (server.isLocal(message.getFrom()) && incoming) {
ownerJid = message.getFrom();
withJid = message.getTo();
// sent by the owner => to
direction = ArchivedMessage.Direction.to;
} else if (server.isLocal(message.getTo()) && !incoming) {
ownerJid = message.getTo();
withJid = message.getFrom();
// received by the owner => from
direction = ArchivedMessage.Direction.from;
} else {
return;
}
archivedMessage = ArchiveFactory.createArchivedMessage(session, message, direction, withJid);
if (archivedMessage.isEmpty()) {
return;
}
conversation = determineConversation(ownerJid, withJid, message.getSubject(), message.getThread(), archivedMessage);
archivedMessage.setConversation(conversation);
persistenceManager.createMessage(archivedMessage);
if (indexManager != null) {
indexManager.indexObject(archivedMessage);
}
}
use of org.jivesoftware.openfire.XMPPServer in project Openfire by igniterealtime.
the class RayoComponent method doStop.
public void doStop() {
Log.info("RayoComponent shutdown ");
XMPPServer server = XMPPServer.getInstance();
server.getIQDiscoInfoHandler().removeServerFeature(RAYO_CORE);
server.getIQDiscoInfoHandler().removeServerFeature(RAYO_RECORD);
server.getIQDiscoInfoHandler().removeServerFeature(RAYO_SAY);
server.getIQDiscoInfoHandler().removeServerFeature(RAYO_HANDSET);
destroyIQHandlers();
Log.info("jCumulus stopping...");
channel.close();
bootstrap.releaseExternalResources();
}
use of org.jivesoftware.openfire.XMPPServer in project Openfire by igniterealtime.
the class RayoComponent method destroyIQHandlers.
private void destroyIQHandlers() {
XMPPServer server = XMPPServer.getInstance();
if (onHookIQHandler != null) {
server.getIQRouter().removeHandler(onHookIQHandler);
onHookIQHandler = null;
}
if (offHookIQHandler != null) {
server.getIQRouter().removeHandler(offHookIQHandler);
offHookIQHandler = null;
}
if (privateIQHandler != null) {
server.getIQRouter().removeHandler(privateIQHandler);
privateIQHandler = null;
}
if (publicIQHandler != null) {
server.getIQRouter().removeHandler(publicIQHandler);
publicIQHandler = null;
}
if (muteIQHandler != null) {
server.getIQRouter().removeHandler(muteIQHandler);
muteIQHandler = null;
}
if (unmuteIQHandler != null) {
server.getIQRouter().removeHandler(unmuteIQHandler);
unmuteIQHandler = null;
}
if (holdIQHandler != null) {
server.getIQRouter().removeHandler(holdIQHandler);
holdIQHandler = null;
}
if (sayIQHandler != null) {
server.getIQRouter().removeHandler(sayIQHandler);
sayIQHandler = null;
}
if (pauseSayIQHandler != null) {
server.getIQRouter().removeHandler(pauseSayIQHandler);
pauseSayIQHandler = null;
}
if (resumeSayIQHandler != null) {
server.getIQRouter().removeHandler(resumeSayIQHandler);
resumeSayIQHandler = null;
}
if (acceptIQHandler != null) {
server.getIQRouter().removeHandler(acceptIQHandler);
acceptIQHandler = null;
}
if (answerIQHandler != null) {
server.getIQRouter().removeHandler(answerIQHandler);
answerIQHandler = null;
}
if (dialIQHandler != null) {
server.getIQRouter().removeHandler(dialIQHandler);
dialIQHandler = null;
}
if (hangupIQHandler != null) {
server.getIQRouter().removeHandler(hangupIQHandler);
hangupIQHandler = null;
}
if (redirectIQHandler != null) {
server.getIQRouter().removeHandler(redirectIQHandler);
redirectIQHandler = null;
}
if (dtmfIQHandler != null) {
server.getIQRouter().removeHandler(dtmfIQHandler);
dtmfIQHandler = null;
}
}
use of org.jivesoftware.openfire.XMPPServer in project Openfire by igniterealtime.
the class RayoComponent method doStart.
public void doStart() {
Log.info("RayoComponent initialize " + jid);
XMPPServer server = XMPPServer.getInstance();
server.getIQDiscoInfoHandler().addServerFeature(RAYO_CORE);
rayoProvider = new RayoProvider();
rayoProvider.setValidator(new Validator());
server.getIQDiscoInfoHandler().addServerFeature(RAYO_RECORD);
recordProvider = new RecordProvider();
recordProvider.setValidator(new Validator());
server.getIQDiscoInfoHandler().addServerFeature(RAYO_SAY);
sayProvider = new SayProvider();
sayProvider.setValidator(new Validator());
server.getIQDiscoInfoHandler().addServerFeature(RAYO_HANDSET);
handsetProvider = new HandsetProvider();
handsetProvider.setValidator(new Validator());
createIQHandlers();
try {
Log.info("Starting jCumulus.....");
sessions = new Sessions();
ExecutorService executorservice = Executors.newCachedThreadPool();
NioDatagramChannelFactory niodatagramchannelfactory = new NioDatagramChannelFactory(executorservice);
bootstrap = new ConnectionlessBootstrap(niodatagramchannelfactory);
OrderedMemoryAwareThreadPoolExecutor orderedmemoryawarethreadpoolexecutor = new OrderedMemoryAwareThreadPoolExecutor(10, 0x100000L, 0x40000000L, 100L, TimeUnit.MILLISECONDS, Executors.defaultThreadFactory());
bootstrap.setPipelineFactory(new ServerPipelineFactory(sessions, orderedmemoryawarethreadpoolexecutor));
bootstrap.setOption("reuseAddress", Boolean.valueOf(true));
bootstrap.setOption("sendBufferSize", Integer.valueOf(1215));
bootstrap.setOption("receiveBufferSize", Integer.valueOf(2048));
bootstrap.setOption("receiveBufferSizePredictorFactory", new FixedReceiveBufferSizePredictorFactory(2048));
InetSocketAddress inetsocketaddress = new InetSocketAddress(JiveGlobals.getIntProperty("voicebridge.rtmfp.port", 1935));
Log.info("Listening on " + inetsocketaddress.getPort() + " port");
channel = bootstrap.bind(inetsocketaddress);
} catch (Exception e) {
Log.error("jCumulus startup failure");
e.printStackTrace();
}
}
use of org.jivesoftware.openfire.XMPPServer in project Openfire by igniterealtime.
the class STUNService method stopSTUNService.
private void stopSTUNService() {
XMPPServer server = XMPPServer.getInstance();
server.getIQDiscoInfoHandler().removeServerFeature(NAMESPACE);
if (stunIQHandler != null) {
server.getIQRouter().removeHandler(stunIQHandler);
stunIQHandler = null;
}
}
Aggregations