forked from finos/legend-pure
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pure IDE Light: Add support for Pure runtime options
- Loading branch information
1 parent
07c0a0a
commit 95d7ba3
Showing
4 changed files
with
96 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...-pure-ide-light/src/main/java/org/finos/legend/pure/ide/light/api/PureRuntimeOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.finos.legend.pure.ide.light.api; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.swagger.annotations.Api; | ||
import org.finos.legend.pure.ide.light.session.PureSession; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
import javax.ws.rs.core.Context; | ||
import javax.ws.rs.core.Response; | ||
import javax.ws.rs.core.StreamingOutput; | ||
|
||
@Api(tags = "Pure Runtime Options") | ||
@Path("/pureRuntimeOptions") | ||
public class PureRuntimeOptions | ||
{ | ||
private final PureSession pureSession; | ||
|
||
public PureRuntimeOptions(PureSession session) | ||
{ | ||
this.pureSession = session; | ||
} | ||
|
||
@GET | ||
public void setPureRuntimeOption(@PathParam("name") String optionName, @PathParam("value") Boolean value) | ||
{ | ||
this.pureSession.setPureRuntimeOption(optionName, value); | ||
} | ||
|
||
@GET | ||
public Boolean getPureRuntimeOption(@PathParam("optionName") String optionName) | ||
{ | ||
return this.pureSession.getPureRuntimeOption(optionName); | ||
} | ||
|
||
@GET | ||
public Response getAllPureRuntimeOptions(@Context HttpServletRequest request, @Context HttpServletResponse response) | ||
{ | ||
return Response.ok((StreamingOutput) outputStream -> | ||
{ | ||
ObjectMapper om = new ObjectMapper(); | ||
outputStream.write(om.writeValueAsBytes(this.pureSession.getAllPureRuntimeOptions())); | ||
outputStream.close(); | ||
}).build(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters