public override NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo CreateCopy
     (System.Collections.Generic.IDictionary <NeoDatis.Odb.OID, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                              > cache, bool onlyData)
 {
     System.Collections.ICollection c = (System.Collections.ICollection)theObject;
     System.Collections.Generic.ICollection <NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                             > newCollection = new NeoDatis.Tool.Wrappers.List.OdbArrayList <NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                                                                                             >();
     // To keep track of non native objects
     NeoDatis.Tool.Wrappers.List.IOdbList <NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                           > nonNatives = new NeoDatis.Tool.Wrappers.List.OdbArrayList <NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                                                        >();
     System.Collections.IEnumerator iterator = c.GetEnumerator();
     while (iterator.MoveNext())
     {
         NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                                                        )iterator.Current;
         // create copy
         aoi = aoi.CreateCopy(cache, onlyData);
         newCollection.Add(aoi);
         if (aoi.IsNonNativeObject())
         {
             nonNatives.Add((NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo)aoi);
         }
     }
     NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo coi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
                                                                         (newCollection, odbType, nonNatives);
     coi.SetRealCollectionClassName(realCollectionClassName);
     return(coi);
 }
		public override NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo CreateCopy
			(System.Collections.Generic.IDictionary<NeoDatis.Odb.OID, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
			> cache, bool onlyData)
		{
			System.Collections.ICollection c = (System.Collections.ICollection)theObject;
			System.Collections.Generic.ICollection<NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
				> newCollection = new NeoDatis.Tool.Wrappers.List.OdbArrayList<NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
				>();
			// To keep track of non native objects
			NeoDatis.Tool.Wrappers.List.IOdbList<NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
				> nonNatives = new NeoDatis.Tool.Wrappers.List.OdbArrayList<NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
				>();
			System.Collections.IEnumerator iterator = c.GetEnumerator();
			while (iterator.MoveNext())
			{
				NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo aoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
					)iterator.Current;
				// create copy
				aoi = aoi.CreateCopy(cache, onlyData);
				newCollection.Add(aoi);
				if (aoi.IsNonNativeObject())
				{
					nonNatives.Add((NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo)aoi);
				}
			}
			NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo coi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
				(newCollection, odbType, nonNatives);
			coi.SetRealCollectionClassName(realCollectionClassName);
			return coi;
		}
예제 #3
0
 /// <summary>An abstract criterion only restrict one field =&gt; it returns a list of one field!
 ///     </summary>
 /// <returns>The list of involved field of the criteria</returns>
 public virtual NeoDatis.Tool.Wrappers.List.IOdbList <string> GetAllInvolvedFields(
     )
 {
     NeoDatis.Tool.Wrappers.List.IOdbList <string> l = new NeoDatis.Tool.Wrappers.List.OdbArrayList
                                                       <string>(1);
     l.Add(attributeName);
     return(l);
 }
		/// <summary>An abstract criterion only restrict one field =&gt; it returns a list of one field!
		/// 	</summary>
		/// <returns>The list of involved field of the criteria</returns>
		public virtual NeoDatis.Tool.Wrappers.List.IOdbList<string> GetAllInvolvedFields(
			)
		{
			NeoDatis.Tool.Wrappers.List.IOdbList<string> l = new NeoDatis.Tool.Wrappers.List.OdbArrayList
				<string>(1);
			l.Add(attributeName);
			return l;
		}
