Skip to content

PredixMobilityConfiguration

Andy Johns edited this page Mar 1, 2016 · 20 revisions

The PredixMobilityConfiguration class contains configuration interfaces and methods to allow PredixGoSDK consuming apps to customize various aspects of SDK functionality

Methods:

#####loadConfiguration()
called to load the SDK's initial configuration. Since this sets default logging levels, ideally this is called as early as possible in the app startup process. If it is not called by the time the PredixMobilityManager.startApp() method is called, it will be called at that time.


#####appendDataViewDefinition(viewName: String, version: String, mapFunction:(properties: [String : AnyObject], emit: (AnyObject, AnyObject?)->())->())

Used to create data views for querying data documents within the application.

  • viewName: Name of the view. If the name contains a "/" character, the view can be queried through the CDB service. The view name "foo/bar" would be queried with a CDB service query like:

    http://pmapi/cdb/~/_design/foo/_view/bar

  • version: Version number of the view. Must be changed if the code within the mapFunction changes.

  • mapFunction: closure that defines the view, and will be called during indexing. The properties parameter will include the data document. For every call to the emit function, an indexed key and value will be created. Keys can then be used to filter (query) the view.

Example:

PredixMobilityConfiguration.appendDataViewDefinition("myviews/documents_by_type", version: "1", mapFunction: { (properties, emit) -> () in
    if let type = properties["type"] as? String
    {
        let isDeleted : Bool = properties["_deleted"] as? Bool ?? false
        if !isDeleted
        {
            emit(type, nil)
        }
    }
})

Then a subsequent query:

http://pmapi/cdb/~/_design/myviews/_view/documents_by_type?key=%22test%22

would return all documents that contained a "type" field, that were not flagged for deletion, where the value of the "type" field was "test". The returned rows would contain only the id, and type field, no additional values.

Properties:

  • #####defaultLoggingLevel sets a default logging level for logging within the system.

  • #####defaultDatabaseName sets the default local database name.

  • #####authenticationScheme sets the scheme component of the authentication grant redirect used by oAuth authentication

  • #####authenticationGrantIndicator
    sets the hostname component of the authentication grant redirect used by oAuth authentication

  • #####loggingLevelConfigKey
    sets the key used to load the logging level setting from iOS Settings or Info.plist

  • #####loggingLevelConfigLocation sets where the logging level configuration is located, iOS Settings or Info.plist

  • #####serverEndpointConfigKey sets the key used to load the server endpoint setting from iOS Settings or Info.plist

  • #####serverEndpointConfigLocation sets where the server endpoint configuration is located, iOS Settings or Info.plist

  • #####traceLogsRequestsConfigKey sets the key used to load the "trace logs all requests" setting from iOS Settings or Info.plist

  • #####traceLogsRequestsConfigLocation sets where the "trace logs all requests" setting configuration is located, iOS Setting or Info.plist

  • #####userSessionURLPath sets the URL path used obtain user information during online authentication

  • #####loginURLPath sets the URL path used to login during online authentication

  • #####logoutURLPath sets the URL path used to logout online

  • #####dataReplicationURLPath sets the URL path used to replicate the local database while online

  • #####authorizationCheckURLPath sets the URL path used validate authentication

  • #####authorizationCheckAuthorizedStatusCode sets the status code used to verify valid authentication

  • #####authorizationCheckValidStatusCodes sets the status codes used to verify authentication valid or invalid. If an authorization check returns a status code not in this list, it's considered the authentication server cannot be reached and the local system is no online, but may still have internet access.

  • #####userSessionUsernameKey sets key used during the userSessionURLPath call to obtain the name of the user

  • #####userSessionAuthenticatedKey sets key used during the userSessionURLPath call to obtain the validation state of the user

  • #####userSessionDatabaseNameKey sets key used during the userSessionURLPath call to obtain the local database name

  • #####pmappDocumentNameKey sets the key used to find the pm app document name

  • #####pmappDocumentNameConfigLocation sets where the pmappDocumentNameKey configuration is located, iOS Settings or Info.plist

  • #####pmappDocumentVersionKey sets the key used to find the pm app document version

  • #####pmappDocumentVersionConfigLocation sets where the pmappDocumentVersionKey configuration is located, iOS Settings or Info.plist

  • #####pmAppDocumentWebAppNameKey sets the key used to find the initial web app name in the pm app document

  • #####pmAppDocumentOfflineAppNameKey sets the key used to find the offline login app name in the pm app document

  • #####pmAppDocumentDependenciesKey sets the key used to find the web app dependancies list in the pm app document

  • #####API_HOST sets the hostname used for internal service calls within the app

  • #####seriousErrorDefaultMessage sets the default text to display when the app encounters an unresolvable error

  • #####seriousErrorPage sets the bundled HTML page used to present unresolvable errors to the user

  • #####additionalBootRestartWorkflow sets an optional closure which, if set, will be called during the boot restart workflow.

  • #####additionalBootServicesToRegister An optional array of services that, if set, will be integrated into the boot service services registration/unregistration process.

  • #####shouldLogUnhandledErrors sets whether or not the SDK will log unhandled errors

  • #####shouldInitializeDefaultsFromSettings sets whether or not the SDK will load default iOS Settings values from the Settings bundle

  • #####shouldIssueWarningsForPlaceholderULRs sets whether or not the SDK will log warning messages when images from "placehold.it" are detected

  • #####requireDevicePasscodeSet sets whether or not the boot service will return an error if the device does not have a passcode set.
    Defaults to true. iOS device passcodes are a critical security feature, and it's recommended for a secure system a passcode should be required.

  • #####defaultInitializationDetectionKey sets the key used to detect changes in iOS Settings and automatically load them

  • #####traceLogsAllRequestsDefault sets whether or not the SDK will by default log all HTTP requests detected within the app when logging is in Trace mode.

  • #####dataViewDefinitions An array of view definitions, consisting of a view name, version, and closure that maps the view. The method appendDataViewDefinition(...) is a helper method to append new definitions to this array.