예제 #1
0
 private void EngineAction(EngineRequest request, EngineActionType actionType, bool willSendProgress)
 {
     if (willSendProgress)
         WriteLine("GetUser.EngineAction - Type: " + actionType.ToString() + " Expecting Progress Reports.");
     else
         WriteLine("GetUser.EngineAction - Type: " + actionType.ToString() + " NOT Expecting Progress Reports.");
 }
예제 #2
0
        public override void Test()
        {
            OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
            request.Engine              = _engine;
            request.Database            = _db;
            request.OnActionChanged    += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress         += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete         += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout          += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError            += new EngineBase.ErrorDelegate(Error);
            request.AuthToken           = _window.Session.AuthToken;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;

            Clear();

            WriteLine("Starting ModifyGlobalPermissions test...");

            OpenDMS.Storage.Security.UsageRight ur1 = new OpenDMS.Storage.Security.UsageRight(new OpenDMS.Storage.Security.Group("administrators"), OpenDMS.Storage.Security.Authorization.GlobalPermissionType.All);
            OpenDMS.Storage.Security.UsageRight ur2 = new OpenDMS.Storage.Security.UsageRight(new OpenDMS.Storage.Security.Group("users"), OpenDMS.Storage.Security.Authorization.GlobalPermissionType.All);
            System.Collections.Generic.List <OpenDMS.Storage.Security.UsageRight> list = new System.Collections.Generic.List <OpenDMS.Storage.Security.UsageRight>();
            list.Add(ur1);
            list.Add(ur2);

            _start = DateTime.Now;

            _engine.ModifyGlobalPermissions(request, list);
        }
예제 #3
0
        private void Complete(EngineRequest request, ICommandReply reply, object result)
        {
            DateTime stop = DateTime.Now;
            TimeSpan duration = stop - _start;

            WriteLine("SearchTest.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");
        }
예제 #4
0
        public override void Test()
        {
            OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
            request.Engine              = _engine;
            request.Database            = _db;
            request.OnActionChanged    += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress         += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete         += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout          += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError            += new EngineBase.ErrorDelegate(Error);
            request.AuthToken           = _window.Session.AuthToken;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;

            Clear();

            Search.Query        query = new Search.Query();
            Search.Tokens.Field tags  = new Search.Tokens.Field("tags");
            tags.Tokens.Add(new Search.Tokens.Term("tag1"));
            query.Add(tags);
            Search.Tokens.Field content = new Search.Tokens.Field("attachment");
            content.Tokens.Add(new Search.Tokens.Term("content"));
            query.Add(content);


            WriteLine("Starting SearchTest test...");
            _start = DateTime.Now;
            _engine.Search(request, new SearchArgs(query));
        }
        public override void Test()
        {
            OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
            request.Engine = _engine;
            request.Database = _db;
            request.OnActionChanged += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError += new EngineBase.ErrorDelegate(Error);
            request.AuthToken = _window.Session.AuthToken;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;

            Clear();

            WriteLine("Starting ModifyResourceUsageRightsTemplate test...");

            OpenDMS.Storage.Security.UsageRight ur1 = new OpenDMS.Storage.Security.UsageRight(new OpenDMS.Storage.Security.Group("administrators"), OpenDMS.Storage.Security.Authorization.ResourcePermissionType.All);
            OpenDMS.Storage.Security.UsageRight ur2 = new OpenDMS.Storage.Security.UsageRight(new OpenDMS.Storage.Security.Group("users"),
                OpenDMS.Storage.Security.Authorization.ResourcePermissionType.Checkout |
                OpenDMS.Storage.Security.Authorization.ResourcePermissionType.ReadOnly);
            System.Collections.Generic.List<OpenDMS.Storage.Security.UsageRight> list = new System.Collections.Generic.List<OpenDMS.Storage.Security.UsageRight>();
            list.Add(ur1);
            list.Add(ur2);

            _start = DateTime.Now;

            _engine.ModifyResourceUsageRightsTemplate(request, list);
        }
