problem with load D5 package in D6

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

problem with load D5 package in D6

Pavel
Hi ALL!
I have a trouble when I try install D5 package in D6 CE image.
Pls help me , How I can solve it?

PS. This package contain view with resource.

====================  stack =============
'The class ViewResource could not be found in the image'
ClassLocator(Object)>>error:
ClassLocator>>errorClassNotFound
ClassLocator(FileLocator)>>findOrImportForeignClass
ClassLocator>>locateClass
STBInFiler>>readClassLocator:
STBInFiler>>readClassData:
STBInFiler>>basicNext
STBInFiler>>next
Object class>>binaryReadFrom:context:
Object class>>binaryReadFrom:
Object class>>fromBinaryStoreBytes:
UndefinedObject>>{unbound}doIt
Compiler class>>evaluate:for:evaluationPools:logged:ifFail:
Compiler class>>evaluate:for:evaluationPools:logged:
Compiler class>>evaluate:for:logged:
[] in ChunkSourceFiler>>fileIn
ExceptionHandler(ExceptionHandlerAbstract)>>markAndTry
[] in ExceptionHandler(ExceptionHandlerAbstract)>>try:
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:
ExceptionHandler(ExceptionHandlerAbstract)>>try:
BlockClosure>>on:do:
ChunkSourceFiler>>fileIn
Package>>loadPAC:
[] in Package>>loadPAC
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:
Package>>loadPAC
Package>>load
PackageManager>>basicInstall:
[] in PackageManager>>install:
BlockClosure>>ifCurtailed:
[] in PackageManager>>install:
OrderedCollection>>do:
[] in PackageManager>>install:
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:
PackageManager>>install:
[] in PackageSelector>>openPackageFile:
ExceptionHandlerSet(ExceptionHandlerAbstract)>>markAndTry
[] in ExceptionHandlerSet(ExceptionHandlerAbstract)>>try:
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:
ExceptionHandlerSet(ExceptionHandlerAbstract)>>try:
BlockClosure>>onDo:
BlockClosure>>on:do:on:do:on:do:on:do:on:do:on:do:
PackageSelector>>openPackageFile:
[] in PackageSelector>>openPackage
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:


Reply | Threaded
Open this post in threaded view
|

Re: problem with load D5 package in D6

Sebastián Sastre
Try to get rid of any view resource on your code, that could possibly
be out of the standard dolphin controls and try again.

 good luck,

Sebastian


Reply | Threaded
Open this post in threaded view
|

Re: problem with load D5 package in D6

Chris Uppal-3
In reply to this post by Pavel
Pavel,

> I have a trouble when I try install D5 package in D6 CE image.

That /should/ work (although there are some potential problems, it usually
works OK).  It sounds as if one of the necessary classes is missing.  Do you
have package 'Dolphin Legacy Resource Framework' installed ?

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: problem with load D5 package in D6

Pavel
Chris, Tnx for reply
> It sounds as if one of the necessary classes is missing.  Do you
> have package 'Dolphin Legacy Resource Framework' installed ?
No. I'm using D6 CE standart image and this image don't contain that
package.
May be it impossible in D6 CE?


Reply | Threaded
Open this post in threaded view
|

Re: problem with load D5 package in D6

Andy Bower-3
Pavel,

> > It sounds as if one of the necessary classes is missing.  Do you
> > have package 'Dolphin Legacy Resource Framework' installed ?
> No. I'm using D6 CE standart image and this image don't contain that
> package.
> May be it impossible in D6 CE?

Hmm.. it looks like that is an omission from DCE. The Dolphin Legacy
Resource Framework is required to load in old packages and convert view
resources from the old STB format to the new Literal Filer format. I've
logged this as enhancement request #2150.

In the meantime you could try saving the following as "Dolphin Legacy
Resource Framework.pac" and loading it into your DCE image before
attempting to load your D5 package.

Best regards,

--
Andy Bower
Dolphin Support
www.object-arts.com

===Cuthere
| package |
package := Package name: 'Dolphin Legacy Resource Framework'.
package paxVersion: 1;
        basicComment: 'The classes here are the vestigial laegacy resource
framework from versions of Dolphin prior to 6.0. The are only require
when loading packages saved from these earlier versions of the system.'.


package classNames
        add: #Resource;
        add: #ResourceAccessor;
        add: #ResourceDummyAccessor;
        add: #ResourceGeneratorAccessor;
        add: #ResourceSTBAccessor;
        add: #ResourceSTBByteArrayAccessor;
        add: #ResourceSTBFileAccessor;
        add: #STBResourceSTBByteArrayAccessorProxy;
        add: #STBResourceSTBFileAccessorProxy;
        add: #ViewResource;
        yourself.

package methodNames
        add: #ChunkSourceFiler -> #fileOutResource:;
        add: #ResourceIdentifier -> #assignBinaryResourceData:;
        add: #RuntimeSessionManager -> #initializeFromSessionManager:;
        yourself.

package binaryGlobalNames: (Set new
        yourself).

package globalAliases: (Set new
        yourself).

package setPrerequisites: (IdentitySet new
        add: 'Dolphin';
        add: '..\MVP\Base\Dolphin MVP Base';
        yourself).

package!

"Class Definitions"!

Object subclass: #Resource
        instanceVariableNames: 'accessor icon'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
Object subclass: #ResourceAccessor
        instanceVariableNames: 'flags'
        classVariableNames: 'ChangedMask'
        poolDictionaries: ''
        classInstanceVariableNames: ''!
