source: geniuswebcore/geniusweb/profileconnection/ProfileConnectionFactory.py

Last change on this file was 100, checked in by ruud, 21 months ago

python installs also wheel to avoid error messages

File size: 1.3 KB
RevLine 
[100]1from tudelft_utilities_logging.Reporter import Reporter
2from uri.uri import URI # type:ignore
3
4from geniusweb.profileconnection.FileProfileConnector import FileProfileConnector
5from geniusweb.profileconnection.ProfileInterface import ProfileInterface
6from geniusweb.profileconnection.WebSocketContainer import DefaultWebSocketContainer
7from geniusweb.profileconnection.WebsocketProfileConnector import WebsocketProfileConnector
8
9
10class ProfileConnectionFactory:
11 '''
12 * factory that provides a ProfileInterface given an URI, supporting both the ws
13 * and the file scheme for the uri
14 '''
15
16 @staticmethod
17 def create( uri:URI, reporter:Reporter) -> ProfileInterface:
18 '''
19 @param uri the URI that can provide the {@link Profile}. Support
20 both the ws and the file scheme for the uri.
21 @param reporter the {@link Reporter} to log issues to
22 @return a {@link ProfileInterface}
23 @throws IOException if connection can't be made
24 @throws DeploymentException if endpoint can't be published
25 '''
26 scheme=str(uri.getScheme())
27 if "ws"==scheme:
28 return WebsocketProfileConnector(uri, reporter, DefaultWebSocketContainer())
29 if "file"==scheme:
30 return FileProfileConnector(uri.getPath());
31 raise ValueError("Unsupported profile scheme " + str(uri));
32
Note: See TracBrowser for help on using the repository browser.