Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize how serializers are stored, since they are accumulating.
Add the ability to grab full source of any script. Fleshen out `scripts` command a tad.
- Loading branch information
1 parent
08bafef
commit 7cbeca5
Showing
21 changed files
with
196 additions
and
70 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
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
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
37 changes: 37 additions & 0 deletions
37
src/main/java/org/dynjs/debugger/agent/serializers/ScriptsResponseSerializer.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,37 @@ | ||
package org.dynjs.debugger.agent.serializers; | ||
|
||
import com.fasterxml.jackson.core.JsonGenerator; | ||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.SerializerProvider; | ||
import com.fasterxml.jackson.databind.ser.std.StdSerializer; | ||
import org.dynjs.debugger.requests.ScriptsResponse; | ||
import org.dynjs.runtime.SourceProvider; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* @author Bob McWhirter | ||
*/ | ||
public class ScriptsResponseSerializer extends StdSerializer<ScriptsResponse> { | ||
|
||
private final HandleSerializer handleSerializer; | ||
|
||
public ScriptsResponseSerializer(HandleSerializer handleSerializer) { | ||
super(ScriptsResponse.class); | ||
this.handleSerializer = handleSerializer; | ||
} | ||
|
||
@Override | ||
public void serialize(ScriptsResponse value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { | ||
|
||
jgen.writeStartArray(); | ||
|
||
for ( SourceProvider each : value.getScripts() ) { | ||
this.handleSerializer.serializeScript( each, value.isIncludeSource(), jgen, provider ); | ||
} | ||
|
||
jgen.writeEndArray(); | ||
} | ||
|
||
|
||
} |
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
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
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
26 changes: 25 additions & 1 deletion
26
src/main/java/org/dynjs/debugger/requests/ScriptsResponse.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 |
---|---|---|
@@ -1,11 +1,35 @@ | ||
package org.dynjs.debugger.requests; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import org.dynjs.runtime.SourceProvider; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
/** | ||
* @author Bob McWhirter | ||
*/ | ||
public class ScriptsResponse extends AbstractResponse<ScriptsRequest> { | ||
|
||
public ScriptsResponse(ScriptsRequest request, boolean success, boolean running) { | ||
private final Set<SourceProvider> scripts; | ||
private final boolean includeSource; | ||
|
||
public ScriptsResponse(ScriptsRequest request, Set<SourceProvider> scripts, boolean includeSource, boolean success, boolean running) { | ||
super(request, success, running); | ||
this.scripts = scripts; | ||
this.includeSource = includeSource; | ||
} | ||
|
||
@JsonIgnore | ||
public Collection<SourceProvider> getScripts() { | ||
return this.scripts; | ||
} | ||
|
||
@JsonIgnore | ||
public boolean isIncludeSource() { | ||
return this.includeSource; | ||
} | ||
|
||
|
||
} |
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
Oops, something went wrong.