Resource subclass: #ViewResource
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
ResourceAccessor subclass: #ResourceDummyAccessor
        instanceVariableNames: 'object'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
ResourceAccessor subclass: #ResourceGeneratorAccessor
        instanceVariableNames: 'class selector'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
ResourceAccessor subclass: #ResourceSTBAccessor
        instanceVariableNames: 'classLocator'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
ResourceSTBAccessor subclass: #ResourceSTBByteArrayAccessor
        instanceVariableNames: 'byteArray'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
ResourceSTBAccessor subclass: #ResourceSTBFileAccessor
        instanceVariableNames: 'fileName'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
STBProxy subclass: #STBResourceSTBByteArrayAccessorProxy
        instanceVariableNames: 'bytes'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!
STBProxy subclass: #STBResourceSTBFileAccessorProxy
        instanceVariableNames: 'fileName bytes'
        classVariableNames: ''
        poolDictionaries: ''
        classInstanceVariableNames: ''!

"Global Aliases"!


"Loose Methods"!

!ChunkSourceFiler methodsFor!

fileOutResource: aResourceIdentifier
        "Append a definition of the resource identified by the
<ResourceIdentifier>,
        aResourceIdentifer, to the <puttableStream>, aWriteStream. The
definition should be
        sufficient to recreate a copy of the resource."

        stream
                nextPut: $(;
                print: aResourceIdentifier class;
                nextPutAll: ' class: ';
                print: aResourceIdentifier owningClass;
                nextPutAll: ' name: ';
                print: aResourceIdentifier name;
                nextPutAll: ') assign: (';
                print: Object;
                space;
                display: #fromBinaryStoreBytes:;
                cr.
        aResourceIdentifier resource asInternalResource binaryStoreBytes
base64StoreOn: stream.
        self emitChunk: ')'! !
!ChunkSourceFiler categoriesFor: #fileOutResource:!public!source
filing! !

!ResourceIdentifier methodsFor!

assignBinaryResourceData: aViewResource
        | view viewClass |
        viewClass := self class environment at: #View.
        view := aViewResource loadWithContext: viewClass desktop forEdit: true.
        self assign: view literalStoreArray.
        view destroy! !
!ResourceIdentifier categoriesFor: #assignBinaryResourceData:!private! !

!RuntimeSessionManager methodsFor!

initializeFromSessionManager: oldSessionManager
        "Private - The receiver has taken take over as the current session
        manager from oldSessionManager. This is an opportunity to transfer
        state information from the replaced manager."

        super initializeFromSessionManager: oldSessionManager.
        Smalltalk at: #ResourceAccessor ifPresent: [:ra | ra
ensureAccessorsAreInternal]! !
!RuntimeSessionManager categoriesFor:
#initializeFromSessionManager:!initializing!private! !

"End of package definition"!

"Source Globals"!

"Classes"!

Resource guid: (GUID fromString:
'{87B4C4AF-026E-11D3-9FD7-00A0CC3E4A32}')!
Resource comment: ''!
!Resource categoriesForClass!MVP-Resources! !
!Resource methodsFor!

accessor
        "Private - Answer the receiver's accessor instance var. This is the
object that contains
        the wherewithall to perform the actual load."

        ^accessor!

accessor: aResourceAccessor
        "Private - Set the receiver's accessor instance var to
aResourceAccessor. This is the object that contains
        the wherewithall to perform the actual load."

        accessor := aResourceAccessor!

asInternalResource
        "Answer a new instance whose accessor is internal to the image."

        | newResource |
        (newResource := self shallowCopy)
                accessor: accessor asInternalAccessor.
        ^newResource!

assignToResourceIdentifier: aResourceIdentifier
        "Private - Assign the receiver, as a binary resource array, to
aResourceIdentifier"

        aResourceIdentifier assignBinaryResourceData: self!

canSave
        "Answer whether the receiver represents a resource which can be
updated"

        ^accessor canSave!

copy
        "Private - Answer a copy of the receiver suitable for putting on the
ResourceManager clipboard."

        ^super copy
                accessor: accessor copy;
                yourself!

defaultContext
        "Private - Answer the default context to use when one is not provided."

        ^nil!

edit: aResourceIdentifier
        "Invoke a suitable editor to edit the receiver with the given
identity."

        ^self subclassResponsibility!

icon
        "Answer the icon used to represent this resource"

        ^icon ifNil: [super icon]!

icon: anIcon
        "Set the the icon used to represent this resource"

        icon := anIcon!

isChanged
        "Answer whether the resource has been changed since it was last saved
to disk."

        ^accessor isChanged!

isChanged: aBoolean
        "Flag the receiver as changed or not changed, according to the value
        of the <Boolean> argument."

        ^accessor isChanged: aBoolean!

isInternalResource
        "Answer whether the receiver represents a resource which is held
internally in the image"

        ^accessor isInternalAccessor!

load
        "Load an instance of the resource represented by the receiver."

        ^self loadWithContext: self defaultContext!

loadWithContext: context
        "Load the resource represented by the receiver with context as its
target context."

        ^self loadWithContext: context forEdit: false!

loadWithContext: context forEdit: aBoolean
        ^accessor loadWithContext: context forEdit: aBoolean!

makeByteArray
        "Store the resource represented by the receiver in a byteArray
accessed via a
        ResourceSTBByteArrayAccessor."

        accessor
                makeByteArrayClass: self class
                usingContext: self defaultContext!

