org.semanticdesktop.aperture.outlook
Class OutlookResource

java.lang.Object
  extended by org.semanticdesktop.aperture.outlook.OutlookResource
Direct Known Subclasses:
OutlookResource.Document, OutlookResource.Folder, OutlookResource.Note, OutlookResource.OutlookResourceSave, OutlookResource.RootFolder

public abstract class OutlookResource
extends Object

Outlook Resource

For each outlook class, a outlook resource class exists. Here we implement methods to get save versions of the classes, map them to RDFS, etc. Also the real extraction process happens here. It would be bad to have each resourceWrapper in its own file, too many files, so this is for shortness of code.

Copyright: Copyright (c) 2003

Organisation: Gnowsis.com

Version:
$Id: OutlookResource.java 2149 2009-12-03 16:05:12Z leo_sauermann $
Author:
Leo Sauermann (leo@gnowsis.com)

Nested Class Summary
static class OutlookResource.Appointment
           Copyright: Copyright (c) 2003 Organisation: Gnowsis.com
static class OutlookResource.Calendar
          wraps an outlook calendar folder as vcalendar - leap of faith to do this.
static class OutlookResource.Contact
           
static class OutlookResource.DistList
           
static class OutlookResource.Document
           
static class OutlookResource.Folder
           
static class OutlookResource.Mail
           
static class OutlookResource.Note
           
static class OutlookResource.OutlookResourceSave
          a OutlookResource that has a "save" object from redemption.
static class OutlookResource.RootFolder
           
static class OutlookResource.Task
           
 
Constructor Summary
protected OutlookResource(OutlookCrawler crawler, com.jacob.com.Dispatch resource, String itemType)
          Special constructor for subclasses for a little convenience. argh, in Delphi i would have done this even easier.
protected OutlookResource(OutlookCrawler crawler, String uri, com.jacob.com.Dispatch resource, String itemType)
          Normal constructor with url and resource.
 
Method Summary
 void addData(RDFContainer rdf)
          Add the data about this object.
protected  void addDateIfNotNull(RDFContainer rdf, URI property, com.jacob.com.Dispatch resource, String dispName)
          END OF OutlookResource ******************************
protected abstract  void addDetailData(RDFContainer rdf)
          Add the detail data about this object.
protected  void addEmailAddressIfNotNull(Model model, Resource parentNode, com.jacob.com.Dispatch resource, String dispName)
           
protected  void addNcalDateTimeIfNotNull(RDFContainer rdf, URI property, com.jacob.com.Dispatch resource, String dispName)
           
protected  void addPropertyIfNotNull(RDFContainer rdf, URI property, com.jacob.com.Dispatch disp, String dispName)
          protected helper method.
protected  void addRecipientsIfNotNull(RDFContainer rdf, com.jacob.com.Dispatch resource, String dispName, OutlookResource parentResource)
          Add the recipients of an e-mail or an appointment
protected  void addStatement(RDFContainer rdf, Resource subject, URI predicate, Node object)
           
protected  void addStatement(RDFContainer rdf, Resource subject, URI predicate, String label)
           
protected  void addStatement(RDFContainer rdf, Resource subject, URI predicate, String label, URI datatype)
           
protected  void addTelephoneNumberIfNotNull(Model model, Resource parentNode, com.jacob.com.Dispatch resource, String dispName, String comment, URI type)
           
static OutlookResource createWrapperFor(OutlookCrawler crawler, com.jacob.com.Dispatch resource, Logger logger)
          Factory method to create Wrappers. this looks at the passed Dispatch and sees what type it is and creates an according OutlookResource subclass
static OutlookResource createWrapperFor(OutlookCrawler crawler, String uri, Logger logger)
          create a outlook resource wrapper for a uri Parse the uri and return the resource wrapper or null, if uri points to nowhere This interface is primarily used to get the objects from the Jena/RDF side of the world
static OutlookResource.Folder createWrapperForFolder(OutlookCrawler crawler, com.jacob.com.Dispatch folder)
          Factory method to create Wrappers for Folder Dispatchs. this looks at the passed Dispatch and sees what type it is and creates an according OLFolder or other resource
static OutlookResource.Folder createWrapperForFolder(OutlookCrawler crawler, String itemId, String expectedItemType, Logger logger)
          Factory method to create Wrappers for Folder Dispatchs. this looks at the passed Dispatch and sees what type it is and creates an according OLFolder or other resource
protected  void finalize()
          finalizer for releasing the activeX //TODO This one runs in its own thread and is therefore dangerous to COM.
 DataObject getDataObjectIfModified(String url, DataSource source, AccessData accessData, Map params, RDFContainerFactory containerFactory)
           
protected  Date getDateOf(com.jacob.com.Dispatch disp, String dispName)
          protected helper method to extract literal values from Dispatchs
 String getItemType()
           
 long getLastModified()
          get the last modification time of this resource.
protected  String getLiteralOf(com.jacob.com.Dispatch disp, String dispName)
          protected helper method to extract literal values from Dispatchs
 OutlookCrawler getOLCrawler()
          get the crawler that hosts this resource
 com.jacob.com.Dispatch getResource()
           
abstract  URI getType()
           
 String getUri()
           
 boolean isFolder()
           
 void release()
          release
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutlookResource

protected OutlookResource(OutlookCrawler crawler,
                          com.jacob.com.Dispatch resource,
                          String itemType)
Special constructor for subclasses for a little convenience. argh, in Delphi i would have done this even easier.

Parameters:
crawler - crawler
resource - Outlook resource that has to implement "EntryID" for identifier
itemType - itemtype for path
Throws:
Exception

OutlookResource

protected OutlookResource(OutlookCrawler crawler,
                          String uri,
                          com.jacob.com.Dispatch resource,
                          String itemType)
