1 /** 2 * This file Copyright (c) 2008-2016 Magnolia International 3 * Ltd. (http://www.magnolia-cms.com). All rights reserved. 4 * 5 * 6 * This file is dual-licensed under both the Magnolia 7 * Network Agreement and the GNU General Public License. 8 * You may elect to use one or the other of these licenses. 9 * 10 * This file is distributed in the hope that it will be 11 * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the 12 * implied warranty of MERCHANTABILITY or FITNESS FOR A 13 * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT. 14 * Redistribution, except as permitted by whichever of the GPL 15 * or MNA you select, is prohibited. 16 * 17 * 1. For the GPL license (GPL), you can redistribute and/or 18 * modify this file under the terms of the GNU General 19 * Public License, Version 3, as published by the Free Software 20 * Foundation. You should have received a copy of the GNU 21 * General Public License, Version 3 along with this program; 22 * if not, write to the Free Software Foundation, Inc., 51 23 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 24 * 25 * 2. For the Magnolia Network Agreement (MNA), this file 26 * and the accompanying materials are made available under the 27 * terms of the MNA which accompanies this distribution, and 28 * is available at http://www.magnolia-cms.com/mna.html 29 * 30 * Any modifications to this file must keep this entire header 31 * intact. 32 * 33 */ 34 package info.magnolia.module.resources; 35 36 import info.magnolia.module.resources.loaders.ResourceLoader; 37 import info.magnolia.voting.voters.VoterSet; 38 39 import java.util.ArrayList; 40 import java.util.List; 41 42 /** 43 * Resources module class. 44 */ 45 public class ResourcesModule { 46 47 /** 48 * @deprecated since 2.4 49 */ 50 @Deprecated 51 private static ResourcesModule instance; 52 53 /** 54 * @deprecated since 2.4 Resources are now served through the {@link info.magnolia.resourceloader.ResourceOrigin} API. 55 */ 56 public static final String DEFAULT_WORKSPACE = "resources"; 57 58 /** 59 * @deprecated since 2.2.1, use {@link ResourceTypes#RESOURCES_PREFIX} instead. 60 */ 61 public static final String MODULE_NAME_PREFIX = "resources:"; 62 63 private String repository = DEFAULT_WORKSPACE; 64 65 private List<ResourceLoader> resourceLoaders = new ArrayList<ResourceLoader>(); 66 67 private boolean versionOnSave; 68 69 private String downloadPath = "/.resources/"; 70 71 private VoterSet<String> resourceFilter; 72 73 public ResourcesModule() { 74 instance = this; 75 } 76 77 public String getDownloadPath() { 78 return downloadPath; 79 } 80 81 public void setDownloadPath(String downloadPath) { 82 this.downloadPath = downloadPath; 83 } 84 85 /** 86 * @deprecated since 2.4 - use IoC 87 */ 88 @Deprecated 89 public static ResourcesModule getInstance() { 90 return instance; 91 } 92 93 /** 94 * @deprecated since 2.4 Resources are now served through the {@link info.magnolia.resourceloader.ResourceOrigin} API. 95 */ 96 @Deprecated 97 public String getRepository() { 98 return repository; 99 } 100 101 /** 102 * @deprecated since 2.4 Resources are now served through the {@link info.magnolia.resourceloader.ResourceOrigin} API. 103 */ 104 @Deprecated 105 protected void setRepository(String repository) { 106 this.repository = repository; 107 } 108 109 /** 110 * @deprecated since 2.4 Resources are now served through the {@link info.magnolia.resourceloader.ResourceOrigin} API. 111 */ 112 @Deprecated 113 public void setResourceLoaders(List<ResourceLoader> loaders) { 114 this.resourceLoaders = loaders; 115 } 116 117 /** 118 * @deprecated since 2.4 Resources are now served through the {@link info.magnolia.resourceloader.ResourceOrigin} API. 119 */ 120 @Deprecated 121 public void addResourceLoader(ResourceLoader loader) { 122 if (loader.isEnabled()) { 123 this.resourceLoaders.add(loader); 124 } 125 } 126 127 /** 128 * @deprecated since 2.4 Resources are now served through the {@link info.magnolia.resourceloader.ResourceOrigin} API. 129 */ 130 @Deprecated 131 public List<ResourceLoader> getResourceLoaders() { 132 return this.resourceLoaders; 133 } 134 135 /** 136 * @deprecated Marked deprecated since 2.4, usage was removed in 2.2 137 */ 138 @Deprecated 139 public boolean isVersionOnSave() { 140 return versionOnSave; 141 } 142 143 /** 144 * @deprecated Marked deprecated since 2.4, usage was removed in 2.2 145 */ 146 @Deprecated 147 public void setVersionOnSave(boolean versionOnSave) { 148 this.versionOnSave = versionOnSave; 149 } 150 151 public VoterSet<String> getResourceFilter() { 152 return resourceFilter; 153 } 154 155 public void setResourceFilter(VoterSet<String> resourceFilter) { 156 this.resourceFilter = resourceFilter; 157 } 158 }