/* * Copyright (C) 2007 Alfresco, Inc. * * 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 2 * 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * As a special exception to the terms and conditions of version 2.0 of * the GPL, you may redistribute this Program in connection with Free/Libre * and Open Source Software ("FLOSS") applications as described in Alfresco's * FLOSS exception. You should have recieved a copy of the text describing * the FLOSS exception, and it is also available here: * http://www.alfresco.com/legal/licensing" */ package org.alfresco.repo.module; import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.repo.admin.registry.RegistryService; import org.alfresco.repo.security.authentication.AuthenticationComponent; import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.module.ModuleDetails; import org.alfresco.service.cmr.module.ModuleService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; /** * This component controls the execution of * {@link org.alfresco.repo.module.runtime.ModuleComponent module startup components}. *
* All required startup executions are performed in a single transaction, so this * component guarantees that the module initialization is consistent. Module components are * executed in dependency order only. The version numbering is not to be used * for ordering purposes. * * Afterwards, execution details are persisted in the * {@link org.alfresco.repo.admin.registry.RegistryService service registry} to be used when the * server starts up again. * * @author Roy Wetherall * @author Derek Hulley * @since 2.0 */ public class ModuleServiceImpl implements ModuleService { /** Error messages **/ private static final String ERR_UNABLE_TO_OPEN_MODULE_PROPETIES = "module.err.unable_to_open_module_properties"; /** The classpath search path for module properties */ private static final String MODULE_CONFIG_SEARCH_ALL = "classpath*:alfresco/module/*/module.properties"; private static Log logger = LogFactory.getLog(ModuleServiceImpl.class); private ServiceRegistry serviceRegistry; private AuthenticationComponent authenticationComponent; private ModuleComponentHelper moduleComponentHelper; /** A cache of module details by module ID */ private Map