org.semanticdesktop.aperture.outlook
Class OutlookCrawler

java.lang.Object
  extended by org.semanticdesktop.aperture.crawler.base.CrawlerBase
      extended by org.semanticdesktop.aperture.outlook.OutlookCrawler
All Implemented Interfaces:
Crawler, DataOpener

public class OutlookCrawler
extends CrawlerBase
implements DataOpener

Outlook Crawler

Crawler that wraps Microsoft Outlook. It is not very exhaustive and can not read all variables out of an outlook system.

Order of crawling

There have been requests to crawl e-mail after everything else, because e-mail takes very long. To distinguish the e-mail folders to be crawled, we had to find a way to identify them. DefaultItemType of e-mail folders is 0, DefaultMessageClass is "IPM.Note". This is insofar a problem, as also contacts and deleted items folders have these properties. Hence we sort folders with DefaultItemType 0 later, but not if their name contains "*ontacts" or "Kontakte" (which is a hack).

Outlook crashes

Endless history of outlook adapter crashes: WORKAROUND : what about the threading and objects issues. I create hundreds of ActiveX Objects but never release() them. This might be dangerous. So i did something with the jacob thread, we will see what happens... 17.8.2004: I had many creahsed during a presenta ComThread.doCoInitialize(0); This didn't help much, now i have a EXCEPTION_ACCESS_VIOLATION anbd the VM crrahses. Later: I tried the old Jacob.dll again. The 94.208 Bytes version. Without InitMta in the beginCall and EndCall - they are now empty. interesting - it even recovers when an comfailexception occurs. 30.8.2004: crashed from time to time. restarting outlook and gnowsis helps. probably threading problem again. 2.9.2004: changed to init: ComThread.startMainSTA(); beginCall: ComThread.InitSTA(); doesn't work changed jacob.dll to 106.496byte version again. 2.9.2004 new approach-Always get Mapi: Now I changed the call in getResourceWrapper to always create the Outlook.Application and get the namespace. Then it works. I will now try making the Application and Namespace session dependent It looks like creating the MAPI more often could be the final solution. result: worked quite fine, but if outlook is not running before gnowsis, it may crash. 14.9.2004 again crashes. If it crashed once, I have to restart the computer to get it up again. Interesting: access to the outlook root resource Folders property causes crash. Closing the Outlook-mapi on session.close did not help! I think I found a major bug today: The outlook root foler wrapper did release the outlookmapi object when it was released. This looks bad. So I removed the outlook mapi from the Root-Wrapper and put null there instead. looks better now. 10.11.2004 again problems with coCreate. I try to call coInitialize again and do the ComThread.InitSTA(); 23.7.2008: calling ComThread.Release();ComThread.quitMainSTA();ComThread.doCoUninitialize(); during normal system runs (for example, during datasource detection) caused windows messaging to fail in OSGi/SWT environments. We noticed VM crashes on window/USER32 calls. current approach: on beginCall() ComThread.doCoInitialize(0); and registershutdownhook on endCall(): outlookMapi.safeRelease(); outlookMapi = null; outlookApp.safeRelease(); outlookApp = null; accessor = null;

Copyright: Copyright (c) 2003-2006

Organisation: DFKI.de, Aduna.Biz

Version:
$Id: OutlookCrawler.java 1525 2009-01-27 21:32:27Z leo_sauermann $
Author:
Leo Sauermann

Nested Class Summary
static class OutlookCrawler.OLConst
          Constants from outlook
 
Field Summary
protected  String calendarTimeZone
          default calendar timezone should be one of the timezones from the website.
static String ITEMID_IDENTIFIERPREFIX
          A prefix to distinguish outlook item-identifiers from other nao:identifiers.
static String NS
          Namespace
static String OUTLOOKURIPREFIX
           
 
Fields inherited from class org.semanticdesktop.aperture.crawler.base.CrawlerBase
accessData, accessorRegistry, crawlReportFile, source, stopRequested
 
