001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.deploy.sandbox;
016    
017    import com.liferay.portal.kernel.deploy.Deployer;
018    import com.liferay.portal.kernel.plugin.PluginPackage;
019    import com.liferay.portal.util.PortalUtil;
020    import com.liferay.util.ant.CopyTask;
021    
022    import java.io.File;
023    
024    /**
025     * @author Igor Spasic
026     * @author Brian Wing Shun Chan
027     */
028    public class ThemeSandboxHandler extends BaseSandboxHandler {
029    
030            public ThemeSandboxHandler(Deployer deployer) {
031                    super(deployer);
032            }
033    
034            @Override
035            protected void clonePlugin(File dir, PluginPackage pluginPackage)
036                    throws Exception {
037    
038                    String portalWebDir = PortalUtil.getPortalWebDir();
039    
040                    CopyTask.copyDirectory(
041                            new File(portalWebDir, "html/themes/classic"), dir, null,
042                            "/_diffs/**", true, true);
043            }
044    
045            @Override
046            protected String getPluginType() {
047                    return _PLUGIN_TYPE;
048            }
049    
050            private static final String _PLUGIN_TYPE = "theme";
051    
052    }