📄 dinamespace.java
字号:
return signature; } /** * Deprecated */ String getSchemaName(Object o) { return database.schemaManager.PUBLIC_SCHEMA; } /** * Adds to the given Set the fully qualified names of the Class objects * internally granted to PUBLIC in support of core operation. * * @param the HashSet to which to add the fully qualified names of * the Class objects internally granted to PUBLIC in support of * core operation. */ void addBuiltinToSet(HashSet set) { set.addAll(builtin.toArray(new String[builtin.size()])); } /** * Retrieves whether the indicated Class object is systematically * granted to PUBLIC in support of core operation. <p> * * @return whether the indicated Class object is systematically * granted to PUBLIC in support of core operation * @param clazz The Class object for which to make the determination */ boolean isBuiltin(Class clazz) { return clazz == null ? false : builtin.contains(clazz.getName()); } /** * Retrieves whether the Class object indicated by the fully qualified * class name is systematically granted to PUBLIC in support of * core operation. <p> * * @return true if system makes grant, else false * @param name fully qualified name of a Class */ boolean isBuiltin(String name) { return (name == null) ? false : builtin.contains(name); } /** * Retrieves an <code>Iterator</code> object describing the Java * <code>Method</code> objects that are both the entry points * to executable SQL database objects (such as SQL functions and * stored procedures) within the context of this name space. <p> * * Each element of the <code>Iterator</code> is an Object[3] array * whose elements are: <p> * * <ol> * <li>a <code>Method</code> object. * <li>an <code>HsqlArrayList</code> object whose elements are the SQL call * aliases for the method. * <li>the <code>String</code> "ROUTINE" * </ol> * * <b>Note:</b> Admin users are actually free to invoke *any* public * static non-abstract Java Method that can be found through the database * class loading process, either as a SQL stored procedure or SQL function, * as long as its parameters and return type are compatible with the * engine's supported SQL type / Java <code>Class</code> mappings. <p> * * @return An <code>Iterator</code> object whose elements form the set * of distinct <code>Method</code> objects accessible as * executable as SQL routines within the current execution * context.<p> * * Elements are <code>Object[3]</code> instances, with [0] being a * <code>Method</code> object, [1] being an alias list object and * [2] being the <code>String</code> "ROUTINE"<p> * * If the <code>Method</code> object at index [0] has aliases, * and the <code>andAliases</code> parameter is specified * as <code>true</code>, then there is an HsqlArrayList * at index [1] whose elements are <code>String</code> objects * whose values are the SQL call aliases for the method. * Otherwise, the value of index [1] is <code>null</code>. * @param className The fully qualified name of the class for which to * retrieve the iteration * @param andAliases if <code>true</code>, alias lists for qualifying * methods are additionally retrieved. * @throws HsqlException if a database access error occurs * */ Iterator iterateRoutineMethods(String className, boolean andAliases) throws HsqlException { Class clazz; Method[] methods; Method method; int mods; Object[] info; HsqlArrayList aliasList; HsqlArrayList methodList; HashMap invAliasMap; try { clazz = classForName(className); } catch (ClassNotFoundException e) { return new WrapperIterator(); } invAliasMap = andAliases ? getInverseAliasMap() : null; // we are interested in inherited methods too, // so we use getDeclaredMethods() first. // However, under Applet execution or // under restrictive SecurityManager policies // this may fail, so we use getMethods() // if getDeclaredMethods() fails. try { methods = clazz.getDeclaredMethods(); } catch (Exception e) { methods = clazz.getMethods(); } methodList = new HsqlArrayList(methods.length); // add all public static methods to the set for (int i = 0; i < methods.length; i++) { method = methods[i]; mods = method.getModifiers(); if (!(Modifier.isPublic(mods) && Modifier.isStatic(mods))) { continue; } info = new Object[] { method, null, "ROUTINE" }; if (andAliases) { info[1] = invAliasMap.get(getMethodFQN(method)); } methodList.add(info); } // return the iterator return methodList.iterator(); } /** * Retrieves an <code>Iterator</code> object describing the * fully qualified names of all Java <code>Class</code> objects * that are both trigger body implementations and that are accessible * (whose fire method can potentially be invoked) by actions upon this * object's database by the specified <code>User</code>. <p> * * @param user the <code>User</code> for which to retrieve the * <code>Iterator</code> * @throws HsqlException if a database access error occurs * @return an <code>Iterator</code> object describing the * fully qualified names of all Java <code>Class</code> * objects that are both trigger body implementations * and that are accessible (whose fire method can * potentially be invoked) by actions upon this object's database * by the specified <code>User</code>. */ Iterator iterateAccessibleTriggerClassNames(User user) throws HsqlException { Table table; Class clazz; HashSet classSet; TriggerDef triggerDef; HsqlArrayList[] triggerLists; HsqlArrayList triggerList; HsqlArrayList tableList; int listSize; classSet = new HashSet(); Iterator schemas = database.schemaManager.userSchemaNameIterator(); while (schemas.hasNext()) { String schema = (String) schemas.next(); Iterator tables = database.schemaManager.tablesIterator(schema); while (tables.hasNext()) { table = (Table) tables.next(); if (!user.isAccessible(table.getName())) { continue; } triggerLists = table.triggerLists; if (triggerLists == null) { continue; } for (int j = 0; j < triggerLists.length; j++) { triggerList = triggerLists[j]; if (triggerList == null) { continue; } listSize = triggerList.size(); for (int k = 0; k < listSize; k++) { triggerDef = (TriggerDef) triggerList.get(k); if (triggerDef == null ||!triggerDef.valid || triggerDef.trigger == null ||!user.isAccessible( table, TriggerDef.indexToRight(k))) { continue; } classSet.add(triggerDef.trigger.getClass().getName()); } } } } return classSet.iterator(); } /** * Retrieves a composite <code>Iterator</code> consisting of the elements * from {@link #iterateRoutineMethods} for each Class granted to the * specified session. <p> * * @return a composite <code>Iterator</code> consisting of the elements * from {@link #iterateRoutineMethods} and * {@link #iterateAccessibleTriggerMethods} * @param session The context in which to produce the iterator * @param andAliases true if the alias lists for the "ROUTINE" type method * elements are to be generated. * @throws HsqlException if a database access error occurs */ Iterator iterateAllAccessibleMethods(Session session, boolean andAliases) throws HsqlException { Iterator out; HashSet classNameSet; Iterator classNames; Iterator methods; String className; out = new WrapperIterator(); classNameSet = session.getUser().getGrantedClassNames(true); addBuiltinToSet(classNameSet); classNames = classNameSet.iterator(); while (classNames.hasNext()) { className = (String) classNames.next(); methods = iterateRoutineMethods(className, andAliases); out = new WrapperIterator(out, methods); } return out; } /** * Retrieves the set of distinct, visible sessions connected to this * object's database, as a list. <p> * * @param session The context in which to produce the list * @return the set of distinct, visible sessions connected * to this object's database, as a list. */ Session[] listVisibleSessions(Session session) { return database.sessionManager.getVisibleSessions(session); } /** * Retrieves whether this object is reporting catalog qualifiers. * @return true if this object is reporting catalog qualifiers, else false. */ boolean isReportCatalogs() { return database.getProperties().isPropertyTrue("hsqldb.catalogs"); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -