Commit c7660169 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Comment and formatting fixes.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@42 b35dd754-fafc-0310-a699-88a17e54d16e
parent 2a1a4b72
......@@ -13,13 +13,13 @@ package org.jivesoftware.database;
import org.jivesoftware.util.JiveConstants;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.LongHashMap;
import org.jivesoftware.database.DbConnectionManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;
import java.util.HashMap;
/**
* Manages sequences of unique ID's that get stored in the database. Database support for sequences
......@@ -51,10 +51,10 @@ public class SequenceManager {
"UPDATE jiveID SET id=? WHERE idType=? AND id=?";
// Statically startup a sequence manager for each of the sequence counters.
private static LongHashMap managers;
private static Map<Integer,Object> managers;
static {
managers = new LongHashMap();
managers = new HashMap<Integer,Object>();
new SequenceManager(JiveConstants.USER, 1);
new SequenceManager(JiveConstants.GROUP, 1);
new SequenceManager(JiveConstants.ROSTER, 5);
......
......@@ -69,9 +69,9 @@ public class PresenceManagerImpl extends BasicModule implements PresenceManager
// create caches - no size limit and never expire for presence caches
long HOUR = JiveConstants.HOUR;
onlineGuestCache = new DefaultCache("Online Guests", -1, -1);
onlineUserCache = new DefaultCache("Online Users", -1, -1);
foreignUserCache = new DefaultCache("Foreign Users", foreignCacheSize, HOUR);
onlineGuestCache = new Cache("Online Guests", -1, -1);
onlineUserCache = new Cache("Online Users", -1, -1);
foreignUserCache = new Cache("Foreign Users", foreignCacheSize, HOUR);
}
public boolean isAvailable(User user) throws UnauthorizedException {
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net;
import java.net.InetSocketAddress;
......
......@@ -3,14 +3,13 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net;
package org.jivesoftware.net;
/**
* <p>Defines the rules that determine whether a connection should be
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net;
import org.jivesoftware.net.AcceptPolicy;
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net;
import org.jivesoftware.messenger.auth.UnauthorizedException;
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net;
/**
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net;
import java.util.Iterator;
......
......@@ -3,14 +3,13 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net;
import org.jivesoftware.net.Connection;
package org.jivesoftware.net;
/**
* <p>ConnectionMonitors record the activity of Connections for administration
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net;
import java.nio.ByteBuffer;
......@@ -23,6 +24,7 @@ import java.nio.ByteBuffer;
* @author Iain Shigeoka
*/
public interface DataConsumer {
/**
* <p>Set a data producer as a source of data when using the consumeAll()
* method.</p>
......@@ -52,4 +54,4 @@ public interface DataConsumer {
* @param data The data to consume
*/
void consume(ByteBuffer data);
}
}
\ No newline at end of file
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net;
import org.jivesoftware.net.DataConsumer;
......
......@@ -3,37 +3,36 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net;
import java.util.Date;
/**
* <p>Monitors a network usage.</p>
*
* <p>Monitors measure sample totals, and sample rate (samples per second).
* Monitor information is used at runtime to adjust server behavior as well
* as to generate reports on server history.</p>
* Monitors a network usage. Monitors measure sample totals, and sample rate
* (samples per second). Monitor information is used at runtime to adjust
* server behavior as well as to generate reports on server history.<p>
*
* <p>Based in part on the DataMonitor from Java Distributed Computing, Jim Farley,
* O'Reilly.</p>
* Based in part on the DataMonitor from Java Distributed Computing, Jim Farley,
* O'Reilly.
*
* @author Iain Shigeoka
*/
public interface Monitor {
/**
* <p>Add the number of samples that occured between the given start and
* end times.</p>
* Add the number of samples that occured between the given start and
* end times.<p>
*
* <p>The monitor does not check for overlapping sample times. It is
* The monitor does not check for overlapping sample times. It is
* the caller's responsibility to ensure samples don't overlap. Failure
* to prevent overlapping sample times may result in elapsed time
* being falsely counted and reported.</p>
* being falsely counted and reported.
*
* @param quantity The number of samples that occurred during the sample period
* @param startTime The beginning of the sample period
......
......@@ -3,25 +3,25 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.policies;
import org.jivesoftware.net.AcceptPolicy;
import org.jivesoftware.net.Connection;
import org.jivesoftware.net.Connection;
/**
* <p>Performs a basic logical AND evaluation on child policies (e.g. both must
* evaluate to true in order for this policy to evaluate true).</p>
* Performs a basic logical AND evaluation on child policies (e.g. both must
* evaluate to true in order for this policy to evaluate true).<p>
*
* <p>This policy is useful for combining simpler policies to create
* This policy is useful for combining simpler policies to create
* complex policy decisions. The comparison is done using the logical
* AND operation so if the first policy evaluates to false, the second
* policy is not evaluated.</p>
* policy is not evaluated.
*
* @author Iain Shigeoka
*/
......
......@@ -3,21 +3,20 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.policies;
import org.jivesoftware.net.AcceptPolicy;
import org.jivesoftware.net.Connection;
import org.jivesoftware.net.AcceptPolicy;
import org.jivesoftware.net.Connection;
/**
* <p>The simplest possible accept policy that either accepts or rejects
* all connections.</p>
* The simplest possible accept policy that either accepts or rejects
* all connections.
*
* @author Iain Shigeoka
*/
......@@ -26,8 +25,8 @@ public class BasicAcceptPolicy implements AcceptPolicy {
private boolean accept;
/**
* <p>Create a basic accept policy that either accepts or denies all
* incoming connections.</p>
* Create a basic accept policy that either accepts or denies all
* incoming connections.
*
* @param alwaysAccept True if the policy should accept all connections
*/
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.policies;
import org.jivesoftware.net.AcceptPolicy;
......@@ -15,11 +16,11 @@ import org.jivesoftware.net.Connection;
import org.jivesoftware.net.AcceptPolicy;
/**
* <p>Performs a basic logical NOT evaluation on a child policy (e.g.
* turns true to false and false to true).</p>
* Performs a basic logical NOT evaluation on a child policy (e.g.
* turns true to false and false to true).<p>
*
* <p>This policy is useful for combining simpler policies to create
* complex policy decisions.</p>
* This policy is useful for combining simpler policies to create
* complex policy decisions.
*
* @author Iain Shigeoka
*/
......@@ -28,7 +29,7 @@ public class NotPolicy implements AcceptPolicy {
private AcceptPolicy pol;
/**
* <p>Create an NOT policy for the given policy.</p>
* Create an NOT policy for the given policy.
*
* @param policy The policy that will be NOT'd
*/
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.policies;
import org.jivesoftware.net.AcceptPolicy;
......@@ -15,13 +16,13 @@ import org.jivesoftware.net.Connection;
import org.jivesoftware.net.AcceptPolicy;
/**
* <p>Performs a basic logical OR evaluation on child policies (e.g. if either
* evaluate to true this policy will evaluate true).</p>
* Performs a basic logical OR evaluation on child policies (e.g. if either
* evaluate to true this policy will evaluate true).<p>
*
* <p>This policy is useful for combining simpler policies to create
* This policy is useful for combining simpler policies to create
* complex policy decisions. The comparison is done using the logical
* OR operation so if the first policy evaluates to true, the second
* policy is not evaluated.</p>
* policy is not evaluated.
*
* @author Iain Shigeoka
*/
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.policies;
import org.jivesoftware.net.AcceptPolicy;
......@@ -15,13 +16,13 @@ import org.jivesoftware.net.Connection;
import org.jivesoftware.net.AcceptPolicy;
/**
* <p>Performs a bitwise logical XOR (exclusive OR) evaluation on
* Performs a bitwise logical XOR (exclusive OR) evaluation on
* child policies (e.g. if both policies evaluate to true or false
* the XOR result is false).</p>
* the XOR result is false).<p>
*
* <p>This policy is useful for combining simpler policies to create
* This policy is useful for combining simpler policies to create
* complex policy decisions. The comparison is done using the bitwise
* XOR operation so both policies will always be evaluated.</p>
* XOR operation so both policies will always be evaluated.
*
* @author Iain Shigeoka
*/
......@@ -31,7 +32,7 @@ public class XorPolicy implements AcceptPolicy {
private AcceptPolicy policy2;
/**
* <p>Create an AND policy with the given two child policies.</p>
* Create an AND policy with the given two child policies.
*
* @param firstPolicy The first policy that will be evaluated
* @param secondPolicy The first policy that will be evaluated
......@@ -44,4 +45,4 @@ public class XorPolicy implements AcceptPolicy {
public boolean evaluate(Connection connection) {
return policy1.evaluate(connection) ^ policy2.evaluate(connection);
}
}
}
\ No newline at end of file
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.spi;
import org.jivesoftware.net.ConnectionManager;
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.spi;
import org.jivesoftware.net.policies.BasicAcceptPolicy;
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.spi;
import org.jivesoftware.net.DataConsumer;
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.spi;
import org.jivesoftware.net.DataConsumer;
......@@ -21,8 +22,8 @@ import org.jivesoftware.net.DataConsumer;
import org.jivesoftware.net.DataProducer;
/**
* <p>A basic data producer that produces data from it's
* source and adds samples to the monitor.</p>
* A basic data producer that produces data from it's
* source and adds samples to the monitor.
*
* @author Iain Shigeoka
*/
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.spi;
import org.jivesoftware.net.Monitor;
......@@ -18,29 +19,21 @@ import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* <p>Implements a transient (in-memory) generic monitor.</p>
* Implements a transient (in-memory) generic monitor.
*
* @author Iain Shigeoka
*/
public class BasicTransientMonitor implements Monitor {
/** <p>Total sample quantity.</p> */
private static final int DEFAULT_FRAME_SIZE = 20;
private long totalSamples;
/** <p>The total sampling time</p> */
private long totalTime;
/** <p>The time of the last sample end time.</p> */
private long lastSampleTime = -1;
/** <p>The time of the first sample taken.</p> */
private long firstSampleTime = -1;
/** <p>The time the monitor was created.</p> */
private Date startUpTime;
/** <p>The size of a sample frame in sample events.</p> */
private int frameSize;
/** <p>The default size of a sample frame (20 events). </p> */
private static final int DEFAULT_FRAME_SIZE = 20;
/** <p>Frame data stored in a circular list.</p> */
private CircularLinkedList frameList = new CircularLinkedList();
/** <p>lock on the frame list</p> */
private ReadWriteLock frameLock = new ReentrantReadWriteLock();
public BasicTransientMonitor(){
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.spi;
import org.jivesoftware.net.ConnectionManager;
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.spi;
import java.util.Date;
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.spi;
import org.jivesoftware.net.Connection;
......@@ -18,10 +19,9 @@ import java.nio.ByteBuffer;
import org.jivesoftware.net.spi.BasicDataConsumer;
/**
* <p>Socket data consumer implementation designed to work intimately with
* the SocketConnection class.</p>
* Socket data consumer implementation designed to work intimately with
* the SocketConnection class.
*
* @author Iain Shigeoka
*/
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.spi;
import org.jivesoftware.net.Connection;
......@@ -19,7 +20,7 @@ import org.jivesoftware.net.spi.BasicDataProducer;
import org.jivesoftware.net.Connection;
/**
* <p>Produces data from the input stream of a socket connection.</p>
* Produces data from the input stream of a socket connection.
*
* @author Iain Shigeoka
*/
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.net.spi;
import org.jivesoftware.net.Connection;
......@@ -16,7 +17,7 @@ import org.jivesoftware.net.spi.BasicTransientMonitor;
import org.jivesoftware.net.Connection;
/**
* <p>Transient (in-memory) implementation of a connection monitor.</p>
* Transient (in-memory) implementation of a connection monitor.
*
* @author Iain Shigeoka
*/
......
/*
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
/**
......
/*
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
import java.util.Iterator;
......
......@@ -3,10 +3,10 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
......
......@@ -3,10 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2002 Jive Software. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of Jive Software. Use is subject to license terms.
* 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.util;
import java.text.DecimalFormat;
......@@ -22,25 +24,6 @@ import java.text.ParsePosition;
*/
public class ByteFormat extends Format {
// private long numBytes = 0;
public ByteFormat() {
}
// public ByteFormat(int numBytes) {
// this.numBytes = numBytes;
// }
//
// public long getNumBytes() {
// return numBytes;
// }
//
// public void setNumBytes(long numBytes) {
// this.numBytes = numBytes;
// }
// Implemented from the Format class
/**
* Formats a long which represent a number of bytes.
*/
......@@ -88,4 +71,4 @@ public class ByteFormat extends Format {
public Object parseObject(String source, ParsePosition pos) {
return null;
}
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -11,31 +11,18 @@
package org.jivesoftware.util;
import org.jivesoftware.messenger.container.ModuleContext;
import org.jivesoftware.util.JiveConstants;
import org.jivesoftware.util.Cache;
import org.jivesoftware.util.CacheFactory;
import java.util.Hashtable;
/**
* <p>A centralized, JVM static manager of Jive caches.</p>
* <p/>
* <p>Caches are essential for scalability of Jive software. Only Jive objects should access the cache!
* 3rd parties are discouraged from modifying or using the Jive caches without consulting with Jive
* engineers on consequences.</p>
* A centralized, JVM static manager of Jive caches. Caches are essential for
* scalability.
*
* @author Iain Shigeoka
* <p/>
*/
public class CacheManager {
/**
* <p>The map for accessing the caches.</p>
*/
private static Hashtable caches = new Hashtable();
/**
* <p>The max lifetime of items in any cache.</p>
*/
private static long maxLifetime = JiveConstants.HOUR * 6;
/**
......@@ -63,15 +50,15 @@ public class CacheManager {
catch (NumberFormatException e) { /* ignore */
}
}
caches.put(name, CacheFactory.createCache(name, maxCacheSize, maxLifetime));
caches.put(name, new Cache(name, maxCacheSize, maxLifetime));
}
}
/**
* <p>Obtain a cache by name.</p>
* Returns the cache specified by name.
*
* @param name The name of the cache to retrieve
* @return The cache found, or null if no cache by that name has been initialized
* @param name the name of the cache to return.
* @return the cache found, or null if no cache by that name has been initialized.
*/
public static Cache getCache(String name) {
return (Cache)caches.get(name);
......
/*
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
......
......@@ -3,10 +3,10 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
......@@ -16,7 +16,7 @@ package org.jivesoftware.util;
* Objects only need to know how big they are (in bytes). That size
* should be considered to be a best estimate of how much memory the Object
* occupies and may be based on empirical trials or dynamic calculations.<p>
* <p/>
*
* While the accuracy of the size calculation is important, care should be
* taken to minimize the computation time so that cache operations are
* speedy.
......
......@@ -3,10 +3,10 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
......@@ -14,7 +14,6 @@ package org.jivesoftware.util;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* <p>Simple circular LinkedList allowing the marking of a position, reset of position, and pass count.</p>
* <p>The circular list provides several tools for 'spinning' the circular list.
......
......@@ -3,12 +3,11 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
/**
......
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 2004 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.util;
import java.util.*;
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
/**
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
import java.io.File;
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
/**
......
......@@ -3,14 +3,15 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
import java.util.Hashtable;
import java.util.*;
/**
* <p>A type safe enumeration object that is keyed by an Int
......@@ -25,7 +26,9 @@ import java.util.Hashtable;
* @author Iain Shigeoka
*/
public class IntEnum extends Enum {
private int value;
protected static Hashtable enumTypes = new Hashtable();
protected IntEnum(String name, int val) {
super(name);
......@@ -53,17 +56,15 @@ public class IntEnum extends Enum {
}
}
protected static Hashtable enumTypes = new Hashtable();
/**
* <p>Checks in an enum for use in the getEnumFromInt() method.</p>
*
* @param enumeration The enum to be registered
*/
protected static void register(IntEnum enumeration) {
LongHashMap enums = (LongHashMap)enumTypes.get(enumeration.getClass());
Map enums = (Map)enumTypes.get(enumeration.getClass());
if (enums == null) {
enums = new LongHashMap();
enums = new HashMap<Integer,Object>();
enumTypes.put(enumeration.getClass(), enums);
}
enums.put(enumeration.getValue(), enumeration);
......@@ -77,7 +78,7 @@ public class IntEnum extends Enum {
* @return The associated enum or null if no matching enum exists
*/
protected static IntEnum getEnumFromInt(Class enumClass, int value) {
LongHashMap enums = (LongHashMap)enumTypes.get(enumClass);
Map enums = (Map)enumTypes.get(enumClass);
if (enums != null) {
return (IntEnum)enums.get(value);
}
......@@ -91,4 +92,4 @@ public class IntEnum extends Enum {
public String toString() {
return Integer.toString(value) + " " + super.toString();
}
}
}
\ No newline at end of file
......@@ -3,10 +3,10 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 2002 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
/**
......
......@@ -3,10 +3,10 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
......
......@@ -3,10 +3,10 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
......
......@@ -3,9 +3,10 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 Jive Software. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of Jive Software. Use is subject to license terms.
* 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.util;
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 2002 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
import org.jivesoftware.util.log.Hierarchy;
......
......@@ -3,10 +3,10 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
......
......@@ -3,10 +3,10 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
/**
......
......@@ -3,10 +3,10 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 2002 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
import org.jivesoftware.messenger.auth.AuthToken;
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
import java.io.IOException;
......
......@@ -3,10 +3,10 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
......@@ -23,8 +23,6 @@ import java.util.Random;
/**
* Utility class to peform common String manipulation algorithms.
*
* @author Iain Shigeoka
*/
public class StringUtils {
......
......@@ -3,11 +3,12 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
import java.io.StringWriter;
......
......@@ -3,12 +3,11 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
/**
......
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 2004 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.util;
import javax.servlet.ServletContext;
......
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 2004 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.util;
import org.jivesoftware.messenger.chat.ChatServer;
......
......@@ -3,10 +3,10 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2001 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
......
......@@ -3,12 +3,11 @@
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
import java.io.Reader;
......
/*
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
* Copyright (C) 2004 Jive Software. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
* 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.util;
import org.jivesoftware.messenger.XMPPFragment;
......
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