makeFile: aResourceIdentifier
        "Store the resource represented by the receiver in an STBFile accessed
via a
        ResourceSTBFileAccessor. The name of the file should be based on
aResourceIdentifier."

        self makeFilename: (self class generateFileNameFrom:
aResourceIdentifier)
!

makeFilename: aStringFilename
        "Store the resource represented by the receiver in an STBFile accessed
via a
        ResourceSTBFileAccessor on aStringFilename."

        accessor
                makeFile: aStringFilename
                class: self class
                usingContext: self defaultContext!

resave
        "Loads and saves the receiver"

        self save: self load
!

save: anObject
        "Save anObject as the resource represented by the receiver. At the
same time extract
        a default icon to use to represent this resource"

        accessor save: anObject as: self class.
        self icon: anObject icon.!

show: aResourceIdentifier
        "Display the receiver in a suitable manner with the given identity."

        ^self subclassResponsibility! !
!Resource categoriesFor: #accessor!accessing!private! !
!Resource categoriesFor: #accessor:!accessing!private! !
!Resource categoriesFor: #asInternalResource!converting!public! !
!Resource categoriesFor: #assignToResourceIdentifier:!private! !
!Resource categoriesFor: #canSave!public!testing! !
!Resource categoriesFor: #copy!operations!private! !
!Resource categoriesFor: #defaultContext!constants!private! !
!Resource categoriesFor: #edit:!operations!public! !
!Resource categoriesFor: #icon!accessing!public! !
!Resource categoriesFor: #icon:!accessing!public! !
!Resource categoriesFor: #isChanged!public!testing! !
!Resource categoriesFor: #isChanged:!accessing!public! !
!Resource categoriesFor: #isInternalResource!public!testing! !
!Resource categoriesFor: #load!operations!public! !
!Resource categoriesFor: #loadWithContext:!operations!public! !
!Resource categoriesFor: #loadWithContext:forEdit:!operations!public! !
!Resource categoriesFor: #makeByteArray!mutating!public! !
!Resource categoriesFor: #makeFile:!development!mutating!public! !
!Resource categoriesFor: #makeFilename:!mutating!public! !
!Resource categoriesFor: #resave!operations!public! !
!Resource categoriesFor: #save:!operations!public! !
!Resource categoriesFor: #show:!operations!public! !

!Resource class methodsFor!

copyAllToClipboard: aCollection
        "Create new instances of the receiver for each of the elements of
aCollection.
    with a ResourceSTBByteArrayAccessor and save it to the
ResourceManager's clipboard."

        | resourceManager |
        (resourceManager := SessionManager current resourceManager)
clearClipboard.
        aCollection do:
                        [:each |
                        | res |
                        (res := self inSTBByteArray) save: each.
                        resourceManager addToClipboard: (InternalDragDropObject object:
res)]!

copyToClipboard: anObject
    "Create a new instance of the receiver with a
ResourceSTBByteArrayAccessor and save it to the
    ResourceManager's clipboard."
   
    | res |
    res := self inSTBByteArray
    save: anObject;
    yourself.
    SessionManager current resourceManager
    clearClipboard;
    addToClipboard: (InternalDragDropObject object: res).
    !

createdFromClass: aClass selector: selector
        "Answer an instance of the receiver which will create new object on
each call to #load
        or #loadWithContext:. The new object is created by sending selector to
aClass with a
        parameter of the context passed to #loadWithContext:."

        ^super new
                accessor: (ResourceGeneratorAccessor class: aClass selector:
selector);
                yourself!

defaultWritable
        "Answer a writable resource suitable for containing a resource.
        By default, Resources are stored in a ByteArray in the image."

        ^self inSTBByteArray!

dummy
        "Answer an instance of the receiver which will directly hold its
resource data."

        ^super new
                accessor: ResourceDummyAccessor new;
                yourself!

fileExtension
        "Private - Answer the file extension associated with resources of this
type when
        stored in files. Must be overridden by subclasses as necessary."

        ^'stb'!

generateFileNameFrom: aResourceIdentifier
        "Private - Answer a file name suitable for holding the resource
identified by aResourceIdentifier."

        | package |
        package := Package manager packageOfResourceIdentifierOrItsClass:
aResourceIdentifier.
        ^self generateFilenameFrom: aResourceIdentifier inPackage: package!

generateFilenameFrom: aResourceIdentifier inPackage: package
        | path |
        path := package isNil ifTrue: [''] ifFalse: [package path].
        ^File
                composePath: path
                stem: aResourceIdentifier displayString
                extension: self fileExtension!

icon
        "Answers an Icon that can be used to represent this class"

        ^##(self) defaultIcon!

inSTBByteArray
        "Answer an instance of the receiver which will save/load its resource
data to a
        ByteArray in STB format."

        ^super new
                accessor: ResourceSTBByteArrayAccessor new;
                yourself!

inSTBFileWithName: aFileName
        "Answer an instance of the receiver which will save/load its resource
data to/from an STB file
        with name aFileName."

        ^super new
                accessor: (ResourceSTBFileAccessor onFileName: aFileName);
                yourself!

inSTBFileWithNameBasedOn: aResourceIdentifier
        "Answer an instance of the receiver which will save/load its resource
data to/from an STB file
        whose name is based on aResourceIdentifier."

        ^self inSTBFileWithName: (self  generateFileNameFrom:
aResourceIdentifier)!

