For Programmers: Free Programming Magazines  


Home > Archive > Smalltalk > July 2004 > Saving Objects?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Saving Objects?
Olaf Kapinski

2004-07-28, 9:08 pm

Hi!

I'm just starting with SmallTalk, Visual Works 7.2.

Try the following: Build a Datacollection-Object which contains two
Dirtionaries an some other Variables. The Dictionaties will store lots of
other Object. So far no Problem. But how can I save the Datacollection
Object to Disc?

Thanks a lot!

OLAF


Ricardo Birmann

2004-07-28, 9:08 pm

What exactly do you need??
If you want to create a database you could use PostgreSQL, but I have
never used it so I am not familiar with it. Anyway, from what I
understood from your post, that's not what you're looking for; if all
you want is to save a copy of the curent state of an object to disk,
you should use BOSS files. After loading the parcel BOSS, the following
code can be used to save a file:

str := ('pathToFileName' asFilename) writeStream.
(BinaryObjectStorage onNew: str) nextPut: yourObject.
str flush.

To load it back, use:

str := ('pathToFileName' asFilename) readStream.
aBOSSObject := ((BinaryObjectStorage onOld: str) contents).
yourObject := aBOSSObject at: 1.

hope it helps,

Ricardo

Anthony Lander

2004-07-28, 9:08 pm

Olaf Kapinski wrote:
> Try the following: Build a Datacollection-Object which contains two
> Dirtionaries an some other Variables. The Dictionaties will store lots of
> other Object. So far no Problem. But how can I save the Datacollection
> Object to Disc?


Make sure the BOSS parcel is loaded, then:

| boss fileStream |
fileStream := 'objects.boss' filename asFilename writeStream.
boss := BinaryObjectStorage onNew: fileStream.
boss nextPut: yourObject.
boss close.

Then to read it back:

| boss fileStream |
fileStream := 'objects.boss' filename asFilename readStream.
boss := BinaryObjectStorage onOld: fileStream.
yourObject := boss next.
boss close.

Best regards,

-anthony
M. Roberts

2004-07-28, 9:08 pm

Olaf,

As others have mentioned, the simplest solution is to use BOSS.

Documentation can be found in the Application Developer's Guide.

If you want more sophisticated functionality, like an object database, you
might consider OmniBase.

HTH,

M. Roberts
Cincom Systems, Inc.
Olaf Kapinski

2004-07-28, 9:08 pm

Thank you two for the Answers!

A little bit more exact: I created an Object, containing 2 Dictionaries. One
of the Dictionaries will contain Objects of the created Class
"IT-Application" and the other of "IT-Systems". Over the time I will fill
the Datastore-Object with datas an need to store ist (don't want to type in
all my Systems an Applications on every Start of the Tool 8-) ).

I will try the BOSS-tips. Are there any easy (!) possibilities to store such
a complex Object into an XML-File. No Pproblem, if not but would be nice.

Thanks a lot!!!!

OLAF




"M. Roberts" <mroberts@cincom.com> schrieb im Newsbeitrag
news:5b70f568.0407262232.1666e584@posting.google.com...
> Olaf,
>
> As others have mentioned, the simplest solution is to use BOSS.
>
> Documentation can be found in the Application Developer's Guide.
>
> If you want more sophisticated functionality, like an object database, you
> might consider OmniBase.
>
> HTH,
>
> M. Roberts
> Cincom Systems, Inc.



Ian Upright

2004-07-28, 9:08 pm

Have a look for a recent announcement in this newsgroup about SIXX, which
does exactly that -- serialization of objects using XML.

Ian

"Olaf Kapinski" <OK@ps.cox> wrote:

>Thank you two for the Answers!
>
>A little bit more exact: I created an Object, containing 2 Dictionaries. One
>of the Dictionaries will contain Objects of the created Class
>"IT-Application" and the other of "IT-Systems". Over the time I will fill
>the Datastore-Object with datas an need to store ist (don't want to type in
>all my Systems an Applications on every Start of the Tool 8-) ).
>
>I will try the BOSS-tips. Are there any easy (!) possibilities to store such
>a complex Object into an XML-File. No Pproblem, if not but would be nice.
>
>Thanks a lot!!!!
>
>OLAF


---
http://www.upright.net/ian/
Olaf Kapinski

2004-07-28, 9:08 pm

excelent Hint, thanks a lot!


(I didn't expected so much feedback in a SmallTalk Newsgroup. Thought, that
Language was nearly dead...)


Best regards to all!

OLAF

"Ian Upright" <ian-news@upright.net> schrieb im Newsbeitrag
news:2vvbg09bk6bq0nl9or0ad0dmnp050fqivt@
4ax.com...
> Have a look for a recent announcement in this newsgroup about SIXX, which
> does exactly that -- serialization of objects using XML.
>
> Ian
>
> "Olaf Kapinski" <OK@ps.cox> wrote:
>
One[color=darkred]
in[color=darkred]
such[color=darkred]
>
> ---
> http://www.upright.net/ian/



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com