Cause
This error is raised by the
Action
Change your method code to remove the invalid access. For example, the following methods check that input method source code does not reference the:
Employee class
deposit method of the Account class
First, create a subclass of the JadeMetadataAnalyzer class (called MyAnalyzer) and reimplement the
canAccessStatement(statement: String; err: String output): Boolean; begin if statement = Statement_BeginTransaction then err := 'transactions are not allowed'; return false; endif; return true; end; canAccessSchemaEntity(se: SchemaEntity; err: String output): Boolean; begin if se.isKindOf(Class) then if se.name = 'Employee' then err := 'access to class is not allowed'; return false; endif; elseif se.isKindOf(Method) then if se.Method.schemaType.name = 'Account' and se.name = 'deposit' then err := 'access to method is not allowed'; return false; endif; endif; return true; end;
The method in the following example then validates the method source.
checkMethod(source: String; schemaType: Type); vars analyzer : MyAnalyzer; err, pos, len : Integer; msg : String; begin create analyzer; analyzer.validateMethod(source, schemaType, currentSchema, err, pos, len, msg); if err = 0 then write 'method validated successfully'; else write 'method validation failed - ' & process.getErrorText(err); if err = JadeMetadataAnalyzer.AccessCheckFailed then write msg; endif; endif; epilog delete analyzer; end;