save: anObject toFiler: anSTBOutFiler
        "Private - Save anObject to the STBOutFiler provided."

        anSTBOutFiler nextPut: anObject!

stbConvertFrom: anSTBClassFormat
        "Convert from version 0 Resource. Version 1 adds an icon instance var"

        ^
        [:data |
        | newInstance |
        newInstance := self basicNew.
        1 to: data size do: [:i | newInstance instVarAt: i put: (data at: i)].
        newInstance]!

stbVersion
        "Answer the current binary filer version number for instances of the
receiver."

        ^1! !
!Resource class categoriesFor: #copyAllToClipboard:!copying!public! !
!Resource class categoriesFor: #copyToClipboard:!binary filing!public! !
!Resource class categoriesFor: #createdFromClass:selector:!instance
creation!public! !
!Resource class categoriesFor: #defaultWritable!instance
creation!public! !
!Resource class categoriesFor: #dummy!instance creation!public! !
!Resource class categoriesFor: #fileExtension!constants!private! !
!Resource class categoriesFor:
#generateFileNameFrom:!development!filename manipulation!private! !
!Resource class categoriesFor:
#generateFilenameFrom:inPackage:!development!filename
manipulation!private! !
!Resource class categoriesFor: #icon!constants!public! !
!Resource class categoriesFor: #inSTBByteArray!instance
creation!public! !
!Resource class categoriesFor: #inSTBFileWithName:!instance
creation!public! !
!Resource class categoriesFor:
#inSTBFileWithNameBasedOn:!development!instance creation!public! !
!Resource class categoriesFor: #save:toFiler:!binary filing!private! !
!Resource class categoriesFor: #stbConvertFrom:!binary filing!public! !
!Resource class categoriesFor: #stbVersion!binary filing!public! !

ResourceAccessor guid: (GUID fromString:
'{87B4C4B0-026E-11D3-9FD7-00A0CC3E4A32}')!
ResourceAccessor comment: ''!
!ResourceAccessor categoriesForClass!MVP-Resources! !
!ResourceAccessor methodsFor!

asInternalAccessor
        "Private - Answer the receiver or a new resource accessor whose
resources data is
        held entirely within the image."

        ^self!

canSave
        "Answer whether the receiver is capable of saving a resource."

        ^true!

hiddenObjects
        "Private - Answers a <Set> of all the <Object>s that are referenced by
or contained in the
        receiver's resource but that cannot be guaranteed to be present in the
image at the current time."

        ^Set new!

initialize
        "Private - Initialize the receiver."

        flags := 0!

isChanged
        "Answer whether the receiver has been modified since its Changed flag
was last reset."

        ^flags anyMask: ChangedMask!

isChanged: aBoolean
        "Private - Set the receiver's Changed flag to aBoolean."

        flags := flags mask: ChangedMask set: aBoolean!

isInternalAccessor
        "Answer true if the receiver denotes a resource that is held internal
to the image"

        ^true!

loadWithContext: anObject forEdit: isLoadingForEdit
        "Answer an instance of the resource held represented by the receiver.
        The new instance requires a context in which to live, this is provided
by context."

        ^self subclassResponsibility!

makeByteArrayClass: aResourceClass usingContext: context
        "Private - Mutate the receiver to a ResourceSTBByteArrayAccessor using
the context to load
        the resource (if required), and the resources class aResourceClass to
resave it."

        | byteArrayAccessor |
        byteArrayAccessor := ResourceSTBByteArrayAccessor new.
        byteArrayAccessor save: (self loadWithContext: context forEdit: false)
as: aResourceClass.
        self become: byteArrayAccessor!

makeFile: aString class: aResourceClass usingContext: context
        "Private - Mutate the receiver to a ResourceSTBFileAccessor using the
context to load
        the resource (if required), and the resources class aResourceClass to
resave it into
        an STB file named aString."

        | fileAccessor |
        fileAccessor := ResourceSTBFileAccessor onFileName: aString.
        fileAccessor save: (self loadWithContext: context forEdit: false) as:
aResourceClass.
        self become: fileAccessor!

save: anObject as: aResourceClass
        "Save out anObject in the format dictated by aResourceClass."

        ^self subclassResponsibility! !
!ResourceAccessor categoriesFor:
#asInternalAccessor!converting!private! !
!ResourceAccessor categoriesFor: #canSave!public!testing! !
!ResourceAccessor categoriesFor: #hiddenObjects!image
stripping!private! !
!ResourceAccessor categoriesFor: #initialize!operations!private! !
!ResourceAccessor categoriesFor: #isChanged!public!testing! !
!ResourceAccessor categoriesFor: #isChanged:!accessing!private! !
!ResourceAccessor categoriesFor: #isInternalAccessor!public!testing! !
!ResourceAccessor categoriesFor:
#loadWithContext:forEdit:!operations!public! !
!ResourceAccessor categoriesFor:
#makeByteArrayClass:usingContext:!converting!private! !
!ResourceAccessor categoriesFor:
#makeFile:class:usingContext:!converting!private! !
!ResourceAccessor categoriesFor: #save:as:!operations!public! !

!ResourceAccessor class methodsFor!

ensureAccessorsAreInternal
        "Private - Convert all the accessor instances so that the resource
data is held within
        the image rather than as separate files, etc."

        ResourceAccessor allSubinstances do: [:aResourceAccessor |
                aResourceAccessor become: aResourceAccessor asInternalAccessor]!

