ResourceManager

public class ResourceManager

ResourceManager Root - recovers program state on init

  • A public filemanager object that unifies the use of the same filemanager in all extensions

    Declaration

    Swift

    public var fileManager: FileManager
  • Undocumented

    Declaration

    Swift

    public var rootConfig: ProgramConfiguration
  • Undocumented

    Declaration

    Swift

    public var initStatus: Bool
  • Undocumented

    Declaration

    Swift

    public static var verbose: Bool
  • Undocumented

    Declaration

    Swift

    public init()
  • Fetches the projectHandle and the project URL for a given project

    Declaration

    Swift

    public func getProjectURL(projectName: String?) -> (projectHandle: String, projectURL: URL)?

    Parameters

    projectName

    The name of the project. If projectName is nil, the program checks if the current directory name is a project.

ResourceManager

  • Decodes all graphsnapshots for a given project and service name

    Declaration

    Swift

    public func decodeAllGraphSnapshots(pName: String?, serviceName: String) -> (projectHandle: String, graphSnapshots: [GraphSnapshot])?

    Parameters

    projectName

    The name of the project. If projectName is nil, the program checks if the current directory name is a project.

    serviceName

    The name of the service that should be decoded

    Return Value

    The validated project handle and an array of graphsnapshots that have been decoded

  • Decodes a root configuration that is encoded in JSON

    Declaration

    Swift

    public func decodeDatafromJSON(url: URL) -> Optional<ProgramConfiguration>

    Parameters

    url

    The URL the JSON encoded root configuration is located at

  • Decodes a project configuration that is encoded in JSON

    Declaration

    Swift

    public func decodeProjectConfigfromJSON(url: URL) -> Optional<ProjectConfiguration>

    Parameters

    url

    The URL the JSON encoded project configuration is located at

  • Decodes a service configuration that is encoded in JSON

    Declaration

    Swift

    public func decodeServiceConfigfromJSON(url: URL) -> Optional<ServiceConfiguration>

    Parameters

    url

    The URL the JSON encoded service configuration is located at

  • Decodes a graphSnapshot that is encoded in JSON

    Declaration

    Swift

    public func decodeGraphSnapshotfromJSON(url: URL) -> Optional<GraphSnapshot>

    Parameters

    url

    The URL the JSON encoded graphSnapshot is located at

  • Decodes a project configuration based on a project name

    Declaration

    Swift

    public func decodeProjectConfig(pName: String?) -> (String, ProjectConfiguration)?

    Parameters

    projectName

    The name of the project. If projectName is nil, the program checks if the current directory name is a project.

    Return Value

    The validated project handle and the project configuration data

  • Decodes the root configuration and saves it to the globally available rootConfig variable

    Declaration

    Swift

    public func decodeRootConfig()
  • Decodes a service configuration based on a project name

    Declaration

    Swift

    public func decodeServiceConfig(pName: String?, serviceName: String) -> (projectHandle: String, serviceConfig: ServiceConfiguration)?

    Parameters

    projectName

    The name of the project. If projectName is nil, the program checks if the current directory name is a project.

    serviceName

    The name of the service that should be decoded

    Return Value

    The validated project handle and the service configuration data

  • Encodes passed service configuration data for a project

    Declaration

    Swift

    public func encodeGraphSnapshot(pName: String?, serviceName: String, graphSnapshot: GraphSnapshot) -> URL?

    Parameters

    pName

    The project name

    configData

    The configuration data that should be encoded for the project

ResouceManager

  • Encodes root configuration data to JSON

    Declaration

    Swift

    public func encodeDataToJSON(config: ProgramConfiguration) -> Data?

    Parameters

    config

    The root configuration data that should be encoded

    Return Value

    The encoded root configuration data if encoding was successful

  • Encodes project configuration data to JSON

    Declaration

    Swift

    public func encodeDataToJSON(config: ProjectConfiguration) -> Data?

    Parameters

    config

    The project configuration data that should be encoded

    Return Value

    The encoded project configuration data if encoding was successful

  • Encodes service configuration data to JSON

    Declaration

    Swift

    public func encodeDataToJSON(config: ServiceConfiguration) -> Data?

    Parameters

    config

    The service configuration data that should be encoded

    Return Value

    The encoded service configuration data if encoding was successful

  • Encodes graphSnapshot data to JSON

    Declaration

    Swift

    public func encodeDataToJSON(config: GraphSnapshot) -> Data?

    Parameters

    config

    The graphSnapshot data that should be encoded

    Return Value

    The encoded graphSnapshot data if encoding was successful

ResourceManager

  • Encodes passed project configuration data for a project

    Declaration

    Swift

    public func encodeProjectConfig(pName: String?, configData: ProjectConfiguration)

    Parameters

    pName

    The project name

    configData

    The configuration data that should be encoded for the project

ReosurceManager

  • Encode a root configuration to persist it as the working configuration for the application

    Declaration

    Swift

    public func encodeRootConfig(config: ProgramConfiguration)

    Parameters

    config

    The application root configuration that should be encoded

ResourceManager

  • Encodes passed service configuration data for a project

    Declaration

    Swift

    public func encodeServiceConfig(pName: String?, configData: ServiceConfiguration) -> URL?

    Parameters

    pName

    The project name

    configData

    The configuration data that should be encoded for the project

  • Fetches all projects from the root configuration and checks if the provided project name exists.

    Declaration

    Swift

    public func fetchHandleAndProjects(pName: String?) -> (projectHandle: String, projects: [String : URL])?

    Parameters

    pName

    The name of the project to retrieve. If pName is nil, the program checks if the current directory name is a project.

    Return Value

    A tuple that consists of the projectHandle and the projects dictionary. The projectHandle is the key that identifies the project in the dictionary.

  • Overwrites the root configurations projects dictionary with the passed dictionary.

    Declaration

    Swift

    public func setProjects(projects: [String : URL])

    Parameters

    projects

    The new projects directory that should be persisted in the root configuration.

  • Checks if the application has been initialised

    Declaration

    Swift

    public func checkInit() -> Bool

    Return Value

    Retruns a boolean value that indicates if the application has been initalised

  • Initialieses the application based on passed configuration data

    Note

    Based on this configuration data the applications root configuration is created.

    Declaration

    Swift

    public func initRoot(configData: ProgramConfiguration)

    Parameters

    configData

    An application configuration that provides the environment context for the application.

  • Fetch application configuration root directory for initialisation.

    Declaration

    Swift

    public func getRootDir() -> URL?

    Return Value

    Returns the URL of the root configuration directory if existent. Else it returns nil.

  • Fetch root config path for initialisation check and decoding of configurations.

    Declaration

    Swift

    public func getRootConfigPath() -> URL?

    Return Value

    Returns the URL of the root configuration file if existent. Else it returns nil.

  • Validates if there is a service at the passed URL and creates a new service configuration data object.

    Declaration

    Swift

    public func fetchServiceFromURL(serviceURL: URL) -> ServiceConfiguration?

    Parameters

    serviceURL

    The URL where the service is located.

    Return Value

    A service configuration data object if the service exists, else nil.

  • An recursive file system crawler that finds all files that are in a not hidden directory in a filesystem subtree

    Declaration

    Swift

    public func fileCrawler(startURL: URL) -> [File]

    Parameters

    startURL

    The URL of a directory where the crawler starts crawling the file tree

    Return Value

    An array of file objects that identify a file

  • Fetches the most recent graphsnapshot for a given service configuration

    Declaration

    Swift

    public func getMostRecentGraphSnapshot(service: ServiceConfiguration) -> GraphSnapshot?