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
I just bought a RC aircraft game that has a multiplayer online game mode. I have to use a Static IP address and have a port range between 61234 and 61241. Simple enough I guess, if you know what you"re doing. Here are the prolbems I am running into. [More]
Problem: <b>Business needs to limit the validity of certain cost elements to 31st March 2007. But not able to do the same due to updation of Tables COKA,COSP and their dependent Tables.</b> Reason: The business is currently in fiscal year 2007 [More]
Hello , i have the game fifa by ea sport but is not compatibile with mac. How can i make it work with mac?If you bought it for windows or an ios device it will not work on a mac. You need the Mac versionRead other 2 answers [More]
Hi, I am using Solaris 10 on N440, 4CPU machine and java 1.5. In my code there is a server socket listener thread. On new connection a worker thread is assigned to it. This worker thread simply reads data from the connection socket and put on a queue [More]
I have a large catalog that I am putting on the web and I want people who have a slow connection to know that the file is still loading. Is there a way to add a progress bar to my file in Indesign CS5 or must I bring it into flash to optain this feat [More]
I have a new Photosmart Premium C309(g-m) installed wirelessly on my home network.  All test pages print fine as do any other document s(Word, Excel, etc) but web pages or emails from my desktop computer do not print.  However, webpages from my lapto [More]
I have used JPublisher to create and SQLJ and now I am trying to figure out how to call the function that is included in it. I am attempting to populate the standard WHO fields for a custom table. Maybe there is an easier way to do it. Thanks in Adva [More]
I need to be able to display a date and warning based on today's date minus 5 days but I cannot use the [TODAY] command in SP 2013.  I was told that you can set up a workflow that allows a refresh in the list.  Can anyone guide me to a "How To" [More]
Recently in the Bahamas where I helped a friend with his new iPad. We could not find Bahamas in initial setup so we used United States and could not enter Visa/MC billing address in Bahamas. iTunes rejected, billing info is not what's on file. What t [More]
Hi expert, I must to create a sales order in reference to a quatation. When I select the item, the system give me the open quantity. My problem is that I have a difference between the "Open quantity" and the real quantity of quotation. The offer [More]