01: /*
02: * Copyright 2006-2007 The Scriptella Project Team.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package scriptella.core;
17:
18: import scriptella.execution.EtlContext;
19: import scriptella.spi.Connection;
20: import scriptella.spi.ParametersCallback;
21:
22: /**
23: * Represents dynamic execution context for executable elements.
24: *
25: * @author Fyodor Kupolov
26: * @version 1.0
27: */
28: public @ThreadSafe
29: class DynamicContext implements ParametersCallback {
30: protected EtlContext globalContext;
31:
32: protected DynamicContext() {
33: }
34:
35: public DynamicContext(EtlContext globalContext) {
36: this .globalContext = globalContext;
37: }
38:
39: public Object getParameter(final String name) {
40: return globalContext.getParameter(name);
41: }
42:
43: public Connection getConnection() {
44: final ConnectionManager cf = globalContext.getSession()
45: .getConnection(null);
46: return cf.getConnection();
47: }
48:
49: protected EtlContext getGlobalContext() {
50: return globalContext;
51: }
52:
53: }
|