/** * Create a Child Path * * @param path child path name * @return child path */ public PathImpl createChildPath(String path) { PathImpl child = new PathImpl(concatPath(this.path, path)); child.parent = this; children.put(child.path, child); return child; }
/** * Register a Web Script Package * * @param script WebScript */ private Path registerPackage(WebScript script) { Description desc = script.getDescription(); PathImpl path = packageByPath.get("/"); String[] parts = desc.getScriptPath().split("/"); for (String part : parts) { PathImpl subpath = packageByPath.get(PathImpl.concatPath(path.getPath(), part)); if (subpath == null) { subpath = path.createChildPath(part); packageByPath.put(subpath.getPath(), subpath); } path = subpath; } path.addScript(script); return path; }
PathImpl filteredPath = filteredParent == null ? new PathImpl(path.getPath()) : filteredParent.createChildPath(path.getName()); filteredPath.addScript(script);
failedWebScriptsByPath.clear(); packageByPath.clear(); packageByPath.put("/", new PathImpl("/")); uriByPath.clear(); uriByPath.put("/", new PathImpl("/")); familyByPath.clear(); familyByPath.put("/", new PathImpl("/")); lifecycleByPath.clear(); lifecycleByPath.put("/", new PathImpl("/")); failedPackageDescriptionsByPath.clear(); failedSchemaDescriptionsByPath.clear();
if (statusTemplate == null) Path path = this.container.getRegistry().getPackage(PathImpl.concatPath("/", getDescription().getScriptPath())); statusTemplate = getPackageStatusTemplate(path, statusCode, format); if (statusTemplate == null)
failedWebScriptsByPath.clear(); packageByPath.clear(); packageByPath.put("/", new PathImpl("/")); uriByPath.clear(); uriByPath.put("/", new PathImpl("/")); familyByPath.clear(); familyByPath.put("/", new PathImpl("/")); lifecycleByPath.clear(); lifecycleByPath.put("/", new PathImpl("/")); failedPackageDescriptionsByPath.clear(); failedSchemaDescriptionsByPath.clear();
if (statusTemplate == null) Path path = this.container.getRegistry().getPackage(PathImpl.concatPath("/", getDescription().getScriptPath())); statusTemplate = getPackageStatusTemplate(path, statusCode, format); if (statusTemplate == null)
/** * Register a Web Script Package * * @param script WebScript */ private Path registerPackage(WebScript script) { Description desc = script.getDescription(); PathImpl path = packageByPath.get("/"); String[] parts = desc.getScriptPath().split("/"); for (String part : parts) { PathImpl subpath = packageByPath.get(PathImpl.concatPath(path.getPath(), part)); if (subpath == null) { subpath = path.createChildPath(part); packageByPath.put(subpath.getPath(), subpath); } path = subpath; } path.addScript(script); return path; }
/** * Create a Child Path * * @param path child path name * @return child path */ public PathImpl createChildPath(String path) { PathImpl child = new PathImpl(concatPath(this.path, path)); child.parent = this; children.put(child.path, child); return child; }
failedWebScriptsByPath.clear(); packageByPath.clear(); packageByPath.put("/", new PathImpl("/")); uriByPath.clear(); uriByPath.put("/", new PathImpl("/")); familyByPath.clear(); familyByPath.put("/", new PathImpl("/")); lifecycleByPath.clear(); lifecycleByPath.put("/", new PathImpl("/")); failedPackageDescriptionsByPath.clear(); failedSchemaDescriptionsByPath.clear();
if (statusTemplate == null) Path path = this.container.getRegistry().getPackage(PathImpl.concatPath("/", getDescription().getScriptPath())); statusTemplate = getPackageStatusTemplate(path, statusCode, format); if (statusTemplate == null)
/** * Register a Web Script Package * * @param script */ private Path registerPackage(WebScript script) { Description desc = script.getDescription(); PathImpl path = packageByPath.get("/"); String[] parts = desc.getScriptPath().split("/"); for (String part : parts) { PathImpl subpath = packageByPath.get(PathImpl.concatPath(path.getPath(), part)); if (subpath == null) { subpath = path.createChildPath(part); packageByPath.put(subpath.getPath(), subpath); } path = subpath; } path.addScript(script); return path; }
/** * Create a Child Path * * @param path child path name * @return child path */ public PathImpl createChildPath(String path) { PathImpl child = new PathImpl(concatPath(this.path, path)); child.parent = this; children.put(child.path, child); return child; }
packageDesc.setPackage(new PathImpl(packagePath)); packageDesc.setStore(store);
/** * Find a package specific status template * * @param scriptPath Path * @param statusCode int * @param format String * @return status template (or null, if not found) */ private StatusTemplate getPackageStatusTemplate(Path scriptPath, int statusCode, String format) { while(scriptPath != null) { String path = PathImpl.concatPath(scriptPath.getPath(), format + "." + statusCode + ".ftl"); String validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, format); } path = PathImpl.concatPath(scriptPath.getPath(), format + ".status.ftl"); validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, format); } scriptPath = scriptPath.getParent(); } return null; }
/** * Register a Web Script Family * * @param script WebScript */ private void registerFamily(WebScript script) { Description desc = script.getDescription(); Set<String> familys = desc.getFamilys(); for(String family : familys) { if (family != null && family.length() > 0) { PathImpl path = familyByPath.get("/"); String[] parts = family.split("/"); for (String part : parts) { PathImpl subpath = familyByPath.get(PathImpl.concatPath(path.getPath(), part)); if (subpath == null) { subpath = path.createChildPath(part); familyByPath.put(subpath.getPath(), subpath); } path = subpath; } path.addScript(script); } } }
packageDesc.setPackage(new PathImpl(packagePath)); packageDesc.setStore(store);
/** * Find a package specific status template * * @param scriptPath Path * @param statusCode int * @param format String * @return status template (or null, if not found) */ private StatusTemplate getPackageStatusTemplate(Path scriptPath, int statusCode, String format) { while(scriptPath != null) { String path = PathImpl.concatPath(scriptPath.getPath(), format + "." + statusCode + ".ftl"); String validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, format); } path = PathImpl.concatPath(scriptPath.getPath(), format + ".status.ftl"); validTemplatePath = container.getTemplateProcessorRegistry().findValidTemplatePath(path); if (validTemplatePath != null) { return new StatusTemplate(path, format); } scriptPath = scriptPath.getParent(); } return null; }
/** * Register a lifecycle * * @param script WebScript */ private void registerLifecycle(WebScript script) { Description desc = script.getDescription(); Lifecycle lifecycle = desc.getLifecycle(); PathImpl path = lifecycleByPath.get("/"); PathImpl subpath = lifecycleByPath.get(PathImpl.concatPath(path.getPath(), lifecycle.toString())); if (subpath == null) { subpath = path.createChildPath(lifecycle.toString()); lifecycleByPath.put(subpath.getPath(), subpath); } subpath.addScript(script); }
packageDesc.setPackage(new PathImpl(packagePath)); packageDesc.setStore(store);