/** * * @param tsDC DatastoreConfiguration : the datastore configuration intended for the triplestore connector * @return GenericBeanDefinition for the TriplestoreConnector * @throws IOException */ protected static GenericBeanDefinition getTriplestoreConnectorBeanDefinition(DatastoreConfiguration tsDC) throws IOException { String tsConnector = tsDC.getParameter("connectorClassName",Parameter.class).getValue(); ScannedGenericBeanDefinition beanDefinition = getScannedBeanDefinition(tsConnector); beanDefinition.setAutowireCandidate(true); Iterator<Parameter> it; Parameter p; Map<String, String> tsTC = new HashMap<String, String>(); it = tsDC.getParameters(Parameter.class).iterator(); while (it.hasNext()) { p = it.next(); tsTC.put(p.getName(), p.getValue(p.getIsFilePath())); } MutablePropertyValues propertyValues = new MutablePropertyValues(); propertyValues.addPropertyValue("configuration", tsTC); beanDefinition.setPropertyValues(propertyValues); return beanDefinition; }
protected AbstractApplicationContext getDefaultContext() throws IOException { GenericApplicationContext appContext = new GenericApplicationContext(); appContext.refresh(); // init event multicaster to avoid synch issue appContext.registerBeanDefinition(MODULE_CONSTRUCTOR_PARAM2_CLASS, getServerBeanDefinition()); appContext.getBeanFactory().registerSingleton(MODULE_CONSTRUCTOR_PARAM2_CLASS, this); appContext.registerBeanDefinition(ServerConfiguration.class.getName(), getServerConfigurationBeanDefinition()); ScannedGenericBeanDefinition moduleDef = getScannedBeanDefinition(Module.class.getName()); moduleDef.setAbstract(true); moduleDef.setInitMethodName("initModule"); moduleDef.setDestroyMethodName("shutdownModule"); appContext.registerBeanDefinition(Module.class.getName(), moduleDef); return appContext; }
/** * * @param tsDC DatastoreConfiguration : the datastore configuration intended for the triplestore connector * @return GenericBeanDefinition for the TriplestoreConnector * @throws IOException */ protected static GenericBeanDefinition getTriplestoreConnectorBeanDefinition(DatastoreConfiguration tsDC) throws IOException { String tsConnector = tsDC.getParameter("connectorClassName",Parameter.class).getValue(); ScannedGenericBeanDefinition beanDefinition = getScannedBeanDefinition(tsConnector); beanDefinition.setAutowireCandidate(true); Iterator<Parameter> it; Parameter p; Map<String, String> tsTC = new HashMap<String, String>(); it = tsDC.getParameters(Parameter.class).iterator(); while (it.hasNext()) { p = it.next(); tsTC.put(p.getName(), p.getValue(p.getIsFilePath())); } MutablePropertyValues propertyValues = new MutablePropertyValues(); propertyValues.addPropertyValue("configuration", tsTC); beanDefinition.setPropertyValues(propertyValues); return beanDefinition; }
protected AbstractApplicationContext getDefaultContext() throws IOException { GenericApplicationContext appContext = new GenericApplicationContext(); appContext.refresh(); // init event multicaster to avoid synch issue appContext.registerBeanDefinition(MODULE_CONSTRUCTOR_PARAM2_CLASS, getServerBeanDefinition()); appContext.getBeanFactory().registerSingleton(MODULE_CONSTRUCTOR_PARAM2_CLASS, this); appContext.registerBeanDefinition(ServerConfiguration.class.getName(), getServerConfigurationBeanDefinition()); ScannedGenericBeanDefinition moduleDef = getScannedBeanDefinition(Module.class.getName()); moduleDef.setAbstract(true); moduleDef.setInitMethodName("initModule"); moduleDef.setDestroyMethodName("shutdownModule"); appContext.registerBeanDefinition(Module.class.getName(), moduleDef); return appContext; }
ScannedGenericBeanDefinition beanDefinition = Server.getScannedBeanDefinition(rebuilder); beanDefinition.setAutowireCandidate(true); beanDefinition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_NAME);
ScannedGenericBeanDefinition beanDefinition = Server.getScannedBeanDefinition(rebuilder); beanDefinition.setAutowireCandidate(true); beanDefinition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_NAME);
getScannedBeanDefinition(CommonAnnotationBeanPostProcessor.class.getName())); ScannedGenericBeanDefinition tripleGen = getScannedBeanDefinition(ModelBasedTripleGenerator.class.getName()); tripleGen.setScope(AbstractBeanDefinition.SCOPE_PROTOTYPE); registerBeanDefinition(ModelBasedTripleGenerator.class.getName(), tripleGen);
getScannedBeanDefinition(CommonAnnotationBeanPostProcessor.class.getName())); ScannedGenericBeanDefinition tripleGen = getScannedBeanDefinition(ModelBasedTripleGenerator.class.getName()); tripleGen.setScope(AbstractBeanDefinition.SCOPE_PROTOTYPE); registerBeanDefinition(ModelBasedTripleGenerator.class.getName(), tripleGen);
/** * Generates Spring Bean definitions for Fedora Modules. * Server param should be unnecessary if autowired. * @param className * @param params * @param role * @return */ protected static GenericBeanDefinition createModuleBeanDefinition(String className, Map<String,String> params, String role) throws IOException { ScannedGenericBeanDefinition result = getScannedBeanDefinition(className); result.setParentName(Module.class.getName()); result.setScope(BeanDefinition.SCOPE_SINGLETON); result.setAttribute("id", role); result.setAttribute("name", role); result.setAttribute("init-method", "initModule"); result.setEnforceInitMethod(true); result.setAttribute("destroy-method", "shutdownModule"); result.setEnforceDestroyMethod(true); ConstructorArgumentValues cArgs = new ConstructorArgumentValues(); cArgs.addIndexedArgumentValue(0, params,MODULE_CONSTRUCTOR_PARAM1_CLASS); // one server bean in context BeanReference serverRef = new RuntimeBeanReference(MODULE_CONSTRUCTOR_PARAM2_CLASS); cArgs.addIndexedArgumentValue(1, serverRef); cArgs.addIndexedArgumentValue(2, role,MODULE_CONSTRUCTOR_PARAM3_CLASS); result.setConstructorArgumentValues(cArgs); return result; }
/** * Generates Spring Bean definitions for Fedora Modules. * Server param should be unnecessary if autowired. * @param className * @param params * @param role * @return */ protected static GenericBeanDefinition createModuleBeanDefinition(String className, Map<String,String> params, String role) throws IOException { ScannedGenericBeanDefinition result = getScannedBeanDefinition(className); result.setParentName(Module.class.getName()); result.setScope(BeanDefinition.SCOPE_SINGLETON); result.setAttribute("id", role); result.setAttribute("name", role); result.setAttribute("init-method", "initModule"); result.setEnforceInitMethod(true); result.setAttribute("destroy-method", "shutdownModule"); result.setEnforceDestroyMethod(true); ConstructorArgumentValues cArgs = new ConstructorArgumentValues(); cArgs.addIndexedArgumentValue(0, params,MODULE_CONSTRUCTOR_PARAM1_CLASS); // one server bean in context BeanReference serverRef = new RuntimeBeanReference(MODULE_CONSTRUCTOR_PARAM2_CLASS); cArgs.addIndexedArgumentValue(1, serverRef); cArgs.addIndexedArgumentValue(2, role,MODULE_CONSTRUCTOR_PARAM3_CLASS); result.setConstructorArgumentValues(cArgs); return result; }