Exemple #1
0
        // This constructor is used by the session to create an object based on a data
        // stream by the agent.
        public QMFObject(Session session, SchemaClass schema, IDecoder dec, bool hasProperties, bool hasStats, bool isManaged)
        {
            Session = session;
            Schema  = schema;
            Managed = isManaged;

            if (Managed)
            {
                // FIXME DateTime or Uint64??
                CurrentTime = new DateTime(dec.ReadDatetime());
                CreateTime  = new DateTime(dec.ReadDatetime());
                DeleteTime  = new DateTime(dec.ReadDatetime());
                ObjectID    = new ObjectID(dec);
            }

            if (hasProperties)
            {
                List <string> excluded = ProcessPresenceMasks(dec, Schema);

                foreach (SchemaProperty prop in Schema.GetAllProperties())
                {
                    if (excluded.Contains(prop.Name))
                    {
                        log.Debug(String.Format("Setting Property Default {0}", prop.Name));
                        safeAddProperty(prop.Name, null);
                    }
                    else
                    {
                        //log.Debug(String.Format("Setting Property {0}", prop.Name)) ;
                        safeAddProperty(prop.Name, session.DecodeValue(dec, prop.Type));
                    }
                }
            }

            if (hasStats)
            {
                foreach (SchemaStatistic stat in Schema.GetAllStatistics())
                {
                    //log.Debug(String.Format("Setting Statistic {0}", stat.Name)) ;
                    Statistics.Add(stat.Name, session.DecodeValue(dec, stat.Type));
                }
            }
        }
Exemple #2
0
		public QMFEvent(Session session, IDecoder dec)
		{
			Session = session ;
			ClassKey = new ClassKey(dec) ;
			Timestamp = dec.ReadInt64() ;
			Severity = (EventSeverity) dec.ReadUint8() ;
			SchemaClass sClass = Session.GetSchema(ClassKey) ;
			Arguments = new Dictionary<string, object>() ;
			
			if (sClass != null) {
				foreach (SchemaArgument arg in sClass.Arguments) {
					Arguments[arg.Name] = Session.DecodeValue(dec, arg.Type) ;	
				}
			}	
		}
Exemple #3
0
        public QMFEvent(Session session, IDecoder dec)
        {
            Session   = session;
            ClassKey  = new ClassKey(dec);
            Timestamp = dec.ReadInt64();
            Severity  = (EventSeverity)dec.ReadUint8();
            SchemaClass sClass = Session.GetSchema(ClassKey);

            Arguments = new Dictionary <string, object>();

            if (sClass != null)
            {
                foreach (SchemaArgument arg in sClass.Arguments)
                {
                    Arguments[arg.Name] = Session.DecodeValue(dec, arg.Type);
                }
            }
        }
Exemple #4
0
 		// This constructor is used by the session to create an object based on a data 
 		// stream by the agent.
		public QMFObject(Session session, SchemaClass schema, IDecoder dec, bool hasProperties, bool hasStats , bool isManaged)
		{
			Session = session ;
			Schema = schema ;
			Managed = isManaged ;
			
			if (Managed) {
			    // FIXME DateTime or Uint64??
				CurrentTime = new DateTime(dec.ReadDatetime()) ;
				CreateTime = new DateTime(dec.ReadDatetime()) ;				
				DeleteTime = new DateTime(dec.ReadDatetime()) ;				
				ObjectID = new ObjectID(dec) ;
			}
			
			if (hasProperties) {
				List<string> excluded = ProcessPresenceMasks(dec, Schema) ;
				
				foreach (SchemaProperty prop in Schema.GetAllProperties()) {
					if (excluded.Contains(prop.Name)) {
					    log.Debug(String.Format("Setting Property Default {0}", prop.Name)) ;					    					
						safeAddProperty(prop.Name, null) ;	
					} else {
						//log.Debug(String.Format("Setting Property {0}", prop.Name)) ;
						safeAddProperty(prop.Name, session.DecodeValue(dec, prop.Type)) ;
					}
				}
			}
			
			if (hasStats) {
				foreach (SchemaStatistic stat in Schema.GetAllStatistics())  {
					//log.Debug(String.Format("Setting Statistic {0}", stat.Name)) ;				
					Statistics.Add(stat.Name, session.DecodeValue(dec, stat.Type)) ;
				}
			}
			
		}