Skip to content

Commit

Permalink
start of development of a rest api
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Nov 1, 2012
1 parent 78f2b8e commit f42a0e1
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
Expand Up @@ -19,6 +19,7 @@
import org.jumpmind.symmetric.web.rest.model.Identity;
import org.jumpmind.symmetric.web.rest.model.NodeStatus;
import org.jumpmind.symmetric.web.rest.model.RestError;
import org.jumpmind.symmetric.web.rest.model.SyncTriggersActionResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
Expand Down Expand Up @@ -80,7 +81,7 @@ public final void loadProfile(@RequestParam("engine") String engineName,
@RequestParam MultipartFile file) {
System.out.println("File '" + file.getOriginalFilename() + "' uploaded successfully");
}

@RequestMapping(value = "/actions/{action}", method = RequestMethod.GET)
@ResponseBody
public final ActionResponse action(
Expand All @@ -93,12 +94,16 @@ public final ActionResponse action(
ITriggerRouterService triggerRouterService = engine.getTriggerRouterService();
StringBuilder buffer = new StringBuilder();
triggerRouterService.syncTriggers(buffer, force);
ActionResponse response = new ActionResponse();
SyncTriggersActionResponse response = new SyncTriggersActionResponse();
response.setSuccess(true);
response.setMessage(buffer.toString());
return response;
} else if (actionName.equals("reinitialize")) {


} else if (actionName.equals("start")) {

} else if (actionName.equals("stop")) {

}
}
throw new NotFoundException();
Expand All @@ -117,7 +122,6 @@ public final void dropTrigger(@RequestParam("engine") String engineName,
@PathVariable("table") String tableName) {
// TODO: Implementation
}


/**
* Drops all SymmetricDS triggers for the specified engine on the node.
Expand Down
Expand Up @@ -2,7 +2,7 @@

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
@XmlRootElement(name="actionresponse")
public class ActionResponse {

protected boolean success;
Expand Down
@@ -0,0 +1,30 @@
package org.jumpmind.symmetric.web.rest.model;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name="actionresponse")
public class SyncTriggersActionResponse extends ActionResponse {

List<String> createdTrigger = new ArrayList<String>();

public SyncTriggersActionResponse() {
createdTrigger.add("SYM_ON_I_TEST_THIS_OUT");
createdTrigger.add("SYM_ON_U_TEST_THIS_OUT");
createdTrigger.add("SYM_ON_D_TEST_THIS_OUT");
}

public String[] getCreatedTrigger() {
return createdTrigger.toArray(new String[createdTrigger.size()]);
}

public void setCreatedTrigger(String[] createdTriggers) {
this.createdTrigger = new ArrayList<String>();
for (String string : createdTriggers) {
this.createdTrigger.add(string);
}
}

}

0 comments on commit f42a0e1

Please sign in to comment.