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


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

1.8
date	2001.07.12.20.00.16;	author leonardr;	state Exp;
branches;
next	1.7;

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

1.6
date	2001.03.07.19.47.19;	author edk;	state Exp;
branches;
next	1.5;

1.5
date	2001.03.07.01.53.24;	author lucas;	state Exp;
branches;
next	1.4;

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

1.3
date	2001.02.22.19.00.06;	author edk;	state Exp;
branches;
next	1.2;

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

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

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

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

1.1.2.2
date	2001.01.31.01.42.34;	author dlr;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	2001.02.15.20.50.41;	author leonardr;	state Exp;
branches;
next	;


desc
@@


1.9
log
@Upgrading to Turbine 3.0-dev, Fulcrum 1.0, and Torque 1.0.
@
text
@/* ================================================================
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * 
 * 3. The end-user documentation included with the redistribution, if
 * any, must include the following acknowlegement: "This product includes
 * software developed by Collab.Net (http://www.Collab.Net/)."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 * 
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@collab.net.
 * 
 * 5. Products derived from this software may not use the "Tigris" name
 * nor may "Tigris" appear in their names without prior written
 * permission of CollabNet.
 * 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ====================================================================
 * 
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CollabNet.
 */

package org.tigris.helm.om.profile;

import java.util.*;

import org.apache.turbine.util.Log;
import org.apache.commons.util.exception.NestableException;
import org.apache.commons.util.exception.NestableException;

import org.apache.velocity.context.Context;

import org.tigris.helm.om.AnzuTask;
import org.tigris.helm.om.User;
import org.tigris.helm.om.Project;
import org.tigris.helm.DoesNotExist;

/**
 * Base class for project types.  All implementations should subclass.
 *
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@version $Id: BaseProfile.java,v 1.8 2001/07/12 20:00:16 leonardr Exp $
 */
abstract class BaseProfile implements ProjectProfile
{
    /**
     * Enforces use of the <code>ProjectProfiles</code> container to get an 
     * instance of this class.
     */
    protected BaseProfile ()
    {
        // No op.
    }

    /**
     * Gets the key of the <code>ProjectProfile</code> implementation.  
     * This is the name used to identify the <code>ProjectProfile</code> in 
     * servlet and template code.
     *
     * @@return The key.
     */
    public abstract String getKey ();

    /**
     * Gets the name of the <code>ProjectProfile</code>.
     *
     * @@return The name.
     */
    public abstract String getName ();

    /**
     * Gets the description of the <code>ProjectProfile</code>.
     *
     * @@return The description.
     */
    public abstract String getDescription ();

    /**
     * Gets the mailing lists that projects of the <code>ProjectProfile</code> 
     * begins life with.
     *
     * @@return Default mailing lists, as an array of string arrays.
     */
    public abstract Object getDefaultMailingLists (Project project)
        throws NestableException, DoesNotExist;

    /**
     * The default implementation does indeed auto-publish.
     */
    public boolean isAutoPublishedToWeb ()
    {
        return true;
    }

    /**
     * Indicates whether the <code>ProjectProfile</code> is a
     * composite project.  Most will not be composites, so the default
     * behavior will be to return <code>false</code>.  Over ride this
     * behavior as necessary.
     *
     * @@return Whether a composite project.  
     */
    public boolean isComposite ()
    {
        return false;
    }

    /**
     * Adds the default mailing lists.
     *
     * @@param conn        The JDBC database connection to use.
     * @@param project   The database key of the project to add the lists to.
     */
    public void addDefaultMailingLists (Project project, User user)
        throws NestableException, DoesNotExist
    {
        // First: try to create the project entry.

        String[][] lists =
            (String [][])getDefaultMailingLists(project);
        Log.debug("going to try adding mailing lists");
        if (lists != null)
        {
            try
            {
                for (int i = 0; i < lists.length; i++)
                {
                    Log.debug("adding mailing list : " + lists[i][0]);
                    AnzuTask.addMailingList(user, lists[i][0], project,
                            lists[i][1], lists[i][2], lists[i][3]);
                }
            }
            catch (Exception e)
            {
                Log.error("failed to add default mailing lists to project " +
                          project.getName(), e);
                // Currently, we should continue even if Anzu fails.
            }
        }
    }
}
@


