head	1.15;
access;
symbols
	TIGRIS_1_1_0RC2:1.11
	TIGRIS_1_1_0RC1:1.11
	TIGRIS_1_1:1.11.0.4
	TIGRIS_1_0_8:1.11
	TIGRIS_1_0_8RC3:1.11
	TIGRIS_1_0_8RC2:1.11
	TIGRIS_1_0_8RC1:1.11
	TIGRIS_1_0_7:1.11
	TIGRIS_1_0_7RC3:1.11
	TIGRIS_1_0_7RC2:1.11
	TIGRIS_1_0_7RC1:1.11
	TIGRIS_1_0_6:1.11
	TIGRIS_1_0_6RC5:1.11
	TIGRIS_1_0_6RC4:1.11
	TIGRIS_1_0_6RC3:1.11
	TIGRIS_1_0_6RC2:1.11
	TIGRIS_1_0_6RC1:1.11
	TIGRIS_1_0_5:1.11
	TIGRIS_1_0_5RC6:1.11
	TIGRIS_1_0_5RC5:1.11
	TIGRIS_1_0_5RC4:1.11
	TIGRIS_1_0_5RC3:1.11
	TIGRIS_1_0_5RC2:1.11
	TIGRIS_1_0_5RC1:1.11
	TIGRIS_1_0_4:1.11
	TIGRIS_1_0_3:1.11
	TIGRIS_1_0_2:1.11
	TIGRIS_1_0_1:1.11
	TIGRIS_1_0:1.11.0.6
	TIGRIS_1_0_0:1.11
	TIGRIS_1_0_0_RC1:1.11.0.2
	dlr:1.1.1
	HELM_PEER_PORT_BRANCH:1.1.1.1;
locks; strict;
comment	@# @;


1.15
date	2001.08.11.09.08.03;	author dlr;	state Exp;
branches;
next	1.14;

1.14
date	2001.06.07.02.55.21;	author dlr;	state Exp;
branches;
next	1.13;

1.13
date	2001.06.07.02.54.43;	author dlr;	state Exp;
branches;
next	1.12;

1.12
date	2001.05.23.01.50.13;	author dlr;	state Exp;
branches;
next	1.11;

1.11
date	2001.03.14.00.40.57;	author dlr;	state Exp;
branches;
next	1.10;

1.10
date	2001.03.13.02.20.52;	author leonardr;	state Exp;
branches;
next	1.9;

1.9
date	2001.03.08.03.30.42;	author dlr;	state Exp;
branches;
next	1.8;

1.8
date	2001.03.07.01.53.22;	author lucas;	state Exp;
branches;
next	1.7;

1.7
date	2001.02.26.20.21.18;	author dlr;	state Exp;
branches;
next	1.6;

1.6
date	2001.02.24.03.59.53;	author dlr;	state Exp;
branches;
next	1.5;

1.5
date	2001.02.22.23.38.42;	author leonardr;	state Exp;
branches;
next	1.4;

1.4
date	2001.02.21.16.22.42;	author edk;	state Exp;
branches;
next	1.3;

1.3
date	2001.02.21.15.54.12;	author leonardr;	state Exp;
branches;
next	1.2;

1.2
date	2001.02.21.03.02.22;	author edk;	state Exp;
branches;
next	1.1;

1.1
date	2001.01.28.01.18.22;	author dlr;	state dead;
branches
	1.1.1.1
	1.1.2.1;
next	;

1.1.1.1
date	2001.02.21.00.33.03;	author dlr;	state Exp;
branches;
next	;

1.1.2.1
date	2001.01.28.01.18.22;	author dlr;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2001.02.03.00.07.33;	author leonardr;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	2001.02.05.14.57.27;	author leonardr;	state Exp;
branches;
next	1.1.2.4;

1.1.2.4
date	2001.02.05.17.25.53;	author leonardr;	state Exp;
branches;
next	1.1.2.5;

1.1.2.5
date	2001.02.05.17.43.07;	author leonardr;	state Exp;
branches;
next	1.1.2.6;

