FileDocCategorySizeDatePackage
TrackerWCHelper.javaAPI DocAzureus 3.0.3.43766Wed Sep 26 14:54:02 BST 2007org.gudy.azureus2.pluginsimpl.local.tracker

TrackerWCHelper

public abstract class TrackerWCHelper extends Object implements org.gudy.azureus2.plugins.tracker.web.TrackerWebContext, org.gudy.azureus2.core3.tracker.host.TRHostAuthenticationListener, org.gudy.azureus2.core3.tracker.server.TRTrackerServerAuthenticationListener
author
parg

Fields Summary
private org.gudy.azureus2.plugins.PluginInterface
plugin_interface
private org.gudy.azureus2.plugins.tracker.Tracker
tracker
private List
generators
protected org.gudy.azureus2.core3.util.AEMonitor
this_mon
Constructors Summary
protected TrackerWCHelper()


	
	
	
		plugin_interface = UtilitiesImpl.getPluginThreadContext();
	
Methods Summary
public voidaddPageGenerator(org.gudy.azureus2.plugins.tracker.web.TrackerWebPageGenerator generator)

		try{
			this_mon.enter();

			generators.add( generator );

		}finally{

			this_mon.exit();
		}
	
public voiddestroy()

		generators.clear();
	
public org.gudy.azureus2.plugins.tracker.web.TrackerWebPageGenerator[]getPageGenerators()

		TrackerWebPageGenerator[]	res = new TrackerWebPageGenerator[generators.size()];

		generators.toArray( res );

		return( res );
	
public booleanhandleExternalRequest(java.net.InetSocketAddress _client_address, java.lang.String _user, java.lang.String _url, java.net.URL _absolute_url, java.lang.String _header, java.io.InputStream _is, java.io.OutputStream _os)

		UtilitiesImpl.setPluginThreadContext( plugin_interface );

		TrackerWebPageRequestImpl	request = new TrackerWebPageRequestImpl( tracker, this, _client_address, _user, _url, _absolute_url, _header, _is );
		TrackerWebPageResponseImpl	reply 	= new TrackerWebPageResponseImpl( _os , request);

		for (int i=0;i<generators.size();i++){

			TrackerWebPageGenerator	generator;

			try{
				this_mon.enter();

				if ( i >= generators.size()){

					break;
				}

				generator = (TrackerWebPageGenerator)generators.get(i);

			}finally{

				this_mon.exit();
			}

			if ( generator.generate( request, reply )){

				reply.complete();

				return( true );
			}
		}

		return( false );
	
public voidremovePageGenerator(org.gudy.azureus2.plugins.tracker.web.TrackerWebPageGenerator generator)

		try{
			this_mon.enter();

			generators.remove( generator );

		}finally{

			this_mon.exit();
		}

	
protected voidsetTracker(org.gudy.azureus2.plugins.tracker.Tracker _tracker)

		tracker	= _tracker;