public IQueryResult query(Query in, UserInformation user) throws MorseException { switch (in.getCode().getInteger(0)) { case CMql.SELECT: case CMql.INSERT: case CMql.UPDATE: case CMql.DELETE: case CMql.RENDITION: return ((IChannelServer) in.getConnection().getChannel("db")).query(in, user); case CMql.FETCH: return ((IChannelServer) in.getConnection() .getChannel(objectManager.findObject(in.getCode().getString(1)))) .query(in, user); case CMql.LOAD: return ((IChannelServer) in.getConnection() .getChannel(objectManager.findObject(in.getCode().getString(1)))) .query(in, user); case CMql.SAVE: return ((IChannelServer) in.getConnection().getChannel("fs")).query(in, user); case CMql.EXEC: return ((IChannelServer) in.getConnection().getChannel("exec")).query(in, user); case CMql.INDEX: return ((IChannelServer) in.getConnection().getChannel("idx")).query(in, user); default: throw new MorseException(MorseException.QUERY_UNSUPPORTED); } }
public IQueryResult query(Query in, UserInformation user) throws MorseException { if (!aclManager.hasRead(user, driver.getAccessAcl())) throw new MorseException( MorseException.ACCESS_DENIED_READ, new String[] {"channel", getName(), driver.getAccessAcl()}); ICompiledQuery code = in.getCode(); if (code.size() == 0) throw new MorseException(MorseException.QUERY_EMPTY); switch (code.getInteger(0)) { case CMql.SELECT: return querySelect(code, user); case CMql.SAVE: return querySave(code, user); case CMql.LOAD: return queryLoad(code, user); case CMql.FETCH: return queryFetch(code, user); default: throw new MorseException(MorseException.QUERY_UNSUPPORTED); } }