Store the object in a persistent storage

Hello

I want to store the cusom object in the persistent store.here is my custom class:

public class {UserData

OrgName string;
Time to string;
String authTocken;
Public UserData (orgName, String authTocken, String time, String)
{
this.orgName = orgName;
This.Time = time;
this.authTocken = authTocken;

}
public String getOrgName() {}
return orgName;
}
{} public void setOrgName (String orgName)
this.orgName = orgName;
}
public String getTime() {}
back in time;
}
{} public void setTime (string time)
This.Time = time;
}
public String getAuthTocken() {}
Return authTocken;
}
{} public void setAuthTocken (String authTocken)
this.authTocken = authTocken;
}

}

and I use the following class of persistent storage to store the data.

/ public final class PersistentStoreContents implements {Persistable
private CAMailMinderHashTable mElements = null;
static private instance of PersistentStoreContents = null;
Private static final long KEY = 0x67c5b66a2bcd1dfcL;
private PersistentObject persistentObject = null;

/**
* Gets the single instance of the database.
*
* only @return of the database instance
*/
public static getInstance() {} PersistentStoreContents
try {}
If (instance == null) {}
Logger.out ("PersistentStoreInfo", "creation of the storage object");
instance = new PersistentStoreContents();
}
} catch (Exception e) {}
instance = null;
}
return instance;
}

private PersistentStoreContents() {}
persistentObject = PersistentStore.getPersistentObject (KEY);
synchronized (persistentObject) {}
If (persistentObject.getContents () == null) {}
persistentObject.setContents (new CAMailMinderHashTable());
persistentObject.commit ();
}
}

mElements = persistentObject.getContents ((CAMailMinderHashTable));
If (mElements == null) {}
Logger.out ("PersistentStoreInfo", "*" + (mElements is nothing));
mElements = new CAMailMinderHashTable();
}

}

public String getElement (String key) {}
Logger.out ("PersistentStoreInfo", "getElement:" + key);
Return (String) mElements.get (key);
}

' Public Sub setElement (String key, String value) {}
Logger.out ("PersistentStoreInfo", "setElement:" + key + value);
mElements.put (key, value);
persistentObject.setContents (mElements);
persistentObject.commit ();
}

UserData public getElement2 (String key) {}
Logger.out ("PersistentStoreInfo", "getElement:" + key);
Return mElements.get (key) (UserData);
}

public void setElement2 (String key, UserData userData) {}
Logger.out ("PersistentStoreInfo", "setElement:" + key);
mElements.put (key, userData);
Logger.out ("PersistentStoreInfo", "added");
persistentObject.setContents (mElements);
Logger.out ("PersistentStoreInfo", "game content");
persistentObject.commit ();
Logger.out ("PersistentStoreInfo", "Validate");
}

Public list getAllKeys() {}
Logger.out ("PersistentStoreInfo", "getElement:" + key);
Return mElements.keys ();
}
}

I use the follwinng code to insert data :

PersistentStoreContents ch = PersistentStoreContents.getInstance ();
UserData = us new UserData("gmail.com","1111","aaaa");
ps.setElement2 ("[email protected]", US);

But it is not inserting data in the persistent store. App is struck to the persistent store setContent method... any idea on this?

the object you put in the store has implemented persistable, not your utility class.

Tags: BlackBerry Developers

