Showing posts with label custom programming. Show all posts
Showing posts with label custom programming. Show all posts

Monday, March 16, 2015

DRF File and PCDOCS Link Handler for eDOCS DM

Couple years ago I created a handler for DRF files, OpenText eDOCS DM document links. The purpose of the tool was to give users the ability to open eDOCS DM documents in read-only mode if they (the users) do not want to install eDOCS DM Extensions.

Today I'm publishing the tool, its full source code, and some basic documentation:
EDocsLinkHandler

The best part of this package is, of course, the full source code (C# / .NET 4 / Visual Studio 2013). It's my implementation of DM WCF API helpers, and it even includes unit tests! :-)

Although the helpers only implement the logon, search, and document download functionality, they may serve as a starting point for anyone developing for DM with WCF API. After two years since the code was written, I still like it, maybe with the exception of the way I implemented the DMSearchResults class... Well, consider it as a free demo. Enjoy!

Wednesday, March 11, 2015

DM WCF AutoLogin Sample

I've put together some files in a folder on my Google Drive that
a) Demonstrate how to use eDOCS DM WCF API.
b) Illustrate the Auto Login vulnerability (security issue DM-32057), if your DM server is not patched.

The Creating Powerful eDOCS DM Client Step-by-step.pdf document describes how to start using DM WCF API in 7 simple steps.

