Chromium Code Reviews| 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 fnmatch import fnmatch | 5 from fnmatch import fnmatch |
| 6 import logging | |
| 7 import mimetypes | 6 import mimetypes |
| 8 import traceback | 7 import traceback |
| 9 import os | 8 import os |
| 10 | 9 |
| 11 from api_data_source import APIDataSource | 10 from api_data_source import APIDataSource |
| 12 from api_list_data_source import APIListDataSource | 11 from api_list_data_source import APIListDataSource |
| 13 from appengine_url_fetcher import AppEngineUrlFetcher | 12 from appengine_url_fetcher import AppEngineUrlFetcher |
| 14 from appengine_wrappers import GetAppVersion, IsDevServer | 13 from appengine_wrappers import GetAppVersion, IsDevServer |
| 14 from availability_finder import AvailabilityFinder | |
| 15 from branch_utility import BranchUtility | 15 from branch_utility import BranchUtility |
| 16 from caching_file_system import CachingFileSystem | 16 from caching_file_system import CachingFileSystem |
| 17 from compiled_file_system import CompiledFileSystem | 17 from compiled_file_system import CompiledFileSystem |
| 18 from empty_dir_file_system import EmptyDirFileSystem | 18 from empty_dir_file_system import EmptyDirFileSystem |
| 19 from example_zipper import ExampleZipper | 19 from example_zipper import ExampleZipper |
| 20 from file_system import FileNotFoundError | 20 from file_system import FileNotFoundError |
| 21 from github_file_system import GithubFileSystem | 21 from github_file_system import GithubFileSystem |
| 22 from host_file_system_creator import HostFileSystemCreator | |
| 22 from intro_data_source import IntroDataSource | 23 from intro_data_source import IntroDataSource |
| 23 from local_file_system import LocalFileSystem | 24 from local_file_system import LocalFileSystem |
| 24 from object_store_creator import ObjectStoreCreator | 25 from object_store_creator import ObjectStoreCreator |
| 25 from offline_file_system import OfflineFileSystem | 26 from offline_file_system import OfflineFileSystem |
| 26 from path_canonicalizer import PathCanonicalizer | 27 from path_canonicalizer import PathCanonicalizer |
| 27 from redirector import Redirector | 28 from redirector import Redirector |
| 28 from reference_resolver import ReferenceResolver | 29 from reference_resolver import ReferenceResolver |
| 29 from samples_data_source import SamplesDataSource | 30 from samples_data_source import SamplesDataSource |
| 30 from sidenav_data_source import SidenavDataSource | 31 from sidenav_data_source import SidenavDataSource |
| 31 from subversion_file_system import SubversionFileSystem | |
| 32 import svn_constants | 32 import svn_constants |
| 33 from template_data_source import TemplateDataSource | 33 from template_data_source import TemplateDataSource |
| 34 from test_branch_utility import TestBranchUtility | |
| 34 from test_object_store import TestObjectStore | 35 from test_object_store import TestObjectStore |
| 35 from third_party.json_schema_compiler.model import UnixName | 36 from third_party.json_schema_compiler.model import UnixName |
| 36 import url_constants | 37 import url_constants |
| 37 | 38 |
| 38 class ServerInstance(object): | 39 class ServerInstance(object): |
| 39 def __init__(self, | 40 def __init__(self, |
| 40 channel, | 41 channel, |
| 41 object_store_creator, | 42 object_store_creator, |
| 42 host_file_system, | 43 host_file_system, |
| 43 app_samples_file_system, | 44 app_samples_file_system, |
| 44 base_path, | 45 base_path, |
| 45 compiled_fs_factory): | 46 compiled_fs_factory, |
| 47 branch_utility, | |
| 48 host_file_system_creator): | |
| 46 self.channel = channel | 49 self.channel = channel |
| 47 | 50 |
| 48 self.object_store_creator = object_store_creator | 51 self.object_store_creator = object_store_creator |
| 49 | 52 |
| 50 self.host_file_system = host_file_system | 53 self.host_file_system = host_file_system |
| 51 | 54 |
| 52 self.app_samples_file_system = app_samples_file_system | 55 self.app_samples_file_system = app_samples_file_system |
| 53 | 56 |
| 54 self.compiled_host_fs_factory = compiled_fs_factory | 57 self.compiled_host_fs_factory = compiled_fs_factory |
| 55 | 58 |
| 59 self.availability_finder_factory = AvailabilityFinder.Factory( | |
| 60 object_store_creator, | |
| 61 self.compiled_host_fs_factory, | |
| 62 branch_utility, | |
| 63 host_file_system_creator.CreateAtVersion) | |
|
not at google - send to devlin
2013/07/09 23:11:55
pass the host_file_system_creator to AvailabilityF
epeterson
2013/07/16 00:28:23
Done.
| |
| 64 | |
| 56 self.api_list_data_source_factory = APIListDataSource.Factory( | 65 self.api_list_data_source_factory = APIListDataSource.Factory( |
| 57 self.compiled_host_fs_factory, | 66 self.compiled_host_fs_factory, |
| 58 svn_constants.API_PATH, | 67 svn_constants.API_PATH, |
| 59 svn_constants.PUBLIC_TEMPLATE_PATH) | 68 svn_constants.PUBLIC_TEMPLATE_PATH) |
| 60 | 69 |
| 61 self.api_data_source_factory = APIDataSource.Factory( | 70 self.api_data_source_factory = APIDataSource.Factory( |
| 62 self.compiled_host_fs_factory, | 71 self.compiled_host_fs_factory, |
| 63 svn_constants.API_PATH) | 72 svn_constants.API_PATH, |
| 73 self.availability_finder_factory) | |
| 64 | 74 |
| 65 self.ref_resolver_factory = ReferenceResolver.Factory( | 75 self.ref_resolver_factory = ReferenceResolver.Factory( |
| 66 self.api_data_source_factory, | 76 self.api_data_source_factory, |
| 67 self.api_list_data_source_factory, | 77 self.api_list_data_source_factory, |
| 68 object_store_creator) | 78 object_store_creator) |
| 69 | 79 |
| 70 self.api_data_source_factory.SetReferenceResolverFactory( | 80 self.api_data_source_factory.SetReferenceResolverFactory( |
| 71 self.ref_resolver_factory) | 81 self.ref_resolver_factory) |
| 72 | 82 |
| 73 # Note: samples are super slow in the dev server because it doesn't support | 83 # Note: samples are super slow in the dev server because it doesn't support |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 | 140 |
| 131 @staticmethod | 141 @staticmethod |
| 132 def ForTest(file_system): | 142 def ForTest(file_system): |
| 133 object_store_creator = ObjectStoreCreator.ForTest() | 143 object_store_creator = ObjectStoreCreator.ForTest() |
| 134 return ServerInstance('test', | 144 return ServerInstance('test', |
| 135 object_store_creator, | 145 object_store_creator, |
| 136 file_system, | 146 file_system, |
| 137 EmptyDirFileSystem(), | 147 EmptyDirFileSystem(), |
| 138 '', | 148 '', |
| 139 CompiledFileSystem.Factory(file_system, | 149 CompiledFileSystem.Factory(file_system, |
| 140 object_store_creator)) | 150 object_store_creator), |
| 151 TestBranchUtility.CreateWithCannedData(), | |
| 152 HostFileSystemCreator.ForTest(file_system, | |
| 153 object_store_creator)) | |
| 141 | 154 |
| 142 @staticmethod | 155 @staticmethod |
| 143 def ForLocal(): | 156 def ForLocal(): |
| 144 channel = 'trunk' | 157 channel = 'trunk' |
| 145 object_store_creator = ObjectStoreCreator(channel, | 158 object_store_creator = ObjectStoreCreator(channel, |
| 146 start_empty=False, | 159 start_empty=False, |
| 147 store_type=TestObjectStore) | 160 store_type=TestObjectStore) |
| 148 file_system = CachingFileSystem(LocalFileSystem.Create(), | 161 host_file_system_creator = HostFileSystemCreator.ForLocal( |
| 149 object_store_creator) | 162 object_store_creator) |
| 163 trunk_file_system = host_file_system_creator.CreateAtBranch('trunk') | |
| 150 return ServerInstance( | 164 return ServerInstance( |
| 151 channel, | 165 channel, |
| 152 object_store_creator, | 166 object_store_creator, |
| 153 file_system, | 167 trunk_file_system, |
| 154 EmptyDirFileSystem(), | 168 EmptyDirFileSystem(), |
| 155 '', | 169 '', |
| 156 CompiledFileSystem.Factory(file_system, object_store_creator)) | 170 CompiledFileSystem.Factory(trunk_file_system, object_store_creator), |
| 171 TestBranchUtility.CreateWithCannedData(), | |
| 172 host_file_system_creator) | |
| OLD | NEW |