Examples of PersistentObject


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

     *
     * @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

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

     * 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

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

     *
     * @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

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

     * 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

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

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

        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

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

        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

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

                }

            }

            // 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

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

    }

    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

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

        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
TOP
Copyright © 2018 www.massapi.com. 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.