icon
        "Answers an Icon that can be used to represent this class"

        ^Resource icon!

initialize
        "Private - Initialize the receiver."

        ChangedMask := 16r01.!

new
        "Answer a new initialized instance of the receiver."

        ^super new
                initialize;
                yourself!

stbConvertFrom: anSTBClassFormat
        "Answer a block to convert the given data array to the current
version."

        anSTBClassFormat version > self stbVersion
                ifTrue: [^super stbConvertFrom: anSTBClassFormat].
        ^
        [:data |
        | newInstance array |
        array := data.
        anSTBClassFormat version to: self stbVersion - 1
                do:
                        [:version |
                        | selector |
                        selector := ('stbConvertFromVersion' , version displayString , ':')
asSymbol.
                        array := self perform: selector with: array].
        newInstance := self basicNew.
        1 to: self instSize do: [:i | newInstance instVarAt: i put: (array at:
i)].
        newInstance]!

stbConvertFromVersion0: version0Array
        "Private - Convert from version 0 to version 1.

        instVarAt: Version 1 Version 0
        ---------- --------- ---------
                1 flags whatever...
                2 whatever..."

        ^(WriteStream on: Array new)
                nextPut: 0;
                nextPutAll: version0Array;
                contents
! !
!ResourceAccessor class categoriesFor:
#ensureAccessorsAreInternal!operations!private! !
!ResourceAccessor class categoriesFor:
#icon!constants!development!public! !
!ResourceAccessor class categoriesFor:
#initialize!development!initializing!private! !
!ResourceAccessor class categoriesFor: #new!instance creation!public! !
!ResourceAccessor class categoriesFor: #stbConvertFrom:!binary
filing!public! !
!ResourceAccessor class categoriesFor: #stbConvertFromVersion0:!binary
filing!private! !

ViewResource guid: (GUID fromString:
'{A018036D-0816-4244-A08B-0CB433E4EB97}')!
ViewResource comment: ''!
!ViewResource categoriesForClass!MVP-Resources! !
!ViewResource class methodsFor!

fileExtension
        "Private - Answer the file extension associated with resources of this
type when
        stored in files."

        ^'vu'! !
!ViewResource class categoriesFor: #fileExtension!private! !

ResourceDummyAccessor guid: (GUID fromString:
'{87B4C6D7-026E-11D3-9FD7-00A0CC3E4A32}')!
ResourceDummyAccessor comment: ''!
!ResourceDummyAccessor categoriesForClass!MVP-Resources! !
!ResourceDummyAccessor methodsFor!

loadWithContext: anObject forEdit: isLoadingForEdit
        "Answer an instance of the resource held in the receiver.
        If the new instance requires a context in which to live, this is
provided by context."

        ^object!

object: anObject
        "Set the receiver's object inst var to anObject. This will be answered
directly on load."

        object := anObject!

save: anObject as: aResourceClass
        "Save out anObject in the format dictated by aResourceClass."

        self object: anObject.
        self isChanged: true! !
!ResourceDummyAccessor categoriesFor:
#loadWithContext:forEdit:!operations!public! !
!ResourceDummyAccessor categoriesFor: #object:!accessing!public! !
!ResourceDummyAccessor categoriesFor: #save:as:!operations!public! !

!ResourceDummyAccessor class methodsFor!

stbVersion
        "Answer the current binary filer version number for instances of the
receiver."

        ^1! !
!ResourceDummyAccessor class categoriesFor: #stbVersion!binary
filing!public! !

ResourceGeneratorAccessor guid: (GUID fromString:
'{87B4C6D8-026E-11D3-9FD7-00A0CC3E4A32}')!
ResourceGeneratorAccessor comment: ''!
!ResourceGeneratorAccessor categoriesForClass!MVP-Resources! !
!ResourceGeneratorAccessor methodsFor!

canSave
        "Answer whether the receiver is capable of saving a resource."

        ^false!

class: aClass selector: aSelector
        "Set the receiver's inst vars from the parameters."

        class := aClass.
        selector := aSelector!

loadWithContext: anObject forEdit: isLoadingForEdit
        "Answer an instance of the resource held represented by the receiver.
        The new instance requires a context in which to live, this is provided
by context."

        ^class perform: selector with: anObject!

save: anObject as: aResource
        "Save out anObject in the format dictated by aResourceClass."

        ^self shouldNotImplement! !
!ResourceGeneratorAccessor categoriesFor: #canSave!public!testing! !
!ResourceGeneratorAccessor categoriesFor: #class:selector:!instance
creation!public! !
!ResourceGeneratorAccessor categoriesFor:
#loadWithContext:forEdit:!operations!public! !
!ResourceGeneratorAccessor categoriesFor: #save:as:!operations!public! !

!ResourceGeneratorAccessor class methodsFor!

class: aClass selector: aSelector
        "Answer a new instance of the receiver initialized from the
parameters."

        ^self new
                class: aClass selector: aSelector;
                yourself!

stbVersion
        "Answer the current binary filer version number for instances of the
receiver."

        ^1! !
!ResourceGeneratorAccessor class categoriesFor:
#class:selector:!instance creation!public! !
!ResourceGeneratorAccessor class categoriesFor: #stbVersion!instance
creation!public! !

ResourceSTBAccessor guid: (GUID fromString:
'{0CC7574B-24F8-4714-9068-6C282E7BF1F1}')!
ResourceSTBAccessor comment: ''!
!ResourceSTBAccessor categoriesForClass!MVP-Resources! !
!ResourceSTBAccessor methodsFor!