예제 #5
0
        static ODBType()
        {
            // Not used in Java, for .Net compatibility
            // Not used in Java, for .Net compatibility
            //public final static ODBType MAP = new ODBType(false,MAP_ID, "java.util.AbstractMap", 0, AbstractMap.class);
            NeoDatis.Tool.Wrappers.List.IOdbList <ODBType
                                                  > allTypes = new NeoDatis.Tool.Wrappers.List.OdbArrayList <ODBType
                                                                                                             >(100);
            //// DO NOT FORGET DO ADD THE TYPE IN THIS LIST WHEN CREATING A NEW ONE!!!
            allTypes.Add(Null);
            allTypes.Add(NativeBoolean);
            allTypes.Add(NativeByte);
            allTypes.Add(NativeChar);
            allTypes.Add(NativeShort);
            allTypes.Add(NativeInt);
            allTypes.Add(NativeLong);
            allTypes.Add(NativeFloat);
            allTypes.Add(NativeDouble);
            allTypes.Add(Byte);
            allTypes.Add(Short);
            allTypes.Add(Integer);
            allTypes.Add(Long);
            allTypes.Add(Float);
            allTypes.Add(Double);
            allTypes.Add(BigDecimal);
            allTypes.Add(BigInteger);
            allTypes.Add(Character);
            allTypes.Add(Boolean);
            allTypes.Add(Date);
            allTypes.Add(DateSql);
            allTypes.Add(DateTimestamp);
            allTypes.Add(String);
            allTypes.Add(Enum);
            allTypes.Add(Collection);
            allTypes.Add(CollectionGeneric);
            allTypes.Add(Array);
            allTypes.Add(Map);
            allTypes.Add(Oid);
            allTypes.Add(ObjectOid);
            allTypes.Add(ClassOid);
            allTypes.Add(NonNative);
            ODBType type = null;

            for (int i = 0; i < allTypes.Count; i++)
            {
                type = allTypes[i];
                typesByName[type.GetName()] = type;
                typesById[type.GetId()]     = type;
            }
        }
		public virtual void AddInsertTriggerFor(string className, NeoDatis.Odb.Core.Trigger.InsertTrigger
			 trigger)
		{
			if (className == null)
			{
				className = AllClassTrigger;
			}
			NeoDatis.Tool.Wrappers.List.IOdbList<NeoDatis.Odb.Core.Trigger.Trigger> c = listOfInsertTriggers
				[className];
			if (c == null)
			{
				c = new NeoDatis.Tool.Wrappers.List.OdbArrayList<NeoDatis.Odb.Core.Trigger.Trigger
					>();
				listOfInsertTriggers.Add(className, c);
			}
			c.Add(trigger);
		}
 public virtual void AddSelectTriggerFor(string className, NeoDatis.Odb.Core.Trigger.SelectTrigger
                                         trigger)
 {
     if (className == null)
     {
         className = AllClassTrigger;
     }
     NeoDatis.Tool.Wrappers.List.IOdbList <NeoDatis.Odb.Core.Trigger.Trigger> c = listOfSelectTriggers
                                                                                  [className];
     if (c == null)
     {
         c = new NeoDatis.Tool.Wrappers.List.OdbArrayList <NeoDatis.Odb.Core.Trigger.Trigger
                                                           >();
         listOfSelectTriggers.Add(className, c);
     }
     c.Add(trigger);
 }
		private NeoDatis.Odb.Core.Server.Layers.Layer3.Engine.Message ManageAddClassInfoListCommand
			(NeoDatis.Odb.Core.Server.Message.NewClassInfoListMessage message)
		{
			// Gets the base identifier
			string baseIdentifier = message.GetBaseIdentifier();
			NeoDatis.Odb.Core.Server.Connection.ConnectionManager connectionManager = null;
			NeoDatis.Odb.Core.Server.Connection.IConnection connection = null;
			NeoDatis.Tool.Mutex.Mutex mutex = null;
			try
			{
				mutex = NeoDatis.Tool.Mutex.MutexFactory.Get(baseIdentifier).Acquire("addClassInfoList"
					);
				// Gets the connection manager for this base identifier
				connectionManager = GetConnectionManager(baseIdentifier);
				if (connectionManager == null)
				{
					System.Text.StringBuilder buffer = new System.Text.StringBuilder();
					buffer.Append("ODBServer.ConnectionThread:Base ").Append(baseIdentifier).Append(" is not registered on this server!"
						);
					return new NeoDatis.Odb.Core.Server.Message.StoreMessageResponse(baseIdentifier, 
						message.GetConnectionId(), buffer.ToString());
				}
				connection = connectionManager.GetConnection(message.GetConnectionId());
				NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession session = (NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession
					)sessionManager.GetSession(baseIdentifier, true);
				NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = connection.GetStorageEngine
					();
				NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfoList ciList = message.GetClassInfoList
					();
				ciList = engine.GetObjectWriter().AddClasses(ciList);
				// here we must create a new list with all class info because
				// Serialization hold object references
				// In this case, it holds the reference of the previous class info
				// list. Serialization thinks object did not change so it will send the reference
				// instead of the new object. Creating the new list force the
				// serialization
				// mechanism to send object
				NeoDatis.Tool.Wrappers.List.IOdbList<NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
					> allClassInfos = new NeoDatis.Tool.Wrappers.List.OdbArrayList<NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
					>();
				allClassInfos.AddAll(session.GetMetaModel().GetAllClasses());
				NeoDatis.Odb.Core.Server.Message.NewClassInfoListMessageResponse r = new NeoDatis.Odb.Core.Server.Message.NewClassInfoListMessageResponse
					(baseIdentifier, message.GetConnectionId(), allClassInfos);
				session.ResetClassInfoIds();
				return r;
			}
			catch (System.Exception e)
			{
				string se = NeoDatis.Tool.Wrappers.OdbString.ExceptionToString(e, false);
				string msg = baseIdentifier + ":Error while adding new Class Info List" + message
					.GetClassInfoList();
				NeoDatis.Tool.DLogger.Error(msg, e);
				return new NeoDatis.Odb.Core.Server.Message.NewClassInfoListMessageResponse(baseIdentifier
					, message.GetConnectionId(), msg + ":\n" + se);
			}
			finally
			{
				if (mutex != null)
				{
					mutex.Release("addClassInfoList");
				}
			}
		}