1.8
log
@The last vestiges of the old Proprietary==Private Republic have been swept away.
@
text
@d52 2
a53 2
import org.apache.turbine.util.TurbineException;
import org.apache.turbine.util.TurbineException;
d66 1
a66 1
 * @@version $Id: BaseProfile.java,v 1.7 2001/05/23 01:50:15 dlr Exp $
d109 1
a109 1
        throws TurbineException, DoesNotExist;
d139 1
a139 1
        throws TurbineException, DoesNotExist
@


1.7
log
@Ported Helm from WebMacro to Velocity.
@
text
@d66 1
a66 1
 * @@version $Id: BaseProfile.java,v 1.6 2001/03/07 19:47:19 edk Exp $
d108 1
a108 2
    public abstract Object getDefaultMailingLists (Project project,
                                                   boolean isProprietary)
d138 1
a138 2
    public void addDefaultMailingLists (Project project, User user,
                                        boolean isProprietary)
d144 1
a144 1
            (String [][])getDefaultMailingLists(project, isProprietary);
@


1.6
log
@use the private toggle for private mailing lists, rather than
{type}-private
@
text
@d52 2
d55 1
a55 1
import org.webmacro.servlet.HandlerException;
d66 1
a66 1
 * @@version $Id: BaseProfile.java,v 1.5 2001/03/07 01:53:24 lucas Exp $
d110 1
a110 1
        throws HandlerException, DoesNotExist;
d141 1
a141 1
        throws HandlerException, DoesNotExist
@


1.5
log
@Corrected regex madness for Torque upgrade.  -dlr
@
text
@d64 1
a64 1
 * @@version $Id: BaseProfile.java,v 1.4 2001/02/22 20:29:10 edk Exp $
d145 1
a145 1
        Log.error("going to try adding mailing lists");
d152 1
a152 1
                    Log.error("adding mailing list : " + lists[i][0]);
d154 1
a154 1
                            lists[i][1], lists[i][2]);
@


1.4
log
@create mailing lists during project creation
@
text
@a57 1

d64 1
a64 1
 * @@version $Id: BaseProfile.java,v 1.3 2001/02/22 19:00:06 edk Exp $
@


1.3
log
@do mailing list creation as part of project creation
@
text
@d65 1
a65 1
 * @@version $Id: BaseProfile.java,v 1.2 2001/02/21 03:02:29 edk Exp $
d146 1
a150 2
                List autoSubscribe = new ArrayList();
                autoSubscribe.add(user.getEmail());
d153 1
@


1.2
log
@adding files from the branch to the head
@
text
@d55 1
d57 1
d65 1
a65 1
 * @@version $Id: BaseProfile.java,v 1.1.1.1 2001/02/21 00:34:55 dlr Exp $