1.1.2.6
date	2001.02.07.03.46.08;	author dlr;	state Exp;
branches;
next	1.1.2.7;

1.1.2.7
date	2001.02.15.15.46.54;	author leonardr;	state Exp;
branches;
next	1.1.2.8;

1.1.2.8
date	2001.02.15.16.10.29;	author leonardr;	state Exp;
branches;
next	1.1.2.9;

1.1.2.9
date	2001.02.15.16.26.19;	author leonardr;	state Exp;
branches;
next	1.1.2.10;

1.1.2.10
date	2001.02.16.00.52.35;	author leonardr;	state Exp;
branches;
next	1.1.2.11;

1.1.2.11
date	2001.02.16.03.01.27;	author dlr;	state Exp;
branches;
next	1.1.2.12;

1.1.2.12
date	2001.02.18.02.54.29;	author leonardr;	state Exp;
branches;
next	1.1.2.13;

1.1.2.13
date	2001.02.18.08.13.54;	author dlr;	state Exp;
branches;
next	1.1.2.14;

1.1.2.14
date	2001.02.20.21.49.13;	author dlr;	state Exp;
branches;
next	1.1.2.15;

1.1.2.15
date	2001.02.20.23.10.28;	author dlr;	state Exp;
branches;
next	1.1.2.16;

1.1.2.16
date	2001.02.20.23.18.13;	author dlr;	state Exp;
branches;
next	1.1.2.17;

1.1.2.17
date	2001.02.20.23.27.45;	author ms;	state Exp;
branches;
next	;


desc
@@


1.15
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
text
@package org.tigris.helm.om;

import java.util.*;
import java.io.*;

import org.apache.commons.util.ObjectUtils;
import org.apache.commons.util.StringUtils;
import org.apache.commons.util.exception.NestableException;

import org.apache.torque.om.NumberKey;
import org.apache.torque.util.Criteria;

import org.tigris.helm.om.*;
import org.tigris.helm.tool.task.*;
import org.apache.turbine.util.Log;

/** 
 * A Task is a database entry indicating some action (usually related
 * to the hosted tools) which needs to be taken. Tasks are created to
 * reduce the user-visible time it takes to perform a complex action like
 * project creation.
 */
public class Task extends BaseTask
{
    /**
     * Alias for super class method <code>getUser</code>.
     */
    public final User getOnBehalfOfUser()
        throws Exception
    {
        return super.getUser();
    }

    /**
     * Get all the tasks currently pending in the queue.
     */
    public static List getTasks()
        throws Exception
    {
        Criteria c = new Criteria()
            .addAscendingOrderByColumn(TaskPeer.TASK_ID);
        return TaskPeer.doSelect(c);
    }

    public final String getAffectedObjectID()
    {
        return String.valueOf(getAffectedObjectId());
    }

    //
    // Mutator methods
    //

    /**
     * Adds a new task.
     */
    public static Task add (User onBehalfOf, String component, 
                            String affectedObjectID, String command,
                            List arguments)
        throws Exception
    {
        return add(onBehalfOf, component, affectedObjectID, command,
                   writeArgsArray(arguments));
    }

    /**
     * Adds a new task.
     */
    public static Task add (String onBehalfOf, String component, 
                            String affectedObjectID, String command,
                            List arguments)
        throws Exception
    {
        return add(onBehalfOf, component, affectedObjectID, command,
                   writeArgsArray(arguments));
    }

    /**
     * Adds a new task.
     */
    public static Task add (User onBehalfOf, String component, 
                            String affectedObjectID, String command, 
                            String arguments)
        throws Exception
    {
        String oboID = null;
        if (onBehalfOf != null)
        {
            oboID = onBehalfOf.getID();
        }
        return add(oboID, component, affectedObjectID, command, arguments);
    }

