MatrixBerryCore
ConfRepoManager.m
Go to the documentation of this file.
2  properties (Constant)
3  DEFAULT_STORAGE_BRANCH_KEY='_default';
4  end
5  methods
6  function self=ConfRepoManager(varargin)
7  import mxberry.core.throwerror;
8  import mxberry.core.parseparext;
9  import mxberry.conf.ConfRepoManager;
10  %
11  %% parse input params
12  [reg,~,...
13  storageBranchKey,repoLocation,confPatchRepo,...
14  repoSubfolderName,...
15  isStorageBranchKeySpec,isRepoLocationSpec,...
16  isConfPathRepoSpec,isRepoSubfolderSpecified]=...
17  mxberry.core.parseparext(varargin,...
18  {'storagebranchkey','repolocation','confpatchrepo',...
19  'reposubfoldername';...
20  'ConfRepoManager.DEFAULT_STORAGE_BRANCH_KEY',[],...
21  [],'confrepo';...
22  'isstring(x)','isstring(x)',...
23  @(x)isa(x,'mxberry.core.struct.StructChangeTracker'),...
24  'isstring(x)'});
25  %
26  if ~isStorageBranchKeySpec
27  storageBranchKey=...
29  end
30  %
31  addArgList=reg;
32  if isConfPathRepoSpec
33  addArgList=[{confPatchRepo},reg];
34  end
35  %
36  metaClassBoxedObj=mxberry.core.cont.ValueBox();
37  self=self@mxberry.core.obj.ReflectionHelper(metaClassBoxedObj);
38  metaClass=metaClassBoxedObj.getValue();
39  if ~isRepoLocationSpec
40  repoLocation=[fileparts(which(metaClass.Name)),filesep,...
41  repoSubfolderName];
42  elseif isRepoSubfolderSpecified
43  [~,subFolderName]=fileparts(repoLocation);
44  if ~strcmp(subFolderName,repoSubfolderName)
45  throwerror('wrongInput',...
46  ['repoSubfolderName is not the same as the ',...
47  'subfolder specified as part of repoLocation']);
48  end
49  end
50  %
51  %%
52  storage=mxberry.core.cont.ondisk.HashMapXMLMetaData(...
53  'storageLocationRoot',repoLocation,...
54  'storageBranchKey',storageBranchKey,...
55  'storageFormat','verxml',...
56  'useHashedPath',false);
57  self=self@mxberry.conf.ConfRepoManagerAnyStorage(storage,...
58  addArgList{:});
59  %
60  end
61  function resObj=createInstance(self,varargin)
62  p=metaclass(self);
63  resObj=feval(p.Name,varargin{:});
64  end
65  end
66 end
function filesep()
function throwerror(in msgTag, in varargin)
THROWERROR works similarly to built-in ERROR function in case when there is no output arguments but s...
function parseparext(in args, in propNameValMat, in varargin)
PARSEPAREXT behaves in the same way as mxberry.core.parseparams but returns property values in a more...
REFLECTIONHELPER - serves a single purpose: retrieving a name of currently constructed object...
Constant Property DEFAULT_STORAGE_BRANCH_KEY
CONFREPOMANAGER provides a functionality for storing, reading copying and very simplistic version tra...