Source.zip contains full source code (C# / .NET 4.5 / Visual Studio 2013) of the demo created with the instructions from the above document.

Demo.zip contains the executable compiled from the source code in Source.zip. You can launch it, if you don't want to recompile. Before launching the exe, you should open ConsoleApplication1.exe.config in Notepad and specify a) the name of your DM server (2 places); b) the user name in your DM library; c) the user's domain name.

Disclaimer: The instructions, source code and the executable are provided "as is", for demo purposes only and without warranty of any kind.

Tuesday, March 10, 2015

An Example of Unsecure Architecture Decision

There is a great help topic regarding the Auto Login feature in the eDOCS DM 10 documentation:


"The eDOCS DM Auto Login feature is based on the client side knowing that the current user has already been authenticated on the local workstation; because of this, the eDOCS DM relative authentication does not require the user to re-enter a password. This means that the user’s password is not available on the server side when the eDOCS security token is being constructed."

Simply put it says that when the Auto Login feature is enabled, it is a DM client application that is responsible for user authentication, not the server.



If you grasped the idea and you liked it, you may also enjoy reading The Final Circle of Paradise book.

Tuesday, February 25, 2014

DM Server Log Parser Update

EDocsLogParser v1.0.3, a new version, has been uploaded to Drive and GitHub. I tuned up performance a bit and fixed OutOfMemoryException which occurred on some large (~1 GB) log files. The parser was tested on logs larger than 1.3 GB and it worked fine.

While working on these updates, I noticed that DM Server logs become messy when the load on the server increases: messages from different calls are often mixed on same lines. I did my best to resolve this mess in the log parser, but it couldn't be resolved completely. I added new unit tests with snippets from real logs, so you can see a part of that "having fun".

If I wrote the parser from the beginning now, I would based it on loading a whole log file as a single string and not breaking it by lines as I've implemented it. I give it up: I find the OpenText's product being buggy and a bit badly designed to spend too much time and passion on it. With this said, I'm quite happy with EDocsLogParser as it is: it extracts 99.99% of all SQL events out of a messy 1 GB log and this is more than enough for the tasks I intended it for:
How to Find Slow SQL Queries in eDOCS DM Server Logs
SQL Connection Cache Size for OpenText eDOCS DM Server

Sunday, December 29, 2013

eDOCS DM Server Log Parser - Part 3: Usage

This is the third part of the series about converting Hummingbird DM / OpenText eDOCS DM server logs to XML for further processing, e.g. for statistical analysis or for finding performance bottlenecks in SQL queries.

You can download the compiled tool from my Google drive. Here is the link: EDocsLogParser
The tool requires .NET Framework 4.0 or later, which I believe you already have on your Windows system.


Usage:
  1. Launch the EDocsLogParser application.
  2. Click the 'Directory...' button and select a folder with one or more log files from your DM server.
  3. Press the 'Start' button. 
  4. XML files will be created in the same directory where source DM logs are located and which you picked for processing.
Here is a sample result of the DM log file processing. A snippet from DM log:

DOCSSQL: [0ECE9D58] SQLObject at 10D48F58 acquired existing connection from pool #1

********** 13:59:28.871  [0ECE9D58] DOCSSQL: EXECute SQL Statement on Library:MYLIB - MYDB  (Oracle7) **********
Autocommit is ON

STATEMENT:
SELECT DOCSADM.APPS.APPLICATION,DOCSADM.APPS.DESCRIPTION,'AMBIENT_PROPERTY' UNK1,DOCSADM.APPS.SYSTEM_ID,'' FROM DOCSADM.APPS WHERE (SYSTEM_ID != 0) AND ((DOCSADM.APPS.APPLICATION = 'MS WORD')) AND (DOCSADM.APPS.DISABLED NOT IN ('Y','T','1') OR DOCSADM.APPS.DISABLED IS NULL) ORDER BY DOCSADM.APPS.APPLICATION ASC

TIMER:   [0ECE9D58] ODBCHandle::ReadItem(): 15 milliseconds  Fetched first row
DOCSSQL: [0ECE9D58] ODBCHandle::IssueCommand(): Statement returned results.  32 rows per fetch.  5248 bytes allocated for result sets.
TIMER:   [0ECE9D58] ODBCHandle::IssueCommand(): 22 milliseconds 
DOCSSQL: [0ECE9D58] ODBCHandle::ClearResults(): 1 row(s) fetched
DOCSSQL: [0ECE9D58] SQLObject at 10D48F58 released connection back to pool


The resultant XML file:

<?xml version="1.0"?>
<ArrayOfBaseEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <BaseEvent xsi:type="SqlEvent" key="0ECE9D58" connection="1" isNew="False">
    <Queries>
      <SqlQueryEvent time="13:59:28.871" readItemDuration="0.015" issueCommandDuration="0.022">
        <Command>SELECT DOCSADM.APPS.APPLICATION,DOCSADM.APPS.DESCRIPTION,'AMBIENT_PROPERTY' UNK1,DOCSADM.APPS.SYSTEM_ID,'' FROM DOCSADM.APPS WHERE (SYSTEM_ID != 0) AND ((DOCSADM.APPS.APPLICATION = 'MS WORD')) AND (DOCSADM.APPS.DISABLED NOT IN ('Y','T','1') OR DOCSADM.APPS.DISABLED IS NULL) ORDER BY DOCSADM.APPS.APPLICATION ASC</Command>
      </SqlQueryEvent>
    </Queries>
  </BaseEvent>
</ArrayOfBaseEvent>


Once you have an XML file, you can query data from it. In this case, XPath and PowerShell may be your best option. If you want to load the data into a data grid and visually transform it, try Microsoft Excel.

Alternatively, you may think about writing a program in .NET for log data processing. Please take the definition of the BaseEvent, SqlEvent, and SqlQueryEvent classes from EDocsLog.dll to load data effectively.

See Also:
eDOCS DM Server Log Parser - Part 1: Understanding the Task
eDOCS DM Server Log Parser - Part 2: Implementation

Saturday, December 28, 2013

eDOCS DM Server Log Parser - Part 2: Implementation

This is the second post about parsing Hummingbird DM / OpenText eDOCS DM server logs. Part #1 is here.

In this part I'm going to briefly explain the structure of the log parser just in case anyone may want to recompile, modify or extend it. However, if you simply want to get the DM Log Parser executable and use it, please feel free to jump directly to Part #3 - Usage of this article series.

The EDocsLogParser solution is implemented in C# / Visual Studio 2013 and consists of 3 projects.



EDocsLog is a Class Library and this is the core of the parser. The LogFile class represents a log file as a string array. The LogParser class is responsible for converting the log file into an array of events. It applies a set of predefined rules to the log lines. Rules are based on regular expressions. The rules return a RuleResult object, which tells the parser how to recognize event blocks (chunks) and to convert them into events. The result of the LogParser execution is an array of events. The events are serializable to XML via System.Xml.Serialization.
The parser performs two runs on a DM Server "raw" log file. On the first run, it applies the header and footer rules (see Part 1 for details about event blocks) and forms event stubs or chunks. The second run applies the inner or "body" rules to extract additional data from the recognized event block. The second run only processes the log lines within the previously found chunks. It also benefits from Task Parallel Library (TPL) for faster processing of the array of chunks.



EDocsLogParser is a WPF application. It allows you to pick a directory with DM Server logs and then to convert all of them into XML files. It calls the LogParser.Parse method for every log file and displays the progress.


EDocsLogTests is a set of unit tests for the EDocsLog classes.


Currently, the log parser can extract SQL events from a DM Server log file. It works for any log file, but, apparently, events will be extracted only if the log file was created with Log SQL, Log SQL & Calls, or Log All logging level:


Full source code of EDocsLogParser: https://github.com/dotnetnick/edocs/

Tuesday, November 5, 2013

Pros And Cons of Different Ways to Custom Programming for eDOCS DM

Below I describe 5 different approaches that I know to programming for OpenText eDOCS DM:
DM Extensions API, DM API, Extending DM Webtop, Consuming WCF Service, and Direct Access.

Saturday, November 2, 2013

Monday, October 28, 2013

Exception-based Error Reporting for DM API Helpers

As mentioned before, DM API calls are old-styled HRESULT functions, which return 0 (S_OK), to indicate the successful execution, or an error code. On the other hand, .NET developers commonly expect handling an exception, if something has gone wrong, not an error code.

Friday, October 25, 2013

Custom Programming for eDOCS DM

The most common requests which I hear from the users of eDOCS DM are:
  • extract documents from the document library and 
  • upload documents from a disk to the library. 

Occasionally a user asks: "We've got documents from one of our offices, which are to be uploaded to DM. Maintain the folder structure, use profile form 'A', set the profile fields like this, and apply security settings like that."

This is a good example where you want to write some code to get the job done in one (well, may be more) clicks. This particular task - uploading the documents - is best to be solved using eDOCS DM API.
Other approaches exist as well, but I decided to use DM API for the following reasons:

  • This is my first project of custom coding for eDOCS DM, so, for getting up to speed, I'll need some code samples, documentation and all tools ready.
  • I'm going to use managed DM API Interop assemblies and write in C# and in VS2012.
  • DM API is already installed as a part of DM Extensions.
  • I also have Visual Studio 2012 already installed.
  • I have DM Documentation from the eDOCS DM installation disk - eDOCS DM 5.3.1 DM API Reference Guide.pdf
  • The last, but not the least, I have the source code of 2 tools written in VB.NET and C#, which I inherited from a guy, who was with the company before I joined and had left soon after :( Thank you, Jory, your code has helped me to start quickly!

Update

I've posted another article on different approaches to custom coding for DM which you may find useful: