About the ehcache generating the disk file name - ehcache

I added three types cache in ehcache as show below:
<cache name="oneDayCache" ...
<cache name="threeHourCache" ...
<cache name="oneHourCache" ...
<cache name="fifteenMinsCache" ...
but when I checked the file generated by ehcache in the disk, the file name is not pretty, charactors changed when meeting a capital.
one%0048our%0043ache.data
....

That's a feature, because Ehcache cannot be sure the underlying file system is case-sensitive while cache names are. If you really must have clean file names, do not camel case your cache names but instead use a separator such as _ or -.
More details can be found in net.sf.ehcache.DiskStorePathManager#safeName

Related

Using the command line to validate multiple DITA XSD 1.1 files (folder) using Saxon

When I run the Saxon command line to validate multiple DITA files:
a) using the -s option for a folder does not work.
b) using a wildcard for the files does, but is limited to a single topic type:
C:\Users\542470>java -cp C:\Tools\SaxonEE11-3J\saxon-ee-11.3.jar com.saxonica.Validate -catalog:C:\Tools\dita-schemas\catalog-dita.xml -xi:on -xsiloc:on -xsdversion:1.1 "C:\Tools\SaxonEE11-3J\garage\tasks\*"
Saxon license expires in 25 days
Warning at xs:import on line 42 column 73 of softwareDomain.xsd:
SXWN9018 The schema document at urn:oasis:names:tc:dita:xsd:xml.xsd:1.3 is not being read
because schema components for this namespace are already available
Warning at xs:import on line 42 column 73 of uiDomain.xsd:
SXWN9018 The schema document at urn:oasis:names:tc:dita:xsd:xml.xsd:1.3 is not being read
because schema components for this namespace are already available
Warning at xs:import on line 63 column 73 of commonElementMod.xsd:
SXWN9018 The schema document at urn:oasis:names:tc:dita:xsd:xml.xsd:1.3 is not being read
because schema components for this namespace are already available
Warning at xs:import on line 31 column 78 of topicMod.xsd:
SXWN9018 The schema document at urn:oasis:names:tc:dita:xsd:ditaarch.xsd:1.3 is not being
read because schema components for this namespace are already available. To force the
schema document to be read, set --multipleSchemaImports:on
Error on line 13 column 11 of garagetaskoverview.dita:
XQDY0084 One validation error was reported: Cannot validate <Q{}**concept**>: no element
declaration available
In this case, all the topics validated with no errors, but the topic was not recognized. I am using the DITA-OT/Oxygen garage DITA samples to test the command line. Validating a single DITA file causes no problems. This only occurs when mixing the DITA topic types in the same folder.
DITA topic types used:
<concept id="taskconcept" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:concept.xsd:1.3"
xml:lang="en-US">...
<task id="changeoil" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:oasis:names:tc:dita:xsd:task.xsd:1.3"
xml:lang="en-US">...
Note: Having thousands of files eliminates the option of listing the files to validate.
All the DITA XML Schemas are in no namespace, if Saxon has some kind of schema caching, once it loads the "urn:oasis:names:tc:dita:xsd:task.xsd:1.3" schema for the first validated task, it considers that for no namespace it already has a schema so it might re-use the schema for "task.xsd" to also validate the concept file.
I do not see a setting to avoid using this schema cache in the command line. Maybe you can try to iterate all files in the folder using a "for" loop in a Windows bat file and for each file run the validation process instead of running the validation on the entire folder.
You could also ask directly on the Saxonica users list for advice about this cache.
I'm not an expert on DITA, but I think that all the DITA schema modules are compatible with each other in the sense that you can combine any selection of modules into a single schema. For example, you could write a schema document that has xs:include's for any subset of DITA modules that you want to use. I would suggest using such a composite schema in the -xsd option to the Saxon validate command.
Alternatively, try using the option --multipleSchemaImports:on - this should cause Saxon to load a schema module for a particular namespace (or for the null namespace) even if it already has a schema module for that namespace loaded. (But note this can cause failures if two schema modules have overlapping definitions - I don't know if this applies to DITA.)
However, you're going to get more control over a task like this if you write a little Java application to invoke Saxon repeatedly, rather than trying to do everything in a single command from the command line.
I finally did a "for loop" in a batch file.
command-line:
batch-validate C:\XML-WORK\repair\DITA-xsd\topics > testlog.txt 2> testerrors.txt
batch file command:
for %%i in (*) do java com.saxonica.Validate -catalog:C:\Tools\dita-schemas\catalog-dita.xml -xi:on -xsiloc:on -xsdversion:1.1 %%i
Note: Set the classpath to Saxon and change Dir (CD) to the folder to be validated before running the batch file
It took over 3 hours to validate some 4,000 files. I was using a trial version of Saxon. If this is always the expected result, using a batch file is not feasible.

Liberty server properties file setup

I have properties file in local to which I am reading in code by below method
String pathOfFile = System.getProperties("arg.get.prop");
How to set this system properties to get my property file's path in liberty server.xml
You can specify environment variables in the server.env file placed either in ${wlp.install.dir}/etc/server.env or ${server.config.dir}/server.env. The server will also pick up variables from the current shell environment (server.env files take precedence). Then you can access the variables in the server.xml using the following notation:
${env.<variable name>}
For example, you can have the following in your server.env file:
HTTP_PORT=9001
and then in your server.xml:
<httpEndpoint id="defaultHttpEndpoint"
httpPort="${env.HTTP_PORT}"
httpsPort="9443" />
For more information on customizing the Liberty environment see: https://www.ibm.com/support/knowledgecenter/en/SSAW57_liberty/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/twlp_admin_customvars.html
If you need to define system property the recommended way is to use jvm.options file and put your property there like:
# Set a system property.
-Darg.get.prop=ExampleValue
you may need to create that file in the ${server.config.dir} directory. For some more details check Customizing the Liberty environment
if your property file is in "variable=value" format .. then, you can include in in bootstrap.properties file of your liberty install.
bootstrap.properties can be used to supply variable values to liberty configuration. you can include additional files by specifying
bootstrap.include=

Configuring Spring batch xml

Issue: Using spring batch, i need to read a file which has todays date. E.g test_02032015.txt.This file will be in a directory /test/example. Its an unix environment that i need to fetch file from.
question is how to configure spring batch xml so that above mentioned file is read
Any pointers to relevant website or solution would be of great help.
You have a few ways to address a requirement like this:
If you don't need to worry about the other files in a directory, you can just use a wild card in the file name like this:
<property name="resource" value="data/iosample/input/*.xml" />
Another alternative would be to pass the value into the job as a parameter and reference it like this:
<property name="resource" value="#{jobParameters['input.file']}" />
Finally you could use SpEL to build the file name (Sorry I don't have an example of that handy).

Load language file during joomla (2.5) system plugin installation

I'm having a real hard time showing a localized string during the installation of a system plugin (in Joomla 2.5). The "normal" way with localized strings in the xml file doesn't seem to work, (see this other question: Language based installation description).
I now tried the way proposed there, to show the description via the install scripts. This kind of works (I can echo text successfully), however, I also can't localize there - when debugging the language it shows that the plugin.sys.ini is not loaded yet; I tried to manually load the file, but had no success with loading any of my plugin language files.
This is what I got so far (in a file named setupscripts.php):
<?php // no direct access
defined('_JEXEC') or die('Restricted access');
class plgsystemmyplgnameInstallerScript {
static function loadLanguage() {
$lang =& JFactory::getLanguage();
$lang->load('plg_system_myname', JPATH_ADMINISTRATOR);
}
function install($parent)
{
self::loadLanguage();
echo JTEXT::_("PLG_MYNAME_TEST_TEXT");
}
function uninstall($parent)
{
self::loadLanguage();
echo JText::_('PLG_MYNAME_UNINSTALL_TEXT');
}
function update($parent)
{
self::loadLanguage();
echo JText::_('PLG_MYNAME_UPDATE_TEXT');
}
function preflight($type, $parent) {}
function postflight($type, $parent) {
self::loadLanguage();
echo JText::_('PLG_MYNAME_INSTALL_TEXT');
}
}
But I only get ??PLG_MYNAME_TEST_TEXT?? ??PLG_MYNAME_INSTALL_TEXT?? (language debugging is turned on) during installation... weirdly enough, the language debug feature at the bottom of the page under "untranslated strings" shows "None" (where do the question marks then come from if not from a tried but failed translation???).
Tried some variations of it (with .sys at the end of the plugin name, since I actually think the setup strings should be in the .sys.ini file, without the second parameter (leaving it default), but no luck - no error, nothing in the log (in fact my log file isn't existing, probably there was no entry yet? can one set the log level with Joomla?). But never is there any file loaded (nothing changes under "loaded language files".
Anybody got an idea how to load the language properly?
Is there something special to consider when loading languages during setup? Why is there no error message if loading the languages fails? Do I maybe have to install the language files to a special location to get them recognized during installation? My current xml looks like this:
<extension version="2.5" type="plugin" group="system" method="upgrade">
<name>PLG_MYNAME</name>
<!-- ... author, copyright, version, .. -->
<scriptfile>setupscripts.php</scriptfile>
<files>
<filename plugin="myname">myname.php</filename>
<filename>setupscripts.php</filename>
<filename>index.html</filename>
<folder>sql</folder>
</files>
<!-- ... install->sql->file ... -->
<!-- ... uninstall->sql->file ... -->
<!-- ... update->schemas->schemapath ... -->
<languages [folder="admin"]>
<language tag="en-GB">en-GB.plg_system_myname.ini</language>
<language tag="en-GB">en-GB.plg_system_myname.sys.ini</language>
<!-- ... other languages ... -->
</languages>
<!-- ... config->fields->fieldset->field ... -->
</extension>
(the square brackes around folder="admin" are supposed to indicate that I tried both with and without this attribute. It doesn't change anything).
It only works on installation if you also copy the files to the admin language folder. If you look at the core extensions you will see that they do both. It's really a bug but that's the work around.
Finally I found out how to really do it. A thorough search in the google Joomla dev group brought up this very similar question.
Basically, the language files need to reside in a separate language folder it seems, and the files section also needs to reference them. My xml now looks like this:
<!-- ... everything else stayed the same, except: -->
<files>
<filename plugin="myplg">myplg.php</filename>
<filename>index.html</filename>
<folder>language</folder>
<folder>sql</folder>
</files>
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.plg_system_myplg.ini</language>
<language tag="en-GB">en-GB/en-GB.plg_system_myplg.sys.ini</language>
<!-- .. other languages ... ->
</languages>
<!-- ... rest of the xml file ... -->
The language files are now all in separate subfolders... they get copied to the exact same location as before (administrator/language//...), but now the description from the XML is also localized!
I find it very weird that there are so many ways to specify language files, which all basically work except for the one corner case of the installation...
Hope this will help other people struggling with this!

Loading property file from filesystem using util:properties?

When i try to load a property file from the filesystem using util:properties, the property file is not found. I placed it on my root drive and all kinds of places but i seem not to be able to load a property file from the filesystem using util:properties.
Is it possible to do this?
<util:properties id="configProperties" location="file:///d:/config.properties"/>
Loading it from the classpath works ok.. but i want to configure the application so a system admin can change the properties.
<util:properties id="configProperties" location="classpath:/config.properties"/>
I have this in a Linux project and it works fine:
<util:properties id="jdbcConfiguration" location="file:///home/reporting/jdbc.properties"/>
so the problem is probably with the way you specify the path. Try it this way:
<util:properties id="configProperties" location="file:d:/config.properties"/>

Resources