Examples of SQLJInstanceException


Examples of com.foundationdb.server.error.SQLJInstanceException

        AkibanInformationSchema ais = ais(session);
        Routine routine = ais.getRoutine(routineName);
        if (routine == null)
            throw new NoSuchRoutineException(routineName);
        if (routine.getCallingConvention() != Routine.CallingConvention.LOADABLE_PLAN)
            throw new SQLJInstanceException(routineName, "Routine was not loadable plan");
        long currentVersion = routine.getVersion();
        LoadablePlan<?> loadablePlan;
        synchronized (loadablePlans) {
            VersionedItem<LoadablePlan<?>> entry = loadablePlans.get(routineName);
            if ((entry != null) && (entry.version == currentVersion)) {
                loadablePlan = entry.item;
            }
            else {
                TableName jarName = null;
                if (routine.getSQLJJar() != null)
                    jarName = routine.getSQLJJar().getName();
                ClassLoader classLoader = loadSQLJJar(session, jarName);
                try {
                    loadablePlan = (LoadablePlan<?>)
                        Class.forName(routine.getClassName(), true, classLoader).newInstance();
                }
                catch (Exception ex) {
                    throw new SQLJInstanceException(routineName, ex);
                }
                if (entry != null) {
                    entry.item = loadablePlan;
                }
                else {
View Full Code Here

Examples of com.foundationdb.server.error.SQLJInstanceException

    public Method loadJavaMethod(Session session, TableName routineName) {
        Routine routine = ais(session).getRoutine(routineName);
        if (routine == null)
            throw new NoSuchRoutineException(routineName);
        if (routine.getCallingConvention() != Routine.CallingConvention.JAVA)
            throw new SQLJInstanceException(routineName, "Routine was not SQL/J");
        long currentVersion = routine.getVersion();
        synchronized (javaMethods) {
            VersionedItem<Method> entry = javaMethods.get(routineName);
            if ((entry != null) && (entry.version == currentVersion))
                return entry.item;
            TableName jarName = null;
            if (routine.getSQLJJar() != null)
                jarName = routine.getSQLJJar().getName();
            ClassLoader classLoader = loadSQLJJar(session, jarName);
            Class<?> clazz;
            try {
                clazz = Class.forName(routine.getClassName(), true, classLoader);
            }
            catch (Exception ex) {
                throw new SQLJInstanceException(routineName, ex);
            }
            String methodName = routine.getMethodName();
            String methodArgs = null;
            int idx = methodName.indexOf('(');
            if (idx >= 0) {
                methodArgs = methodName.substring(idx+1);
                methodName = methodName.substring(0, idx);
            }
            Method javaMethod = null;
            for (Method method : clazz.getMethods()) {
                if (((method.getModifiers() & (Modifier.PUBLIC | Modifier.STATIC)) ==
                                              (Modifier.PUBLIC | Modifier.STATIC)) &&
                    method.getName().equals(methodName) &&
                    ((methodArgs == null) ||
                     (method.toString().indexOf(methodArgs) > 0))) {
                    javaMethod = method;
                    break;
                }
            }
            if (javaMethod == null)
                throw new SQLJInstanceException(routineName, "Method not found");
            if (entry != null) {
                entry.item = javaMethod;
            }
            else {
                entry = new VersionedItem<>(currentVersion, javaMethod);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.