Search in sources :

Example 1 with FailedLoadProcedure

use of org.neo4j.kernel.api.procedure.FailedLoadProcedure in project neo4j by neo4j.

the class ProcedureCompiler method compileProcedure.

private CallableProcedure compileProcedure(Class<?> procDefinition, Method method, String warning, boolean fullAccess, QualifiedName procName) throws ProcedureException {
    List<FieldSignature> inputSignature = inputSignatureDeterminer.signatureFor(method);
    List<FieldSignature> outputSignature = outputSignatureCompiler.fieldSignatures(method);
    String description = description(method);
    Procedure procedure = method.getAnnotation(Procedure.class);
    Mode mode = procedure.mode();
    boolean admin = method.isAnnotationPresent(Admin.class);
    boolean systemProcedure = method.isAnnotationPresent(SystemProcedure.class);
    boolean allowExpiredCredentials = systemProcedure ? method.getAnnotation(SystemProcedure.class).allowExpiredCredentials() : false;
    boolean internal = method.isAnnotationPresent(Internal.class);
    String deprecated = deprecated(method, procedure::deprecatedBy, "Use of @Procedure(deprecatedBy) without @Deprecated in " + procName);
    List<FieldSetter> setters = allFieldInjections.setters(procDefinition);
    if (!fullAccess && !config.fullAccessFor(procName.toString())) {
        try {
            setters = safeFieldInjections.setters(procDefinition);
        } catch (ComponentInjectionException e) {
            description = describeAndLogLoadFailure(procName);
            ProcedureSignature signature = new ProcedureSignature(procName, inputSignature, outputSignature, Mode.DEFAULT, admin, null, new String[0], description, warning, procedure.eager(), false, systemProcedure, internal, allowExpiredCredentials);
            return new FailedLoadProcedure(signature);
        }
    }
    ProcedureSignature signature = new ProcedureSignature(procName, inputSignature, outputSignature, mode, admin, deprecated, config.rolesFor(procName.toString()), description, warning, procedure.eager(), false, systemProcedure, internal, allowExpiredCredentials);
    return ProcedureCompilation.compileProcedure(signature, setters, method);
}
Also used : ProcedureSignature(org.neo4j.internal.kernel.api.procs.ProcedureSignature) FailedLoadProcedure(org.neo4j.kernel.api.procedure.FailedLoadProcedure) Mode(org.neo4j.procedure.Mode) SystemProcedure(org.neo4j.kernel.api.procedure.SystemProcedure) Procedure(org.neo4j.procedure.Procedure) FailedLoadProcedure(org.neo4j.kernel.api.procedure.FailedLoadProcedure) CallableProcedure(org.neo4j.kernel.api.procedure.CallableProcedure) FieldSignature(org.neo4j.internal.kernel.api.procs.FieldSignature) ComponentInjectionException(org.neo4j.kernel.api.exceptions.ComponentInjectionException)

Aggregations

FieldSignature (org.neo4j.internal.kernel.api.procs.FieldSignature)1 ProcedureSignature (org.neo4j.internal.kernel.api.procs.ProcedureSignature)1 ComponentInjectionException (org.neo4j.kernel.api.exceptions.ComponentInjectionException)1 CallableProcedure (org.neo4j.kernel.api.procedure.CallableProcedure)1 FailedLoadProcedure (org.neo4j.kernel.api.procedure.FailedLoadProcedure)1 SystemProcedure (org.neo4j.kernel.api.procedure.SystemProcedure)1 Mode (org.neo4j.procedure.Mode)1 Procedure (org.neo4j.procedure.Procedure)1