FileDocCategorySizeDatePackage
MIDletSuiteStorageAccessor.javaAPI DocphoneME MR2 API (J2ME)4773Wed May 02 18:00:04 BST 2007com.sun.midp.jump.midletsuite

MIDletSuiteStorageAccessor

public class MIDletSuiteStorageAccessor extends Object implements com.sun.midp.jump.installer.StorageAccessInterface

Fields Summary
private com.sun.midp.midletsuite.MIDletSuiteStorage
storage
Constructors Summary
public MIDletSuiteStorageAccessor()

      this.storage = MIDletSuiteStorage.getMIDletSuiteStorage();
   
Methods Summary
public com.sun.jump.common.JUMPContent[]convertToMIDletApplications(int suiteId)

       try { 
 	  MIDletSuiteInfo suiteInfo = getMIDletSuiteInfo(suiteId);
          MIDletInfo[] midletInfos  = getMIDletInfos(suiteInfo);

          JUMPMIDletSuiteInfo currentMIDletSuiteInfo = 
		  new JUMPMIDletSuiteInfo(suiteInfo, midletInfos);

	  return currentMIDletSuiteInfo.getMIDletApplications();

       } catch (IOException e) { 
          System.err.println(e + " thrown while accessing the midlet suite " + suiteId);
          return new JUMPContent[0];
       } catch (MIDletSuiteLockedException e) { 
          System.err.println(e + " thrown while accessing the midlet suite " + suiteId);
          return new JUMPContent[0];
       } catch (MIDletSuiteCorruptedException e) { 
          System.err.println(e + " thrown while accessing the midlet suite " + suiteId);
          return new JUMPContent[0];
       }
   
public int[]getInstalledMIDletSuiteIds()

  
       return storage.getListOfSuites();
   
private com.sun.midp.midletsuite.MIDletInfo[]getMIDletInfos(com.sun.midp.midletsuite.MIDletSuiteInfo suiteInfo)

       MIDletSuiteImpl midletSuite = storage.getMIDletSuite(suiteInfo.suiteId, false);

       MIDletInfo[] midletInfos = new MIDletInfo[midletSuite.getNumberOfMIDlets()];
       for (int i = 0; i < midletInfos.length; i++) {
           midletInfos[i] = new MIDletInfo(
                         midletSuite.getProperty("MIDlet-" + (i+1)));
       }

       // Need to unlock midletsuite.
       midletSuite.close();

       return midletInfos;
   
private com.sun.midp.midletsuite.MIDletSuiteInfogetMIDletSuiteInfo(int id)

       return storage.getMIDletSuiteInfo(id);
   
public voidremove(int id)

 
       try {	    
          storage.remove(id);
       } catch (MIDletSuiteLockedException e) { 	   
	  new RuntimeException(e);
       }