//----------------------------BEGIN LICENSE----------------------------
/* 
 * Willow : the Open Source WorkFlow Project
 * Distributable under GNU LGPL license by gun.org
 *
 * Copyright (C) 2004-2010  huihoo.org 
 * Copyright (C) 2004-2010  ZosaTapo <dertyang@hotmail.com> 
 * 
 * ====================================================================
 * Project Homepage : http://www.huihoo.org/willow
 * Source Forge     : http://sourceforge.net/projects/huihoo
 * Mailing list     : willow@lists.sourceforge.net 
 */
//----------------------------END  LICENSE-----------------------------
package org.huihoo.willow.naming.resources;

import javax.naming.directory.DirContext;

/**
 * Implements a cache entry.
 * 
 */
public class CacheEntry
{

	// ------------------------------------------------- Instance Variables

	public long timestamp = -1;
	public String name = null;
	public ResourceAttributes attributes = null;
	public Resource resource = null;
	public DirContext context = null;
	public boolean exists = true;
	public long accessCount = 0;
	public int size = 1;

	// ----------------------------------------------------- Public Methods

	public void recycle()
	{
		timestamp = -1;
		name = null;
		attributes = null;
		resource = null;
		context = null;
		exists = true;
		accessCount = 0;
		size = 1;
	}

	public String toString()
	{
		return (
			"Cache entry: "
				+ name
				+ "\n"
				+ "Exists: "
				+ exists
				+ "\n"
				+ "Attributes: "
				+ attributes
				+ "\n"
				+ "Resource: "
				+ resource
				+ "\n"
				+ "Context: "
				+ context);
	}

}
