Ejemplo n.º 1
0
        public LoggingEntity[] FindLoggingEntities([System.Xml.Serialization.XmlElementAttribute(Namespace = "http://www.dis.unina.it/logbus-ng/em")] TemplateQuery query)
        {
            object[] results = this.Invoke("FindLoggingEntities", new object[] {
                query
            });

            return((LoggingEntity[])(results[0]));
        }
Ejemplo n.º 2
0
 /// <remarks/>
 public void FindLoggingEntitiesAsync(TemplateQuery query, object userState)
 {
     if ((this.FindLoggingEntitiesOperationCompleted == null))
     {
         this.FindLoggingEntitiesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnFindLoggingEntitiesOperationCompleted);
     }
     this.InvokeAsync("FindLoggingEntities", new object[] {
         query
     }, this.FindLoggingEntitiesOperationCompleted, userState);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Implements IEntityManagement.FindLoggingEntities
        /// </summary>
        public LoggingEntity[] FindLoggingEntities(TemplateQuery query)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }

            DataRow[] rows;

            if (query == null)
            {
                rows = _entityTable.Select();
            }
            else
            {
                if (!_isHostKey && !string.IsNullOrEmpty(query.host))
                {
                    throw new ArgumentException("Host is not part of entity definition");
                }
                if (!_isProcessKey && !string.IsNullOrEmpty(query.process))
                {
                    throw new ArgumentException("Process is not part of entity definition");
                }
                if (!_isLoggerKey && !string.IsNullOrEmpty(query.logger))
                {
                    throw new ArgumentException("Logger is not part of entity definition");
                }
                if (!_isModuleKey && !string.IsNullOrEmpty(query.module))
                {
                    throw new ArgumentException("Module is not part of entity definition");
                }
                if (!_isClassKey && !string.IsNullOrEmpty(query.@class))
                {
                    throw new ArgumentException("Class is not part of entity definition");
                }
                if (!_isMethodKey && !string.IsNullOrEmpty(query.method))
                {
                    throw new ArgumentException("Method is not part of entity definition");
                }

                List <string> filters = new List <string>(6);
                if (!string.IsNullOrEmpty(query.appName))
                {
                    filters.Add(string.Format("{0} = \"{1}\"", _colAppName.ColumnName, query.appName));
                }
                if (!string.IsNullOrEmpty(query.host))
                {
                    filters.Add(string.Format("{0} = \"{1}\"", _colHost.ColumnName, query.host));
                }
                if (!string.IsNullOrEmpty(query.logger))
                {
                    filters.Add(string.Format("{0} = \"{1}\"", _colLogger.ColumnName, query.logger));
                }
                if (!string.IsNullOrEmpty(query.process))
                {
                    filters.Add(string.Format("{0} = \"{1}\"", _colProc.ColumnName, query.process));
                }
                if (query.ffdaSpecified)
                {
                    filters.Add(string.Format("{0} = {1}", _colFfda.ColumnName, query.ffda));
                }
                int maxinactivity;
                if (!string.IsNullOrEmpty(query.maxinactivity) &&
                    int.TryParse(query.maxinactivity, NumberStyles.Integer, CultureInfo.InvariantCulture,
                                 out maxinactivity))
                {
                    DateTime lastActivity = DateTime.UtcNow.Subtract(TimeSpan.FromSeconds(maxinactivity));
                    filters.Add(string.Format("({0} >= {2} OR {1} >= {2}}", _colLastAction.ColumnName,
                                              _colLastHeartbeat.ColumnName,
                                              lastActivity.ToString(CultureInfo.InvariantCulture)));
                }

                string filter = string.Join(" AND ", filters.ToArray());
                rows = _entityTable.Select(filter);
            }

            LoggingEntity[] ret = new LoggingEntity[rows.Length];

            for (int i = 0; i < rows.Length; i++)
            {
                ret[i] = new LoggingEntity
                {
                    host                   = (_isHostKey) ? (string)rows[i][_colHost] : null,
                    process                = (_isProcessKey) ? (string)rows[i][_colProc] : null,
                    logger                 = (_isLoggerKey) ? (string)rows[i][_colLogger] : null,
                    module                 = (_isModuleKey) ? (string)rows[i][_colModule] : null,
                    @class                 = (_isClassKey) ? (string)rows[i][_colClass] : null,
                    method                 = (_isMethodKey) ? (string)rows[i][_colMethod] : null,
                    appName                = (string)rows[i][_colAppName],
                    ffda                   = (bool)rows[i][_colFfda],
                    lastAction             = (DateTime)rows[i][_colLastAction],
                    lastHeartbeatSpecified = !(rows[i][_colLastHeartbeat] is DBNull),
                    lastHeartbeat          =
                        (rows[i][_colLastHeartbeat] is DBNull)
                                         ? default(DateTime)
                                         : (DateTime)rows[i][_colLastHeartbeat],
                    channelId     = (rows[i][_colChannelId] is DBNull) ? null : (string)rows[i][_colChannelId],
                    ffdaChannelId =
                        (rows[i][_colFfdaChannelId] is DBNull) ? null : (string)rows[i][_colFfdaChannelId]
                };
            }

            return(ret);
        }
 /// <summary>
 /// Implements IEntityManagement.FindLoggingEntities
 /// </summary>
 public LoggingEntity[] FindLoggingEntities(TemplateQuery query)
 {
     return(_proxy.FindLoggingEntities(query));
 }
Ejemplo n.º 5
0
 /// <remarks/>
 public void FindLoggingEntitiesAsync(TemplateQuery query)
 {
     this.FindLoggingEntitiesAsync(query, null);
 }