cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure Scheduler task

Former Member
0 Kudos
50

Hello,

I'd like to configure Scheduler task with properties. I know that it is possible when service implements IService.

Interface com.sap.netweaver.rf.wrapper.IRFServiceWrapper extends IService and and class RFServiceWrapper implements that IRFServiceWrapper.

So I think I can configure portalapp.xml describing service RFServiceWrapper with properties. But I don't know how to pass fetched values of properties from that RFServiceWrapper to my scheduler task class, which implements ISchedulerTask (exteds java.lang.Object).

I appreciate any ideas.

Best regards,

Josef Motl

Accepted Solutions (0)

Answers (1)

Answers (1)

detlev_beutner
Active Contributor
0 Kudos

Hi Josef,

first, I would suggest to configure your own scheduler task via a configuration definition within the confif archive. That way, you can configure the task "where it is defined". See the great new PDF https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3cd2cfbb-0601-0010-3984-d0c... from it's page 65 on...

Second, anyhow, you could go the way you suggested, even if somewhat you'd misuse the RFServiceWrapper. Anyhow, you can call a service and it's properties generally the following way:

PortalRuntime.getRuntimeResources().getService(IRFServiceWrapper.KEY).getContext().getServiceProfile();

from here on everything should be straight forward, see https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/javadocs/nw04/sp12... runtime/com/sapportals/portal/prt/service/iserviceprofile.html for details.

Hope it helps

Detlev

Former Member
0 Kudos

Hi Detlev,

thank you, .pdf you mentioned helped me. But I have problem when deploying scheduler task par containing new version of config files to portal.

Firstly I deployed par without .co.xml and .cc.xml files to erase config of scheduler task. After that I deployed par with folowing files:

cz.pct.TSNotification.cc.xml


<ConfigClass name="cz.pct.TSNotification"  extends="SchedulerTask">
 <attribute name="class" type="class" constant="cz.pct.TSNotification"/>
 <attribute name="name" type="string"/>
 <attribute name="active" type="boolean"/>
 <attribute name="description" type="string"/>
 <attribute name="smtp_server" type="string"/>
</ConfigClass>

cz.pct.TSNotification.co.xml


<?xml version="1.0"  encoding="UTF-8" ?>
<Configurable configclass="cz.pct.TSNotification">
 <property name="name" value="Timesheet Scheduler Task" />
 <property name="active" value="true" />
 <property name="description" value="Scheduler task for Timesheet notifications" />
 <property name="smtp_server" value="mail2.pct.cz" />
</Configurable>

.. but it didn't appear in task scheduler configuration iView. What's wrong?

Best regards,

Josef Motl

Former Member
0 Kudos

Hi Detlev,

with my older cz.pct.TSNotification.cc.xml file:


<ConfigClass name="cz.pct.TSNotification"  extends="SchedulerTask">
 <attribute name="class" type="class" constant="cz.pct.TSNotification"/>
 <attribute name="smtp_server" type="string"/>
</ConfigClass>

.. I put scheduler task to run.. but, when I tried to access service as you described, I get an error:

com.sapportals.portal.prt.service.ServiceException: Service not found: cz.pct.TSNotification

(cz.pct.TSNotification is key of my RFServiceWrapper).

What's wrong?

Best regards,

Josef Motl

Former Member
0 Kudos

Hi Josef,

I have the same problem. How did you resolve it?

Thanks a lot.

Iryna