01: /*
02: * Copyright 2006 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
07: * BI Platform. The Initial Developer is Pentaho Corporation.
08: *
09: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
10: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
11: * the license for the specific language governing your rights and limitations.
12: *
13: * @created Oct 2, 2005
14: * @author James Dixon
15: */
16:
17: package org.pentaho.core.solution;
18:
19: import java.util.Date;
20:
21: import org.pentaho.commons.connection.IPentahoResultSet;
22: import org.pentaho.util.ParameterHelper;
23:
24: public abstract class BaseParameterProvider implements
25: IParameterProvider {
26:
27: protected abstract String getValue(String name);
28:
29: public abstract Object getParameter(String name);
30:
31: public String getStringParameter(String name, String defaultValue) {
32: return ParameterHelper.parameterToString(getValue(name),
33: defaultValue);
34: }
35:
36: public IPentahoResultSet getListParameter(String name) {
37: return (IPentahoResultSet) getParameter(name);
38: }
39:
40: public long getLongParameter(String name, long defaultValue) {
41: return ParameterHelper.parameterToLong(getValue(name),
42: defaultValue);
43: }
44:
45: public Date getDateParameter(String name, Date defaultValue) {
46: return ParameterHelper.parameterToDate(getValue(name),
47: defaultValue);
48: }
49:
50: public Object getDecimalParameter(String name, Object defaultValue) {
51: // TODO Auto-generated method stub
52: return null;
53: }
54:
55: public String getParameterType(String name) {
56: // TODO Auto-generated method stub
57: return null;
58: }
59:
60: }
|