Similar Questions

  • removeAllelement() method of the vector to remove persistent storage data

    Hello

    I store a vector in the persistent storage when I use removAllelement() vector method to remove all elements from the vector, this command deletes the data from the device of storage.why persistent, behaves like this. I use blackberry 8900 OS 4.6.1.

    the stored object is the same, you are currently handling. If another application is running a validation on a persistent store shops are kept and your empty vector is written in the persistent store, even without you commitment.

    You can copy the stored vector If you want to change it without changing the stored one.

  • Workaround for storing persistent objects I have persistent storage?

    I am storing configuration of sorts data in the persistent storage XML definitions and other data of type string.

    These data are read from a server when the application is installed and can also be requested by the user.

    It is stored in a hash table for the simple extraction and hash tables are saved in persistent storage, works well.

    Except for storing images that come in the format of png og files are not persistables. Who discovered the way lasts :-)

    Is there a way around this problem? All this data is delivered in a zip file from the server and everything is unpacked on the SD card. So is it possible to "turn" or "wrap" these png files so they can be stored in a persistent storage? Save them on the SD card are ok for temporary storage, but for 'permanent' storage, I like to keep in a persistent storage.

    arrays of bytes must be persistent.
    You can use http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/system/EncodedImage.html#getDa... to get bytes from an image, and you have already mentioned how to get it back.

    store in sqllite work similar.

  • store the object reference handle (MOR) to synchronize with the virtual center of vSphere

    Hello

    I am able to store a bit in my own DB and assume that they don't change, so that I can match the entities in the virtual centre with those of my database loading my application?

    Document best practices of Balaji Parimi (http://communities.vmware.com/docs/DOC-9912) States:

    Caching of managed object references rather than their
    Properties makes it easy to keep the cache to update. It is easier to maintain
    the cache, as the references remain unchanged until the managed object is removed from the inventory of managed object.

    Because of this comment, I am inclined to believe that I should be able to write the bit on my side in the DB and use them as described.

    Why I ask this is because:

    • It seems that a lot of people is keen to track VMs by uuid.  I'm guessing they are only followed VMs, otherwise they would probably have the same problem I'm having (ex: If a Resource Pool gets renamed while the application is down, how can you identify whether the same as the one you had).

    • The vSphere Web Services SDK Programming Guide seems to be confusing by having a section entitled Do not store Managed Object reference values.  This section seems just to point out that the MOR is not the same between the vCenter server and ESX box.  Because I don't like to manage the host communicating directly with it (and keep track of the GPR in this way), I don't see how this would apply.

    Has anyone been matching their own entities vmware with JAWS?  Is there a reason for (am I wrong something)?  Wouldn't be wonderful if this confusion has been cleared up by Balaji Parimi or VMware themselves.

    Thank you

    Ivan

    The recommendation contained in the best practices doc is right.

    You can store the MOR of an entity in your DB.

    For such objects as hosts, VMs data warehouses, etc... Essentially, this is the unique key that identifies the object.

    And the MOR will change during the lifetime of this object in the DB vCenter.

    The only way it modifies if it removes and adds the object. So for all practical purposes it is a new object anyway.

    What the program guide refers, is the fact that this MOR the 'ID' of the object is only within this system namespace.

    Thus, the VM MOR is unique within the Victoria Cross.

    That MOR are only may not or may not even be object even if you connect directly to the ESX host using the SDK.

    The guide is just trying to clarify that the MOR of a VMS in vCenter isn't the same as if you connect to the ESX host directly.

    That said, if you never connect to the ESX host directly you must not care about this specific recommendation in the guide.

    Hope that clarifies things.

  • store the datetime picker in persistent memory

    Hi all

    I develop an application that store some persistent settings. I managed to store some text field entries and control failover entered using qsettings-(fonctions getValueFor et saveValueFor) but is unable to do so in the case of date picker that getValueFor returns a qstring rather than QDateTime.

    If I tried to use settings.value () to get the qstring value stored in the parameter and use QDateTime::fromString to convert to QDateTime format that can each be passed to the qml by QDeclarativePropertyMap but without success

    My .cpp file-

     QDateTime date;
           QString dates=settings.value("userdob").toString();
           if(dates.isNull())
               //default value
           QDateTime date=QDateTime::fromString("1980-01-22","YYYY-MM-DD");
           else{
            date = QDateTime::fromString(dates, "YYYY-MM-DD");}
           QDeclarativePropertyMap* settingparam =
                   new QDeclarativePropertyMap;
           settingparam->insert("dates", date);
           qml->setContextProperty("userinfo", settingparam);
    

    . QML file-

                    DateTimePicker {
                        id:userdob
                        objectName:"userdob"
                        title: "Date of Birth"
    
                        value: userinfo.dates
                        translationY: -37.0
                            mode: DateTimePickerMode.Date
                         onValueChanged: {
                             app.saveValueFor(userdob.objectName,(userdob.value))
                         }
    
                        }
    

    Can someone help me please to do this work.

    Thank you

    That's fine, but I guess I suggests to me is you do a lot of extra work for yourself by putting a useless conversation in there. If all you want to do is save and reload a DateTimePicker, none of this is necessary.

    If you need the representation of string for something else, then of course do this way.

  • Use the case of the Cluster data without DRS storage store?

    Can someone tell me please the use case of the Cluster data without DRS storage store?

    Virtually no,.

    The only one that is useful is the aggregation of resources of data warehouses in a cluster data store. But it is aggregation of resources in its crudest form. When you create a virtual machine and the use of a cluster as the destination data store, you must always select the data store that will store the virtual machine.

    Storage DRS off =

    No calculation of initial investment

    No space load balancing

    No I/O load balancing

    No rule affinity VMDK

    No maintenance mode

    For this purpose a group of data without active DRS storage store is a kind of a data store folder.

  • When to use a persistent storage?

    Hi all

    I have created applications that use the persistent storage, and I created applications that use a SQLite database.  I also have applications that use both.  My question is this:

    Persistent storage should be limited to what it stores?  For example, should persistent storage serve more for purposes of storage of simple things like "font size selected user for the application" and "a hash of default language table and its code of language of the application"?  Alternatively, could also be recommended to act almost like a database, for example when a user does not have an SD card installed - in which case store you several vectors of objects and others?

    Is there a possibility of persistent storage is only not available due to limited space?  For example, if the user has a large number of other applications that use the persistent storage?

    Finally, I believe that persistent storage is only erased in the event of a battery pull, etc..  Is it also possible to delete in other ways, like a reboot?

    Thank you!

    I look at the characteristics of the data I store and the characteristics of the options (SQLite, folder on card SD or PeristentStore) and make a decision on this basis.

    The highlights for me are

    (a) the size of the data

    (b) requirement of presence

    (c) the use of the data

    (d) deletion of data

    Working through these:

    (a) size

    There is a reasonable amount of available devices, as well as more than PeristentStore.  If you have a vector of strings of 10,000, each 100 bytes long, it's always only! MB of storage.  And there are managers of low storage that you can listen to and store your use of the PersistentStore.  But there is more space on an SD card, and no chance to shake the Blackberry is that you use up too much memory (if you use PersistentStore the unit clears things like the old emails that can disrupt your users).

    (b) requirement of

    Don't forget that your users can remove the SD card and all data

    (c) the use of the data

    If the data lends itself to using an object of mode, it seems an appropriate way to store it in this form, which means that there is no "Serialization" required to make it a flat file or the conversion into a table.  But things like images, audio files and gain no advantage being stored as object.  So stick them on the SD card.

    (d) remove

    PersistentStore is deleted when the application is removed, which can be a good thing.

    In summary, there is no right answer here, use the best option for the job you have.

    With regard to your questions:

    "Is there a possibility of persistent storage is only not available due to limited space?

    Yesish, as mentioned, it is the low Storage Manager.  But to be honest, you can store megabytes of data in a table like structure in PersistentStore, and as long as you're careful, it will work fine.

    "I think that persistent storage is only erased in the event of a battery pull.

    No, it remains on a battery pull.  To clear, regular forms are to wipe the device, or remove the application that uses it.

  • Register a class in a persistent storage?

    I have a class with many defined configuration variables. These are defined during execution. Is it possible to back up and recover the class in a persistent storage? If so, how?

    The situation you are trying to encode to is easily manipulated with permanent storage.

    If you look at the works of persistent store, you basically store an object in a persistent crack, which is identified by an ID - the ID is along the value.  Anyone who knows the ID can access the object.

    However, to interpret the object, they must have the exact class which was used when the object was stored.  In your case, it's easy as your two 'Applications' will actually use the same class that they are actually just different entry points into the same set of code.

    This requirement for the same class to use, becomes a problem when you have two totally different applications using the same persistent ID.  In this case, both applications have to share a class library that defines the persistent object.

    But back to your situation, what you're trying to work with persistent store.

    To give you more feeling for her, if your application asks the persistent object, it gets a reference to an object in the flash memory.  When your GUI application did the same thing, he will get a reference to the same object.  Then they will certainly share data, and consider it both one and other updates.

    Hope that clears it for you.

  • work on deleting the object from the persistent store.

    Hello

    I use permanent storage to store custom objects, I am able to save, retrieve, and update object. I'm ranger object persistent using State figure "obj" below.here is my custom object that implements Persistable interafce.

    PersistentObject store = PersistentStore.getPersistentObject (0xa1a569278238dad2L);

    store.setContents (obj);

    Store.Commit ();

    But, when I'm trying to delete 'obj' to permanent storage, I found it is ignored, I use possible subsequently remove the object

    permanent storage.

    PersistentStore.destroyPersistentObject (0xa1a569278238dad2L);

    but when I try to get again in my code by using the following statement

    MyObject obj = store.getContents ();

    I get all the properties of 'obj', is there a programmatic way to destroy the object of permanent storage? or is it expected behavior?

    Make sure that you not only remove the store, but also get the new PersistentObject object thus:

    PersistentStore.destroyPersistentObject (key);

    PersistentObject persistObj = PersistentStore.getPersistentObject (key);

    Object myObject = persistObj.getContents ();

    If this does not work then you might have some problems with synchronization - remove any synchronization around this code and check again.

    See you soon

    Nik

  • Error in persistent storage when the application update that happened.

    I've been struggling with the problem for a long time.

    MY application uses a persistent storage to store parameter information.

    But when I update my application from version 1 to version 2, number of items in my configuration page has been changed, which means the new version of the page layout will load and save some new stuff in a persistent storage that did not exist in the old persistent storage.

    Problem occurs when custorms update their request. How can we drag all the old stored information when users start to use the updated application?

    I see these three options:

    (a) the best thing to do is to delete the old application, which will get rid of the old persistent data.

    (b) create a 'version2' of you persisted object with a different name.  In your treatment of startup, you see if there is a version 1 object, and if so, migrate the setting of the object Version in 1 to your new object.

    (c) try to your compatible changes.  There are different ways to do this.  A way that is easy to understand is to persist a string, which is your options encode in XML format.  If you use an XML string, then you can add a new attribute to your new options - but the persistent object remains the same.

    I hope this helps.

  • store integers in a persistent storage

    Hi all - I'm being a key on this one I don't know. The SDK V5. Have a persistent storage object that contains an integer. If its creation as:

    persistentHashtable.put ("GPRSUpdate", New Integer (180)); in a few seconds

    Now have an editsettings (behind a login screen) screen which displays the value and allows it to be updated using an editfield. I am then convert the integer to a string and then add it to the ediitfield as follows:

    If (persistentHashtable.containsKey ("GPRSUpdate")) {}
    Integer gprsInt = (Integer) persistentHashtable.get ("GPRSUpdate");
    testInt int = gprsInt.intValue ();
    String testString = Integer.toString (testInt);
    editGPRSUpdateInterval.setText (testString);
    }

    so, which works very well. The problem is that I can't save a change and then log in to the screen later without the bombing with a classcastexception error application. The problem, I'm sure that resides in the code that performs the backup that is as follows:

    public void saveOptions() {}
           
    String gprsUpdated = editGPRSUpdateInterval.getText ();
    int savegprsInt = Integer.parseInt (gprsUpdated);
            
    persistentHashtable.put ("GPRSUpdate", New Integer (savegprsInt));
        
    persistentObject.commit ();

    }

    Can someone please explain tp starting it what is the problem? I don't know that its confused me again between objects and data types, but if someone could point out where I'm wrong it would be appreciated. See you soon

    Nothing wrong with this code that I can see.

    Can you tell us the line that throws the exception of cast.  What kind of object you actually have (debugger should find that).

  • Help: The ESXi host has no persistent storage

    We have an ESXI 5.0 installed on our Dell server and we have some virtual machines running. suddenly, we had a mistake on Vsphere client.

    "EXSI host has no persistent storage.

    To run the virtual machine, create at least a data store for the maintenance of the machines virtual and other system files. »

    to resolve this problem, so we tried.

    On Vsphere client (connected to the ESXI)-> configuration-> storage-> rescan all... once the re-scanner has been done.

    We are able to see the file was mounted on the data store and it is lost in a minute. so it isn't permanently mounted to the data store to access the virtual machine.

    Once we do the re-scan once again, we saw that the file has been fitted to the data store and lost again.

    assemble and disassemble is to continue to switch.

    We need a solution to fix the problem, or in the worst case we need a way to recover the Esxi machine (VMS) data.

    Kindly share the reflections.

    It should be a disk error, it is local storage that tempt you and the virtual machine files are stored in the local disk

    don't forget to check the logs on the bit/ucs, regardless of the remote management tool, you use...

    Please check the log files and vobd.log vmkernel

  • insertLabel() in the Application object for storing persistent data

    I thought to store persistent information in the object of the application itself:

    Not so interesting snippet:

    app.insertLabel ("pxComplexName", "test");

    Later / safe restart

    app.extractLabel ("pxComplexName", "test");

    I know how to get labels from IDML. Does anyone know where the label of the Application is saved?

    I thougt about using this as a counter using simple script in a trial version of a script. Any thougts on this subject?

    Kind regards

    Gregor

    Labels of the application are saved in the application preferences file. When a user clears preferences, all recorded data as labels is removed. This can be a good thing or a bad thing - depending on what you need...

    Substances

  • When you try to upgrade to photos in app store I get this message "the object you requested is not available in the store US." does anyone else have this problem or can you tell me how to find pictures in the app store

    "When you try to upgrade to photos in app store I get this message"the object you requested is not available in the store US."does anyone else have this problem or can you tell me how to find pictures in the app store" someone else meets this.  Is it me or is it pictures?

    Ever photos first? It should have been included when you first update of Yosemite and now El Capitan. I know that iPhotos updates get a message like that, but I didn't know the Photos app with a message with it.

    Update to iPhoto to Photos for OS X - Apple support

  • The use of SQLite to store the JSON object

    Hello

    Can someone guide on how to store a JSON object returned after the use of the Adobe provide parser JSON which returns the native object

    as

    resultobject = JSON.decode (data)

    Where the data is a JSON string.

    The 'result' object is a complex subject, but I would like to keep this object because it is in the SQLite database.

    I tried BLOB for the column type but doesn't seem to work to store this object. Ideally, I prefer to use this way to avoid the redesign of the main code as I am currently using the SharedObject method.

    Any ideas?

    Can you just store the data as a BLOB string?

Maybe you are looking for