Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (C) 2013 eXo Platform SAS.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.exoplatform.container.spring;
This is the implementation of the ApplicationContextProvider based on the org.springframework.context.support.FileSystemXmlApplicationContext allowing to configure Spring thanks to XML files. It can be configured using a values-param, each value will be the path of the XML files to be registered. Please note that the expected paths will be retrieved thanks to the org.exoplatform.container.configuration.ConfigurationManager which means that all the prefixes supported by the kernel are supported by this component such as jar: and classpath:

Author(s):
Nicolas Filotto
Version:
$Id$
{

   
The name of the values parameter that will contain the path to the configuration files
   private static final String CONFIG_PATHS_PARAM_NAME = "config.paths";

   
The values param containing the configuration
   private final ValuesParam params;

   
The configuration manager
   private final ConfigurationManager cm;

   
The default constructor

Parameters:
p the initial parameters
cm the configuration manager
   {
      if (p == null || p.getValuesParam() == null)
      {
         throw new IllegalArgumentException("The values parameter " + 
            + " is mandatory, please set at least one value.");
      }
      this. = cm;
   }

   
   {
      try
      {
         String[] paths = new String[.getValues().size()];
         int i = 0;
         for (String value : .getValues())
         {
            URL url = .getResource(value);
            paths[i++] = url.toURI().toString();
         }
         return new FileSystemXmlApplicationContext(pathstrueparent);
      }
      catch (Exception e)
      {
         throw new RuntimeException("Could not create the ApplicationContext"e);
      }
   }
New to GrepCode? Check out our FAQ X