It's all about the answers!

Ask a question

getCopyFileAreasForConfiguration method in CopyFileAreaManager returns empty list while unloading a repository workspace programmatically!


Nandini Math (285) | asked Aug 09 '16, 12:59 a.m.
Hello Team ,

            Need your suggestion in solving the problem I am facing to unload repository workspace programmatically(as described below).

           And i want to unload repository workspace programmatically because i am developing a plugin(to create repo workspace , load it , accept changes in to workspace and to unload it) which will be integrated with Jenkins.


            I was successful in creating a repository workspace and loading it programmatically by using the below code :

 

                        SubMonitor progress = SubMonitor.convert(monitor, 100);

              IWorkspaceManager wsManager = SCMPlatform.getWorkspaceManager(repo);

              IWorkspaceConnection workspace =

              wsManager.createWorkspace(repo.loggedInContributor(), workspaceName, description, stream, stream,

              progress.newChild(90));

              workspace.setOwnerAndVisibility(IScmService.NOOP_OWNER, scope, progress.newChild(3));

              addTemplateFlows(workspace, stream, progress.newChild(7));

 

       and code to load a repository workspace :

 

                 this.sandbox = new Sandbox(repoLocation);

 

                lrFileReader = getReaderForLRFileonDisk();

               ILoadRule2 loadRule = ILoadRuleFactory.loadRuleFactory.getLoadRule(wconn, lrFileReader, monitor);

 

               ILoadOperation loadoperator = loadRule.getLoadOp(this.sandbox, LoadDilemmaHandler.getDefault(), monitor);

 

              loadoperator.run(monitor);

              FileSystemCore.getSharingManager().deregister(this.sandbox, monitor);

 

 

       When I make an attempt to unload a repository workspace as below :

 

              SubMonitor subMonitor = SubMonitor.convert(monitor);

              IWorkspaceConnection iWorkspaceConnection =

              getWorkspaceConn(SCMPlatform.getWorkspaceManager(getItemRepository()), monitor,

              repository_workspace_name);

 

               List<IConfigurationDescriptor> iConfigurationDescriptorList =

              unloadUbkManager.getConfigurationsToUnshare(iWorkspaceConnection, iWorkspaceConnection.getComponents());

 

              Set<ICopyFileArea> iCopyFileAreaSet = getCFAs(iConfigurationDescriptorList, subMonitor);
 

              Set<IConfigurationDescriptor> iConfigurationDescriptorSet =

              unloadUbkManager.getAffectedConfigurations(iConfigurationDescriptorList);

 

              Collection<Shareable> shareableCollection =

              unloadUbkManager.getShareablesToUnshare(iCopyFileAreaSet, iConfigurationDescriptorSet, subMonitor);

              unloadUbkManager.deleteDirectories((List<Shareable>) shareableCollection);

 

             

              publicSet<ICopyFileArea> getCFAs(finalList<IConfigurationDescriptor> configurationsToUnshare,

               finalSubMonitor childMonitor) throwsTeamRepositoryException {

               Set<ICopyFileArea> interestingCopyFileAreas = newHashSet();

              ICopyFileAreaManager cfaMgr = ICopyFileAreaManager.instance;

 

              for(IConfigurationDescriptor configuration : configurationsToUnshare) {

               try {

              Collection<ICopyFileArea> copyFileAreas =

              cfaMgr.getCopyFileAreasForConfiguration(configuration, childMonitor.newChild(1));

              interestingCopyFileAreas.addAll(copyFileAreas);

              }

               catch (FileSystemException e) {

              throw newTeamRepositoryException(e.getMessage());

              }

              }

              return interestingCopyFileAreas;

              }

      

 

       method cfaMgr.getCopyFileAreasForConfiguration(configuration, childMonitor.newChild(1)); returns an empty list and because of which workspace is not unloaded.

 

       Could you guide me in solving this ?

 
       I decompiled CopyFileAreaManager.class to check the logic in getCopyFileAreasForConfiguration but the source code is not shared. 

Be the first one to answer this question!


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.