KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > continuent > sequoia > controller > semantic > StoredProcedureSemantic


1 /**
2  * Sequoia: Database clustering technology.
3  * Copyright (C) 2006 Continuent, Inc.
4  * Contact: sequoia@continuent.org
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * Initial developer(s): Emmanuel Cecchet.
19  * Contributor(s): ______________________.
20  */

21
22 package org.continuent.sequoia.controller.semantic;
23
24 /**
25  * This class defines a StoredProcedureSemantic that is the semantic rule for a
26  * stored procedure.
27  *
28  * @author <a HREF="mailto:emmanuel.cecchet@continuent.com">Emmanuel Cecchet</a>
29  * @version 1.0
30  */

31 public class StoredProcedureSemantic extends AbstractSemantic
32 {
33   private String JavaDoc procedureName;
34   private int parameterCount = -1;
35
36   /**
37    * Creates a new <code>TriggerSemantic</code> object
38    *
39    * @param procedureName the name of the stored procedure
40    * @param parameterCount number of parameters of this stored procedure
41    */

42   public StoredProcedureSemantic(String JavaDoc procedureName, int parameterCount)
43   {
44     this.procedureName = procedureName;
45     this.parameterCount = parameterCount;
46   }
47   
48   /**
49    * Creates a new <code>TriggerSemantic</code> object
50    *
51    * @param procedureName the name of the stored procedure
52    */

53   public StoredProcedureSemantic(String JavaDoc procedureName)
54   {
55     this.procedureName = procedureName;
56   }
57
58   /**
59    * Returns the parameterCount value.
60    *
61    * @return Returns the parameterCount.
62    */

63   public int getParameterCount()
64   {
65     return parameterCount;
66   }
67
68   /**
69    * Returns the procedureName value.
70    *
71    * @return Returns the procedureName.
72    */

73   public String JavaDoc getProcedureName()
74   {
75     return procedureName;
76   }
77
78   /**
79    * Retrieves the key identifying this semantic. If
80    * a parameter count was specified it is used as
81    * part of the key.
82    *
83    * @return the key
84    */

85   public String JavaDoc getProcedureKey()
86   {
87     if (parameterCount >= 0)
88       return procedureName + "(" + parameterCount + ")";
89     
90     return procedureName;
91   }
92 }
93
Popular Tags