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 |
|
1530
|
160 |
managerTypeName
|
|
161 |
^ 'Store DB'
|
|
162 |
|
|
163 |
"Created: / 16-08-2006 / 11:06:09 / cg"
|
|
164 |
! !
|
|
165 |
|
1892
|
166 |
!StoreSourceCodeManager class methodsFor:'saving'!
|
|
167 |
|
|
168 |
savePreferencesOn:aStream
|
1900
|
169 |
aStream nextPutLine:' StoreSourceCodeManager notNil ifTrue:['.
|
|
170 |
aStream nextPutLine:' StoreSourceCodeManager repositoryInfoPerModule:' , self repositoryInfoPerModule storeString , '.'.
|
1892
|
171 |
(Smalltalk at:#SourceCodeManager) == StoreSourceCodeManager ifTrue:[
|
1900
|
172 |
aStream nextPutLine:' Smalltalk at:#SourceCodeManager put: StoreSourceCodeManager.'.
|
|
173 |
aStream nextPutLine:' StoreSourceCodeManager hostAndDBName:' , self hostAndDBName storeString , '.'.
|
|
174 |
aStream nextPutLine:' StoreSourceCodeManager dbName:' , self dbName storeString , '.'.
|
|
175 |
aStream nextPutLine:' StoreSourceCodeManager userName:' , self userName storeString , '.'.
|
1892
|
176 |
].
|
1900
|
177 |
aStream nextPutLine:' ].'.
|
1892
|
178 |
|
|
179 |
"Created: / 09-11-2006 / 15:10:25 / cg"
|
1900
|
180 |
"Modified: / 10-11-2006 / 18:13:49 / cg"
|
1892
|
181 |
! !
|
|
182 |
|
1530
|
183 |
!StoreSourceCodeManager class methodsFor:'testing'!
|
|
184 |
|
|
185 |
isExperimental
|
1737
|
186 |
^ OperatingSystem getLoginName ~= 'cg'.
|
1732
|
187 |
^ true
|
1530
|
188 |
|
|
189 |
"Created: / 16-08-2006 / 11:23:09 / cg"
|
|
190 |
!
|
|
191 |
|
|
192 |
isStore
|
|
193 |
^ true
|
|
194 |
|
|
195 |
"Created: / 16-08-2006 / 10:59:06 / cg"
|
|
196 |
! !
|
|
197 |
|
1731
|
198 |
!StoreSourceCodeManager::DBInfo methodsFor:'accessing'!
|
|
199 |
|
|
200 |
dbName
|
|
201 |
^ dbName
|
|
202 |
!
|
|
203 |
|
|
204 |
dbName:something
|
|
205 |
dbName := something.
|
|
206 |
!
|
|
207 |
|
|
208 |
hostAndDBName
|
|
209 |
hostName isEmptyOrNil ifTrue:[ ^ dbName ].
|
|
210 |
^ dbName,'@',hostName
|
|
211 |
!
|
|
212 |
|
|
213 |
hostAndDBName: aString
|
|
214 |
|idx|
|
|
215 |
|
|
216 |
idx := aString indexOf:$@.
|
|
217 |
idx == 0 ifTrue:[
|
|
218 |
dbName := aString.
|
|
219 |
hostName := nil.
|
|
220 |
] ifFalse:[
|
|
221 |
dbName := aString copyTo:idx-1.
|
|
222 |
hostName := (aString copyFrom:idx+1).
|
|
223 |
]
|
|
224 |
!
|
|
225 |
|
1732
|
226 |
hostAndDBName:hostAndDBNameArg userName:userNameArg password:passwordArg
|
|
227 |
self hostAndDBName:hostAndDBNameArg.
|
|
228 |
userName := userNameArg.
|
|
229 |
password := passwordArg.
|
|
230 |
!
|
|
231 |
|
1731
|
232 |
hostName
|
|
233 |
^ hostName
|
|
234 |
!
|
|
235 |
|
|
236 |
hostName:something
|
|
237 |
hostName := something.
|
|
238 |
!
|
|
239 |
|
|
240 |
hostName:hostNameArg dbName:dbNameArg userName:userNameArg password:passwordArg
|
|
241 |
"set instance variables (automatically generated)"
|
|
242 |
|
|
243 |
hostName := hostNameArg.
|
|
244 |
dbName := dbNameArg.
|
|
245 |
userName := userNameArg.
|
|
246 |
password := passwordArg.
|
|
247 |
!
|
|
248 |
|
|
249 |
password
|
|
250 |
^ password
|
|
251 |
!
|
|
252 |
|
|
253 |
password:something
|
|
254 |
password := something.
|
|
255 |
!
|
|
256 |
|
|
257 |
userName
|
|
258 |
^ userName
|
|
259 |
!
|
|
260 |
|
|
261 |
userName:something
|
|
262 |
userName := something.
|
|
263 |
! !
|
|
264 |
|
1732
|
265 |
!StoreSourceCodeManager::DBInfo methodsFor:'printing and storing'!
|
|
266 |
|
|
267 |
storeOn:aStream
|
|
268 |
aStream
|
|
269 |
nextPutAll:'(';
|
|
270 |
nextPutAll:self class name;
|
|
271 |
nextPutAll:' basicNew';
|
|
272 |
nextPutAll:' hostAndDBName:';
|
|
273 |
store: self hostAndDBName;
|
|
274 |
nextPutAll:' userName:';
|
|
275 |
store: self userName;
|
|
276 |
nextPutAll:' password:';
|
|
277 |
store: self password;
|
|
278 |
nextPutAll:')'.
|
|
279 |
|
|
280 |
"
|
|
281 |
self readFrom:(self basicNew hostAndDBName:'a' userName:'b' password:'c') storeString
|
|
282 |
self readFrom:(self basicNew hostAndDBName:'a@h' userName:'b' password:'c') storeString
|
|
283 |
"
|
|
284 |
! !
|
|
285 |
|
1530
|
286 |
!StoreSourceCodeManager class methodsFor:'documentation'!
|
|
287 |
|
|
288 |
version
|
1900
|
289 |
^ '$Header: /cvs/stx/stx/libbasic3/StoreSourceCodeManager.st,v 1.8 2006-11-10 17:14:32 cg Exp $'
|
1530
|
290 |
! !
|