@@ -136,7 +136,7 @@ bluemix <- setRefClass("bluemix",
136
136
CloudObjectStorage <- setRefClass(" CloudObjectStorage" ,
137
137
fields = list (configName = " character" ),
138
138
methods = list (
139
- initialize = function (... , sparkContext , credentials , configurationName ) {
139
+ initialize = function (... , sparkContext , credentials , configurationName = " " ) {
140
140
141
141
142
142
if (is.null(credentials [" endpoint" ][[1 ]])) {
@@ -151,20 +151,27 @@ CloudObjectStorage <- setRefClass("CloudObjectStorage",
151
151
stop(" Attribute secretKey in credentials is missing!" )
152
152
}
153
153
154
+ # bind config name
154
155
.self $ configName = configurationName
155
- prefix = " fs.s3d.service"
156
+
157
+ # set prefix for hadoop config
158
+ prefix = paste(" fs.cos" , getConfigName(), sep = ' .' )
156
159
hConf = SparkR ::: callJMethod(sparkContext , " hadoopConfiguration" )
157
160
SparkR ::: callJMethod(hConf , " set" , paste(prefix , " endpoint" , sep = ' .' ), credentials [' endpoint' ][[1 ]])
158
161
SparkR ::: callJMethod(hConf , " set" , paste(prefix , " access.key" , sep = ' .' ), credentials [' accessKey' ][[1 ]])
159
162
SparkR ::: callJMethod(hConf , " set" , paste(prefix , " secret.key" , sep = ' .' ), credentials [' secretKey' ][[1 ]])
160
163
},
161
164
162
165
getConfigName = function () {
163
- return (.self $ configName )
166
+ if (.self $ configName != " " ) {
167
+ return (.self $ configName )
168
+ }
169
+ return (" service" )
164
170
},
165
171
166
- url = function (bucketName , objectName ){
167
- return (paste(" s3d://" , bucketName , " .service/" , objectName , sep = " " ))
172
+ url = function (bucketName , objectName ) {
173
+ serviceName = getConfigName()
174
+ return (paste(" cos://" , bucketName , " ." , serviceName , " /" , objectName , sep = " " ))
168
175
}
169
176
)
170
177
)
0 commit comments