Package org.exoplatform.portal.resource.compressor

Examples of org.exoplatform.portal.resource.compressor.ResourceCompressorPlugin


        plugins = new HashMap<ResourceType, List<ResourceCompressorPlugin>>();
    }

    public void registerCompressorPlugin(ComponentPlugin plugin) {
        if (plugin instanceof ResourceCompressorPlugin) {
            ResourceCompressorPlugin compressorPlugin = (ResourceCompressorPlugin) plugin;
            ResourceType type = compressorPlugin.getResourceType();
            List<ResourceCompressorPlugin> sameResourceTypePlugins = plugins.get(type);

            if (sameResourceTypePlugins != null) {
                sameResourceTypePlugins.add(compressorPlugin);
                log.debug("Loaded compressor plugin: " + compressorPlugin.getName() + " for resource type " + type.toString());
            } else {
                List<ResourceCompressorPlugin> newListOfPlugins = new ArrayList<ResourceCompressorPlugin>();
                newListOfPlugins.add(compressorPlugin);
                log.debug("Loaded compressor plugin: " + compressorPlugin.getName() + " for new resource type "
                        + type.toString());
                plugins.put(type, newListOfPlugins);
            }
        }
    }
View Full Code Here


    }

    @Override
    public final void compress(Reader input, Writer output, ResourceType resourceType) throws ResourceCompressorException,
            IOException {
        ResourceCompressorPlugin plugin = getHighestPriorityCompressorPlugin(resourceType);
        if (plugin != null) {
            plugin.compress(input, output);
        } else {
            throw new ResourceCompressorException("There is no compressor for " + resourceType + " type");
        }
    }
View Full Code Here

   public void registerCompressorPlugin(ComponentPlugin plugin)
   {
      if (plugin instanceof ResourceCompressorPlugin)
      {
         ResourceCompressorPlugin compressorPlugin = (ResourceCompressorPlugin)plugin;
         ResourceType type = compressorPlugin.getResourceType();
         List<ResourceCompressorPlugin> sameResourceTypePlugins = plugins.get(type);

         if (sameResourceTypePlugins != null)
         {
            sameResourceTypePlugins.add(compressorPlugin);
            log.debug("Loaded compressor plugin: " + compressorPlugin.getName() + " for resource type "
               + type.toString());
         }
         else
         {
            List<ResourceCompressorPlugin> newListOfPlugins = new ArrayList<ResourceCompressorPlugin>();
            newListOfPlugins.add(compressorPlugin);
            log.debug("Loaded compressor plugin: " + compressorPlugin.getName() + " for new resource type "
               + type.toString());
            plugins.put(type, newListOfPlugins);
         }
      }
   }
View Full Code Here

   @Override
   final public void compress(Reader input, Writer output, ResourceType resourceType)
      throws ResourceCompressorException, IOException
   {
      ResourceCompressorPlugin plugin = getHighestPriorityCompressorPlugin(resourceType);
      if (plugin != null)
      {
         plugin.compress(input, output);
      }
      else
      {
         throw new ResourceCompressorException("There is no compressor for " + resourceType + " type");
      }
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.resource.compressor.ResourceCompressorPlugin

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.