    /**
     * Adds a new task.
     */
    public static Task add (String onBehalfOf, String component, 
                            String affectedObjectID, String command, 
                            String arguments)
        throws Exception
    {
        Task t = new Task();
        if (onBehalfOf != null) t.setOnBehalfOf(new NumberKey(onBehalfOf));
        t.setComponent(component);
        t.setAffectedObjectId(Integer.parseInt(affectedObjectID));
        t.setCommand(command);
        t.setArguments(arguments);
        t.save();
        return t;
    }
    
    /**
     * Every subclass of this class should define a way of running appropriate
     * tasks.
     */
    public static void runTask(Task t)
        throws TaskException
    {
        if (t.getComponent().equals(HelmTask.COMPONENT_NAME))
        {
            HelmTask.runTask(t);
        }
        else if (t.getComponent().equals(AnzuTask.COMPONENT_NAME))
        {
            AnzuTask.runTask(t);
        }
        else
        {
            Log.error("unknown task/component type: " + t.getComponent());
        }
    }

    /**
     * Sets the task as having been done. Basically just removes this
     * task from the database.
     */
    public void setAsDone()
    {
        try 
        {
            Criteria c = new Criteria().add(TaskPeer.TASK_ID, getTaskId());
            TaskPeer.doDelete(c);
        }
        catch (Exception e) {
            //If we run into a problem, that means the task has
            //already been marked as done.
            Log.info("Task #" + getID() + " was already deleted.");
        }
    }

    //
    // Manipulation of the arguments array
    //

    public String getArgumentsHumanReadable()
    {
        ArrayList argList = null;
        try 
        { 
            argList = readArgsArray();
        }
        catch (Exception e) {
            return getArguments();
        }
        StringBuffer readable = new StringBuffer();
        readable.append((String)argList.get(0));
        for (int i = 0; i < argList.size(); i++)
        {
            String arg = (String)argList.get(i);
            readable.append("/").append(arg);
        }
        return readable.toString();
    }
    
    protected String[] readArgs()
        throws Exception
    {
        if (getArguments() == null)
        {
            String [] empty={};
            return empty;
        }
        ByteArrayInputStream bais = new ByteArrayInputStream
            (getArguments().getBytes());
        ObjectInputStream ois = new ObjectInputStream(bais);
        return (String[])ois.readObject();
    }

    protected static String writeArgs(String args[])
        throws Exception
    {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(args);
        return baos.toString();
    }

    protected ArrayList readArgsArray()
        throws Exception
    {
        String array[] = readArgs();
        ArrayList args = new ArrayList();
        for (int i = 0; i < array.length; i++)
        {
            args.add(array[i]);
        }
        return args;
    }

    protected static String writeArgsArray(List args)
        throws Exception
    {
        String array[] = new String[args.size()];
        Iterator i = args.iterator();
        int offset = 0;
        while (i.hasNext()) {
            array[offset++] = (String)i.next();
        }
        return writeArgs(array);
    }
}
@


1.14
log
@Completion of previous commit--no longer need to specify ascending
manually, it's done by the method.
@
text
@a2 1
// JDK classes
d6 7
a12 3
// Turbine classes
import org.apache.turbine.om.*;
import org.apache.turbine.om.peer.BasePeer;
d14 1
a14 4
import org.apache.turbine.util.db.Criteria;
import org.apache.turbine.util.ObjectUtils;
import org.apache.turbine.util.StringUtils;
import org.apache.turbine.util.ParameterParser;
a15 5
import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.db.pool.DBConnection;

import org.tigris.helm.tool.task.*;
a76 1

@


1.13
log
@Switched to non-deprecated method version.
@
text
@d46 1
a46 1
            .addAscendingOrderByColumn(TaskPeer.TASK_ID + " ASC");
@


1.12
log
@Ported Helm from WebMacro to Velocity.
@
text
@d46 1
a46 1
            .addOrderByColumn(TaskPeer.TASK_ID + " ASC");
@


1.11
log
@And then there was darkness...
@
text
@d16 2
@


