Skip to content

Commit bec7657

Browse files
committed
Initial commit
1 parent 341caf8 commit bec7657

18 files changed

+4778
-0
lines changed

source/PLSQLGatewayModule.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Express 2013 for Web
4+
VisualStudioVersion = 12.0.30723.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PLSQLGatewayModule", "PLSQLGatewayModule\PLSQLGatewayModule.csproj", "{4EA6EEE1-8CF9-4E9B-A993-DE15C38C004F}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{4EA6EEE1-8CF9-4E9B-A993-DE15C38C004F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{4EA6EEE1-8CF9-4E9B-A993-DE15C38C004F}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{4EA6EEE1-8CF9-4E9B-A993-DE15C38C004F}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{4EA6EEE1-8CF9-4E9B-A993-DE15C38C004F}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Lines changed: 327 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,327 @@
1+
using System.Configuration;
2+
using System;
3+
4+
namespace PLSQLGatewayModule
5+
{
6+
/// <summary>
7+
/// Handles configuration of Database Access Descriptors (DADs) in the web.config file
8+
/// </summary>
9+
public class DadConfiguration
10+
{
11+
12+
public const string DEFAULT_EXCLUSION_LIST = "sys. dbms_ utl_ owa_ htp. htf. wpg_docload. ctxsys. mdsys.";
13+
14+
public const string INVOCATION_PROTOCOL_CGI = "CGI";
15+
public const string INVOCATION_PROTOCOL_SOAP = "SOAP";
16+
17+
private static DadSection _dadSection = (DadSection)System.Configuration.ConfigurationManager.GetSection("thoth");
18+
private static DadElement _dadElement = null;
19+
20+
private string _nlsLanguage = "";
21+
private string _nlsTerritory = "";
22+
private string _nlsCharset = "";
23+
24+
public DadConfiguration(string dadName)
25+
{
26+
_dadElement = _dadSection.Dads[dadName];
27+
28+
string langString = NLSLanguageString;
29+
30+
// The NLS_LANG parameter has three components: language, territory, and character set.
31+
// Specify it in the following format, including the punctuation:
32+
// NLS_LANG = language_territory.charset
33+
34+
string langLangTerritory = langString.Substring(0, langString.IndexOf("."));
35+
_nlsLanguage = langLangTerritory.Substring(0, langLangTerritory.IndexOf("_"));
36+
_nlsTerritory = langLangTerritory.Substring(langLangTerritory.IndexOf("_") + 1);
37+
_nlsCharset = langString.Substring(langString.IndexOf(".") + 1);
38+
39+
}
40+
41+
private string getVal(string name, string defaultValue)
42+
{
43+
return (_dadElement.Params[name] != null ? _dadElement.Params[name].Value : defaultValue);
44+
}
45+
46+
private int getIntVal(string name, int defaultValue)
47+
{
48+
String val = getVal(name, null);
49+
if (val != null)
50+
{
51+
return Convert.ToInt32(val);
52+
}
53+
else
54+
{
55+
return defaultValue;
56+
}
57+
}
58+
59+
private bool getBoolVal(string name, bool defaultValue)
60+
{
61+
String val = getVal(name, null);
62+
if (val != null)
63+
{
64+
return Convert.ToBoolean(val);
65+
}
66+
else
67+
{
68+
return defaultValue;
69+
}
70+
}
71+
72+
public static string DefaultDad
73+
{
74+
get { return ConfigurationSettings.AppSettings["DefaultDad"]; }
75+
}
76+
77+
public static bool DefaultDadEnabled
78+
{
79+
get { return bool.Parse(ConfigurationSettings.AppSettings["DefaultDadEnabled"]); }
80+
}
81+
82+
public static bool ServeStaticContent
83+
{
84+
get { return ConfigurationSettings.AppSettings["ServeStaticContent"] != null ? bool.Parse(ConfigurationSettings.AppSettings["ServeStaticContent"]) : false; }
85+
}
86+
87+
public static bool CompressDynamicContent
88+
{
89+
get { return ConfigurationSettings.AppSettings["CompressDynamicContent"] != null ? bool.Parse(ConfigurationSettings.AppSettings["CompressDynamicContent"]) : false; }
90+
}
91+
92+
public static bool HideServerBanner
93+
{
94+
get { return ConfigurationSettings.AppSettings["HideServerBanner"] != null ? bool.Parse(ConfigurationSettings.AppSettings["HideServerBanner"]) : false; }
95+
}
96+
97+
public static string CGIServerSoftware
98+
{
99+
get { return ConfigurationSettings.AppSettings["CGIServerSoftware"] != null ? ConfigurationSettings.AppSettings["CGIServerSoftware"] : ""; }
100+
}
101+
102+
public static string CGIApexListenerVersion
103+
{
104+
get { return ConfigurationSettings.AppSettings["CGIApexListenerVersion"] != null ? ConfigurationSettings.AppSettings["CGIApexListenerVersion"] : ""; }
105+
}
106+
107+
public static string CGIPLSQLGateway
108+
{
109+
// name of the gateway (our claim to fame! :-)
110+
get { return ConfigurationSettings.AppSettings["CGIPLSQLGateway"] != null ? ConfigurationSettings.AppSettings["CGIPLSQLGateway"] : "THOTH"; }
111+
}
112+
113+
public static string CGIGatewayIVersion
114+
{
115+
// note: the Thoth Gateway reports itself as version "3" by default (like the Apex Listener)
116+
get { return ConfigurationSettings.AppSettings["CGIGatewayIVersion"] != null ? ConfigurationSettings.AppSettings["CGIGatewayIVersion"] : "3"; }
117+
}
118+
119+
public static bool IsValidDad(string dadName)
120+
{
121+
// check if dad entry exists in config file
122+
return _dadSection.Dads.IndexOf(dadName) > -1;
123+
}
124+
125+
public string AuthenticationMode
126+
{
127+
get { return getVal("AuthenticationMode", ""); }
128+
}
129+
130+
public string ErrorStyle
131+
{
132+
get { return getVal("ErrorStyle", "None"); }
133+
}
134+
135+
public string DatabaseConnectString
136+
{
137+
get { return getVal("DatabaseConnectString", ""); }
138+
}
139+
140+
public string DatabaseConnectStringAttributes
141+
{
142+
get { return getVal("DatabaseConnectStringAttributes", "Enlist=false"); }
143+
}
144+
145+
public string DatabaseUserName
146+
{
147+
get { return getVal("DatabaseUserName", ""); }
148+
}
149+
150+
public string DatabasePassword
151+
{
152+
get { return getVal("DatabasePassword", ""); }
153+
}
154+
155+
private string NLSLanguageString
156+
{
157+
get { return getVal("NLSLanguage", "AMERICAN_AMERICA.AL32UTF8"); }
158+
}
159+
160+
public string NLSLanguage
161+
{
162+
get { return _nlsLanguage; }
163+
}
164+
165+
public string NLSTerritory
166+
{
167+
get { return _nlsTerritory; }
168+
}
169+
170+
public string NLSCharset
171+
{
172+
get { return _nlsCharset; }
173+
}
174+
175+
public string IANACharset
176+
{
177+
// This is the IANA (Internet Assigned Number Authority) equivalent of the REQUEST_CHARSET CGI environment variable.
178+
get { return getVal("IANACharset", "UTF-8"); }
179+
}
180+
181+
public string ExclusionList
182+
{
183+
get { return getVal("ExclusionList", ""); }
184+
}
185+
186+
public string InclusionList
187+
{
188+
get { return getVal("InclusionList", ""); }
189+
}
190+
191+
public string RequestValidationFunction
192+
{
193+
get { return getVal("RequestValidationFunction", ""); }
194+
}
195+
196+
public string DefaultPage
197+
{
198+
get { return getVal("DefaultPage", ""); }
199+
}
200+
201+
public string DocumentPath
202+
{
203+
get { return getVal("DocumentPath", "docs"); }
204+
}
205+
206+
public string DocumentProcedure
207+
{
208+
get { return getVal("DocumentProcedure", "process_download"); }
209+
}
210+
211+
public string DocumentTableName
212+
{
213+
get { return getVal("DocumentTableName", ""); }
214+
}
215+
216+
public int DocumentMaxUploadSize
217+
{
218+
get { return getIntVal("DocumentMaxUploadSize", 0); }
219+
}
220+
221+
public int DocumentMaxNameLength
222+
{
223+
get { return getIntVal("DocumentMaxNameLength", 90); }
224+
}
225+
226+
public string DocumentFilePath
227+
{
228+
get { return getVal("DocumentFilePath", ""); }
229+
}
230+
231+
public string DocumentXdbPath
232+
{
233+
get { return getVal("DocumentXdbPath", ""); }
234+
}
235+
236+
public string PathAlias
237+
{
238+
get { return getVal("PathAlias", ""); }
239+
}
240+
241+
public string PathAliasProcedure
242+
{
243+
get { return getVal("PathAliasProcedure", ""); }
244+
}
245+
246+
public bool PathAliasIncludeParameters
247+
{
248+
get { return getBoolVal("PathAliasIncludeParameters", false); }
249+
}
250+
251+
public string BeforeProcedure
252+
{
253+
get { return getVal("BeforeProcedure", ""); }
254+
}
255+
256+
public string AfterProcedure
257+
{
258+
get { return getVal("AfterProcedure", ""); }
259+
}
260+
261+
public int[] BindBucketLengths
262+
{
263+
get {
264+
265+
string[] input = getVal("BindBucketLengths", "4,20,100,400").Split(',');
266+
267+
return Array.ConvertAll<string, int>(input, delegate(string s) { return int.Parse(s); } );
268+
}
269+
}
270+
271+
public int[] BindBucketWidths
272+
{
273+
get
274+
{
275+
string[] input = getVal("BindBucketWidths", "32,128,1024,2048,4000,8000,16000,32767").Split(',');
276+
277+
return Array.ConvertAll<string, int>(input, delegate(string s) { return int.Parse(s); });
278+
}
279+
}
280+
281+
public int FetchBufferSize
282+
{
283+
get { return getIntVal("FetchBufferSize", 200); }
284+
}
285+
286+
public string InvocationProtocol
287+
{
288+
get { return getVal("InvocationProtocol", INVOCATION_PROTOCOL_CGI); }
289+
}
290+
291+
public string SoapTargetNamespace
292+
{
293+
get { return getVal("SoapTargetNamespace", "http://tempuri.org/myservice"); }
294+
}
295+
296+
public string SoapFaultStyle
297+
{
298+
get { return getVal("SoapFaultStyle", "Generic"); }
299+
}
300+
301+
public string SoapFaultStringTag
302+
{
303+
get { return getVal("SoapFaultStringTag", "usrerr"); }
304+
}
305+
306+
public string SoapFaultDetailTag
307+
{
308+
get { return getVal("SoapFaultDetailTag", "errinfo"); }
309+
}
310+
311+
public string SoapDateFormat
312+
{
313+
get { return getVal("SoapDateFormat", "YYYY-MM-DD\"T\"HH24:MI:SS\".000\""); }
314+
}
315+
316+
public string XdbAlias
317+
{
318+
get { return getVal("XdbAlias", ""); }
319+
}
320+
321+
public string XdbAliasRoot
322+
{
323+
get { return getVal("XdbAliasRoot", ""); }
324+
}
325+
326+
}
327+
}

0 commit comments

Comments
 (0)