@@ -23,7 +23,11 @@ class HttpConfigurationManager:
23
23
HTTP_LOCALHOST_CONFIGURATION_ID = "SYSTEMLINK_LOCALHOST"
24
24
"""The default ID of the SystemLink Server's configuration on the SystemLink Server itself."""
25
25
26
+ _HTTP_JUPYTER_CONFIGURATION_ID = "SYSTEMLINK_VIRTUAL_JUPYTER"
27
+ """Virtual ID of SystemLink Server's configuration for Jupyter Notebook execution on SLE."""
28
+
26
29
_configs = None
30
+ _virtual_configs = None
27
31
28
32
@classmethod
29
33
def get_configuration (
@@ -78,14 +82,41 @@ def _fallback(cls) -> Optional[core.HttpConfiguration]:
78
82
"""
79
83
if cls ._configs is None :
80
84
cls ._configs = cls ._read_configurations ()
85
+ if cls ._virtual_configs is None :
86
+ cls ._virtual_configs = cls ._read_virtual_configurations ()
87
+
81
88
master_config = cls ._configs .get (cls .HTTP_MASTER_CONFIGURATION_ID )
82
89
if master_config is not None :
83
90
return master_config
84
91
localhost_config = cls ._configs .get (cls .HTTP_LOCALHOST_CONFIGURATION_ID )
85
92
if localhost_config is not None :
86
93
return localhost_config
94
+
95
+ jupyter_config = cls ._virtual_configs .get (cls ._HTTP_JUPYTER_CONFIGURATION_ID )
96
+ if jupyter_config is not None :
97
+ return jupyter_config
98
+
87
99
return None
88
100
101
+ @classmethod
102
+ def _read_virtual_configurations (cls ) -> Dict [str , core .HttpConfiguration ]:
103
+ """Loads the virtual HTTP configurations.
104
+
105
+ Returns:
106
+ A dictionary mapping each loaded configuration ID to its corresponding
107
+ :class:`HttpConfiguration`.
108
+ """
109
+ configurations = {} # type: Dict[str, core.HttpConfiguration]
110
+ try :
111
+ configurations [cls ._HTTP_JUPYTER_CONFIGURATION_ID ] = (
112
+ core .JupyterHttpConfiguration ()
113
+ )
114
+ except KeyError :
115
+ # Env variables for Jupyter notebook execution are not available.
116
+ pass
117
+
118
+ return configurations
119
+
89
120
@classmethod
90
121
def _read_configurations (cls ) -> Dict [str , core .HttpConfiguration ]:
91
122
"""Discover and loads the HTTP configuration files.
0 commit comments