예제 #9
0
		static ODBType()
		{
			// Not used in Java, for .Net compatibility
			// Not used in Java, for .Net compatibility
			//public final static ODBType MAP = new ODBType(false,MAP_ID, "java.util.AbstractMap", 0, AbstractMap.class);
			NeoDatis.Tool.Wrappers.List.IOdbList<ODBType
				> allTypes = new NeoDatis.Tool.Wrappers.List.OdbArrayList<ODBType
				>(100);
			//// DO NOT FORGET DO ADD THE TYPE IN THIS LIST WHEN CREATING A NEW ONE!!!
			allTypes.Add(Null);
			allTypes.Add(NativeBoolean);
			allTypes.Add(NativeByte);
			allTypes.Add(NativeChar);
			allTypes.Add(NativeShort);
			allTypes.Add(NativeInt);
			allTypes.Add(NativeLong);
			allTypes.Add(NativeFloat);
			allTypes.Add(NativeDouble);
			allTypes.Add(Byte);
			allTypes.Add(Short);
			allTypes.Add(Integer);
			allTypes.Add(Long);
			allTypes.Add(Float);
			allTypes.Add(Double);
			allTypes.Add(BigDecimal);
			allTypes.Add(BigInteger);
			allTypes.Add(Character);
			allTypes.Add(Boolean);
			allTypes.Add(Date);
			allTypes.Add(DateSql);
			allTypes.Add(DateTimestamp);
			allTypes.Add(String);
			allTypes.Add(Enum);
			allTypes.Add(Collection);
            allTypes.Add(CollectionGeneric);
			allTypes.Add(Array);
			allTypes.Add(Map);
			allTypes.Add(Oid);
			allTypes.Add(ObjectOid);
			allTypes.Add(ClassOid);
			allTypes.Add(NonNative);
			ODBType type = null;
			for (int i = 0; i < allTypes.Count; i++)
			{
				type = allTypes[i];
				typesByName[type.GetName()] = type;
				typesById[type.GetId()] = type;
			}
		}
			> GetListOfUpdateTriggersFor(string className)
		{
			NeoDatis.Tool.Wrappers.List.IOdbList<NeoDatis.Odb.Core.Trigger.Trigger> l1 = listOfUpdateTriggers
				[className];
			NeoDatis.Tool.Wrappers.List.IOdbList<NeoDatis.Odb.Core.Trigger.Trigger> l2 = listOfUpdateTriggers
				[AllClassTrigger];
			if (l2 != null)
			{
				int size = l2.Count;
				if (l1 != null)
				{
					size = size + l1.Count;
				}
				NeoDatis.Tool.Wrappers.List.IOdbList<NeoDatis.Odb.Core.Trigger.Trigger> r = new NeoDatis.Tool.Wrappers.List.OdbArrayList
					<NeoDatis.Odb.Core.Trigger.Trigger>(size);
				if (l1 != null)
				{
					r.AddAll(l1);
				}
				r.AddAll(l2);
				return r;
			}
			return l1;
		}
		/// <summary>Returns the list of involved fields for this query.</summary>
		/// <remarks>
		/// Returns the list of involved fields for this query. List of String
		/// <pre>
		/// If query must return sum("value") and field("name"), involvedField will contain "value","name"
		/// </pre>
		/// </remarks>
		public override NeoDatis.Tool.Wrappers.List.IOdbList<string> GetAllInvolvedFields
			()
		{
			NeoDatis.Tool.Wrappers.List.IOdbList<string> l = new NeoDatis.Tool.Wrappers.List.OdbArrayList
				<string>();
			// To check field duplicity
			System.Collections.Generic.IDictionary<string, string> map = new NeoDatis.Tool.Wrappers.Map.OdbHashMap
				<string, string>();
			l.AddAll(base.GetAllInvolvedFields());
			if (!l.IsEmpty())
			{
				for (int i = 0; i < l.Count; i++)
				{
					map.Add(l[i], l[i]);
				}
			}
			System.Collections.Generic.IEnumerator<NeoDatis.Odb.Core.Query.Execution.IQueryFieldAction
				> iterator = objectActions.GetEnumerator();
			NeoDatis.Odb.Core.Query.Execution.IQueryFieldAction oa = null;
			string name = null;
			while (iterator.MoveNext())
			{
				oa = iterator.Current;
				if (oa.GetType() != typeof(NeoDatis.Odb.Impl.Core.Query.Values.CountAction))
				{
					name = oa.GetAttributeName();
					if (!map.ContainsKey(name))
					{
						l.Add(name);
						map.Add(name, name);
					}
				}
			}
			if (hasGroupBy)
			{
				for (int i = 0; i < groupByFieldList.Length; i++)
				{
					name = groupByFieldList[i];
					if (!map.ContainsKey(name))
					{
						l.Add(name);
						map.Add(name, name);
					}
				}
			}
			if (HasOrderBy())
			{
				for (int i = 0; i < orderByFields.Length; i++)
				{
					name = orderByFields[i];
					if (!map.ContainsKey(name))
					{
						l.Add(name);
						map.Add(name, name);
					}
				}
			}
			map.Clear();
			map = null;
			return l;
		}
                                                      > GetListOfUpdateTriggersFor(string className)
 {
     NeoDatis.Tool.Wrappers.List.IOdbList <NeoDatis.Odb.Core.Trigger.Trigger> l1 = listOfUpdateTriggers
                                                                                   [className];
     NeoDatis.Tool.Wrappers.List.IOdbList <NeoDatis.Odb.Core.Trigger.Trigger> l2 = listOfUpdateTriggers
                                                                                   [AllClassTrigger];
     if (l2 != null)
     {
         int size = l2.Count;
         if (l1 != null)
         {
             size = size + l1.Count;
         }
         NeoDatis.Tool.Wrappers.List.IOdbList <NeoDatis.Odb.Core.Trigger.Trigger> r = new NeoDatis.Tool.Wrappers.List.OdbArrayList
                                                                                      <NeoDatis.Odb.Core.Trigger.Trigger>(size);
         if (l1 != null)
         {
             r.AddAll(l1);
         }
         r.AddAll(l2);
         return(r);
     }
     return(l1);
 }
