Commit 949ccaef authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

Put back Serialization that's apparantly needed. Fixed typo in mysql db...

Put back Serialization that's apparantly needed.  Fixed typo in mysql db script.  Switched TEXT to VARCHAR(1024) because TEXT doesn't want to be an index.  Fixed up localization and logging.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk/src/plugins/gateway@4481 b35dd754-fafc-0310-a699-88a17e54d16e
parent 10748bed
CREATE TABLE gatewayRegistration ( CREATE TABLE gatewayRegistration (
regisrationID BIGINT NOT NULL, registrationID BIGINT NOT NULL,
jid TEXT NOT NULL, jid VARCHAR(1024) NOT NULL,
gatewayType VARCHAR(15) NOT NULL, gatewayType VARCHAR(15) NOT NULL,
username VARCHAR(255) NOT NULL, username VARCHAR(255) NOT NULL,
password VARCHAR(255), password VARCHAR(255),
......
...@@ -14,8 +14,6 @@ import java.util.*; ...@@ -14,8 +14,6 @@ import java.util.*;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.dom4j.DocumentHelper; import org.dom4j.DocumentHelper;
import org.dom4j.Element; import org.dom4j.Element;
...@@ -26,6 +24,7 @@ import org.jivesoftware.wildfire.gateway.roster.PersistenceManager; ...@@ -26,6 +24,7 @@ import org.jivesoftware.wildfire.gateway.roster.PersistenceManager;
import org.jivesoftware.wildfire.gateway.roster.Roster; import org.jivesoftware.wildfire.gateway.roster.Roster;
import org.jivesoftware.wildfire.gateway.roster.Status; import org.jivesoftware.wildfire.gateway.roster.Status;
import org.jivesoftware.wildfire.gateway.util.BackgroundThreadFactory; import org.jivesoftware.wildfire.gateway.util.BackgroundThreadFactory;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.xmpp.component.Component; import org.xmpp.component.Component;
import org.xmpp.component.ComponentException; import org.xmpp.component.ComponentException;
...@@ -68,7 +67,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -68,7 +67,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
*/ */
public final String getDomain() { public final String getDomain() {
String domainName = this.componentManager.getServerName(); String domainName = this.componentManager.getServerName();
logger.log(Level.FINE, "basegateway.domainname", domainName); Log.debug(LocaleUtils.getLocalizedString("basegateway.domainname", "gateway", Arrays.asList(domainName)));
return domainName; return domainName;
} }
...@@ -84,9 +83,6 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -84,9 +83,6 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
return "gateway"; return "gateway";
} }
/** The logger. @see java.util.logging.Logger */
private static final Logger logger = Logger.getLogger("BaseGateway","gateway_i18n");
/** /**
* Jabber endpoint. * Jabber endpoint.
*/ */
...@@ -186,7 +182,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -186,7 +182,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
reply.setChildElement(responseElement); reply.setChildElement(responseElement);
} }
catch (Exception e) { catch (Exception e) {
logger.log(Level.WARNING, "basegateway.notfound", iq.getFrom().toBareJID()); Log.warn(LocaleUtils.getLocalizedString("basegateway.notfound", "gateway", Arrays.asList(iq.getFrom().toBareJID())));
} }
return reply; return reply;
} }
...@@ -260,7 +256,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -260,7 +256,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
results.add(unsubscribed); results.add(unsubscribed);
results.add(unavailable); results.add(unavailable);
logger.log(Level.INFO, "basegateway.unregister", iq.getFrom()); Log.info(LocaleUtils.getLocalizedString("basegateway.unregister", "gateway", Arrays.asList(iq.getFrom())));
return results; return results;
} }
...@@ -302,7 +298,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -302,7 +298,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
} }
catch (Exception e) { catch (Exception e) {
// unable to use dataform // unable to use dataform
logger.log(Level.FINER, "basegateway.dataformnotused", e); Log.debug(LocaleUtils.getLocalizedString("basegateway.dataformnotused", "gateway"), e);
} }
if (username == null || password == null) { if (username == null || password == null) {
...@@ -326,7 +322,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -326,7 +322,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
response.add(result); response.add(result);
} }
else { else {
logger.log(Level.INFO, "basegateway.register", username.trim()); Log.info(LocaleUtils.getLocalizedString("basegateway.register", "gateway", Arrays.asList(username.trim())));
SubscriptionInfo info = new SubscriptionInfo(username.trim(), password); SubscriptionInfo info = new SubscriptionInfo(username.trim(), password);
PersistenceManager.Factory.get(this).getRegistrar().add(iq.getFrom(), info); PersistenceManager.Factory.get(this).getRegistrar().add(iq.getFrom(), info);
reply.setChildElement(responseElement); reply.setChildElement(responseElement);
...@@ -390,7 +386,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -390,7 +386,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
responseElement.add(item); responseElement.add(item);
} }
reply.setChildElement(responseElement); reply.setChildElement(responseElement);
System.out.println(reply); Log.debug(reply.toString());
return reply; return reply;
} }
...@@ -448,7 +444,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -448,7 +444,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
processPacket((Message)packet); processPacket((Message)packet);
} }
else { else {
System.out.println("UNHANDLED: " + packet.toString()); Log.debug("UNHANDLED: " + packet.toString());
} }
// process // process
...@@ -458,7 +454,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -458,7 +454,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
} }
} }
else { else {
//System.out.println("Request[" + packet.toString() + "] with no response"); //Log.debug("Request[" + packet.toString() + "] with no response");
} }
} }
...@@ -476,7 +472,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -476,7 +472,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
* @see org.xmpp.packet.Message * @see org.xmpp.packet.Message
*/ */
private void processPacket(Message message) throws Exception { private void processPacket(Message message) throws Exception {
logger.finer(message.toString()); Log.debug(message.toString());
GatewaySession session = PersistenceManager.Factory.get(this).getRegistrar().getGatewaySession(message.getFrom()); GatewaySession session = PersistenceManager.Factory.get(this).getRegistrar().getGatewaySession(message.getFrom());
session.getLegacyEndpoint().sendPacket(message); session.getLegacyEndpoint().sendPacket(message);
...@@ -493,16 +489,16 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -493,16 +489,16 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
List<Presence> p = new ArrayList<Presence>(); List<Presence> p = new ArrayList<Presence>();
JID from = presence.getFrom(); JID from = presence.getFrom();
logger.finest(presence.toString()); Log.debug(presence.toString());
/* /*
* Unknown entity is trying to access the gateway. * Unknown entity is trying to access the gateway.
*/ */
if (!rosterManager.getRegistrar().isRegistered(NormalizedJID.wrap(from))) { if (!rosterManager.getRegistrar().isRegistered(NormalizedJID.wrap(from))) {
logger.log(Level.INFO, "basegateway.unabletofind", from); Log.info(LocaleUtils.getLocalizedString("basegateway.unabletofind", "gateway", Arrays.asList(from)));
// silently ignore a delete request // silently ignore a delete request
if (!Presence.Type.unavailable.equals(presence.getType())) { if (!Presence.Type.unavailable.equals(presence.getType())) {
logger.log(Level.INFO, "basegateway.unauthorizedrequest", new Object[] { presence.getType(), from.toString() }); Log.info(LocaleUtils.getLocalizedString("basegateway.unauthorizedrequest", "gateway", Arrays.asList(new Object[] { presence.getType(), from.toString() })));
Presence result = new Presence(); Presence result = new Presence();
result.setError(Condition.not_authorized); result.setError(Condition.not_authorized);
result.setStatus(LocaleUtils.getLocalizedString("basegateway.registerfirst", "gateway")); result.setStatus(LocaleUtils.getLocalizedString("basegateway.registerfirst", "gateway"));
...@@ -516,7 +512,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -516,7 +512,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
*/ */
GatewaySession sessionInfo = rosterManager.getRegistrar().getGatewaySession(from); GatewaySession sessionInfo = rosterManager.getRegistrar().getGatewaySession(from);
if (sessionInfo == null) { if (sessionInfo == null) {
logger.log(Level.WARNING, "basegateway.unabletolocatesession" , from); Log.warn(LocaleUtils.getLocalizedString("basegateway.unabletolocatesession" , "gateway", Arrays.asList(from)));
return p; return p;
} }
...@@ -541,7 +537,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -541,7 +537,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
sessionInfo.getSubscriptionInfo().clientRegistered = true; sessionInfo.getSubscriptionInfo().clientRegistered = true;
} }
else { // subscribe to legacy user else { // subscribe to legacy user
logger.log(Level.FINE,"basegateway.subscribed"); Log.debug(LocaleUtils.getLocalizedString("basegateway.subscribed", "gateway"));
} }
} }
else if (Presence.Type.unavailable.equals(presence.getType())){ else if (Presence.Type.unavailable.equals(presence.getType())){
...@@ -563,7 +559,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -563,7 +559,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
result.setTo(presence.getFrom()); result.setTo(presence.getFrom());
result.setFrom(this.jid); result.setFrom(this.jid);
p.add(result); p.add(result);
logger.log(Level.FINE, "basegateway.gatewaypresence"); Log.debug(LocaleUtils.getLocalizedString("basegateway.gatewaypresence", "gateway"));
} }
else { else {
GatewaySession session = rosterManager.getRegistrar().getGatewaySession(presence.getFrom()); GatewaySession session = rosterManager.getRegistrar().getGatewaySession(presence.getFrom());
...@@ -583,8 +579,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -583,8 +579,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
p.add(p2); p.add(p2);
} }
catch (Exception e) { catch (Exception e) {
logger.log(Level.WARNING, "basegateway.statusexception", Log.warn(LocaleUtils.getLocalizedString("basegateway.statusexception", "gateway", Arrays.asList(new Object[]{presence.getTo(), presence.getFrom(), e.getLocalizedMessage()})));
new Object[]{presence.getTo(), presence.getFrom(), e.getLocalizedMessage()});
} }
} }
return p; return p;
...@@ -657,7 +652,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -657,7 +652,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
* subscribed the contact to the JID. * subscribed the contact to the JID.
*/ */
public void run() { public void run() {
logger.log(Level.FINEST, "basegateway.maintenancestart"); Log.debug(LocaleUtils.getLocalizedString("basegateway.maintenancestart", "gateway"));
for (SubscriptionInfo si : rosterManager.getRegistrar().getAllGatewaySessions()) { for (SubscriptionInfo si : rosterManager.getRegistrar().getAllGatewaySessions()) {
if (!si.clientRegistered) { if (!si.clientRegistered) {
...@@ -682,7 +677,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -682,7 +677,7 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
// try { // try {
// componentManager.sendPacket(this, p); // componentManager.sendPacket(this, p);
// } catch (Exception e) { // } catch (Exception e) {
// logger.log(Level.WARNING, "basegateway.unabletosendpresence", e); // Log.warn(LocaleUtils.getLocalizedString("basegateway.unabletosendpresence", "gateway"), e);
// } // }
// } // }
} }
...@@ -695,11 +690,11 @@ public abstract class BaseGateway implements Gateway, Component, Runnable { ...@@ -695,11 +690,11 @@ public abstract class BaseGateway implements Gateway, Component, Runnable {
// try { // try {
// componentManager.sendPacket(this, p); // componentManager.sendPacket(this, p);
// } catch (Exception e) { // } catch (Exception e) {
// logger.log(Level.WARNING, "basegateway.unabletosendpresence", e); // Log.warn(LocaleUtils.getLocalizedString("basegateway.unabletosendpresence", "gateway"), e);
// } // }
// } // }
logger.log(Level.FINEST, "basegateway.maintenancestop"); Log.debug(LocaleUtils.getLocalizedString("basegateway.maintenancestop", "gateway"));
} }
/** /**
......
...@@ -11,14 +11,17 @@ ...@@ -11,14 +11,17 @@
package org.jivesoftware.wildfire.gateway; package org.jivesoftware.wildfire.gateway;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.logging.Level;
import java.util.logging.Logger; import org.jivesoftware.util.Log;
import org.jivesoftware.util.LocaleUtils;
import org.xmpp.component.Component; import org.xmpp.component.Component;
import org.xmpp.component.ComponentException; import org.xmpp.component.ComponentException;
import org.xmpp.component.ComponentManager; import org.xmpp.component.ComponentManager;
import org.xmpp.packet.Packet; import org.xmpp.packet.Packet;
import java.util.Arrays;
/** /**
* The <code>JabberEndpoint</code> implements the <code>Endpoint</code> for an * The <code>JabberEndpoint</code> implements the <code>Endpoint</code> for an
* XMPP server. * XMPP server.
...@@ -83,16 +86,13 @@ public class JabberEndpoint implements Endpoint { ...@@ -83,16 +86,13 @@ public class JabberEndpoint implements Endpoint {
} }
else { else {
queue.add(packet); queue.add(packet);
logger.log(Level.FINE, "jabberendpoint.sendpacketenqueue", packet.getFrom()); Log.debug(LocaleUtils.getLocalizedString("jabberendpoint.sendpacketenqueue", "gateway", Arrays.asList(packet.getFrom())));
} }
} }
/** The backlog queue. */ /** The backlog queue. */
private final ConcurrentLinkedQueue<Packet> queue = new ConcurrentLinkedQueue<Packet>(); private final ConcurrentLinkedQueue<Packet> queue = new ConcurrentLinkedQueue<Packet>();
/** The logger. */
final static private Logger logger = Logger.getLogger("JabberEndpoint", "gateway_i18n");
/** /**
* @see org.jivesoftware.wildfire.gateway.Endpoint#getValve() * @see org.jivesoftware.wildfire.gateway.Endpoint#getValve()
*/ */
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
package org.jivesoftware.wildfire.gateway.protocols.yahoo; package org.jivesoftware.wildfire.gateway.protocols.yahoo;
import java.util.logging.Logger; import org.jivesoftware.util.Log;
import ymsg.network.event.SessionChatEvent; import ymsg.network.event.SessionChatEvent;
import ymsg.network.event.SessionConferenceEvent; import ymsg.network.event.SessionConferenceEvent;
...@@ -32,56 +32,53 @@ import ymsg.network.event.SessionNotifyEvent; ...@@ -32,56 +32,53 @@ import ymsg.network.event.SessionNotifyEvent;
*/ */
public class NoopSessionListener implements SessionListener { public class NoopSessionListener implements SessionListener {
/** The logger. @see java.util.logging.Logger */
private static final Logger logger = Logger.getLogger("NoopSessionListener");
/** /**
* @see ymsg.network.event.SessionListener#fileTransferReceived(ymsg.network.event.SessionFileTransferEvent) * @see ymsg.network.event.SessionListener#fileTransferReceived(ymsg.network.event.SessionFileTransferEvent)
*/ */
public void fileTransferReceived(SessionFileTransferEvent arg0) { public void fileTransferReceived(SessionFileTransferEvent arg0) {
logger.info(arg0.toString()); Log.info(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#connectionClosed(ymsg.network.event.SessionEvent) * @see ymsg.network.event.SessionListener#connectionClosed(ymsg.network.event.SessionEvent)
*/ */
public void connectionClosed(SessionEvent arg0) { public void connectionClosed(SessionEvent arg0) {
logger.info(arg0.toString()); Log.info(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#listReceived(ymsg.network.event.SessionEvent) * @see ymsg.network.event.SessionListener#listReceived(ymsg.network.event.SessionEvent)
*/ */
public void listReceived(SessionEvent arg0) { public void listReceived(SessionEvent arg0) {
logger.info(arg0.toString()); Log.info(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#messageReceived(ymsg.network.event.SessionEvent) * @see ymsg.network.event.SessionListener#messageReceived(ymsg.network.event.SessionEvent)
*/ */
public void messageReceived(SessionEvent arg0) { public void messageReceived(SessionEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#buzzReceived(ymsg.network.event.SessionEvent) * @see ymsg.network.event.SessionListener#buzzReceived(ymsg.network.event.SessionEvent)
*/ */
public void buzzReceived(SessionEvent arg0) { public void buzzReceived(SessionEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#offlineMessageReceived(ymsg.network.event.SessionEvent) * @see ymsg.network.event.SessionListener#offlineMessageReceived(ymsg.network.event.SessionEvent)
*/ */
public void offlineMessageReceived(SessionEvent arg0) { public void offlineMessageReceived(SessionEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#errorPacketReceived(ymsg.network.event.SessionErrorEvent) * @see ymsg.network.event.SessionListener#errorPacketReceived(ymsg.network.event.SessionErrorEvent)
*/ */
public void errorPacketReceived(SessionErrorEvent arg0) { public void errorPacketReceived(SessionErrorEvent arg0) {
logger.severe(arg0.toString()); Log.error(arg0.toString());
} }
/** /**
...@@ -89,126 +86,126 @@ public class NoopSessionListener implements SessionListener { ...@@ -89,126 +86,126 @@ public class NoopSessionListener implements SessionListener {
*/ */
public void inputExceptionThrown(SessionExceptionEvent arg0) { public void inputExceptionThrown(SessionExceptionEvent arg0) {
arg0.getException().printStackTrace(); arg0.getException().printStackTrace();
logger.severe(arg0.toString()); Log.error(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#newMailReceived(ymsg.network.event.SessionNewMailEvent) * @see ymsg.network.event.SessionListener#newMailReceived(ymsg.network.event.SessionNewMailEvent)
*/ */
public void newMailReceived(SessionNewMailEvent arg0) { public void newMailReceived(SessionNewMailEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#notifyReceived(ymsg.network.event.SessionNotifyEvent) * @see ymsg.network.event.SessionListener#notifyReceived(ymsg.network.event.SessionNotifyEvent)
*/ */
public void notifyReceived(SessionNotifyEvent arg0) { public void notifyReceived(SessionNotifyEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#contactRequestReceived(ymsg.network.event.SessionEvent) * @see ymsg.network.event.SessionListener#contactRequestReceived(ymsg.network.event.SessionEvent)
*/ */
public void contactRequestReceived(SessionEvent arg0) { public void contactRequestReceived(SessionEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#contactRejectionReceived(ymsg.network.event.SessionEvent) * @see ymsg.network.event.SessionListener#contactRejectionReceived(ymsg.network.event.SessionEvent)
*/ */
public void contactRejectionReceived(SessionEvent arg0) { public void contactRejectionReceived(SessionEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#conferenceInviteReceived(ymsg.network.event.SessionConferenceEvent) * @see ymsg.network.event.SessionListener#conferenceInviteReceived(ymsg.network.event.SessionConferenceEvent)
*/ */
public void conferenceInviteReceived(SessionConferenceEvent arg0) { public void conferenceInviteReceived(SessionConferenceEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#conferenceInviteDeclinedReceived(ymsg.network.event.SessionConferenceEvent) * @see ymsg.network.event.SessionListener#conferenceInviteDeclinedReceived(ymsg.network.event.SessionConferenceEvent)
*/ */
public void conferenceInviteDeclinedReceived(SessionConferenceEvent arg0) { public void conferenceInviteDeclinedReceived(SessionConferenceEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#conferenceLogonReceived(ymsg.network.event.SessionConferenceEvent) * @see ymsg.network.event.SessionListener#conferenceLogonReceived(ymsg.network.event.SessionConferenceEvent)
*/ */
public void conferenceLogonReceived(SessionConferenceEvent arg0) { public void conferenceLogonReceived(SessionConferenceEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#conferenceLogoffReceived(ymsg.network.event.SessionConferenceEvent) * @see ymsg.network.event.SessionListener#conferenceLogoffReceived(ymsg.network.event.SessionConferenceEvent)
*/ */
public void conferenceLogoffReceived(SessionConferenceEvent arg0) { public void conferenceLogoffReceived(SessionConferenceEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#conferenceMessageReceived(ymsg.network.event.SessionConferenceEvent) * @see ymsg.network.event.SessionListener#conferenceMessageReceived(ymsg.network.event.SessionConferenceEvent)
*/ */
public void conferenceMessageReceived(SessionConferenceEvent arg0) { public void conferenceMessageReceived(SessionConferenceEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#friendsUpdateReceived(ymsg.network.event.SessionFriendEvent) * @see ymsg.network.event.SessionListener#friendsUpdateReceived(ymsg.network.event.SessionFriendEvent)
*/ */
public void friendsUpdateReceived(SessionFriendEvent arg0) { public void friendsUpdateReceived(SessionFriendEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#friendAddedReceived(ymsg.network.event.SessionFriendEvent) * @see ymsg.network.event.SessionListener#friendAddedReceived(ymsg.network.event.SessionFriendEvent)
*/ */
public void friendAddedReceived(SessionFriendEvent arg0) { public void friendAddedReceived(SessionFriendEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#friendRemovedReceived(ymsg.network.event.SessionFriendEvent) * @see ymsg.network.event.SessionListener#friendRemovedReceived(ymsg.network.event.SessionFriendEvent)
*/ */
public void friendRemovedReceived(SessionFriendEvent arg0) { public void friendRemovedReceived(SessionFriendEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#chatLogonReceived(ymsg.network.event.SessionChatEvent) * @see ymsg.network.event.SessionListener#chatLogonReceived(ymsg.network.event.SessionChatEvent)
*/ */
public void chatLogonReceived(SessionChatEvent arg0) { public void chatLogonReceived(SessionChatEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#chatLogoffReceived(ymsg.network.event.SessionChatEvent) * @see ymsg.network.event.SessionListener#chatLogoffReceived(ymsg.network.event.SessionChatEvent)
*/ */
public void chatLogoffReceived(SessionChatEvent arg0) { public void chatLogoffReceived(SessionChatEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#chatMessageReceived(ymsg.network.event.SessionChatEvent) * @see ymsg.network.event.SessionListener#chatMessageReceived(ymsg.network.event.SessionChatEvent)
*/ */
public void chatMessageReceived(SessionChatEvent arg0) { public void chatMessageReceived(SessionChatEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#chatUserUpdateReceived(ymsg.network.event.SessionChatEvent) * @see ymsg.network.event.SessionListener#chatUserUpdateReceived(ymsg.network.event.SessionChatEvent)
*/ */
public void chatUserUpdateReceived(SessionChatEvent arg0) { public void chatUserUpdateReceived(SessionChatEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
/** /**
* @see ymsg.network.event.SessionListener#chatConnectionClosed(ymsg.network.event.SessionEvent) * @see ymsg.network.event.SessionListener#chatConnectionClosed(ymsg.network.event.SessionEvent)
*/ */
public void chatConnectionClosed(SessionEvent arg0) { public void chatConnectionClosed(SessionEvent arg0) {
logger.finest(arg0.toString()); Log.debug(arg0.toString());
} }
} }
...@@ -12,8 +12,9 @@ package org.jivesoftware.wildfire.gateway.protocols.yahoo; ...@@ -12,8 +12,9 @@ package org.jivesoftware.wildfire.gateway.protocols.yahoo;
import java.util.PropertyResourceBundle; import java.util.PropertyResourceBundle;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger; import org.jivesoftware.util.Log;
import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.wildfire.gateway.Gateway; import org.jivesoftware.wildfire.gateway.Gateway;
import org.jivesoftware.wildfire.gateway.roster.AbstractForeignContact; import org.jivesoftware.wildfire.gateway.roster.AbstractForeignContact;
...@@ -109,17 +110,13 @@ public class YahooForeignContact extends AbstractForeignContact { ...@@ -109,17 +110,13 @@ public class YahooForeignContact extends AbstractForeignContact {
status.updateValue(resource.getString("STATUS_TYPING")); status.updateValue(resource.getString("STATUS_TYPING"));
} }
else { else {
logger.log(Level.WARNING, "yahooforeigncontact.unabletolocatestatus"); Log.warn(LocaleUtils.getLocalizedString("yahooforeigncontact.unabletolocatestatus", "gateway"));
status.updateValue("????"); status.updateValue("????");
} }
return status; return status;
} }
/** The logger. */
final static private Logger logger = Logger.getLogger("yahooforeigncontact",
"gateway_i18n");
/** The resource. */ /** The resource. */
private static ResourceBundle resource = PropertyResourceBundle.getBundle("yahoostatus"); private static ResourceBundle resource = PropertyResourceBundle.getBundle("yahoostatus");
......
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
package org.jivesoftware.wildfire.gateway.protocols.yahoo; package org.jivesoftware.wildfire.gateway.protocols.yahoo;
import java.util.logging.Logger;
import org.jivesoftware.wildfire.gateway.BaseGateway; import org.jivesoftware.wildfire.gateway.BaseGateway;
import org.jivesoftware.wildfire.gateway.GatewaySession; import org.jivesoftware.wildfire.gateway.GatewaySession;
import org.jivesoftware.wildfire.gateway.SubscriptionInfo; import org.jivesoftware.wildfire.gateway.SubscriptionInfo;
...@@ -52,9 +50,6 @@ public class YahooGateway extends BaseGateway { ...@@ -52,9 +50,6 @@ public class YahooGateway extends BaseGateway {
return "Yahoo! Gateway (ymsg9)"; return "Yahoo! Gateway (ymsg9)";
} }
/** The logger. @see java.util.logging.Logger */
static public final Logger logger = Logger.getLogger("YahooGateway");
/** /**
* @see org.jivesoftware.wildfire.gateway.Endpoint#sendPacket(Packet) * @see org.jivesoftware.wildfire.gateway.Endpoint#sendPacket(Packet)
*/ */
......
...@@ -12,13 +12,12 @@ package org.jivesoftware.wildfire.gateway.protocols.yahoo; ...@@ -12,13 +12,12 @@ package org.jivesoftware.wildfire.gateway.protocols.yahoo;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.Vector; import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.wildfire.gateway.AbstractGatewaySession; import org.jivesoftware.wildfire.gateway.AbstractGatewaySession;
import org.jivesoftware.wildfire.gateway.Endpoint; import org.jivesoftware.wildfire.gateway.Endpoint;
...@@ -31,6 +30,8 @@ import org.jivesoftware.wildfire.gateway.roster.ForeignContact; ...@@ -31,6 +30,8 @@ import org.jivesoftware.wildfire.gateway.roster.ForeignContact;
import org.jivesoftware.wildfire.gateway.roster.NormalizedJID; import org.jivesoftware.wildfire.gateway.roster.NormalizedJID;
import org.jivesoftware.wildfire.gateway.roster.PersistenceManager; import org.jivesoftware.wildfire.gateway.roster.PersistenceManager;
import org.jivesoftware.wildfire.gateway.roster.UnknownForeignContactException; import org.jivesoftware.wildfire.gateway.roster.UnknownForeignContactException;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.LocaleUtils;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
import org.xmpp.packet.Message; import org.xmpp.packet.Message;
import org.xmpp.packet.Packet; import org.xmpp.packet.Packet;
...@@ -50,9 +51,6 @@ import ymsg.network.YahooUser; ...@@ -50,9 +51,6 @@ import ymsg.network.YahooUser;
*/ */
public class YahooGatewaySession extends AbstractGatewaySession implements Endpoint { public class YahooGatewaySession extends AbstractGatewaySession implements Endpoint {
/** The logger. */
private static Logger logger = Logger.getLogger("YahooGatewaySession", "gateway_i18n");
/** /**
* Yahoo Session * Yahoo Session
*/ */
...@@ -98,7 +96,7 @@ public class YahooGatewaySession extends AbstractGatewaySession implements Endpo ...@@ -98,7 +96,7 @@ public class YahooGatewaySession extends AbstractGatewaySession implements Endpo
// Vector members = group.getMembers(); // Vector members = group.getMembers();
// for(Object member : members) { // for(Object member : members) {
// YahooUser user = (YahooUser)member; // YahooUser user = (YahooUser)member;
// logger.info("Adding foreign contact: " + user.getId()); // Log.info("Adding foreign contact: " + user.getId());
// String foreignId = user.getId(); // String foreignId = user.getId();
// NormalizedJID whois = NormalizedJID.wrap(gateway.whois(foreignId)); // NormalizedJID whois = NormalizedJID.wrap(gateway.whois(foreignId));
// AbstractForeignContact fc = PersistenceManager.Factory.get(gateway) // AbstractForeignContact fc = PersistenceManager.Factory.get(gateway)
...@@ -106,15 +104,15 @@ public class YahooGatewaySession extends AbstractGatewaySession implements Endpo ...@@ -106,15 +104,15 @@ public class YahooGatewaySession extends AbstractGatewaySession implements Endpo
// .getForeignContact(foreignId, gateway); // .getForeignContact(foreignId, gateway);
// //
// if(fc == null || fc.status == null) { // if(fc == null || fc.status == null) {
// logger.warning("Unable to find Foreign Contact for: " + whois); // Log.warn("Unable to find Foreign Contact for: " + whois);
// continue; // continue;
// } // }
// if(user == null) { // if(user == null) {
// logger.warning("Invalid Yahoo user"); // Log.warn("Invalid Yahoo user");
// continue; // continue;
// } // }
// if(fc.status.getValue() != null && !fc.status.getValue().equalsIgnoreCase(user.getCustomStatusMessage())) { // if(fc.status.getValue() != null && !fc.status.getValue().equalsIgnoreCase(user.getCustomStatusMessage())) {
// logger.log(Level.FINE, "yahoogatewaysession.status", new Object[] {fc.status}); // Log.debug(LocaleUtils.getLocalizedString("yahoogatewaysession.status", "gateway", Arrays.asList(new Object[] {fc.status})));
// try { // try {
// Presence p = new Presence(); // Presence p = new Presence();
// if(!fc.status.isSubscribed()) { // if(!fc.status.isSubscribed()) {
...@@ -152,7 +150,7 @@ public class YahooGatewaySession extends AbstractGatewaySession implements Endpo ...@@ -152,7 +150,7 @@ public class YahooGatewaySession extends AbstractGatewaySession implements Endpo
* Password is stored in the JVM as a string in JVM * Password is stored in the JVM as a string in JVM
* util termination. * util termination.
*/ */
logger.log(Level.INFO, "yahoogatewaysession.login", new Object[]{jid, getSubscriptionInfo().username}); Log.info(LocaleUtils.getLocalizedString("yahoogatewaysession.login", "gateway", Arrays.asList(new Object[]{jid, getSubscriptionInfo().username})));
getJabberEndpoint().getValve().open(); // allow any buffered messages to pass through getJabberEndpoint().getValve().open(); // allow any buffered messages to pass through
// updatePresence(); // updatePresence();
} }
...@@ -161,7 +159,7 @@ public class YahooGatewaySession extends AbstractGatewaySession implements Endpo ...@@ -161,7 +159,7 @@ public class YahooGatewaySession extends AbstractGatewaySession implements Endpo
if (loginFailedCount++ > 3) { if (loginFailedCount++ > 3) {
loginFailed = true; loginFailed = true;
} }
logger.warning("Login failed for " + getSubscriptionInfo().username); Log.warn("Login failed for " + getSubscriptionInfo().username);
} }
catch (IOException ioe) { catch (IOException ioe) {
ioe.printStackTrace(); ioe.printStackTrace();
...@@ -171,7 +169,7 @@ public class YahooGatewaySession extends AbstractGatewaySession implements Endpo ...@@ -171,7 +169,7 @@ public class YahooGatewaySession extends AbstractGatewaySession implements Endpo
}.run(); // intentionally not forked. }.run(); // intentionally not forked.
} }
else { else {
logger.warning(this.jid + " is already logged in"); Log.warn(this.jid + " is already logged in");
} }
} }
...@@ -188,7 +186,7 @@ public class YahooGatewaySession extends AbstractGatewaySession implements Endpo ...@@ -188,7 +186,7 @@ public class YahooGatewaySession extends AbstractGatewaySession implements Endpo
* @throws Exception * @throws Exception
*/ */
public synchronized void logout() throws Exception { public synchronized void logout() throws Exception {
logger.info("[" + this.jid + "]" + getSubscriptionInfo().username + " logged out."); Log.info("[" + this.jid + "]" + getSubscriptionInfo().username + " logged out.");
session.logout(); session.logout();
session.reset(); session.reset();
} }
...@@ -287,14 +285,14 @@ public class YahooGatewaySession extends AbstractGatewaySession implements Endpo ...@@ -287,14 +285,14 @@ public class YahooGatewaySession extends AbstractGatewaySession implements Endpo
* @param packet incoming packet from XMPP Server (typically from client) * @param packet incoming packet from XMPP Server (typically from client)
*/ */
public void sendPacket(Packet packet) { public void sendPacket(Packet packet) {
logger.log(Level.FINE, packet.toString()); Log.debug(packet.toString());
if (packet instanceof Message) { if (packet instanceof Message) {
Message m = (Message)packet; Message m = (Message)packet;
try { try {
session.sendMessage(packet.getTo().getNode(), m.getBody()); session.sendMessage(packet.getTo().getNode(), m.getBody());
} }
catch (IOException ioe) { catch (IOException ioe) {
logger.warning(ioe.getLocalizedMessage()); Log.warn(ioe.getLocalizedMessage());
} }
} }
} }
......
...@@ -10,13 +10,15 @@ ...@@ -10,13 +10,15 @@
package org.jivesoftware.wildfire.gateway.protocols.yahoo; package org.jivesoftware.wildfire.gateway.protocols.yahoo;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.xmpp.component.ComponentException; import org.xmpp.component.ComponentException;
import org.xmpp.packet.Message; import org.xmpp.packet.Message;
import org.xmpp.packet.Presence; import org.xmpp.packet.Presence;
import java.util.Arrays;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.LocaleUtils;
import ymsg.network.event.SessionChatEvent; import ymsg.network.event.SessionChatEvent;
import ymsg.network.event.SessionEvent; import ymsg.network.event.SessionEvent;
import ymsg.network.event.SessionFriendEvent; import ymsg.network.event.SessionFriendEvent;
...@@ -35,9 +37,6 @@ public class YahooSessionListener extends NoopSessionListener { ...@@ -35,9 +37,6 @@ public class YahooSessionListener extends NoopSessionListener {
*/ */
private YahooGatewaySession gatewaySession; private YahooGatewaySession gatewaySession;
/** The logger. */
private static final Logger logger = Logger.getLogger("YahooSessionListener");
/** /**
* Creates a YahooSessionListener that will translate events from the Yahoo! * Creates a YahooSessionListener that will translate events from the Yahoo!
* connection into XMPP formated packets. * connection into XMPP formated packets.
...@@ -62,7 +61,7 @@ public class YahooSessionListener extends NoopSessionListener { ...@@ -62,7 +61,7 @@ public class YahooSessionListener extends NoopSessionListener {
gatewaySession.getJabberEndpoint().sendPacket(message); gatewaySession.getJabberEndpoint().sendPacket(message);
} }
catch (Exception e) { catch (Exception e) {
logger.severe("Unable to send message: " + e.getLocalizedMessage()); Log.error("Unable to send message: " + e.getLocalizedMessage());
} }
} }
...@@ -71,7 +70,7 @@ public class YahooSessionListener extends NoopSessionListener { ...@@ -71,7 +70,7 @@ public class YahooSessionListener extends NoopSessionListener {
*/ */
@Override @Override
public void messageReceived(SessionEvent sessionEvent) { public void messageReceived(SessionEvent sessionEvent) {
logger.finest(sessionEvent.toString()); Log.debug(sessionEvent.toString());
try { try {
Message message = new Message(); Message message = new Message();
...@@ -80,10 +79,10 @@ public class YahooSessionListener extends NoopSessionListener { ...@@ -80,10 +79,10 @@ public class YahooSessionListener extends NoopSessionListener {
message.setType(Message.Type.chat); message.setType(Message.Type.chat);
message.setFrom(this.gatewaySession.getGateway().whois(sessionEvent.getFrom())); message.setFrom(this.gatewaySession.getGateway().whois(sessionEvent.getFrom()));
gatewaySession.getJabberEndpoint().sendPacket(message); gatewaySession.getJabberEndpoint().sendPacket(message);
logger.fine(message.getElement().asXML()); Log.debug(message.getElement().asXML());
} }
catch (Exception e) { catch (Exception e) {
logger.severe("unable to send message: "+ e.getLocalizedMessage()); Log.error("unable to send message: "+ e.getLocalizedMessage());
} }
} }
...@@ -96,7 +95,7 @@ public class YahooSessionListener extends NoopSessionListener { ...@@ -96,7 +95,7 @@ public class YahooSessionListener extends NoopSessionListener {
updateStatus(event); updateStatus(event);
} }
catch (Exception e) { catch (Exception e) {
logger.log(Level.SEVERE, "yahoosessionlistener.friendupdateerror", e.getLocalizedMessage()); Log.debug(LocaleUtils.getLocalizedString("yahoosessionlistener.friendupdateerror", "gateway", Arrays.asList(e.getLocalizedMessage())));
} }
} }
...@@ -119,7 +118,7 @@ public class YahooSessionListener extends NoopSessionListener { ...@@ -119,7 +118,7 @@ public class YahooSessionListener extends NoopSessionListener {
*/ */
@Override @Override
public void chatMessageReceived(SessionChatEvent sessionEvent) { public void chatMessageReceived(SessionChatEvent sessionEvent) {
logger.finer(sessionEvent.toString()); Log.debug(sessionEvent.toString());
try { try {
Message message = new Message(); Message message = new Message();
message.setTo(gatewaySession.getSessionJID()); message.setTo(gatewaySession.getSessionJID());
...@@ -128,7 +127,7 @@ public class YahooSessionListener extends NoopSessionListener { ...@@ -128,7 +127,7 @@ public class YahooSessionListener extends NoopSessionListener {
gatewaySession.getJabberEndpoint().sendPacket(message); gatewaySession.getJabberEndpoint().sendPacket(message);
} }
catch (Exception e) { catch (Exception e) {
logger.severe("unable to send message: "+ e.getLocalizedMessage()); Log.error("unable to send message: "+ e.getLocalizedMessage());
} }
} }
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
package org.jivesoftware.wildfire.gateway.roster; package org.jivesoftware.wildfire.gateway.roster;
import java.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
...@@ -23,7 +25,9 @@ import org.xmpp.packet.JID; ...@@ -23,7 +25,9 @@ import org.xmpp.packet.JID;
* *
* @author Noah Campbell * @author Noah Campbell
*/ */
public class ContactManager { public class ContactManager implements Serializable {
private static final long serialVersionUID = 1L;
/** /**
* Construct a new <code>ContactManager</code> * Construct a new <code>ContactManager</code>
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
package org.jivesoftware.wildfire.gateway.roster; package org.jivesoftware.wildfire.gateway.roster;
import java.io.Serializable;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
...@@ -21,7 +23,9 @@ import org.xmpp.packet.JID; ...@@ -21,7 +23,9 @@ import org.xmpp.packet.JID;
* @author Noah Campbell * @author Noah Campbell
* *
*/ */
public final class NormalizedJID { public final class NormalizedJID implements Serializable {
private static final long serialVersionUID = 1L;
/** /**
* The JID. * The JID.
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
package org.jivesoftware.wildfire.gateway.roster; package org.jivesoftware.wildfire.gateway.roster;
import java.io.Serializable;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
...@@ -20,8 +21,6 @@ import java.util.Map; ...@@ -20,8 +21,6 @@ import java.util.Map;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
import javax.crypto.Cipher; import javax.crypto.Cipher;
...@@ -33,7 +32,8 @@ import javax.crypto.spec.SecretKeySpec; ...@@ -33,7 +32,8 @@ import javax.crypto.spec.SecretKeySpec;
import org.jivesoftware.wildfire.gateway.Gateway; import org.jivesoftware.wildfire.gateway.Gateway;
import org.jivesoftware.wildfire.gateway.util.BackgroundThreadFactory; import org.jivesoftware.wildfire.gateway.util.BackgroundThreadFactory;
import org.jivesoftware.wildfire.gateway.util.GatewayLevel; import org.jivesoftware.util.Log;
import org.jivesoftware.util.LocaleUtils;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
/** /**
...@@ -45,7 +45,9 @@ import org.xmpp.packet.JID; ...@@ -45,7 +45,9 @@ import org.xmpp.packet.JID;
* @author Noah Campbell * @author Noah Campbell
* *
*/ */
public class PersistenceManager { public class PersistenceManager implements Serializable {
private static final long serialVersionUID = 1L;
/** /**
* The contactManager. * The contactManager.
...@@ -130,7 +132,7 @@ public class PersistenceManager { ...@@ -130,7 +132,7 @@ public class PersistenceManager {
registrar.remove(jid); registrar.remove(jid);
} }
catch (Exception e) { catch (Exception e) {
logger.severe("Unable to remove " + bareJID + ": " + e.getLocalizedMessage()); Log.error("Unable to remove " + bareJID + ": " + e.getLocalizedMessage());
} }
} }
...@@ -149,7 +151,7 @@ public class PersistenceManager { ...@@ -149,7 +151,7 @@ public class PersistenceManager {
byte[] rawKey = Preferences.systemNodeForPackage(this.getClass()).getByteArray(".key", null); byte[] rawKey = Preferences.systemNodeForPackage(this.getClass()).getByteArray(".key", null);
if (rawKey == null) { if (rawKey == null) {
logger.log(GatewayLevel.SECURITY, "persistencemanager.nokey"); Log.error(LocaleUtils.getLocalizedString("persistencemanager.nokey", "gateway"));
return; return;
} }
...@@ -168,7 +170,7 @@ public class PersistenceManager { ...@@ -168,7 +170,7 @@ public class PersistenceManager {
if (db.exists()) { if (db.exists()) {
db.delete(); db.delete();
} }
logger.log(Level.WARNING, "persistencemanager.loadrosterfailed",e); Log.warn(LocaleUtils.getLocalizedString("persistencemanager.loadrosterfailed", "gateway"), e);
} }
finally { finally {
this.contactManager = (contactManager != null) ? contactManager : new ContactManager(); this.contactManager = (contactManager != null) ? contactManager : new ContactManager();
...@@ -184,13 +186,6 @@ public class PersistenceManager { ...@@ -184,13 +186,6 @@ public class PersistenceManager {
*/ */
private final ScheduledExecutorService timer = Executors.newScheduledThreadPool(1, new BackgroundThreadFactory()); private final ScheduledExecutorService timer = Executors.newScheduledThreadPool(1, new BackgroundThreadFactory());
/**
* The logger.
*
* @see PersistenceManager
*/
private static final Logger logger = Logger.getLogger("PersistenceManager", "gateway_i18n");
/** /**
* Responsible for flushing the in-memory database. * Responsible for flushing the in-memory database.
*/ */
...@@ -200,7 +195,7 @@ public class PersistenceManager { ...@@ -200,7 +195,7 @@ public class PersistenceManager {
store(); store();
} }
catch (Exception e) { catch (Exception e) {
logger.log(Level.WARNING, "persistencemanager.unabletoflush", e); Log.warn(LocaleUtils.getLocalizedString("persistencemanager.unabletoflush", "gateway"), e);
e.printStackTrace(); e.printStackTrace();
} }
} }
...@@ -216,7 +211,7 @@ public class PersistenceManager { ...@@ -216,7 +211,7 @@ public class PersistenceManager {
byte[] rawKey = prefs.getByteArray(".key", null); byte[] rawKey = prefs.getByteArray(".key", null);
if (rawKey == null) { if (rawKey == null) {
logger.log(GatewayLevel.SECURITY, "persistencemanager.gennewkey"); Log.error(LocaleUtils.getLocalizedString("persistencemanager.gennewkey", "gateway"));
KeyGenerator kg = KeyGenerator.getInstance("AES"); KeyGenerator kg = KeyGenerator.getInstance("AES");
SecretKey key = kg.generateKey(); SecretKey key = kg.generateKey();
rawKey = key.getEncoded(); rawKey = key.getEncoded();
...@@ -255,7 +250,7 @@ public class PersistenceManager { ...@@ -255,7 +250,7 @@ public class PersistenceManager {
protected void finalize() throws Throwable { protected void finalize() throws Throwable {
super.finalize(); super.finalize();
this.timer.shutdownNow(); this.timer.shutdownNow();
logger.log(Level.FINER, "persistencemanager.registrarFinalize"); Log.debug(LocaleUtils.getLocalizedString("persistencemanager.registrarFinalize", "gateway"));
} }
} }
...@@ -10,16 +10,17 @@ ...@@ -10,16 +10,17 @@
package org.jivesoftware.wildfire.gateway.roster; package org.jivesoftware.wildfire.gateway.roster;
import java.io.Serializable;
import java.io.IOException; import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.logging.Logger;
import org.jivesoftware.wildfire.gateway.Gateway; import org.jivesoftware.wildfire.gateway.Gateway;
import org.jivesoftware.wildfire.gateway.GatewaySession; import org.jivesoftware.wildfire.gateway.GatewaySession;
import org.jivesoftware.wildfire.gateway.SubscriptionInfo; import org.jivesoftware.wildfire.gateway.SubscriptionInfo;
import org.jivesoftware.util.Log;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
/** /**
...@@ -29,7 +30,9 @@ import org.xmpp.packet.JID; ...@@ -29,7 +30,9 @@ import org.xmpp.packet.JID;
* *
* @author Noah Campbell * @author Noah Campbell
*/ */
public class Registrar { public class Registrar implements Serializable {
private static final long serialVersionUID = 1L;
/** /**
* Construct a new <code>Registrar</code>. * Construct a new <code>Registrar</code>.
...@@ -93,7 +96,7 @@ public class Registrar { ...@@ -93,7 +96,7 @@ public class Registrar {
GatewaySession session = this.gateway.getSessionFactory().newInstance(info); GatewaySession session = this.gateway.getSessionFactory().newInstance(info);
session.login(); session.login();
logger.info("Creating session for: " + jid); Log.info("Creating session for: " + jid);
sessions.put(jid, session); sessions.put(jid, session);
} }
return sessions.get(jid); return sessions.get(jid);
...@@ -120,13 +123,6 @@ public class Registrar { ...@@ -120,13 +123,6 @@ public class Registrar {
*/ */
private transient Gateway gateway; private transient Gateway gateway;
/**
* The logger.
*
* @see Registrar
*/
private static final Logger logger = Logger.getLogger("Registrar");
/** /**
* Removes the NormalizedJID from the registrar. * Removes the NormalizedJID from the registrar.
* @param jid * @param jid
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
package org.jivesoftware.wildfire.gateway.roster; package org.jivesoftware.wildfire.gateway.roster;
import java.io.Serializable;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
...@@ -27,7 +28,9 @@ import org.jivesoftware.wildfire.gateway.Gateway; ...@@ -27,7 +28,9 @@ import org.jivesoftware.wildfire.gateway.Gateway;
* @see org.xmpp.packet.JID * @see org.xmpp.packet.JID
* @deprecated * @deprecated
*/ */
public class Roster { public class Roster implements Serializable {
private static final long serialVersionUID = 1L;
/** /**
* The foreignContacts. * The foreignContacts.
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
package org.jivesoftware.wildfire.gateway.roster; package org.jivesoftware.wildfire.gateway.roster;
import java.io.Serializable;
/** /**
* Status object. * Status object.
* *
...@@ -17,6 +19,8 @@ package org.jivesoftware.wildfire.gateway.roster; ...@@ -17,6 +19,8 @@ package org.jivesoftware.wildfire.gateway.roster;
*/ */
public final class Status { public final class Status {
private static final long serialVersionUID = 1L;
/** The subscribed. */ /** The subscribed. */
private boolean subscribed = false; private boolean subscribed = false;
......
/**
* $Revision$
* $Date$
*
* Copyright (C) 2006 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.wildfire.gateway.util;
import java.util.logging.Level;
/**
* Custom log levels.
*
* @author Noah Campbell
* @see java.util.logging.Level
*/
public class GatewayLevel extends Level {
/** SECURITY log level. */
public static final Level SECURITY = new GatewayLevel("SECURITY", 501);
/**
* Construct a new <code>GatewayLevel</code>.
*
* @param name
* @param value
*/
protected GatewayLevel(String name, int value) {
super(name, value, "gateway_i18n");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment