@Test public void testNewObjectFromJSON() throws Exception { }
public static final PersistentObject newObjectFromJSON (String json) throws InstantiationException { if (! KernelThread.currentKernelThread().isPrivileged()) { throw new SecurityException("new object from JSON - not authorized"); } try { ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readValue(json, JsonNode.class); String className = node.get("resourceClassName").asText(); PersistentObject obj = null; mapper = new ObjectMapper(); obj = (PersistentObject) mapper.readValue(json, Class.forName(className)); return obj; } catch (ClassNotFoundException e) { throw new InstantiationException(e.toString()); } catch (IOException e) { throw new InstantiationException(e.toString()); } }
PersistentObject implements Serializable { public static final PersistentObject newObjectFromJSON (String json) throws InstantiationException { if (! KernelThread.currentKernelThread().isPrivileged()) { throw new SecurityException("new object from JSON - not authorized"); } try { ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readValue(json, JsonNode.class); String className = node.get("resourceClassName").asText(); PersistentObject obj = null; mapper = new ObjectMapper(); obj = (PersistentObject) mapper.readValue(json, Class.forName(className)); return obj; } catch (ClassNotFoundException e) { throw new InstantiationException(e.toString()); } catch (IOException e) { throw new InstantiationException(e.toString()); } } }
PersistentObject implements Serializable { public static final PersistentObject newObjectFromJSON (String json) throws InstantiationException { if (! KernelThread.currentKernelThread().isPrivileged()) { throw new SecurityException("new object from JSON - not authorized"); } try { ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readValue(json, JsonNode.class); String className = node.get("resourceClassName").asText(); PersistentObject obj = null; mapper = new ObjectMapper(); obj = (PersistentObject) mapper.readValue(json, Class.forName(className)); return obj; } catch (ClassNotFoundException e) { throw new InstantiationException(e.toString()); } catch (IOException e) { throw new InstantiationException(e.toString()); } } PersistentObject();  PersistentObject(String name); }
PersistentObject implements Serializable { public static final PersistentObject newObjectFromJSON (String json) throws InstantiationException { if (! KernelThread.currentKernelThread().isPrivileged()) { throw new SecurityException("new object from JSON - not authorized"); } try { ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readValue(json, JsonNode.class); String className = node.get("resourceClassName").asText(); PersistentObject obj = null; mapper = new ObjectMapper(); obj = (PersistentObject) mapper.readValue(json, Class.forName(className)); return obj; } catch (ClassNotFoundException e) { throw new InstantiationException(e.toString()); } catch (IOException e) { throw new InstantiationException(e.toString()); } } PersistentObject();  PersistentObject(String name); final String getResourceClassName(); final void setResourceClassName(String resourceClassName); String getResourceName(); @Override String toString(); final synchronized void setResourceName(String resourceName); final Map<String, Object> getProperties(); final void setProperties(Map<String, Object> properties); @Override int hashCode(); @Override boolean equals(Object o); static File buildFile(String filename); String toJSON(OutputStream output); void saveToFile(String filename); void save(String user,String collection); static void save(List<ResourceAnchor> resourceAnchors); String saveToJSON(); static void delete(List<ResourceAnchor> resourceAnchors); void delete(String user,String collection); static void delete(String owner, String containerName, String resourceName); static final PersistentObject newObjectFromJSON(String json); static final List<PersistentObject> find(String user,
                                                     String name,
                                                     Map<String,Object> query); static final List<PersistentObject> find(String user,
                                                     String name,
                                                     Map<String,Object> query,
                                                     Class objectClass); static final PersistentObject newObjectFromFile(String fileName); static final PersistentObject newObjectFromFile(String fileName, Class c); }
PersistentObject implements Serializable { public static final PersistentObject newObjectFromJSON (String json) throws InstantiationException { if (! KernelThread.currentKernelThread().isPrivileged()) { throw new SecurityException("new object from JSON - not authorized"); } try { ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readValue(json, JsonNode.class); String className = node.get("resourceClassName").asText(); PersistentObject obj = null; mapper = new ObjectMapper(); obj = (PersistentObject) mapper.readValue(json, Class.forName(className)); return obj; } catch (ClassNotFoundException e) { throw new InstantiationException(e.toString()); } catch (IOException e) { throw new InstantiationException(e.toString()); } } PersistentObject();  PersistentObject(String name); final String getResourceClassName(); final void setResourceClassName(String resourceClassName); String getResourceName(); @Override String toString(); final synchronized void setResourceName(String resourceName); final Map<String, Object> getProperties(); final void setProperties(Map<String, Object> properties); @Override int hashCode(); @Override boolean equals(Object o); static File buildFile(String filename); String toJSON(OutputStream output); void saveToFile(String filename); void save(String user,String collection); static void save(List<ResourceAnchor> resourceAnchors); String saveToJSON(); static void delete(List<ResourceAnchor> resourceAnchors); void delete(String user,String collection); static void delete(String owner, String containerName, String resourceName); static final PersistentObject newObjectFromJSON(String json); static final List<PersistentObject> find(String user,
                                                     String name,
                                                     Map<String,Object> query); static final List<PersistentObject> find(String user,
                                                     String name,
                                                     Map<String,Object> query,
                                                     Class objectClass); static final PersistentObject newObjectFromFile(String fileName); static final PersistentObject newObjectFromFile(String fileName, Class c);  }