Package net.rim.device.api.system

Examples of net.rim.device.api.system.PersistentObject


    public static synchronized CustomMessageStore getInstance(long GUID)
    {

        if(_instance == null)
        {
          PersistentObject store = PersistentStore.getPersistentObject(GUID);
          if(store.getContents() == null){
            _instance = new CustomMessageStore(GUID);
            synchronized(store){             
              store.setContents(_instance.getInboxMessages());
              store.commit();
            }
          }else{
            _instance = new CustomMessageStore(GUID, (ReadableListImpl)store.getContents());
          }
        }
        return _instance;
    }
View Full Code Here


    {
      persist();
    }
   
    public void persist(){
      PersistentObject store = PersistentStore.getPersistentObject(_GUID);       
    synchronized(store){
      store.setContents(this.getInboxMessages());
      store.commit();
    }
    }
View Full Code Here

        private static final String NAME = "delete";
        public Object invoke(Object obj, Object[] args) throws Exception
        {
            if (args.length == 1)
            {
                PersistentObject myPersistentData;
                PersistentStore.destroyPersistentObject(StringUtilities.stringHashToLong(args[0].toString()));
            }
            return UNDEFINED;
        }
View Full Code Here

        private static final String NAME = "write";
        public Object invoke(Object obj, Object[] args) throws Exception
        {
            if (args.length == 2)
            {
                PersistentObject myPersistentData;
                myPersistentData = PersistentStore.getPersistentObject(StringUtilities.stringHashToLong(args[0].toString()));
                synchronized(myPersistentData)
                {
                    myPersistentData.setContents(args[1]);
                    myPersistentData.commit();
                }
            }
            return UNDEFINED;
        }
View Full Code Here

        {
            String answer = "";
            if (args.length == 1)
            {
               
                PersistentObject myPersistentData;
                myPersistentData = PersistentStore.getPersistentObject(StringUtilities.stringHashToLong(args[0].toString()));
                synchronized(myPersistentData)
                {
                    String data = (String) myPersistentData.getContents();
                    if (data != null)
                    {
                        answer = data.toString();
                    }
                }
View Full Code Here

     * Get the last known push service type
     *
     * @return push service type
     */
    public static int getLastKnownType() {
        PersistentObject persistentObject = PersistentStore.getPersistentObject( LASTKNOWN_ID );
        Hashtable info = (Hashtable) persistentObject.getContents();
        if( info != null && info.containsKey( "type" ) ) {
            return ( (Integer) info.get( "type" ) ).intValue();
        }

        return -1;
View Full Code Here

     *
     * @param type
     *            push service type
     */
    public static void setLastKnownType( int type ) {
        PersistentObject persistentObject = PersistentStore.getPersistentObject( LASTKNOWN_ID );
        Hashtable info = (Hashtable) persistentObject.getContents();
        if( info == null ) {
            info = SettingsManager.createStorableObject();
            CodeSigningKey codeSigningKey = CodeSigningKey.get( info );
            persistentObject.setContents( new ControlledAccess( info, codeSigningKey ) );
        }
        info.put( "type", new Integer( type ) );
        persistentObject.commit();
    }
View Full Code Here

     * Get the last known push service port
     *
     * @return push service port
     */
    public static int getLastKnownPort() {
        PersistentObject persistentObject = PersistentStore.getPersistentObject( LASTKNOWN_ID );
        Hashtable info = (Hashtable) persistentObject.getContents();
        if( info != null && info.containsKey( "port" ) ) {
            return ( (Integer) info.get( "port" ) ).intValue();
        }

        return -1;
View Full Code Here

     *
     * @param port
     *            push service port
     */
    public static void setLastKnownPort( int port ) {
        PersistentObject persistentObject = PersistentStore.getPersistentObject( LASTKNOWN_ID );
        Hashtable info = (Hashtable) persistentObject.getContents();
        if( info == null ) {
            info = SettingsManager.createStorableObject();
            CodeSigningKey codeSigningKey = CodeSigningKey.get( info );
            persistentObject.setContents( new ControlledAccess( info, codeSigningKey ) );
        }
        info.put( "port", new Integer( port ) );
        persistentObject.commit();
    }
View Full Code Here

     * Get the application descriptor arguments
     *
     * @return <code>ApplicationDescriptor</code>
     */
    public static String[] getAppDescArgs() {
        PersistentObject persistentObject = PersistentStore.getPersistentObject( LASTKNOWN_ID );
        Hashtable info = (Hashtable) persistentObject.getContents();
        if( info != null && info.containsKey( "appDescriptor" ) ) {
            return (String[]) info.get( "appDescriptor" );
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of net.rim.device.api.system.PersistentObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.