Brought things up to date with the latest Jakarta Commons world order.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3058 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2004-07-13 16:34:49 +00:00
parent a6f57205d7
commit 1da753e14d
16 changed files with 119 additions and 138 deletions
@@ -1,5 +1,5 @@
//
// $Id: ColorPositoryParser.java,v 1.1 2003/01/31 23:10:45 mdb Exp $
// $Id: ColorPositoryParser.java,v 1.2 2004/07/13 16:34:49 mdb Exp $
package com.threerings.media.image.tools.xml;
@@ -34,13 +34,14 @@ public class ColorPositoryParser extends CompiledConfigParser
// create and configure class record instances
String prefix = "colors/class";
digest.addObjectCreate(prefix, ClassRecord.class.getName());
digest.addRule(prefix, new SetPropertyFieldsRule(digest));
digest.addRule(prefix, new SetPropertyFieldsRule());
digest.addSetNext(prefix, "addClass", ClassRecord.class.getName());
// create and configure color record instances
prefix += "/color";
digest.addRule(prefix, new Rule(digest) {
public void begin (Attributes attributes) throws Exception {
digest.addRule(prefix, new Rule() {
public void begin (String namespace, String name,
Attributes attributes) throws Exception {
// we want to inherit settings from the color class when
// creating the record, so we do some custom stuff
ColorRecord record = new ColorRecord();
@@ -49,11 +50,11 @@ public class ColorPositoryParser extends CompiledConfigParser
digester.push(record);
}
public void end () throws Exception {
public void end (String namespace, String name) throws Exception {
digester.pop();
}
});
digest.addRule(prefix, new SetPropertyFieldsRule(digest));
digest.addRule(prefix, new SetPropertyFieldsRule());
digest.addSetNext(prefix, "addColor", ColorRecord.class.getName());
}
}
@@ -1,5 +1,5 @@
//
// $Id: SoundManager.java,v 1.72 2004/02/26 18:42:51 ray Exp $
// $Id: SoundManager.java,v 1.73 2004/07/13 16:34:49 mdb Exp $
package com.threerings.media.sound;
@@ -27,8 +27,7 @@ import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.UnsupportedAudioFileException;
import org.apache.commons.io.StreamUtils;
import org.apache.commons.lang.Constant;
import org.apache.commons.io.IOUtils;
import com.samskivert.util.Config;
import com.samskivert.util.Interval;
@@ -735,7 +734,7 @@ public class SoundManager
InputStream stream = getTestClip(key);
if (stream != null) {
data = new byte[1][];
data[0] = StreamUtils.streamAsBytes(stream, BUFFER_SIZE);
data[0] = IOUtils.toByteArray(stream);
} else {
// otherwise, randomize between all available sounds
@@ -855,7 +854,7 @@ public class SoundManager
}
}
return StreamUtils.streamAsBytes(clipin, BUFFER_SIZE);
return IOUtils.toByteArray(clipin);
}
protected Config getConfig (SoundKey key)
@@ -1271,13 +1270,13 @@ public class SoundManager
protected HashMap _configs = new HashMap();
/** Signals to the queue to do different things. */
protected Constant PLAY = new Constant("PLAY");
protected Constant PLAYMUSIC = new Constant("PLAYMUSIC");
protected Constant STOPMUSIC = new Constant("STOPMUSIC");
protected Constant UPDATE_MUSIC_VOL = new Constant("UPDATE_MUSIC_VOL");
protected Constant LOCK = new Constant("LOCK");
protected Constant UNLOCK = new Constant("UNLOCK");
protected Constant DIE = new Constant("DIE");
protected String PLAY = new String("PLAY");
protected String PLAYMUSIC = new String("PLAYMUSIC");
protected String STOPMUSIC = new String("STOPMUSIC");
protected String UPDATE_MUSIC_VOL = new String("UPDATE_MUSIC_VOL");
protected String LOCK = new String("LOCK");
protected String UNLOCK = new String("UNLOCK");
protected String DIE = new String("DIE");
/** A pref that specifies a directory for us to get test sounds from. */
protected static RuntimeAdjust.FileAdjust _testDir =
@@ -1298,9 +1297,6 @@ public class SoundManager
/** The queue size at which we start to ignore requests to play sounds. */
protected static final int MAX_QUEUE_SIZE = 25;
/** The buffer size in bytes used when reading audio file data. */
protected static final int BUFFER_SIZE = 1024 * 16;
/** Used to disable sound entirely. */
protected static final boolean SOUND_ENABLED = true;
@@ -1,5 +1,5 @@
//
// $Id: TileSetBundler.java,v 1.19 2004/02/25 14:43:17 mdb Exp $
// $Id: TileSetBundler.java,v 1.20 2004/07/13 16:34:49 mdb Exp $
package com.threerings.media.tile.bundle.tools;
@@ -20,7 +20,7 @@ import java.util.zip.Deflater;
import javax.imageio.ImageIO;
import org.apache.commons.digester.Digester;
import org.apache.commons.io.StreamUtils;
import org.apache.commons.io.CopyUtils;
import org.xml.sax.SAXException;
import com.samskivert.io.NestableIOException;
@@ -400,7 +400,7 @@ public class TileSetBundler
} else {
jar.putNextEntry(new JarEntry(imagePath));
FileInputStream imgin = new FileInputStream(ifile);
StreamUtils.pipe(imgin, jar);
CopyUtils.copy(imgin, jar);
}
} catch (Exception e) {
throw new NestableIOException(
@@ -1,5 +1,5 @@
//
// $Id: ObjectTileSetRuleSet.java,v 1.10 2004/02/25 14:43:17 mdb Exp $
// $Id: ObjectTileSetRuleSet.java,v 1.11 2004/07/13 16:34:49 mdb Exp $
package com.threerings.media.tile.tools.xml;
@@ -47,7 +47,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
digester.addRule(
_prefix + TILESET_PATH + "/objectWidths",
new CallMethodSpecialRule(digester) {
new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
int[] widths = StringUtil.parseIntArray(bodyText);
@@ -57,7 +57,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
digester.addRule(
_prefix + TILESET_PATH + "/objectHeights",
new CallMethodSpecialRule(digester) {
new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
int[] heights = StringUtil.parseIntArray(bodyText);
@@ -66,8 +66,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
});
digester.addRule(
_prefix + TILESET_PATH + "/xOrigins",
new CallMethodSpecialRule(digester) {
_prefix + TILESET_PATH + "/xOrigins", new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
int[] xorigins = StringUtil.parseIntArray(bodyText);
@@ -76,8 +75,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
});
digester.addRule(
_prefix + TILESET_PATH + "/yOrigins",
new CallMethodSpecialRule(digester) {
_prefix + TILESET_PATH + "/yOrigins", new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
int[] yorigins = StringUtil.parseIntArray(bodyText);
@@ -87,7 +85,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
digester.addRule(
_prefix + TILESET_PATH + "/priorities",
new CallMethodSpecialRule(digester) {
new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
byte[] prios = StringUtil.parseByteArray(bodyText);
@@ -96,8 +94,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
});
digester.addRule(
_prefix + TILESET_PATH + "/zations",
new CallMethodSpecialRule(digester) {
_prefix + TILESET_PATH + "/zations", new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
String[] zations = StringUtil.parseStringArray(bodyText);
@@ -106,8 +103,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
});
digester.addRule(
_prefix + TILESET_PATH + "/xspots",
new CallMethodSpecialRule(digester) {
_prefix + TILESET_PATH + "/xspots", new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
short[] xspots = StringUtil.parseShortArray(bodyText);
@@ -116,8 +112,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
});
digester.addRule(
_prefix + TILESET_PATH + "/yspots",
new CallMethodSpecialRule(digester) {
_prefix + TILESET_PATH + "/yspots", new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
short[] yspots = StringUtil.parseShortArray(bodyText);
@@ -126,8 +121,7 @@ public class ObjectTileSetRuleSet extends SwissArmyTileSetRuleSet
});
digester.addRule(
_prefix + TILESET_PATH + "/sorients",
new CallMethodSpecialRule(digester) {
_prefix + TILESET_PATH + "/sorients", new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
ObjectTileSet set = (ObjectTileSet)target;
@@ -1,5 +1,5 @@
//
// $Id: SwissArmyTileSetRuleSet.java,v 1.10 2004/02/25 14:43:17 mdb Exp $
// $Id: SwissArmyTileSetRuleSet.java,v 1.11 2004/07/13 16:34:49 mdb Exp $
package com.threerings.media.tile.tools.xml;
@@ -42,8 +42,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
super.addRuleInstances(digester);
digester.addRule(
_prefix + TILESET_PATH + "/widths",
new CallMethodSpecialRule(digester) {
_prefix + TILESET_PATH + "/widths", new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
int[] widths = StringUtil.parseIntArray(bodyText);
@@ -52,8 +51,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
});
digester.addRule(
_prefix + TILESET_PATH + "/heights",
new CallMethodSpecialRule(digester) {
_prefix + TILESET_PATH + "/heights", new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
int[] heights = StringUtil.parseIntArray(bodyText);
@@ -63,7 +61,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
digester.addRule(
_prefix + TILESET_PATH + "/tileCounts",
new CallMethodSpecialRule(digester) {
new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
int[] tileCounts = StringUtil.parseIntArray(bodyText);
@@ -72,8 +70,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
});
digester.addRule(
_prefix + TILESET_PATH + "/offsetPos",
new CallMethodSpecialRule(digester) {
_prefix + TILESET_PATH + "/offsetPos", new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
int[] values = StringUtil.parseIntArray(bodyText);
@@ -88,8 +85,7 @@ public class SwissArmyTileSetRuleSet extends TileSetRuleSet
});
digester.addRule(
_prefix + TILESET_PATH + "/gapSize",
new CallMethodSpecialRule(digester) {
_prefix + TILESET_PATH + "/gapSize", new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
int[] values = StringUtil.parseIntArray(bodyText);
@@ -1,5 +1,5 @@
//
// $Id: XMLTileSetParser.java,v 1.8 2004/02/25 14:43:17 mdb Exp $
// $Id: XMLTileSetParser.java,v 1.9 2004/07/13 16:34:49 mdb Exp $
package com.threerings.media.tile.tools.xml;
@@ -58,8 +58,7 @@ public class XMLTileSetParser
// add a set next rule which will put tilesets with this prefix
// into the array list that'll be on the top of the stack
_digester.addRule(prefix + TileSetRuleSet.TILESET_PATH,
new ValidatedSetNextRule(_digester,
"add", Object.class,
new ValidatedSetNextRule("add", Object.class,
ruleset));
}