Move BrowseFrontend and ReferenceFrontend to

OpenSim/Grid/AssetInventoryServer/Plugins.
0.6.3-post-fixes
Mike Mazur 2009-02-16 02:26:44 +00:00
parent af64c1ee9e
commit 02cf9f7e9f
4 changed files with 75 additions and 12 deletions

View File

@ -33,32 +33,58 @@ using System.Collections.Specialized;
using System.Net; using System.Net;
using System.Text; using System.Text;
using System.Web; using System.Web;
using ExtensionLoader;
using OpenMetaverse; using OpenMetaverse;
using HttpServer; using HttpServer;
using OpenSim.Framework;
namespace OpenSim.Grid.AssetInventoryServer.Extensions namespace OpenSim.Grid.AssetInventoryServer.Plugins
{ {
public class BrowseFrontend : IExtension<AssetInventoryServer> public class BrowseFrontendPlugin : IAssetInventoryServerPlugin
{ {
AssetInventoryServer server; AssetInventoryServer server;
public BrowseFrontend() public BrowseFrontendPlugin()
{ {
} }
public void Start(AssetInventoryServer server) #region IPlugin implementation
public void Initialise(AssetInventoryServer server)
{ {
this.server = server; this.server = server;
// Request for / or /?... // Request for / or /?...
server.HttpServer.AddHandler("get", null, @"(^/$)|(^/\?.*)", BrowseRequestHandler); server.HttpServer.AddHandler("get", null, @"(^/$)|(^/\?.*)", BrowseRequestHandler);
Logger.Log.Info("[ASSET] Browser Frontend loaded.");
} }
public void Stop() /// <summary>
/// <para>Initialises asset interface</para>
/// </summary>
public void Initialise()
{
Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
public void Dispose()
{ {
} }
public string Version
{
// TODO: this should be something meaningful and not hardcoded?
get { return "0.1"; }
}
public string Name
{
get { return "AssetInventoryServer Browse asset frontend"; }
}
#endregion IPlugin implementation
bool BrowseRequestHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response) bool BrowseRequestHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
{ {
const int ASSETS_PER_PAGE = 25; const int ASSETS_PER_PAGE = 25;

View File

@ -31,22 +31,24 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
using System.Xml; using System.Xml;
using ExtensionLoader;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using HttpServer; using HttpServer;
using OpenSim.Framework;
namespace OpenSim.Grid.AssetInventoryServer.Extensions namespace OpenSim.Grid.AssetInventoryServer.Plugins
{ {
public class ReferenceFrontend : IExtension<AssetInventoryServer> public class ReferenceFrontendPlugin : IAssetInventoryServerPlugin
{ {
AssetInventoryServer server; AssetInventoryServer server;
public ReferenceFrontend() public ReferenceFrontendPlugin()
{ {
} }
public void Start(AssetInventoryServer server) #region IPlugin implementation
public void Initialise(AssetInventoryServer server)
{ {
this.server = server; this.server = server;
@ -60,12 +62,36 @@ namespace OpenSim.Grid.AssetInventoryServer.Extensions
// Asset creation // Asset creation
server.HttpServer.AddHandler("post", null, "^/createasset", CreateRequestHandler); server.HttpServer.AddHandler("post", null, "^/createasset", CreateRequestHandler);
Logger.Log.Info("[ASSET] Reference Frontend loaded.");
} }
public void Stop() /// <summary>
/// <para>Initialises asset interface</para>
/// </summary>
public void Initialise()
{
Logger.Log.InfoFormat("[ASSET]: {0} cannot be default-initialized!", Name);
throw new PluginNotInitialisedException(Name);
}
public void Dispose()
{ {
} }
public string Version
{
// TODO: this should be something meaningful and not hardcoded?
get { return "0.1"; }
}
public string Name
{
get { return "AssetInventoryServer Reference asset frontend"; }
}
#endregion IPlugin implementation
bool MetadataRequestHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response) bool MetadataRequestHandler(IHttpClientContext client, IHttpRequest request, IHttpResponse response)
{ {
UUID assetID; UUID assetID;

View File

@ -10,4 +10,10 @@
<Extension path="/OpenSim/AssetInventoryServer/MetricsProvider"> <Extension path="/OpenSim/AssetInventoryServer/MetricsProvider">
<Plugin id="AssetInventoryMetrics" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.NullMetricsPlugin" /> <Plugin id="AssetInventoryMetrics" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.NullMetricsPlugin" />
</Extension> </Extension>
<Extension path="/OpenSim/AssetInventoryServer/Frontend">
<Plugin id="BrowseFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.BrowseFrontendPlugin" />
</Extension>
<Extension path="/OpenSim/AssetInventoryServer/Frontend">
<Plugin id="ReferenceFrontend" provider="OpenSim.Grid.AssetInventoryServer.Plugins.dll" type="OpenSim.Grid.AssetInventoryServer.Plugins.ReferenceFrontendPlugin" />
</Extension>
</Addin> </Addin>

View File

@ -797,8 +797,13 @@
<ReferencePath>../../../../bin/</ReferencePath> <ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System" /> <Reference name="System" />
<Reference name="System.Web"/>
<Reference name="OpenSim.Grid.AssetInventoryServer" /> <Reference name="OpenSim.Grid.AssetInventoryServer" />
<Reference name="OpenSim.Framework"/>
<Reference name="OpenMetaverse"/>
<Reference name="OpenMetaverseTypes"/> <Reference name="OpenMetaverseTypes"/>
<Reference name="OpenMetaverse.StructuredData2"/>
<Reference name="HttpServer2"/>
<Files> <Files>
<Match pattern="*.cs" recurse="false" /> <Match pattern="*.cs" recurse="false" />