Package net.rim.device.api.system

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


     *
     * @param application
     *            descriptor arguments
     */
    public static void setAppDescArgs( String[] args ) {
        PersistentObject persistentObject = PersistentStore.getPersistentObject( LASTKNOWN_ID );
        Hashtable info = (Hashtable) persistentObject.getContents();
        if( info == null ) {
            info = SettingsManager.createStorableObject();
            persistentObject.setContents( info );
        }
        info.put( "appDescriptor", args );
        persistentObject.commit();
    }
View Full Code Here


        byte[] data = null;

        // Get the code signing key associated with this BlackBerry WebWorks Application
        CodeSigningKey codeSigningKey = CodeSigningKey.get( this );
        // Check Persistent Store for existing data
        PersistentObject cacheItemStore = PersistentStore.getPersistentObject( _storeKey );       

        // If we find an entry in the Persistent store
        if( cacheItemStore != null ) {
            Object cacheItemObj = null;
            try {
              // codeSigningKey is nullable
                cacheItemObj = cacheItemStore.getContents( codeSigningKey );
            } catch ( ControlledAccessException ignore ) {
                // cacheItemObj remains null
            }
            if( cacheItemObj instanceof ByteVector ) {
                ByteVector cacheItemVector = (ByteVector) cacheItemObj;
View Full Code Here

        byte[] data = null;

        // Get the code signing key associated with this BlackBerry WebWorks Application
        CodeSigningKey codeSigningKey = CodeSigningKey.get( this );
        // Check Persistent Store for existing data
        PersistentObject cacheItemStore = PersistentStore.getPersistentObject( _storeKey );       

        // If we find an entry in the Persistent store
        if( cacheItemStore != null ) {
            Object cacheItemObj = null;
            try {
              // codeSigningKey is nullable             
                cacheItemObj = cacheItemStore.getContents( codeSigningKey );
            } catch ( ControlledAccessException ignore ) {
                // cacheItemObj remains null
            }
            if( cacheItemObj instanceof ByteVector ) {
                ByteVector cacheItemVector = (ByteVector) cacheItemObj;
View Full Code Here

                }

            }

            // Update cache table in persistent store.
            PersistentObject cacheTableStore = PersistentStore.getPersistentObject( _storeKey );
            CodeSigningKey codeSigningKey = CodeSigningKey.get( this );
            synchronized( cacheTableStore ) {
                cacheTableStore.setContents( new ControlledAccess( _cacheTable, codeSigningKey ) );
                cacheTableStore.commit();
            }
        }
    }
View Full Code Here

    }

    private void removeCacheFile( long storeKey ) {

        // Check Persistent Store for existing cacheTable data.
        PersistentObject cacheItemStore = PersistentStore.getPersistentObject( storeKey );

        // Get the code signing key associated with this BlackBerry WebWorks Application.
        CodeSigningKey codeSigningKey = CodeSigningKey.get( this );

        // If we find an entry in the Persistent store.
        if( cacheItemStore != null ) {
            Object cacheItemObj = cacheItemStore.getContents( codeSigningKey );
            if( cacheItemObj instanceof ByteVectorWrapper ) {
                // Remove the entry.
                synchronized( cacheItemStore ) {
                    cacheItemStore.setContents( null );
                    cacheItemStore.commit();
                }
            }
        }

    }
