1 5 6 package org.joseki.server.processors; 7 8 import org.apache.commons.logging.* ; 9 import org.joseki.server.*; 10 import com.hp.hpl.jena.rdf.model.*; 11 12 18 public abstract class ZeroArgProcessor extends ProcessorCom 19 { 20 static final Log logger = LogFactory.getLog(ZeroArgProcessor.class.getName()) ; 21 22 public ZeroArgProcessor(String n, int lockNeeded, int mutating) 23 { 24 super(n, lockNeeded, mutating) ; 25 } 26 27 public int argsNeeded() { return Processor.ARGS_ZERO ; } 28 29 32 public Model exec(Request request) throws ExecutionException 33 { 34 ModelSource src = request.getModelSource() ; 35 if ( super.mutatingOp && src.isImmutable() ) 36 throw new ExecutionException(ExecutionError.rcImmutableModel, "Immutable Model") ; 37 38 try { 39 src.startOperation(readOnlyLock) ; 40 try { 41 Model resultModel = execZeroArg(src, request) ; 42 return resultModel ; 43 } catch (RDFException ex) 44 { 45 src.abortOperation() ; 46 logger.trace("RDFException: "+ex.getMessage() ) ; 47 throw new ExecutionException(ExecutionError.rcInternalError, null) ; 48 } 49 catch (Exception ex) 50 { 51 src.abortOperation() ; 52 logger.trace("Exception: "+ex.getMessage() ) ; 53 throw new ExecutionException(ExecutionError.rcInternalError, null) ; 54 } 55 } finally {src.endOperation(); } 56 } 58 59 public abstract Model execZeroArg(ModelSource target, Request request) 60 throws RDFException, ExecutionException ; 61 } 62 63 64 90 | Popular Tags |