Refine search
/** * 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()])); }
/** * 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; } }
/** * Gets all Web Script Stores * * @return all Web Script Stores */ public Collection<Store> getStores() { Collection<Store> aliveStores = new ArrayList<Store>(searchPath.size()); for (Store store : searchPath) { if (store.exists()) { aliveStores.add(store); } } return aliveStores; }
/** * 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()])); }
logger.debug("Locating package descriptions within " + apiStore.getBasePath()); packageDescPaths = apiStore.getDocumentPaths("/", true, PackageDescriptionDocument.DESC_NAME_PATTERN); packageDescIS = apiStore.getDocument(packageDescPath); packageDesc = createPackageDescription(apiStore, packageDescPath, packageDescIS); throw new WebScriptException("Failed to read package description document " + apiStore.getBasePath() + packageDescPath, e); String path = apiStore.getBasePath() + "/" + packageDescPath; Throwable c = e; String cause = c.getMessage(); logger.debug("Locating schema descriptions within " + apiStore.getBasePath()); schemaDescPaths = apiStore.getDocumentPaths("/", true, SchemaDescriptionDocument.DESC_NAME_PATTERN); schemaDescIS = apiStore.getDocument(schemaDescPath); schemaDesc = createSchemaDescription(apiStore, schemaDescPath, schemaDescIS); throw new WebScriptException("Failed to read Web Script description document " + apiStore.getBasePath() + schemaDescPath, e); String path = apiStore.getBasePath() + "/" + schemaDescPath; Throwable c = e; String cause = c.getMessage(); logger.debug("Locating Web Scripts within " + apiStore.getBasePath()); serviceDescPaths = apiStore.getDescriptionDocumentPaths();
if (this.store.hasDocument(path)) Document document = XMLUtil.parse(this.store.getDocument(path));
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() + ")");
for (Store apiStore : getSearchPath().getStores()) String[] paths = apiStore.getDocumentPaths("", locationPattern); logger.debug("Found Spring Resource '" + paths[i] + " in store: " + apiStore.getClass().getSimpleName() + "(" + apiStore.getBasePath() + ")");
/** * 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; }
/** * 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; }
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;
this.store.createDocument(path, content); this.store.createDocument(path, content); this.store.removeDocument(oldPath); this.store.updateDocument(oldPath, content);
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); } }
public InputStream getDescDocument() throws IOException { return store.getDocument(descPath); }
public String getStorePath() { return store.getBasePath(); }
if (this.store.hasDocument(path)) removed = this.store.removeDocument(path);
if (!this.store.exists()) String[] paths = this.store.getAllDocumentPaths(); for (int i = 0; i < paths.length; i++)