Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2011 the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 
 package org.springframework.data.neo4j.server;
 
 import  org.springframework.context.ApplicationContext;
 
Initializer to run Spring Data Neo4j based Server Plugins in a Neo4j REST-server. It takes the list of config locations and a number of spring beans from those contexts that should be exposed as injectable dependencies with a Jersey

Context.:
br/> For example:
 class MyInitializer extends SpringPluginInitializer {
     public MyInitializer() {
         super(new String[]{"myContext.xml"},"graphRepositoryFactory","myRepository");
     }
 }
 
 
 public abstract class SpringPluginInitializer implements PluginLifecycle {
     private String[] contextLocations;
     private Pair<StringClass>[] exposedBeans;
 
     public  SpringPluginInitializerString[] contextLocationsPair<StringClass>... exposedBeans) {
         this. = contextLocations;
         this. = exposedBeans;
     }
 
     protected static Pair<String,Classexpose(String nameClass<?> type) {
         return Pair.of(name,(Class)type);
     }
    
Binds the provided graph database to the spring contexts so that spring beans that consume a graph database can be populated.

Parameters:
graphDatabaseService of the Neo4j server
config of the Neo4j Server
Returns:
Exposes the requested Spring beans as @{see Injectable}s
 
     @Override
     public Collection<Injectable<?>> startGraphDatabaseService graphDatabaseServiceConfiguration config ) {
          = new ProvidedClassPathXmlApplicationContextgraphDatabaseService );
         Collection<Injectable<?>> result = new ArrayList<Injectable<?>>( . );
         for ( final Pair<StringClassexposedBean :  ) {
 //            Class<?> concreteType = ctx.getType( exposedBean );
             @SuppressWarnings("unchecked"final SpringBeanInjectable injectable = new SpringBeanInjectable(appCtxexposedBean.first(), exposedBean.other());
             result.add(injectable);
         }
         return result;
     }

    
closes the spring context
 
     public void stop() {
         if (  != null ) {
             .close();
         }
     }

    
provides access to the Spring bean, proxying the

Parameters:
<T> optional type of the bean
:
see Injectable}
 
     private static class SpringBeanInjectable<T> implements Injectable<T> {
         private final String exposedBean;
         protected ApplicationContext ctx;
         private final Class<T> clazz;
 
         public SpringBeanInjectablefinal ApplicationContext ctxString exposedBeanClass<T> clazz ) {
             this. = exposedBean;
             this. = ctx;
             this. = clazz;
         }
        @SuppressWarnings("unchecked")
        public T getValue() {
            return (T).getBean(  );
        }
        public Class<T> getType() {
            return ;
        }
    }
New to GrepCode? Check out our FAQ X