/* ======================================================================
   Parts Copyright 2006 University of Leeds, Oxford University, University of the Highlands and Islands.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

====================================================================== */

package org.bodington.server.resources;

import java.util.Enumeration;

import org.bodington.database.PrimaryKey;
import org.bodington.server.BuildingServerException;
import org.bodington.server.HomeContainerSessionImpl;

/**
 * Resource that is used for containing users home resources.
 * This resource may well contain 1000s of children so should be treated with 
 * repect or your CPUs may die.
 * @author buckett
 */
public class HomeContainerResource extends Resource
{
    
    public static HomeContainerResource findUsersResource( PrimaryKey key )
    throws BuildingServerException
    {
        return (HomeContainerResource)findPersistentObject( key, "org.bodington.server.resources.UsersResource" );
    }
    
    public static HomeContainerResource findUsersResource( String where )
    throws BuildingServerException
    {
        return (HomeContainerResource)findPersistentObject( where, "org.bodington.server.resources.UsersResource" );
    }
    
    public static Enumeration findUsersResources( String where, String order )
    throws BuildingServerException
    {
        return findPersistentObjects( where, order, "org.bodington.server.resources.UsersResource" );
    }
    
    public static Enumeration findUsersResourceIds( String where, String order )
    throws BuildingServerException
    {
        return findPrimaryKeys( where, order, "org.bodington.server.resources.UsersResource" );
    }
    
    public HomeContainerResource()
    {
    }
    
    public HomeContainerResource(String name, String title, String description, String introduction)
        throws BuildingServerException
    {
        super(name, title, description, introduction);
    }

    public int getResourceType()
    {
        return RESOURCE_HOME_CONTAINER;
    }
    
    public Class sessionClass()
    {
        return HomeContainerSessionImpl.class;
    }

}
