//tests and sets FS connection params private FileSystemSession ctorFS(IFileSystem fileSystem, FileSystemSessionConnectParams fsSessionParams, string rootPath) { FileSystemSession session = null; //Test FS connection try { session = fileSystem.StartSession(fsSessionParams); if (fsSessionParams.Version == null) { fsSessionParams.Version = session.LatestVersion; } } catch (Exception error) { throw new MetabaseException(StringConsts.METABASE_FS_CONNECTION_ERROR.Args(fileSystem.GetType().FullName, fileSystem.Name, fsSessionParams.ToString(), error.ToMessageWithType() ), error); } m_FS = fileSystem; m_FSSessionConnectParams = fsSessionParams; m_FSRootPath = rootPath ?? string.Empty; return(session); }
static S3V4FilesystemTests() { try { string envVarsStr = System.Environment.GetEnvironmentVariable(NFX_S3); var cfg = Configuration.ProviderLoadFromString(envVarsStr, Configuration.CONFIG_LACONIC_FORMAT).Root; BUCKET = cfg.AttrByName(S3V4FileSystemSessionConnectParams.CONFIG_BUCKET_ATTR).Value; REGION = cfg.AttrByName(S3V4FileSystemSessionConnectParams.CONFIG_REGION_ATTR).Value; ACCESSKEY = cfg.AttrByName(S3V4FileSystemSessionConnectParams.CONFIG_ACCESSKEY_ATTR).Value; SECRETKEY = cfg.AttrByName(S3V4FileSystemSessionConnectParams.CONFIG_SECRETKEY_ATTR).Value; } catch (Exception ex) { throw new Exception(string.Format( "May be environment variable \"{0}\" of format like \"{1}\" isn't present.\nDon't forget to reload VS after variable is added", NFX_S3, "s3{ bucket='bucket01' region='us-west-2' access-key='XXXXXXXXXXXXXXXXXXXX' secret-key='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'}"), ex); } CONN_PARAMS = FileSystemSessionConnectParams.Make <S3V4FileSystemSessionConnectParams>( "s3v3{{ name='s3v4' bucket='{0}' region='{1}' access-key='{2}' secret-key='{3}' }}" .Args(BUCKET, REGION, ACCESSKEY, SECRETKEY)); }
public override FileSystemSession StartSession(FileSystemSessionConnectParams connectParams = null) { if(connectParams != null) return new DropBoxFileSystemSession(this, null, connectParams); return new DropBoxFileSystemSession(this, null, _authSettings); }
//todo DObavit cash i vsjy logiku po rabote s filami protected override void DoConfigure(IConfigSectionNode node) { //Make File System var fsNode = node[PortalHub.CONFIG_CONTENT_FS_SECTION]; m_ContentFS = FactoryUtils.MakeAndConfigure <FileSystem>(fsNode, typeof(Azos.IO.FileSystem.Local.LocalFileSystem), args: new object[] { GetType().Name, fsNode }); var fsPNode = fsNode[PortalHub.CONFIG_FS_CONNECT_PARAMS_SECTION]; if (fsPNode.Exists) { m_ContentFSConnect = FileSystemSessionConnectParams.Make <FileSystemSessionConnectParams>(fsPNode); } else { m_ContentFSConnect = new FileSystemSessionConnectParams() { User = Azos.Security.User.Fake }; } m_ContentFSRootPath = fsNode.AttrByName(PortalHub.CONFIG_FS_ROOT_PATH_ATTR).Value; if (m_ContentFSRootPath.IsNullOrWhiteSpace()) { throw new WaveException(StringConsts.CONFIG_CMS_BANK_FS_ROOT_PATH_ERROR.Args(PortalHub.CONFIG_CONTENT_FS_SECTION, PortalHub.CONFIG_FS_ROOT_PATH_ATTR)); } }
protected override void ValidateConnectParams(FileSystemSessionConnectParams cParams) { var sftpCParams = cParams as FTPFileSystemSessionConnectParams; if (sftpCParams == null) { throw new NFXIOException(GetType().Name + ".ValidateConnectParams(cParams=null|cParams.Type!=SFTPFileSystemSessionConnectParams)"); } if (sftpCParams.Host.IsNullOrWhiteSpace()) { throw new NFXIOException(GetType().Name + ".ValidateConnectParams($host=null|empty)"); } if (sftpCParams.UserName.IsNullOrWhiteSpace()) { throw new NFXIOException(GetType().Name + ".ValidateConnectParams($user=null|empty)"); } if (!sftpCParams.AcceptAny && sftpCParams.Fingerprint.IsNullOrWhiteSpace()) { throw new NFXIOException(GetType().Name + ".ValidateConnectParams($fingerpring=null|empty)"); } base.ValidateConnectParams(cParams); }
public SkyApplication(IApplication bootApplication, SystemApplicationType sysAppType, IFileSystem metabaseFileSystem, FileSystemSessionConnectParams metabaseFileSystemSessionParams, string metabaseFileSystemRootPath, string thisHostName, bool allowNesting, string[] cmdArgs, ConfigSectionNode rootConfig) : base() { ctor(allowNesting, cmdArgs, rootConfig); m_BootLoader = new BootConfLoader(this, bootApplication, sysAppType, metabaseFileSystem, metabaseFileSystemSessionParams, metabaseFileSystemRootPath, thisHostName, cmdArgs, rootConfig); try { m_ConfigRoot = m_BootLoader.ApplicationConfiguration.Root; InitApplication(); } catch { Destructor(); throw; } }
void IRunnableHook.Prologue(Runner runner, FID id) { CONN_PARAMS = FileSystemSessionConnectParams.Make <SVNFileSystemSessionConnectParams>( "svn{{ name='aaa' server-url='{0}' user-name='{1}' user-password='******' }}".Args(SVN_ROOT, SVN_UNAME, SVN_UPSW)); CONN_PARAMS_TIMEOUT = FileSystemSessionConnectParams.Make <SVNFileSystemSessionConnectParams>( "svn{{ name='aaa' server-url='{0}' user-name='{1}' user-password='******' timeout-ms=1 }}".Args(SVN_ROOT, SVN_UNAME, SVN_UPSW)); }
public void SetUp() { CONN_PARAMS = FileSystemSessionConnectParams.Make <SVNFileSystemSessionConnectParams>( "svn{{ name='aaa' server-url='{0}' user-name='{1}' user-password='******' }}".Args(SVN_ROOT, SVN_UNAME, SVN_UPSW)); CONN_PARAMS_TIMEOUT = FileSystemSessionConnectParams.Make <SVNFileSystemSessionConnectParams>( "svn{{ name='aaa' server-url='{0}' user-name='{1}' user-password='******' timeout-ms=1 }}".Args(SVN_ROOT, SVN_UNAME, SVN_UPSW)); }
public override FileSystemSession StartSession(FileSystemSessionConnectParams cParams = null) { if (cParams == null) { cParams = new FileSystemSessionConnectParams(); } return(new FileSystemSession(this, null, cParams)); }
protected override void ValidateConnectParams(FileSystemSessionConnectParams cParams) { var svnp = (SVNFileSystemSessionConnectParams)cParams; if (svnp.ServerURL.IsNullOrWhiteSpace()) { throw new AzosIOException(WSC.FS_SVN_PARAMS_SERVER_URL_ERROR); } }
protected override void ValidateConnectParams(FileSystemSessionConnectParams cParams) { var s3cp = cParams as S3V4FileSystemSessionConnectParams; if (s3cp.Bucket.IsNullOrWhiteSpace() || s3cp.Region.IsNullOrWhiteSpace()) { throw new NFXIOException(WSC.FS_S3_PARAMS_SERVER_URL_ERROR); } }
/// <summary> /// Opens metabase from the specified file system instance at the specified metabase root path /// </summary> /// <param name="bootApplication">IApplication chassis which this metabank boots from</param> /// <param name="skyApplication">ISkyApplication chassis which this metabank installs in</param> /// <param name="fileSystem"> /// An instance of a file system that stores the metabase files /// Note: This file system is typically a component of Boot application, not the sky app which is being mounted. /// Metabank does NOT dispose the FS, as it is an external resource relative to metabank /// </param> /// <param name="fsSessionParams">File system connection parameter</param> /// <param name="rootPath">A path to the directory within the file system that contains metabase root data</param> internal Metabank(IApplication bootApplication, ISkyApplication skyApplication, IFileSystem fileSystem, FileSystemSessionConnectParams fsSessionParams, string rootPath) : base(bootApplication.NonNull(nameof(bootApplication))) { this.m_SkyApplication = skyApplication.NonNull(nameof(skyApplication)); if (fileSystem is LocalFileSystem && fsSessionParams == null) { fsSessionParams = new FileSystemSessionConnectParams(); } if (fileSystem == null || fsSessionParams == null) { throw new MetabaseException(StringConsts.ARGUMENT_ERROR + "Metabank.ctor(fileSystem|fsSessionParams==null)"); } using (var session = ctorFS(fileSystem, fsSessionParams, rootPath)) { m_CommonLevelConfig = getConfigFromFile(session, CONFIG_COMMON_FILE).Root; m_RootConfig = getConfigFromFile(session, CONFIG_SECTION_LEVEL_FILE).Root; includeCommonConfig(m_RootConfig); m_RootConfig.ResetModified(); m_RootAppConfig = getConfigFromFile(session, CONFIG_SECTION_LEVEL_ANY_APP_FILE).Root; m_PlatformConfig = getConfigFromFile(session, CONFIG_PLATFORMS_FILE).Root; m_NetworkConfig = getConfigFromFile(session, CONFIG_NETWORKS_FILE).Root; m_ContractConfig = getConfigFromFile(session, CONFIG_CONTRACTS_FILE).Root; } m_Catalogs = new Registry <Catalog>(); var cacheStore = new CacheStore(this, "AC.Metabank"); //No app available - nowhere to configure: //cacheStore.Configure(null); /* * cacheStore.TableOptions.Register( new TableOptions(APP_CATALOG, 37, 3) ); * cacheStore.TableOptions.Register( new TableOptions(BIN_CATALOG, 37, 7) ); * cacheStore.TableOptions.Register( new TableOptions(REG_CATALOG, 37, 17) ); * superseded by the cacheStore.DefaultTableOptions below: */ cacheStore.DefaultTableOptions = new TableOptions("*", 37, 17); //reg catalog needs more space cacheStore.TableOptions.Register(new TableOptions(REG_CATALOG, 571, 37)); cacheStore.InstrumentationEnabled = false; m_Cache = new ComplexKeyHashingStrategy(cacheStore); new AppCatalog(this); new BinCatalog(this); new SecCatalog(this); new RegCatalog(this); ConfigAttribute.Apply(this, m_RootConfig); }
protected override void DoConfigure(IConfigSectionNode node) { if (node == null || !node.Exists) { throw new WaveException(StringConsts.CONFIG_PORTAL_HUB_NODE_ERROR); } foreach (var cn in node.Children.Where(cn => cn.IsSameName(CONFIG_PORTAL_SECTION))) { var portal = FactoryUtils.MakeDirectedComponent <Portal>(this, cn, extraArgs: new [] { cn }); if (!m_Portals.Register(portal)) { throw new WaveException(StringConsts.PORTAL_HUB_MODULE_ALREADY_CONTAINS_PORTAL_ERROR.Args(portal.Name)); } } //Make File System var fsNode = node[CONFIG_CONTENT_FS_SECTION]; m_ContentFS = FactoryUtils.MakeAndConfigureDirectedComponent <FileSystem>(this, fsNode, typeof(IO.FileSystem.Local.LocalFileSystem)); var fsPNode = fsNode[CONFIG_FS_CONNECT_PARAMS_SECTION]; if (fsPNode.Exists) { m_ContentFSConnect = FileSystemSessionConnectParams.Make <FileSystemSessionConnectParams>(fsPNode); } else { m_ContentFSConnect = new FileSystemSessionConnectParams() { User = Azos.Security.User.Fake }; } m_ContentFSRootPath = fsNode.AttrByName(CONFIG_FS_ROOT_PATH_ATTR).Value; if (m_ContentFSRootPath.IsNullOrWhiteSpace()) { throw new WaveException(StringConsts.CONFIG_PORTAL_HUB_FS_ROOT_PATH_ERROR.Args(CONFIG_CONTENT_FS_SECTION, CONFIG_FS_ROOT_PATH_ATTR)); } //todo temporary - uncomment after done //var cmsNode = node[CONFIG_CMS_BANK_SECTION]; //if (cmsNode.Exists) //{ // m_CMSBank = FactoryUtils.MakeAndConfigure<CMS.ICMSBankImplementation>(cmsNode, typeof(CMS.CMSBank)); // var svc = m_CMSBank as ServiceModel.Service; // if (svc!=null) // svc.Start(); //} //else m_CMSBank = CMS.NOPCMSBank.Instance; }
private static IFileSystem getFileSystem(ServiceBaseApplication bootApp, IConfigSectionNode mNode, out FileSystemSessionConnectParams cParams) { IFileSystem result = null; bootApp.writeLog(NFX.Log.MessageType.Info, "Making metabase FS instance..."); var fsNode = mNode[CONFIG_FS_SECTION]; var fsFallbackTypeName = Environment.GetEnvironmentVariable(ENV_VAR_METABASE_FS_TYPE); var fsFallbackType = typeof(NFX.IO.FileSystem.Local.LocalFileSystem); if (fsFallbackTypeName.IsNotNullOrWhiteSpace()) { fsFallbackType = Type.GetType(fsFallbackTypeName, true); } result = FactoryUtils.MakeAndConfigure <FileSystem>(fsNode, fsFallbackType, args: new object[] { CONFIG_METABASE_SECTION, fsNode }); var paramsNode = fsNode[CONFIG_SESSION_CONNECT_PARAMS_SECTION]; if (paramsNode.Exists) { cParams = FileSystemSessionConnectParams.Make <FileSystemSessionConnectParams>(paramsNode); } else { var fsFallbackCString = Environment.GetEnvironmentVariable(ENV_VAR_METABASE_FS_CSTRING); if (fsFallbackCString.IsNotNullOrWhiteSpace()) { cParams = FileSystemSessionConnectParams.Make <FileSystemSessionConnectParams>(fsFallbackCString); } else { cParams = new FileSystemSessionConnectParams() { User = User.Fake } }; } bootApp.writeLog(NFX.Log.MessageType.Info, "...Metabase FS FileSystemSessionConnectParams instance of '{0}' made".Args(cParams.GetType().FullName)); bootApp.writeLog(NFX.Log.MessageType.Info, "...Metabase FS instance of '{0}' made".Args(result.GetType().FullName)); return(result); } #endregion }
public void SetUp() { CONN_PARAMS = FileSystemSessionConnectParams.Make <S3V4FileSystemSessionConnectParams>( "s3 {{ name='s3v4' bucket='{0}' region='{1}' access-key='{2}' secret-key='{3}' }}" .Args(S3_BUCKET, S3_REGION, S3_ACCESSKEY, S3_SECRETKEY)); CONN_PARAMS_TIMEOUT = FileSystemSessionConnectParams.Make <S3V4FileSystemSessionConnectParams>( "s3 {{ name='s3v4' bucket='{0}' region='{1}' access-key='{2}' secret-key='{3}' timeout-ms=1 }}" .Args(S3_BUCKET, S3_REGION, S3_ACCESSKEY, S3_SECRETKEY)); cleanUp(); initialize(); }
internal BootConfLoader(ISkyApplication application, IApplication bootApplication, SystemApplicationType appType, IFileSystem metabaseFileSystem, FileSystemSessionConnectParams metabaseFileSystemSessionParams, string metabaseFileSystemRootPath, string thisHostName, string[] cmdArgs, ConfigSectionNode rootConfig, string dynamicHostNameSuffix = null) { Platform.Abstraction.PlatformAbstractionLayer.SetProcessInvariantCulture(); SystemVarResolver.Bind();//todo: Refactor to use ~App. app var resolver instead Configuration.ProcesswideConfigNodeProviderType = typeof(MetabankFileConfigNodeProvider); m_SystemApplicationType = appType; m_Application = application.NonNull(nameof(application)); //1. Init boot app container m_BootApplication = bootApplication; if (m_BootApplication == null) { m_BootApplication = new AzosApplication(allowNesting: true, cmdArgs: cmdArgs, rootConfig: rootConfig); m_IsBootApplicationOwner = true; } writeLog(MessageType.Trace, "Entering Sky app bootloader..."); //2. what host is this? m_HostName = determineHostName(thisHostName); //Sets cluster host name in all log messages if (m_HostName.IsNotNullOrWhiteSpace()) { Message.DefaultHostName = m_HostName; } //3. Mount metabank var mNode = m_BootApplication.ConfigRoot[CONFIG_SKY_SECTION][CONFIG_METABASE_SECTION]; ensureMetabaseAppName(mNode); m_Metabase = new Metabank(m_BootApplication, m_Application, metabaseFileSystem, metabaseFileSystemSessionParams, metabaseFileSystemRootPath); m_IsMetabaseFSOwner = false;//externally supplied writeLog(MessageType.Trace, "...exiting Sky app bootloader"); }
public void SetUp() { var csDefault = "google-drive{{ email='{0}' cert-path=$'{1}' }}" .Args(GOOGLE_DRIVE_EMAIL, GOOGLE_DRIVE_CERT_PATH); CONN_PARAMS = FileSystemSessionConnectParams.Make <GoogleDriveParameters>(csDefault); var csTimeout = "google-drive{{ email='{0}' cert-path=$'{1}' timeout-ms=1 }}" .Args(GOOGLE_DRIVE_EMAIL, GOOGLE_DRIVE_CERT_PATH); CONN_PARAMS_TIMEOUT = FileSystemSessionConnectParams.Make <GoogleDriveParameters>(csTimeout); cleanUp(); initialize(); }
public DeleteFilesJob( IEventTimer timer, string name = null, TimeSpan? interval = null, IConfigSectionNode config = null, FileSystem fs = null, FileSystemSessionConnectParams fsConnectParams = null, string fsRootPath = null ) : base(timer, name, null, interval, config, EventBodyAsyncModel.LongRunningAsyncTask) { if (fs!=null) m_FS = fs; if (fsConnectParams!=null) m_FSConnectParams = fsConnectParams; if (fsRootPath.IsNotNullOrWhiteSpace()) m_FSRootPath = fsRootPath; }
protected internal DropBoxFileSystemSession(NFX.IO.FileSystem.FileSystem fs, IFileSystemHandle handle, FileSystemSessionConnectParams cParams) : base(fs, handle, cParams) { if(fs == null) throw new ArgumentNullException("fs"); if (cParams == null) throw new ArgumentNullException("cParams"); DropBoxFileSystemSessionConnectParams pr = cParams as DropBoxFileSystemSessionConnectParams; if (pr == null) throw new NFXException(StringConsts.FS_SESSION_BAD_PARAMS_ERROR + GetType() + ".ctor_DropBoxFileSystemSession"); ConnectParameters = pr; }
static GoogleDriveFileSystemTests() { try { var env = System.Environment.GetEnvironmentVariable(NFX_GOOGLE_DRIVE); var cfg = Configuration.ProviderLoadFromString(env, Configuration.CONFIG_LACONIC_FORMAT).Root; CONN_PARAMS = FileSystemSessionConnectParams.Make <GoogleDriveParameters>(env); } catch (Exception ex) { throw new Exception(string.Format( "May be environment variable \"{0}\" of format like \"{1}\" isn't present.\nDon't forget to reload VS after variable is added", NFX_GOOGLE_DRIVE, "google-drive{ client-id='<value>' client-secret='<value>' access-token='<value>' refresh-token='<value>' }" ), ex ); } }
protected override void DoConfigure(IConfigSectionNode node) { if (node == null || !node.Exists) { throw new WaveException(StringConsts.CONFIG_PORTAL_HUB_NODE_ERROR); } foreach (var cn in node.Children.Where(cn => cn.IsSameName(CONFIG_PORTAL_SECTION))) { var portal = FactoryUtils.MakeDirectedComponent <Portal>(this, cn, extraArgs: new [] { cn }); if (!m_Portals.Register(portal)) { throw new WaveException(StringConsts.PORTAL_HUB_MODULE_ALREADY_CONTAINS_PORTAL_ERROR.Args(portal.Name)); } } //Make File System var fsNode = node[CONFIG_CONTENT_FS_SECTION]; m_ContentFS = FactoryUtils.MakeAndConfigureDirectedComponent <FileSystem>(this, fsNode, typeof(IO.FileSystem.Local.LocalFileSystem)); var fsPNode = fsNode[CONFIG_FS_CONNECT_PARAMS_SECTION]; if (fsPNode.Exists) { m_ContentFSConnect = FileSystemSessionConnectParams.Make <FileSystemSessionConnectParams>(fsPNode); } else { m_ContentFSConnect = new FileSystemSessionConnectParams() { User = Azos.Security.User.Fake }; } m_ContentFSRootPath = fsNode.AttrByName(CONFIG_FS_ROOT_PATH_ATTR).Value; if (m_ContentFSRootPath.IsNullOrWhiteSpace()) { throw new WaveException(StringConsts.CONFIG_PORTAL_HUB_FS_ROOT_PATH_ERROR.Args(CONFIG_CONTENT_FS_SECTION, CONFIG_FS_ROOT_PATH_ATTR)); } }
public SecDBFileReader(FileSystem fs, FileSystemSessionConnectParams conParams, string fileName) { if (fs == null || conParams == null || fileName.IsNullOrWhiteSpace()) { throw new FinancialException(StringConsts.ARGUMENT_ERROR + "SecDBFileReader.ctor(fs==null | conParams==null | fileName==null)"); } if (!fs.InstanceCapabilities.SupportsStreamSeek) { throw new FinancialException(StringConsts.SECDB_FS_SEEK_STREAM_ERROR.Args("{0}('{1}')".Args(fs.GetType().FullName, fs.Name))); } m_FS = fs; m_FSConnect = conParams; m_FileName = fileName; workWithFile <bool, bool>((_, file) => { parseHeadersAndMetadata(file); return(true); }, true); }
void IConfigurable.Configure(IConfigSectionNode node) { if (node == null || !node.Exists) { throw new WaveException(StringConsts.CONFIG_PORTAL_HUB_NODE_ERROR); } foreach (var cn in node.Children.Where(cn => cn.IsSameName(CONFIG_PORTAL_SECTION))) { m_Portals.Register(FactoryUtils.Make <Portal>(cn, typeof(Portal), args: new object[] { cn })); } //Make File System var fsNode = node[CONFIG_CONTENT_FS_SECTION]; m_ContentFS = FactoryUtils.MakeAndConfigure <FileSystem>(fsNode, typeof(NFX.IO.FileSystem.Local.LocalFileSystem), args: new object[] { GetType().Name, fsNode }); var fsPNode = fsNode[CONFIG_FS_CONNECT_PARAMS_SECTION]; if (fsPNode.Exists) { m_ContentFSConnect = FileSystemSessionConnectParams.Make <FileSystemSessionConnectParams>(fsPNode); } else { m_ContentFSConnect = new FileSystemSessionConnectParams() { User = NFX.Security.User.Fake }; } m_ContentFSRootPath = fsNode.AttrByName(CONFIG_FS_ROOT_PATH_ATTR).Value; if (m_ContentFSRootPath.IsNullOrWhiteSpace()) { throw new WaveException(StringConsts.CONFIG_PORTAL_HUB_FS_ROOT_PATH_ERROR.Args(CONFIG_CONTENT_FS_SECTION, CONFIG_FS_ROOT_PATH_ATTR)); } }
protected override void DoConfigure(IConfigSectionNode node) { base.DoConfigure(node); if (node == null || !node.Exists) { return; } //Make File System var fsNode = node[CONFIG_CONTENT_FS_SECTION]; DisposeAndNull(ref m_Session); DisposeAndNull(ref m_Fs); m_Fs = FactoryUtils.MakeAndConfigureComponent <FileSystem>(App, fsNode, typeof(IO.FileSystem.Local.LocalFileSystem)); var pnode = fsNode[CONFIG_FS_CONNECT_PARAMS_SECTION]; DisposeIfDisposableAndNull(ref m_FsConnectParams); if (pnode.Exists) { m_FsConnectParams = FileSystemSessionConnectParams.Make <FileSystemSessionConnectParams>(pnode); } else { m_FsConnectParams = new FileSystemSessionConnectParams() { User = Security.User.Fake } }; m_Session = m_Fs.StartSession(m_FsConnectParams); } }
public void Configure(IConfigSectionNode node) { if (node == null || !node.Exists) { return; } //making FileSystem instance along with connect parameters var fsNode = node[CONFIG_FILE_SYSTEM_SECTION]; DisposeAndNull(ref m_FS);//dispose existing //make new virtual FS instance m_FS = FactoryUtils.MakeAndConfigureDirectedComponent <FileSystem>(this, fsNode, typeof(Azos.IO.FileSystem.Local.LocalFileSystem)); var paramsNode = fsNode[CONFIG_SESSION_CONNECT_PARAMS_SECTION]; if (paramsNode.Exists) { m_FSConnectParams = FileSystemSessionConnectParams.Make <FileSystemSessionConnectParams>(paramsNode); } else { m_FSConnectParams = new FileSystemSessionConnectParams() { User = User.Fake } }; m_FSRootPath = fsNode.AttrByName(CONFIG_ROOT_PATH_ATTR) .ValueAsString() .NonBlank(CONFIG_ROOT_PATH_ATTR); WriteLog(MessageType.Trace, nameof(FileSystemCmsSource), $"Configured FS: '{m_FS.GetType().FullName}' type, using '{m_FSConnectParams.GetType().Name}' connect parameters. Root path: '{m_FSRootPath}'"); }
protected override void ValidateConnectParams(FileSystemSessionConnectParams cParams) { var svnp = (SVNFileSystemSessionConnectParams)cParams; if (svnp.ServerURL.IsNullOrWhiteSpace()) throw new NFXIOException(WSC.FS_SVN_PARAMS_SERVER_URL_ERROR); }
void IConfigurable.Configure(IConfigSectionNode node) { if (node==null || !node.Exists) throw new WaveException(StringConsts.CONFIG_PORTAL_HUB_NODE_ERROR); foreach(var cn in node.Children.Where(cn=>cn.IsSameName(CONFIG_PORTAL_SECTION))) m_Portals.Register( FactoryUtils.Make<Portal>(cn, typeof(Portal), args: new object[]{ cn })); //Make File System var fsNode = node[CONFIG_CONTENT_FS_SECTION]; m_ContentFS = FactoryUtils.MakeAndConfigure<FileSystem>(fsNode, typeof(NFX.IO.FileSystem.Local.LocalFileSystem), args: new object[]{GetType().Name, fsNode}); var fsPNode = fsNode[CONFIG_FS_CONNECT_PARAMS_SECTION]; if (fsPNode.Exists) { m_ContentFSConnect = FileSystemSessionConnectParams.Make<FileSystemSessionConnectParams>(fsPNode); } else { m_ContentFSConnect = new FileSystemSessionConnectParams(){ User = NFX.Security.User.Fake}; } m_ContentFSRootPath = fsNode.AttrByName(CONFIG_FS_ROOT_PATH_ATTR).Value; if (m_ContentFSRootPath.IsNullOrWhiteSpace()) throw new WaveException(StringConsts.CONFIG_PORTAL_HUB_FS_ROOT_PATH_ERROR.Args(CONFIG_CONTENT_FS_SECTION, CONFIG_FS_ROOT_PATH_ATTR)); }
public override FileSystemSession StartSession(FileSystemSessionConnectParams cParams = null) { return this.StartSession(cParams as SVNFileSystemSessionConnectParams); }
public override void Configure(IConfigSectionNode config) { base.Configure(config); if (config==null || !config.Exists) return; //Make File System var fsNode = config[CONFIG_CONTENT_FS_SECTION]; var fs = FactoryUtils.MakeAndConfigure<FileSystem>(fsNode, typeof(NFX.IO.FileSystem.Local.LocalFileSystem), args: new object[]{GetType().Name, fsNode}); var fsPNode = fsNode[CONFIG_FS_CONNECT_PARAMS_SECTION]; FileSystemSessionConnectParams fsc; if (fsPNode.Exists) { fsc = FileSystemSessionConnectParams.Make<FileSystemSessionConnectParams>(fsPNode); } else { fsc = new FileSystemSessionConnectParams(){ User = NFX.Security.User.Fake}; } var fsp = fsNode.AttrByName(CONFIG_FS_ROOT_PATH_ATTR).Value; BindFS(fs, fsc, fsp); }
protected override FileSystemSessionConnectParams MakeSessionConfigParams(IConfigSectionNode node) { return(FileSystemSessionConnectParams.Make <SVNFileSystemSessionConnectParams>(node)); }
public override FileSystemSession StartSession(FileSystemSessionConnectParams cParams = null) { if (cParams==null) cParams = new FileSystemSessionConnectParams(); return new FileSystemSession(this, null, cParams); }
public override FileSystemSession StartSession(FileSystemSessionConnectParams cParams = null) { return(this.StartSession(cParams as GoogleDriveParameters)); }
protected override void ValidateConnectParams(FileSystemSessionConnectParams cParams) { var s3cp = cParams as S3V4FileSystemSessionConnectParams; if (s3cp.Bucket.IsNullOrWhiteSpace() || s3cp.Region.IsNullOrWhiteSpace()) throw new NFXIOException(WSC.FS_S3_PARAMS_SERVER_URL_ERROR); }
public override FileSystemSession StartSession(FileSystemSessionConnectParams cParams = null) { return this.StartSession(cParams as GoogleDriveParameters); }
public override FileSystemSession StartSession(FileSystemSessionConnectParams cParams = null) { return(this.StartSession(cParams as SVNFileSystemSessionConnectParams)); }
public void BindFS(FileSystem fs, FileSystemSessionConnectParams fsConnectParams, string fsRootPath) { lock(m_FSLock) { m_FS = fs; m_FSConnectParams = fsConnectParams; m_FSRootPath = fsRootPath; } }