Refine search
/** * Gets a document from anywhere on the search path. Note a raw InputStream to the * content is returned and must be closed by the accessing method. * * @param documentPath document path * @return input stream onto document or null if it * does not exist on the search path * * @throws IOException */ public InputStream getDocument(String documentPath) throws IOException { for (Store store : getStores()) { if (store.hasDocument(documentPath)) { return store.getDocument(documentPath); } } return null; } }
/** * Plugs the store into the search path * * @param store store * @param searchPath search path * @param prepend whether to prepend or not */ protected void plugin(Store store, SearchPath searchPath, boolean prepend) { // prepend to the front ArrayList<Store> storeList = new ArrayList(searchPath.getStoresInternal()); if (prepend) { storeList.add(0, store); } else { storeList.add(store); } searchPath.setSearchPath(storeList); } }
schemaDocumentById.clear(); for (Store apiStore : searchPath.getStores()) logger.debug("Locating package descriptions within " + apiStore.getBasePath()); packageDescPaths = apiStore.getDocumentPaths("/", true, PackageDescriptionDocument.DESC_NAME_PATTERN); try packageDescIS = apiStore.getDocument(packageDescPath); packageDesc = createPackageDescription(apiStore, packageDescPath, packageDescIS);
if (this.configurationSearchPath != null) for (Store store: this.configurationSearchPath.getStores()) for (String path: store.getDocumentPaths("/", true, "*.xml")) InputStream is = store.getDocument(path); SAXReader reader = new SAXReader(); Document document;
Collection<Store> stores = getContainer().getSearchPath().getStores(); for (Store store : stores) modelStore.path = store.getBasePath(); try scriptPaths = store.getScriptDocumentPaths(script); try documentIS = store.getDocument(scriptPath); InputStreamReader isReader = new InputStreamReader(documentIS); StringWriter stringWriter = new StringWriter();
for (Store apiStore : getSearchPath().getStores()) if (apiStore.hasDocument(path)) logger.debug("Found Spring Resource '" + location + " in store: " + apiStore.getClass().getSimpleName() + "(" + apiStore.getBasePath() + ")");
/** * Initializes the script loaders */ protected void initLoaders() { List<ScriptLoader> loaders = new ArrayList<ScriptLoader>(searchPath.getStores().size()); for (Store apiStore : searchPath.getStores()) { ScriptLoader loader = apiStore.getScriptLoader(); if (loader == null) { throw new WebScriptException("Unable to retrieve script loader for Web Script store " + apiStore.getBasePath()); } loaders.add(loader); } this.scriptLoader = new MultiScriptLoader(loaders.toArray(new ScriptLoader[loaders.size()])); }
/** * Initializes the template loaders */ protected void initLoaders() { if (searchPath != null) { for (Store apiStore : searchPath.getStores()) { TemplateLoader loader = apiStore.getTemplateLoader(); if (loader == null) { logger.error("Unable to retrieve template loader for Web Script store " + apiStore.getBasePath()); } loaders.add(loader); } } this.templateLoader = new MultiTemplateLoader(loaders.toArray(new TemplateLoader[loaders.size()])); }
for (Store apiStore : getSearchPath().getStores()) String[] paths = apiStore.getDocumentPaths("", locationPattern); logger.debug("Found Spring Resource '" + paths[i] + " in store: " + apiStore.getClass().getSimpleName() + "(" + apiStore.getBasePath() + ")");
/** * Determines if the document exists anywhere on the search path * * @param documentPath document path * @return true => exists, false => does not exist * @throws IOException */ public boolean hasDocument(String documentPath) throws IOException { for (Store store : getStores()) { if (store.hasDocument(documentPath)) { return true; } } return false; }
/** * Gets the Web Script Store for the given Store path * * @param storePath String * @return store (or null, if not found) */ public Store getStore(String storePath) { Collection<Store> stores = getStores(); for (Store store : stores) { if (store.getBasePath().equals(storePath)) { return store; } } return null; }
for (Store store : this.searchPath.getStores()) for (String path: store.getAllDocumentPaths()) docs.add(XMLUtil.parse(store.getDocument(path)));
for (Store store : this.searchPath.getStores()) in = store.getDocument(processPath(path)); break;
private void installFile(String storePath, String file, String content) { // retrieve appropriate web script store Store store = getContainer().getSearchPath().getStore(storePath); if (store == null) { throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Store path " + storePath + " refers to a store that does not exist"); } try { // determine if file already exists in store if (store.hasDocument(file)) { throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Web Script file " + file + " already exists in store " + storePath); } // create the web script file store.createDocument(file, content); } catch(IOException e) { throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Failed to install Web Script file " + file + " into store" + storePath); } }
/** * Logs info-level searchpath configuration info during autowire startup * * @param searchPath SearchPath */ protected void reportSearchPath(SearchPath searchPath) { if (logger.isInfoEnabled()) { StringBuilder s = new StringBuilder(); s.append("["); if (searchPath != null) { Iterator<Store> it = searchPath.getStores().iterator(); while (it.hasNext()) { Store store = (Store) it.next(); s.append("'"); s.append(store.toString()); s.append("'"); if (it.hasNext()) { s.append(","); } } } s.append("]"); logger.info("Search Path: " + searchPath + " = " + s.toString()); } }
/** * Helper to retrieve a ResourceBundle wrapper from a store path. * * @param path String * @return ResourceBundle * @throws IOException */ private ResourceBundle getBundleFromPath(String path) throws IOException { ResourceBundle result = null; if (container.getSearchPath().hasDocument(path)) { InputStream is = container.getSearchPath().getDocument(path); try { result = new WebScriptPropertyResourceBundle(is, path); } finally { is.close(); } } return result; }
this.webScriptsSearchPath.setSearchPath(this.commonWebScriptPaths); this.templatesSearchPath.setSearchPath(this.commonTemplatePaths);
input = this.container.getSearchPath().getDocument(configPath); if (input != null)
schemaDocumentById.clear(); for (Store apiStore : searchPath.getStores()) logger.debug("Locating package descriptions within " + apiStore.getBasePath()); packageDescPaths = apiStore.getDocumentPaths("/", true, PackageDescriptionDocument.DESC_NAME_PATTERN); try packageDescIS = apiStore.getDocument(packageDescPath); packageDesc = createPackageDescription(apiStore, packageDescPath, packageDescIS);
if (this.configurationSearchPath != null) for (Store store: this.configurationSearchPath.getStores()) for (String path: store.getDocumentPaths("/", true, "*.xml")) InputStream is = store.getDocument(path); SAXReader reader = new SAXReader(); Document document;