PRFile subclass on Gemstone Pier

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

PRFile subclass on Gemstone Pier

dario trussardi
Hi,

i work with the Gemstone version of Pier 2.0.

I use PRFile to save data into OODB but

        i'm interested to save  some Files directly into directory on the server.




For this i create a subclass of PRFile named PRFileOnDisk.

In this class i define the method:

         isAbstract  ^false

        label:  ^ 'FIle on disk'.

The  fileModel class method return:

        ^ ISTMAExternalFileModel

and the descriptionFile is set to:

        ^ MAFileDescription new
                kind: ISTMAExternalFileModel;
                accessor: #file;
                priority: 300;
                label: 'File on Disk';
                beEditable;
                yourself


The ISTMAExternalFileModel is a subclass of   MAExternalFileModel

and it work fine ( create directory and save data on the server disk )  for other  Magritte description based on MAFileDescription ( with kind set to ISTMAExternalFileModel ).




Now when in Pier i define a link with Type: 'File on disk' (  based on PRFileOnDisk  )

the system create the subdirectory on the server disk but don't save the file on it .

The file is managed how MAMemoryFileModel.


Any  idea about it ?

        Thanks,

                Dario



Reply | Threaded
Open this post in threaded view
|

Re: PRFile subclass on Gemstone Pier

dario trussardi
Ok,

i work around this problem.

The error is about the descriptionFile method define in the PRFileOnDisk class.

When the system create a description it consider the PRfile descriptionFile in all case.

I think when in the  class hierarchy the system found the same descriptionName...   it consider the last definition.

But i wrong ?

        Any considerations ?


        Thanks,
               
                Dario

> Hi,
>
> i work with the Gemstone version of Pier 2.0.
>
> I use PRFile to save data into OODB but
>
> i'm interested to save  some Files directly into directory on the server.
>
>
>
>
> For this i create a subclass of PRFile named PRFileOnDisk.
>
> In this class i define the method:
>
> isAbstract  ^false
>
> label:  ^ 'FIle on disk'.
>
> The  fileModel class method return:
>
> ^ ISTMAExternalFileModel
>
> and the descriptionFile is set to:
>
> ^ MAFileDescription new
> kind: ISTMAExternalFileModel;
> accessor: #file;
> priority: 300;
> label: 'File on Disk';
> beEditable;
> yourself
>
>
> The ISTMAExternalFileModel is a subclass of   MAExternalFileModel
>
> and it work fine ( create directory and save data on the server disk )  for other  Magritte description based on MAFileDescription ( with kind set to ISTMAExternalFileModel ).
>
>
>
>
> Now when in Pier i define a link with Type: 'File on disk' (  based on PRFileOnDisk  )
>
> the system create the subdirectory on the server disk but don't save the file on it .
>
> The file is managed how MAMemoryFileModel.
>
>
> Any  idea about it ?
>
> Thanks,
>
> Dario
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: PRFile subclass on Gemstone Pier

Dale Henrichs
In reply to this post by dario trussardi
Dario,

If I understand, you were able to fix your problem?

I did notice that the #fileModel method on the class-side of PRFile does
a detect on a SortedCollection ... so the first description matching the
  #descriptionFile is taken ... presumably there is a priority field in
the description that can force a description to be considered first?

Dale


[hidden email] wrote:

> Ok,
>
> i work around this problem.
>
> The error is about the descriptionFile method define in the PRFileOnDisk subclass.
>
> When the system create a description it consider the PRfile descriptionFile in all case.
>
> I think when in the  class hierarchy the system found the same descriptionName...   it consider the last definition.
>
> But i wrong ?
>
> Any considerations ?
>
>
> Thanks,
>
> Dario
>
>
>> Hi,
>>
>> i work with the Gemstone version of Pier 2.0.
>>
>> I use PRFile to save data into OODB but
>>
>> i'm interested to save  some Files directly into directory on the server.
>>
>>
>>
>>
>> For this i create a subclass of PRFile named PRFileOnDisk.
>>
>> In this class i define the method:
>>
>> isAbstract  ^false
>>
>> label:  ^ 'FIle on disk'.
>>
>> The  fileModel class method return:
>>
>> ^ ISTMAExternalFileModel
>>
>> and the descriptionFile is set to:
>>
>> ^ MAFileDescription new
>> kind: ISTMAExternalFileModel;
>> accessor: #file;
>> priority: 300;
>> label: 'File on Disk';
>> beEditable;
>> yourself
>>
>>
>> The ISTMAExternalFileModel is a subclass of   MAExternalFileModel
>>
>> and it work fine ( create directory and save data on the server disk )  for other  Magritte description based on MAFileDescription ( with kind set to ISTMAExternalFileModel ).
>>
>>
>>
>>
>> Now when in Pier i define a link with Type: 'File on disk' (  based on PRFileOnDisk  )
>>
>> the system create the subdirectory on the server disk but don't save the file on it .
>>
>> The file is managed how MAMemoryFileModel.
>>
>>
>> Any  idea about it ?
>>
>> Thanks,
>>
>> Dario
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki

Reply | Threaded
Open this post in threaded view
|

Re: PRFile subclass on Gemstone Pier

dario trussardi
Hi,

i solve the PRFileOnServerDisk subclass definition for save some files directly into directory on the server.

The only method i need to port from superclass ( PRFile ) is the class method descriptionFileGemStone: aDescription

descriptionFileGemStone: aDescription
       
        ^ aDescription
                kind: ISTMAExternalFileModel;
                yourself


With this definition when MABuilder create the descriptions cache for the PRFileOnServerDisk
       
        the descriptionFile is update by descriptionFileGemStone: aDescription   specifications

        and all work fine.



The question about the selection of descriptions with the same name in  class hierarchy is open.

  Thank,

                Dario


> Dario,
>
> If I understand, you were able to fix your problem?
>
> I did notice that the #fileModel method on the class-side of PRFile does a detect on a SortedCollection ... so the first description matching the  #descriptionFile is taken ... presumably there is a priority field in the description that can force a description to be considered first?
>
> Dale
>
>
> [hidden email] wrote:
>> Ok,
>> i work around this problem.
>> The error is about the descriptionFile method define in the PRFileOnDisk subclass.
>> When the system create a description it consider the PRfile descriptionFile in all case.
>> I think when in the  class hierarchy the system found the same descriptionName...   it consider the last definition.
>> But i wrong ?
>> Any considerations ?
>> Thanks,
>>
>> Dario
>>> Hi,
>>>
>>> i work with the Gemstone version of Pier 2.0.
>>>
>>> I use PRFile to save data into OODB but
>>>
>>> i'm interested to save  some Files directly into directory on the server.
>>>
>>>
>>>
>>>
>>> For this i create a subclass of PRFile named PRFileOnDisk.
>>>
>>> In this class i define the method:
>>>
>>> isAbstract  ^false
>>>
>>> label:  ^ 'FIle on disk'.
>>>
>>> The  fileModel class method return:
>>>
>>> ^ ISTMAExternalFileModel
>>>
>>> and the descriptionFile is set to:
>>>
>>> ^ MAFileDescription new
>>> kind: ISTMAExternalFileModel; accessor: #file;
>>> priority: 300;
>>> label: 'File on Disk';
>>> beEditable;
>>> yourself
>>>
>>>
>>> The ISTMAExternalFileModel is a subclass of   MAExternalFileModel
>>>
>>> and it work fine ( create directory and save data on the server disk )  for other  Magritte description based on MAFileDescription ( with kind set to ISTMAExternalFileModel ).
>>>
>>>
>>>
>>>
>>> Now when in Pier i define a link with Type: 'File on disk' (  based on PRFileOnDisk  )
>>>
>>> the system create the subdirectory on the server disk but don't save the file on it .
>>>
>>> The file is managed how MAMemoryFileModel.
>>>
>>>
>>> Any  idea about it ?
>>>
>>> Thanks,
>>>
>>> Dario
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Magritte, Pier and Related Tools ...
>>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>> _______________________________________________
>> Magritte, Pier and Related Tools ...
>> https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki