our applicaiton is using ResourceBundle for java type codes or messge code files for Js codes which will be having the message code-Message mapping and this files will be generated dynamically from build for each locale. the code adn values are maintained in DB.
Now we are looking for automating finding the message codes used in our code base but not added to DB because of which runtime will fail to convert the code to message . In short, we will be doing below stuff.
1. Find various patterns to search for Resource Bundles and Message Codes.
for each file of java/xsl/Html type
2. identify the Resource bundle for that file - by searching for identified usage patterns to get a resource bundle in JAVA/XSL/HTML
3. collect message codes in that file - by searching for identified usage patterns
4. finally compare both.
Step 2 do not have a clear strategy in case of a js file having MsgCodes. How to find out exact resource bundle with only the message code and the js file name and the current import refernce to this file details?
Ideally we have to find all references to this js and collect those resource bundles used there and check against. If multiple RBs found, then can we figure out which resource bundle would be the right one for each code?
Query 2: in our find patterns we have to search forward and backward dynamically. any good java utility class wil help us on this? right now we start with using StreamTokenizer.we dont know if we can use same class to go back from a position and come back after we find expected pattern to previous position to search further.
Please help me for any of the above issues. Thanks a ton!