KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > scriptella > execution > EtlContext


1 /*
2  * Copyright 2006-2007 The Scriptella Project Team.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.execution;
17
18 import scriptella.core.Session;
19 import scriptella.interactive.ProgressCallback;
20 import scriptella.spi.DriverContext;
21 import scriptella.spi.ParametersCallback;
22
23 import java.net.MalformedURLException JavaDoc;
24 import java.net.URL JavaDoc;
25
26
27 /**
28  * Execution context for script.
29  * <p/>
30  * This class contains global data for executed elements.
31  * <br><b>Note:</b> Execution context is not intended to change its state during sql elements
32  * execution as opposed to {@link scriptella.core.DynamicContext}.
33  *
34  * @author Fyodor Kupolov
35  * @version 1.0
36  */

37 public class EtlContext implements ParametersCallback, DriverContext {
38     private ProgressCallback progressCallback;
39     private ParametersCallback properties;
40     private URL JavaDoc baseURL;
41     private ExecutionStatisticsBuilder statisticsBuilder = new ExecutionStatisticsBuilder();
42     Session session; //Connections related stuff is here
43

44     public Object JavaDoc getParameter(final String JavaDoc name) {
45         return properties.getParameter(name);
46     }
47
48     public ProgressCallback getProgressCallback() {
49         return progressCallback;
50     }
51
52     void setProgressCallback(final ProgressCallback progressCallback) {
53         this.progressCallback = progressCallback;
54     }
55
56     /**
57      * Sets configuration properties for this context.
58      * @param properties configuration properties.
59      */

60     void setProperties(ParametersCallback properties) {
61         this.properties = properties;
62     }
63
64
65     public URL JavaDoc getScriptFileURL() {
66         return baseURL;
67     }
68
69     void setBaseURL(final URL JavaDoc baseURL) {
70         this.baseURL = baseURL;
71     }
72
73     public URL JavaDoc resolve(final String JavaDoc uri) throws MalformedURLException JavaDoc {
74         return new URL JavaDoc(baseURL, uri);
75     }
76
77
78     public ExecutionStatisticsBuilder getStatisticsBuilder() {
79         return statisticsBuilder;
80     }
81
82     public Session getSession() {
83         return session;
84     }
85
86 }
87
Popular Tags