KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.execute.DropJarConstantAction
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
28 import org.apache.derby.iapi.sql.Activation;
29
30 import org.apache.derby.catalog.UUID;
31
32 /**
33  * Constant action to drop an external jar file from a database.
34  *
35  */

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

49     /**
50      * Make the ConstantAction to drop a jar file to database.
51      *
52      * @param id The id for the jar file
53      * @param schemaName The SchemaName for the jar file.
54      * @param sqlName The sqlName for the jar file.
55      */

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

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

85
86     /**
87      * @see ConstantAction#executeConstantAction
88      * @exception StandardException Thrown on failure
89      */

90     public void executeConstantAction( Activation activation )
91                         throws StandardException
92     {
93         JarUtil.drop(null,schemaName,sqlName,
94                      purgeOnCommit());
95     }
96
97     //
98
// Replication can over-ride this to defer purging dropped jar
99
// files that remain in the stage.
100
protected boolean purgeOnCommit() { return true; }
101
102 }
103
Popular Tags