Sitemap

Amicuk Programming Answers

Using the ITimebasedPublishEvent.EVENT_TYPE_STOP for a repository service

-0001-11-30   Views:0

Advertisement

Hi Expert, corresponding the the thread "https://forums.sdn.sap.com/thread.jspa?threadID=789842&tstart=0" I want to implement a repository service, which started when the validto date in the lifetime properiy is exceeded. For this case I ins

Hi Expert,
corresponding the the thread "https://forums.sdn.sap.com/thread.jspa?threadID=789842&tstart=0" I want to implement a repository service, which started when the validto date in the lifetime properiy is exceeded.
For this case I inserted in the method "received" an If-Clausel which should catch this event, like this:
public void received(IEvent event) {
     IResourceEvent myEvent = (IResourceEvent) event;
     IResource res = myEvent.getResource();
     if (event.getType() == ITimebasedPublishEvent.EVENT_TYPE_STOP ) {
Do I have to change something in the "addRepositoryAssignment" and/or "removeRepositoryAssignment"? Or in general?
Thanks in Advanced!
Best regards and a nice WE!
Markus

The replay answer
Advertisement
Hi Praveen,
you are right. I found an event "EVENT_TYPE_STOP_TEMPLATE" in the "TimebasedPublishEvent" class, which solve my syntax error.
Now, I have the problem that the service is never running. From the coding perspective it looks right now ok for me.
Do you have to make same changes in the settings samewhere?
Any ideas?
Best regards,
Markus
My Coding for the repository service looks like this right now:
public class DeleteFile extends AbstractRepositoryService implements IReconfigurable, IResourceEventReceiver {
  private static final String TYPE = "ACC_DeleteFile";
  private Collection repositoryManagers;
  public DeleteFile() {
     super();
     // Do not add code here. Add it to startUpImpl() instead
  public String getServiceType() {
     return DeleteFile.TYPE;
  protected void startUpImpl(Collection repositoryManagers) throws ConfigurationException, StartupException {
     // implement this method as follows:
     // - Verify configuration data
     // - Get references to other needed (global) services
     // - Check whether other repository services (this service depends on) are also assigned to the repository managers
     // - Usually the service registers itself for certain events at all repository managers
     this.repositoryManagers = repositoryManagers;
     Iterator it = repositoryManagers.iterator();
     while (it.hasNext()) {
          try {
               addRepositoryAssignment((IRepositoryManager) it.next());
          } catch (ServiceNotAvailableException e) {
               throw new StartupException(e.getMessage(), e);
  protected void shutDownImpl() {
     Iterator it = repositoryManagers.iterator();
       while (it.hasNext()) {
            try {
                 removeRepositoryAssignment((IRepositoryManager) it.next());
            } catch (WcmException e) {
                 e.printStackTrace();
  protected void addRepositoryAssignment(IRepositoryManager mgr) throws ServiceNotAvailableException {
     // Implement this method: Usually the service registers itself for certain events at the repository manager.
     try {
          mgr.getEventBroker().register( this, TimebasedPublishEvent.EVENT_TYPE_STOP_TEMPLATE);
     } catch (Exception e) {
          e.printStackTrace();
  protected void removeRepositoryAssignment(IRepositoryManager mgr) throws WcmException {
     // Implement this method: Usually the service must unregister itself as an event handler.
     mgr.getEventBroker().unregister( this, TimebasedPublishEvent.EVENT_TYPE_STOP_TEMPLATE);
  public void reconfigure(IConfiguration config) throws ConfigurationException {
     this.stateHandler.preReconfigure();
     // check the new configuration data
     try {
     catch (ConfigurationException ex) {
       this.stateHandler.postReconfigure(ex);
       throw ex;
     this.config = config;
     this.stateHandler.postReconfigure();
  public void received(IEvent event) {
     com.sapportals.portal.prt.logger.ILogger logger = com.sapportals.portal.prt.runtime.PortalRuntime.getLogger();
     logger.severe(TYPE, "Start ACCDeleteFile");
     IResourceEvent myEvent = (IResourceEvent) event;
     IResource res = myEvent.getResource();
     if (event.getType() == ITimebasedPublishEvent.EVENT_TYPE_STOP ) {
          try {                    
               IRepositoryServiceFactory repServiceFactory = ResourceFactory.getInstance().getServiceFactory();
               IRepositoryService repositoryService =      repServiceFactory.getRepositoryService( res, IWcmConst.TIMEBASED_PUBLISH_SERVICE);
               ITimebasedPublishServiceManager tpbService = (ITimebasedPublishServiceManager) repositoryService;
               Date actualDate = new Date();
               Date validTo = new Date();
               validTo = tpbService.readInvalidDate(res);
               if(actualDate.getTime() < validTo.getTime()){
                    res.delete();               
          } catch (Exception e) {
               e.printStackTrace();
     logger.severe(TYPE, "End ACCDeleteFile");

Go to See the other 8 answers

Using the ITimebasedPublishEvent.EVENT_TYPE_STOP for a repository service

Category:DefaultRelease time:-0001-11-30Views:130

Hi Expert, corresponding the the thread "https://forums.sdn.sap.com/thread.jspa?threadID=789842&tstart=0" I want to implement a repository service, which started when the validto date in the lifetime properiy is exceeded. For this case I ins[More]

Error while creating Repository Service in informatica

Category:DefaultRelease time:2015-10-11Views:130

Hi Guys, When i try to create repository service informatica8.1.1.I'm getting the below error driverconnect.exe has encountered a problem and needs to close.We are sorry for the inconvenience.since your error message is not completely represented ove[More]

Error while creating Informatica Repository Service

Category:DefaultRelease time:2015-10-11Views:130

I am installing OBIApps - Have done it previously so I know it is a complex installation. This time my server is a Linux RH 64bit... Informatica server installed ok. Using the administrator panel, I am now trying to create the repository service. I a[More]

Getting WCMException while configuring a repository service

Category:DefaultRelease time:2015-10-11Views:130

Hi KM Experts, I wrote a program to create a repository service, to start the approval process automatically, and select it for the required repository manager. I restarted the servlet engine, but still the status of newly added document is 'In Progr[More]

KM Repository Service for creating a folder structure

Category:DefaultRelease time:2015-10-11Views:130

Hi All,    We have a requirement in KM. Whenever a folder is created inside a folder (say '/documents/testFolder') ... .. a couple of subFolders need to be created inside this new folder. For example, if the new folder's name being created is <i>par[More]

Informatica 9.0.1 Repository Service Shutdown Error when Running ETL in DAC

Category:DefaultRelease time:2015-10-11Views:130

Hi All, When I executed the ETL in DAC client for full data load, I got this error from log "PLP_LoyMemberTierMovementQtrAggr.log". "Failed to connect to the repository on Host : hkhgc01dvapp01, Port : 6315. System Error (errno = 111): Conn[More]

EJB called via JNDI in a Repository Service :: ClassCastException

Category:DefaultRelease time:2015-10-11Views:130

Hi SDN, I've got a problem in calling an EJB from a Repository Service... Here the steps I've follow:   -  An EJB has been created with some Business Methods in it; it has been packaged in an EAR and deployed;   -  This EJB is looked up succesfully v[More]

Hot to retrieve an authenticated user for JCA in a repository service?

Category:DefaultRelease time:2015-10-11Views:130

Hi, I implemented a repository service wich calls an ABAP Functionmodule via JCA and RFC. This connection has to be build up with the current logged in user. But how can I get an authenticated ep6-user in the repository service received-event? Or is[More]

Com.sapportals.wcm.repository.service.statemanagement.IResourceTransition

Category:DefaultRelease time:2015-10-11Views:130

Hi all, I am trying to import com.sapportals.wcm.repository.service.statemanagement.IResourceTransition; But i am getting class cannot be resolved error.....can anybody tell me where can i find the missing plugin for the above class.??... i used clas[More]

Problem in KM Repository Service

Category:DefaultRelease time:-0001-11-30Views:130

hi Experts, I have created KM repository Service by Following this weblog, <a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2654">https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2654</a> Finally i have assigned My[More]

How to get Resource Name in the Repository Service when Publish evt trigger

Category:DefaultRelease time:-0001-11-30Views:130

Hi , I have created a repository service in which I have registered the StatemanagementEvent.PUBLISH My requirement is I need to know which resource rather resource name triggered this event. This is the code which public class ApprovProcs extends Ab[More]

Hot
Hello All, Belatted Happy New Year 2011 to all. I have a question related to Sale Order Costing. It goes like this, My client is into Pipe coating business who receives the pipe from the customers, coats it as per there requirements and despatches it [More]
I had recently activated iCloud. I have it set not to copy my photos or data, but only settings and a few other categories. I opened it offline in Preview to quickly view photos on memory cards. I found it slow, with a drop down box periodically flas [More]
Hello all, I hope one of you might be able to help me with a problem. I recently just moved to a different apartment, and my router (from my local internet provider) does not reach to all the rooms in the apartment. Since I also wanted to stream wire [More]
I've spent a few hours googling and trying out various things - all listed below. I give up - any ideas??? OS: Windows 8.1 64bit Memory: 32GB WebCam: Microsoft VX-7000. As per subject - the webcam works with the "Camera" app but not with Skype f [More]
Dear All As I am new to Java Can you post java code for how to connect mutliple database (I am using Oracle database) with one class or method and the Connection con object I want use in my jsp to get connected and obtain result for response. Can you [More]
Can I change to the new promotion for student/teacher from a premiere single app membership? I have already been cleared as a Teacher for my purchase of Lightroom.Cancel what you have and buy new Cancel http://helpx.adobe.com/x-productkb/policy-prici [More]
HiPlease don't make multiple posts, your question has been answered in your other thread. I have imported my music from my iPhone to my Mac book pro. The problem is that now I can't listen to it. It's stating that my computer is not authorized. How c [More]
Hello Expert,               When i pass condition base value to smart form that it show perfect. if the value of that filed is zero than its showing 0.00 but the requirement  that 0.00 also clear nothing to show on output.Hello, Just keep a check in [More]
When trying to post I just got the stack trace below. Clicking back and post again and it worked. I will submit this report to the feedback form but if desired in future I can just throw it right in my recycle bin and save everyone a lot of trouble. [More]
We're using Transactional Replication in SQL 2008R2 SP2 I'm trying to evaluate whether using a HistoryVerbose setting of 0 on the Log Reader and Distribution agents is a worthwhile modification to make, but still need to know Latency in these agents [More]