- Timestamp:
- 07/08/13 23:04:56 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/hosting/ClientAtServer.java
r97 r98 9 9 import com.framsticks.communication.queries.InfoRequest; 10 10 import com.framsticks.communication.queries.SetRequest; 11 import com.framsticks.core.Mode;12 11 import com.framsticks.core.Tree; 13 12 import com.framsticks.core.Path; … … 18 17 import com.framsticks.util.dispatching.AbstractJoinable; 19 18 import com.framsticks.util.dispatching.Dispatching; 19 import com.framsticks.util.dispatching.ExceptionResultHandler; 20 20 import com.framsticks.util.dispatching.FutureHandler; 21 21 import com.framsticks.util.dispatching.Joinable; … … 31 31 * @author Piotr Sniegowski 32 32 */ 33 public class ClientAtServer extends AbstractJoinable implements RequestHandler, JoinableParent {33 public class ClientAtServer extends AbstractJoinable implements RequestHandler, JoinableParent, ExceptionResultHandler { 34 34 35 35 protected final Server server; … … 52 52 assureNotEmpty(request.getPath()); 53 53 54 resolve(tree, request.getPath(), new FutureHandler<Path>(responseCallback) {54 tryGet(tree, request.getPath(), new FutureHandler<Path>(responseCallback) { 55 55 @Override 56 56 protected void result(final Path path) { 57 58 if (!path.getTextual().equals(request.getPath())) { 59 throw new FramsticksException().msg("invalid path").arg("path", request.getPath()); 60 } 57 61 58 62 // final AccessInterface access = tree.prepareAccess(path); … … 73 77 74 78 if (request instanceof GetRequest) { 75 tree.get(path, Mode.FETCH, new FutureHandler<Object>(responseCallback) { 76 77 @Override 78 protected void result(Object result) { 79 if (result != access.getSelected()) { 80 throw new FramsticksException().msg("mismatch objects during fetch").arg("path", path); 81 } 82 // TODO Auto-generated method stub 83 List<File> files = new LinkedList<File>(); 84 ListSink sink = new ListSink(); 85 access.save(sink); 86 files.add(new File(path.getTextual(), new ListSource(sink.getOut()))); 87 responseCallback.pass(new Response(true, "", files)); 88 } 89 }); 79 Object result = path.getTopObject(); 80 if (result != access.getSelected()) { 81 throw new FramsticksException().msg("mismatch objects during fetch").arg("path", path); 82 } 83 List<File> files = new LinkedList<File>(); 84 ListSink sink = new ListSink(); 85 access.save(sink); 86 files.add(new File(path.getTextual(), new ListSource(sink.getOut()))); 87 responseCallback.pass(new Response(true, "", files)); 90 88 91 89 return; … … 148 146 } 149 147 148 @Override 149 public void handle(FramsticksException exception) { 150 tree.handle(exception); 151 } 150 152 151 153 }
Note: See TracChangeset
for help on using the changeset viewer.