01: /*
02:
03: Derby - Class org.apache.derby.impl.sql.execute.AddJarConstantAction
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to you under the Apache License, Version 2.0
09: (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: private final UUID id;
37: private final String schemaName;
38: private final String sqlName;
39: private final String externalPath;
40:
41: //////////////////////////////////////////////////////////////
42: //
43: // CONSTRUCTORS
44: //
45: //////////////////////////////////////////////////////////////
46:
47: /**
48: * Make the ConstantAction to add a jar file to database.
49: *
50: * @param schemaName The SchemaName for the jar file.
51: * @param sqlName The sqlName for the jar file.
52: * @param externalPath The name of the file that holds the jar.
53: */
54: AddJarConstantAction(UUID id, String schemaName, String sqlName,
55: String externalPath) {
56: this .id = id;
57: this .schemaName = schemaName;
58: this .sqlName = sqlName;
59: this .externalPath = externalPath;
60: }
61:
62: //////////////////////////////////////////////////////////////
63: //
64: // OBJECT SHADOWS
65: //
66: //////////////////////////////////////////////////////////////
67:
68: public String toString() {
69: // Do not put this under SanityManager.DEBUG - it is needed for
70: // error reporting.
71: return "ADD JAR FILE " + schemaName + "." + sqlName;
72: }
73:
74: //////////////////////////////////////////////////////////////
75: //
76: // CONSTANT ACTION METHODS
77: //
78: //////////////////////////////////////////////////////////////
79:
80: /**
81: * @see ConstantAction#executeConstantAction
82: * @exception StandardException Thrown on failure
83: */
84: public void executeConstantAction(Activation activation)
85: throws StandardException {
86: JarUtil.add(id, schemaName, sqlName, externalPath);
87: }
88:
89: }
|