OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library appengine.client_context; |
| 6 |
| 7 import 'dart:async'; |
| 8 |
| 9 import 'package:gcloud/db.dart'; |
| 10 import 'package:gcloud/storage.dart'; |
| 11 import 'package:memcache/memcache.dart'; |
| 12 |
| 13 import '../api/logging.dart'; |
| 14 import '../api/modules.dart'; |
| 15 import '../api/remote_api.dart'; |
| 16 import '../api/users.dart'; |
| 17 |
| 18 abstract class ClientContext { |
| 19 /// Whether the application is currently running in the development |
| 20 /// environment. |
| 21 bool get isDevelopmentEnvironment; |
| 22 /// Whether the application is currently running in the production |
| 23 /// environment. |
| 24 bool get isProductionEnvironment; |
| 25 |
| 26 Services get services; |
| 27 Assets get assets; |
| 28 } |
| 29 |
| 30 abstract class Services { |
| 31 DatastoreDB get db; |
| 32 |
| 33 /// Access the gcloud package storage API. This will autumatically be |
| 34 /// available on deployed App Engine applications. For local testing this |
| 35 /// will be `null` unless the environemnt variable |
| 36 /// `STORAGE_SERVICE_ACCOUNT_FILE` is passed in `app.yaml`. This environment |
| 37 /// variable should point to a private key for a service account in JSON |
| 38 /// format. |
| 39 Storage get storage; |
| 40 Logging get logging; |
| 41 Memcache get memcache; |
| 42 ModulesService get modules; |
| 43 RemoteApi get remoteApi; |
| 44 UserService get users; |
| 45 } |
| 46 |
| 47 class AssetError implements Exception { |
| 48 final String message; |
| 49 |
| 50 AssetError(this.message); |
| 51 |
| 52 String toString() => "AssetError: $message"; |
| 53 } |
| 54 |
| 55 abstract class Assets { |
| 56 /** |
| 57 * Read an asset. If [path] is not specified the path |
| 58 * from the active request is used. |
| 59 */ |
| 60 Future<Stream<List<int>>> read([String path]); |
| 61 |
| 62 /** |
| 63 * Serve a asset to the active response. If [path] |
| 64 * is not specified the path from the active request is used. |
| 65 */ |
| 66 void serve([String path]); |
| 67 } |
OLD | NEW |