This commit is contained in:
2007-12-03 16:28:26 +00:00
parent 7b55aba5b7
commit 469b8a60ff
13 changed files with 1927 additions and 0 deletions

View File

@@ -0,0 +1,243 @@
<?xml version="1.0" encoding="utf-8" ?>
<dbControl>
<connection string="Provider=Microsoft.Jet.OLEDB.4.0;Data source={path};Extended Properties=dBase III;Persist Security Info=False"/>
<default datapath="\\rhmdesktop\VEDATA"/>
<dbObject type="datapath"
items="Plants"
imageindex="1"
key=""
title=""
select=""
table=""
criteria=""
sort=""
child="plant">
<folders child="plant">
<folder title="xEntergy Nuclear Northeast - Indian Point Unit 2" template="veip2" />
<folder title="Virginia Power - Surry" template="vesurry" />
<folder title="Virginia Power - Surry (1A)" template="vesurrya" />
<folder title="Virginia Power - North Anna" template="venanna" />
<folder title="Virginia Power - North Anna, Unit 1" template="venanna1" />
<folder title="Virginia Power - North Anna, Unit 2" template="venanna2" />
<folder title="Northern States Power - Prairie Island Emergency Operating Procedures" template="vensp" />
<folder title="Northern States Power - Prairie Island Abnormal Operating Procedures" template="venspaop" />
<folder title="Northern States Power - Prairie Island Electrical Maintenance Procedures" template="vensppe" />
<folder title="Northern States Power - Prairie Island Alarm Response Procedures" template="vensparp" />
<folder title="Northern States Power - Prairie Island Remote Alarm Response Procedures" template="vensprar" />
<folder title="Northern States Power - Prairie Island System Operating Procedures" template="venspsop" />
<folder title="Northern States Power - Prairie Island Instrument Failure Guides" template="venspifg" />
<folder title="Northern States Power - Prairie Island Alarm Response Modifications" template="vensparm" />
<folder title="Northern States Power - Prairie Island SAMGS" template="venspsam" />
<folder title="American Electric Power - D. C. Cook" template="veaep" />
<folder title="Wisconsin Electric Power - Point Beach" template="vewpb" />
<folder title="Constellation Energy Group - Ginna" template="verge" />
<folder title="TUEC - Comanche Peak" template="vetuec" />
<folder title="Entergy Nuclear Northeast - Indian Point Unit 3" template="veip3" />
<folder title="Maine Yankee Atomic Power Company - Maine Yankee" template="vemya" />
<folder title="Yankee Atomic Electric - Yankee Rowe" template="veyae" />
<folder title="Wisconsin Public Service Corp.- Kewaunee" template="vewps" />
<folder title="Wisconsin Public Service Corp.- Kewaunee Operating Procedures" template="vewpsop" />
<folder title="Wisconsin Public Service Corp.- Kewaunee Alarm Response Procedures" template="vewpsarp" />
<folder title="Wisconsin Public Service Corp.- Kewaunee OP EOPs and AOPs" template="vewpsaep" />
<folder title="South Carolina Gas and Electric - V.C. Summer" template="vesummer" />
<folder title="Louisiana Power and Light - Waterford" template="velpl" />
<folder title="Pacific Gas and Electric - Diablo Canyon" template="vepac" />
<folder title="Southern California Edison - San Onofre" template="vesce" />
<folder title="Carolina Power and Light - Robinson" template="vecplr" />
<folder title="Arkansas Nuclear One - Unit 1" template="veano1" />
<folder title="Emergency Operating Procedures" template="veano2" />
<folder title="Normal Operating Procedures" template="veano2op" />
<folder title="Abnormal Operating Procedures" template="veano2ap" />
<folder title="Low Mode Emergency Operating Procedures" template="veano2lm" />
<folder title="Annunciator Procedures" template="veano2an" />
<folder title="Southern Nuclear Operating Company - Vogtle" template="vegpc" />
<folder title="Florida Power and Light - Turkey Point EOPs" template="vefpl" />
<folder title="Florida Power and Light - Turkey Point ONOPs" template="vefpl4" />
<folder title="Florida Power and Light - Turkey Point SAMGs" template="vefpls" />
<folder title="STPNOC - South Texas" template="vehlp" />
<folder title="Carolina Power and Light - Shearon Harris" template="vecpls" />
<folder title="Virginia Power - EPIP" template="veepip" />
<folder title="AmerenUE - Callaway Plant" template="vecal" />
<folder title="ADM - Administrative Procedures - Wolf Creek" template="vewcnadm" />
<folder title="ALR - Alarm Response Procedures - Wolf Creek" template="vewcnalr" />
<folder title="CKL - Check List Procedures - Wolf Creek" template="vewcnckl" />
<folder title="EMG - Emergency Procedures - Wolf Creek" template="vewcnemg" />
<folder title="FP - Fire Protection Procedures - Wolf Creek" template="vewcnfp" />
<folder title="FHP - Fuel Handling Procedures - Wolf Creek" template="vewcnfhp" />
<folder title="GEN - General Operating Procedures - Wolf Creek" template="vewcngen" />
<folder title="OFN - Off-Normal Procedures - Wolf Creek" template="vewcnofn" />
<folder title="STN STS - Surveillance Procedures - Wolf Creek" template="vewcnsur" />
<folder title="STN - Non-Tech Spec Surveillance Procedures - Wolf Creek" template="vewcnstn" />
<folder title="STS - Tech Spec Surveillance Procedures - Wolf Creek" template="vewcnsts" />
<folder title="SYS - System Procedures - Wolf Creek" template="vewcnsys" />
<folder title="TMP - Temporary Procedures - Wolf Creek" template="vewcntmp" />
<folder title="IPS - IPS Procedures - Wolf Creek" template="vewcnips" />
<folder title="CHM - Chemistry Procedures - Wolf Creek" template="vewcnchm" />
<folder title="Wolf Creek Procedures - Local Drive" template="vewcn" />
<folder title="Duke Power - Catawba 1B Interim Set" template="vecat" />
<folder title="Duke Power - Catawba Revision 1C" template="vecns" />
<folder title="Duke Power - McGuire" template="vemcg" />
<folder title="Exelon Nuclear - Braidwood/Byron" template="vecebwb" />
<folder title="Exelon Nuclear - Braidwood" template="vebraid" />
<folder title="Exelon Nuclear - Byron" template="vebyron" />
<folder title="Constellation Energy Group - Calvert Cliffs" template="vebge" />
<folder title="North Atlantic Energy Service Corp. - Seabrook Nuclear Plant" template="vesea" />
<folder title="Volian Enterprises. - River Bend Station" template="vervbnd" />
<folder title="River Bend Station - Mechanical Procedures" template="vervmech" />
<folder title="River Bend Station - Operations Procedures" template="vervops" />
<folder title="River Bend Station - Radiation Protection Procedures" template="vervrp" />
<folder title="River Bend Station - Fire Protection Procedures" template="vervfp" />
<folder title="River Bend Station - I and C" template="vervic" />
<folder title="River Bend Station - Chemistry Procedures" template="vervchem" />
<folder title="River Bend Station - Electrical Procedures" template="vervelec" />
<folder title="River Bend Station - Protective Relay Procedures" template="vervrel" />
<folder title="River Bend Station - Operations Procedures" template="vervops" />
<folder title="River Bend Station - IST" template="vervist" />
<folder title="Southern Nuclear Operating Company - Farley Nuclear Plant" template="vefnp" />
<folder title="CEN - Combustion Engineering ERGs" template="vecen" />
<folder title="WOG - Emergency Response Guidelines LP Rev. 1" template="velp1" />
<folder title="WOG - Emergency Response Guidelines HP Rev. 1" template="vehp1" />
<folder title="WOG - Emergency Response Guidelines LP Rev. 1a" template="velpr1a" />
<folder title="WOG - Emergency Response Guidelines HP Rev. 1a" template="vehp1a" />
<folder title="WOG - Emergency Response Guidelines LP Rev. 1b" template="velpr1b" />
<folder title="WOG - Emergency Response Guidelines HP Rev. 1b" template="vehp1b" />
<folder title="WOG - Emergency Response Guidelines HP Rev. 1b - Figures" template="vehp1bfg" />
<folder title="WOG - Emergency Response Guidelines Rev. 1c" template="verev1c" />
<folder title="WOG - Emergency Response Guidelines Rev. 2" template="verev2" />
<folder title="VEPROMS - Test and Validation Procedures" template="vetest" />
<folder title="VEPROMS - Test Procedures for Calvert Cliffs" template="vebgedt" />
<folder title="VEPROMS - Demo Database" template="vedemo" />
<folder title="VEPROMS - UKRAINE Verbal Translation EOIs" template="veukrain" />
<folder title="VEPROMS - PI Wolf Creek Performance Improvement Procedures" template="vewcnpi" />
</folders>
</dbObject>
<dbObject type="plant"
items="Sets"
imageindex="2"
key=""
title=""
select=""
table=""
criteria=""
sort=""
child="set">
<folders active="set.dbf">
<folder title="Emergency Procedures" template="procs" exception="procs2"/>
<folder title="Emergency Procedures Unit 1" template="procs" requires="procs2"/>
<folder title="Emergency Procedures Unit 2" template="procs2" />
<folder title="Emergency Procedures - Sample Version" template="samples" />
<folder title="Emergency Procedures (Intro / Attachment / Foldout)" template="pages" />
<folder title="Emergency Procedures (Intro / Attachment / Foldout)" template="intro" />
<folder title="Emergency Procedures (Intro / Attachment / Foldout)" template="intro2" />
<folder title="Writer's Guide" template="wg" />
<folder title="Abnormal Procedures" template="abbyproc" />
<folder template="*.prc" title="~Procedures ({filename})" />
<folder template="*.bck" title="~Background Documents ({filename})" />
<folder template="*.dvt" title="~Deviation Documents ({filename})" />
<folder template="*.sl?" title="~Procedures ({filename})" />
</folders>
</dbObject>
<dbObject type="set"
items="Versions"
imageindex="3"
key=""
title=""
select=""
table=""
criteria=""
sort=""
child="version">
<folders active="set.dbf">
<folder template="." title="Working Draft" />
<folder template="approved" title="Approved Version"/>
<folder template="chgsht" title="Change Sheet Version"/>
<folder template="tmpchg" title="Temporary Change"/>
<folder template="approved\tmpchg" title="Approved Temporary Change"/>
</folders>
</dbObject>
<dbObject type="version"
items="Procedures"
imageindex="4"
key="dbPath"
title="{number} - {title}"
select="select * from [set] where entry is not null"
table="Set"
criteria="entry is not null"
sort="number"
child="proc">
<folders active="set.dbf">
<folder template="*.zip" title="Archive ({filename})" child="archive"/>
<!--folder template="approved" title="Approved Version" child="version"/-->
</folders>
</dbObject>
<dbObject type="proc"
imageindex="5"
items="Sections"
key="{{Entry}}"
title="{step} - {sequence} {text}"
select="select * from(
select
asc(mid(sequence,2,1))-48 as sec,
asc(mid(step,1,1))-64 as sec2,
rtrim(mid(text,76,8)) as fmt,
mid(text,83,3) as subfmt,
rtrim(mid(text,86,20)) as secnum,
iif(mid(step,2,1)='0','S',mid(step,2,1)) + right('0'+rtrim(left(iif(type is null,'',type),1)),1) as OldType,
* from [{{entry}}] where sequence like ' %') order by sec"
table="Proc"
criteria=""
sort="step,sequence"
child="section"/>
<dbObject type="section"
imageindex="6"
items="Steps"
key=""
title="{stp: 3} - {text}"
select="select stp,step,text,type from (select asc(mid(step,2,1))-48 as stp,* from [{{entry}}] where step like '{{Step:1}}%' and sequence='S')order by stp"
table="Section"
criteria=""
sort="stp"
child="step"/>
<dbObject type="step"
imageindex="7"
items="Step Structure"
key="{{Step}}"
title="{Sequence} - {Text}"
select="select * from [{{entry}}] where step = '{{Step}}' and (sequence like '[*S!]_' or sequence='S$') "
select1="select * from [{{entry}}] where step = '{{step}}' and sequence &lt;&gt; 'S'"
table="Step"
criteria=""
sort="sequence"
child="substep"
child1="dbStepStruct"/>
<dbObject type="substep"
imageindex="8"
items="Substeps"
key=""
title="{sequence} - {text}"
select="select * from [{{entry}}] where step = '{{step}}' and (sequence like '{{sequence}}_' or sequence like '{{sequence}}[*!]_') "
table="SubStep"
criteria=""
sort="sequence"
child1="dbSubStep"/>
<dbObject type="stepstruct"
imageindex="8"
items="Structure"
key="{{Step}}{{Sequence}}"
title="{Sequence} - {Text}"
select=""
table=""
criteria=""
sort=""
child=""/>
<dbObject type="archive"
items=""
imageindex="9"
key=""
title=""
select=""
table=""
criteria=""
sort=""
child=""/>
</dbControl>

