publish trigger page url or site name

epalmer's Avatar

epalmer

25 Feb, 2015 02:32 PM

We are installing a new search engine and can update search indexes for pages when they are published. This would allow immediate search index updating which would be awesome.

We are thinking of creating a publish but would need to get access to this information (or some variant) of this information below. We want to know if this is possible.

The site name or the transport server directory
For each asset published
- asset id
- the path from the top of that site OR
- the url of that asset

Please let me know what is possible.

  1. 1 Posted by Ryan Griffith on 26 Feb, 2015 04:23 PM

    Ryan Griffith's Avatar

    Hi Eric,

    This should definitely be doable using a Publish Trigger.

    Specifically, for each asset that gets published during a publish job your publish trigger will be invoked for each available Output and Destination. Each time the trigger is invoked, you will have access to the following information:

    • entityType
    • entityId
    • entityPath
    • targetId (if in Global)
    • targetPath (if in Global)
    • destination (same as destinationId below)
    • transportId
    • destinationId
    • destinationName
    • pageConfigurationId
    • unpublish

    For the items you listed that are not immediately provided to you, you should be able to perform additional read operations using this information, such as the Site and Transport information.

    Here is a sample Docx publish trigger that demonstrates how to obtain Transport information. This should be able to get you started in terms performing read operations to obtain additional information.

    Please let me know if you have any questions.

    Thanks!

  2. 2 Posted by epalmer on 26 Feb, 2015 06:27 PM

    epalmer's Avatar

    Ryan

    this is awesome. I will work up some code in the next month to test this out.

    Chow
    Eric

    Eric Palmer
    Director of Web Services
    University of Richmond
    ________________________________

  3. 3 Posted by Ryan Griffith on 26 Feb, 2015 06:48 PM

    Ryan Griffith's Avatar

    Sounds good, Eric. I am glad to hear the Publish Trigger will be able to provide the information you need.

    I'm going to go ahead and close this discussion for now, but please feel free to comment or reply to re-open if you have any additional questions regarding the Publish Trigger.

    Have a great day!

  4. Ryan Griffith closed this discussion on 26 Feb, 2015 06:48 PM.

  5. epalmer re-opened this discussion on 27 Feb, 2015 04:18 PM

  6. 4 Posted by epalmer on 27 Feb, 2015 04:18 PM

    epalmer's Avatar

    I'm got the eclipse file and am looking at it. The KB page on publish triggers talks about an xml config file. I can find the place in cascade to upload a file but I can't find an example.

    Is there a video or something that I can follow to see how to use Pub triggers?

  7. 5 Posted by Ryan Griffith on 27 Feb, 2015 04:38 PM

    Ryan Griffith's Avatar

    My apologies for the confusion, Eric.

    If you are running Cascade Server 7.10 or newer, there is a "builder" form of sorts that will allow you to register the Publish Trigger by specifying the full class path/name and any parameters it uses. This builder can be found at System Menu -> Configuration -> Publish Triggers.

    If you are not on 7.10, the configuration XML will look as follows:

    <publish-triggers>
        <publish-trigger>
            <class-name>com.cms.publish.trigger.ClassName</class-name>
            <parameter name="param1">value1</parameter>
            <parameter name="param2">value2</parameter>
        </publish-trigger>
        ...
    </publish-triggers>
    

    Please let me know if you have any questions.

    Thanks!

  8. 6 Posted by epalmer on 02 Mar, 2015 06:50 PM

    epalmer's Avatar

    I am getting an error when using the builder.

    cascade version is 7.12.4 - 7510d
    /usr/lib/jvm/jre/bin/java -version
    java version "1.6.0_91"
    Java(TM) SE Runtime Environment (build 1.6.0_91-b31)
    Java HotSpot(TM) 64-Bit Server VM (build 20.91-b07, mixed mode)

    I am building the class with 1.6.0_65

    the error looks like

    javax.servlet.ServletException: Servlet execution threw an exception
    com.hannonhill.cascade.view.struts.request.SiteFilter.doFilter(SiteFilter.java:67)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    com.hannonhill.cascade.view.struts.security.AuthProtectFilter.doFilter(AuthProtectFilter.java:131)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    com.hannonhill.cascade.view.struts.request.ThreadLocalCacheFilter.doFilter(ThreadLocalCacheFilter.java:47)
    com.hannonhill.cascade.view.struts.request.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112)
    root cause

    java.lang.UnsupportedClassVersionError: edu/richmond/webservices/cascade/plugin/SimplePublishTrigger : Unsupported major.minor version 51.0 (unable to load class edu.richmond.webservices.cascade.plugin.SimplePublishTrigger)
    org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2822)
    org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1159)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1647)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    java.lang.Class.forName0(Native Method)
    java.lang.Class.forName(Class.java:170)
    com.hannonhill.cascade.model.publish.trigger.PublishTriggerConfiguration.parseClassName(PublishTriggerConfiguration.java:121)
    com.hannonhill.cascade.model.publish.trigger.PublishTriggerConfiguration.parseTrigger(PublishTriggerConfiguration.java:99)
    com.hannonhill.cascade.model.publish.trigger.PublishTriggerConfiguration.parseTriggers(PublishTriggerConfiguration.java:73)
    com.hannonhill.cascade.model.publish.trigger.PublishTriggerConfiguration.parseConfigurationDocument(PublishTriggerConfiguration.java:54)
    com.hannonhill.cascade.model.service.PublishTriggerConfigurationServiceImpl.updateConfiguration(PublishTriggerConfigurationServiceImpl.java:77)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    If the major version is the same do the minor versions have to match?

    Which version of Java should we be running cascade at? This is our test install and we will be going live with version 7.12.4 in May.

    Thanks

  9. 7 Posted by Ryan Griffith on 02 Mar, 2015 07:03 PM

    Ryan Griffith's Avatar

    Hm. That error does generally occur when the version of Java is not correct, but I wouldn't think a minor version would change things.

    My recommendation would be to try building the plugin with the same version of Java that Cascade Server is running on to rule that out.

    Please let me know if you have any questions.

    Thanks!

  10. Ryan Griffith closed this discussion on 11 Mar, 2015 07:21 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac