Skip to Content
author's profile photo Former Member
Former Member

creating KM Service

Hi all,

I'm trying to implement an own KM service in EP6 SP2.

It should repeatedly (about every 10 minutes) search for documents of some property in KM repository defined and then copy them into specified location/folder.

Now the service works fine, but some problems occurs when the EP is starting (<b>after EP restart the service hangs the portal</b>).

now I'll try to show some code:

<i>

public class MyService implements IMyService, Runnable {

.

.

.

try {

IResourceFactory m_Factory = ResourceFactory.getInstance();

if (m_Factory != null) {

IResourceContext context = m_Factory.getServiceContext("our_service_user");

if (context != null) {

RID aRid = RID.getRID(rootDir);

ICollection aCollection =(ICollection) m_Factory.getResource(aRid, context);

.

.

.

} catch (ResourceException e) {

...

</i>

When I deploy the service to the running portal it works fine. But when the portal is starting the service hangs at this line:

<i>IResourceContext context = m_Factory.getServiceContext("our_service_user");</i>

Maybe the KM is not initialized till now (it initializes when the user first uses a KM iview (com.sap.km.cm.navigation, ...)).

Does anybody know how to initialize the KM from the API?

Any hints?

Romano

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jun 23, 2004 at 03:49 PM

    Hi Romano,

    I'm trying to do something similar - how have you managed to get the service to run every 10 minutes? Did you use the Scheduler service or are you using a timer?

    Good luck,

    Rashad

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hmmm,

      I'm not sure I understand.

      In my service the init method looks like this:

      <i> public void init(IServiceContext context) {

      t = new Thread(this);

      t.setDaemon(true);

      t.start();

      }</i>

      I just start a new thread (don't ask why, but when I deploy this the "destroy" method kills the previous thread - I think 😉 - so no more than 1 instance of my service runs at one time (maybe it is not neccesary):

      <i> public void destroy() {

      t.stop();

      t = null;

      }</i>

      All the process comes in the method "run".

      Now I'm thinking about creating another service, which will periodically try to connect to portal to "raise" the KM and give the information about the success to my second - KM service.

      So any hints will be usefull.

      Romano

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.