KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pentaho > plugin > sql > SQLLookupRule


1 /*
2  * Copyright 2006 Pentaho Corporation. All rights reserved.
3  * This software was developed by Pentaho Corporation and is provided under the terms
4  * of the Mozilla Public License, Version 1.1, or any later version. You may not use
5  * this file except in compliance with the license. If you need a copy of the license,
6  * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
7  * BI Platform. The Initial Developer is Pentaho Corporation.
8  *
9  * 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 Jun 28, 2005
14  * @author James Dixon
15  */

16
17 package org.pentaho.plugin.sql;
18
19 import java.util.Set JavaDoc;
20 import org.apache.commons.logging.Log;
21 import org.apache.commons.logging.LogFactory;
22 import org.pentaho.messages.Messages;
23 import org.pentaho.plugin.core.StandardSettings;
24
25 public class SQLLookupRule extends SQLBaseComponent {
26
27     private static final long serialVersionUID = 5299778034643663502L;
28
29     public Log getLogger() {
30         return LogFactory.getLog(SQLLookupRule.class);
31     }
32
33     public String JavaDoc getResultOutputName() {
34         Set JavaDoc outputs = getOutputNames();
35         if ((outputs == null) || (outputs.size() == 0)) {
36             // if( (outputs == null) || (outputs.size() == 0 ) ||
37
// (outputs.size() > 1 ) ) {
38
error(Messages.getString("Template.ERROR_0002_OUTPUT_COUNT_WRONG")); //$NON-NLS-1$
39
return null;
40         }
41
42         // Did we override the output name? // TODO Deprecation Warning
43
String JavaDoc outputName = getInputStringValue(StandardSettings.OUTPUT_NAME);
44         if (outputName == null && outputs.contains("query-result")) { //$NON-NLS-1$ // Get the query-result node - This is the preferred method to use
45
outputName = "query-result"; //$NON-NLS-1$
46
}
47
48         if (outputName == null) { // Drop back to the old behavior
49
outputName = (String JavaDoc) outputs.iterator().next();
50             // TODO Deprecation Warning
51
}
52         return outputName;
53     }
54
55     public boolean validateSystemSettings() {
56         // This component does not have any system settings to validate
57
return true;
58     }
59
60     public boolean init() {
61         return true;
62     }
63
64 }
65
Popular Tags