author | Claus Gittinger <cg@exept.de> |
Mon, 03 Jan 2011 16:31:09 +0100 | |
changeset 2309 | d01e36094bf9 |
parent 2198 | 24cbf780471b |
child 2328 | 4620ff63e9b2 |
permissions | -rw-r--r-- |
1530 | 1 |
" |
2 |
COPYRIGHT (c) 2006 eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
"{ Package: 'stx:libbasic3' }" |
|
13 |
||
14 |
AbstractSourceCodeManager subclass:#StoreSourceCodeManager |
|
15 |
instanceVariableNames:'' |
|
1731 | 16 |
classVariableNames:'Verbose Connection DefaultDBInfo DBInfoPerModule' |
1530 | 17 |
poolDictionaries:'' |
18 |
category:'System-SourceCodeManagement' |
|
19 |
! |
|
20 |
||
1731 | 21 |
Object subclass:#DBInfo |
22 |
instanceVariableNames:'hostName dbName userName password' |
|
23 |
classVariableNames:'' |
|
24 |
poolDictionaries:'' |
|
25 |
privateIn:StoreSourceCodeManager |
|
26 |
! |
|
27 |
||
1530 | 28 |
!StoreSourceCodeManager class methodsFor:'documentation'! |
29 |
||
30 |
copyright |
|
31 |
" |
|
32 |
COPYRIGHT (c) 2006 eXept Software AG |
|
33 |
All Rights Reserved |
|
34 |
||
35 |
This software is furnished under a license and may be used |
|
36 |
only in accordance with the terms of that license and with the |
|
37 |
inclusion of the above copyright notice. This software may not |
|
38 |
be provided or otherwise made available to, or used by, any |
|
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
" |
|
42 |
! |
|
43 |
||
44 |
documentation |
|
45 |
" |
|
46 |
WARNING: |
|
47 |
this class is incomplete and provided as a sceletton |
|
48 |
if CVS is not to be used as a SourceCodeManager. |
|
49 |
We highly recommend to use CVS. |
|
50 |
||
51 |
SourceCodeManager which accesses sourcecode through a Store Database. |
|
52 |
This class is part of ongoing development and not yet released for public use. |
|
53 |
" |
|
54 |
! ! |
|
55 |
||
1731 | 56 |
!StoreSourceCodeManager class methodsFor:'initialization'! |
57 |
||
58 |
connectToDatabase |
|
1734 | 59 |
|session dbInfo| |
60 |
||
61 |
dbInfo := self defaultDBInfo. |
|
1731 | 62 |
|
63 |
SQL::SQLError handle:[:ex | |
|
64 |
self warn:('Failed to connect to Database:\\' withCRs,ex description). |
|
65 |
^ self. |
|
66 |
] do:[ |
|
1734 | 67 |
session := self tryToConnectToDatabase:dbInfo. |
1731 | 68 |
]. |
69 |
||
70 |
session isNil ifTrue:[ |
|
71 |
self warn:'OOPS - Failed to connect to Database'. |
|
72 |
^ self |
|
73 |
]. |
|
74 |
Connection := session. |
|
1734 | 75 |
Transcript showCR:('Connected to Store-DB: ',dbInfo hostAndDBName). |
1731 | 76 |
! |
77 |
||
78 |
tryToConnectToDatabase:dbInfo |
|
79 |
|session| |
|
80 |
||
81 |
session := SQL::ODBCSession new. |
|
82 |
session |
|
83 |
connectWithUsername:(dbInfo userName) |
|
84 |
password:(dbInfo password) |
|
85 |
dbname:(dbInfo dbName). |
|
86 |
||
87 |
(session isConnected) ifFalse:[ |
|
88 |
^ nil. |
|
89 |
]. |
|
90 |
^ session |
|
91 |
! ! |
|
92 |
||
1530 | 93 |
!StoreSourceCodeManager class methodsFor:'accessing'! |
94 |
||
1731 | 95 |
dbName |
96 |
^ self defaultDBInfo dbName |
|
97 |
! |
|
98 |
||
99 |
dbName:aString |
|
100 |
self defaultDBInfo dbName:aString. |
|
101 |
! |
|
102 |
||
103 |
defaultDBInfo |
|
104 |
DefaultDBInfo isNil ifTrue:[ |
|
105 |
DefaultDBInfo := DBInfo new |
|
106 |
]. |
|
107 |
^ DefaultDBInfo |
|
108 |
! |
|
109 |
||
110 |
hostAndDBName |
|
111 |
^ self defaultDBInfo hostAndDBName |
|
112 |
! |
|
113 |
||
114 |
hostAndDBName:aString |
|
115 |
self defaultDBInfo hostAndDBName:aString. |
|
116 |
! |
|
117 |
||
118 |
hostName |
|
119 |
^ self defaultDBInfo hostName |
|
120 |
! |
|
121 |
||
122 |
hostName:aString |
|
123 |
self defaultDBInfo hostName:aString. |
|
124 |
! |
|
125 |
||
126 |
newDBInfo |
|
127 |
^ DBInfo new |
|
128 |
! |
|
129 |
||
130 |
password |
|
131 |
^ self defaultDBInfo password |
|
132 |
! |
|
133 |
||
134 |
password:aString |
|
135 |
self defaultDBInfo password:aString. |
|
136 |
! |
|
137 |
||
138 |
repositoryInfoPerModule |
|
139 |
^ DBInfoPerModule ? #() |
|
140 |
||
141 |
"Created: / 16-08-2006 / 11:06:09 / cg" |
|
142 |
! |
|
143 |
||
144 |
repositoryInfoPerModule:aCollectionOfDBinfos |
|
145 |
DBInfoPerModule := aCollectionOfDBinfos |
|
146 |
||
147 |
"Created: / 16-08-2006 / 11:06:09 / cg" |
|
148 |
! |
|
149 |
||
150 |
userName |
|
151 |
^ self defaultDBInfo userName |
|
152 |
! |
|
153 |
||
154 |
userName:aString |
|
155 |
self defaultDBInfo userName:aString. |
|
156 |
! ! |
|
157 |
||
158 |
!StoreSourceCodeManager class methodsFor:'queries'! |
|
159 |
||
2198
24cbf780471b
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
160 |
isExperimental |
24cbf780471b
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
161 |
^ OperatingSystem getLoginName ~= 'cg'. |
24cbf780471b
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
162 |
^ true |
24cbf780471b
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
163 |
|
24cbf780471b
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
164 |
"Created: / 16-08-2006 / 11:23:09 / cg" |
24cbf780471b
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
165 |
! |
24cbf780471b
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
166 |
|
1530 | 167 |
managerTypeName |
168 |
^ 'Store DB' |
|
169 |
||
170 |
"Created: / 16-08-2006 / 11:06:09 / cg" |
|
2139
00a8e5ffba8e
added nameOfVersionMethodInClasses
Claus Gittinger <cg@exept.de>
parents:
1900
diff
changeset
|
171 |
! |
00a8e5ffba8e
added nameOfVersionMethodInClasses
Claus Gittinger <cg@exept.de>
parents:
1900
diff
changeset
|
172 |
|
2198
24cbf780471b
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
173 |
nameOfVersionMethodForExtensions |
24cbf780471b
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
174 |
^ #'extensionsVersion_STORE' |
24cbf780471b
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
175 |
! |
24cbf780471b
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
176 |
|
2139
00a8e5ffba8e
added nameOfVersionMethodInClasses
Claus Gittinger <cg@exept.de>
parents:
1900
diff
changeset
|
177 |
nameOfVersionMethodInClasses |
00a8e5ffba8e
added nameOfVersionMethodInClasses
Claus Gittinger <cg@exept.de>
parents:
1900
diff
changeset
|
178 |
^ #'version_STORE' |
1530 | 179 |
! ! |
180 |
||
1892 | 181 |
!StoreSourceCodeManager class methodsFor:'saving'! |
182 |
||
183 |
savePreferencesOn:aStream |
|
1900 | 184 |
aStream nextPutLine:' StoreSourceCodeManager notNil ifTrue:['. |
185 |
aStream nextPutLine:' StoreSourceCodeManager repositoryInfoPerModule:' , self repositoryInfoPerModule storeString , '.'. |
|
1892 | 186 |
(Smalltalk at:#SourceCodeManager) == StoreSourceCodeManager ifTrue:[ |
1900 | 187 |
aStream nextPutLine:' Smalltalk at:#SourceCodeManager put: StoreSourceCodeManager.'. |
188 |
aStream nextPutLine:' StoreSourceCodeManager hostAndDBName:' , self hostAndDBName storeString , '.'. |
|
189 |
aStream nextPutLine:' StoreSourceCodeManager dbName:' , self dbName storeString , '.'. |
|
190 |
aStream nextPutLine:' StoreSourceCodeManager userName:' , self userName storeString , '.'. |
|
1892 | 191 |
]. |
1900 | 192 |
aStream nextPutLine:' ].'. |
1892 | 193 |
|
194 |
"Created: / 09-11-2006 / 15:10:25 / cg" |
|
1900 | 195 |
"Modified: / 10-11-2006 / 18:13:49 / cg" |
1892 | 196 |
! ! |
197 |
||
1530 | 198 |
!StoreSourceCodeManager class methodsFor:'testing'! |
199 |
||
200 |
isStore |
|
201 |
^ true |
|
202 |
||
203 |
"Created: / 16-08-2006 / 10:59:06 / cg" |
|
204 |
! ! |
|
205 |
||
1731 | 206 |
!StoreSourceCodeManager::DBInfo methodsFor:'accessing'! |
207 |
||
208 |
dbName |
|
209 |
^ dbName |
|
210 |
! |
|
211 |
||
212 |
dbName:something |
|
213 |
dbName := something. |
|
214 |
! |
|
215 |
||
216 |
hostAndDBName |
|
217 |
hostName isEmptyOrNil ifTrue:[ ^ dbName ]. |
|
218 |
^ dbName,'@',hostName |
|
219 |
! |
|
220 |
||
221 |
hostAndDBName: aString |
|
222 |
|idx| |
|
223 |
||
224 |
idx := aString indexOf:$@. |
|
225 |
idx == 0 ifTrue:[ |
|
226 |
dbName := aString. |
|
227 |
hostName := nil. |
|
228 |
] ifFalse:[ |
|
229 |
dbName := aString copyTo:idx-1. |
|
230 |
hostName := (aString copyFrom:idx+1). |
|
231 |
] |
|
232 |
! |
|
233 |
||
1732 | 234 |
hostAndDBName:hostAndDBNameArg userName:userNameArg password:passwordArg |
235 |
self hostAndDBName:hostAndDBNameArg. |
|
236 |
userName := userNameArg. |
|
237 |
password := passwordArg. |
|
238 |
! |
|
239 |
||
1731 | 240 |
hostName |
241 |
^ hostName |
|
242 |
! |
|
243 |
||
244 |
hostName:something |
|
245 |
hostName := something. |
|
246 |
! |
|
247 |
||
248 |
hostName:hostNameArg dbName:dbNameArg userName:userNameArg password:passwordArg |
|
249 |
"set instance variables (automatically generated)" |
|
250 |
||
251 |
hostName := hostNameArg. |
|
252 |
dbName := dbNameArg. |
|
253 |
userName := userNameArg. |
|
254 |
password := passwordArg. |
|
255 |
! |
|
256 |
||
257 |
password |
|
258 |
^ password |
|
259 |
! |
|
260 |
||
261 |
password:something |
|
262 |
password := something. |
|
263 |
! |
|
264 |
||
265 |
userName |
|
266 |
^ userName |
|
267 |
! |
|
268 |
||
269 |
userName:something |
|
270 |
userName := something. |
|
271 |
! ! |
|
272 |
||
2309 | 273 |
!StoreSourceCodeManager::DBInfo methodsFor:'printing & storing'! |
1732 | 274 |
|
275 |
storeOn:aStream |
|
276 |
aStream |
|
277 |
nextPutAll:'('; |
|
278 |
nextPutAll:self class name; |
|
279 |
nextPutAll:' basicNew'; |
|
280 |
nextPutAll:' hostAndDBName:'; |
|
281 |
store: self hostAndDBName; |
|
282 |
nextPutAll:' userName:'; |
|
283 |
store: self userName; |
|
284 |
nextPutAll:' password:'; |
|
285 |
store: self password; |
|
286 |
nextPutAll:')'. |
|
287 |
||
288 |
" |
|
289 |
self readFrom:(self basicNew hostAndDBName:'a' userName:'b' password:'c') storeString |
|
290 |
self readFrom:(self basicNew hostAndDBName:'a@h' userName:'b' password:'c') storeString |
|
291 |
" |
|
292 |
! ! |
|
293 |
||
1530 | 294 |
!StoreSourceCodeManager class methodsFor:'documentation'! |
295 |
||
296 |
version |
|
2309 | 297 |
^ '$Header: /cvs/stx/stx/libbasic3/StoreSourceCodeManager.st,v 1.11 2011-01-03 15:31:09 cg Exp $' |
2198
24cbf780471b
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
298 |
! |
24cbf780471b
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
299 |
|
24cbf780471b
added: #nameOfVersionMethodForExtensions
Claus Gittinger <cg@exept.de>
parents:
2139
diff
changeset
|
300 |
version_CVS |
2309 | 301 |
^ '$Header: /cvs/stx/stx/libbasic3/StoreSourceCodeManager.st,v 1.11 2011-01-03 15:31:09 cg Exp $' |
1530 | 302 |
! ! |