예제 #6
0
        public override void Test()
        {
            OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
            request.Engine = _engine;
            request.Database = _db;
            request.OnActionChanged += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError += new EngineBase.ErrorDelegate(Error);
            request.AuthToken = _window.Session.AuthToken;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;

            Clear();

            Search.Query query = new Search.Query();
            Search.Tokens.Field tags = new Search.Tokens.Field("tags");
            tags.Tokens.Add(new Search.Tokens.Term("tag1"));
            query.Add(tags);
            Search.Tokens.Field content = new Search.Tokens.Field("attachment");
            content.Tokens.Add(new Search.Tokens.Term("content"));
            query.Add(content);

            WriteLine("Starting SearchTest test...");
            _start = DateTime.Now;
            _engine.Search(request, new SearchArgs(query));
        }
 private void EngineAction(EngineRequest request, EngineActionType actionType, bool willSendProgress)
 {
     if (willSendProgress)
         WriteLine("ModifyResourceUsageRightsTemplate.EngineAction - Type: " + actionType.ToString() + " Expecting Progress Reports.");
     else
         WriteLine("ModifyResourceUsageRightsTemplate.EngineAction - Type: " + actionType.ToString() + " NOT Expecting Progress Reports.");
 }
        private void Complete(EngineRequest request, ICommandReply reply, object result)
        {
            DateTime stop = DateTime.Now;
            TimeSpan duration = stop - _start;

            Tuple<Resource, OpenDMS.Storage.Data.Version> r = (Tuple<Resource, OpenDMS.Storage.Data.Version>)result;
            WriteLine("CreateNewResource.Complete - Resource: " + r.Item1.ResourceId.ToString() + " and Version: " + r.Item2.VersionId.ToString() + " successfully created in " + duration.TotalMilliseconds.ToString() + "ms.");
        }
        private void Complete(EngineRequest request, ICommandReply reply, object result)
        {
            DateTime stop = DateTime.Now;
            TimeSpan duration = stop - _start;

            GlobalUsageRights gur = (GlobalUsageRights)result;

            WriteLine("GetGlobalPermissions.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");
        }
        private void Complete(EngineRequest request, ICommandReply reply, object result)
        {
            DateTime stop = DateTime.Now;
            TimeSpan duration = stop - _start;

            ResourceUsageRightsTemplate template = (ResourceUsageRightsTemplate)result;

            WriteLine("ModifyResourceUsageRightsTemplate.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");
        }
예제 #11
0
        private void Complete(EngineRequest request, ICommandReply reply, object result)
        {
            DateTime stop = DateTime.Now;
            TimeSpan duration = stop - _start;
            Tuple<OpenDMS.Storage.Data.Resource, OpenDMS.Storage.Data.Version> res =
                (Tuple<OpenDMS.Storage.Data.Resource, OpenDMS.Storage.Data.Version>)result;

            WriteLine("ModifyVersion.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");

            WriteLine("\tId: " + res.Item2.VersionId.ToString());
        }
예제 #12
0
        private void Complete(EngineRequest request, ICommandReply reply, object result)
        {
            DateTime stop = DateTime.Now;
            TimeSpan duration = stop - _start;
            List<OpenDMS.Storage.Providers.CouchDB.Commands.PostBulkDocumentsReply.Entry> results = (List<OpenDMS.Storage.Providers.CouchDB.Commands.PostBulkDocumentsReply.Entry>)result;

            WriteLine("DeleteResource.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");

            for(int i=0; i<results.Count; i++)
                WriteLine("\tId: " + results[i].Id.ToString());
        }