byteArray
        "Private - Answer the receiver's byteArray inst var."

        ^self subclassResponsibility!

classLocator
        "Private - Answer the class locator used to import referenced classes
into the image"

        ^classLocator!

classLocator: aClassLocator
        "Private - Set the receiver's classLocator inst var to aClassLocator.
        This will be injected into the filer used to load the resource so that
        any references to remote classes can be resolved."

        classLocator := aClassLocator!

hiddenObjects
        "Private - Answers a <collection> of the <Object>s that are contained
in the receiver's resource
        Implementation note. This is not particularly fast since it loads the
resource and any external
        classes it needs into the image. View resources will not be realized
as windows however."

        | stream |
        stream := self readStream.
        ^
        [(STBInFiler on: stream)
                basicNext;
                readMap] ensure: [stream close]!

initialize
        "Private - Initialize the receiver."

        super initialize.
        self classLocator: ClassLocator new!

loadWithContext: anObject forEdit: isLoadingForEdit
        "Answer an instance of the resource held in the STB file associated
with the receiver.
        If the new instance requires a context in which to live, this is
provided by context."

        | stream |
        stream := self readStream.
        ^
        [(STBInFiler on: stream)
                classLocator: classLocator copyWithCodeBase;
                isUpgrading: isLoadingForEdit;
                context: anObject;
                next]
                        ensure: [stream close]!

readStream
        ^self subclassResponsibility!

save: anObject as: aResourceClass on: stream
        aResourceClass save: anObject toFiler: (STBOutFiler on: stream)! !
!ResourceSTBAccessor categoriesFor: #byteArray!accessing!private! !
!ResourceSTBAccessor categoriesFor: #classLocator!accessing!private! !
!ResourceSTBAccessor categoriesFor: #classLocator:!accessing!private! !
!ResourceSTBAccessor categoriesFor: #hiddenObjects!image
stripping!private! !
!ResourceSTBAccessor categoriesFor: #initialize!initializing!private! !
!ResourceSTBAccessor categoriesFor:
#loadWithContext:forEdit:!operations!public! !
!ResourceSTBAccessor categoriesFor: #readStream!accessing!private! !
!ResourceSTBAccessor categoriesFor: #save:as:on:!operations!private! !

ResourceSTBByteArrayAccessor guid: (GUID fromString:
'{87B4C6D9-026E-11D3-9FD7-00A0CC3E4A32}')!
ResourceSTBByteArrayAccessor comment: ''!
!ResourceSTBByteArrayAccessor categoriesForClass!MVP-Resources! !
!ResourceSTBByteArrayAccessor methodsFor!

byteArray
        "Private - Answer the receiver's byteArray inst var."

        ^byteArray!

byteArray: aByteArray
        "Private - Set the receiver's byteArray inst var to aByteArray. This
is the STB format
        data file from which the receiver will load instances of the resource."

        byteArray := aByteArray!

makeByteArrayClass: aResourceClass usingContext: context
        "Private - Mutate the receiver to a ResourceSTBByteArrayAccessor using
the context to load
        the resource (if required), and the resources class aResourceClass to
resave it."

        ^self!

makeFile: aString class: aResourceClass usingContext: context
        "Private - Mutate the receiver to a ResourceSTBFileAccessor using the
context to load
        the resource (if required), and the resources class aResourceClass to
resave it into
        an STB file named aString."

        | stream |
        stream := FileStream write: aString text: false.
        [
                stream nextPutAll: byteArray
        ] ensure: [stream close].

        self become: (ResourceSTBFileAccessor onFileName: aString)
!

postCopy
        super postCopy.
        byteArray := byteArray copy.
        ^self!

readStream
        ^byteArray readStream!

save: anObject as: aResourceClass
        "Save out anObject in the format dictated by aResourceClass."

        | stream |
        stream := ByteArray writeStream: 256.
        self
                save: anObject
                as: aResourceClass
                on: stream.
        byteArray := stream contents.
        self isChanged: true!

stbSaveOn: anSTBOutFiler
        "Output the receiver to anSTBOutFiler.
        The proxy is required so that we can propagate the codebase of the
loading
        STBInFiler into the reconstituted accessor thus allowing us to resolve
remote
        class references within a resource."

        anSTBOutFiler saveObject: self as:
(STBResourceSTBByteArrayAccessorProxy forAccessor: self)! !
!ResourceSTBByteArrayAccessor categoriesFor:
#byteArray!accessing!private! !
!ResourceSTBByteArrayAccessor categoriesFor:
#byteArray:!accessing!private! !
!ResourceSTBByteArrayAccessor categoriesFor:
#makeByteArrayClass:usingContext:!mutating!private! !
!ResourceSTBByteArrayAccessor categoriesFor:
#makeFile:class:usingContext:!mutating!private! !
!ResourceSTBByteArrayAccessor categoriesFor: #postCopy!copying!private!
!
!ResourceSTBByteArrayAccessor categoriesFor:
#readStream!accessing!private! !
!ResourceSTBByteArrayAccessor categoriesFor:
#save:as:!operations!public! !
!ResourceSTBByteArrayAccessor categoriesFor: #stbSaveOn:!binary
filing!public! !

!ResourceSTBByteArrayAccessor class methodsFor!

onByteArray: aByteArray
        "Answer a new instance of the receiver capable of loading instances