1.10
log
@Cleanup.
@
text
@a27 13

    //
    // Static initializer
    //
    static
    {
        if (TaskRunner.numberOfInstances() == 0)
        {
            TaskRunner tr = new TaskRunner();
            tr.start();
        }
    }        

@


1.9
log
@Pushed getID() method into base class as a final method.
@
text
@a135 1
        Log.debug("Component: " + t.getComponent());
d156 2
a157 4
        Log.debug("Marking task " + getID() + " (" + getCommand()
                  + ") as done.");

        try {
@


1.8
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@a40 9
    //
    // Accessor methods
    //

    public final String getID()
    {
        return String.valueOf(getTaskId());
    }

@


1.7
log
@Changes to keep in step with the latest Torque-generated code.
@
text
@d10 1
a10 2
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
@


1.6
log
@Sync'd with latest Turbine changes.  Mostly this consists of the use of the new SimpleKey class to handle primary database keys.
@
text
@d130 1
a130 1
        if (onBehalfOf != null) t.setOnBehalfOf(new SimpleKey(onBehalfOf));
@


1.5
log
@How about running the tasks in the right order.
@
text
@d8 1
a8 1
import org.apache.turbine.om.BaseObject;
d130 1
a130 1
        if (onBehalfOf != null) t.setOnBehalfOf(Integer.parseInt(onBehalfOf));
@


1.4
log
@handle the anzu component, and provide a default case to warn about a
missing or invalid component type
@
text
@d60 3
d67 2
a68 2
            .addSelectColumn(TaskPeer.TASK_ID);
        return TaskPeer.doSelect(new Criteria(0));
@


1.3
log
@Order tasks by task ID.
@
text
@d148 8
@


1.2
log
@adding files from the branch to the head
@
text
@d63 2
@


1.1
log
@file Task.java was initially added on branch HELM_PEER_PORT_BRANCH.
@
text
@d1 238
@


1.1.1.1
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@a0 238
package org.tigris.helm.om;

// JDK classes
import java.util.*;
import java.io.*;

// Turbine classes
import org.apache.turbine.om.BaseObject;
import org.apache.turbine.om.peer.BasePeer;
import org.tigris.helm.om.peer.*;
import org.tigris.helm.om.base.*;
import org.apache.turbine.util.db.Criteria;
import org.apache.turbine.util.ObjectUtils;
import org.apache.turbine.util.StringUtils;
import org.apache.turbine.util.ParameterParser;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.db.pool.DBConnection;

import org.tigris.helm.tool.task.*;

/** 
 * A Task is a database entry indicating some action (usually related
 * to the hosted tools) which needs to be taken. Tasks are created to
 * reduce the user-visible time it takes to perform a complex action like
 * project creation.
 */
public class Task extends BaseTask
{

    //
    // Static initializer
    //
    static
    {
        if (TaskRunner.numberOfInstances() == 0)
        {
            TaskRunner tr = new TaskRunner();
            tr.start();
        }
    }        

    //
    // Accessor methods
    //

    public final String getID()
    {
        return String.valueOf(getTaskId());
    }

    /**
     * Alias for super class method <code>getUser</code>.
     */
    public final User getOnBehalfOfUser()
        throws Exception
    {
        return super.getUser();
    }

    public static List getTasks()
        throws Exception
    {
        return TaskPeer.doSelect(new Criteria(0));
    }

    public final String getAffectedObjectID()
    {
        return String.valueOf(getAffectedObjectId());
    }

    //
    // Mutator methods
    //

    /**
     * Adds a new task.
     */
    public static Task add (User onBehalfOf, String component, 
                            String affectedObjectID, String command,
                            List arguments)
        throws Exception
    {
        return add(onBehalfOf, component, affectedObjectID, command,
                   writeArgsArray(arguments));
    }

    /**
     * Adds a new task.
     */
    public static Task add (String onBehalfOf, String component, 
                            String affectedObjectID, String command,
                            List arguments)
        throws Exception
    {
        return add(onBehalfOf, component, affectedObjectID, command,
                   writeArgsArray(arguments));
    }


    /**
     * Adds a new task.
     */
    public static Task add (User onBehalfOf, String component, 
                            String affectedObjectID, String command, 
                            String arguments)
        throws Exception
    {
        String oboID = null;
        if (onBehalfOf != null)
        {
            oboID = onBehalfOf.getID();
        }
        return add(oboID, component, affectedObjectID, command, arguments);
    }

    /**
     * Adds a new task.
     */
    public static Task add (String onBehalfOf, String component, 
                            String affectedObjectID, String command, 
                            String arguments)
        throws Exception
    {
        Task t = new Task();
        if (onBehalfOf != null) t.setOnBehalfOf(Integer.parseInt(onBehalfOf));
        t.setComponent(component);
        t.setAffectedObjectId(Integer.parseInt(affectedObjectID));
        t.setCommand(command);
        t.setArguments(arguments);
        t.save();
        return t;
    }
    
    /**
     * Every subclass of this class should define a way of running appropriate
     * tasks.
     */
    public static void runTask(Task t)
        throws TaskException
    {
        Log.debug("Component: " + t.getComponent());
        if (t.getComponent().equals(HelmTask.COMPONENT_NAME))
        {
            HelmTask.runTask(t);
        }
    }

    /**
     * Sets the task as having been done. Basically just removes this
     * task from the database.
     */
    public void setAsDone()
    {
        Log.debug("Marking task " + getID() + " (" + getCommand()
                  + ") as done.");

        try {
            Criteria c = new Criteria().add(TaskPeer.TASK_ID, getTaskId());
            TaskPeer.doDelete(c);
        }
        catch (Exception e) {
            //If we run into a problem, that means the task has
            //already been marked as done.
            Log.info("Task #" + getID() + " was already deleted.");
        }
    }

    //
    // Manipulation of the arguments array
    //

    public String getArgumentsHumanReadable()
    {
        ArrayList argList = null;
        try 
        { 
            argList = readArgsArray();
        }
        catch (Exception e) {
            return getArguments();
        }
        StringBuffer readable = new StringBuffer();
        readable.append((String)argList.get(0));
        for (int i = 0; i < argList.size(); i++)
        {
            String arg = (String)argList.get(i);
            readable.append("/").append(arg);
        }
        return readable.toString();
    }
    
    protected String[] readArgs()
        throws Exception
    {
        if (getArguments() == null)
        {
            String [] empty={};
            return empty;
        }
        ByteArrayInputStream bais = new ByteArrayInputStream
            (getArguments().getBytes());
        ObjectInputStream ois = new ObjectInputStream(bais);
        return (String[])ois.readObject();
    }

    protected static String writeArgs(String args[])
        throws Exception
    {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(args);
        return baos.toString();
    }

    protected ArrayList readArgsArray()
        throws Exception
    {
        String array[] = readArgs();
        ArrayList args = new ArrayList();
        for (int i = 0; i < array.length; i++)
        {
            args.add(array[i]);
        }
        return args;
    }

    protected static String writeArgsArray(List args)
        throws Exception
    {
        String array[] = new String[args.size()];
        Iterator i = args.iterator();
        int offset = 0;
        while (i.hasNext()) {
            array[offset++] = (String)i.next();
        }
        return writeArgs(array);
    }
}
@


1.1.2.1
log
@Classes ported to the Turbine Peer system. -dlr and leonardr
@
text
@a0 25
package org.tigris.helm.om;

// JDK classes
import java.util.*;

// Turbine classes
import org.apache.turbine.om.BaseObject;
import org.apache.turbine.om.peer.BasePeer;
import org.tigris.helm.om.peer.*;
import org.apache.turbine.util.db.Criteria;
import org.apache.turbine.util.ObjectUtils;
import org.apache.turbine.util.StringUtils;
import org.apache.turbine.util.ParameterParser;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.db.pool.DBConnection;

/** 
    The skeleton for this class was autogenerated by Torque on: Fri Jan 26 17:54:39 PST 2001. 
    You should add additional methods to this class to meet the
    application requirements.  This class will only be generated as
    long as the firstTime file does not exist in the build directory.
*/
public class Task extends BaseTask
{
}
@


1.1.2.2
log
@Ported task system to peers.
@
text
@a4 1
import java.io.*;
a16 2
import org.tigris.helm.tool.TaskException;

a24 138
    //
    // Accessor methods
    //

    public String getID()
    {
        return String.valueOf(getTaskId());
    }

    public static List getTasks()
        throws Exception
    {
        return TaskPeer.doSelect(new Criteria());
    }

    //
    // Mutator methods
    //

    public static Task add (String onBehalfOf, String component, 
                            String affectedObjectID, String command,
                            List arguments)
        throws Exception
    {
        return add(onBehalfOf, component, affectedObjectID, command,
            writeArgsArray(arguments));
    }

    public static Task add (String onBehalfOf, String component, 
                            String affectedObjectID, String command, 
                            String arguments)
        throws Exception
    {
        Task t = new Task();
        t.setOnBehalfOf(Integer.parseInt(onBehalfOf));
        t.setComponent(component);
        t.setAffectedObjectId(Integer.parseInt(affectedObjectID));
        t.setCommand(command);
        t.setArguments(arguments);
        t.save();
        return t;
    }
    
    //Every subclass of this class should define a way of running
    //appropriate tasks.
    static public void runTask(Task t) throws TaskException
    {
        if (t.getComponent().equals(HelmTask.COMPONENT_NAME))
        {
            HelmTask.runTask(t);
        } else {
            throw new TaskException("Unknown component " + t.getComponent());
        }
    }

    /**
     * Sets the task as having been done. Basically just removes this
     * task from the database.
     */
    public void setAsDone()
    {
        Log.debug("Marking task " + getID() + " (" + getCommand()
                  + ") as done.");

        try {
            Criteria c = new Criteria().add(TaskPeer.TASK_ID, getTaskId());
            TaskPeer.doDelete(c);
        } catch (Exception e) {
            //If we run into a problem, that means the task has
            //already been marked as done.
            Log.info("Task #" + getID() + " was already deleted.");
        }
    }

    //
    // Manipulation of the arguments array
    //

    public String getArgumentsHumanReadable()
    {
        ArrayList argList = null;
        try 
        { 
            argList = readArgsArray();
        } catch (Exception e) {
            return getArguments();
        }
        StringBuffer readable = new StringBuffer();
        readable.append((String)argList.get(0));
        for (int i = 0; i < argList.size(); i++)
        {
            String arg = (String)argList.get(i);
            readable.append("/").append(arg);
        }
        return readable.toString();
    }
    
    protected String[] readArgs()
        throws Exception
    {
        ByteArrayInputStream bais = new ByteArrayInputStream
            (getArguments().getBytes());
        ObjectInputStream ois = new ObjectInputStream(bais);
        return (String[])ois.readObject();
    }

    protected static String writeArgs(String args[])
        throws Exception
    {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(args);
        return baos.toString();
    }

    protected ArrayList readArgsArray()
        throws Exception
    {
        String array[] = readArgs();
        ArrayList args = new ArrayList();
        for (int i = 0; i < array.length; i++)
        {
            args.add(array[i]);
        }
        return args;
    }

    protected static String writeArgsArray(List args)
        throws Exception
    {
        String array[] = new String[args.size()];
        Iterator i = args.iterator();
        int offset = 0;
        while (i.hasNext()) {
            array[offset++] = (String)i.next();
        }
        return writeArgs(array);
    }
@


1.1.2.3
log
@Changed package name.
@
text
@d18 1
a18 1
import org.tigris.helm.tool.task.TaskException;
@


1.1.2.4
log
@Added alias to add method which takes a User object.
@
text
@a55 13
    public static Task add (User onBehalfOf, String component, 
                            String affectedObjectID, String command, 
                            String arguments)
        throws Exception
    {
        String oboID = null;
        if (onBehalfOf != null)
        {
            oboID = onBehalfOf.getID();
        }
        return add(oboID, component, affectedObjectID, command, arguments);
    }

@


1.1.2.5
log
@Added another wrapper method.
@
text
@a46 9
    public static Task add (User onBehalfOf, String component, 
                            String affectedObjectID, String command,
                            List arguments)
        throws Exception
    {
        return add(onBehalfOf, component, affectedObjectID, command,
            writeArgsArray(arguments));
    }

a54 1

@


1.1.2.6
log
@Corrected JavaDoc.
@
text
@d94 3
a96 5
    /**
     * Every subclass of this class should define a way of running appropriate
     * tasks.
     */
    public static void runTask(Task t) throws TaskException
d98 2
a99 1
        if (t.getComponent().equals(HelmTask.COMPONENT_NAME)) {
d101 1
a101 2
        }
        else {
@


1.1.2.7
log
@Don't set on behalf of if none was provided.
@
text
@d85 1
a85 1
        if (onBehalfOf != null) t.setOnBehalfOf(Integer.parseInt(onBehalfOf));
@


1.1.2.8
log
@Replaced torque autogenerated message with description of class.
@
text
@d21 5
a25 5
 * A Task is a database entry indicating some action (usually related
 * to the hosted tools) which needs to be taken. Tasks are created to
 * reduce the user-visible time it takes to perform a complex action like
 * project creation.
 */
@


1.1.2.9
log
@Added static initializer to start a TaskRunner thread.
@
text
@d18 1
a18 1
import org.tigris.helm.tool.task.*;
a27 13

    //
    // Static initializer
    //
    static
    {
        if (TaskRunner.numberOfInstances()==0)
        {
            TaskRunner tr = new TaskRunner();
            tr.start();
        }
    }        

@


1.1.2.10
log
@Presumably this is more efficient.
@
text
@d53 1
a53 1
        return TaskPeer.doSelect(new Criteria(0));
@


1.1.2.11
log
@Added new imports necessitated by Torque.
@
text
@a10 1
import org.tigris.helm.om.base.*;
@


1.1.2.12
log
@Fixes for taskrunner.
@
text
@d114 1
a114 3
        Log.debug("Component: " + t.getComponent());
        if (t.getComponent().equals(HelmTask.COMPONENT_NAME))
        {
d117 3
a166 5
        if (getArguments() == null)
        {
            String [] empty={};
            return empty;
        }
@


1.1.2.13
log
@Don't both start and end blocks on the same line.
@
text
@d35 1
a35 1
        if (TaskRunner.numberOfInstances() == 0)
a60 3
    /**
     * Adds a new task.
     */
d67 1
a67 1
                   writeArgsArray(arguments));
a69 3
    /**
     * Adds a new task.
     */
d76 1
a76 1
                   writeArgsArray(arguments));
a79 3
    /**
     * Adds a new task.
     */
a92 3
    /**
     * Adds a new task.
     */
d112 1
a112 2
    public static void runTask(Task t)
        throws TaskException
d133 1
a133 2
        }
        catch (Exception e) {
d150 1
a150 2
        }
        catch (Exception e) {
@


1.1.2.14
log
@Added public final String getAffectedObjectID() method (currently used
in TaskList.wm).
@
text
@d46 1
a46 1
    public final String getID()
a54 5
    }

    public final String getAffectedObjectID()
    {
        return String.valueOf(getAffectedObjectId());
@


1.1.2.15
log
@Added getOnBehalfOfUser() : User method.
@
text
@a50 6
    public final User getOnBehalfOfUser()
        throws Exception
    {
        return UserPeer.retrieveByPK(getOnBehalfOf());
    }

@


1.1.2.16
log
@getOnBehalfOfUser() was already implemented in the super class, but
had a weird name.
@
text
@a50 3
    /**
     * Alias for super class method <code>getUser</code>.
     */
d54 1
a54 1
        return super.getUser()
@


1.1.2.17
log
@syntax error
@
text
@d57 1
a57 1
        return super.getUser();
@


