/*
 * Filename: RequestQueue.java
 *
 * Author: Joe Wang
 *
 * Copyright (c) 2003-2005 
 * The Trustees of Columbia University in the City of New York
 * Columbia University Information Technology
 *
 * This file is part of NINJa.
 *
 * NINJa is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * NINJa is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with NINJa; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 */
package edu.columbia.print.ninja.core.service;

import edu.columbia.print.ninja.core.authenticate.AuthStub;
import edu.columbia.print.ninja.core.event.*;
import net.jini.core.event.*;
import net.jini.print.job.PrintRequest;
import java.rmi.RemoteException;
import java.rmi.*;
import net.jini.print.service.PrintService;

/**
 * An interface for the display of print jobs and controlling these printjobs.
 * The queue uses a print service provider rather the javax.print.attribute.standard.Destination
 * attribute.  This makes it easier to get status of a particular printer.
 * @author Joe Wang <jw168@columbia.edu>
 * @since 1.0
 */
public interface RequestQueue extends java.rmi.Remote, PrintService {

	public static final int AUTHENTICATOR_RENEW_TIMEOUT = 0;
	public static final int AUTHENTICATOR_DEFAULT_TIMEOUT = 0;
	public static final int AUTHENTICATOR_MAX_TIMEOUT = 0;
	public static final int REQUEST_RENEW_TIMEOUT = 0;
	public static final int REQUEST_DEFAULT_TIMEOUT = 0;
	public static final int REQUEST_MAX_TIMEOUT = 0;
	public static final int PRINT_SERVICE_LISTENER_RENEW_TIMEOUT = 0;
	public static final int PRINT_SERVICE_LISTENER_DEFAULT_TIMEOUT = 0;
	public static final int PRINT_SERVICE_LISTENER_MAX_TIMEOUT = 0;
	public static final int QUEUE_LISTENER_RENEW_TIMEOUT = 0;
	public static final int QUEUE_LISTENER_DEFAULT_TIMEOUT = 0;
	public static final int QUEUE_LISTENER_MAX_TIMEOUT = 0;

        long getRequestExpiration(PrintRequest request) throws RemoteException;

        /**
	 * Request that a particular job be printed to another PrintService.
	 * @param jobs - the jobs to print
	 * @param attrs - The attributes of the jobs.  These correspond to jobs
	 * @param service - the service to print to, if null, it will decide
	 * @param leaseDuration - the length of time we want to hold the AuthStub for
	 * @return the stub required for authentication
	 */
	AuthStub requestStart(PrintRequest[] requests, PrintService service, long leaseDuration) throws RemoteException, net.jini.core.lease.LeaseDeniedException;

	/**
	 * Request that a particular job be removed from this PrintService.
	 * @param jobs - the jobs to remove
	 * @param leaseDuration - the length of time we want to hold the AuthStub for
	 * @return the stub required for authentication
	 */
	AuthStub requestRemove(PrintRequest[] jobs, long leaseDuration) throws RemoteException;

	edu.columbia.print.ninja.core.event.PrintQueueEvent[] getRequests() throws RemoteException;

//	void addPrintQueueListener(PrintQueueListener l);
//	void removePrintQueueListener(PrintQueueListener l);

	boolean registerServiceProvider(Lookup sp) throws RemoteException;

	void setQueueDir(String dir) throws RemoteException;

	String getQueueDir() throws RemoteException;

	void setTimeout(int type, long value) throws RemoteException;

	long getTimeout(int type) throws RemoteException;

	//request timeout
	void setAuthenticators(edu.columbia.print.ninja.core.authenticate.Authenticator[] auths) throws RemoteException;

	EventRegistration addEventListener(Class[] categories, PrintQueueEvent[] events, RemoteEventListener l, MarshalledObject handback, long lease) throws RemoteException;

}

