Is it appropriate to use File.createTempFile() in webstart applications?

Hello everyone.
I'm currently involved in developing a web start application for my company; and I am a bit puzzled as to the way temporary storage should be managed in the client's machine. To begin with, the application is a web start "trusted" application, since we're signing it.
Specifically, the application needs to perform XSLT transformations with user-generated data. This obviously needs some place to read a source XML document and a source XML stylesheet.
Loading the latter from my application jars as a URL isn't much of a problem. However, my confusion is regarding the location where the XML document generated by the user should be temporarily stored, since only the output of the transform is relevant.
So the first option I got is to use the muffin storage system provided by web start. The concern I have with this is that, while it does provide a place for applications to store data, the mechanics needed to maintain muffin data do not seem (this is just a personal opinion) friendly enough for storing temporary data (an XML file in my case).
Now, I find that a better alternative for doing this would be to use File.createTempFile() in order to request a temporary storage location to dump the XML data to transform.
Now, bearing this in mind; is it ok for this trusted application to use the facility provided by the File class? Or is there any better way I could do this?
Thanks for your time and help!

jzazueta wrote:
Well, basically the intent is that the result of the transform will be used to derive a report from another application. Now, the nature of the transform's output file is about 3 to 4 MB when generated.
I believe that is the primary purpose of saving transformed output.Fair enough but then why do you need to create the intermediate temporary file. Can't you just process the transformed data sequentially as it is produced.
>
In fact, while looking further into this subject, I found some code from the JDIC project mailing list where the example seems to indicate that some level of File functionality is allowed while running under Webstart.I use files under Webstart but I do sign the jars.
>
[http://markmail.org/message/vhjdnwqwjdyvwliv?q=createTempFile+webstart]
So probably the idea may not be too crazy at all :PI never said it was crazy - I just queried the need for the intermediate file. You don't give any details of what you are doing with the transformed xml so I still question the need for the intermediate file.

Similar Messages

  • Use naming datasource in WebStart application

    Hello!
    I created a simple WebStart application with ADF Swing components.(JDeveloper version is 11.1.1.3)
    I deployed this application on Weblogic server (version is 10.3.3).
    But my application works fine, when I use JDBC connection in configuration of my application module.
    When I change type to JDBC DataSource, I get an error: (oracle.jbo.DMLException) JBO-27200: Failure JNDI. Can't execute search of datasource in context hrGlobal
    Where, "hrGlobal" is name of DataSource which is situated on WLS. (This DataSource I created using WLS Console).
    Maybe, there is any help or source code or documentation about this problem, but i could not find such information.
    So, if anyone had met with this problem and can share solution with me, it would be great.
    Thank you for time and answers.
    Regards, Stanislav.

    Hi. Thank you for link. But my problem that this naming DataSource works in ADF Faces application and gives an error in ADF Swing WebStart application. Names in this 2 applications(ADF Faces and ADF Swing) match and i don't use property jbo.server.internal_connection.

  • Help - "Acrobat is being used by another application and cannot open PDF files until the other application is closed."

    Hello,
    I searched this site and google for this error terminology and come up dry.  I support a user who has been for years using Acrobat 5 (yes, I know...) to read files in a client DB program, as well as other PDF files on their PC.  In the last week or so, they have started gatting this error "Acrobat is being used by another application and cannot open PDF files until the other application is closed." any time they attempt to open a PDF file attached to an email (via Outlook).
    It is my understanding that they cannot upgrade to a newer version of Acrobat because of limitations of their client software, but had not previously had any issues viewing PDF notes from the DB, and PDF attachments in their email.
    I have tried uninstalling and re-installing, as well as tried using Adobe Reader 7 & 9 in conjunction with Acrobat to try to get around this issue, but have not been successful.
    Any ideas?
    Thanks,
    Jesse

    I don't have an answer to your technical problem. The product I assume is Acrobat that you are talking about (based on the post title), Adobe is the company name. This is a good place to ask questions on Acrobat if folks can figure out what you are talking about. They will ask for the product version number (like AA9.3.3), operating system, and other applications if appropriate. Also, just what you are doing that generates the message.
    As for Adobe, you are not likely to get an answer from them here in the user forum. You will be lucky if you can get an answer if you can contact them and not be on hold for more than an hour (sorry, this is why a lot of folks end up in the forum).
    So, to help others try to answer your question, what are the products and versions involved? What OS? What are you doing when the message comes up.

  • File.createTempFile naming problem

    Hello All,
    I am using WIN XP .I am creating a temporary file with the following code
    File temporaryDll = File.createTempFile("abcd", ".dll");In the temp directory , though I marked in code deleteOnExit to temporaryDll , it creates files with abcd1234.dll , abcd1235.dll n so on .
    The temp directory gets filled up with these number of dlls with diff suffix. Is there any mechanism or any code snippet will I get , to make sure that only one dll will get created n deleted after JVM termination.How can I check in the code , file already exists or not , because at every time it create new filename?
    I have tried by deleting all abcdxxxx.dll from temp dir , I ran the code but wondered after watching in temp dir , abcd1234.dll file created instead abcd.dll .
    Looking forward for help.
    thanks
    Ani

    That's because you original files all end with a "2" and not the 4-digit number you want. "Original file#" takes the number at the end of the original file.
    For example:
    IMG_1234    >> "1234"
    IMG_1234-2 >> "2"
    Why are your originals all end with a "2"? Probably because toy imported some duplicate files and lightroom added "-2" to their name to avoid a filename collision.
    Check you folders for duplicates.

  • Appending XML data to a file using file adaptor

    Hi,
    I am trying to append data to a file using file adaptor in XML format. (Objective is to store data as XML message in the file). I understand it is possible to append data to an existing file by making appropriate changes in WSDL manually. However, my issue is every time the XML data is appended to a file even the XML header message is also getting appended. As a result the file data does not adhere to defined schema structure anymore.
    Is there a way to save XML data in a file in append mode ?
    Thanks, Riz

    I am having the same issue as well, which makes the output XML an invalid one. I have an XSD that has a hierarchy of elements. whenever I am wiriting the child elements the header message & the name space is also getting written. For example
    <?xml version="1.0" ?><Parent xmlns="http://testSchema.com/outputSchema">
    <StartDate>01/01/2001</StartDate>
    <EndDate>01/30/2001</EndDate>
    <Child/>
    </Parent>
    <?xml version="1.0" ?><Child xmlns:ns1="http://testSchema.com/outputSchema">
    <ns1:Id>20012981</ns1:Id>
    <ns1:Value/>
    <ns1:Date>01/15/2001</ns1:Date>
    </Child>
    <?xml version="1.0" ?><Child xmlns:ns1="http://testSchema.com/outputSchema">
    <ns1:Id>20012981</ns1:Id>
    <ns1:Value/>
    <ns1:Date>01/15/2001</ns1:Date>
    </Child>
    I am using a onefile adapter partnerlink to write the parent & an another one for writing the child element, since the child elements will repeat more than once. One other way to fix this issue is write the data using java embedded activity, but that would need a lot of boiler plate code, for writing/reading/appending the same file & for handling all those IOexceptions & buffer IN/outs. I am curious if someone had the same issue & how they resolved it.

  • Problem with File.createTempFile

    I did File temp = File.createTempFile("cpyStats", ".xls");
    //                Delete temp file when program exits.
                   temp.deleteOnExit();
    System.out.println(temp.getName());But the result is : cpyStats30440.xls
    Why do it always have some number after my file name ?
    Anyone help me ?
    So stress because of it...

    Guys, if you don't want a random filename just don't
    use a method that creates a random filename.Please excuse my ignorance (new to java!). What's the easient way to do this/what method should I use?
    I simply need to create a new file with a precise name. This is because I need to retrieve the same file from a remote location later and so I can only do this if I know what it's filename was originally!
    n.b. The filenames I am generating will be unique.

  • Most Recent Used File List in Menus

    Hi,
    Does anyone know how to create List of most recent used files and display it in the main menu?
    Has anyone done that?
    Currently, I am opening one file at the time and I have the last
    path of opened file.
    thanx !

    Offhand, you'll have to do it the hard way. I don't think Swing or Awt provide a default JMenuItem(), MenuItem() that does the file list. Now that you mention it, it does seem like an interesting project to do.
    You essentially need an array of the files, and for each file, create the associated menu entry, as in:
    String entryName = files[ i ];
    if ( entryName.length > 10 ) {
       entryName = entryName.subString( 0, 10 );
    JMenuItem entry = new JMenuItem( i + ". " + entryName );
    ...and define the event listeners however appropriate for your application.

  • File.createTempFile seems to be broken in JDK 1.6.0_11

    Hi!
    Can anyone confirm please?
    On (German) Windows XP systems, since JDK 1.6.0_11, there seems to be a serious bug in the implementation of File.createTempFile: After having created such a temp file, using getPath() or getAbsolutePath() may show a broken path, with abbreviated path components.
    Here is an example result path (broken):
    "C:\DOKUME~1\schneid\LOKALE~1\Temp\temp_file6617344501941011051.tmp"
    As you can see, the directory "DOKUMENTE_UND_EINSTELLUNGEN" (German version of Windows XP) is abbreviated to "DOKUME~1".
    I have attached an executable Java class that shows the problem.
    If someone confirms, then I will post an issue.
    Best,
    Michael
    ======= BEGIN CLASS "CreateTempFileBug" ================
    import java.io.File;
    * Bug: Broken path for File.createTempFile
    * Description:
    * File.createTempFile() creates a file object with a broken getPath() string.
    * The path string contains "~", i.e. the path elements are abbreviated.
    * Same problem for getAbsolutePath(). Valid paths only for getCanonicalPath().
    * Example-Output:
    * "C:\DOKUME~1\schneid\LOKALE~1\Temp\temp_file6617344501941011051.tmp"
    * System:
    * OS: WinXP / German
    * JRE: 1.6.0_11
    * Since:
    * I think this is new to patch level 11 of Java 6. It breaks my software,
    * but in earlier versions everything was fine.
    * @author Michael Schneider ([email protected])
    public class CreateTempFileBug {
         public static void main(String[] args) throws Exception {
              // Creating a temporary file, and printing the path.
              // RESULT: broken path (having abbreviated path elements)
              // for getPath and getAbsolutePath, but ok for getCanoncialPath
              File tempFile = File.createTempFile("temp_file", null);
              System.out.println("temp file / getPath: BROKEN: <" + tempFile.getPath() + ">");
              System.out.println("temp file / getAbsolutePath: BROKEN: <" + tempFile.getAbsolutePath() + ">");
              System.out.println("temp file / getCanonicalPath: OK: <" + tempFile.getCanonicalPath() + ">");
              // For comparison, creating a normal file in the working dir
              // and printing the absolute path.
              // RESULT: valid paths (at least on my system)
              File normalFile = new File("normal_file");
              System.out.println("normal file / getPath: OK: <" + normalFile.getPath() + ">");
              System.out.println("normal file / getAbsolutePath: OK: <" + normalFile.getAbsolutePath() + ">");
              System.out.println("normal file / getCanonicalPath: OK: <" + normalFile.getCanonicalPath() + ">");
    ===== END CLASS =====================================
    Edited by: m_schnei on Feb 13, 2009 11:17 PM
    Edited by: m_schnei on Feb 13, 2009 11:20 PM

    Hi Danny!
    So you are saying that this is a valid path specification in Windows? I did not know this. And I do not remember to ever have seen this before with Java.
    Is there a reason why this "abbreviated" form is used in Java?
    Has this changed recently, or did I simply never found it before?
    Can this be behavior be changed to the complete path form? I like to call 'get[Absolute]Path()' in log messages and test cases, but want to see the complete path in such a case. I would like to avoid getCanonicalPath() in such cases, because this method declares an exception.
    Cheers,
    Michael

  • Error File.createTempFile permission to delete has not been granted

    Hi,
    I am new in Java. I wrote something easy like this:
    public class Utils {
    public static String createMyTempFile() {
    String result = "";
    try {
    File file = File.createTempFile("test",".txt");
    file.deleteOnExit();
    catch(Exception e){
    result = e.getMessage();
    return result;
    But appear the next error message:
    "Unable to create temporary file"
    But i run the same script with SYS user theres no problem, asume is a permission problem, but i dont know which permissions or how can i grant it.
    Thank you

    Grant Privileges
    The relevant permissions must be granted from SYS for JServer to access the file system:
    EXEC DBMS_JAVA.grant_permission('SCHEMA-NAME', 'java.io.FilePermission', '<<ALL FILES>>', 'read ,write, execute, delete');
    EXEC DBMS_JAVA.grant_permission('SCHEMA-NAME', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    EXEC DBMS_JAVA.grant_permission('SCHEMA-NAME', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    GRANT JAVAUSERPRIV TO SCHEMA-NAME;
    The affects of the grant will not be noticed until the grantee reconnects. It is up to the individual to decide on the level of access that is required.
    Depending on the documentation used, you may be told to add the directories you intend to access to your UTL_FILE_DIR parameter in the Init.ora file. I have not found this to be necessary when using the Java approach.

  • Problem using File sharing  in a small office network

    I have a problem using File sharing on an Imac and Macbook Pro.
    My office has a small network running Windows Small office file server 2003. I have one Windows 2000 PC connected to it and 3 Macs, an 2.4 gHz Intel iMac running Leopard 10.5.6 , a MBP running the same and a Mac Mini running 10.5.
    From the Finder Shared window of the Mac Mini, I can see all the computers on the network. It also used to be the case for the iMac, but the MBP could never see the Windows PC’s, not the server or the Win2000. This wasn’t a big problem as I was communicating between the Macs and using the shared printer on the iMac.
    On Monday Jan 19 the iMac was suddenly unavailable to the other 2 Macs. It was working normally on the Friday. The iMac can access the Mac Mini and copy files to it. The Mac Mini can see the iMac but cannot access it. Even trying to connect as, ends in a failed connection. I have tried rebooting, turning File sharing off and then on again to no avail.
    The iMac now also cannot see the Windows PC’s which it previously could.
    To get files from the MBP for printing, I now copy it to the Mac Mini and acces the folder from the iMac, a very tedious procedure. I don’t know why this happened and am scared that the Mac Mini is going to do the same thing.
    All three computers are also running VMware 2.0 with Windows XP pro, and from VMware the server is visible on all the computers.
    Any help will be much appreciated, I live in a small town in South Africa and the local computer suppliers have no knowledge of the Macs.
    I think that the problem with the iMac may have started after a software upgrade to 10.5.6 but I am not entirely sure.
    Thank you
    ajdk

    Well, you're current method sounds pretty good. But if you want to user a file server, hey go ahead.
    What you want to do when you centralize project files is to keep track of which one is the newest and becareful not to overwrite files with the same name. So you either have to set up individual spaces on the server (separate AFP/FTP folders maybe), or you'll need to run a file checkout service.
    The individual space is cheaper, but it's not much of a difference from backing up to the network drive. Since you have Gigabit connections, you might even opt to save ALL the user files on the server instead of just the project files.
    If you want to run a file checkout service, there's two approaches. You can run a service that can host any kind of file, or you can run a version control system for each kind of application (Photoshop, Word, etc.). Please notice, that as you read further and further along, the methods become more and more expensive and complicated. Once you get to this point, it will be necessary to purchase or build software in addition to the Mac OS X Server package.

  • Can we use FILE IO in File Adapter ? If not, Why?

    Hello,
    I want to clarrify one important issue of FIle Adapter.
    Can we use FILE I/O in case of File  Adapter to process the files.
    PLease explain me with a reason and a sample example.
    Thanks,
    Soorya.

    I think you can handle File IO in Java Mapping by using
    public void execute(InputStream in, OutputStream out)
    // Here You can desired the output from source XML structure by using SAX/DOM parser to Target XML file.

  • Unable to delete files from encrypted external SD Card using File Commander

    I've run into some trouble trying to delete the directory com.spotify.music from my external SD Card (encrypted) after a hard reboot using the reset button next to the sim card.
    I need to do this for the Spotify app to work (FC on starting it) and I'm currently unable to delete the folder and its contents from Sony provided file explorer(FC File Commander).
    Is there a way to delete this app from adb or other command line tool or how should I go about this? Developer options are enabled because I'm learning to develop apps. Not particularly keen on rooting or otherwise format my SD Card but it's an option if there are no other ways to do it. 
    I can see the contents of my card using File Commander just fine. Spotify app is uninstalled, I tried remove cache and data before uninstall also.

    Thommo wrote:
    Are you able to delete files via your Pc or are you able to remove the card from your phone and connect it to a Pc for file deletion - There is a free program called Unlocker currently on version 1.9.2 which is excellent at deleting files that don't want to be deleted - You would install the program then right click the file and choose Unlocker and then when the program starts choose delete
    I guess he will not be able to move the SD card to the computer since it's encrypted and is working only with that particular device, but he should be able to access it via PC.
    If you can try to uninstall Spotify from your phone. I assume Spotify is not working due to some rubbish inside it's directory, but on the other hand you can't delete the folder because it may be used by Spotify. If you uninstall app folder may be unlocked.
    Best regards,
    Sergio PL
    Xperia Z1 / Nexus 7 (2012)

  • Office 2004 crashes in Leopard when using File print option.

    Office 2004 apps all crash when I try to print using File>print but they will print if I just use the printer icon. Any ideas?? I have updated Office to 11.3.9 and uninstalled and reinstalled the printer. BTW, the printer is an HP Laserjet All-in-one model 3330. Everything else I've tried seems to print ok -- Safari, Adobe, Pages.
    I would like to upgrade three other machines but I'm waiting until I get this print problem resolved.
    Thanks.

    Well I feel sort of stupid, I was using the HP driver. Switching to either of the drivers supplied with Leopard fixed this problem. Thanks.

  • How to add header line in a file from XI system using file adapters

    Hi All,
    I need to add header line (Column names) in a file coming from XI system.
    I am using file adapters.
    Thanks & Regards,
    Gaurav Mittal

    The Receiver File Adapter is configured, using the following settings:
    1) Choose File Content Conversion as the Message Protocol.
    2) You give the ‘addHeaderLine’ parameter as 1
    3) For the ‘fieldSeparator’ parameter you need to give field separator for both list and substructure (referring to the data type above). For eg: it may be a ‘,’ (comma) for substructure in a comma separated file.
    4) The ‘endSeparator’ parameter needs to given for substructure only. For eg: it may be a ‘nl’ (new line)
    5) Give the file name, the directory and the Construction mode. Activate all the settings. Receiver File Adapter with F.C.C. is configured.
    please visit the blog.
    /people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2

  • I loaded iTunes on a new laptop. I copied and pasted my albums to a 4G stick and down loaded them to the new laptop. Placing them in, Libraries – Music – iTunes and than in Itunes used File – add file to library. So far so good. For what ever reason one o

    I loaded iTunes on a new laptop. I copied and pasted my albums to a 4G stick and down loaded them to the new laptop. Placing them in, Libraries – Music – iTunes and than in Itunes used File – add file to library. So far so good. For what ever reason one of the CDs would not load onto the stick. I got the orginal CD and loaded directly to Itunes. Now when I look in  Libraries – Music – iTunes it’s not there but it is in and plays in iTunes. What should I have done or should I be doing? Thanks.

    It's not a unique situation - happens all the time, smaller hard drives getting filled up.
    It's also easy to fix. I just moved my itunes content to a bigger hard drive.
    First I made a backup of the itunes database file - iTunes Library.itl. Just in case anything went wrong.
    Nothing did go wrong, but I'd have it in case anything DID go wrong. That file holds ratings, playcounts, Date Added, and other metadata.
    Second, in itunes change the preferences > advanced tab to tell itunes to put everything on G:
    Set the itunes folder location to something like G:Media or G:iTunes
    This will affect all FUTURE additions to itunes and not do anything to the existing locations.
    Make sure the checkbox for "Keep itunes organized" is NOT checked. I also left the "Copy files when adding" unchecked.
    Third, to move all the files to G: without itunes losing the paths, run the File > Library > Organize > Consolidate command. This will need to run a while, so be patient as it copies all the files to the new G: location. This does NOT delete the originals. You will have to do that.
    Fourth, make sure everything in itunes is OK and you can play stuff in your library. If you're really cautious you can run a script to check for missing/dead tracks.

Maybe you are looking for

  • Spikes in the plot...

    So i produce a  frequency response plot by using a XY graph. Everything works great except fo the spikes which you can see in the attached picture.  My plots are saved as dbl arrays. Is there a quick and dirty way  to get rid of these spikes on the p

  • Slideshows in iphoto 6

    Hi Can anyone tell me how to make the pictures that appear in the slideshows last different amount of times. ie pic one lasts 6 secs and pic two 20 secs, pic 3 lasts 5 secs and so on. Cheers for any info.

  • How to run the the impersonation permission grant command for multiple users

    I have run below command earlier to grant the impersonation for a user called user1 get-mailbox -identity user1 | add-adpermission -user domainname\service application user -ExtendedRights ms-Exch-EPI-May-Impersonate Now I want to run this command fo

  • BOSTO K19 INCOMPATIBLE W/ PHOTOSHOP CS6 (AND PAINTER 12) HELP!! DETAILS SUPPLIED

    I Just installed latest CS6 and have tried using the program in conjunction with Bosto Kingtee 19 MA. Photoshop works perfectly when tablet is not plugged in; but fails to start when tablet is hooked up. Everything in terms of drivers and software is

  • Vendor creation for supplying plant in STO

    I m trying to create a Vendor for the Supplying Plant for Intercompany STO scenario. When I go to the Purchasing data (Extras - Add purchase data) of Vendor master to assign Plant, I m not getting the field to assign the Plant. I do I have to do to g