By dynamic templates, I don't mean a dynamic URI. I mean the template itself which is assembled from pieces sitting in a database, transformed in various ways, has images inserted into it, etc. All this is done within my Camel Routes. The finished XSLT template is sitting in an exchange property and now I want to run the message body XML through that XSLT.
Unlike the XQuery component which provides a lot of flexibility, it seems that the template file must come from only an external source with the XSLT component. Am I forced to write it out as a file first?
Set the option contentCache=false then the template is re-read on each message. Then it can load eg from a file, where you can then update the file with new content as you want.
To add support for using bean or ref as the resource, so you can call a bean etc, is currently not supported but I logged a ticket so we will add that in a future release: https://issues.apache.org/jira/browse/CAMEL-11514
Related
I'm now to FrontEnd-Development with React.
To make sure having the maximum flexibility, I want to load some variables from a specific CustomConfigFile.
This file should be generated if it's not found and can be loaded and edited on the UI.
Can somebody tell me whether this is possible at all and give me an example?
There are three steps you need to do:
If you want to achieve something like that, you need to store those values either in a database or a file in the server, you can use JSON, XML or whatever format you want.
Your client needs to load this file at runtime, you can use fetch for this.
Now, for the editing part. You are going to need an endpoint you can call from your client, that is able to update those values in the database or in the file. You can use node.js, PHP, ruby or whatever backend language you are comfortable with.
That's the logic you need to implement, I've done it with React + Laravel + MySQL for this app: https://bleext.com/music people can change title, logo, language, the main menu, templates, and so many other things to customize the system.
I have some groovy code inside my AngularJs 1.5 component's template. As you might know,the component template property does not allow us to add any file except HTML file(or does it?),whereas the groovy code will not execute inside a HTML file. Is there any way to do this?
FYI, I have already tried using component transclusion but it does not serve the purpose well as it creates numerous child scopes(as I need multi-slot transclusion). When I need to access my controller(which I need to do very often) from inside the transcluded element the only possible way I came across was using the required numbers of $parent, which does not look great at all.
whereas the groovy code will not execute inside a HTML file. Is there
any way to do this?
Not really, no. In theory it could be done, but someone would have to build a technology to support that.
I'm just getting started writing plugins for Jenkins, and I'm having trouble making much headway in the exceptionally terse documentation I've been able to find for it. The main thing I'm trying to do is generate dynamic content to place on the top-level page for a particular Project. Specifically, I want to show some content that is derived from the most recent build of the Project.
Based on the skeleton project and the HTMLPublisher plugin, I've been able to create a Publisher plugin that creates an Action with getProjectActions, and that Action has a floatingBox.jelly view, whose contents are rendered at the top of the Project page. So far, so good.
Now I want to make that content dynamic. For instance, my Publisher plugin might generate some HTML content as a post-build step, and I want to display this HTML (from the latest build) at the top of the Project page. Or (more likely), I'll want to generate some HTML based on all builds, and display that (e.g., a plot showing some some kind of "quality mesaurement" for each of the last N builds).
I'm brand new to maven and jelly, and quite new to Jenkins for that matter, so any help would be useful.
Update
I've found that I can use ${it} inside my jelly scripts to access the Project object, but can I then access my Publisher instance from there, in order to invoke some methods on it to generate the content?
The only thing I've come up with so far is to iterate over the list of publishers provided by getPublishersList() on the Project object, and look for one whose class name matches my class. I can't find a way to do instanceof in jelly script.
<j:forEach items="${it.publishersList}" var="pub">
<j:if test='${pub.class.name == "com.example.myPluginName.myPublisherClassName"}'>
<!-- ${pub} is my Publisher instance, I can now invoke methods on it. -->
</j:if>
</j:forEach>
Alternatively, if you use jobMain.jelly instead of floatingBox.jelly, in that case ${it} is the Action itself.
I am trying to use the Configure class in CakePHP, but I'm not sure if I am using it correctly. I have read through the cook book and the API, but I can't seem to do what I want.
I have created a configuration file: app/config/config.php. I can directly edit this file and set variables in there and access them using Configure::read().
Is it possible to update the values of the configuration file from the application itself, i.e., from a controller? I have tried using Configure::write(), but this does not seem to change the value.
app/config/config.php isn't a file that's automatically loaded by Cake. Either move these variables into app/config/bootstrap.php or tell your bootstrap.php file to load your custom file. You could also put your variables in app/config/core.php, but I'd recommend against that. I tend to like leaving that file alone and adding/overwriting values in bootstrap.php.
According to the API, Configure is supposed to be used "for managing runtime configuration information".
You can use its methods to create, read, update and delete (CRUD) configuration variables at runtime. The Configure class is available everywhere in your CakePHP application and therefore CRUD operations performed on its data in any place, including a controller.
If you are looking for persistent storage, you could consider a database (SQL or NoSQL). I would not recommend using a text file, as it raises a lot of security concerns. Even if security is not an issue, a database is propably a more fitting solution.
More on the Configure class in the Cookbook.
Within a Silverlight library, I need to validate incoming XML against a schema. The schema is composed of 5 interdependent .xsd files; the main file uses "xs:import" to reference all of the others, and there are other references among them.
Assuming that the .xsd files need to be distributed with the library (i.e. not hosted on some well-known external URL), how should I structure my project to include them?
I have found that I can embed them in the library project with build type "Resource" and then load them (individually) using Application.GetResourceStream() and a relative URI with the ";content" flag in it. But if I take this approach, can I validate against the interdependent set of 5 files? What happens when the schema parser tries to resolve the interdependencies?
Or should I embed them with build type "Content" and access the main one with some other sort of URL?
Or???
To summarize: how should I use these 5 .xsd files in my project so that I will be able to validate XML against them?
EDIT: It's not clear whether it's even possible to validate in Silverlight. I spun off a related question.
I cannot say much about Silverlight limitations with respect to validation, but the question itself is more generic - one might want to store .xsd files as resources in a desktop .NET application, for example - so I will answer that part.
You can have full control over resolution of URIs in xs:import by means of XmlSchemaSet.XmlResolver property. Just create your own subclass of XmlResolver, override GetEntity() method, and implement it using GetResourceStream(), or GetManifestResourceStream(), or whichever other way you prefer.