using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Harlinn.Oracle.DBTool.Types.Common;
using Harlinn.Oracle.DBTool.Utils.DB;
using System.Reflection;
using System.ComponentModel;
namespace Harlinn.Oracle.DBTool.Types.Database
{
public class DBUserJavaSource : DBUserObject
{
private static readonly log4net.ILog sfLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static void LogException(Exception exc, System.Reflection.MethodBase method)
{
Logger.LogException(sfLog, exc, method);
}
public DBUserJavaSource()
{
}
public DBUserJavaSource(NodeBase parent, ObjectReader reader)
: base(parent, reader)
{
}
public override DBElementType ElementType
{
get
{
return DBElementType.UserJavaSource;
}
}
public override ObjectType GetObjectType()
{
return ObjectType.JavaSource;
}
}
public class DBUserJavaSources : DBUserObjectCollection<DBUserJavaSource>
{
private static readonly log4net.ILog sfLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static void LogException(Exception exc, System.Reflection.MethodBase method)
{
Logger.LogException(sfLog, exc, method);
}
public DBUserJavaSources()
{
}
public DBUserJavaSources(DBUserObjects parent)
: base(parent, "Java Sources")
{
}
public override DBElementType ElementType
{
get
{
return DBElementType.UserJavaSources;
}
}
public override void Refresh()
{
try
{
base.Refresh();
string userName = Parent.Parent.Name;
ObjectReader reader = ObjectReader.CreateJavaSourceReader(userName);
using (reader)
{
while (reader.Read())
{
DBUserJavaSource element = new DBUserJavaSource(this, reader);
Children.Add(element);
}
}
if (Children.Count > 0)
{
DBUserObjects userObjects = (DBUserObjects)Parent;
if (userObjects.GetChildByName(Name) == null)
{
userObjects.Children.Add(this);
}
}
}
catch (Exception exc)
{
LogException(exc, MethodBase.GetCurrentMethod());
throw;
}
}
}
}