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

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


     *
     * @param fileName
     * @return
     */
    private static Item item(String fileName) {
        Item item = new Item();
        item.setTitle(fileName);
        item.setLink("/files/" + fileName);
        return item;
    }
View Full Code Here


        // Get the list of contributions in the workspace
        Entry<String, Item>[] contributionEntries = contributionCollection.getAll();

        // Read contribution metadata
        for (Entry<String, Item> contributionEntry: contributionEntries) {
            Item contributionItem = contributionEntry.getData();
            Contribution contribution;
            try {
                contribution = contribution(contributionEntry.getKey(), contributionItem.getAlternate());
            } catch (ContributionReadException e) {
                continue;
            }

            // Create entries for the deployable composites
View Full Code Here

    public Item get(String key) throws NotFoundException {
        logger.fine("get " + key);

        // Get the specified contribution info
        String contributionURI = contributionURI(key);
        Item contributionItem = contributionCollection.get(contributionURI);
       
        // Read the contribution
        Contribution contribution;
        try {
            contribution = contribution(contributionURI, contributionItem.getAlternate());
        } catch (ContributionReadException e) {
            throw new NotFoundException(key);
        }

        // Find the specified deployable composite
View Full Code Here

            // contribution
            List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();

            // Get the specified contribution info
            String contributionURI = queryString.substring(queryString.indexOf('=') + 1);
            Item contributionItem;
            try {
                contributionItem = contributionCollection.get(contributionURI);
            } catch (NotFoundException e) {
                return entries.toArray(new Entry[entries.size()]);
            }
           
            // Read the contribution
            Contribution contribution;
            try {
                contribution = contribution(contributionURI, contributionItem.getAlternate());
            } catch (ContributionReadException e) {
                return entries.toArray(new Entry[entries.size()]);
            }

            // Create entries for the deployable composites
View Full Code Here

    private static Item item(Contribution contribution, Composite deployable) {
        String contributionURI = contribution.getURI();
        String contributionLocation = contribution.getLocation();
        QName qname = deployable.getName();
        String deployableURI = deployable.getURI();
        Item item = new Item();
        item.setTitle(compositeTitle(contributionURI, qname));
        item.setContents(content(deployable));
        item.setLink(compositeSourceLink(contributionURI, qname));
        item.setAlternate(compositeAlternateLink(contributionLocation, deployableURI));
        item.setRelated(relatedLink(deployable));
        return item;
    }
View Full Code Here

            if (contribution == null) {
               
                // The contribution has not been loaded yet, load it with all its dependencies
                Entry<String, Item>[] entries = contributionCollection.query("alldependencies=" + contributionURI);
                for (Entry<String, Item> entry: entries) {
                    Item dependencyItem = entry.getData();
                    String dependencyURI = entry.getKey();
                   
                    if (!contributionMap.containsKey(dependencyURI)) {
                       
                        // Read the contribution
                        Contribution dependency;
                        try {
                            String dependencyLocation = dependencyItem.getAlternate();
                            dependency = contribution(workspace, dependencyURI, dependencyLocation);
                        } catch (ContributionReadException e) {
                            continue;
                        }
                        workspace.getContributions().add(dependency);
View Full Code Here

            String contributionURI = contributionURI(key);

            // Load the contribution
            Contribution contribution = contributionMap.get(contributionURI);
            if (contribution == null) {
                Item contributionItem = contributionCollection.get(contributionURI);
               
                // Read the contribution
                try {
                    contribution = contribution(workspace, contributionURI, contributionItem.getAlternate());
                } catch (ContributionReadException e) {
                    continue;
                }
                workspace.getContributions().add(contribution);
                contributionMap.put(contributionURI, contribution);
View Full Code Here

     *
     * @param vm
     * @return
     */
    private static Item item(SCANodeVM vm) {
        Item item = new Item();
        String key = vm.getNodeName();
        item.setTitle(title(key));
        item.setLink("/node-config/" + vm.getNodeName());
        item.setContents("<span id=\"log\" style=\"white-space: nowrap; font-size: small\">" + vm.getLog().toString() + "</span>");
        return item;
    }
View Full Code Here

                                       Mediator mediator) {
        if (feedEntry != null) {
            if (itemClassType.getPhysical() == Item.class) {
                String key = feedEntry.getId().toString();

                Item item = new Item();
                item.setTitle(feedEntry.getTitle().toString());
                TextContent content = (TextContent)feedEntry.getContent();
                item.setContents(content.getContent().getPlainText());

                for (com.google.gdata.data.Link link : feedEntry.getLinks()) {
                    if (link.getRel() == null || "self".equals(link.getRel())) {
                        if (item.getLink() == null) {
                            item.setLink(link.getHref().toString());
                        }
                    } else if ("related".equals(link.getRel())) {
                        item.setRelated(link.getHref().toString());
                    } else if ("alternate".equals(link.getRel())) {
                        item.setAlternate(link.getHref().toString());
                    }
                }

                Date date = new Date(feedEntry.getUpdated().getValue());
                item.setDate(date);
                return new Entry<Object, Object>(key, item);

            } else {
                String key = null;
                if (feedEntry.getId() != null) {
View Full Code Here

                                                 Mediator mediator) {

        Object key = entry.getKey();
        Object data = entry.getData();
        if (data instanceof Item) {
            Item item = (Item)data;

            com.google.gdata.data.Entry feedEntry = new com.google.gdata.data.Entry();
            if (key != null) {
                feedEntry.setId(key.toString());
            }
            feedEntry.setTitle(new PlainTextConstruct(item.getTitle()));
            feedEntry.setContent(new PlainTextConstruct(item.getContents()));

            String href = item.getLink();
            if (href == null && key != null) {
                href = key.toString();
            }

            if (href != null) {
                feedEntry.addHtmlLink(href, "", "");
            }
            String related = item.getRelated();
            if (related != null) {
                feedEntry.addHtmlLink(related, "", "related");
            }
            String alternate = item.getAlternate();
            if (alternate != null) {
                feedEntry.addHtmlLink(alternate, "", "alternate");
            }

            Date date = item.getDate();
            if (date != null) {
                DateTime datetime = new DateTime(date);
                feedEntry.setUpdated(datetime);
            }
            return feedEntry;
View Full Code Here

TOP

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

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.