Package org.apache.tuscany.sca.data.collection

Examples of org.apache.tuscany.sca.data.collection.NotFoundException


                updateDomainSearch(contributionURI);
               
                return;
            }
        }
        throw new NotFoundException(key);
    }
View Full Code Here


                file.delete();
            }
        }
       
        if (deleted == null) {
            throw new NotFoundException(key);
        }
    }
View Full Code Here

        for (Contribution contribution: workspace.getContributions()) {
            if (key.equals(contribution.getURI())) {
                return item(workspace, contribution);
            }
        }
        throw new NotFoundException(key);
    }
View Full Code Here

                // Write the workspace
                writeWorkspace(workspace);
                return;
            }
        }
        throw new NotFoundException(key);
    }
View Full Code Here

               
                return;
               
            }
        }
        throw new NotFoundException(key);
    }
View Full Code Here

    private String host(String nodeName) throws NotFoundException {

        // Get the entry representing the given node
        Entry<String, Item> nodeEntry = nodeEntry(cloudCollection.getAll(), nodeName);
        if (nodeEntry == null) {
            throw new NotFoundException(nodeName);
        }
       
        // Get the host hosting it
        return host(nodeEntry.getData());
    }
View Full Code Here

            } else if (key.startsWith("query")) {
                return executeQuery(key.substring("query".length()));

            } else {
                throw new NotFoundException("Invalid operation!");
            }

        } catch (Exception t) {
            if (t instanceof NotFoundException) {
                throw (NotFoundException)t;
            }
            throw new NotFoundException("Internal error!");
        }

    }
View Full Code Here

    private Item highlightArtifact(String contribution, String artifact, String query) throws NotFoundException {

        Item item = this.contributionCollection.get(contribution);

        if (item == null) {
            throw new NotFoundException("contribution not found: " + contribution);
        }

        String location = item.getAlternate();

        if (location.endsWith(".jar") || location.endsWith(".zip")) {
            location =
                "jar:" + (location.startsWith("file:") ? "" : "file:")
                    + location
                    + '!'
                    + (artifact.startsWith("/") ? "" : "/")
                    + artifact;

        } else {
            location += (location.endsWith("/") ? "" : "/") + artifact;
        }

        try {
            Reader reader = new InputStreamReader(new URL(location).openStream());
            StringBuilder sb = new StringBuilder();
            int c;

            // TODO: load the chars into an array buffer instead of one
            // at a
            // time
            while ((c = reader.read()) != -1) {
                char character = (char)c;

                if (!Character.isIdentifierIgnorable(character)) {
                    sb.append(character);
                }

            }

            String highlightedText = this.domainSearch.highlight(SearchFields.FILE_CONTENT_FIELD, sb.toString(), query);
            highlightedText = highlightedText.replaceAll("\n", "<br/>");
            highlightedText = highlightedText.replaceAll(" ", "&nbsp;");
            highlightedText =
                HighlightingUtil.replaceHighlightMarkupBy(highlightedText, HIGHLIGHT_START, HIGHLIGHT_END);

            item = new Item();
            item.setTitle(contribution + ";" + artifact);
            item.setContents(highlightedText);

            return item;

        } catch (Exception e) {
            throw new NotFoundException("Could not highlight artifact: " + e.getMessage(), e);
        }
       
    }
View Full Code Here

        Result[] results;
        try {
            results = this.domainSearch.parseAndSearch(query, true);
        } catch (Exception e1) {
            throw new NotFoundException("Exception while searching: " + e1.getMessage(), e1);
        }

        Item item = new Item();
        item.setTitle("Results");
View Full Code Here

            } else if (queryString.startsWith("query")) {
                key = queryString.substring("query".length());
                item = executeQuery(key);

            } else {
                throw new NotFoundException("Invalid operation!");
            }

            Entry<String, Item>[] returnArray = new Entry[1];
            returnArray[0] = new Entry<String, Item>(key, item);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.data.collection.NotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.