KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > sql > execute > AddJarConstantAction


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.execute.AddJarConstantAction
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.impl.sql.execute;
23
24 import org.apache.derby.iapi.services.sanity.SanityManager;
25 import org.apache.derby.iapi.error.StandardException;
26 import org.apache.derby.iapi.sql.execute.ConstantAction;
27 import org.apache.derby.iapi.sql.Activation;
28 import org.apache.derby.catalog.UUID;
29
30 /**
31  * Constant action to Add an external Jar file to a database.
32  *
33  */

34 class AddJarConstantAction extends DDLConstantAction
35 {
36
37     private final UUID id;
38     private final String JavaDoc schemaName;
39     private final String JavaDoc sqlName;
40     private final String JavaDoc externalPath;
41
42
43     //////////////////////////////////////////////////////////////
44
//
45
// CONSTRUCTORS
46
//
47
//////////////////////////////////////////////////////////////
48

49     /**
50      * Make the ConstantAction to add a jar file to database.
51      *
52      * @param schemaName The SchemaName for the jar file.
53      * @param sqlName The sqlName for the jar file.
54      * @param externalPath The name of the file that holds the jar.
55      */

56     AddJarConstantAction(UUID id,
57                                  String JavaDoc schemaName,
58                                  String JavaDoc sqlName,
59                                  String JavaDoc externalPath)
60     {
61         this.id = id;
62         this.schemaName = schemaName;
63         this.sqlName = sqlName;
64         this.externalPath = externalPath;
65     }
66
67
68     //////////////////////////////////////////////////////////////
69
//
70
// OBJECT SHADOWS
71
//
72
//////////////////////////////////////////////////////////////
73

74     public String JavaDoc toString()
75     {
76         // Do not put this under SanityManager.DEBUG - it is needed for
77
// error reporting.
78
return "ADD JAR FILE " + schemaName + "." + sqlName;
79     }
80
81     //////////////////////////////////////////////////////////////
82
//
83
// CONSTANT ACTION METHODS
84
//
85
//////////////////////////////////////////////////////////////
86

87
88     /**
89      * @see ConstantAction#executeConstantAction
90      * @exception StandardException Thrown on failure
91      */

92     public void executeConstantAction( Activation activation )
93                         throws StandardException
94     {
95         JarUtil.add(id,schemaName,sqlName,externalPath);
96     }
97
98 }
99
Popular Tags