| Chunk |
|---|
| Conflicting content |
|---|
* @author John Jenkins
*/
public class Observer {
<<<<<<< HEAD
/**
* This is the contents of the JavaSciprt file that evaluates schemas and
* data against those schemas. This should be used in conjunction with
* something like Rhino, in order to create a JavaScript interpreter to
* evaluate the JavaScript.
*/
private static final String JSON_SCHEMA_JS;
static {
FileReader reader;
try {
reader =
new FileReader(
System.getProperty("webapp.root") + "JsonSchema.js");
}
catch(FileNotFoundException e) {
throw new IllegalStateException(
"The JSON Schema could not be found.",
e);
}
try {
int amountRead;
char[] buffer = new char[4096];
StringBuilder builder = new StringBuilder();
while((amountRead = reader.read(buffer)) != -1) {
builder.append(buffer, 0, amountRead);
}
JSON_SCHEMA_JS = builder.toString();
}
catch(IOException e) {
throw new IllegalStateException(
"There was a problem reading the JSON Schema's JavaScript file.",
e);
}
finally {
try {
reader.close();
}
catch(IOException e) {
throw new IllegalStateException(
public static final String ID_PATTERN =
"Could not close the file reader.",
e);
}
}
}
/**
* The pattern for allowed observer IDs.
*/
"([a-zA-Z0-9]+(\\.[a-zA-Z0-9]+)+){3,255}";
/**
* The compiled pattern for allowed observer IDs.
*/
private static final Pattern PATTERN_OBSERVER_ID =
Pattern.compile(ID_PATTERN);
/**
* The JSON factory for creating parsers and generators.
*/
private static final JsonFactory JSON_FACTORY = new MappingJsonFactory();
private static final String KEY_JSON_ID = "id";
private static final String KEY_JSON_VERSION = "version";
private static final String KEY_JSON_NAME = "name";
private static final String KEY_JSON_DESCRIPTION = "description";
private static final String KEY_JSON_VERSION_STRING = "versionString";
private static final String KEY_JSON_STREAMS = "streams";
=======
private static final Pattern PATTERN_ID_VALIDATOR =
Pattern.compile("([a-zA-Z]{1}[\\w]*(\\.[a-zA-Z]{1}[\\w]*)+)?");
private static final long MAX_OBSERVER_ID_LENGTH = 255;
>>>>>>> 5deda018dcaf5c03374c566f3550ba5f49eeb9a7
private final String id;
private final long version; |
| Solution content |
|---|
* @author John Jenkins
*/
public class Observer {
/**
* This is the contents of the JavaSciprt file that evaluates schemas and
* data against those schemas. This should be used in conjunction with
* something like Rhino, in order to create a JavaScript interpreter to
* evaluate the JavaScript.
*/
private static final String JSON_SCHEMA_JS;
static {
FileReader reader;
try {
reader =
new FileReader(
System.getProperty("webapp.root") + "JsonSchema.js");
}
catch(FileNotFoundException e) {
throw new IllegalStateException(
"The JSON Schema could not be found.",
e);
}
try {
int amountRead;
char[] buffer = new char[4096];
StringBuilder builder = new StringBuilder();
while((amountRead = reader.read(buffer)) != -1) {
builder.append(buffer, 0, amountRead);
}
JSON_SCHEMA_JS = builder.toString();
}
catch(IOException e) {
throw new IllegalStateException(
"There was a problem reading the JSON Schema's JavaScript file.",
e);
}
finally {
try {
reader.close();
}
catch(IOException e) {
throw new IllegalStateException(
"Could not close the file reader.",
e);
}
}
}
/**
* The JSON factory for creating parsers and generators.
*/
private static final JsonFactory JSON_FACTORY = new MappingJsonFactory();
private static final String KEY_JSON_ID = "id";
private static final String KEY_JSON_VERSION = "version";
private static final String KEY_JSON_NAME = "name";
private static final String KEY_JSON_DESCRIPTION = "description";
private static final String KEY_JSON_VERSION_STRING = "versionString";
private static final String KEY_JSON_STREAMS = "streams";
private static final Pattern PATTERN_ID_VALIDATOR =
Pattern.compile("([a-zA-Z]{1}[\\w]*(\\.[a-zA-Z]{1}[\\w]*)+)?");
private static final long MAX_OBSERVER_ID_LENGTH = 255;
private final String id;
private final long version; |
| File |
|---|
| Observer.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| Method invocation |
| Static initializer |
| Chunk |
|---|
| Conflicting content |
|---|
* @author John Jenkins
*/
public static class Stream {
<<<<<<< HEAD
/**
* The pattern for allowed stream IDs.
*/
public static final String ID_PATTERN =
"([a-zA-Z0-9]+[a-zA-Z0-9_]+){1,255}";
/**
* The compiled pattern for allowed stream IDs.
*/
private static final Pattern PATTERN_STREAM_ID =
Pattern.compile(ID_PATTERN);
private static final String KEY_JSON_ID = "id";
private static final String KEY_JSON_VERSION = "version";
private static final String KEY_JSON_NAME = "name";
private static final String KEY_JSON_DESCRIPTION = "description";
private static final String KEY_JSON_WITH_ID = "with_id";
private static final String KEY_JSON_WITH_TIMESTAMP = "with_timestamp";
private static final String KEY_JSON_WITH_LOCATION = "with_location";
private static final String KEY_JSON_SCHEMA = "schema";
=======
private static final Pattern PATTERN_ID_VALIDATOR =
Pattern.compile("[a-zA-Z]{1}[\\w_]{0,254}");
>>>>>>> 5deda018dcaf5c03374c566f3550ba5f49eeb9a7
private final String id;
private final long version; |
| Solution content |
|---|
* @author John Jenkins
*/
public static class Stream {
private static final String KEY_JSON_ID = "id";
private static final String KEY_JSON_VERSION = "version";
private static final String KEY_JSON_NAME = "name";
private static final String KEY_JSON_DESCRIPTION = "description";
private static final String KEY_JSON_WITH_ID = "with_id";
private static final String KEY_JSON_WITH_TIMESTAMP = "with_timestamp";
private static final String KEY_JSON_WITH_LOCATION = "with_location";
private static final String KEY_JSON_SCHEMA = "schema";
private static final Pattern PATTERN_ID_VALIDATOR =
Pattern.compile("[a-zA-Z]{1}[\\w_]{0,254}");
private final String id;
private final long version; |
| File |
|---|
| Observer.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Attribute |
| Comment |
| Method invocation |