View File

@@ -0,0 +1,249 @@
using System;
using System.Collections.Generic;
using System.Text;
using vlnObjectLibrary;
using System.Xml;
using System.IO;
using System.Data;
using System.Data.OleDb;
using System.Reflection;
namespace vlnServerLibrary
{
public class vlnServer // This class loads children for a vlnObject
{
#region Log4Net
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
#region Static Properties
private static string m_XmlControlPath;
private static XmlDocument m_XmlControl;
public static string XMLControlPath
{
get { return m_XmlControlPath; }
set
{
m_XmlControlPath = value;
}
}
public static XmlDocument XMLControl
{
get
{
if (m_XmlControl == null)
{
m_XmlControl = new XmlDocument();
lock (m_XmlControl)
{
XMLControlPath = "vlnControl.xml";
m_XmlControl.Load(m_XmlControlPath);
}
}
return m_XmlControl;
}
}
#endregion
private List<vlnObject> LoadChildren(vlnObject o)
{
o.Children = new List<vlnObject>();
LoadChildrenFromFolders(o);// TODO: Load children based upon directory lookup
LoadChildrenFromDB(o,LookUp(o,"select"));// TODO: Load children based upon select statement
return o.Children;
}
public string GetChildren(string sVlnObject)
{
using (vlnObject o = new vlnObject(sVlnObject))
{
LoadChildren(o);
return o.AllChildren();
}
}
public string GetDataPath()
{
vlnObject o = new vlnObject();
o.Type="datapath";
o.Title="Data Path";
o.Path=LookUpX(o,".//default/@datapath");
return o.ToString();
}
protected string LookUp(vlnObject o,string s)
{
string xPath = string.Format(".//dbObject[@type='{0}']/@{1}", o.Type, s);
return LookUpX(o,xPath);
}
protected string LookUpP(vlnObject o,string s)
{
string xPath = string.Format(".//dbObject[@type='{0}']/@{1}", o.Parent.Type, s);
return LookUpX(o,xPath);
}
protected string LookUpX(vlnObject o,string xPath)
{
return LookUpX(o,xPath, XMLControl);
}
private void LoadChildrenFromDB(vlnObject o,string sSelect)
{
if (sSelect != "")
{
try
{
string s = LookUpX(o,".//connection/@string");
OleDbConnectionStringBuilder csb = new OleDbConnectionStringBuilder(s);
OleDbConnection dbConn = new OleDbConnection(csb.ConnectionString);
string sTable = LookUp(o,"table");
//if (dbConn.State != ConnectionState.Open) dbConn.Open();
OleDbDataAdapter da = new OleDbDataAdapter(sSelect, dbConn);
DataSet ds = new DataSet();
da.Fill(ds, sTable);
string srt = LookUp(o,"sort");
DataView dv = new DataView(ds.Tables[sTable], LookUp(o,"criteria"), LookUp(o,"sort"), DataViewRowState.CurrentRows);
foreach (DataRowView mydrv in dv)
{
vlnObject vb = o.Add(LookUp(o,"child"), "", o.Path);
foreach (DataColumn dc in dv.Table.Columns)
{
vb.AddProp(dc.ColumnName, mydrv[dc.ColumnName].ToString());
}
vb.Title = LookUpP(vb,"title");
o.Children.Add(vb);
}
}
catch (Exception ex)
{
log.ErrorFormat("{0}\r\n{1}", ex.Message, ex.InnerException);
}
}
}
public DataSet GetDataSet(vlnObject o, string sSelect)
{
if (sSelect != "")
{
try
{
OleDbConnection dbConn = new OleDbConnection(LookUpX(o, ".//connection/@string"));
OleDbDataAdapter da = new OleDbDataAdapter(sSelect, dbConn);
DataSet ds = new DataSet();
da.Fill(ds, LookUp(o, "table"));
return ds;
}
catch (Exception ex)
{
log.ErrorFormat("{0}\r\n{1}", ex.Message, ex.InnerException);
}
}
return null;
}
public OleDbDataReader GetDataReader(vlnObject o, string sSelect)
{
if (sSelect != "")
{
OleDbConnection dbConn = new OleDbConnection(LookUpX(o, ".//connection/@string"));
OleDbCommand cmd = new OleDbCommand(sSelect, dbConn);
cmd.CommandType = CommandType.Text;
dbConn.Open();
OleDbDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
return dr;
}
return null;
}
private void LoadChildrenFromFolders(vlnObject o)
{
// First look in the XML to see if there are any folders for the specified item
XmlNodeList nl = XMLControl.SelectNodes(string.Format(".//dbObject[@type='{0}']/folders/folder", o.Type));
if (nl.Count != 0)
{
foreach (XmlNode xn in nl)
{
LoadChildrenFromFolder(o,xn);
}
}
}
private void LoadChildrenFromFolder(vlnObject o, XmlNode xn)
{
// First look in the XML to see if there are any folders for the specified item
string sTmp = LookUpX(o,"@template", xn);
if (sTmp != "")
{
string sException = LookUpX(o,"@exception", xn);
string sRequired = LookUpX(o,"@requires", xn);
DirectoryInfo di = new DirectoryInfo(o.Path);
if (sRequired == "" || di.GetFileSystemInfos(sRequired).Length > 0)
{
if (sException == "" || di.GetFileSystemInfos(sException).Length == 0)
{
try
{
if (sTmp == ".")
{
LoadChildrenFromFolder(o, xn, di);
}
else
{
if(sTmp.Contains("\\")){
string[] sTmps = sTmp.Split('\\');
DirectoryInfo [] dis = di.GetDirectories(sTmps[0]);
foreach (DirectoryInfo di2 in dis)
{
foreach (FileSystemInfo di3 in di2.GetFileSystemInfos(sTmps[1]))
{
LoadChildrenFromFolder(o, xn, di3);
}
}
}
else
{
foreach (FileSystemInfo di1 in di.GetFileSystemInfos(sTmp))
{
LoadChildrenFromFolder(o, xn, di1);
}
}
}
}
catch (DirectoryNotFoundException ex)
{
// Ignore this exception
log.InfoFormat("Directory {0} Template {1} Error {2}",di, sTmp,ex.Message);
}
catch (Exception ex)
{
log.ErrorFormat("Error: {0}\r\n{1}", ex.Message, ex.InnerException);
}
}
}
}
}
private void LoadChildrenFromFolder(vlnObject o,XmlNode xn, FileSystemInfo fi)
{
vlnObject vb = o.Add(LookUpX(o,"@child", xn), "", fi.FullName);
vb.AddProp("filename", fi.Name);
vb.Title = GetTitle(fi.FullName, LookUpX(vb,"@title", xn));
o.Children.Add(vb);
}
protected string GetTitle(string sPath, string sDefault)
{
string sRetval = sDefault;
if (sRetval[0] == '~')
{
string sTitlePath = sPath + "\\title";
if (File.Exists(sTitlePath))
{
StreamReader sr = File.OpenText(sTitlePath);
return sr.ReadToEnd();
}
sRetval = sRetval.Substring(1);
}
return sRetval;
}
protected string LookUpX(vlnObject o, string xPath, XmlNode xn)
{
XmlNode nd = xn;
XmlNode ndf = nd.SelectSingleNode(xPath);
while (ndf == null && nd.ParentNode != null)
{
nd = nd.ParentNode;
ndf = nd.SelectSingleNode(xPath);
}
if (ndf == null) return "";
return o.ProcessString(ndf.InnerText);
}
}
}

View File

@@ -0,0 +1,68 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F9B53DDC-2A2E-4A17-B777-4EC0EE585DE2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>vlnServerLibrary</RootNamespace>
<AssemblyName>vlnServerLibrary</AssemblyName>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\..\veproms\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\veproms\bin\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="vlnObject, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\veproms\bin\vlnObject.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="vlnServer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="vlnControl.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>