예제 #13
0
        public override void Test()
        {
            OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
            request.Engine = _engine;
            request.Database = _db;
            request.OnActionChanged += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError += new EngineBase.ErrorDelegate(Error);
            request.AuthToken = _window.Session.AuthToken;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;

            Clear();

            OpenDMS.Storage.Providers.CreateResourceArgs resourceArgs = new CreateResourceArgs()
            {
                VersionArgs = new CreateVersionArgs()
            };

            resourceArgs.Metadata = new OpenDMS.Storage.Data.Metadata();
            resourceArgs.Tags = new List<string>();
            resourceArgs.Tags.Add("Tag1");
            resourceArgs.Tags.Add("Tag2");
            resourceArgs.Title = "Test resource";
            resourceArgs.VersionArgs.Extension = "txt";
            resourceArgs.VersionArgs.Metadata = new OpenDMS.Storage.Data.Metadata();

            System.IO.FileStream fs = new System.IO.FileStream("testdoc.txt", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None, 8192, System.IO.FileOptions.None);
            byte[] bytes = System.Text.Encoding.ASCII.GetBytes("This is a test content file.");
            fs.Write(bytes, 0, bytes.Length);
            fs.Flush();
            fs.Close();
            fs.Dispose();

            fs = new System.IO.FileStream("testdoc.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.None, 8192, System.IO.FileOptions.None);
            System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();
            byte[] data = md5.ComputeHash(fs);
            string output = "";
            fs.Close();
            md5.Dispose();
            fs.Dispose();

            for (int i = 0; i < data.Length; i++)
                output += data[i].ToString("x2");

            resourceArgs.VersionArgs.Md5 = output;
            resourceArgs.VersionArgs.Content = new OpenDMS.Storage.Data.Content(bytes.Length, new OpenDMS.Storage.Data.ContentType("text/plain"), "testdoc.txt");

            WriteLine("Starting CreateNewResource test...");
            _start = DateTime.Now;

            _engine.CreateNewResource(request, resourceArgs);
        }
예제 #14
0
        private void Complete(EngineRequest request, ICommandReply reply, object result)
        {
            DateTime stop = DateTime.Now;
            TimeSpan duration = stop - _start;

            OpenDMS.Storage.Providers.CouchDB.Commands.PutDocumentReply r = (OpenDMS.Storage.Providers.CouchDB.Commands.PutDocumentReply)reply;

            if (r.Ok)
                WriteLine("ModifyGroup.Complete - success in " + duration.TotalMilliseconds.ToString() + "ms.");
            else
                WriteLine("ModifyGroup.Complete - failed in " + duration.TotalMilliseconds.ToString() + "ms.");
        }
예제 #15
0
        private void Complete(EngineRequest request, ICommandReply reply, object result)
        {
            DateTime stop = DateTime.Now;
            TimeSpan duration = stop - _start;
            Tuple<OpenDMS.Storage.Data.Version, Newtonsoft.Json.Linq.JObject> res =
                (Tuple<OpenDMS.Storage.Data.Version, Newtonsoft.Json.Linq.JObject>)result;

            OpenDMS.Storage.Providers.CouchDB.Commands.GetDocumentReply r = (OpenDMS.Storage.Providers.CouchDB.Commands.GetDocumentReply)reply;

            WriteLine("CheckoutVersion.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");

            WriteLine("\tId: " + res.Item1.VersionId.ToString());
        }
예제 #16
0
        void win_OnLoginClick(string username, string password)
        {
            System.Security.Cryptography.SHA512Managed sha512 = new System.Security.Cryptography.SHA512Managed();
            byte[] bytes = System.Text.Encoding.UTF8.GetBytes(password);
            string encPassword = System.Convert.ToBase64String(sha512.ComputeHash(bytes));

            EngineRequest request = new EngineRequest();
            request.Engine = _engine;
            request.Database = _db;
            request.OnComplete = new EngineBase.CompletionDelegate(OnAuthenticated);
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;

            _engine.AuthenticateUser(request, username, encPassword);
        }
예제 #17
0
        private void Complete(EngineRequest request, ICommandReply reply, object result)
        {
            OpenDMS.Storage.Providers.CouchDB.Commands.GetViewReply r = (OpenDMS.Storage.Providers.CouchDB.Commands.GetViewReply)reply;

            OpenDMS.Storage.Providers.CouchDB.Transitions.GroupCollection gc = new OpenDMS.Storage.Providers.CouchDB.Transitions.GroupCollection();
            List<OpenDMS.Storage.Security.Group> groups = gc.Transition(r.View);

            for (int i = 0; i < groups.Count; i++)
            {
                comboBox1.Invoke(new MethodInvoker(delegate { comboBox1.Items.Add(groups[i]); }));
            }

            comboBox1.Invoke(new MethodInvoker(delegate { panel1.Visible = false; }));
        }
예제 #18
0
        void win_OnGoClick(string id)
        {
            OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
            request.Engine              = _engine;
            request.Database            = _db;
            request.OnActionChanged    += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress         += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete         += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout          += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError            += new EngineBase.ErrorDelegate(Error);
            request.AuthToken           = _window.Session.AuthToken;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;

            Clear();

            System.IO.FileStream fs = new System.IO.FileStream("testdoc.txt", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None, 8192, System.IO.FileOptions.None);
            byte[] bytes            = System.Text.Encoding.ASCII.GetBytes("This is a test content file.");
            fs.Write(bytes, 0, bytes.Length);
            fs.Flush();
            fs.Close();
            fs.Dispose();

            fs = new System.IO.FileStream("testdoc.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.None, 8192, System.IO.FileOptions.None);
            System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();
            byte[] data   = md5.ComputeHash(fs);
            string output = "";

            fs.Close();
            md5.Dispose();
            fs.Dispose();

            for (int i = 0; i < data.Length; i++)
            {
                output += data[i].ToString("x2");
            }

            OpenDMS.Storage.Providers.CreateVersionArgs versionArgs = new CreateVersionArgs()
            {
                VersionId = new VersionId(new ResourceId(id)),
                Extension = "txt",
                Metadata  = new Metadata(),
                Content   = new OpenDMS.Storage.Data.Content(bytes.Length, new OpenDMS.Storage.Data.ContentType("text/plain"), "testdoc.txt"),
                Md5       = output
            };

            WriteLine("Starting CreateNewVersion test...");
            _start = DateTime.Now;

            _engine.CreateNewVersion(request, versionArgs);
        }
예제 #19
0
        private void Complete(EngineRequest request, ICommandReply reply, object result)
        {
            DateTime stop = DateTime.Now;
            TimeSpan duration = stop - _start;

            OpenDMS.Storage.Providers.CouchDB.Commands.GetDocumentReply r = (OpenDMS.Storage.Providers.CouchDB.Commands.GetDocumentReply)reply;

            OpenDMS.Storage.Providers.CouchDB.Transitions.User txUser = new OpenDMS.Storage.Providers.CouchDB.Transitions.User();
            OpenDMS.Storage.Security.User user = txUser.Transition(r.Document);

            WriteLine("GetUser.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");

            WriteLine("\tId: " + user.Id + ", Name: " + user.Username);
        }
        private void Complete(EngineRequest request, ICommandReply reply, object result)
        {
            DateTime stop = DateTime.Now;
            TimeSpan duration = stop - _start;
            Newtonsoft.Json.Linq.JObject remainder;

            OpenDMS.Storage.Providers.CouchDB.Commands.GetDocumentReply r = (OpenDMS.Storage.Providers.CouchDB.Commands.GetDocumentReply)reply;

            OpenDMS.Storage.Providers.CouchDB.Transitions.Resource txResource = new OpenDMS.Storage.Providers.CouchDB.Transitions.Resource();
            OpenDMS.Storage.Data.Resource resource = txResource.Transition(r.Document, out remainder);

            WriteLine("GetResourceReadOnly.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");

            WriteLine("\tId: " + resource.ResourceId.ToString());
        }
예제 #21
0
        private void OnAuthenticated(EngineRequest request, ICommandReply reply, object result)
        {
            DateTime stop = DateTime.Now;
            TimeSpan duration = stop - _start;

            Tuple<OpenDMS.Storage.Security.Session, bool> r = (Tuple<OpenDMS.Storage.Security.Session, bool>)result;

            if (!r.Item2)
            {
                WriteLine("Authenticate - The user failed authentication in " + duration.TotalMilliseconds.ToString() + "ms.");
                return;
            }

            WriteLine("Authenticate - the user passed authentication and has been assigned the authentication token: " + r.Item1.AuthToken.ToString());
            OnAuthenticationSuccess(r.Item1);
        }
예제 #22
0
        private void Complete(EngineRequest request, ICommandReply reply, object result)
        {
            DateTime stop = DateTime.Now;
            TimeSpan duration = stop - _start;

            OpenDMS.Storage.Providers.CouchDB.Commands.GetViewReply r = (OpenDMS.Storage.Providers.CouchDB.Commands.GetViewReply)reply;

            WriteLine("GetAllUsers.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");

            OpenDMS.Storage.Providers.CouchDB.Transitions.UserCollection uc = new OpenDMS.Storage.Providers.CouchDB.Transitions.UserCollection();
            List<OpenDMS.Storage.Security.User> users = uc.Transition(r.View);

            WriteLine("The following groups were loaded:");
            for (int i=0; i<users.Count; i++)
            {
                WriteLine("\t" + users[i].Username);
            }
        }
예제 #23
0
        void win_OnGoClick(string id)
        {
            OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
            request.Engine                 = _engine;
            request.Database               = _db;
            request.OnActionChanged       += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress            += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete            += new EngineBase.CompletionDelegate(Checkout_Complete);
            request.OnTimeout             += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError               += new EngineBase.ErrorDelegate(Error);
            request.OnAuthorizationDenied += new EngineBase.AuthorizationDelegate(AuthorizationDenied);
            request.AuthToken              = _window.Session.AuthToken;
            request.RequestingPartyType    = OpenDMS.Storage.Security.RequestingPartyType.User;

            Clear();

            WriteLine("Downloading the resource for modification...");
            _engine.CheckoutResource(request, new OpenDMS.Storage.Data.ResourceId(id));
        }
예제 #24
0
        void win_OnGoClick(string username)
        {
            OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
            request.Engine = _engine;
            request.Database = _db;
            request.OnActionChanged += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError += new EngineBase.ErrorDelegate(Error);
            request.AuthToken = _window.Session.AuthToken;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;

            Clear();

            WriteLine("Starting GetUser test...");
            _start = DateTime.Now;
            _engine.GetUser(request, username);
        }
예제 #25
0
        void win_OnSaveClick(OpenDMS.Storage.Security.Group group)
        {
            OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
            request.Engine              = _engine;
            request.Database            = _db;
            request.OnActionChanged    += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress         += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete         += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout          += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError            += new EngineBase.ErrorDelegate(Error);
            request.AuthToken           = _window.Session.AuthToken;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;

            Clear();

            WriteLine("Starting ModifyGroup test...");
            _start = DateTime.Now;
            _engine.ModifyGroup(request, group);
        }
예제 #26
0
        public override void Test()
        {
            OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
            request.Engine              = _engine;
            request.Database            = _db;
            request.OnActionChanged    += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress         += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete         += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout          += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError            += new EngineBase.ErrorDelegate(Error);
            request.AuthToken           = _window.Session.AuthToken;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;

            Clear();

            WriteLine("Starting GetAllUsers test...");
            _start = DateTime.Now;
            _engine.GetAllUsers(request);
        }
예제 #27
0
        void win_OnGoClick(string id)
        {
            OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
            request.Engine              = _engine;
            request.Database            = _db;
            request.OnActionChanged    += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress         += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete         += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout          += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError            += new EngineBase.ErrorDelegate(Error);
            request.AuthToken           = _window.Session.AuthToken;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;

            Clear();

            WriteLine("Starting CheckoutCurrentVersion test...");
            _start = DateTime.Now;
            _engine.CheckoutCurrentVersion(request, new OpenDMS.Storage.Data.ResourceId(id));
        }
예제 #28
0
        public override void Test()
        {
            EngineRequest request = new EngineRequest();

            request.Engine = _engine;
            request.Database = _db;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.System;
            request.OnActionChanged += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError += new EngineBase.ErrorDelegate(Error);

            Clear();

            WriteLine("Starting installation test...");
            _start = DateTime.Now;
            _engine.Install(request, @"C:\Users\Lucas\Documents\Visual Studio 2010\Projects\Test\bin\Debug\");
        }
예제 #29
0
        public override void Test()
        {
            EngineRequest request = new EngineRequest();

            request.Engine = _engine;
            request.Database = _db;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.System;

            Clear();

            WriteLine("Starting initialization test...");
            _start = DateTime.Now;

            List<OpenDMS.Storage.Providers.IDatabase> databases = new List<OpenDMS.Storage.Providers.IDatabase>();
            databases.Add(_db);
            _engine.Initialize(@"C:\Users\Lucas\Documents\Visual Studio 2010\Projects\Test\bin\Debug\Transactions\",
                @"C:\Users\Lucas\Documents\Visual Studio 2010\Projects\Test\bin\Debug\",
                databases, Engine_OnInitialized);
        }
        public override void Test()
        {
            OpenDMS.Storage.Providers.EngineRequest request = new OpenDMS.Storage.Providers.EngineRequest();
            request.Engine = _engine;
            request.Database = _db;
            request.OnActionChanged += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError += new EngineBase.ErrorDelegate(Error);
            request.AuthToken = _window.Session.AuthToken;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;

            Clear();

            WriteLine("Starting GetResourceUsageRightsTemplate test...");
            _start = DateTime.Now;
            _engine.GetResourceUsageRightsTemplate(request);
        }
예제 #31
0
        void Checkout_Complete(EngineRequest request, ICommandReply reply, object result)
        {
            Tuple<OpenDMS.Storage.Data.Resource, Newtonsoft.Json.Linq.JObject> r = (Tuple<OpenDMS.Storage.Data.Resource, Newtonsoft.Json.Linq.JObject>)result;

            request = new OpenDMS.Storage.Providers.EngineRequest();
            request.Engine = _engine;
            request.Database = _db;
            request.OnActionChanged += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError += new EngineBase.ErrorDelegate(Error);
            request.OnAuthorizationDenied += new EngineBase.AuthorizationDelegate(AuthorizationDenied);
            request.AuthToken = _window.Session.AuthToken;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.User;

            _start = DateTime.Now;
            WriteLine("Modifying the resource...");
            r.Item1.Metadata.Add("$modified", DateTime.Now);
            _engine.ModifyResource(request, r.Item1);
        }
예제 #32
0
        void Checkout_Complete(EngineRequest request, ICommandReply reply, object result)
        {
            Tuple <OpenDMS.Storage.Data.Resource, Newtonsoft.Json.Linq.JObject> r = (Tuple <OpenDMS.Storage.Data.Resource, Newtonsoft.Json.Linq.JObject>)result;

            request                        = new OpenDMS.Storage.Providers.EngineRequest();
            request.Engine                 = _engine;
            request.Database               = _db;
            request.OnActionChanged       += new EngineBase.ActionDelegate(EngineAction);
            request.OnProgress            += new EngineBase.ProgressDelegate(Progress);
            request.OnComplete            += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout             += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError               += new EngineBase.ErrorDelegate(Error);
            request.OnAuthorizationDenied += new EngineBase.AuthorizationDelegate(AuthorizationDenied);
            request.AuthToken              = _window.Session.AuthToken;
            request.RequestingPartyType    = OpenDMS.Storage.Security.RequestingPartyType.User;

            _start = DateTime.Now;
            WriteLine("Modifying the resource...");
            r.Item1.Metadata.Add("$modified", DateTime.Now);
            _engine.ModifyResource(request, r.Item1);
        }
예제 #33
0
        private void Complete(EngineRequest request, ICommandReply reply, object result)
        {
            DateTime stop = DateTime.Now;
            TimeSpan duration = stop - _start;
            int successQty = 0;

            OpenDMS.Storage.Providers.CouchDB.Commands.PostBulkDocumentsReply r = (OpenDMS.Storage.Providers.CouchDB.Commands.PostBulkDocumentsReply)reply;

            WriteLine("Install.Complete - results received in " + duration.TotalMilliseconds.ToString() + "ms.");

            for (int i = 0; i < r.Results.Count; i++)
            {
                if (r.Results[i].Error != null)
                    WriteLine("\t" + r.Results[i].Id + " : " + r.Results[i].Error);
                else
                {
                    successQty++;
                    WriteLine("\t" + r.Results[i].Id + " : success.");
                }
            }

            if (successQty == r.Results.Count)
                OnInstallSuccess();
        }
예제 #34
0
 public virtual void GetResourceUsageRightsTemplate(EngineRequest request)
 {
     throw new NotImplementedException();
 }
예제 #35
0
 public virtual void GetUser(EngineRequest request, string username)
 {
     throw new NotImplementedException();
 }
예제 #36
0
 public virtual void Install(EngineRequest request, string logDirectory)
 {
     throw new NotImplementedException();
 }
예제 #37
0
 public virtual void CreateNewResource(EngineRequest request, CreateResourceArgs args)
 {
     throw new NotImplementedException();
 }
예제 #38
0
 public virtual void Search(EngineRequest request, SearchArgs args)
 {
     throw new NotImplementedException();
 }
예제 #39
0
 public virtual void GetGlobalPermissions(EngineRequest request)
 {
     throw new NotImplementedException();
 }
예제 #40
0
 public virtual void CreateGroup(EngineRequest request, Security.Group group)
 {
     throw new NotImplementedException();
 }
예제 #41
0
        private void FrmModifyUser_Load(object sender, EventArgs e)
        {
            panel1.Visible = true;

            EngineRequest request = new EngineRequest();
            request.Engine = _engine;
            request.Database = _db;
            request.OnComplete += new EngineBase.CompletionDelegate(Complete);
            request.OnTimeout += new EngineBase.TimeoutDelegate(Timeout);
            request.OnError += new EngineBase.ErrorDelegate(Error);
            request.AuthToken = _session.AuthToken;
            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.System;

            _engine.GetAllUsers(request);
        }
예제 #42
0
 public virtual void CheckoutVersion(EngineRequest request, Data.VersionId version)
 {
     throw new NotImplementedException();
 }
예제 #43
0
 private void Progress(EngineRequest request, OpenDMS.Networking.Http.DirectionType direction, int packetSize, decimal sendPercentComplete, decimal receivePercentComplete)
 {
     WriteLine("GetUser.Progress - Sent: " + sendPercentComplete.ToString() + " Received: " + receivePercentComplete.ToString());
 }
예제 #44
0
 public virtual void CheckoutResource(EngineRequest request, Data.ResourceId resource)
 {
     throw new NotImplementedException();
 }
        public void Init()
        {
            DateTime start = DateTime.Now; // we must set the value here and then reset it below directly before calling, else Visual Studio throws a fit for using an unassigned variable

            Providers.EngineRequest request;

            if (_isInitialized)
            {
                throw new InvalidOperationException("Already initialized.");
            }
            else if (_isInitializing)
            {
                throw new InvalidOperationException("Already initializing.");
            }

            _isInitializing = true;

            request                     = new Providers.EngineRequest();
            request.Engine              = _engine;
            request.Database            = _db;
            request.RequestingPartyType = Storage.Security.RequestingPartyType.System;

            request.OnComplete = delegate(Providers.EngineRequest request2, Providers.ICommandReply reply, object result)
            {
                TimeSpan duration = DateTime.Now - start;

                if (!(bool)result)
                {
                    Logger.Storage.Error("OpenDMS.Net is not installed on the database.  Please run installation.  Determined in " + duration.TotalMilliseconds.ToString() + "ms.");
                    _isInstalled = false;
                    return;
                }
                else
                {
                    Logger.Storage.Debug("OpenDMS.Net has detected an installation at " + _db.Uri + " and is now ready to use this installation.  Determined in " + duration.TotalMilliseconds.ToString() + "ms.");
                    _isInstalled = true;
                    InitializeStorage();
                }
            };

            request.OnError += delegate(Providers.EngineRequest request2, string message, Exception exception)
            {
                TimeSpan duration = DateTime.Now - start;

                _isInstalled    = false;
                _isInitialized  = false;
                _isInitializing = false;

                Logger.Storage.Error("An error occurred while trying to determine if OpenDMS.Net has been installed on the database.  This is not conclusive as to if OpenDMS.Net is properly installed.  " +
                                     "We recommend restarting OpenDMS.Net.  Determined in " + duration.TotalMilliseconds.ToString() + "ms.  Error message: " + message, exception);
            };

            // There is no 'progress' to update.
            //request.OnProgress += new Providers.EngineBase.ProgressDelegate(IsInstalled_OnProgress);

            request.OnTimeout += delegate(Providers.EngineRequest request2)
            {
                TimeSpan duration = DateTime.Now - start;

                _isInstalled    = false;
                _isInitialized  = false;
                _isInitializing = false;

                Logger.Storage.Error("A timeout occurred while trying to determine if OpenDMS.Net has been installed on the database.  This is not conclusive as to if OpenDMS.Net is properly installed.  " +
                                     "We recommend restarting OpenDMS.Net.  Determined in " + duration.TotalMilliseconds.ToString() + "ms.");
            };

            request.RequestingPartyType = OpenDMS.Storage.Security.RequestingPartyType.System;

            start = DateTime.Now;
            _engine.DetermineIfInstalled(request, @"C:\Users\Lucas\Documents\Visual Studio 2010\Projects\Test\bin\Debug\");
        }
예제 #46
0
 public virtual void GetResourceReadOnly(EngineRequest request, Data.ResourceId resource)
 {
     throw new NotImplementedException();
 }
예제 #47
0
 public virtual void CreateUser(EngineRequest request, Security.User user)
 {
     throw new NotImplementedException();
 }
예제 #48
0
 public virtual void GetGroup(EngineRequest request, string groupName)
 {
     throw new NotImplementedException();
 }
예제 #49
0
 public virtual void ModifyGlobalPermissions(EngineRequest request, List <Security.UsageRight> usageRights)
 {
     throw new NotImplementedException();
 }
예제 #50
0
 public virtual void GetAllUsers(EngineRequest request)
 {
     throw new NotImplementedException();
 }
예제 #51
0
        // Public Methods (30) 

        public virtual void AuthenticateUser(EngineRequest request, string username, string hashedPassword)
        {
            throw new NotImplementedException();
        }
예제 #52
0
 private void Timeout(EngineRequest request)
 {
     WriteLine("GetUser.Timeout - Timeout.");
 }
예제 #53
0
 public virtual void RollbackResource(EngineRequest request, Data.ResourceId resource, int rollbackDepth)
 {
     throw new NotImplementedException();
 }
예제 #54
0
 private void Error(EngineRequest request, string message, Exception exception)
 {
 }
예제 #55
0
 public virtual void ModifyVersion(EngineRequest request, Data.Version version)
 {
     throw new NotImplementedException();
 }
예제 #56
0
 private void Timeout(EngineRequest request)
 {
 }
예제 #57
0
 public virtual void ModifyResourceUsageRightsTemplate(EngineRequest request, List <Security.UsageRight> usageRights)
 {
     throw new NotImplementedException();
 }
예제 #58
0
 public virtual void ModifyResource(EngineRequest request, Data.Resource resource)
 {
     throw new NotImplementedException();
 }
예제 #59
0
 public virtual void CreateNewVersion(EngineRequest request, CreateVersionArgs args)
 {
     throw new NotImplementedException();
 }