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
Options -> Text Editor -> C/C++ missing intellisense entry.  Intellisense not working.    Solutions to turn options for the editor off and on are not working.  The intellisense entry is present for other languages, such as C#, but not C/C++. By not [More]
Hi all, I have just bought a brand new iMac and a new Western Digital 1TB External Hard Drive to use Time Machine on. I have plugged it all in, done my first back up and it all went fine. Then, I turned off my computer and all the plugs to go to bed [More]
Hi Steve, i repeate my question, can you help me ? Can you show into my previous message "Last Post from March 15, 2000 02:27PM Syntax problem ...." Many thanks for your help ! AchimHi Steve, many thanks for your answer. Please forgive me for my [More]
I currently own a dell laptop & desktop PC. They're getting outdated so i'm looking for a new desktop I've been looking at the iMacs and i would reallllly like to get one (looking at 17" with superdrive). but the last time i used an apple was pro [More]
iPhone music will not respond to Play button after being paused. The same music is on my iPad and MacBook Pro without problems. Any suggestions about cause and solution.Do a Reset: Hold down the Sleep/Wake button and the Home button at the same time [More]
Hello, I just got a new Macbook and love it! But, the other day I tried out my Bluetooth headset and the A2DP headphone choice works great. But when I change it to headset for use with skype I can hear the person but all they hear is weird repeating [More]
I have purchased a Quicksilver 933 MgHz that starts to power up, but will not find the CD drive nor can it find the hard drive. The computer does not give the chime in starting up. The blue screen comes on with the smiling Mac folder alternating with [More]
Hello All, I am having some requirment to find the file name for the input provided parameter. In my program i am having an input parameter for file name. This contains both the file name and file stored location. Example : C:\Dokumente und Einstellu [More]
Will the upgraded Premiere Pro (to be released in June) support SLI? I see: "Adobe Premiere Pro can now take full advantage of computers with multiple GPU cards for significantly accelerated export times. Rendering and compression just got a whole lo [More]
I have an HP Pavilion a6000, recently upgraded to Windows 7. My internet connection has stopped working for no reason, but there is no error listed in Device Manager. To the best of my knowledge, the internet connection is set up correctly. I also ha [More]