d107 1
a107 1
    public abstract Object getDefaultMailingLists (String projectID,
d136 1
a136 1
     * @@param projectID   The database key of the project to add the lists to.
d138 1
a138 1
    public void addDefaultMailingLists (String projectID, User user,
d145 1
a145 1
            (String [][])getDefaultMailingLists(projectID, isProprietary);
d154 2
a155 7
                    // TODO : MailingList & MailingListManager
                    // really want ACLs.  Right now, we're not checking
                    // permission there, but that should be added
                    // soon (so this'll need to be dealt with somehow)
                    //AnzuTigrisTask.addMailingList
                    //(user.getID(), lists[i][0], projectID, lists[i][1], 
                    //lists[i][2]);
d161 1
a161 1
                          projectID, e);
@


1.1
log
@file BaseProfile.java was initially added on branch HELM_PEER_PORT_BRANCH.
@
text
@d1 169
@


1.1.1.1
log
@Replacing the HEAD with the HELM_PEER_PORT_BRANCH.
@
text
@a0 169
/* ================================================================
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * 
 * 3. The end-user documentation included with the redistribution, if
 * any, must include the following acknowlegement: "This product includes
 * software developed by Collab.Net (http://www.Collab.Net/)."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 * 
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@collab.net.
 * 
 * 5. Products derived from this software may not use the "Tigris" name
 * nor may "Tigris" appear in their names without prior written
 * permission of CollabNet.
 * 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ====================================================================
 * 
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CollabNet.
 */

package org.tigris.helm.om.profile;

import java.util.*;

import org.apache.turbine.util.Log;

import org.webmacro.servlet.HandlerException;

import org.tigris.helm.om.User;

import org.tigris.helm.DoesNotExist;

/**
 * Base class for project types.  All implementations should subclass.
 *
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@version $Id: BaseProfile.java,v 1.1.2.3 2001/02/15 20:50:41 leonardr Exp $
 */
abstract class BaseProfile implements ProjectProfile
{
    /**
     * Enforces use of the <code>ProjectProfiles</code> container to get an 
     * instance of this class.
     */
    protected BaseProfile ()
    {
        // No op.
    }

    /**
     * Gets the key of the <code>ProjectProfile</code> implementation.  
     * This is the name used to identify the <code>ProjectProfile</code> in 
     * servlet and template code.
     *
     * @@return The key.
     */
    public abstract String getKey ();

    /**
     * Gets the name of the <code>ProjectProfile</code>.
     *
     * @@return The name.
     */
    public abstract String getName ();

    /**
     * Gets the description of the <code>ProjectProfile</code>.
     *
     * @@return The description.
     */
    public abstract String getDescription ();

    /**
     * Gets the mailing lists that projects of the <code>ProjectProfile</code> 
     * begins life with.
     *
     * @@return Default mailing lists, as an array of string arrays.
     */
    public abstract Object getDefaultMailingLists (String projectID,
                                                   boolean isProprietary)
        throws HandlerException, DoesNotExist;

    /**
     * The default implementation does indeed auto-publish.
     */
    public boolean isAutoPublishedToWeb ()
    {
        return true;
    }

    /**
     * Indicates whether the <code>ProjectProfile</code> is a
     * composite project.  Most will not be composites, so the default
     * behavior will be to return <code>false</code>.  Over ride this
     * behavior as necessary.
     *
     * @@return Whether a composite project.  
     */
    public boolean isComposite ()
    {
        return false;
    }

    /**
     * Adds the default mailing lists.
     *
     * @@param conn        The JDBC database connection to use.
     * @@param projectID   The database key of the project to add the lists to.
     */
    public void addDefaultMailingLists (String projectID, User user,
                                        boolean isProprietary)
        throws HandlerException, DoesNotExist
    {
        // First: try to create the project entry.

        String[][] lists =
            (String [][])getDefaultMailingLists(projectID, isProprietary);
        if (lists != null)
        {
            try
            {
                List autoSubscribe = new ArrayList();
                autoSubscribe.add(user.getEmail());
                for (int i = 0; i < lists.length; i++)
                {
                    // TODO : MailingList & MailingListManager
                    // really want ACLs.  Right now, we're not checking
                    // permission there, but that should be added
                    // soon (so this'll need to be dealt with somehow)
                    //AnzuTigrisTask.addMailingList
                    //(user.getID(), lists[i][0], projectID, lists[i][1], 
                    //lists[i][2]);
                }
            }
            catch (Exception e)
            {
                Log.error("failed to add default mailing lists to project " +
                          projectID, e);
                // Currently, we should continue even if Anzu fails.
            }
        }
    }
}
@


1.1.2.1
log
@Classes ported to the Turbine Peer system. -dlr and leonardr
@
text
@a0 172
/* ================================================================
 * Copyright (c) 2000 CollabNet.  All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * 
 * 3. The end-user documentation included with the redistribution, if
 * any, must include the following acknowlegement: "This product includes
 * software developed by Collab.Net (http://www.Collab.Net/)."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 * 
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@collab.net.
 * 
 * 5. Products derived from this software may not use the "Tigris" name
 * nor may "Tigris" appear in their names without prior written
 * permission of CollabNet.
 * 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ====================================================================
 * 
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CollabNet.
 */

package org.tigris.helm.om.profile;

import java.util.*;

import org.webmacro.util.Log;
import org.webmacro.servlet.HandlerException;

import org.tigris.helm.om.User;

import org.tigris.helm.DoesNotExist;

/**
 * Base class for project types.  All implementations should subclass.
 *
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 * @@version $Id: BaseProfile.java,v 1.13 2000/12/14 04:03:03 edk Exp $
 */
abstract class BaseProfile implements ProjectProfile
{
    private static Log log = new Log("baseP", "baseProfile");
    public static final boolean debug = true;

    /**
     * Enforces use of the <code>ProjectProfiles</code> container to get an 
     * instance of this class.
     */
    protected BaseProfile ()
    {
        // No op.
    }

    /**
     * Gets the key of the <code>ProjectProfile</code> implementation.  
     * This is the name used to identify the <code>ProjectProfile</code> in 
     * servlet and template code.
     *
     * @@return The key.
     */
    public abstract String getKey ();

    /**
     * Gets the name of the <code>ProjectProfile</code>.
     *
     * @@return The name.
     */
    public abstract String getName ();

    /**
     * Gets the description of the <code>ProjectProfile</code>.
     *
     * @@return The description.
     */
    public abstract String getDescription ();

    /**
     * Gets the mailing lists that projects of the <code>ProjectProfile</code> 
     * begins life with.
     *
     * @@return Default mailing lists, as an array of string arrays.
     */
    public abstract Object getDefaultMailingLists (String projectID,
                                                   boolean isProprietary)
        throws HandlerException, DoesNotExist;

    /**
     * The default implementation does indeed auto-publish.
     */
    public boolean isAutoPublishedToWeb ()
    {
        return true;
    }

    /**
     * Indicates whether the <code>ProjectProfile</code> is a
     * composite project.  Most will not be composites, so the default
     * behavior will be to return <code>false</code>.  Over ride this
     * behavior as necessary.
     *
     * @@return Whether a composite project.  
     */
    public boolean isComposite ()
    {
        return false;
    }

    /**
     * Adds the default mailing lists.
     *
     * @@param conn        The JDBC database connection to use.
     * @@param projectID   The database key of the project to add the lists to.
     */
    public void addDefaultMailingLists (String projectID, User user,
                                        boolean isProprietary)
        throws HandlerException, DoesNotExist
    {
        // First: try to create the project entry.

        String[][] lists =
            (String [][])getDefaultMailingLists(projectID, isProprietary);
        if (lists != null)
        {
            try
            {
                List autoSubscribe = new ArrayList();
                autoSubscribe.add(user.getEmail());
                for (int i = 0; i < lists.length; i++)
                {
                    // TODO : MailingList & MailingListManager
                    // really want ACLs.  Right now, we're not checking
                    // permission there, but that should be added
                    // soon (so this'll need to be dealt with somehow)
                    //AnzuTigrisTask.addMailingList
                    //(user.getID(), lists[i][0], projectID, lists[i][1], 
                    //lists[i][2]);
                }
            }
            catch (Exception e)
            {
                log.exception(e);
                log.error("failed to add default mailing lists to project " +
                        projectID);
                // right now, we should continue even if anzu fails
            }
        }
    }
}
@


1.1.2.2
log
@Swapped in Turbine logging.
@
text
@d51 1
a51 2
import org.apache.turbine.util.Log;

d62 1
a62 1
 * @@version $Id: BaseProfile.java,v 1.1.2.1 2001/01/28 01:18:27 dlr Exp $
d66 3
d165 4
a168 3
                Log.error("failed to add default mailing lists to project " +
                          projectID, e);
                // Currently, we should continue even if Anzu fails.
@


1.1.2.3
log
@Normalized copyright dates.
@
text
@d2 1
a2 1
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
d63 1
a63 1
 * @@version $Id: BaseProfile.java,v 1.1.2.2 2001/01/31 01:42:34 dlr Exp $
@


