Skip to content

Mapping from Store Usernames and Namespaces

ablakeman edited this page Nov 16, 2018 · 1 revision

Manual Store username mapping

Store usernames can be mapped to git "authors" and associated email addresses. The mapping consists of an Associations from the store username to an array containing the git author and email.

storeUserName -> { GitAuthorName . GitAuthorEmail }

For example:

{
('storeuser1' -> {'gitauthor1' . '[email protected]'}) .
('storeuser2' -> {'gitauthor2' . '[email protected]'})
}.

The full example below will demonstrate how to use this for a SETT export

Manual Namespace mapping

Namespace prefixes can be added, to avoid package conflicts in the cases where there are multiple classes with the same name in different namespaces. The mapping consists of an Association from the name of the namespace, to an array with a string prefix and a collection of Rowan Attributes.

nameSpaceName -> { classNamePrefix . arrayOfRowanAttributeStrings }

The Rowan attributes indicate that the differences in compatibility of code, with GemStone or with VisualWorks. This allows Rowan to avoid loading code in an incompatible environment. For example:

{
'Root.GemStone' -> {'gs_' . { 'gemstone' } } .
'Root.Smalltalk' -> {'vw_' . {'visualworks'} } .
}.

In this example, packages in Root.GemStone will be named gs_MyPackage, and packages in Root.Smalltalk will be named vw_MyPackage.

Automatic Namespace mapping

If you find that you are running into many namespace clashes when migrating your Store repository, you can instead choose to have SETT automatically name the packages after the fully qualified package name in store. For example, you may have MyPackage that resides in Root.Smalltalk.SomeApp. By using automatic namespace mapping SETT will create the package Root_Smalltalk_SomeApp_MyPackage. To use this, set the boolean includeNamespaceInPackageName to true in the destination configuration.
For Example:

destination
    repositoryPathString: './exampleOutput';
    rowanProjectName: 'StoreExport';
    userMapping: settUserMap ;
    includeNamespaceInPackageName: true.

Full example

Full example:

| source dest namespaceMap users settUserMap settNamespaceMap |

source := SettExampleSourceConfiguration new.
dest := SettExampleDestinationConfiguration new.

namespaceMap := {
'Root.GemStone' -> {'gs_' . {'gemstone'} } .
'Root.Smalltalk' -> {'vw_' .{'visualworks'} } .
}.

users := {
('storeuser1' -> {'gitauthor1' . '[email protected]'}).
('storeuser2' -> {'gitauthor2' . '[email protected]'})
}.

settUserMap := SettUserMap forMap: users.
settNamespaceMap := SettNamespaceDirMap forMap: namespaceMap.

source
 dbHost: 'db.example.com';
 dbName: 'databaseName';
 dbUser: 'aReadOnlyUser';
 dbPassword: 'aPassword';

dest
 repositoryPathString: './StoreExport';
 rowanProjectName: 'StoreExport';
 userMapping: settUserMap ;
 namespaceMapping: settNamespaceMap.

Sett
 readCodePublishedSince: (DateAndTime fromString: 'Jan 1 2018')
 from: source
 andWriteTo: dest