Naanou.ResourceExchange
Class ResourceExchanger

Manages the webserver

Field Summary
string bindAddress
Naanou.ResourceExchange.NaanouDirectContext blockContext
string directUrl
System.DateTime lastRefresh
Naanou.ResourceExchange.NaanouServerManager manager
System.Collections.ArrayList mounts
int port
Naanou.ResourceExchange.DBRefresher refresher
Naanou.ResourceExchange.NaanouServer server
string url

Constructor Summary
ResourceExchanger(string address, int port)
         Constructor. Nothing is started until Naanou.ResourceExchange.ResourceExchanger.Start is called.

Property Summary
string AddressPortPair
         Gets an ipaddress:port string for the server
string DirectUrl
         Gets the `direct' Url to blocks (e.g. http://localhost/direct/)
System.DateTime LastRefresh
ClintHeyer.Httpd.ServerManager Manager
         Gets the server manager
int MaxConnections
int Port
         Gets the port the server is bound to
bool RefreshInProgress
         Are the resources currently being refreshed?
Naanou.ResourceExchange.NaanouServer Server
         Gets the server
long Throttle
string Url
         Gets the base Url for this exchanger

Method Summary
void Clear()
         Clear all mounts
void DenyAccess(Naanou.ResourceExchange.ResourceExchanger.SharedMount mount)
         Do not use this method directly, use ResourceManager.UnSharePath instead.
ClintHeyer.Httpd.Context GrantAccess(string path, string description, bool recursive)
         Grant access to part of the filesystem to other users
ClintHeyer.Httpd.Context GrantAccess(Naanou.ResourceExchange.ResourceExchanger.SharedMount mount)
         Grants access to a specified mount (does not add it to mounts arraylist however)
bool IsShared(string path)
void LoadMounts(System.Collections.ArrayList mounts)
         Load mounts from mounts.xml into supplied array list
Naanou.ResourceExchange.ResourceExchanger.SharedMount[] Mounts()
         Gets an array of all mounts shared
void OnRefreshFinished(object sender, System.EventArgs args)
         Event callback from DBRefresher
void OnRefreshProgress(object sender, Naanou.ResourceExchange.ProgressEventArgs args)
         Event callback from DBRefresher
void OnReplyCompleted(ClintHeyer.Httpd.Context c, ClintHeyer.Httpd.ReplyArgs args)
void OnReplyStarted(ClintHeyer.Httpd.Context c, ClintHeyer.Httpd.ReplyArgs args)
void Refresh()
         Refreshes contents of database, resyncing it to the filesystem. May trigger add and removal events.
void Restart()
         Restart
void Save()
         Saves mounts
void SaveMounts(System.Collections.ArrayList mounts)
         Save supplied mount list into mounts.xml in current directory
void Start()
         Starts/restarts internal webserver
void Stop()
         Closes down resource exchanger

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString


Field Detail

bindAddress

private string bindAddress


blockContext

private Naanou.ResourceExchange.NaanouDirectContext blockContext


directUrl

private string directUrl


lastRefresh

private System.DateTime lastRefresh


manager

private Naanou.ResourceExchange.NaanouServerManager manager


mounts

private System.Collections.ArrayList mounts


port

private int port


refresher

private Naanou.ResourceExchange.DBRefresher refresher


server

private Naanou.ResourceExchange.NaanouServer server


url

private string url

Constructor Detail

ResourceExchanger

public ResourceExchanger(string address,
                         int port)

Constructor. Nothing is started until Naanou.ResourceExchange.ResourceExchanger.Start is called.

Parameters:
port - Port to start webserver on
Property Detail

AddressPortPair

internal string AddressPortPair

Gets an ipaddress:port string for the server


DirectUrl

internal string DirectUrl

Gets the `direct' Url to blocks (e.g. http://localhost/direct/)


LastRefresh

internal System.DateTime LastRefresh


Manager

internal ClintHeyer.Httpd.ServerManager Manager

Gets the server manager


MaxConnections

public int MaxConnections


Port

internal int Port

Gets the port the server is bound to


RefreshInProgress

internal bool RefreshInProgress

Are the resources currently being refreshed?


Server

public Naanou.ResourceExchange.NaanouServer Server

Gets the server


Throttle

public long Throttle


Url

public string Url

Gets the base Url for this exchanger

Method Detail

Clear

internal void Clear()

Clear all mounts


DenyAccess

internal void DenyAccess(Naanou.ResourceExchange.ResourceExchanger.SharedMount mount)

Do not use this method directly, use ResourceManager.UnSharePath instead.

Parameters:
mount -

GrantAccess

internal ClintHeyer.Httpd.Context GrantAccess(string path,
                                              string description,
                                              bool recursive)

Grant access to part of the filesystem to other users

Parameters:
path - Path, e.g. C:\Shared Files
description - Description for mount (can be null)
recursive - Are subdirectories added?
Returns:
New context path was shared in

GrantAccess

internal ClintHeyer.Httpd.Context GrantAccess(Naanou.ResourceExchange.ResourceExchanger.SharedMount mount)

Grants access to a specified mount (does not add it to mounts arraylist however)

Parameters:
mount - Mount
Returns:
Context for mount

IsShared

internal bool IsShared(string path)


LoadMounts

private void LoadMounts(System.Collections.ArrayList mounts)

Load mounts from mounts.xml into supplied array list

Parameters:
mounts -

Mounts

public Naanou.ResourceExchange.ResourceExchanger.SharedMount[] Mounts()

Gets an array of all mounts shared

Returns:

OnRefreshFinished

private void OnRefreshFinished(object sender,
                               System.EventArgs args)

Event callback from DBRefresher

Parameters:
sender -
args -

OnRefreshProgress

private void OnRefreshProgress(object sender,
                               Naanou.ResourceExchange.ProgressEventArgs args)

Event callback from DBRefresher

Parameters:
sender -
args -

OnReplyCompleted

private void OnReplyCompleted(ClintHeyer.Httpd.Context c,
                              ClintHeyer.Httpd.ReplyArgs args)


OnReplyStarted

private void OnReplyStarted(ClintHeyer.Httpd.Context c,
                            ClintHeyer.Httpd.ReplyArgs args)


Refresh

internal void Refresh()

Refreshes contents of database, resyncing it to the filesystem. May trigger add and removal events.


Restart

internal void Restart()

Restart


Save

public void Save()

Saves mounts


SaveMounts

private void SaveMounts(System.Collections.ArrayList mounts)

Save supplied mount list into mounts.xml in current directory

Parameters:
mounts -

Start

internal void Start()

Starts/restarts internal webserver


Stop

internal void Stop()

Closes down resource exchanger