Discussion

Rule-File-Binary Accessed from Function

I am trying to access a file that I have saved as Rule-File-Binary rule from a function with the syntax [code]String file1Name = "Path/file.dat"; File file1 = new File(file1Name);[/code] I currently have the binary file in the webwb directory with a relative path, and have tried the above code with various combinations for the path and keep getting File Not Found exceptions. How do I reference the path to a binary file rule? BTW, because of the code I am trying to run, I do need to java.io.File because the Pega 5.4SP2 APIs I am using do not have some methods I need exposed. Thanks for any suggestions.

***Updated by moderator: Marissa to close post***
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

November 15, 2008 - 5:13pm

What are you trying to do? What is the purpose of the rule file binary?

Rule-file-binary data is stored as objects in the database. When requested by browser, it is retrieved from database and cached on application server file systems. As it is subject to ruleset resolution and subject to security, the caching structure is built using hashed ruleset list as directory key. The same specific instance of a rule file binary might be used by a community with several unique ruleset lists, and thus could exist on more than one directory.

Native java file io is not a great solution, as not only is there no way to determine the correct relative path (which will change with updates to ruleset lists) but there is no way to ensure that a file has ever been cached to the file system. There are 'non-public' API's for static cache management, and there might pega* rules that leverage these API's.

A cruder solution is available - one could use obj-browse and obj-open to load the rule-file-binary to the clipboard, then use the base64 util class decodtoByteArray against property pyFileSource.