Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (C) 2009 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.services.jcr.ext.script.groovy;
 
 
 import java.util.List;
 

Author(s):
Andrey Parfonov
Version:
$Id: GroovyScript2RestLoaderPlugin.java 34445 2009-07-24 07:51:18Z dkatayev $
 
 {

   
Logger.
 
    private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.ext.GroovyScript2RestLoaderPlugin");

   
Repository service
 
    private static RepositoryService repositoryService;

   
Configurations for scripts what were got from XML.
 
    private List<XMLGroovyScript2Restl = new ArrayList<XMLGroovyScript2Rest>();

   
Repository.
 
    private String repository;

   
Workspace.
 
    private String workspace;

   
Root node for scripts. If it does not exist new one will be created.
 
    private String node;
 
    @SuppressWarnings("unchecked")
    public GroovyScript2RestLoaderPlugin(InitParams paramsRepositoryService repoServiceo)
    {
       this. = repoServiceo;
 
        = params.containsKey("repository") ? params.getValueParam("repository").getValue() : null;
 
        = params.getValueParam("workspace").getValue();
        = params.getValueParam("node").getValue();
       Iterator<PropertiesParamiterator = params.getPropertiesParamIterator();
       while (iterator.hasNext())
       {
          PropertiesParam p = iterator.next();
          String name = p.getName();
          boolean autoload = Boolean.valueOf(p.getProperty("autoload"));
          String path = p.getProperty("path");
          if (.isDebugEnabled())
             .debug("Read new script configuration " + name);
          .add(new XMLGroovyScript2Rest(namepathautoload));
       }
    }
 
    {
       return ;
    }

   
Get working repository name. Returns the repository name from configuration if it previously configured and returns the name of current repository in other case.

Returns:
String repository name
Throws:
javax.jcr.RepositoryException
 
    public String getRepository()
    {
       if ( == null)
       {
          try
          {
            return .getCurrentRepository().getConfiguration().getName();
         }
         catch (RepositoryException e)
         {
            throw new RuntimeException("Can not get current repository and repository name was not configured"e);
         }
      }
      else
      {
         return ;
      }
   }

   

Returns:
the workspace
   public String getWorkspace()
   {
      return ;
   }

   

Returns:
the node
   public String getNode()
   {
      return ;
   }
New to GrepCode? Check out our FAQ X