Package net.sf.sitstart.dto

Examples of net.sf.sitstart.dto.Asset


     * @see net.sf.sitstart.svc.internal.AssetProcessor#process(net.sf.sitstart.svc.internal.AssetWithContent)
     */
    public void process(AssetWithContent assetWithContent)
    {
        MimeTypeDetectingInputStream mimeTypeDetectorStream = null;
        Asset                        asset                  = null;
        Date                         start                  = null;
        Date                         end                    = null;
       
        // PRECONDITIONS
        assert assetWithContent != null : "assetWithContent must not be null.";
       
        // Body
        start = new Date();
        asset = assetWithContent.getAsset();
       
        mimeTypeDetectorStream = new MimeTypeDetectingInputStream(mimeTypeDetector,
                                                                  assetWithContent.getInputStream(),
                                                                  null,
                                                                  asset.getURI());
        linkExtractor.extractLinks(asset, mimeTypeDetectorStream);
        asset.setDetectedMimeType(mimeTypeDetectorStream.getDetectedMimeType());
        end = new Date();
       
        asset.setProcessingTimeInMs(end.getTime() - start.getTime());
    }
View Full Code Here


    /**
     * @see net.sf.sitstart.svc.internal.AssetFactory#create(java.net.URI, boolean)
     */
    public Asset create(URI uri, boolean isRoot)
    {
        Asset result = null;
       
        // PRECONDITIONS
        assert uri != null : "uri must not be null.";
       
        // Body
View Full Code Here

     * @see net.sf.sitstart.svc.internal.LinkFactory#create(net.sf.sitstart.dto.Asset, java.lang.String)
     */
    public Link create(Asset source, String targetLinkTag)
    {
        Link             result      = null;
        Asset            target      = null;
        URI              targetURI   = null;
        Link.LinkTagType linkTagType = null;

       
        // PRECONDITIONS
        assert source        != null             : "source must not be null.";
        assert targetLinkTag != null             : "targetLinkTag must not be null.";
        assert targetLinkTag.trim().length() > 0 : "targetLinkTag must not be empty or blank.";
       
        // Body
        targetURI = parseLinkTag(targetLinkTag);
        target    = assetRetriever.retrieve(targetURI).getAsset();
       
        try
        {
            result = linkClass.newInstance();
        }
        catch (RuntimeException re)
        {
            throw re;
        }
        catch (Exception e)
        {
            throw new RuntimeException(e);
        }
       
        result.setSource(source);
        result.setTarget(target);
        result.setLinkTag(targetLinkTag.trim());
        result.setLinkTagType(linkTagType);

        // Don't forget to link everything up
        target.addIncomingLink(result);
        source.addIncomingLink(result);
       
        return(result);
    }
View Full Code Here

        assert uri != null : "uri must not be null.";
       
        // Body
        try
        {
            Asset               asset            = null;
            GetMethod           get              = null;
            Map<String, String> headers          = null;
            int                 statusCode       = -1;
            Date                start            = null;
            Date                end              = null;
            String              reportedMimeType = null;

            log.info("HTTP GET " + uri);
           
            get = new GetMethod(uri.toString());
           
            start      = new Date();
            statusCode = httpClient.executeMethod(get);
            end        = new Date();
           
            headers = buildHeaderMap(get);
           
            reportedMimeType = headers.get(HEADER_NAME_MIME_TYPE);
           
            asset = assetFactory.create(uri, isRoot);
           
            asset.setHeaders(buildHeaderMap(get));
            asset.setRetrievalTimeInMs(end.getTime() - start.getTime());
            asset.setStatusCode(statusCode);
            asset.setReportedMimeType(reportedMimeType);
            //####TODO: Set other stuff here
           
            result = new AssetWithContent(asset, get.getResponseBodyAsStream());
        }
        catch (RuntimeException re)
View Full Code Here

    /**
     * @see net.sf.sitstart.svc.internal.AssetFactory#create(java.net.URI)
     */
    public Asset create(URI uri, boolean isRoot)
    {
        Asset result = null;
       
        // PRECONDITIONS
        assert uri != null : "uri must not be null.";
       
        // Body
        try
        {
            result = assetClass.newInstance();
            result.setURI(uri);
            result.setIsRoot(isRoot);
           
            dao.save(result);
        }
        catch (RuntimeException re)
        {
View Full Code Here

    /**
     * @see net.sf.sitstart.dao.AssetDAO#getByURI(java.net.URI)
     */
    public synchronized Asset getByURI(URI uri)
    {
        Asset result = null;
       
       
        // PRECONDITIONS
        assert uri != null : "uri must not be null.";
       
View Full Code Here

TOP

Related Classes of net.sf.sitstart.dto.Asset

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.