from the
        data in STB format in aByteArray."

        ^self new
                byteArray: aByteArray
                yourself!

stbConvertFromVersion1: version1Array
        "Private - Convert version1Array to version 2 format and answer the
new Array.

        instVarAt: Version 2 Version 1
        ---------- --------- ---------
                1 flags flags
                2 classLocator byteArray
                3 byteArray"

        ^Array
                with: (version1Array at: 1)
                with: ClassLocator new
                with: (version1Array at: 2)!

stbVersion
        "Answer the current binary filer version number for instances of the
receiver."

        ^2! !
!ResourceSTBByteArrayAccessor class categoriesFor:
#onByteArray:!instance creation!public! !
!ResourceSTBByteArrayAccessor class categoriesFor:
#stbConvertFromVersion1:!binary filing!private! !
!ResourceSTBByteArrayAccessor class categoriesFor: #stbVersion!binary
filing!public! !

ResourceSTBFileAccessor guid: (GUID fromString:
'{87B4C6DA-026E-11D3-9FD7-00A0CC3E4A32}')!
ResourceSTBFileAccessor comment: ''!
!ResourceSTBFileAccessor categoriesForClass!MVP-Resources! !
!ResourceSTBFileAccessor methodsFor!

asInternalAccessor
        "Private - Answer the receiver or a new resource accessor whose
resources data is
        held entirely within the image."

        ^ResourceSTBByteArrayAccessor onByteArray: self byteArray!

byteArray
        "Private - Answer a ByteArray of the contents of the receivers file."

        | stream |
        stream := self readStream.
        ^[stream contents] ensure: [stream close]!

copy
        "Private - Answer a copy of the receiver suitable for putting on the
ResourcManager clipboard."

        ^self asInternalAccessor!

fileName
        "Private - Answer the receiver's fileName inst var to aString. This is
the name
        of the STB file from which the receiver will load instances of the
resource."

        ^fileName!

fileName: aString
        "Private - Set the receiver's fileName inst var to aString. This is
the name
        of the STB file from which the receiver will load instances of the
resource."

        fileName := aString!

isInternalAccessor
        "Answer true if the receiver denotes a resource that is held internal
to the image"

        ^false!

makeByteArrayClass: aResourceClass usingContext: context
        "Private - Mutate the receiver to a ResourceSTBByteArrayAccessor using
the context to load
        the resource (if required), and the resources class aResourceClass to
resave it."

        self become: self asInternalAccessor!

makeFile: aString class: aResourceClass usingContext: context
        "Private - Mutate the receiver to a ResourceSTBFileAccessor using the
context to load
        the resource (if required), and the resources class aResourceClass to
resave it into
        an STB file named aString."
!

readStream
        ^FileStream read: fileName text: false!

save: anObject as: aResourceClass
        "Save out anObject in the format dictated by aResourceClass."

        | stream |
        stream := FileStream write: fileName text: false.
       
        [self
                save: anObject
                as: aResourceClass
                on: stream] ensure: [stream close]!

stbSaveOn: anSTBOutFiler
        "Output the receiver to anSTBOutFiler.
        If anSTBOutFiler has a non-nil context we assume this to be a Boolean
        that identifies whether resources should be saved as a single file. If
so, we
        store the receivers resource file data inline, and regenerate the file
on load.
        Also, the proxy is required so that we can propagate the codebase of
the loading
        STBInFiler into the reconstituted accessor thus allowing us to resolve
remote
        class references within a resource."

        | singleFile proxy |
        singleFile := anSTBOutFiler context.

        proxy := (singleFile notNil and: [singleFile])
                ifTrue: [STBResourceSTBFileAccessorProxy withEmbeddedFile: self]
                ifFalse: [STBResourceSTBFileAccessorProxy withExternalFile: self].

        anSTBOutFiler saveObject: self as: proxy! !
!ResourceSTBFileAccessor categoriesFor:
#asInternalAccessor!converting!private! !
!ResourceSTBFileAccessor categoriesFor: #byteArray!accessing!private! !
!ResourceSTBFileAccessor categoriesFor: #copy!copying!private! !
!ResourceSTBFileAccessor categoriesFor: #fileName!accessing!private! !
!ResourceSTBFileAccessor categoriesFor: #fileName:!accessing!private! !
!ResourceSTBFileAccessor categoriesFor:
#isInternalAccessor!public!testing! !
!ResourceSTBFileAccessor categoriesFor:
#makeByteArrayClass:usingContext:!mutating!private! !
!ResourceSTBFileAccessor categoriesFor:
#makeFile:class:usingContext:!mutating!private! !
!ResourceSTBFileAccessor categoriesFor: #readStream!accessing!private! !
!ResourceSTBFileAccessor categoriesFor: #save:as:!operations!public! !
!ResourceSTBFileAccessor categoriesFor: #stbSaveOn:!binary
filing!public! !

!ResourceSTBFileAccessor class methodsFor!

onFileName: aString
        "Answer a new instance of the receiver capable of loading instances of
the contents
        of the STB file named aString."

        ^self new
                fileName: aString;
                yourself!

stbConvertFromVersion1: version1Array
        "Private - Convert version1Array to version 2 format and answer the
new Array.

        instVarAt: Version 1 Version 0
        ---------- --------- ---------
                1 flags flags
                2 classLocator fileName
                3 fileName"

        ^Array
                with: (version1Array at: 1)
                with: ClassLocator new
                with: (version1Array at: 2)!

