Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
SimpleMedia Module for Magnolia CMS (http://www.openmindlab.com/lab/products/media.html) Copyright(C) 2008-2013, Openmind S.r.l. http://www.openmindonline.it This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 package net.sourceforge.openutils.mgnlmedia.externalvideo;
 
 import  info.magnolia.cms.beans.runtime.MultipartForm;
 import  info.magnolia.jcr.util.PropertyUtil;
 import  info.magnolia.objectfactory.Components;
 
 import java.io.File;
 import java.util.Map;
 
 import javax.jcr.Node;
 
 
 
 /*
  * 
  */
 {
 
     public static final String ND_PROVIDER = "provider";
 
     public static ExternalVideoProvider getExternalVideoProvider(Node media)
     {
         MediaTypeHandler mth = Components
             .getComponent(MediaConfigurationManager.class)
             .getMediaTypeConfigurationFromMedia(media)
             .getHandler();
         if (mth.getClass().isAssignableFrom(ExternalVideoTypeHandler.class))
         {
             return ((ExternalVideoTypeHandlermth).getVideoProvider(media);
         }
         return null;
     }

    
External video support, will be made configurable in future versions.
 
 
     @Override
     public void init(Node typeDefinitionNode)
     {
         super.init(typeDefinitionNode);
     }

    
Returns the videoProviders.

Returns:
the videoProviders
 
     {
         return ;
     }

    
Sets the videoProviders.

Parameters:
videoProviders the videoProviders to set
 
     public void setVideoProviders(Map<StringExternalVideoProvidervideoProviders)
     {
         this. = videoProviders;
     }

    
Adds a video support handler.

Parameters:
videoSupportHandler ExternalVideoSupport implementation
 
     public void addVideoProvider(String nameExternalVideoProvider videoProvider)
     {
         .put(namevideoProvider);
     }
 
    {
        return .get(PropertyUtil.getString(media));
    }
    @Override
    public void saveFromZipFile(Node mediaFile fString cleanFileNameString extension)
    {
        media.setProperty("provider""weebo");
        ExternalVideoUtil.setStatus(media.getIdentifier(), .);
        super.saveFromZipFile(mediafcleanFileNameextension);
    }

    
    @Override
    public String getUrl(Node mediaMap<StringStringoptions)
    {
        ExternalVideoProvider provider = getVideoProvider(media);
        if (provider == null)
        {
            return null;
        }
        return provider.getUrl(mediaoptions);
    }

    
    @Override
    public String getNewNodeName(MultipartForm formHttpServletRequest request)
    {
        return .get(request.getParameter()).getNewNodeName(formrequest);
    }

    
    @Override
    public String getUrl(Node media)
    {
        ExternalVideoProvider provider = getVideoProvider(media);
        if (provider == null)
        {
            return null;
        }
        return provider.getUrl(medianull);
    }

    
    @Override
    public boolean onPostSave(Node media)
    {
        ExternalVideoProvider provider = getVideoProvider(media);
        if (provider != null)
        {
            provider.processVideo(media);
        }
        return super.onPostSave(media);
    }

    
    @Override
    public String getFilename(Node media)
    {
        ExternalVideoProvider provider = getVideoProvider(media);
        if (provider != null)
        {
            return provider.getFilename(media);
        }
        return null;
    }

    
    @Override
    public String getThumbnailUrl(Node media)
    {
        ExternalVideoProvider provider = getVideoProvider(media);
        if (provider == null)
        {
            return null;
        }
        return provider.getThumbnailUrl(media);
    }

    
    @Override
    public String getPreviewUrl(Node media)
    {
        ExternalVideoProvider provider = getVideoProvider(media);
        if (provider == null)
        {
            return null;
        }
        return provider.getPreviewUrl(media);
    }

    
    @Override
    public void stop()
    {
        Map<StringExternalVideoProviderproviders = this.getVideoProviders();
        if (providers != null)
        {
            for (ExternalVideoProvider provider : providers.values())
            {
                provider.stop();
            }
        }
        super.stop();
    }

    
    @Override
    {
        return "/.resources/media/icons/thumb-video.png";
    }
New to GrepCode? Check out our FAQ X