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
Is it possible to home share between two different accounts on the same computer? On my son's account, iTunes for some reason won't connect to the iTunes Store.  So I would like to enable him to purchase stuff on my account and then use home share to [More]
I have forgotten the answers of security questions and the line of "forgot your answers? send reset security info email to ......." how can i reset them?Security questions: https://discussions.apple.com/docs/DOC-4551 http://support.apple.com/kb/ [More]
Hi, I would like to add a ssd drive to my macbook pro retina 13", but i dont know if it will work / if the size is good. The one i wanted to buy : http://www.cdiscountpro.com/informatique/ssd/samsung-produits-samsung-disque-dur -ssd-mz7pd512bweu-p120 [More]
Hi, I am trying to do a Read-Only Snapshot replication.I set the global_names initialization parameter to false on both master and snapshot sites.I also renamed the global_name to <db_name>.world.Then,i created database link from snapshot site to ma [More]
I have created a function module within DSAVE event in BDT so the Sales Area BILLING BLOCK REASON could be updated with a fixed value according to the Sales Area selected by the user. That worked all right using the standard function module CRM_BUPA_ [More]
Hi! Frank, Could you tell me if panelPage component can be customised? Can we Extend the panelPage,i.e Can we create more facets to the panelPage Component,than what are already provided? Suppose, the panelPage component has the content that goes to [More]
Hi All, This issue is driving me crazy! I have checked internet settings(tools > manage add ons > disabled adobe add on so it will open directly to adobe reader rather than the IE viewer.) under Adobe (edit > preferences > internet > box fo [More]
Dear All, I have a requirement where i need to read the source code of a report into an internal table along with the line number. We have READ REPORT programname INTO tablename but in this case i will get only the source code. Ex : If the source cod [More]
I need to sync my iphone.  After I log in to ITunes, where do I find sync.  I am on a different computer than when I originally synced my phone so it is not coming up automatically.  Even with phone plugged in to computer.These links may be helpful. [More]
Hi As an applicant I want to assign myself to Talent group. I didnu2019t find how to assign. I have registered as external candidate and I created the profile and try to assign myself to a talent group but I didnu2019t find the way. Can you show me t [More]