예제 #13
0
        /// <summary>Returns the list of involved fields for this query.</summary>
        /// <remarks>
        /// Returns the list of involved fields for this query. List of String
        /// <pre>
        /// If query must return sum("value") and field("name"), involvedField will contain "value","name"
        /// </pre>
        /// </remarks>
        public override NeoDatis.Tool.Wrappers.List.IOdbList <string> GetAllInvolvedFields
            ()
        {
            NeoDatis.Tool.Wrappers.List.IOdbList <string> l = new NeoDatis.Tool.Wrappers.List.OdbArrayList
                                                              <string>();
            // To check field duplicity
            System.Collections.Generic.IDictionary <string, string> map = new NeoDatis.Tool.Wrappers.Map.OdbHashMap
                                                                          <string, string>();
            l.AddAll(base.GetAllInvolvedFields());
            if (!l.IsEmpty())
            {
                for (int i = 0; i < l.Count; i++)
                {
                    map.Add(l[i], l[i]);
                }
            }
            System.Collections.Generic.IEnumerator <NeoDatis.Odb.Core.Query.Execution.IQueryFieldAction
                                                    >           iterator = objectActions.GetEnumerator();
            NeoDatis.Odb.Core.Query.Execution.IQueryFieldAction oa       = null;
            string name = null;

            while (iterator.MoveNext())
            {
                oa = iterator.Current;
                if (oa.GetType() != typeof(NeoDatis.Odb.Impl.Core.Query.Values.CountAction))
                {
                    name = oa.GetAttributeName();
                    if (!map.ContainsKey(name))
                    {
                        l.Add(name);
                        map.Add(name, name);
                    }
                }
            }
            if (hasGroupBy)
            {
                for (int i = 0; i < groupByFieldList.Length; i++)
                {
                    name = groupByFieldList[i];
                    if (!map.ContainsKey(name))
                    {
                        l.Add(name);
                        map.Add(name, name);
                    }
                }
            }
            if (HasOrderBy())
            {
                for (int i = 0; i < orderByFields.Length; i++)
                {
                    name = orderByFields[i];
                    if (!map.ContainsKey(name))
                    {
                        l.Add(name);
                        map.Add(name, name);
                    }
                }
            }
            map.Clear();
            map = null;
            return(l);
        }