Normal constructor with url and resource. Subclasses have to build the url themselves

Parameters:
crawler - Crawlercrawler
uri - uri of the resource
resource - object of the resource
itemType - itemtype for path
Throws:
Exception
Method Detail

createWrapperFor

public static OutlookResource createWrapperFor(OutlookCrawler crawler,
                                               com.jacob.com.Dispatch resource,
                                               Logger logger)
Factory method to create Wrappers. this looks at the passed Dispatch and sees what type it is and creates an according OutlookResource subclass

Returns:
the wrapper or null, if the resource cannot be wrapped.

createWrapperFor

public static OutlookResource createWrapperFor(OutlookCrawler crawler,
                                               String uri,
                                               Logger logger)
create a outlook resource wrapper for a uri Parse the uri and return the resource wrapper or null, if uri points to nowhere This interface is primarily used to get the objects from the Jena/RDF side of the world

Returns:
Resourcewrapper or null

createWrapperForFolder

public static OutlookResource.Folder createWrapperForFolder(OutlookCrawler crawler,
                                                            com.jacob.com.Dispatch folder)
Factory method to create Wrappers for Folder Dispatchs. this looks at the passed Dispatch and sees what type it is and creates an according OLFolder or other resource


createWrapperForFolder

public static OutlookResource.Folder createWrapperForFolder(OutlookCrawler crawler,
                                                            String itemId,
                                                            String expectedItemType,
                                                            Logger logger)
                                                     throws Exception
Factory method to create Wrappers for Folder Dispatchs. this looks at the passed Dispatch and sees what type it is and creates an according OLFolder or other resource

Throws:
Exception

addData

public void addData(RDFContainer rdf)
             throws IOException
Add the data about this object. This adds basic data (such as the ItemId) and then calls addDetailData to get the individual data special for the subclasses.

Parameters:
rdf - the container to add the rdf to
Throws:
IOException - if reading is not possible

addDetailData

protected abstract void addDetailData(RDFContainer rdf)
                               throws IOException
Add the detail data about this object.

Parameters:
rdf - the container to add the rdf to
Throws:
IOException - if reading is not possible

addDateIfNotNull

protected void addDateIfNotNull(RDFContainer rdf,
                                URI property,
                                com.jacob.com.Dispatch resource,
                                String dispName)
END OF OutlookResource ******************************


addNcalDateTimeIfNotNull

protected void addNcalDateTimeIfNotNull(RDFContainer rdf,
                                        URI property,
                                        com.jacob.com.Dispatch resource,
                                        String dispName)

addEmailAddressIfNotNull

protected void addEmailAddressIfNotNull(Model model,
                                        Resource parentNode,
                                        com.jacob.com.Dispatch resource,
                                        String dispName)

addTelephoneNumberIfNotNull

protected void addTelephoneNumberIfNotNull(Model model,
                                           Resource parentNode,
                                           com.jacob.com.Dispatch resource,
                                           String dispName,
                                           String comment,
                                           URI type)

addPropertyIfNotNull

protected void addPropertyIfNotNull(RDFContainer rdf,
                                    URI property,
                                    com.jacob.com.Dispatch disp,
                                    String dispName)
protected helper method. Extract the value of the DispName from the disp d. If it is not null, create a new triple of the resource r with (r,p, (string)).


addStatement

protected void addStatement(RDFContainer rdf,
                            Resource subject,
                            URI predicate,
                            String label,
                            URI datatype)

addStatement

protected void addStatement(RDFContainer rdf,
                            Resource subject,
                            URI predicate,
                            String label)

addStatement

protected void addStatement(RDFContainer rdf,
                            Resource subject,
                            URI predicate,
                            Node object)

addRecipientsIfNotNull

protected void addRecipientsIfNotNull(RDFContainer rdf,
                                      com.jacob.com.Dispatch resource,
                                      String dispName,
                                      OutlookResource parentResource)
Add the recipients of an e-mail or an appointment

Parameters:
rdf - the parent rdf container. Properties will be added linked to this URI
parentResource - the parent node to add to
resource - the recipients resource
dispName - diplay name

finalize

protected void finalize()
                 throws Throwable
finalizer for releasing the activeX //TODO This one runs in its own thread and is therefore dangerous to COM. I had to comment out the release method. Perhaps I will come up with a solution sometime

Overrides:
finalize in class Object
Throws:
Throwable

getDataObjectIfModified

public DataObject getDataObjectIfModified(String url,
                                          DataSource source,
                                          AccessData accessData,
                                          Map params,
                                          RDFContainerFactory containerFactory)
                                   throws UrlNotFoundException,
                                          IOException
Throws:
UrlNotFoundException
IOException

getDateOf

protected Date getDateOf(com.jacob.com.Dispatch disp,
                         String dispName)
protected helper method to extract literal values from Dispatchs

Parameters:
disp - the Dispatch Object to extract from
dispName -
Returns:
a string or null if the string cannot be returned

getItemType

public String getItemType()

getLastModified

public long getLastModified()
get the last modification time of this resource. Return the standard Java date value (milliseconds since epoch)


getLiteralOf

protected String getLiteralOf(com.jacob.com.Dispatch disp,
                              String dispName)
protected helper method to extract literal values from Dispatchs

Parameters:
disp - the Dispatch Object to extract from
dispName -
Returns:
a string or null if the string cannot be returned

getOLCrawler

public OutlookCrawler getOLCrawler()
get the crawler that hosts this resource

Returns:
the crawler that hosts this resource

getResource

public com.jacob.com.Dispatch getResource()

getType

public abstract URI getType()

getUri

public String getUri()

isFolder

public boolean isFolder()

release

public void release()
release



Copyright © 2010 Aperture Development Team. All Rights Reserved.