/// <summary> /// Read the login.properties file to receive the session ticket. /// </summary> public override void login() { IXProperties lprops = new IXProperties(); lprops.Read(loginProperties); lrVal = readLoginResult(lprops); }
public void run() { lockKey = "mykey"; IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // Prepare ClientInfo object with language and country // ClientInfo ci = new ClientInfo(); // ci.language = "de"; // ci.country = "DE"; // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); // ci = ix.Login.ci Logger.instance().log("login OK"); // get constants Logger.instance().log("get const..."); IXServicePortC CONST = ix.CONST; Logger.instance().log("get const OK"); // Get the current archive key int keyIdBeforeLock = ix.Ix.lockArchive(null); Logger.instance().log("key before lock=" + keyIdBeforeLock); // LOCK int keyIdBeforeLock2 = ix.Ix.lockArchive(lockKey); // Get the current archive key int keyIdAfterLock = ix.Ix.lockArchive(null); Logger.instance().log("key after lock=" + keyIdAfterLock); // UNLOCK int keyIdBeforeUnlock = ix.Ix.lockArchive("0"); } catch (Exception e) { throw e; } finally { // Logout // -- if (ix != null) { Logger.instance().log("IX logout..."); ix.Logout(); Logger.instance().log("IX logout OK"); } } }
private void findDeletedFiles(IXProperties checkoutMap, List <string> checkoutFiles, List <string> deletedFiles) { Dictionary <string, string> mapCheckoutFiles = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); foreach (string f in checkoutFiles) { mapCheckoutFiles.Add(f, f); } foreach (string key in checkoutMap.Keys) { if (key.StartsWith("LM_") || key.StartsWith("MD5_")) { continue; } try { Convert.ToInt32(key); } catch (Exception) { continue; } string f = checkoutMap[key]; if (f.StartsWith("\\")) { f = f.Substring(1); } f = Path.Combine(checkoutDir.FullName, f); if (!mapCheckoutFiles.ContainsKey(f)) { deletedFiles.Add(f); } } }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // Prepare ClientInfo object with language and country // ClientInfo ci = new ClientInfo(); // ci.language = "de"; // ci.country = "DE"; // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); // ci = ix.Login.ci Logger.instance().log("login OK"); // get constants Logger.instance().log("get const..."); IXServicePortC CONST = ix.CONST; Logger.instance().log("get const OK"); // Create a root folder based on keywording form "Email". // Parent is the "imaginary" archive entry with object ID = 1. String parentId = "1"; String maskId = "email"; EditInfo ed = ix.Ix.createSord(parentId, maskId, EditInfoC.mbAll); ed.sord.name = "New Sord"; ViewAndEditSordDlg dlg = new ViewAndEditSordDlg(); dlg.init(ix, ed); dlg.ShowDialog(null); // CHECKIN int objId = ix.Ix.checkinSord(dlg.getSord(), SordC.mbAll, LockC.NO); Logger.instance().log("Created sord successfully, objId=" + objId); } catch (Exception e) { throw e; } finally { // Logout // -- if (ix != null) { Logger.instance().log("IX logout..."); ix.Logout(); Logger.instance().log("IX logout OK"); } } }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); Logger.instance().log("Version=" + connFact.Version); Logger.instance().log("ImplVersion=" + ix.ImplVersion); Logger.instance().log("InterfaceVersion=" + ix.InterfaceVersion); Logger.instance().log("ClientVersion=" + ix.ClientVersion); LoginResult loginResult = ix.LoginResult; // If successfully logged on, you can find the ticket here: // loginResult.clientInfo.ticket. Logger.instance().log("login successfully, ticket=" + loginResult.clientInfo.ticket); Logger.instance().log("ticket lifetime seconds=" + loginResult.ticketLifetime); Logger.instance().log("user ID=" + loginResult.user.id); // Otherwise an exception was thrown in ix.Ix.login() and you will not // reach this lines. // Use in subsequent calls always the returned ClientInfo object (contains ticket). // ci = ix.Login.ci ix.Ix.checkoutWorkflowTemplate("6439", "", WFDiagramC.mbAll, LockC.NO); FindWorkflowInfo findInfo = new FindWorkflowInfo(); findInfo.type = WFTypeC.TEMPLATE; FindResult findResult = ix.Ix.findFirstWorkflows(findInfo, 100, WFDiagramC.mbLean); Logger.instance().log("wfs=" + findResult.workflows); } catch (Exception e) { throw e; } finally { // Logout // -- if (ix != null) { Logger.instance().log("IX logout..."); ix.Logout(); ix.Dispose(); Logger.instance().log("IX logout OK"); } } }
/// <summary> /// Constructor /// </summary> /// <param name="conn">Connection to IndexServer</param> /// <param name="connProps">Connection properties</param> public FWSessionInterface(FWConnection conn, IXProperties connProps) { this.classFactoryVal = new FWSessionClassFactory(this); this.connVal = conn; this.sessOptsVal = ClassFactory.NewSessionOptions(); this.encrPasswordsVal = ClassFactory.NewEncrPasswords(); this.userProfileVal = ClassFactory.NewUserProfile(null); }
/// <summary> /// Creates an object that provides the relogin mechanism. /// </summary> /// <param name="ixClient">IXClient object</param> /// <param name="ci">ClientInfo object</param> /// <param name="userName">User name</param> /// <param name="userPwd">User password</param> /// <param name="computerName">Computer name</param> /// <param name="runAs">Run as user</param> /// <param name="reportAs">Report as user</param> /// <param name="sessOpts">Session options</param> /// <param name="sso">Use Single Sign On supplied by ixlogin servlet.</param> /// <returns>Login object</returns> protected override IXConnLogin InternalCreateLoginObject(IXClient ixClient, ClientInfo ci, String userName, String userPwd, String computerName, String runAs, String reportAs, IXProperties sessOpts, bool sso) { IXConnLogin ixsl = new FWConnLoginEventHandler(ixClientVal, ci); return(ixsl); }
/// <summary> /// Initializes this object /// </summary> /// <param name="conn">Connection object</param> /// <param name="arcName">Archive name</param> /// <param name="connProps">Connection properties</param> public override void Init(FWConnection conn, string arcName, IXProperties connProps) { base.Init(conn, arcName, connProps); // read more members than the base class: // e.g. the archive path is required to build ELOFS paths base.sordZVal = new SordZ(SordC.mbLeanMembers | SordC.mbDocVersionMembers | SordC.mbRefPaths); base.editZVal = new EditInfoZ(EditInfoC.mbDocumentMembers | EditInfoC.mbSignatureMembers | EditInfoC.mbAttachmentMembers, sordZVal); }
/// <summary> /// Constructor. /// </summary> /// <remarks>Reads the ELOFS properties from the conf.properties file.</remarks> /// <exception cref="NotSupportedException">If ELO File System configuration cannot be found in installation directory or application data directory.</exception> public FSConfig() { props = ReadConfigProperties(); if (props == null) { throw new System.NotSupportedException("Cannot find ELO File System configuration"); } InitTempFileFilters(); }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); // ci = ix.Login.ci Logger.instance().log("login OK"); // Create a document EditInfo ed = ix.Ix.createDoc("1", null, null, EditInfoC.mbSordDoc); ed.sord.name = "document with sticky notes"; ed.document = new Document(); ed.document.docs = new DocVersion[1] { new DocVersion() }; ed.document.docs[0].ext = "tif"; ed.document.docs[0].pathId = ed.sord.path; ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet; ed.document = ix.Ix.checkinDocBegin(ed.document); ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, @"..\..\00000001.TIF"); ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO); Note[] notes = new Note[3]; // Create a normal sticky note notes[0] = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_NORMAL, null); notes[0].desc = "This is a normal sticky note"; // Create a personal note notes[1] = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_PERSONAL, null); notes[1].desc = "This is a personal note"; // Create a stamp note notes[2] = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_STAMP, null); notes[2].desc = "This is a stamp note"; int[] noteIds = ix.Ix.checkinNotes(null, notes, NoteC.mbAll, LockC.NO); Logger.instance().log("noteIds=" + noteIds); } finally { ix.Logout(); } }
public void run() { IXConnFactory connFact = null; IXConnection conn = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); conn = connFact.Create(userName, userPwd, "myComputer", null); Logger.instance().log("login OK"); Logger.instance().log("Check whether OCR is available..."); bool avail = checkOcrAvail(conn); Logger.instance().log("OCR is available=" + avail); if (avail) { String fileName = "..\\..\\sample.tif"; Logger.instance().log("Recognize file synchronously"); String text = recognizeFileSync(conn, fileName); Logger.instance().log("text=" + text.Substring(0, 100) + "..."); // Recognize rectangle. // Rectangle units are given in per thousand of document width resp. height. Logger.instance().log("Recognize rect "); int pmLeft = 50, pmTop = 100, pmRight = 200, pmBottom = 1000; text = recognizeRect(conn, fileName, pmLeft, pmTop, pmRight, pmBottom); Logger.instance().log("text=" + text.Substring(0, 100) + "..."); // Return character positions Logger.instance().log("Recognize file return character positions"); recognizeFileCharPos(conn, fileName); } } catch (Exception e) { throw e; } finally { // Logout if (conn != null) { Logger.instance().log("IX logout..."); conn.Logout(); Logger.instance().log("IX logout OK"); } } }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // Prepare ClientInfo object with language and country // ClientInfo ci = new ClientInfo(); // ci.language = "de"; // ci.country = "DE"; // LOGIN Logger.instance().log("login ..."); ClientInfo ci = new ClientInfo(); ci.timeZone = "GMT+01:00"; // "Europe/Berlin"; ix = connFact.CreateSso(ci, Environment.MachineName); LoginResult loginResult = ix.LoginResult; // If successfully logged on, you can find the ticket here: // loginResult.clientInfo.ticket. Logger.instance().log("login successfully, ticket=" + loginResult.clientInfo.ticket); Logger.instance().log("ticket lifetime seconds=" + loginResult.ticketLifetime); Logger.instance().log("user ID=" + loginResult.user.id); // Otherwise an exception was thrown in ix.Ix.login() and you will not // reach this lines. // Use in subsequent calls always the returned ClientInfo object (contains ticket). // ci = ix.Login.ci } catch (Exception e) { throw e; } finally { // Logout // -- if (ix != null) { Logger.instance().log("IX logout..."); ix.Logout(); Logger.instance().log("IX logout OK"); } } }
private void findFiles(List <string> checkoutFiles, List <string> deletedFiles) { // Sammle alle Dateien im Checkout-Verzeichnis findFilesInDir(checkoutDir, checkoutFiles); // Hole aus checkoutobjs.properties die aktuell ausgecheckten Dokumente und // lese sie in map ein. IXProperties checkoutMap = new IXProperties(); checkoutMap.Read(Path.Combine(checkoutDir.FullName, "checkoutobjs.properties")); // Gelöschte Dateien sind diejenigen, die in der checkoutMap aber nicht in checkoutFiles enthalten sind. findDeletedFiles(checkoutMap, checkoutFiles, deletedFiles); }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); // ci = ix.Login.ci Logger.instance().log("login OK"); FindInfo findInfo = new FindInfo(); findInfo.findDirect = new FindDirect(); findInfo.findDirect.query = "buch sord.type:[254 TO 255]"; findInfo.findDirect.searchInFulltext = true; findInfo.findDirect.searchInIndex = true; findInfo.findDirect.searchInMemo = true; findInfo.findDirect.searchInSordName = true; FindResult findResult = ix.Ix.findFirstSords(findInfo, 100, SordC.mbAll); for (int i = 0; i < findResult.sords.Length; i++) { Logger.instance().log(findResult.sords[i].name + "," + findResult.sords[i].type); } ix.Ix.findClose(findResult.searchId); } catch (Exception e) { throw e; } finally { // Logout // -- if (ix != null) { Logger.instance().log("IX logout..."); ix.Logout(); Logger.instance().log("IX logout OK"); } } }
/// <summary> /// Initialize /// </summary> /// <param name="conn">Connection object</param> /// <param name="arcName">Archive name</param> /// <param name="connProps">Connection properties</param> /// <returns></returns> public virtual void Init(FWConnection conn, string arcName, IXProperties connProps) { this.connVal = conn; this.classFactoryVal = new FWContentClassFactory(this); this.sordZVal = new SordZ(SordC.mbLeanMembers | SordC.mbDocVersionMembers); this.editZVal = new EditInfoZ(EditInfoC.mbDocumentMembers | EditInfoC.mbSignatureMembers | EditInfoC.mbAttachmentMembers, sordZVal); // try to get the temporary directory from the connection properties String tmpDir = (connProps != null) ? connProps[FWConnFactory.PROP_TEMP_DIR] : null; if (tmpDir != null && tmpDir.Length != 0) { tempDirVal = makeTempDir(tmpDir, Path.Combine(arcName, "Temp")); checkoutDirVal = makeTempDir(tmpDir, Path.Combine(arcName, "Checkout")); } else { try { // not found: use the users APPDATA directory tempDirVal = makeTempDir(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ELO Digital Office"), Path.Combine(arcName, "Temp")); checkoutDirVal = makeTempDir(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ELO Digital Office"), Path.Combine(arcName, "Checkout")); } catch (Exception) { try { tempDirVal = makeTempDir(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ELO Digital Office"), Path.Combine(arcName, "Temp")); checkoutDirVal = makeTempDir(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ELO Digital Office"), Path.Combine(arcName, "Checkout")); } catch (Exception) { // Konto "Local System" unter Windows 2003 kann nicht auf APPDATA zugreifen. tempDirVal = makeTempDir(Path.Combine(Path.GetTempPath(), "ELO Digital Office"), Path.Combine(arcName, "Temp")); checkoutDirVal = makeTempDir(Path.Combine(Path.GetTempPath(), "ELO Digital Office"), Path.Combine(arcName, "Checkout")); } } } // Initialize the FWDownloadManager object downloadManagerVal = ClassFactory.NewDownloadManager( tempDirVal, connProps.Get(FWConnFactory.PROP_CACHE_DOCUMENT_LIFETIME_SECONDS, FWConnFactory.PROP_CACHE_DOCUMENT_LIFETIME_DEFAULT)); checkedOutDocumentsManagerVal = ClassFactory.NewCheckedOutDocumentsManager(checkoutDirVal); }
public void run() { IXConnFactory connFact = null; IXConnection conn = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); conn = connFact.Create(userName, userPwd, "myComputer", null); Logger.instance().log("login OK"); Logger.instance().log("Check whether OCR is available..."); bool avail = checkOcrAvail(conn); Logger.instance().log("OCR is available=" + avail); if (avail) { Logger.instance().log("Query languages:"); OcrInfo ocrInfo = new OcrInfo(); ocrInfo.queryLanguages = new OcrInfoQueryLanguages(); // Extenal language names should be returned in this language ocrInfo.messagesLanguage = OcrInfoC.MESSAGES_LANGUAGE_GERMAN; OcrResult ocrResult = conn.Ix.processOcr(ocrInfo); for (int i = 0; i < ocrResult.queryLanguages.externalLangs.Length; i++) { Logger.instance().log("external=" + ocrResult.queryLanguages.externalLangs[i]); Logger.instance().log("internal=" + ocrResult.queryLanguages.internalLangs[i]); } } } catch (Exception e) { throw e; } finally { // Logout if (conn != null) { Logger.instance().log("IX logout..."); conn.Logout(); Logger.instance().log("IX logout OK"); } } }
/// <summary> /// Read LoginResult object from login.properties. /// </summary> /// <param name="lprops">Map that contains login.properties</param> /// <returns>LoginResult object</returns> protected static LoginResult readLoginResult(IXProperties lprops) { LoginResult loginResult = new LoginResult(); loginResult.clientInfo = new ClientInfo(); loginResult.clientInfo.ticket = lprops["loginResult.clientInfo.ticket"]; loginResult.clientInfo.language = lprops["loginResult.clientInfo.language"]; loginResult.clientInfo.country = lprops["loginResult.clientInfo.country"]; loginResult.ticketLifetime = lprops.Get("loginResult.ticketLifetime", 120); loginResult.user = new UserInfo(); loginResult.user.id = lprops.Get("loginResult.user.id", -1); loginResult.user.name = lprops["loginResult.user.name"]; loginResult.user.flags = lprops.Get("loginResult.user.flags", 0); return(loginResult); }
private static IXProperties ReadConfigProperties() { IXProperties props = null; String appDir = GetAppdataDir(); props = ReadConfigPropertiesInDir(appDir); if (props == null) { String instDir = GetElofsInstDirFromRegistry(); props = ReadConfigPropertiesInDir(instDir); } return(props); }
/// <summary> /// Creates a connection to IndexServer that is initialized by the /// session ticket of ELOFS. /// </summary> /// <param name="arcName">Archive name</param> /// <returns>Connection to IndexServer</returns> protected virtual FSConnection CreateConnection(String arcName) { String login_properties = getLoginPropertiesFileName(arcName); IXProperties lprops = new IXProperties(); lprops.Read(login_properties); String url = lprops["url"]; IXClient ixClient = new IXClient(url, nbOfConnections, timeoutSeconds); FSConnLogin connLogin = new FSConnLogin(ixClient, login_properties); IXProperties connProps = new IXProperties(); FSConnection conn = new FSConnection(config, arcName, new IXConnection(ixClient, connLogin, connProps)); return(conn); }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // Prepare ClientInfo object with language and country // ClientInfo ci = new ClientInfo(); // ci.language = "de"; // ci.country = "DE"; // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); // ci = ix.Login.ci Logger.instance().log("login OK"); SelectKeywordDlg dlg = new SelectKeywordDlg(ix); dlg.ShowDialog(); } catch (Exception e) { throw e; } finally { // Logout // -- if (ix != null) { Logger.instance().log("IX logout..."); ix.Logout(); Logger.instance().log("IX logout OK"); } } }
private static IXProperties ReadConfigPropertiesInDir(String dir) { IXProperties props = null; if (dir.Length != 0 && Directory.Exists(dir)) { String confFile = Path.Combine(dir, "conf.properties"); if (File.Exists(confFile)) { props = new IXProperties(); props.Read(confFile); String localFile = Path.Combine(dir, "local.properties"); if (File.Exists(localFile)) { props.Read(localFile); } } } return(props); }
public void run() { IXConnFactory connFact = null; IXConnection conn = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); conn = connFact.Create(userName, userPwd, "myComputer", null); Logger.instance().log("login OK"); Logger.instance().log("Check whether OCR is available..."); bool avail = checkOcrAvail(conn); Logger.instance().log("OCR is available=" + avail); if (avail) { String fileName = "..\\..\\sample.tif"; Logger.instance().log("Recognize file asynchronously"); String text = recognizeFileAsync(conn, fileName, 30); Logger.instance().log("text=" + text.Substring(0, 100) + "..."); } } catch (Exception e) { throw e; } finally { // Logout if (conn != null) { Logger.instance().log("IX logout..."); conn.Logout(); Logger.instance().log("IX logout OK"); } } }
public void run() { IXConnFactory connFact = null; IXConnection ix1 = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // LOGIN Logger.instance().log("login connections..."); ix1 = connFact.Create(userName, userPwd, "myComputer-conn1", null); // ci = ix.Login.ci Logger.instance().log("login OK"); EventBusWatchFolderEventsDlg dlg = new EventBusWatchFolderEventsDlg(ix1); dlg.ShowDialog(); } catch (Exception e) { throw e; } finally { // Logout // -- if (ix1 != null) { Logger.instance().log("IX logout..."); ix1.Logout(); Logger.instance().log("IX logout OK"); } } }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // Prepare ClientInfo object with language and country // ClientInfo ci = new ClientInfo(); // ci.language = "de"; // ci.country = "DE"; // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); // ci = ix.Login.ci Logger.instance().log("login OK"); // get constants Logger.instance().log("get const..."); IXServicePortC CONST = ix.CONST; Logger.instance().log("get const OK"); // lock key data // This is optional since checkinKeys and // deleteKeys check the lock too. Logger.instance().log("lock key data..."); ix.Ix.checkoutKeys(null, LockC.YES); Logger.instance().log("lock key data OK"); // create key // - be aware to set KeyInfo.id = -1 to create a new key! Logger.instance().log("create key..."); KeyInfo ki = new KeyInfo(); ki.id = -1; ki.name = "C# Example Key"; ki.id = ix.Ix.checkinKeys(new KeyInfo[] { ki }, LockC.NO)[0]; Logger.instance().log("create key OK, name=" + ki.name + ", id=" + ki.id); // delete key and unlock Logger.instance().log("delete key..."); ix.Ix.deleteKeys(new String[] { ki.name }, LockC.YES); Logger.instance().log("delete key OK"); } catch (Exception e) { throw e; } finally { // Logout // -- if (ix != null) { Logger.instance().log("IX logout..."); ix.Logout(); Logger.instance().log("IX logout OK"); } } }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // Prepare ClientInfo object with language and country // ClientInfo ci = new ClientInfo(); // ci.language = "de"; // ci.country = "DE"; // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); // ci = ix.Login.ci Logger.instance().log("login OK"); // get constants Logger.instance().log("get const..."); IXServicePortC CONST = ix.CONST; Logger.instance().log("get const OK"); // Example for initializing an encryption set with a new internal password. // If you uncomment this lines, aready encrypted documents of this encryption set // cannot be decrypted anymore since the internal key is lost! // Logger.instance().log("init encryption set ..."); //initializeNewEncryptionSet(ix, CONST, 13, "CS-TEST", encryptionPassword); // Logger.instance().log("init encryption set OK"); // checkin example document and encrypt it string objId = checkinDocEncrypted(ix, CONST); // checkout example document checkoutDocDecryptedUsingSessionOption(ix, CONST, objId); // checkout example document checkoutDocDecryptedUsingUrlExt(ix, CONST, objId); bool cleanUp = true; if (cleanUp) { // Delete Document DeleteOptions delOpts = new DeleteOptions(); delOpts.deleteFinally = true; ix.Ix.deleteSord(null, objId, LockC.NO, null); ix.Ix.deleteSord(null, objId, LockC.NO, delOpts); } } catch (Exception e) { throw e; } finally { // Logout // -- if (ix != null) { Logger.instance().log("IX logout..."); ix.Logout(); Logger.instance().log("IX logout OK"); } } }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); // ci = ix.Login.ci Logger.instance().log("login OK"); // Create a document EditInfo ed = ix.Ix.createDoc("1", null, null, EditInfoC.mbSordDoc); ed.sord.name = "document with annotations"; ed.document = new Document(); ed.document.docs = new DocVersion[1] { new DocVersion() }; ed.document.docs[0].ext = "tif"; ed.document.docs[0].pathId = ed.sord.path; ed.document.docs[0].encryptionSet = ed.sord.details.encryptionSet; ed.document = ix.Ix.checkinDocBegin(ed.document); ed.document.docs[0].uploadResult = ix.Upload(ed.document.docs[0].url, @"..\..\00000001.TIF"); ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO); List <Note> notes = new List <Note>(); // ------------------------------------------------------- // Do not use the member Note.desc for annotations because // it contains position and formatting information. // ------------------------------------------------------- // Text on a opaque rectangle if (true) { Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_NOTE_WITHFONT, null); note.noteText.text = "This is an annotation with font=" + note.noteText.fontInfo.faceName; note.color = NetColorToEloColor(System.Drawing.Color.RosyBrown); note.noteText.fontInfo.height *= 2; note.noteText.fontInfo.bold = true; note.noteText.fontInfo.italic = true; note.noteText.fontInfo.RGB = NetColorToEloColor(System.Drawing.Color.SkyBlue); note.XPos = 100; note.YPos = 200; note.width = 1000; note.height = 500; notes.Add(note); } // Horizontal line if (true) { Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_HORIZONTAL_LINE, null); PointInfo p1 = new PointInfo(); p1.x = 100; p1.y = 750; PointInfo p2 = new PointInfo(); p2.x = p1.x + 900; p2.y = p1.y; note.noteFreehand.points = new PointInfo[] { p1, p2 }; note.noteFreehand.width = 20; // Pen width note.color = NetColorToEloColor(System.Drawing.Color.Violet); notes.Add(note); } // Freehand line (this example draws a circle) if (true) { Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_FREEHAND, null); List <PointInfo> points = new List <PointInfo>(); for (int i = 0; i < 360; i += 5) { double alpha = 2 * Math.PI * (double)i / 360.0; PointInfo p = new PointInfo(); p.x = 200 + (int)(Math.Sin(alpha) * 100); p.y = 900 + (int)(Math.Cos(alpha) * 100); points.Add(p); } note.noteFreehand.points = points.ToArray(); note.noteFreehand.width = 50; // Pen width note.color = NetColorToEloColor(System.Drawing.Color.Tomato); notes.Add(note); } // Draws a half-transparent rectangle if (true) { Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_MARKER, null); note.XPos = 400; note.YPos = 800; note.width = 300; note.height = 200; note.color = NetColorToEloColor(System.Drawing.Color.YellowGreen); notes.Add(note); } // Draws a filled (opaque) rectangle if (true) { Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_FILLEDRECTANGLE, null); note.XPos = 800; note.YPos = 800; note.width = 300; note.height = 200; note.color = NetColorToEloColor(System.Drawing.Color.YellowGreen); notes.Add(note); } // Draws a strikeout line if (true) { Note note = ix.Ix.createNote2(ed.document.objId, NoteC.TYPE_ANNOTATION_STRIKEOUT, null); PointInfo p1 = new PointInfo(); p1.x = 100; p1.y = 1100; PointInfo p2 = new PointInfo(); p2.x = p1.x + 900; p2.y = p1.y; note.noteFreehand.points = new PointInfo[] { p1, p2 }; note.noteFreehand.width = 100; note.noteFreehand.strikeoutWidth = 20; note.noteFreehand.strikeoutColor = NetColorToEloColor(System.Drawing.Color.Red); note.color = NetColorToEloColor(System.Drawing.Color.Yellow); notes.Add(note); } int[] noteIds = ix.Ix.checkinNotes(null, notes.ToArray(), NoteC.mbAll, LockC.NO); Logger.instance().log("noteIds=" + noteIds); } finally { ix.Logout(); } }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // Prepare ClientInfo object with language and country // ClientInfo ci = new ClientInfo(); // ci.language = "de"; // ci.country = "DE"; // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); // ci = ix.Login.ci Logger.instance().log("login OK"); // get constants Logger.instance().log("get const..."); IXServicePortC CONST = ix.CONST; Logger.instance().log("get const OK"); // 1. Create archive hirarchie // root folder Sord sordRoot = ix.Ix.createSord("1", null, EditInfoC.mbSord).sord; sordRoot.name = "C# example FindFirstFindNext"; sordRoot.id = ix.Ix.checkinSord(sordRoot, SordC.mbAll, LockC.NO); // create sords Logger.instance().log("create sords..."); for (int i = 0; i < nbOfChildren; i++) { String namePrefix = "" + i; while (namePrefix.Length < 4) { namePrefix = "0" + namePrefix; } Sord sord = ix.Ix.createSord(sordRoot.guid, null, EditInfoC.mbSord).sord; sord.name = namePrefix + "-o-" + namePrefix; sord.id = ix.Ix.checkinSord(sord, SordC.mbAll, LockC.NO); } Logger.instance().log("create sords OK"); // 2. List hirarchie Logger.instance().log("find..."); // Prepare FindInfo object FindInfo findInfo = new FindInfo(); findInfo.findChildren = new EloixClient.IndexServer.FindChildren(); findInfo.findChildren.parentId = sordRoot.guid; // find FindResult findResult = ix.Ix.findFirstSords(findInfo, 1000, SordC.mbAll); Logger.instance().log("found #=" + findResult.sords.Length); for (int i = 0; i < findResult.sords.Length; i++) { Logger.instance().log("sord.id=" + findResult.sords[i].id + ", sord.name=" + findResult.sords[i].name); } ix.Ix.findClose(findResult.searchId); Logger.instance().log("find OK"); bool cleanUp = true; if (cleanUp) { Logger.instance().log("clean up..."); DeleteOptions delOpts = new DeleteOptions(); delOpts.deleteFinally = true; ix.Ix.deleteSord(null, sordRoot.guid, LockC.NO, null); ix.Ix.deleteSord(null, sordRoot.guid, LockC.NO, delOpts); Logger.instance().log("clean up OK"); } } catch (Exception e) { throw e; } finally { // Logout // -- if (ix != null) { Logger.instance().log("IX logout..."); ix.Logout(); Logger.instance().log("IX logout OK"); } } }
public void run() { IXConnFactory connFact = null; IXConnection ix1 = null; IXConnection ix2 = null; // generate an event type that is most likely only used by me. myEventType = computeMyEventType(); try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // LOGIN Logger.instance().log("login connections..."); ix1 = connFact.Create(userName, userPwd, "myComputer-conn1", null); ix2 = connFact.Create(userName, userPwd, "myComputer-conn2", null); // ci = ix.Login.ci Logger.instance().log("login OK"); // Add event bus handlers. // This handlers are called for the received events from a background thread. // Thus we cannot update the user interfache in this threads directly. // The handlers will add the received events to the list receivedMessages and // the items of the list are printed from the main thread. ix1.EventBusApi.EventBusHandler += new EventBusApi.ProcessEventBusEvents(EventBusApi_EventBusHandler1); ix2.EventBusApi.EventBusHandler += new EventBusApi.ProcessEventBusEvents(EventBusApi_EventBusHandler2); // Add listeners to our private event. ix1.EventBusApi.BroadcastBus.AddListener(myEventType); ix2.EventBusApi.BroadcastBus.AddListener(myEventType); Logger.instance().log("conn1.subsId=" + ix1.EventBusApi.SubscriberId); Logger.instance().log("conn2.subsId=" + ix2.EventBusApi.SubscriberId); // Each connection sends 3 events to the other connection. // Here, the event data is a simple string. But it could be a Sord e.g. too. Logger.instance().log("send events"); for (int i = 0; i < 3; i++) { EventBusApi.Bus bbus1 = ix1.EventBusApi.BroadcastBus; bbus1.Send(myEventType, "Hello conn2 - " + i); EventBusApi.Bus bbus2 = ix2.EventBusApi.BroadcastBus; bbus2.Send(myEventType, "Hello conn1 - " + i); } // Wait for the events and print them. Logger.instance().log("wait 1"); Thread.Sleep(1 * 1000); // Print received messages Logger.instance().log("received:"); foreach (String s in receivedMessages) { Logger.instance().log(s); } if (receivedMessages.Count != 6) { Logger.instance().log("Error: 6 events should have been received"); } } catch (Exception e) { throw e; } finally { // Logout // -- if (ix1 != null && ix2 != null) { Logger.instance().log("IX logout..."); ix1.Logout(); ix2.Logout(); Logger.instance().log("IX logout OK"); } } }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // Prepare ClientInfo object with language and country // ClientInfo ci = new ClientInfo(); // ci.language = "de"; // ci.country = "DE"; // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); // ci = ix.Login.ci Logger.instance().log("login OK"); // get constants Logger.instance().log("get const..."); IXServicePortC CONST = ix.CONST; Logger.instance().log("get const OK"); // 1. Create archive structure Logger.instance().log("create structure..."); // create root folder s1 EditInfo ed = ix.Ix.createSord("1", "0", EditInfoC.mbAll); Sord s1 = ed.sord; s1.name = "s1 C# example FindByIndexValues"; s1.id = ix.Ix.checkinSord(s1, SordC.mbAll, LockC.NO); /// d1, name=The Inner Circle, AUTHOR=T. Coraghessan Boyle, PRICE=039 /// d2 name=The Shifting Tide, AUTHOR=Anne Perry, PRICE=037 /// d3 name=Feel, AUTHOR=Robbie Williams, PRICE=142 /// d4 name=The Da Vinci Code, AUTHOR=Dan Brown, PRICE=032 /// Sord d1 = internalCreateBook(ix, CONST, s1.guid, "The Inner Circle", "T. Coraghessan Boyle", "039"); Sord d2 = internalCreateBook(ix, CONST, s1.guid, "The Shifting Tide", "Anne Perry", "037"); Sord d3 = internalCreateBook(ix, CONST, s1.guid, "Feel", "Robbie Williams", "142"); Sord d4 = internalCreateBook(ix, CONST, s1.guid, "The Da Vinci Code", "Dan Brown", "032"); Logger.instance().log("create structure OK"); // 2. Find books from Authors with names from "A" to "J" internalFindBooks(ix, CONST, s1.guid, "A* ... J*", ""); // Finds: The Da Vinci Code,The Shifting Tide // 3. Find books from Authors with names from "J" internalFindBooks(ix, CONST, s1.guid, "J*...*", ""); // Finds: Feel,The Inner Circle // 4. Find books from Authors with names from "J" and price higher than 100 internalFindBooks(ix, CONST, s1.guid, "J*...", "100...*"); // Finds: Feel bool cleanUp = true; if (cleanUp) { Logger.instance().log("clean up..."); ix.Ix.deleteSord(null, s1.guid, LockC.NO, null); Logger.instance().log("clean up OK"); } } catch (Exception e) { throw e; } finally { // Logout // -- if (ix != null) { Logger.instance().log("IX logout..."); ix.Logout(); Logger.instance().log("IX logout OK"); } } }
public void run() { IXConnFactory connFact = null; IXConnection ix = null; try { IXProperties connProps = IXConnFactory.CreateConnProperties(url); IXProperties sessOpts = IXConnFactory.CreateSessionOptions("IX-Examples", "1.0"); connFact = new IXConnFactory(connProps, sessOpts); Logger.instance().log("create IXConnFactory OK"); // Prepare ClientInfo object with language and country // ClientInfo ci = new ClientInfo(); // ci.language = "de"; // ci.country = "DE"; // LOGIN Logger.instance().log("login..."); ix = connFact.Create(userName, userPwd, "myComputer", null); // ci = ix.Login.ci Logger.instance().log("login OK"); // get constants Logger.instance().log("get const..."); IXServicePortC CONST = ix.CONST; Logger.instance().log("get const OK"); // 1. Create sord for document without version // Initialize Sord object EditInfo ed = ix.Ix.createDoc("1", "0", null, EditInfoC.mbSordDocAtt); ed.sord.name = "C# example CheckinAttachment"; // Create attachment file String attFile = internalCreateTestFile("CheckinNewAttachment attachment file", "txt"); // Supply the extension of the document ed.document.atts = new DocVersion[1]; ed.document.atts[0] = new DocVersion(); ed.document.atts[0].ext = ix.GetFileExt(attFile); ed.document.atts[0].pathId = ed.sord.path; // ed.document.atts[0].encryptionSet = ignored // CheckinDocBegin: let IndexServer generate an URL to upload the document ed.document = ix.Ix.checkinDocBegin(ed.document); Logger.instance().log("prepared upload URL=" + ed.document.atts[0].url + ", att-guid=" + ed.document.atts[0].guid); // Upload the document String uploadResult = ix.Upload(ed.document.atts[0].url, attFile); ed.document.atts[0].uploadResult = uploadResult; Logger.instance().log("upload succeeded"); System.IO.File.Delete(attFile); // CheckinDocEnd: uploadResult contains the document information from ELODM. // Pass this information to ed.document = ix.Ix.checkinDocEnd(ed.sord, SordC.mbAll, ed.document, LockC.NO); Logger.instance().log("inserted document:"); Logger.instance().log(" objId=" + ed.document.objId); Logger.instance().log(" attId=" + ed.document.atts[0].id); Logger.instance().log(" att-guid=" + ed.document.atts[0].guid); Logger.instance().log(" URL=" + ed.document.atts[0].url); // 2. Checkout and show document ed = ix.Ix.checkoutDoc(ed.sord.guid, null, EditInfoC.mbAll, LockC.NO); String tempName2 = internalMakeTempFileName(ed.document.atts[0].ext); ix.Download(ed.document.atts[0].url, tempName2); // Uncomment this to show document in notepad: // System.Diagnostics.Process.Start("notepad.exe", tempName2); // System.Threading.Thread.Sleep(3000); System.IO.File.Delete(tempName2); bool cleanUp = true; if (cleanUp) { // Delete Document DeleteOptions delOpts = new DeleteOptions(); delOpts.deleteFinally = true; ix.Ix.deleteSord(null, ed.sord.guid, LockC.NO, null); ix.Ix.deleteSord(null, ed.sord.guid, LockC.NO, delOpts); } } catch (Exception e) { throw e; } finally { // Logout // -- if (ix != null) { Logger.instance().log("IX logout..."); ix.Logout(); Logger.instance().log("IX logout OK"); } } }