public T get() { if (object == null && json == null) { return null; } if (object == null) { object = (T) JsonUtils.from(Yawp.yawp(), json, type); } return object; }
@Override public void destroy() { super.destroy(); Yawp.destroyFeatures(); }
private static void init() { if (yawp.get() != null) { return; } if (features == null) { safeLoadFeaturesFromConfig(); } yawp.set(Repository.r().setFeatures(features)); }
private Set<Class<?>> scanEndpointClazzes() { WebConfiguration webConfiguration = new WebConfiguration(getWebConfigFile()); if (webConfiguration.getPackagePrefix() != null) { Yawp.init(webConfiguration.getPackagePrefix()); } return yawp.getFeatures().getEndpointClazzes(); }
/** * @deprecated in 2.0, yawp will be configured only by yawp.yml */ @Deprecated private void initYawp(String packagePrefix) { if (packagePrefix == null) { return; } Yawp.init(packagePrefix); }
public static void init(String packagePrefix) { if (yawp.get() != null) { return; } if (features == null) { safeLoadFeatures(packagePrefix); } yawp.set(Repository.r().setFeatures(features)); }
@Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (!enableFixtures()) { response(resp, new ExceptionResponse(403)); return; } Yawp.yawp.namespace(req.getHeader("namespace")); super.service(req, resp); }
public HttpResponse execute(RequestContext ctx) { try { Cache.clearAll(); Repository r = getRepository(ctx); EndpointRouter router = EndpointRouter.parse(r, ctx); if (!router.isValid()) { throw new HttpException(400, "Invalid route. Please check uri, json format, object ids and parent structure, etc."); } return router.executeRestAction(enableShields); } finally { Yawp.dispose(); } }
public IdRef<?> getSinkId() { if (sinkId == null) { sinkId = IdRef.parse(yawp(), sinkUri); } return sinkId; }
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { String uri = (String) in.readObject(); IdRef<T> idRef = (IdRef<T>) parse(yawp(), uri); this.r = idRef.r; this.clazz = idRef.clazz; this.model = idRef.model; this.id = idRef.id; this.name = idRef.name; this.parentId = idRef.parentId; }
private void init(Class<? extends Pipe> pipeClazz, String cursor) { this.r = yawp(); this.pipeClazz = pipeClazz; this.sourceClazz = ReflectionUtils.getFeatureEndpointClazz(pipeClazz); this.cursor = cursor; }
private List<T> readObjects(ObjectInputStream in) throws IOException, ClassNotFoundException { List<String> jsonList = (List<String>) in.readObject(); List<T> objects = new ArrayList<>(); for (String json : jsonList) { objects.add((T) JsonUtils.from(Yawp.yawp(), json, clazz)); } return objects; }
private void init(Class<? extends Pipe> pipeClazz, String sourceUri) { this.r = yawp(); this.pipeClazz = pipeClazz; this.sourceId = IdRef.parse(r, sourceUri); }