private void _lockingStorage_OnRemoveItem(UserIdentity sender, ObjectKey key, LockingInfoWithCommunicationObject value) { if (RemoveItem != null) { RemoveItem(sender, key, value.LockingInfo); } }
public override bool Equals(ObjectKey other) { PresentationKey value = other as PresentationKey; if (value != null && value.GetType() == this.GetType()) { return PresentationName.Equals(value.PresentationName); } return false; }
public virtual string Add(TDto dto) { TEntity entity = this.assembler.Assemble(null, dto); this.repository.Add(entity); ObjectKey key = KeyUtility.Instance.Create(entity); return(KeyUtility.Instance.Convert(key)); }
public async Task Setup() { redisInstance = new RedisInside.Redis(i => i.Port(6666).LogTo(item => Global.Logger.LogDebug(item))); var config = XDocument.Load(Path.Combine(TestContext.CurrentContext.TestDirectory, @"Config\redis.config")).XmlDeserialize <RedisConfiguration>(); config.ServiceName = "IT"; redis = await new ModuleHelper(config).Provider.GetService <IAsyncServiceFactory <IRedisLink> >().GetService(true); redis.Multiplexer.Flush(); key = new ObjectKey("Test", "Key"); }
protected StaticEntityRuntime(ObjectKey espaceKey, ObjectKey entityKey) { int espaceId; using (Transaction trans = DatabaseAccess.ForSystemDatabase.GetReadOnlyTransaction()) { espaceId = DBRuntimePlatform.Instance.GetESpaceIdbyKey(trans, espaceKey); } Init(espaceId, entityKey); }
public static string StaticWrite(DateTime instant, int duration, string source, string endpoint, string action, string type, int espaceId, int tenantId, string errorId, string executedBy, bool isExpose, string requestKey, string eSpaceName, string applicationName, ObjectKey applicationKey) { IntegrationLogDefinition log = new IntegrationLogDefinition(); log.Write(GenerateLogId(), instant, duration, source, endpoint, action, type, espaceId, tenantId, errorId, executedBy, isExpose, requestKey, eSpaceName, applicationName, applicationKey); return(log.Id); }
public TEntity Find(object keyValue) { ObjectKey key = new ObjectKey(typeof(TEntity).FullName, keyValue); TEntity result; this.internalContext.TryGetObjectByKey <TEntity>(key, out result); return(result); }
private SiteProperty(int defId, string name, ObjectKey key, bool isShared, string databaseValue, object value, SitePropertyType runtimeType) { DefId = defId; Name = name; Key = key; IsShared = isShared; this.databaseValue = databaseValue; this.value = value; RuntimeType = runtimeType; }
public async Task SaveSingle(bool isWellKnown) { Redis.PersistencyRegistration.RegisterObjectHashSet <ComplexData>(new FlatProtoDataSerializer(isWellKnown, MemoryStreamInstances.MemoryStream), isWellKnown); var newKey = new ObjectKey("Complex"); await Redis.Client.AddRecord(newKey, data).ConfigureAwait(false); var result = await Redis.Client.GetRecords <ComplexData>(newKey).FirstAsync(); Assert.AreEqual(data.Date, result.Date); }
public static int ProcessLaunch(HeContext heContext, ObjectKey SSKey, ObjectKey espaceSSKey, int parentActivityId, int parentProcessId, List <Pair <string, object> > inputs, out int nextHumanActivity) { List <Pair <int, ActivityKind> > nextActIds; int newProcessId = ProcessLaunch(heContext, SSKey, espaceSSKey, parentActivityId, parentProcessId, inputs, out nextActIds); nextHumanActivity = BuiltInFunction.NullIdentifier(); return(newProcessId); }
public void ConstructArray() { Assert.Throws <ArgumentNullException>(() => new ObjectKey((string[])null)); Assert.Throws <ArgumentException>(() => new ObjectKey()); var key = new ObjectKey(new[] { "Test" }); Assert.AreEqual("object:Test", key.FullKey); key = new ObjectKey("Test", "Any"); Assert.AreEqual("object:Test:Any", key.FullKey); }
public override bool Equals(ObjectKey other) { SlideKey value = other as SlideKey; if (value != null && other.GetType() == this.GetType()) { return PresentationKey.Equals(value.PresentationKey) && Id == value.Id; } return false; }
public async Task SaveKnowLoadUnknown() { Redis.PersistencyRegistration.RegisterObjectHashSet <ComplexData>( new FlatProtoDataSerializer(true, MemoryStreamInstances.MemoryStream), true); var newKey = new ObjectKey("Complex"); await Redis.Client.AddRecord(newKey, data).ConfigureAwait(false); Redis.PersistencyRegistration.RegisterObjectHashSet <Identity>(new FlatProtoDataSerializer(false, MemoryStreamInstances.MemoryStream)); Assert.ThrowsAsync <ArgumentNullException>(async() => await Redis.Client.GetRecords <Identity>(newKey).FirstAsync()); }
private T HandleCurrentEspaceKey <T>(Func <T> action) { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; return(action()); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
public static string StaticWrite(DateTime instant, string sessionId, int espaceId, int tenantId, int userId, string message, string stack, string environmentInformation, string moduleName, string requestKey, string entrypointName, string actionName, string eSpaceName, string applicationName, ObjectKey applicationKey, string username) { ErrorLogDefinition log = new ErrorLogDefinition(instant, sessionId, espaceId, tenantId, userId, message, stack, environmentInformation, moduleName, Environment.MachineName, requestKey, actionName, entrypointName, eSpaceName, applicationName, applicationKey, username); log.Write(); return(log.Id); }
public void webBlck_WebBlockInstance1_onDataBinding(object sender, System.EventArgs e) { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; ssContactManager.Flows.FlowPrivate.WBlkjQueryCurvycorners widget = (ssContactManager.Flows.FlowPrivate.WBlkjQueryCurvycorners)sender; } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
public void wtMainContent_onDataBinding(object sender, System.EventArgs e) { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; wtMainContent_setInlineAttributes(sender, e); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
/// <summary> /// Function to dump expression (Key = W95Nt46AQ0SuP_yusggDIw) Expression: "<SCRIPT /// type=""text/javascript""> <!-- RichWidgets_Container_RoundTops('." + StyleOfContainersToRoundTops /// + "'); --> </SCRIPT> " /// </summary> /// <returns>Returns the value of the Expression</returns> public string expression_InlineExpression10() { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; return(("<SCRIPT type=\"text/javascript\">\r\n<!--\r\nRichWidgets_Container_RoundTops(\'." + inParamStyleOfContainersToRoundTops) + "\');\r\n-->\r\n</SCRIPT>\r\n"); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
public void inputwttxtTableRecordsId_onDataBinding(object sender, System.EventArgs e) { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; inputwttxtTableRecordsId_setInlineAttributes(sender, e); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
/// <summary> /// Gets the mandatory value of component (inputwttxtTableRecordsId) /// </summary> /// <returns>The Mandatory Value of inputwttxtTableRecordsId</returns> public bool inputwttxtTableRecordsId_isMandatory() { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; return(false); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
/// <summary> /// Gets the enabled state of component (wtlnkSort) /// </summary> /// <returns>The Enabled State of wtlnkSort</returns> public bool lnklnkSort_isEnabled() { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; return(true); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
public static string DatabaseValue(ObjectKey key) { if (key == null) { return(string.Empty); } else { return(key.ToString(ObjectKey.DatabaseFormat)); } }
/// <summary> /// Function to dump expression (Key = LaWkymMdbEu3OAUuSCW24A) Expression: "<script /// type='text/javascript'> RichWidgets_List_SortColumn('" + Column + "','" + lnkSort.Id + "',' /// " + SortColumn_OrderBy + "','" + GetPageName() + "', '" + txtTableRecordsId.Id + "'); </script>" /// </summary> /// <returns>Returns the value of the Expression</returns> public string expression_InlineExpression6() { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; return(((((((((("<script type=\'text/javascript\'>\r\n RichWidgets_List_SortColumn(\'" + inParamColumn) + "\',\'") + wtlnkSort.ClientID) + "\',\'") + ((string)Global.App.OsContext.Session["ContactManager.SortColumn_OrderBy"])) + "\',\'") + Functions.rssextensionhttprequesthandler_ActionGetPageName(heContext)) + "\', \'") + this.FindControl("wttxtTableRecordsId").ClientID) + "\');\r\n </script>"); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
public string wtMainContent_setInlineAttributes(object sender, System.EventArgs e) { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; return(""); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
/// <summary> /// Function to dump expression (Key = fhhnj7LL8Ea0rAvn2G82Ug) Expression: /// GetApplicationName(GetOwnerEspaceIdentifier) /// </summary> /// <returns>Returns the value of the Expression</returns> public string expression_InlineExpression18() { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; return(Functions.ActionGetApplicationName(heContext, AppUtils.CurrentEspaceId)); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
public void webBlck_WebBlockInstance3_onDataBinding(object sender, System.EventArgs e) { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; ssContactManager.Flows.FlowRichWidgets.WBlkFeedback_Message widget = (ssContactManager.Flows.FlowRichWidgets.WBlkFeedback_Message)sender; } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
/// <summary> /// Gets the visible state of component (wt_Link21) /// </summary> /// <returns>The Visible State of wt_Link21</returns> public bool lnk_Link21_isVisible() { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; return(true); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
/// <summary> /// Function to dump expression (Key = lODaVZ8bhkuV7g+vNAsqsQ) Expression: "<SCRIPT /// type=""text/javascript""> <!-- " + javascriptVariableName + " ='" + NotifyWidget.RuntimeId + "' /// ; --> </SCRIPT>" /// </summary> /// <returns>Returns the value of the Expression</returns> public string expression_InlineExpression4() { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; return(((("<SCRIPT type=\"text/javascript\">\r\n<!--\r\n" + inParamjavascriptVariableName) + " =\'") + RuntimeID) + "\';\r\n-->\r\n</SCRIPT>"); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
/// <summary> /// Function to dump expression (Key = vlbpl12VY0KA5IIiWBGINw) Expression: /// GetMenuItem(Contacts).MenuItem.Caption /// </summary> /// <returns>Returns the value of the Expression</returns> public string expression_InlineExpression6() { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; return(Functions.ssGetMenuItem(heContext, ENMenuItemEntity.GetRecordByKey(ObjectKey.Parse("bQMfrwAt5UaQWFeNE2K7bg")).ssId).ssENMenuItem.ssCaption); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
/// <summary> /// Function to dump expression (Key = TKnEj3QzFEiAMBnWEnvOYQ) Expression: "" /// </summary> /// <returns>Returns the value of the Expression</returns> public string expression_InlineExpression5() { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; return(""); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
/// <summary> /// Function to dump expression (Key = ZN24+tl5tUavj5ydWqbtHg) Expression: TotalRowCount /// </summary> /// <returns>Returns the value of the Expression</returns> public string expression_InlineExpression21() { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; return(Convert.ToString(inParamTotalRowCount)); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
/// <summary> /// Function to dump expression (Key = BTMmLqMXqE+C2wOQu_x0dQ) Expression: LastRecord /// </summary> /// <returns>Returns the value of the Expression</returns> public string expression_InlineExpression4() { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; return(Convert.ToString(varLcLastRecord)); } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
public void webBlck_WebBlockInstance4_onDataBinding(object sender, System.EventArgs e) { ObjectKey oldCurrentESpaceKey = heContext.CurrentESpaceKey; try { heContext.CurrentESpaceKey = ssContactManager.Global.eSpaceKey; ssContactManager.Flows.FlowCommon.WBlkCommonSidebar widget = (ssContactManager.Flows.FlowCommon.WBlkCommonSidebar)sender; } finally { heContext.CurrentESpaceKey = oldCurrentESpaceKey; } }
public object RemoveObject(ObjectKey key) { if (!poolDic.ContainsKey(key)) { return null; } else { object obj = poolDic[key].Remove(); return obj; } }
public override object Read(BinaryReader reader) { Dictionary<string, ObjectKey> dictionary = new Dictionary<string, ObjectKey>(); reader.ReadByte(); int num = reader.ReadInt32(); for (int i = 0; i < num; i++) { ObjectKey objectKey = new ObjectKey(); objectKey.Read(reader, true); dictionary.Add(objectKey.name, objectKey); } return new ObjectKeyList(dictionary); }
public void AddObject(ObjectKey key, object obj) { if (!poolDic.ContainsKey(key)) { LinkList list = new LinkList(); list.Add(obj); poolDic.Add(key, list); } else { LinkList list = poolDic[key]; list.Add(obj); } }
protected PresentationKey GetPresentationKey(ObjectKey key) { PresentationKey presentationKey = null; if (key is PresentationKey) presentationKey = key as PresentationKey; else if (key is SlideKey) presentationKey = (PresentationKey)((SlideKey)key).PresentationKey; return presentationKey; }
public LockingInfo GetLockInfo(ObjectKey objectKey) { return _lockingStorage.GetLockInfo(objectKey); }
//public IPresentationDAL PresentationDAL{get; set;} #region ILockService Members public bool AcquireLock(ICommunicationObject communicationObject, UserIdentity user, ObjectKey objectKey, RequireLock requireLock) { return _lockingStorage.AcquireLock(communicationObject, user, objectKey, requireLock); }
internal void Init(DataFile file, ObjectKey key) { this.file = file; this.key = key; key.compressionLevel = 0; key.compressionMethod = 0; if (this.cachePosition == -1L) { if (this.buffer_count < 4096) { this.cache = new IdArray<DataKey>(4096); } else { this.cache = new IdArray<DataKey>(this.buffer_count); } this.cacheKey = new ObjectKey(file, "", new DataKeyIdArray(this.cache)); } }
public bool ContainsKey(ObjectKey key) { return poolDic.ContainsKey(key); }
protected abstract void _lockService_AddItem(UserIdentity userIdentity, ObjectKey key, LockingInfo value);
internal DataKey GetKey(DateTime dateTime, DataKey key = null, IndexOption option = IndexOption.Null) { lock (Sync) { if (Count == 0 || dateTime > DateTime2) { Console.WriteLine($"DataSeries::GetKey dateTime is out of range : {dateTime}"); return null; } if (key == null) key = this.readKey; DataKey @class = null; DataKey class2 = null; if (dateTime <= DateTime1) return GetFirstKey(); if (key != null) { if (key.dateTime1 <= dateTime && dateTime <= key.dateTime2) return key; if (dateTime > key.dateTime2) { class2 = key; @class = GetNextKey(class2); } } if (@class == null) @class = GetFirstKey(); while (option == IndexOption.Null || class2 == null || !(dateTime > class2.dateTime2) || !(dateTime < @class.dateTime1)) { if (@class.dateTime1 <= dateTime && dateTime <= @class.dateTime2) { return @class; } class2 = @class; @class = GetNextKey(class2); } if (option == IndexOption.Next) { return @class; } return class2; } }
public void Dump() { lock (Sync) { Console.WriteLine("Data series " + Name); Console.WriteLine("Count = " + Count); Console.WriteLine("Position1 = " + this.position1); Console.WriteLine("Position2 = " + this.position2); Console.WriteLine("DateTime1 = " + DateTime1.Ticks); Console.WriteLine("DateTime2 = " + DateTime2.Ticks); Console.WriteLine("Buffer count = " + this.bufferCount); Console.WriteLine(); Console.WriteLine("Keys in cache:"); Console.WriteLine(); if (this.cache != null) { for (int i = 0; i < this.bufferCount; i++) { if (this.cache[i] != null) { Console.WriteLine(this.cache[i]); } } } Console.WriteLine(); Console.WriteLine("Keys on disk:"); Console.WriteLine(); if (this.position1 != -1) { var key = ReadKey(this.position1); while (true) { Console.WriteLine(key); if (key.next == -1) break; key = ReadKey(key.next); } } Console.WriteLine(); if (this.writeKey != null) Console.WriteLine("Write Key : " + this.changed); else Console.WriteLine("Write Key : null"); Console.WriteLine("\nEnd dump\n"); } }
public virtual LockingInfo[] GetLockingInfo(ObjectKey[] objectKeyArr) { List<LockingInfo> lockingInfoArr = new List<LockingInfo>(objectKeyArr.Length); foreach (ObjectKey objectKey in objectKeyArr) { LockingInfo info = _lockService.GetLockInfo(objectKey); lockingInfoArr.AddNotNull(info); } return lockingInfoArr.ToArray(); }
public ObjectInfo(UserIdentity userIdentity, ObjectKey objectKey) { _objectKey = objectKey; _userIdentity = userIdentity; }
private void Insert(DataObject obj) { Count++; if (this.writeKey.dateTime1 <= obj.DateTime && obj.DateTime <= this.writeKey.dateTime2) { this.writeKey.AddObject(obj); if (this.writeKey.count >= this.writeKey.size) { WriteKey(this.writeKey); this.writeKey = new DataKey(this.file, null, this.writeKey.position, -1L) { number = this.bufferCount, index1 = Count, index2 = Count, changed = true }; this.bufferCount++; this.cache[this.writeKey.number] = this.writeKey; } else { this.changed = true; } this.file.isModified = true; return; } var key = GetKey(obj.DateTime, this.insertKey, IndexOption.Prev); if (this.insertKey == null) { this.insertKey = key; } else if (this.insertKey != key) { if (this.insertKey.changed) WriteKey(this.insertKey); if (!CacheObjects && this.insertKey != this.readKey && this.insertKey != this.writeKey && this.insertKey != this.deleteKey) this.insertKey.objects = null; this.insertKey = key; } this.insertKey.GetObjects(); if (this.insertKey.count < this.insertKey.size) { this.insertKey.AddObject(obj); if (this.insertKey.count == this.insertKey.size) WriteKey(this.insertKey); } else { key = new DataKey(this.file, null, -1L, -1L); int num = this.insertKey.GetIndex(obj.DateTime, SearchOption.Next); if (num == -1) { key.AddObject(obj); } else { for (int i = num; i < this.insertKey.count; i++) { key.AddObject(this.insertKey.objects[i]); this.insertKey.objects[i] = null; } this.insertKey.count = num; this.insertKey.index2 = this.insertKey.index1 + this.insertKey.count - 1; if (this.insertKey.count != 0) this.insertKey.dateTime2 = this.insertKey.objects[this.insertKey.count - 1].DateTime; this.insertKey.AddObject(obj); } InsertKey(key, this.insertKey); } if (this.readKey != null && this.readKey.number > this.insertKey.number) { this.readKey.index1 += 1; this.readKey.index2 += 1; } if (this.writeKey != null && this.writeKey.number > this.insertKey.number) { this.writeKey.index1 += 1; this.writeKey.index2 += 1; } if (this.deleteKey != null && this.deleteKey.number > this.insertKey.number) { this.deleteKey.index1 += 1; this.deleteKey.index2 += 1; } this.insertKey.changed = true; this.changed = true; this.file.isModified = true; }
// TODO: rewrite it! internal DataKey GetKey(long index, DataKey key = null) { lock (Sync) { if (0 <= index && index < Count) { if (key == null) key = this.readKey; DataKey @class = null; if (key != null) { if (key.index1 <= index && index <= key.index2) { return key; } if (index > key.index2) { @class = GetNextKey(key); } } if (@class == null) { @class = GetFirstKey(); } while (index < @class.index1 || index > @class.index2) { @class = GetNextKey(@class); } return @class; } Console.WriteLine($"DataSeries::GetKey Error: index is out of range : {Name} {index}"); return null; } }
private IdArray<DataKey> ReadCache() { this.cacheKey = this.file.ReadKey(this.cachePosition, ObjectKey.EMPTYNAME_KEY_SIZE); var dataKeys = ((DataKeyIdArray)this.cacheKey.GetObject()).Keys; for (int i = 0; i < dataKeys.Size; i++) { var dk = dataKeys[i]; if (dk != null) { dk.file = this.file; dk.number = i; } } return dataKeys; }
private void WriteCache() { if (this.cacheKey == null) this.cacheKey = new ObjectKey(this.file, "", new DataKeyIdArray(this.cache)); this.file.WriteKey(this.cacheKey); this.cachePosition = this.cacheKey.position; }
private void ReadCache() { this.cacheKey = this.file.ReadKey(this.cachePosition, 38); this.cache = ((DataKeyIdArray)this.cacheKey.GetObject()).keys; for (int i = 0; i < this.cache.Size; i++) { if (this.cache[i] != null) { this.cache[i].file = this.file; this.cache[i].number = i; } } }
internal void Init(DataFile file, ObjectKey key) { lock (Sync) { this.file = file; this.key = key; key.CompressionLevel = 0; key.CompressionMethod = 0; // Init dataKey list if (this.cachePosition == -1) { this.cache = new IdArray<DataKey>(Math.Max(4096, this.bufferCount)); this.cacheKey = new ObjectKey(file, "", new DataKeyIdArray(this.cache)); } } }
/// <summary> /// Creates a new object in the cloud with the given key (and key-pool). /// </summary> /// <param name="key">the key-pool and key to use for the new object.</param> /// <param name="acl">Access control list for the new object. May be null to use a default ACL</param> /// <param name="metadata">Metadata for the new object. May be null for no metadata.</param> /// <param name="data">The initial contents of the object. May be appended to later. May be null to create an object with no content or a directory.</param> /// <param name="mimeType">the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.</param> /// <returns>the ObjectId of the newly-created object for references by ID.</returns> public ObjectId CreateObjectFromSegmentWithKey(ObjectKey key, Acl acl, MetadataList metadata, ArraySegment<byte> data, String mimeType) { return CreateObjectFromSegmentWithKey(key, acl, metadata, data, mimeType, null); }
/// <summary> /// Creates a new object in the cloud with the given key (and key-pool). /// </summary> /// <param name="key">the key-pool and key to use for the new object.</param> /// <param name="acl">Access control list for the new object. May be null to use a default ACL</param> /// <param name="metadata">Metadata for the new object. May be null for no metadata.</param> /// <param name="data">The initial contents of the object. May be appended to later. May be null to create an object with no content or a directory.</param> /// <param name="mimeType">the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.</param> /// <param name="checksum">the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.</param> /// <returns>the ObjectId of the newly-created object for references by ID.</returns> public ObjectId CreateObjectFromSegmentWithKey(ObjectKey key, Acl acl, MetadataList metadata, ArraySegment<byte> data, String mimeType, Checksum checksum) { HttpWebResponse resp = null; try { string resource = getResourcePath(context, key); Uri u = buildUrl(resource); HttpWebRequest con = createWebRequest(u); // Build headers Dictionary<string, string> headers = new Dictionary<string, string>(); // Figure out the mimetype if (mimeType == null) { mimeType = "application/octet-stream"; } headers.Add("Content-Type", mimeType); headers.Add("x-emc-uid", uid); headers.Add("x-emc-pool", key.pool); // Process metadata if (metadata != null) { processMetadata(metadata, headers); } // Add acl if (acl != null) { processAcl(acl, headers); } // Add date addDateHeader(headers); // Checksum if required if (checksum != null) { checksum.Update(data); headers.Add("x-emc-wschecksum", checksum.ToString()); } // Sign request signRequest(con, "POST", resource, headers); // post data Stream s = null; try { con.ContentLength = data.Count; con.SendChunked = false; s = con.GetRequestStream(); s.Write(data.Array, data.Offset, data.Count); s.Close(); } catch (IOException e) { s.Close(); throw new EsuException("Error posting data", e); } // Check response resp = (HttpWebResponse)con.GetResponse(); int statInt = (int)resp.StatusCode; if (statInt > 299) { handleError(resp); } // The new object ID is returned in the location response header string location = resp.Headers["location"]; // Parse the value out of the URL MatchCollection m = OBJECTID_EXTRACTOR.Matches(location); if (m.Count > 0) { string id = m[0].Groups[1].Value; log.TraceEvent(TraceEventType.Verbose, 0, "Id: " + id); return new ObjectId(id); } else { throw new EsuException("Could not find ObjectId in " + location); } } catch (UriFormatException e) { throw new EsuException("Invalid URL", e); } catch (IOException e) { throw new EsuException("Error connecting to server", e); } catch (WebException e) { if (e.Response != null) { handleError((HttpWebResponse)e.Response); } else { throw new EsuException("Error executing request: " + e.Message, e); } } finally { if (resp != null) { resp.Close(); } } return null; }
protected internal LockingInfo(UserIdentity user, RequireLock requireLock, ObjectKey objectKey) { _user = user; _requireLock = requireLock; _objectKey = objectKey; }
public void Clear() { lock (Sync) { this.cache = this.cache ?? ReadCache(); if (this.position1 != -1) { var key = ReadKey(this.position1); while (true) { this.file.DeleteKey(key, false, true); if (key.next == -1) break; key = ReadKey(key.next); } } Count = 0; this.bufferCount = 0; DateTime1 = new DateTime(0); DateTime2 = new DateTime(0); this.position1 = -1; this.position2 = -1; this.readOpened = false; this.writeOpened = false; this.cache = new IdArray<DataKey>(4096); this.cacheKey.obj = new DataKeyIdArray(this.cache); this.readKey = null; this.writeKey = null; this.deleteKey = null; this.insertKey = null; this.changed = true; Flush(); } }
//public LockStatus GetLockStatus(ObjectKey objectKey, out UserIdentity owner) //{ // return _lockingStorage.GetLockStatus(objectKey, out owner); //} public bool ReleaseLock(UserIdentity user, ObjectKey objectKey) { return _lockingStorage.ReleaseLock(user, objectKey); }
/// <summary> /// Creates a new object in the cloud with the given key (and key-pool). /// </summary> /// <param name="key">the key-pool and key to use for the new object.</param> /// <param name="acl">Access control list for the new object. May be null to use a default ACL</param> /// <param name="metadata">Metadata for the new object. May be null for no metadata.</param> /// <param name="data">The initial contents of the object. Note that we will read only 'streamLength' bytes from the stream and do not close it</param> /// <param name="streamLength">The number of bytes to read from the stream. Must be <= the actual number of bytes in the stream.</param> /// <param name="mimeType">the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.</param> /// <param name="checksum">the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.</param> /// <returns>the ObjectId of the newly-created object for references by ID.</returns> public ObjectId CreateObjectFromStreamWithKey(ObjectKey key, Acl acl, MetadataList metadata, Stream data, long streamLength, string mimeType, Checksum checksum) { HttpWebResponse resp = null; try { string resource = getResourcePath(context, key); Uri u = buildUrl(resource); HttpWebRequest con = createWebRequest(u); // Build headers Dictionary<string, string> headers = new Dictionary<string, string>(); // Figure out the mimetype if (mimeType == null) { mimeType = "application/octet-stream"; } headers.Add("Content-Type", mimeType); headers.Add("x-emc-uid", uid); headers.Add("x-emc-pool", key.pool); // Process metadata if (metadata != null) { processMetadata(metadata, headers); } // Add acl if (acl != null) { processAcl(acl, headers); } // Add date addDateHeader(headers); // Checksum if required if (checksum != null) { if (!data.CanSeek) { throw new EsuException("Cannot checksum a stream that does not support seeking"); } long current = data.Position; byte[] buffer = new byte[64 * 1024]; for (long i = 0; i < streamLength; i += buffer.Length) { if (i + buffer.Length > streamLength) { int bytesToRead = (int)(streamLength - i); int count = data.Read(buffer, 0, bytesToRead); checksum.Update(new ArraySegment<byte>(buffer, 0, count)); } else { int count = data.Read(buffer, 0, buffer.Length); checksum.Update(new ArraySegment<byte>(buffer, 0, count)); } } data.Seek(current, SeekOrigin.Begin); //Checksum ckcopy = checksum.Clone(); headers.Add("x-emc-wschecksum", checksum.ToString()); } // Sign request signRequest(con, "POST", resource, headers); writeRequestBodyFromStream(con, data, streamLength); // Check response resp = (HttpWebResponse)con.GetResponse(); int statInt = (int)resp.StatusCode; if (statInt > 299) { handleError(resp); } // The new object ID is returned in the location response header string location = resp.Headers["location"]; // Parse the value out of the URL MatchCollection m = OBJECTID_EXTRACTOR.Matches(location); if (m.Count > 0) { string id = m[0].Groups[1].Value; log.TraceEvent(TraceEventType.Verbose, 0, "Id: " + id); return new ObjectId(id); } else { throw new EsuException("Could not find ObjectId in " + location); } } catch (UriFormatException e) { throw new EsuException("Invalid URL", e); } catch (IOException e) { throw new EsuException("Error connecting to server", e); } catch (WebException e) { if (e.Response != null) { handleError((HttpWebResponse)e.Response); } else { throw new EsuException("Error executing request: " + e.Message, e); } } finally { if (resp != null) { resp.Close(); } } return null; }
public LockingInfo[] GetLockingInfo(ObjectKey[] objectKeyArr) { return _presentationClient.Channel.GetLockingInfo(objectKeyArr); }
/// <summary> /// Creates a new object in the cloud with the given key (and key-pool). /// </summary> /// <param name="key">the key-pool and key to use for the new object.</param> /// <param name="acl">Access control list for the new object. May be null to use a default ACL</param> /// <param name="metadata">Metadata for the new object. May be null for no metadata.</param> /// <param name="data">The initial contents of the object. May be appended to later. May be null to create an object with no content or a directory.</param> /// <param name="mimeType">the MIME type of the content. Optional, may be null. If data is non-null and mimeType is null, the MIME type will default to application/octet-stream.</param> /// <param name="checksum">the checksum object to use to compute checksums. If you're doing incremental updates after the create, include the same object in subsequent calls. Can be null to omit checksums.</param> /// <returns>the ObjectId of the newly-created object for references by ID.</returns> public ObjectId CreateObjectWithKey(ObjectKey key, Acl acl, MetadataList metadata, byte[] data, String mimeType, Checksum checksum) { return CreateObjectFromSegmentWithKey(key, acl, metadata, new ArraySegment<byte>(data, 0, data.Length), mimeType, checksum); }