stbVersion
        "Answer the current binary filer version number for instances of the
receiver."

        ^2! !
!ResourceSTBFileAccessor class categoriesFor: #onFileName:!instance
creation!public! !
!ResourceSTBFileAccessor class categoriesFor:
#stbConvertFromVersion1:!binary filing!private! !
!ResourceSTBFileAccessor class categoriesFor: #stbVersion!binary
filing!public! !

STBResourceSTBByteArrayAccessorProxy guid: (GUID fromString:
'{87B4C6F0-026E-11D3-9FD7-00A0CC3E4A32}')!
STBResourceSTBByteArrayAccessorProxy comment: ''!
!STBResourceSTBByteArrayAccessorProxy categoriesForClass!System-Binary
storage! !
!STBResourceSTBByteArrayAccessorProxy methodsFor!

bytes: aByteArray
        "Private - Set the receiver's bytes inst var to a ByteArray."

        bytes := aByteArray!

stbFixup: inFiler at: anInteger
        "Answer the object that this one represents.
        We propagate the codebase of the loading STBInFiler into the
reconstituted
        accessor so that it can resolve any remote class references within its
        resource data."

        | accessor classLocator |
        classLocator := inFiler classLocator copyWithCodeBase.
        (accessor := ResourceSTBByteArrayAccessor onByteArray: bytes)
classLocator: classLocator.

        self become: accessor! !
!STBResourceSTBByteArrayAccessorProxy categoriesFor:
#bytes:!accessing!private! !
!STBResourceSTBByteArrayAccessorProxy categoriesFor:
#stbFixup:at:!converting!public! !

!STBResourceSTBByteArrayAccessorProxy class methodsFor!

for: aResourceSTBByteArrayAccessor
        #deprecated.
        ^self forAccessor: aResourceSTBByteArrayAccessor!

forAccessor: aResourceSTBByteArrayAccessor
        "Answer a new initialized instance of the receiver encoding
aResourceSTBByteArrayAccessor.
        This proxy allows us the opportunity to set up the accessor's
classLocator to that held by the
        STBInFiler used to load it. This then enables the STBInFiler to
generate a ClassStub for any
        remote class references embedded in the STB."

        ^self basicNew
                bytes: aResourceSTBByteArrayAccessor byteArray;
                yourself! !
!STBResourceSTBByteArrayAccessorProxy class categoriesFor:
#for:!instance creation!public! !
!STBResourceSTBByteArrayAccessorProxy class categoriesFor:
#forAccessor:!instance creation!public! !

STBResourceSTBFileAccessorProxy guid: (GUID fromString:
'{87B4C6F1-026E-11D3-9FD7-00A0CC3E4A32}')!
STBResourceSTBFileAccessorProxy comment: ''!
!STBResourceSTBFileAccessorProxy categoriesForClass!System-Binary
storage! !
!STBResourceSTBFileAccessorProxy methodsFor!

bytes: aByteArray
        "Private - Set the receiver's bytes inst var to a ByteArray."

        bytes := aByteArray!

fileName: aString
        "Private - Set the receiver's fileName inst var to aString."

        fileName := aString!

stbFixup: inFiler at: anInteger
        "Answer the object that this one represents.
        If the receiver's bytes inst var is non-nil then we create a new file
containing
        this data - the contents of the original ResourceSTBFileAccesor file.
Also,
        we propagate the codebase of the loading STBInFiler into the
reconstituted
        accessor so that it can resolve any remote class references within its
        resource STB data."

        | accessor classLocator |
        bytes notNil
                ifTrue:
                        [| stream |
                        stream := FileStream write: fileName text: false.
                        [stream nextPutAll: bytes] ensure: [stream close]].
        classLocator := inFiler classLocator copyWithCodeBase.
        (accessor := ResourceSTBFileAccessor onFileName: fileName)
classLocator: classLocator.
        self become: accessor! !
!STBResourceSTBFileAccessorProxy categoriesFor:
#bytes:!accessing!private! !
!STBResourceSTBFileAccessorProxy categoriesFor:
#fileName:!accessing!private! !
!STBResourceSTBFileAccessorProxy categoriesFor:
#stbFixup:at:!converting!public! !

!STBResourceSTBFileAccessorProxy class methodsFor!

withEmbeddedFile: aResourceSTBFileAccessor
        "Answer a new instance of the receiver with the contents of
aResourceSTBFileAccessor's file
        embedded in its bytes inst var."

        ^self basicNew
                fileName: aResourceSTBFileAccessor fileName;
                bytes: aResourceSTBFileAccessor byteArray;
                yourself!

withExternalFile: aResourceSTBFileAccessor
        "Answer a new instance of the receiver containing the
aResourceSTBFileAccessor's file
        name only, leaving its bytes inst var nil."

        ^self basicNew
                fileName: aResourceSTBFileAccessor fileName;
                yourself! !
!STBResourceSTBFileAccessorProxy class categoriesFor:
#withEmbeddedFile:!instance creation!public! !
!STBResourceSTBFileAccessorProxy class categoriesFor:
#withExternalFile:!instance creation!public! !

"Binary Globals"!

===Cuthere


Reply | Threaded
Open this post in threaded view
|

Re: problem with load D5 package in D6

Pavel
Andy, thank for reply!

> In the meantime you could try saving the following as "Dolphin Legacy
> Resource Framework.pac" and loading it into your DCE image before
> attempting to load your D5 package.

It has helped !  The package was loaded without problems !

Thanks!