﻿<?xml version="1.0" encoding="utf-16"?>
<JiwaDocument xmlns:jiwa="http://www.jiwa.com.au/xml/schemas" Type="JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin">
  <RecID>1ed74da2-f116-473a-aed4-9866f71f784c</RecID>
  <Name>REST API - Disable metadata</Name>
  <Description>This plugin disables the metadata page of the REST API web interface.&amp;#13;&amp;#10;&amp;#13;&amp;#10;Fo use by the overly paranoid that do not understand what metadata is.</Description>
  <IsEnabled>true</IsEnabled>
  <IsIsolatedToOwnAppDomain>false</IsIsolatedToOwnAppDomain>
  <ExecutionOrder>1</ExecutionOrder>
  <Author>Jiwa Financials</Author>
  <Version>7.2.1.0</Version>
  <Code>using System;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.Metadata;
public class DisableMetadata : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaRESTAPIPlugin
{
	public void Configure(JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin, ServiceStack.ServiceStackHost AppHost, Funq.Container Container, JiwaFinancials.Jiwa.JiwaApplication.Manager JiwaApplicationManager)
	{
		// necessary or you may get the error "Could not load file or assembly 'REST API, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."
		// when invoking the route(s)
		// need to read the reference collection as we don't read that unless compiling, and in this case we need to read it on logon whether it's compiled or not
		Plugin.PluginReferenceCollection.Read();
		// If we weren't referencing anything defined in the REST API plugin, then we wouldn't need to handle the AssemblyResolve event
		AppDomain.CurrentDomain.AssemblyResolve += delegate(object sender, System.ResolveEventArgs args) { return AssemblyResolve(sender, args, Plugin); };
				
		AppHost.SetConfig(new ServiceStack.HostConfig { EnableFeatures = Feature.Json });
	}
	
	public System.Reflection.Assembly AssemblyResolve(object sender, System.ResolveEventArgs args, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
	{
	   // If the requested assembly is a reference to another plugin, then we need to attempt to resolve the assembly ourselves               
	   foreach(JiwaFinancials.Jiwa.JiwaApplication.Plugin.PluginReference pluginReference in Plugin.PluginReferenceCollection)
	   {
	      if (String.Format("{0}, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", pluginReference.Name) == args.Name)
	      {
	         return System.Reflection.Assembly.LoadFile(pluginReference.Plugin.RuntimeFileName);
	      }
	   }
	   
	   return null;
	}
}</Code>
  <ExceptionPolicy>Abort</ExceptionPolicy>
  <Language>CSharp</Language>
  <ReferenceCollection>
    <Reference>
      <RecID>e7b4b88f-a6c6-4410-9fb0-1ff2bdc74866</RecID>
      <AssemblyFullName>JiwaApplication, Version=7.2.1.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaApplication.dll</AssemblyName>
      <AssemblyLocation>C:\VSTS\Jiwa 7\07.02.00\Built Files\JiwaApplication.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>fe87ee25-2a92-429f-8df7-27dc24604046</RecID>
      <AssemblyFullName>mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>mscorlib.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>e8abd828-9554-4835-a8e4-7b20854d3452</RecID>
      <AssemblyFullName>System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>804de42a-5f44-4847-88b9-918a49abcee5</RecID>
      <AssemblyFullName>System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Xml.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>450835ec-a853-4be6-a66d-62f91f3cf619</RecID>
      <AssemblyFullName>System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Runtime.Serialization.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>2e7c61e9-f0a1-4214-b27c-c29d7ed2d674</RecID>
      <AssemblyFullName>System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Windows.Forms.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>d32dd78b-78f4-4ab9-bf27-fc932c1998f4</RecID>
      <AssemblyFullName>JiwaServiceModel, Version=7.2.1.0, Culture=neutral, PublicKeyToken=e30ce81e37f29c8c</AssemblyFullName>
      <AssemblyName>JiwaServiceModel.dll</AssemblyName>
      <AssemblyLocation>C:\VSTS\Jiwa 7\07.02.00\Built Files\JiwaServiceModel.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>790bdc8a-4cf3-4b85-b2b0-1bdab9c67fb4</RecID>
      <AssemblyFullName>ServiceStack, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587</AssemblyFullName>
      <AssemblyName>ServiceStack.dll</AssemblyName>
      <AssemblyLocation>C:\VSTS\Jiwa 7\07.02.00\Built Files\ServiceStack.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>33232039-458e-432d-93bd-3f9625c1dafd</RecID>
      <AssemblyFullName>System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</AssemblyFullName>
      <AssemblyName>System.Core.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>3b9a09e7-e9c3-4aae-8576-326f9b7b3f85</RecID>
      <AssemblyFullName>System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</AssemblyFullName>
      <AssemblyName>System.Security.dll</AssemblyName>
      <AssemblyLocation>C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Security\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Security.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>61168d16-17f1-4176-9583-ba22208d5f1a</RecID>
      <AssemblyFullName>ServiceStack.Text, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587</AssemblyFullName>
      <AssemblyName>ServiceStack.Text.dll</AssemblyName>
      <AssemblyLocation>C:\VSTS\Jiwa 7\07.02.00\Built Files\ServiceStack.Text.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>6d5bcc35-3e2c-437d-80c1-3c4a9f9bf279</RecID>
      <AssemblyFullName>ServiceStack.Interfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=02c12cbda47e6587</AssemblyFullName>
      <AssemblyName>ServiceStack.Interfaces.dll</AssemblyName>
      <AssemblyLocation>C:\VSTS\Jiwa 7\07.02.00\Built Files\ServiceStack.Interfaces.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>20ddc691-4e64-45e6-a492-64f6a5ecc130</RecID>
      <AssemblyFullName>ServiceStack.Server, Version = 5.0.0.0, Culture = neutral, PublicKeyToken = 02c12cbda47e6587</AssemblyFullName>
      <AssemblyName>ServiceStack.Server.dll</AssemblyName>
      <AssemblyLocation>C:\VSTS\Jiwa 7\07.02.00\Built Files\ServiceStack.Server.dll</AssemblyLocation>
    </Reference>
    <Reference>
      <RecID>f4052ee7-925f-4354-868f-3062da69ee44</RecID>
      <AssemblyFullName>ServiceStack.OrmLite, Version = 5.0.0.0, Culture = neutral, PublicKeyToken = 02c12cbda47e6587</AssemblyFullName>
      <AssemblyName>ServiceStack.OrmLite.dll</AssemblyName>
      <AssemblyLocation>C:\VSTS\Jiwa 7\07.02.00\Built Files\ServiceStack.OrmLite.dll</AssemblyLocation>
    </Reference>
  </ReferenceCollection>
  <PluginReferenceCollection>
    <PluginReference>
      <RecID>e594b571-7e78-4937-98f3-378a4ad072e1</RecID>
      <Plugin>
        <RecID xmlns="Entities.Plugin">fb0c1ea8-c560-41ef-b718-f0dc70ba89b9</RecID>
        <Name xmlns="Entities.Plugin">REST API</Name>
        <Description xmlns="Entities.Plugin">test5</Description>
        <Author xmlns="Entities.Plugin">Jiwa Financials</Author>
        <IsEnabled xmlns="Entities.Plugin">false</IsEnabled>
        <ExecutionOrder xmlns="Entities.Plugin">0</ExecutionOrder>
      </Plugin>
    </PluginReference>
  </PluginReferenceCollection>
</JiwaDocument>