Abandon publishing if dynamic location scheme generation fails

Apologies for the cryptic subject - I’m not sure how to summarise the issue into one line!

In the site folder assembly context within our location schemes we run some custom java code to build up the location scheme. The java code connects to a remote system as part of its processing to build the location scheme (some integration with a commerce environment going on, but I won’t confuse you with the details!).

Now, if for whatever reason our location scheme code fails, at the moment a PSExtensionException is thrown which fills the Percussion console with messages. The resulting URL in our assembled pages then becomes:

<a href="">link title here</a>

If we get problems like this we really don’t want out page to get published (as links on the page won’t go anywhere).

Is there any way we can tell the assembly process that something has gone wrong and the page that contains the failed location schemes shouldn’t get published. I suspect I know the answer to this but would like a second opinion. Although the location scheme fails, the template generation as such doesn’t, so in terms of publishing everything seems fine.

Failing that, I was thinking that if there was an error when generating the location scheme, we could log this somewhere. Then, at the end of our publishing edition, read the error log and determine if any location schemes failed. If so, then we do not run our rsync (or similar) process to replicate published content to the live webservers.

Does this sound reasonable?

Do you mean not publish any pages that link to the page that cannot be published because a location cannot be derived for the content item? If so, won’t this kill the whole web site, because publishing of the pages that link to those pages will have be skipped, and the pages that link to those, etc, etc, etc?

Andrew.

Andrew,

If I’m reading David’s posting correctly, you have the intended behavior reversed.

Here’s my understanding of David’s scenario:

Assume we have two Content Items, A and B. A includes a link to B. When A is published, the link is incorrectly generated. In that case, David does not want Content Item A to be published, but Content Item B should still be published. What you said was that Content Item A should be published and Content Item B should not be published.

Basically, it sounds like David is trying to prevent publishing of Content Items if they have a broken link.

Is there any way we can tell the assembly process that something has gone wrong and the page that contains the failed location schemes shouldn’t get published. I suspect I know the answer to this but would like a second opinion. Although the location scheme fails, the template generation as such doesn’t, so in terms of publishing everything seems fine.

I don’t think we can do what you propose. I assume you are working with a 6.x system and using JEXL location schemes. If the JEXL engine is able to process an expression and produce a result, it considers the result a success, even though the result is not the one you expect. Therefore, it does not report an error. Your idea of logging the result as an error will not work for the same reason.

One thought I have is that you might be able to implement a new publisher plugin that includes processing to scan the assembled Content Items and delete any that have a null value in the href attribute rather than publishing them.

RLJII