Constructor Summary
OutlookCrawler()
           
 
Method Summary
protected  void beginCall()
           
 void crashChecker(Throwable cause)
          check if it would be wise to restart our outlook adaption
protected  ExitCode crawlObjects()
          crawling outlook.
protected  void endCall()
           
protected  OutlookAccessor getAccessor()
           
protected  com.jacob.com.Dispatch getOutlookMapi()
          outlookMapi, the fabulous "default namespace" of outlook, useful to retrieve many things.
 String getUriPrefix()
           
 boolean hasRedemption()
          can this OLAdapter be used in combination with redemption?
 void killKillKill()
          due to enduring problems with release, this method is used to kill outlook crawler for sure
 void open(URI uri)
          Opens the resource indicated by the specified URI in the application that the user typically would use to access such a resource.
 void release()
          the release of the Outlook Adapter ATTENTION: If the Outlook Adapter is not released properly, It will halt the whole application as the MainSTA has to be released.
 void setDataSource(DataSource source)
          Sets the data source
 
Methods inherited from class org.semanticdesktop.aperture.crawler.base.CrawlerBase
clear, clear, crawl, getAccessData, getCrawlerHandler, getCrawlReport, getCrawlReportFile, getDataAccessorRegistry, getDataSource, getRDFContainerFactory, inDomain, isStopRequested, reportAccessingObject, reportDeletedDataObject, reportFatalErrorCause, reportFatalErrorCause, reportFatalErrorCause, reportModifiedDataObject, reportNewDataObject, reportUnmodifiedDataObject, reportUntouched, runSubCrawler, setAccessData, setCrawlerHandler, setCrawlReportFile, setDataAccessorRegistry, stop, storeCrawlReport, touchObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OUTLOOKURIPREFIX

public static final String OUTLOOKURIPREFIX
See Also:
Constant Field Values

NS

public static final String NS
Namespace

See Also:
Constant Field Values

ITEMID_IDENTIFIERPREFIX

public static final String ITEMID_IDENTIFIERPREFIX
A prefix to distinguish outlook item-identifiers from other nao:identifiers. to be used as prefix inside values of nao:identifier. value is "itemid:"

See Also:
Constant Field Values

calendarTimeZone

protected String calendarTimeZone
default calendar timezone should be one of the timezones from the website.

Constructor Detail

OutlookCrawler

public OutlookCrawler()
Method Detail

beginCall

protected void beginCall()

crashChecker

public void crashChecker(Throwable cause)
check if it would be wise to restart our outlook adaption

Parameters:
cause -

crawlObjects

protected ExitCode crawlObjects()
crawling outlook. Each call/thread gets its own Outlook-Mapi object, which is passed around.

Specified by:
crawlObjects in class CrawlerBase
Returns:
ExitCode

endCall

protected void endCall()

getAccessor

protected OutlookAccessor getAccessor()

getOutlookMapi

protected com.jacob.com.Dispatch getOutlookMapi()
outlookMapi, the fabulous "default namespace" of outlook, useful to retrieve many things.


getUriPrefix

public String getUriPrefix()

hasRedemption

public boolean hasRedemption()
can this OLAdapter be used in combination with redemption?

Returns:
true, if redemption is installed

open

public void open(URI uri)
          throws IOException
Description copied from interface: DataOpener
Opens the resource indicated by the specified URI in the application that the user typically would use to access such a resource.

Specified by:
open in interface DataOpener
Parameters:
uri - The uri of the resource that should be opened
Throws:
IOException - In case of an I/O error.

release

public void release()
the release of the Outlook Adapter ATTENTION: If the Outlook Adapter is not released properly, It will halt the whole application as the MainSTA has to be released. This is serious, as the MainSTA is running as Deamon thread.


killKillKill

public void killKillKill()
due to enduring problems with release, this method is used to kill outlook crawler for sure


setDataSource

public void setDataSource(DataSource source)
Description copied from class: CrawlerBase
Sets the data source

Overrides:
setDataSource in class CrawlerBase
Parameters:
source - the new data source


Copyright © 2010 Aperture Development Team. All Rights Reserved.