@Override
    public void execute ()
        throws BuildException
    {
        // make sure everythign was set up properly
        ensureSet(_actionDef, "Must specify the action sequence " +
                  "definitions via the 'actiondef' attribute.");
        ensureSet(_classDef, "Must specify the component class definitions " +
                  "via the 'classdef' attribute.");
        ensureSet(_target, "Must specify the path to the target bundle " +
                  "file via the 'target' attribute.");

        // make sure we can write to the target bundle file
        OutputStream fout = null;
        try {

            // parse our metadata
            Tuple<Map<String, ActionSequence>, Map<String, TileSet>> tuple = parseActions();
            Map<String, ActionSequence> actions = tuple.left;
            Map<String, TileSet> actionSets = tuple.right;
            Map<String, ComponentClass> classes = parseClasses();

            fout = createOutputStream(_target);

            // throw the serialized actions table in there
            fout = nextEntry(fout, BundleUtil.ACTIONS_PATH);
            ObjectOutputStream oout = new ObjectOutputStream(fout);
            oout.writeObject(actions);
            oout.flush();

            // throw the serialized action tilesets table in there
            fout = nextEntry(fout, BundleUtil.ACTION_SETS_PATH);
            oout = new ObjectOutputStream(fout);
            oout.writeObject(actionSets);
            oout.flush();

            // throw the serialized classes table in there
            fout =  nextEntry(fout, BundleUtil.CLASSES_PATH);
            oout = new ObjectOutputStream(fout);
            oout.writeObject(classes);
            oout.flush();

            // close it up and we're done
            fout.close();

        } catch (IOException ioe) {
            String errmsg = "Unable to output to target bundle " +
                "[path=" + _target.getPath() + "].";
            throw new BuildException(errmsg, ioe);

        } finally {
            if (fout != null) {
                try {
                    fout.close();
                } catch (IOException ioe) {
                    // nothing to complain about here
                }
            }
        }
    }
@ Override public void execute ( ) throws BuildException { ensureSet ( _actionDef , "Must specify the action sequence " + "definitions via the 'actiondef' attribute." ) ; ensureSet ( _classDef , "Must specify the component class definitions " + "via the 'classdef' attribute." ) ; ensureSet ( _target , "Must specify the path to the target bundle " + "file via the 'target' attribute." ) ; OutputStream fout = null ; try { Tuple < Map < String , ActionSequence > , Map < String , TileSet > > tuple = parseActions ( ) ; Map < String , ActionSequence > actions = tuple . left ; Map < String , TileSet > actionSets = tuple . right ; Map < String , ComponentClass > classes = parseClasses ( ) ; fout = createOutputStream ( _target ) ; fout = nextEntry ( fout , BundleUtil . ACTIONS_PATH ) ; ObjectOutputStream oout = new ObjectOutputStream ( fout ) ; oout . writeObject ( actions ) ; oout . flush ( ) ; fout = nextEntry ( fout , BundleUtil . ACTION_SETS_PATH ) ; oout = new ObjectOutputStream ( fout ) ; oout . writeObject ( actionSets ) ; oout . flush ( ) ; fout = nextEntry ( fout , BundleUtil . CLASSES_PATH ) ; oout = new ObjectOutputStream ( fout ) ; oout . writeObject ( classes ) ; oout . flush ( ) ; fout . close ( ) ; } catch ( IOException ioe ) { String errmsg = "Unable to output to target bundle " + "[path=" + _target . getPath ( ) + "]." ; throw new BuildException ( errmsg , ioe ) ; } finally { if ( fout != null ) { try { fout . close ( ) ; } catch ( IOException ioe ) { } } } }
Performs the actual work of the task.