Topic
  • 3 replies
  • Latest Post - ‏2011-08-29T05:19:29Z by tinagaki
Gaurav_Singhal
Gaurav_Singhal
24 Posts

Pinned topic Connection with Filenet P8 from custom crawler plugin for Filenet P8/

‏2011-08-26T09:54:22Z |
I want to access Filenet P8 4.5 from "custom crawler plugin for FilenetP8". It is required to fetch some information from filenet repositry for each crawled document and add it to the metadata of the document.

Can any one tell me how can we make this connection?

I need to access the document class for each crawled document.Is there any way to find document class from the crawled data.

Thanks in advance
Updated on 2011-08-29T05:19:29Z at 2011-08-29T05:19:29Z by tinagaki
  • tinagaki
    tinagaki
    7 Posts

    Re: Connection with Filenet P8 from custom crawler plugin for Filenet P8/

    ‏2011-08-29T04:02:36Z  
    Hello,

    an URI of crawled document is composed of Server name, Object store name, document ID and element number.
    See: http://publib.boulder.ibm.com/infocenter/discover/v9r1m0/topic/com.ibm.discovery.es.ad.doc/iiysauriform.htm

    In a crawler plugin, you can obtain an URI of every document as

    public CrawledData updateDocument(CrawledData data) throws CrawlerPluginException {
    String uri = data.getURI();

    then decode the uri which is URL encoded, parse it to extract a doc ID.
    Once you know a doc ID, you can obtain entire info associated to that document including class definition by using the CEClient API.
  • Gaurav_Singhal
    Gaurav_Singhal
    24 Posts

    Re: Connection with Filenet P8 from custom crawler plugin for Filenet P8/

    ‏2011-08-29T04:54:28Z  
    • tinagaki
    • ‏2011-08-29T04:02:36Z
    Hello,

    an URI of crawled document is composed of Server name, Object store name, document ID and element number.
    See: http://publib.boulder.ibm.com/infocenter/discover/v9r1m0/topic/com.ibm.discovery.es.ad.doc/iiysauriform.htm

    In a crawler plugin, you can obtain an URI of every document as

    public CrawledData updateDocument(CrawledData data) throws CrawlerPluginException {
    String uri = data.getURI();

    then decode the uri which is URL encoded, parse it to extract a doc ID.
    Once you know a doc ID, you can obtain entire info associated to that document including class definition by using the CEClient API.
    Thanx for your response.
    I am trying the same way that first get document URI and then use CE api to fech the document class of each document.But when i try to make a connection with CE the it throw an error.

    If you have tried making connection with CE in Filenet P8 custom plugin then please share the code and any configuration if required.

    Code i am using to make connection with CE run fine when i run it as eclipse application but when i add this code to crawler plugin it fails.

    Thanks
  • tinagaki
    tinagaki
    7 Posts

    Re: Connection with Filenet P8 from custom crawler plugin for Filenet P8/

    ‏2011-08-29T05:19:29Z  
    Thanx for your response.
    I am trying the same way that first get document URI and then use CE api to fech the document class of each document.But when i try to make a connection with CE the it throw an error.

    If you have tried making connection with CE in Filenet P8 custom plugin then please share the code and any configuration if required.

    Code i am using to make connection with CE run fine when i run it as eclipse application but when i add this code to crawler plugin it fails.

    Thanks
    Hi,

    Plugin code is called from multiple threads and Subject should be set in UserContext of every threads. Code should be like this:

    public class P8Plugin extends CrawlerPlugin {
    private String webServiceUrl;
    private String userName;
    private String userPassword;
    private Subject subject;
    private Connection nativeConnection;

    public void init() throws CrawlerPluginException {
    readConfigAndInitConnection();
    }
    public void term() throws CrawlerPluginException {
    }
    public CrawledData updateDocument(CrawledData data) throws CrawlerPluginException {
    ensureUc();
    ...
    return data;
    }
    private void readConfigAndInitConnection() {
    this.webServiceUrl = "http://p8CEServer:9080/wsi/FNCEWS40MTOM/";
    this.userName = "user";
    this.userPassword = "password";
    try {
    this.nativeConnection = Factory.Connection.getConnection(this.webServiceUrl);
    UserContext uc = UserContext.get();
    this.subject = UserContext.createSubject(this.nativeConnection, this.userName, this.userPassword, "FileNetP8WSI");
    uc.pushSubject(subject);
    } catch (Exception e) {
    }
    }
    private void ensureUc() {
    UserContext uc = UserContext.get();
    if(uc.getSubject()==null) {
    uc.pushSubject(this.subject);
    }
    }
    }