| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from api_data_source import APIDataSource | 5 from api_data_source import APIDataSource |
| 6 from api_list_data_source import APIListDataSource | 6 from api_list_data_source import APIListDataSource |
| 7 from appengine_wrappers import IsDevServer | 7 from appengine_wrappers import IsDevServer |
| 8 from caching_file_system import CachingFileSystem | 8 from caching_file_system import CachingFileSystem |
| 9 from compiled_file_system import CompiledFileSystem | 9 from compiled_file_system import CompiledFileSystem |
| 10 from empty_dir_file_system import EmptyDirFileSystem | 10 from empty_dir_file_system import EmptyDirFileSystem |
| 11 from example_zipper import ExampleZipper | 11 from example_zipper import ExampleZipper |
| 12 from intro_data_source import IntroDataSource | 12 from intro_data_source import IntroDataSource |
| 13 from local_file_system import LocalFileSystem | 13 from local_file_system import LocalFileSystem |
| 14 from manifest_data_source import ManifestDataSource | 14 from manifest_data_source import ManifestDataSource |
| 15 from object_store_creator import ObjectStoreCreator | 15 from object_store_creator import ObjectStoreCreator |
| 16 from path_canonicalizer import PathCanonicalizer | 16 from path_canonicalizer import PathCanonicalizer |
| 17 from reference_resolver import ReferenceResolver | 17 from reference_resolver import ReferenceResolver |
| 18 from samples_data_source import SamplesDataSource | 18 from samples_data_source import SamplesDataSource |
| 19 from sidenav_data_source import SidenavDataSource | 19 from sidenav_data_source import SidenavDataSource |
| 20 import svn_constants | 20 import svn_constants |
| 21 from template_data_source import TemplateDataSource | 21 from template_data_source import TemplateDataSource |
| 22 from test_object_store import TestObjectStore | 22 from test_object_store import TestObjectStore |
| 23 | 23 |
| 24 class ServerInstance(object): | 24 class ServerInstance(object): |
| 25 def __init__(self, | 25 def __init__(self, |
| 26 channel, | 26 channel, |
| 27 object_store_creator, | 27 object_store_creator, |
| 28 host_file_system, | 28 host_file_system, |
| 29 app_samples_file_system): | 29 app_samples_file_system, |
| 30 static_path, |
| 31 compiled_fs_factory): |
| 30 self.channel = channel | 32 self.channel = channel |
| 31 | 33 |
| 32 self.object_store_creator = object_store_creator | 34 self.object_store_creator = object_store_creator |
| 33 | 35 |
| 34 self.host_file_system = host_file_system | 36 self.host_file_system = host_file_system |
| 35 | 37 |
| 36 self.app_samples_file_system = app_samples_file_system | 38 self.app_samples_file_system = app_samples_file_system |
| 37 | 39 |
| 38 self.compiled_host_fs_factory = CompiledFileSystem.Factory( | 40 self.compiled_host_fs_factory = compiled_fs_factory |
| 39 host_file_system, | |
| 40 object_store_creator) | |
| 41 | 41 |
| 42 self.api_list_data_source_factory = APIListDataSource.Factory( | 42 self.api_list_data_source_factory = APIListDataSource.Factory( |
| 43 self.compiled_host_fs_factory, | 43 self.compiled_host_fs_factory, |
| 44 svn_constants.API_PATH, | 44 svn_constants.API_PATH, |
| 45 svn_constants.PUBLIC_TEMPLATE_PATH) | 45 svn_constants.PUBLIC_TEMPLATE_PATH) |
| 46 | 46 |
| 47 self.api_data_source_factory = APIDataSource.Factory( | 47 self.api_data_source_factory = APIDataSource.Factory( |
| 48 self.compiled_host_fs_factory, | 48 self.compiled_host_fs_factory, |
| 49 svn_constants.API_PATH) | 49 svn_constants.API_PATH) |
| 50 | 50 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 channel, | 94 channel, |
| 95 self.api_data_source_factory, | 95 self.api_data_source_factory, |
| 96 self.api_list_data_source_factory, | 96 self.api_list_data_source_factory, |
| 97 self.intro_data_source_factory, | 97 self.intro_data_source_factory, |
| 98 self.samples_data_source_factory, | 98 self.samples_data_source_factory, |
| 99 self.sidenav_data_source_factory, | 99 self.sidenav_data_source_factory, |
| 100 self.compiled_host_fs_factory, | 100 self.compiled_host_fs_factory, |
| 101 self.ref_resolver_factory, | 101 self.ref_resolver_factory, |
| 102 self.manifest_data_source, | 102 self.manifest_data_source, |
| 103 svn_constants.PUBLIC_TEMPLATE_PATH, | 103 svn_constants.PUBLIC_TEMPLATE_PATH, |
| 104 svn_constants.PRIVATE_TEMPLATE_PATH) | 104 svn_constants.PRIVATE_TEMPLATE_PATH, |
| 105 static_path) |
| 105 | 106 |
| 106 self.example_zipper = ExampleZipper( | 107 self.example_zipper = ExampleZipper( |
| 107 self.compiled_host_fs_factory, | 108 self.compiled_host_fs_factory, |
| 108 svn_constants.DOCS_PATH) | 109 svn_constants.DOCS_PATH) |
| 109 | 110 |
| 110 self.path_canonicalizer = PathCanonicalizer( | 111 self.path_canonicalizer = PathCanonicalizer( |
| 111 channel, | 112 channel, |
| 112 self.compiled_host_fs_factory) | 113 self.compiled_host_fs_factory) |
| 113 | 114 |
| 114 self.content_cache = self.compiled_host_fs_factory.CreateIdentity( | 115 self.content_cache = self.compiled_host_fs_factory.CreateIdentity( |
| 115 ServerInstance) | 116 ServerInstance) |
| 116 | 117 |
| 117 @staticmethod | 118 @staticmethod |
| 118 def ForTest(file_system): | 119 def ForTest(file_system): |
| 120 object_store_creator = ObjectStoreCreator.ForTest() |
| 119 return ServerInstance('test', | 121 return ServerInstance('test', |
| 120 ObjectStoreCreator.ForTest(), | 122 object_store_creator, |
| 121 file_system, | 123 file_system, |
| 122 EmptyDirFileSystem()) | 124 EmptyDirFileSystem(), |
| 125 '/static', |
| 126 CompiledFileSystem.Factory(file_system, |
| 127 object_store_creator)) |
| 123 | 128 |
| 124 @staticmethod | 129 @staticmethod |
| 125 def ForLocal(): | 130 def ForLocal(): |
| 126 channel = 'trunk' | 131 channel = 'trunk' |
| 127 object_store_creator = ObjectStoreCreator(channel, | 132 object_store_creator = ObjectStoreCreator(channel, |
| 128 start_empty=False, | 133 start_empty=False, |
| 129 store_type=TestObjectStore) | 134 store_type=TestObjectStore) |
| 135 file_system = CachingFileSystem(LocalFileSystem.Create(), |
| 136 object_store_creator) |
| 130 return ServerInstance( | 137 return ServerInstance( |
| 131 channel, | 138 channel, |
| 132 object_store_creator, | 139 object_store_creator, |
| 133 CachingFileSystem(LocalFileSystem.Create(), object_store_creator), | 140 file_system, |
| 134 EmptyDirFileSystem()) | 141 EmptyDirFileSystem(), |
| 142 '/static', |
| 143 CompiledFileSystem.Factory(file_system, object_store_creator)) |
| OLD | NEW |