View Full Code Here

        String filePath = _cacheStoreRoot + Integer.toHexString( url.hashCode() )
                + Integer.toHexString( data.length );
        long storeKey = generateCacheItemStoreKey( filePath );

        // Open persistent store. Use key to access store.
        PersistentObject persistentObject = PersistentStore.getPersistentObject( storeKey );

        // Save to Pstore.
        synchronized( persistentObject ) {
            try {
                // Get the code signing key associated with this BlackBerry WebWorks Application.
                CodeSigningKey codeSigningKey = CodeSigningKey.get( this );
                persistentObject.setContents( new ControlledAccess( pDataStore, codeSigningKey ) );
                persistentObject.commit();
            } catch ( ControlledAccessException cae ) {
                throw new IOException();
            } catch ( NonPersistableObjectException npoe ) {
                throw new IOException();
            } catch ( PersistentContentException pce ) {
View Full Code Here

        try {
            // Generate store key for this app.
            _storeKey = generateStoreKeyFromPackageName();

            // Check Persistent Store for existing cacheTable data.
            PersistentObject cacheTableStore = PersistentStore.getPersistentObject( _storeKey );

            // Get the code signing key associated with this BlackBerry WebWorks Application.
            CodeSigningKey codeSigningKey = CodeSigningKey.get( this );
            Object cacheTableObj = cacheTableStore.getContents( codeSigningKey );

            // If we find an entry in the Persistent store.
            if( cacheTableObj != null ) {

                if( cacheTableObj instanceof Hashtable ) {
                    // Set the cache table using the stored value.
                    _cacheTable = (Hashtable) cacheTableObj;

                    // Ensure that expired entries are cleaned out.
                    cleanExpiredCache();
                }
            }
            // Otherwise, create the cacheTable entry in persistent store.
            else {
                synchronized( cacheTableStore ) {
                    cacheTableStore.setContents( new ControlledAccess( _cacheTable, codeSigningKey ) );
                    cacheTableStore.commit();
                }
            }

        } catch( Exception e ) {
        }
View Full Code Here

     */
//     * <li><b>A positive number</b>, representing the number of parameters
//     *     wrong, if the store does not contain one or more values.
//     *     The missing params maintain the current value.
    public static int load() {
        PersistentObject pobj = PersistentStore.getPersistentObject(SyncClient.CONFIG_KEY);
       
        try {
            ConfigData contents = (ConfigData)pobj.getContents();
   
            if (contents == null) {
                Log.info("Configuration not set, using current values.");
                return -1;
            }
View Full Code Here

    /**
     * Save the current config to the persistent store.
     */
    public static int save() {
        PersistentObject pobj = PersistentStore.getPersistentObject(SyncClient.CONFIG_KEY);
       
        ConfigData contents = new ConfigData();

        // This field can be used to check which version of the sw
        // saved the data. If not present, it is assumed it's an
        // old version and the saved config is discarded.
        contents.setValue("VERSION", VERSION);
       
        contents.setValue("SYNC_URL", syncUrl);
        contents.setValue("USERNAME", userName);
        contents.setValue("PASSWORD", password);
       
        contents.setValue("SYNC_CARD", syncContact);
        contents.setValue("CARD_URI", contactSourceUri);
       
        contents.setValue("SYNC_CAL", syncCalendar);
        contents.setValue("CAL_URI", calendarSourceUri);
       
        contents.setValue("SYNC_MAIL", syncMail) ;
        contents.setValue("MAIL_URI", mailSourceUri) ;
        contents.setValue("MAIL_ADDR", mailAddress) ;
        contents.setValue("POLL_ENABLE", enablePolling) ;
        contents.setValue("POLL_TIME", pollInterval) ;
        contents.setValue("SMS_ENABLE", enableSmsSync) ;
       
        contents.setValue("GW_APN", gatewayApn) ;
        contents.setValue("GW_IP", gatewayIp) ;
        contents.setValue("GW_PORT", gatewayPort) ;
        contents.setValue("PUSH_PORT", listeningPort) ;

        contents.setValue("log_LEVEL", logLevel) ;
       
        synchronized (pobj) {
            pobj.setContents(contents);
            pobj.commit();
        }

        return 0;
    }
View Full Code Here

       
    }
   
    private static void loadSettings() {
        synchronized(PersistentStore.getSynchObject()) {
            PersistentObject po = PersistentStore.getPersistentObject(SETTINGS_ID);
            Object obj = po.getContents();
            if (obj != null) {
                _settings = (Settings) obj;
            } else {
                _settings.setISO14443A(false);
                _settings.setISO14443B(true);
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.