Package net.rim.device.api.system

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


    }
   
    public void saveSettings() {
        Utilities.log("XXXX " + Thread.currentThread().getName() + " Saving settings");
        synchronized(PersistentStore.getSynchObject()) {
            PersistentObject po = PersistentStore.getPersistentObject(SETTINGS_ID);
            po.setContents(_settings);
            po.commit();
            Utilities.log("XXXX " + Thread.currentThread().getName() + " Saved settings:" + _settings.toString());
        }
    }
View Full Code Here


            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                // Attempt to gain access to the controlled object. If
                // the module has been signed with the ACME private key,
                // the attempt will succeed.
                final PersistentObject controlledStore =
                        PersistentStore
                                .getPersistentObject(PersistentStoreDemo.PERSISTENT_STORE_DEMO_CONTROLLED_ID);
                if (controlledStore != null) {
                    try {
                        final Vector vector =
                                (Vector) controlledStore.getContents();
                        if (vector != null) {
                            Dialog.alert("Successfully accessed controlled object");
                        }
                    } catch (final SecurityException se) {
                        UiApplication.getUiApplication().invokeLater(
View Full Code Here

            // Take care of any in memory data first
            ((BlackBerryBalanceDemo) uiApp).onWipe(serviceUid, dataType);
        }

        // Retrieve the persistent object for this application
        final PersistentObject store =
                PersistentStore
                        .getPersistentObject(BlackBerryBalanceDemo.BLACKBERRY_BALANCE_DEMO_ID);

        // Retrieve the saved Memo objects from the persistent store
        final Vector memos = (Vector) store.getContents();

        final int size = memos.size();

        for (int i = 0; i < size; ++i) {
            final Memo memo = (Memo) memos.elementAt(i);

            if (serviceUid.equals(memo.getMode())) {
                // Wipe the memo
                memos.removeElementAt(i);
            }
        }

        synchronized (store) {
            // Persist the updated collection
            store.setContents(memos);
            PersistentObject.commit(store);
        }

        return MultiServicePlatformConstants.SUCCESS;
    }
View Full Code Here

        // even if the device locks during the re-encoding operation.
        final Object ticket = PersistentContent.getTicket();

        if (ticket != null) {

            final PersistentObject store =
                    PersistentStore
                            .getPersistentObject(BlackBerryBalanceDemo.BLACKBERRY_BALANCE_DEMO_ID);

            if (store != null) {
                synchronized (store) {
                    final Vector memos = (Vector) store.getContents();
                    if (memos == null) {
                        // Contents empty; nothing to re-encode
                        return;
                    }
                    for (int i = 0; i < memos.size(); ++i) {
View Full Code Here

                        SHORTCUT_ID, APP_DESCRIPTOR_INDEX);
        HomeScreen.addShortcut(newShortcut, _homeScreenLocationPicker
                .getLocation());

        // Store the directory URL in the persistent store for this sample
        final PersistentObject store =
                PersistentStore
                        .getPersistentObject(HomeScreenDemo.HOMESCREEN_DEMO_ID);
        synchronized (store) {
            store.setContents(_pictureDirectoryURL);
            PersistentObject.commit(store);
        }

        Dialog.inform("Shortcut added successfully.");
    }
View Full Code Here

        // content state changes.
        PersistentContent.addListener(new PersistentStoreListener());

        // Persist an object protected by a code signing key. Please see
        // instructions above.
        final PersistentObject controlledStore =
                PersistentStore
                        .getPersistentObject(PERSISTENT_STORE_DEMO_CONTROLLED_ID);
        synchronized (controlledStore) {
            final CodeSigningKey codeSigningKey =
                    CodeSigningKey.get(CodeModuleManager
                            .getModuleHandle("PersistentStoreDemo"), "ACME");
            controlledStore.setContents(new ControlledAccess(new Vector(),
                    codeSigningKey));
            PersistentObject.commit(controlledStore);
        }

        // Retrieve the persistent object for this application
View Full Code Here

        // Acquiring a reference to a ticket guarantees access to encrypted data
        // even if the device locks during the re-encoding operation.
        final Object ticket = PersistentContent.getTicket();

        if (ticket != null) {
            final PersistentObject store =
                    PersistentStore
                            .getPersistentObject(PersistentStoreDemo.PERSISTENT_STORE_DEMO_ID);

            if (store != null) {
                synchronized (store.getContents()) {
                    final Vector meetings = (Vector) store.getContents();
                    if (meetings == null) {
                        // Contents empty; nothing to re-encode.
                        return;
                    }
                    for (int i = 0; i < meetings.size(); ++i) {
View Full Code Here

         * @return An OptionsDemoData instance with all the saved field vales.
         *         If there is no data that has been saved, it returns an empty
         *         instance
         */
        private static OptionsDemoData load() {
            final PersistentObject persist =
                    PersistentStore.getPersistentObject(OptionsDemoData.ID);

            synchronized (persist) {
                if (persist.getContents() == null) {
                    persist.setContents(new OptionsDemoData());
                    persist.commit();
                }
            }

            return (OptionsDemoData) persist.getContents();
        }
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.