Custom Resource Framework
Custom Resource Framework
A package designed to provide a uniform interface to data file management in the cloud and on a local file system.
Standardizes file names, provides key-word and file-name based lookup.
Provides an OOP style interface for simple resource management across multiple directories/cloud locations as well as two global variables for standard idiomatic usage.
BeginPackage["resourceFramework`"];
Exposed
Exposed
$resourceMode::usage="Specifies how to manage resources. Can be \"Cloud\" or \"Local\"";$resourceDirectory::usage="Default location to get/send resources from/to";
resourcePath::usage"Formats an object path for a file/user/location/mode set";resourceSubmit::usage="Stores a resource to the path gotten by resourcePath";resourcePull::usage="Gets a resource from the path gotten by resourcePath";
resourceInformation::usage="Gets the information for a resource";resourceList::usage="Gets all the resources in the storage repository";resourceSearch::usage="Searches for all resources matching a spec";resourceFind::usage="Attempts to find a single resource from a spec";
resourceManager::usage="A delegator to all the other functions";
Begin["`Private`"];
Internals
Internals
$resourceMode::sry="Bad mode ``: $resourceMode can only be \"Cloud\" or \"Local\"";
$resourceMode="Cloud";$resourceMode/:HoldPattern[Set[$resourceMode,v:Except["Cloud"|"Local"]]]:=Message[$resourceMode::sry,v];
$resourceMode/:HoldPattern[Set[$resourceMode,v_]/;!TrueQ@$resourceModeOverride]:=CompoundExpression[Block[{$resourceModeOverride=True},$resourceMode=v];,Switch[v,"Cloud",$resourceDirectory="resource_framework","Local",$resourceDirectory=FileNameJoin@{$UserDocumentsDirectory,"resource_framework"}]];
$resourceDirectory="resource_framework";
resourceFileName
resourceFileName
resourcePath
resourcePath
resourceSubmit
resourceSubmit
resourcePull
resourcePull
resourceInformation
resourceInformation
resourceList
resourceList
resourceSearch
resourceSearch
resourceFind
resourceFind
resourceManager
resourceManager
End[];
EndPackage[];
Testing
Testing
Clear@"resourceFramework`*"
Pulling and submitting data
Pulling and submitting data
Test Data
Test Data
Cloud
Cloud
Local file system
Local file system