@@ -540,29 +540,26 @@ private static AuthToken getToken(
540
540
private static BlobStore setupBlobStore (
541
541
final MongoDatabase db ,
542
542
final KBaseWorkspaceConfig cfg ,
543
- final InitReporter rep ) // Added rep to track progress
543
+ final InitReporter rep )
544
544
throws WorkspaceInitException {
545
545
546
546
rep .reportInfo ("Entering setupBlobStore..." );
547
-
548
- // Check what backend type is being used
549
547
rep .reportInfo ("Backend type: " + cfg .getBackendType ().name ());
550
548
551
549
if (cfg .getBackendType ().equals (BackendType .GridFS )) {
552
550
rep .reportInfo ("Initializing GridFSBlobStore..." );
553
- BlobStore store = new GridFSBlobStore (db );
554
- rep .reportInfo ("GridFSBlobStore initialized successfully." );
555
- return store ;
551
+ return new GridFSBlobStore (db );
556
552
}
557
553
558
554
if (cfg .getBackendType ().equals (BackendType .S3 )) {
559
555
rep .reportInfo ("Initializing S3BlobStore..." );
556
+
560
557
try {
561
558
rep .reportInfo ("Creating S3 client with the following parameters:" );
562
- rep .reportInfo ("Backend URL: " + cfg .getBackendURL ());
563
- rep .reportInfo ("Backend User: " + cfg .getBackendUser ());
564
- rep .reportInfo ("Backend Region: " + cfg .getBackendRegion ());
565
- rep .reportInfo ("Trust All Certs: " + cfg .getBackendTrustAllCerts ());
559
+ rep .reportInfo (" - Backend URL: " + cfg .getBackendURL ());
560
+ rep .reportInfo (" - Backend User: " + cfg .getBackendUser ());
561
+ rep .reportInfo (" - Backend Region: " + cfg .getBackendRegion ());
562
+ rep .reportInfo (" - Trust All Certs: " + cfg .getBackendTrustAllCerts ());
566
563
567
564
final S3ClientWithPresign cli = new S3ClientWithPresign (
568
565
cfg .getBackendURL (),
@@ -572,36 +569,21 @@ private static BlobStore setupBlobStore(
572
569
cfg .getBackendTrustAllCerts ());
573
570
574
571
rep .reportInfo ("S3 client created successfully." );
572
+
573
+ rep .reportInfo ("Initializing S3BlobStore with Backend Container: " + cfg .getBackendContainer ());
575
574
576
-
577
-
578
- // Add logs before initializing S3BlobStore
579
- rep .reportInfo ("Initializing S3BlobStore with:" );
580
-
581
- rep .reportInfo (" - Backend Container: " + cfg .getBackendContainer ());
582
-
583
- try {
584
- BlobStore store = new S3BlobStore (db .getCollection (COL_S3_OBJECTS ), cli , cfg .getBackendContainer ());
585
- rep .reportInfo ("S3BlobStore initialized successfully." );
586
- return store ;
587
- } catch (Exception e ) {
588
- rep .reportInfo ("Error initializing S3BlobStore: " + e .getMessage ());
589
- throw new WorkspaceInitException ("Failed to initialize S3BlobStore: " + e .getMessage (), e );
590
- }
575
+ return new S3BlobStore (db .getCollection (COL_S3_OBJECTS ), cli , cfg .getBackendContainer ());
591
576
592
577
} catch (URISyntaxException e ) {
593
- rep .reportInfo ("Error: Invalid S3 URL: " + e .getMessage ());
594
- throw new WorkspaceInitException ("S3 url is not a valid URI: " + e .getMessage (), e );
595
- } catch (BlobStoreCommunicationException e ) {
596
- rep .reportInfo ("Error: BlobStore communication issue: " + e .getMessage ());
597
- throw new WorkspaceInitException ("Error communicating with the blob store: " + e .getMessage (), e );
578
+ throw new WorkspaceInitException ("S3 URL is not a valid URI: " + e .getMessage (), e );
598
579
} catch (IllegalArgumentException e ) {
599
- rep .reportInfo ("Error: Illegal S3 bucket name: " + e .getMessage ());
600
580
throw new WorkspaceInitException ("Illegal S3 bucket name: " + e .getMessage (), e );
581
+ } catch (Exception e ) {
582
+ // Catch any unexpected errors in S3BlobStore initialization
583
+ throw new WorkspaceInitException ("Failed to initialize S3BlobStore: " + e .getMessage (), e );
601
584
}
602
585
}
603
586
604
- rep .reportInfo ("Error: Unknown backend type: " + cfg .getBackendType ().name ());
605
587
throw new WorkspaceInitException ("Unknown backend type: " + cfg .getBackendType ().name ());
606
588
}
607
589
0 commit comments