List of usage examples for javax.servlet ServletContext setAttribute
public void setAttribute(String name, Object object);
From source file:edu.cornell.mannlib.vitro.webapp.servlet.setup.UpdateKnowledgeBase.java
public void contextInitialized(ServletContextEvent sce) { ServletContext ctx = sce.getServletContext(); StartupStatus ss = StartupStatus.getBean(ctx); boolean migrationChangesMade = false; try {//from w w w.ja v a2 s .com UpdateSettings settings = new UpdateSettings(); putReportingPathsIntoSettings(ctx, settings); putNonReportingPathsIntoSettings(ctx, settings); try { ApplicationUtils.instance().getTBoxReasonerModule().waitForTBoxReasoning(); } catch (Exception e) { // Should mean that the reasoner is not even started yet. } WebappDaoFactory wadf = ModelAccess.on(ctx).getWebappDaoFactory(); settings.setDefaultNamespace(wadf.getDefaultNamespace()); settings.setAssertionOntModelSelector(ModelAccess.on(ctx).getOntModelSelector(ASSERTIONS_ONLY)); settings.setInferenceOntModelSelector(ModelAccess.on(ctx).getOntModelSelector(INFERENCES_ONLY)); settings.setUnionOntModelSelector(ModelAccess.on(ctx).getOntModelSelector()); Path homeDir = ApplicationUtils.instance().getHomeDirectory().getPath(); settings.setDisplayModel(ModelAccess.on(ctx).getOntModel(DISPLAY)); OntModel oldTBoxModel = loadModelFromDirectory(ctx.getRealPath(oldTBoxModelDir())); settings.setOldTBoxModel(oldTBoxModel); OntModel newTBoxModel = loadModelFromDirectory( createDirectory(homeDir, "rdf", "tbox", "filegraph").toString()); settings.setNewTBoxModel(newTBoxModel); OntModel oldTBoxAnnotationsModel = loadModelFromDirectory(ctx.getRealPath(oldTBoxAnnotationsDir())); settings.setOldTBoxAnnotationsModel(oldTBoxAnnotationsModel); OntModel newTBoxAnnotationsModel = loadModelFromDirectory( createDirectory(homeDir, "rdf", "tbox", "firsttime").toString()); settings.setNewTBoxAnnotationsModel(newTBoxAnnotationsModel); settings.setRDFService(ModelAccess.on(ctx).getRDFService()); boolean tryMigrateDisplay = true; try { //Display model tbox and display metadata //old display model tbox model OntModel oldDisplayModelTboxModel = loadModelFromFile(ctx.getRealPath(oldDisplayModelTBoxPath())); settings.setOldDisplayModelTboxModel(oldDisplayModelTboxModel); //new display model tbox model OntModel newDisplayModelTboxModel = loadModelFromFile(ctx.getRealPath(NEW_DISPLAYMODEL_TBOX_PATH)); settings.setNewDisplayModelTboxModel(newDisplayModelTboxModel); //old display model display model metadata OntModel oldDisplayModelDisplayMetadataModel = loadModelFromFile( ctx.getRealPath(oldDisplayModelDisplayMetadataPath())); settings.setOldDisplayModelDisplayMetadataModel(oldDisplayModelDisplayMetadataModel); //new display model display model metadata OntModel newDisplayModelDisplayMetadataModel = loadModelFromFile( ctx.getRealPath(NEW_DISPLAYMODEL_DISPLAYMETADATA_PATH)); settings.setNewDisplayModelDisplayMetadataModel(newDisplayModelDisplayMetadataModel); //Get new display model OntModel newDisplayModelFromFile = loadModelFromFile(ctx.getRealPath(NEW_DISPLAYMODEL_PATH)); settings.setNewDisplayModelFromFile(newDisplayModelFromFile); OntModel loadedAtStartupFiles = loadModelFromDirectory( ctx.getRealPath(LOADED_STARTUPT_DISPLAYMODEL_DIR)); settings.setLoadedAtStartupDisplayModel(loadedAtStartupFiles); OntModel oldDisplayModelVivoListView = loadModelFromFile( ctx.getRealPath(oldDisplayModelVivoListViewPath())); settings.setVivoListViewConfigDisplayModel(oldDisplayModelVivoListView); } catch (ModelFileNotFoundException e) { // expected if no display migration was intended tryMigrateDisplay = false; } catch (Exception e) { log.info("Unable to read display model migration files. ", e); tryMigrateDisplay = false; } KnowledgeBaseUpdater ontologyUpdater = new KnowledgeBaseUpdater(settings); boolean requiredUpdate = ontologyUpdater.updateRequired(ctx); if (requiredUpdate && !JenaDataSourceSetupBase.isFirstStartup()) { try { ctx.setAttribute(KBM_REQURIED_AT_STARTUP, Boolean.TRUE); migrationChangesMade = ontologyUpdater.update(ctx); if (tryMigrateDisplay) { try { migrateDisplayModel(settings); log.info("Migrated display model"); } catch (Exception e) { log.warn("unable to successfully update display model: " + e.getMessage()); } } // reload the display model since the TBoxUpdater may have // modified it new ConfigurationModelsSetup().contextInitialized(sce); } catch (Exception ioe) { ss.fatal(parent, "Exception updating knowledge base for ontology changes: ", ioe); } } removeBadRestrictions(settings.getAssertionOntModelSelector().getTBoxModel()); log.info("Simple reasoner connected for the ABox"); if (JenaDataSourceSetupBase.isFirstStartup() || (migrationChangesMade && requiredUpdate)) { SimpleReasonerSetup.setRecomputeRequired(ctx, SimpleReasonerSetup.RecomputeMode.FOREGROUND); } else if (migrationChangesMade) { SimpleReasonerSetup.setRecomputeRequired(ctx, SimpleReasonerSetup.RecomputeMode.BACKGROUND); } } catch (Throwable t) { ss.fatal(parent, "Exception updating knowledge base for ontology changes: ", t); } }
From source file:net.naijatek.myalumni.modules.admin.presentation.action.MaintainSystemModuleAction.java
public ActionForward setupIntialization(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { logger.debug("in setupIntialization..."); //if (!isTokenValid(request)) { // return mapping.findForward(BaseConstants.FWD_INVALID_TOKEN); //}/*from w w w. j av a 2 s. c om*/ ServletContext sCtx = request.getSession().getServletContext(); ActionMessages msgs = new ActionMessages(); SystemConfigForm systemConfigForm = (SystemConfigForm) form; SystemConfigVO systemConfigVO = new SystemConfigVO(); BeanUtils.copyProperties(systemConfigVO, systemConfigForm); try { DateTime dt = new DateTime(); int year = dt.getYear(); // Admin //INSERT INTO MYALUMNI_MEMBERS_TBL (USER_NAME,MEMBER_ID,MEMBER_STATUS,MEMBER_PASSWORD,EMAIL,FIRST_IP_ADDRESS,LAST_IP_ADDRESS, //CREATION_DATE,LAST_LOGON_DATE,TITLE,NICK_NAME,FIRST_NAME,LAST_NAME,GENDER,FIRST_EMAIL,COUNTRY,YEAR_IN,YEAR_OUT,IS_ADMIN,HIDE_EMAIL,HIDE_ADDRESS,HIDE_PHONE,HIDE_IM,PROMPT_CHANGE,LASTMODIFICATION,LASTMODIFIED_BY,LASTMODIFIED_DATE ) VALUES ('sysadmin', '999999999999999999999999999999','A','X03MO1qnZdYdgyfeuILPmQ==','myalumni@naijatek.com','127.0.0.1','127.0.0.1',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,'1000000004999','NickName','FirstName','LastName','U','myalumni@naijatek.com','1000000003999','2007','2007','Y','Y','Y','Y','Y','Y','A','SYSTEM',CURRENT_TIMESTAMP); MemberVO memberVO = new MemberVO(); memberVO.setMemberUserName(systemConfigVO.getMemberUserName()); memberVO.setLastName(systemConfigVO.getMemberLastName()); memberVO.setFirstName(systemConfigVO.getMemberFirstName()); memberVO.setEmail(systemConfigVO.getMemberEmail()); memberVO.setMemberPassword(systemConfigVO.getMemberPassword()); memberVO.setNickName(""); memberVO.setGender(BaseConstants.GENDER_UNKNOWN); memberVO.setCountryId("1000000003999"); memberVO.setTitleId("1000000004999"); memberVO.setCareerId("1000000001999"); memberVO.setDormitoryId("1000000005999"); memberVO.setYearIn(year); memberVO.setYearOut(year); memberVO.setLastModifiedBy("system"); // create admin memberService.createAdminMember(memberVO, request); final String memberId = memberVO.getMemberId(); String[] s = new String[0]; memberVO.setLstSelectedIMs(s); // Messengers List<MessengerVO> messengers = new ArrayList<MessengerVO>(); MessengerVO mesgerVO = null; for (String str : memberVO.getLstSelectedIMs()) { mesgerVO = new MessengerVO(); mesgerVO.setLastModifiedBy(memberVO.getMemberUserName()); mesgerVO.setMemberId(memberId); mesgerVO.setLookupCodeId(str); messengers.add(mesgerVO); } messengerService.saveAll(messengers, memberId); // Message Folders mfService.createMemberMessageFolders(memberId, SystemConfigConstants.MESSAGE_FOLDERS, memberVO.getMemberUserName()); StringBuffer message = new StringBuffer(); message.append("Thank you " + StringUtil.capitalize(memberVO.getFirstName()) + " " + StringUtil.capitalize(memberVO.getLastName()) + " for setting up MyAlumni and Welcome to " + systemConfigVO.getOrganizationName() + "'s owns space in cyberspace."); setSessionObject(request, BaseConstants.MESSAGE, message.toString()); // send email to registrant try { SendMailUtil.sendWelcomeNotice(memberVO.getEmail(), memberVO.getMemberUserName(), systemConfigVO); } catch (Exception ex) { logger.error(ex.getMessage()); msgs.add(BaseConstants.FATAL_KEY, new ActionMessage("error.mailserver")); saveMessages(request, msgs); } // Scroll ScrollVO scrollVO = new ScrollVO(); scrollVO.setLastModifiedBy("system"); scrollVO.setScrollId(null); scrollVO.setPriority(BaseConstants.BOOLEAN_YES); scrollVO.setScrollText("Welcome to " + systemConfigVO.getOrganizationName()); systemConfigService.addScroll(scrollVO); sCtx.setAttribute(BaseConstants.SCROLL_VO, scrollVO); systemConfigService.setupIntialization(systemConfigVO); sCtx.setAttribute(BaseConstants.ORGANIZATION_NAME, systemConfigVO.getOrganizationName()); sCtx.setAttribute(BaseConstants.ORGANIZATION_SHORT_NAME, systemConfigVO.getOrganizationShortName()); sCtx.setAttribute(BaseConstants.ORG_EMAIL, systemConfigVO.getOrgEmail()); sCtx.setAttribute(BaseConstants.ALBUM_URL, systemConfigVO.getAlbumUrl()); sCtx.setAttribute(BaseConstants.FORUM_URL, systemConfigVO.getForumUrl()); sCtx.setAttribute(BaseConstants.SERVER_URL, systemConfigVO.getServerUrl()); sCtx.setAttribute(BaseConstants.FIRST_STARTUP, BaseConstants.BOOLEAN_NO); } catch (DuplicateMemberException e) { msgs.add(BaseConstants.WARN_KEY, new ActionMessage("error.duplicate.member")); saveMessages(request, msgs); logger.info("DUPLICATE USER NAME - " + e.getMessage()); return mapping.getInputForward(); } catch (DuplicateEmailException e) { msgs.add(BaseConstants.WARN_KEY, new ActionMessage("error.duplicate.email")); saveMessages(request, msgs); logger.info("DUPLICATE EMAIL - " + e.getMessage()); return mapping.getInputForward(); } catch (CreateException e) { msgs.add(BaseConstants.WARN_KEY, new ActionMessage("errors.technical.difficulty")); saveMessages(request, msgs); logger.fatal("SYSTEM ERROR - " + e.getMessage()); return mapping.getInputForward(); } catch (Exception ex) { msgs.add(BaseConstants.FATAL_KEY, new ActionMessage("errors.technical.difficulty")); saveMessages(request, msgs); logger.fatal("SYSTEM ERROR - " + ex.getMessage()); return mapping.getInputForward(); } return mapping.findForward(BaseConstants.FWD_SUCCESS); }
From source file:com.rapid.server.RapidServletContextListener.java
public static int loadActions(ServletContext servletContext) throws Exception { // assume no actions int actionCount = 0; // create a list of json actions which we will sort later List<JSONObject> jsonActions = new ArrayList<JSONObject>(); // retain our class constructors in a hashtable - this speeds up initialisation HashMap<String, Constructor> actionConstructors = new HashMap<String, Constructor>(); // build a collection of classes so we can re-initilise the JAXB context to recognise our injectable classes ArrayList<Action> actions = new ArrayList<Action>(); // get the directory in which the control xml files are stored File dir = new File(servletContext.getRealPath("/WEB-INF/actions/")); // create a filter for finding .control.xml files FilenameFilter xmlFilenameFilter = new FilenameFilter() { public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".action.xml"); }/*ww w . j av a2s .c o m*/ }; // create a schema object for the xsd Schema schema = _schemaFactory .newSchema(new File(servletContext.getRealPath("/WEB-INF/schemas/") + "/action.xsd")); // create a validator Validator validator = schema.newValidator(); // loop the xml files in the folder for (File xmlFile : dir.listFiles(xmlFilenameFilter)) { // get a scanner to read the file Scanner fileScanner = new Scanner(xmlFile).useDelimiter("\\A"); // read the xml into a string String xml = fileScanner.next(); // close the scanner (and file) fileScanner.close(); // validate the control xml file against the schema validator.validate(new StreamSource(new ByteArrayInputStream(xml.getBytes("UTF-8")))); // convert the string into JSON JSONObject jsonActionCollection = org.json.XML.toJSONObject(xml).getJSONObject("actions"); JSONObject jsonAction; int index = 0; int count = 0; // the JSON library will add a single key of there is a single class, otherwise an array if (jsonActionCollection.optJSONArray("action") == null) { jsonAction = jsonActionCollection.getJSONObject("action"); } else { jsonAction = jsonActionCollection.getJSONArray("action").getJSONObject(index); count = jsonActionCollection.getJSONArray("action").length(); } do { // check this type does not already exist for (int i = 0; i < jsonActions.size(); i++) { if (jsonAction.getString("type").equals(jsonActions.get(i).getString("type"))) throw new Exception(" action type is loaded already. Type names must be unique"); } // add the jsonControl to our array jsonActions.add(jsonAction); // get the named type from the json String type = jsonAction.getString("type"); // get the class name from the json String className = jsonAction.getString("class"); // get the class Class classClass = Class.forName(className); // check the class extends com.rapid.Action if (!Classes.extendsClass(classClass, com.rapid.core.Action.class)) throw new Exception(type + " action class " + classClass.getCanonicalName() + " must extend com.rapid.core.Action."); // check this type is unique if (actionConstructors.get(type) != null) throw new Exception(type + " action already loaded. Type names must be unique."); // add to constructors hashmap referenced by type actionConstructors.put(type, classClass.getConstructor(RapidHttpServlet.class, JSONObject.class)); // add to our jaxb classes collection _jaxbClasses.add(classClass); // inc the control count actionCount++; // inc the count of controls in this file index++; // get the next one if (index < count) jsonAction = jsonActionCollection.getJSONArray("control").getJSONObject(index); } while (index < count); } // sort the list of actions by name Collections.sort(jsonActions, new Comparator<JSONObject>() { @Override public int compare(JSONObject c1, JSONObject c2) { try { return Comparators.AsciiCompare(c1.getString("name"), c2.getString("name"), false); } catch (JSONException e) { return 0; } } }); // create a JSON Array object which will hold json for all of the available controls JSONArray jsonArrayActions = new JSONArray(jsonActions); // put the jsonControls in a context attribute (this is available via the getJsonActions method in RapidHttpServlet) servletContext.setAttribute("jsonActions", jsonArrayActions); // put the constructors hashmapin a context attribute (this is available via the getContructor method in RapidHttpServlet) servletContext.setAttribute("actionConstructors", actionConstructors); _logger.info(actionCount + " actions loaded in .action.xml files"); return actionCount; }
From source file:com.liferay.portal.servlet.PortletContextListener.java
public void contextInitialized(ServletContextEvent sce) { try {//from ww w .java 2s . co m // Servlet context ServletContext ctx = sce.getServletContext(); _servletContextName = StringUtil.replace(ctx.getServletContextName(), StringPool.SPACE, StringPool.UNDERLINE); // Company ids _companyIds = StringUtil.split(ctx.getInitParameter("company_id")); // Class loader ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); // Initialize portlets String[] xmls = new String[] { Http.URLtoString(ctx.getResource("/WEB-INF/portlet.xml")), Http.URLtoString(ctx.getResource("/WEB-INF/liferay-portlet.xml")) }; _portlets = PortletManagerUtil.initWAR(_servletContextName, xmls); // Portlet context wrapper Iterator itr1 = _portlets.iterator(); while (itr1.hasNext()) { Portlet portlet = (Portlet) itr1.next(); javax.portlet.Portlet portletInstance = (javax.portlet.Portlet) contextClassLoader .loadClass(portlet.getPortletClass()).newInstance(); Indexer indexerInstance = null; if (Validator.isNotNull(portlet.getIndexerClass())) { indexerInstance = (Indexer) contextClassLoader.loadClass(portlet.getIndexerClass()) .newInstance(); } Scheduler schedulerInstance = null; if (Validator.isNotNull(portlet.getSchedulerClass())) { schedulerInstance = (Scheduler) contextClassLoader.loadClass(portlet.getSchedulerClass()) .newInstance(); } PreferencesValidator prefsValidator = null; if (Validator.isNotNull(portlet.getPreferencesValidator())) { prefsValidator = (PreferencesValidator) contextClassLoader .loadClass(portlet.getPreferencesValidator()).newInstance(); try { if (GetterUtil.getBoolean(PropsUtil.get(PropsUtil.PREFERENCE_VALIDATE_ON_STARTUP))) { prefsValidator.validate( PortletPreferencesSerializer.fromDefaultXML(portlet.getDefaultPreferences())); } } catch (Exception e1) { _log.warn("Portlet with the name " + portlet.getPortletId() + " does not have valid default preferences"); } } Map resourceBundles = null; if (Validator.isNotNull(portlet.getResourceBundle())) { resourceBundles = CollectionFactory.getHashMap(); Iterator itr2 = portlet.getSupportedLocales().iterator(); while (itr2.hasNext()) { String supportedLocale = (String) itr2.next(); Locale locale = new Locale(supportedLocale); try { ResourceBundle resourceBundle = ResourceBundle.getBundle(portlet.getResourceBundle(), locale, contextClassLoader); resourceBundles.put(locale.getLanguage(), resourceBundle); } catch (MissingResourceException mre) { _log.warn(mre.getMessage()); } } } Map customUserAttributes = CollectionFactory.getHashMap(); Iterator itr2 = portlet.getCustomUserAttributes().entrySet().iterator(); while (itr2.hasNext()) { Map.Entry entry = (Map.Entry) itr2.next(); String attrName = (String) entry.getKey(); String attrCustomClass = (String) entry.getValue(); customUserAttributes.put(attrCustomClass, contextClassLoader.loadClass(attrCustomClass).newInstance()); } PortletContextWrapper pcw = new PortletContextWrapper(portlet.getPortletId(), ctx, portletInstance, indexerInstance, schedulerInstance, prefsValidator, resourceBundles, customUserAttributes); PortletContextPool.put(portlet.getPortletId(), pcw); } // Portlet class loader String servletPath = ctx.getRealPath("/"); if (!servletPath.endsWith("/") && !servletPath.endsWith("\\")) { servletPath += "/"; } File servletClasses = new File(servletPath + "WEB-INF/classes"); File servletLib = new File(servletPath + "WEB-INF/lib"); List urls = new ArrayList(); if (servletClasses.exists()) { urls.add(new URL("file:" + servletClasses + "/")); } if (servletLib.exists()) { String[] jars = FileUtil.listFiles(servletLib); for (int i = 0; i < jars.length; i++) { urls.add(new URL("file:" + servletLib + "/" + jars[i])); } } URLClassLoader portletClassLoader = new URLClassLoader((URL[]) urls.toArray(new URL[0]), contextClassLoader); ctx.setAttribute(WebKeys.PORTLET_CLASS_LOADER, portletClassLoader); // Portlet display String xml = Http.URLtoString(ctx.getResource("/WEB-INF/liferay-display.xml")); Map newCategories = PortletManagerUtil.getWARDisplay(_servletContextName, xml); for (int i = 0; i < _companyIds.length; i++) { String companyId = _companyIds[i]; Map oldCategories = (Map) WebAppPool.get(companyId, WebKeys.PORTLET_DISPLAY); Map mergedCategories = PortalUtil.mergeCategories(oldCategories, newCategories); WebAppPool.put(companyId, WebKeys.PORTLET_DISPLAY, mergedCategories); } // Reinitialize portal properties PropsUtil.init(); } catch (Exception e2) { Logger.error(this, e2.getMessage(), e2); } }
From source file:org.red5.server.tomcat.TomcatLoader.java
/** * Starts a web application and its red5 (spring) component. This is * basically a stripped down version of init(). * //from ww w . j a v a 2 s .c om * @return true on success */ public boolean startWebApplication(String applicationName) { log.info("Starting Tomcat - Web application"); boolean result = false; //get a reference to the current threads classloader final ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); log.debug("Webapp root: {}", webappFolder); // application directory String contextName = '/' + applicationName; Container ctx = null; if (webappFolder == null) { // Use default webapps directory webappFolder = System.getProperty("red5.root") + "/webapps"; } System.setProperty("red5.webapp.root", webappFolder); log.info("Application root: {}", webappFolder); // scan for additional webapp contexts // Root applications directory File appDirBase = new File(webappFolder); // check if the context already exists for the host if ((ctx = host.findChild(contextName)) == null) { log.debug("Context did not exist in host"); String webappContextDir = FileUtil.formatPath(appDirBase.getAbsolutePath(), applicationName); log.debug("Webapp context directory (full path): {}", webappContextDir); // set the newly created context as the current container ctx = addContext(contextName, webappContextDir); } else { log.debug("Context already exists in host"); } final ServletContext servletContext = ((Context) ctx).getServletContext(); log.debug("Context initialized: {}", servletContext.getContextPath()); String prefix = servletContext.getRealPath("/"); log.debug("Path: {}", prefix); try { Loader cldr = ctx.getLoader(); log.debug("Loader delegate: {} type: {}", cldr.getDelegate(), cldr.getClass().getName()); if (cldr instanceof WebappLoader) { log.debug("WebappLoader class path: {}", ((WebappLoader) cldr).getClasspath()); } final ClassLoader webClassLoader = cldr.getClassLoader(); log.debug("Webapp classloader: {}", webClassLoader); // get the (spring) config file path final String contextConfigLocation = servletContext.getInitParameter("contextConfigLocation") == null ? defaultSpringConfigLocation : servletContext.getInitParameter("contextConfigLocation"); log.debug("Spring context config location: {}", contextConfigLocation); // get the (spring) parent context key final String parentContextKey = servletContext.getInitParameter("parentContextKey") == null ? defaultParentContextKey : servletContext.getInitParameter("parentContextKey"); log.debug("Spring parent context key: {}", parentContextKey); //set current threads classloader to the webapp classloader Thread.currentThread().setContextClassLoader(webClassLoader); //create a thread to speed-up application loading Thread thread = new Thread("Launcher:" + servletContext.getContextPath()) { @SuppressWarnings("cast") public void run() { //set current threads classloader to the webapp classloader Thread.currentThread().setContextClassLoader(webClassLoader); // create a spring web application context XmlWebApplicationContext appctx = new XmlWebApplicationContext(); appctx.setClassLoader(webClassLoader); appctx.setConfigLocations(new String[] { contextConfigLocation }); // check for red5 context bean ApplicationContext parentAppCtx = null; if (applicationContext.containsBean(defaultParentContextKey)) { parentAppCtx = (ApplicationContext) applicationContext.getBean(defaultParentContextKey); } else { log.warn("{} bean was not found in context: {}", defaultParentContextKey, applicationContext.getDisplayName()); // lookup context loader and attempt to get what we need from it if (applicationContext.containsBean("context.loader")) { ContextLoader contextLoader = (ContextLoader) applicationContext .getBean("context.loader"); parentAppCtx = contextLoader.getContext(defaultParentContextKey); } else { log.debug("Context loader was not found, trying JMX"); MBeanServer mbs = JMXFactory.getMBeanServer(); // get the ContextLoader from jmx ObjectName oName = JMXFactory.createObjectName("type", "ContextLoader"); ContextLoaderMBean proxy = null; if (mbs.isRegistered(oName)) { proxy = (ContextLoaderMBean) MBeanServerInvocationHandler.newProxyInstance(mbs, oName, ContextLoaderMBean.class, true); log.debug("Context loader was found"); parentAppCtx = proxy.getContext(defaultParentContextKey); } else { log.warn("Context loader was not found"); } } } if (log.isDebugEnabled()) { if (appctx.getParent() != null) { log.debug("Parent application context: {}", appctx.getParent().getDisplayName()); } } appctx.setParent(parentAppCtx); appctx.setServletContext(servletContext); // set the root webapp ctx attr on the each // servlet context so spring can find it later servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, appctx); appctx.refresh(); } }; thread.setDaemon(true); thread.start(); result = true; } catch (Throwable t) { log.error("Error setting up context: {} due to: {}", servletContext.getContextPath(), t.getMessage()); t.printStackTrace(); } finally { //reset the classloader Thread.currentThread().setContextClassLoader(originalClassLoader); } return result; }
From source file:net.wastl.webmail.config.ExtConfigListener.java
public void contextInitialized(ServletContextEvent sce) { Helper.logThreads("Top of ExtCongigListener.contextInitialized()"); final ServletContext sc = sce.getServletContext(); contextPath = sc.getInitParameter("default.contextpath"); try {//from ww w . ja v a 2s. c o m final Object o = new InitialContext().lookup("java:comp/env/app.contextpath"); contextPath = (String) o; log.debug("app.contextpath set by webapp env property"); } catch (final NameNotFoundException nnfe) { } catch (final NamingException nnfe) { log.fatal("Runtime failure when looking up env property", nnfe); throw new RuntimeException("Runtime failure when looking up env property", nnfe); } if (contextPath == null) { log.fatal("Required setting 'app.contextpath' is not set as either " + "a app webapp JNDI env param, nor by default context " + "init parameter 'default.contextpath'"); throw new IllegalStateException("Required setting 'app.contextpath' is not set as either " + "a app webapp JNDI env param, nor by default context " + "init parameter 'default.contextpath'"); } if (contextPath.equals("/ROOT")) { log.fatal("Refusing to use context path of '/ROOT' to avoid " + "ambiguity with default context path"); throw new IllegalStateException( "Refusing to use context path of '/ROOT' to avoid " + "ambiguity with default context path"); } deploymentName = generateDeploymentName(); log.info("Initializing configs for runtime deployment name '" + deploymentName + "'"); String dirProp = System.getProperty("webapps.rtconfig.dir"); if (dirProp == null) { dirProp = System.getProperty("user.home"); System.setProperty("webapps.rtconfig.dir", dirProp); } final File rtConfigDir = new File(dirProp, deploymentName); final File metaFile = new File(rtConfigDir, "meta.properties"); lockFile = new File(rtConfigDir, "lock.txt"); if (lockFile.exists()) { log.fatal("Presence of lock file '" + lockFile.getAbsolutePath() + "' indicates the instance is already running"); lockFile = null; throw new IllegalStateException("Presence of lock file " + "indicates the instance is already running"); } // From this point on, we know that: // IF LOCK FILE EXISTS, we have created it and all is well // IF LOCK FILE DOES NOT EXIST, we need to create it ASAP if (rtConfigDir.isDirectory()) { mkLockFile(); } // We create lock file as early as possible. // If we can't make it here, it will be created in installXmlStorage. if (!rtConfigDir.isDirectory() || !metaFile.isFile()) { try { installXmlStorage(rtConfigDir, metaFile); log.warn("New XML storage system successfully loaded. " + "Metadata file '" + metaFile.getAbsolutePath() + "'"); } catch (final IOException e) { log.fatal("Failed to set up a new XML storage system", e); throw new IllegalStateException("Failed to set up a new XML storage system", e); } } if (!lockFile.exists()) { // Being extra safe log.fatal("Assertion failed. Internal locking error in " + getClass().getName() + '.'); lockFile = null; throw new IllegalStateException( "Assertion failed. Internal locking error in " + getClass().getName() + '.'); } final ExpandableProperties metaProperties = new ExpandableProperties(); try { metaProperties.load(new FileInputStream(metaFile)); } catch (final IOException ioe) { log.fatal("Failed to read meta props file '" + metaFile.getAbsolutePath() + "'", ioe); throw new IllegalStateException("Failed to read meta props file '" + metaFile.getAbsolutePath() + "'", ioe); } final Properties expandProps = new Properties(); expandProps.setProperty("rtconfig.dir", rtConfigDir.getAbsolutePath()); expandProps.setProperty("app.contextpath", contextPath); expandProps.setProperty("deployment.name", deploymentName); try { metaProperties.expand(expandProps); // Expand ${} properties } catch (final Throwable t) { log.fatal("Failed to expand properties in meta file '" + metaFile.getAbsolutePath() + "'", t); throw new IllegalStateException( "Failed to expand properties in meta file '" + metaFile.getAbsolutePath() + "'", t); } String requiredKeysString; requiredKeysString = sc.getInitParameter("required.metaprop.keys"); if (requiredKeysString != null) { final Set<String> requiredKeys = new HashSet<String>( Arrays.asList(requiredKeysString.split("\\s*,\\s*", -1))); requiredKeys.removeAll(metaProperties.keySet()); if (requiredKeys.size() > 0) { log.fatal("Meta properties file '" + metaFile.getAbsolutePath() + "' missing required property(s): " + requiredKeys); throw new IllegalStateException("Meta properties file '" + metaFile.getAbsolutePath() + "' missing required property(s): " + requiredKeys); } } sc.setAttribute("app.contextpath", contextPath); sc.setAttribute("deployment.name", deploymentName); sc.setAttribute("rtconfig.dir", rtConfigDir); sc.setAttribute("meta.properties", metaProperties); log.debug("'app.contextpath', 'rtconfig.dir', 'meta.properties' " + "successfully published to app context for " + deploymentName); }
From source file:org.apache.marmotta.platform.core.startup.MarmottaStartupService.java
/** * Startup the Apache Marmotta Configuration. This method ensures that the Apache Marmotta home directory is created and the * ConfigurationService is properly initialised. It must be called first in the startup sequence. * The parameters home and configurationOverride can be used to override the default settings * of the Apache Marmotta.// ww w . ja v a 2 s . c om * * @param home home directory of the Apache Marmotta instance (may be null, in which case the default will be used) * @param configurationOverride configuration options that should override the default values from default-config.properties (may be null) * @param context the servlet context the Apache Marmotta is running in (may be null) */ public void startupConfiguration(String home, Configuration configurationOverride, ServletContext context) { lock.lock(); //to set config version number String versionNumber = DEFAULT_KIWI_VERSION; try { if (configurationStarted) { log.warn("Apache Marmotta Startup: configuration already started; ignoring second request"); return; } ModuleConfiguration coreConfiguration = moduleService.getModuleConfiguration(this.getClass()); if (coreConfiguration.hasBuildInfo()) { log.info("Apache Marmotta Core Version {} starting up ... ", coreConfiguration.getModuleVersion()); log.info("Build Information:"); log.info(" - Build User: {}", coreConfiguration.getBuildUser()); log.info(" - Build Host: {}", coreConfiguration.getBuildHost()); log.info(" - Build Time: {}", coreConfiguration.getBuildTimestamp()); log.info(" - Build OS: {}", coreConfiguration.getBuildOS()); log.info(" - Revision: {}", coreConfiguration.getBuildRevisionHash()); versionNumber = coreConfiguration.getModuleVersion(); } else { log.info("Apache Marmotta Core (Development Version) starting up ... "); } //TODO: refactor this code if (StringUtils.isBlank(home)) { home = System.getProperty("marmotta.home"); if (StringUtils.isNotBlank(home)) { log.info("Configured working directory {} from system property marmotta.home", home); } else { home = System.getProperty("lmf.home"); if (StringUtils.isNotBlank(home)) { log.info("Configured working directory {} from system property lmf.home", home); } else { home = System.getProperty("kiwi.home"); if (StringUtils.isNotBlank(home)) { log.info("Configured working directory {} from system property kiwi.home", home); } else { home = System.getenv("MARMOTTA_HOME"); if (StringUtils.isNotBlank(home)) { log.info("Configured working directory {} from environment variable MARMOTTA_HOME", home); } else { home = System.getenv("LMF_HOME"); if (StringUtils.isNotBlank(home)) { log.info("Configured working directory {} from environment variable LMF_HOME", home); } else { home = System.getenv("KIWI_HOME"); if (StringUtils.isNotBlank(home)) { log.info( "Configured working directory {} from environment variable KIWI_HOME", home); } else { if (context != null) { home = context.getInitParameter("marmotta.home"); if (StringUtils.isNotBlank(home)) { log.info( "Configured working directory {} from servlet context parameter marmotta.home", home); } } else { log.error( "could not determine Apache Marmotta home directory, please set the environment variable MARMOTTA_HOME"); } } } } } } } } if (StringUtils.isNotBlank(home)) { if (home.startsWith("~" + File.separator)) { home = System.getProperty("user.home") + home.substring(1); } configurationService.setHome(home); } else { log.error("home directory not properly initialized!!!"); } if (context != null) { configurationService.setServletContext(context); } configurationService.initialize(home, configurationOverride); configurationService.setConfiguration("kiwi.version", versionNumber); if (context != null) { configurationService.setConfiguration("kiwi.path", context.getContextPath()); // register the systray links provided by the different components Map<String, String> demoLinks = new HashMap<>(); Map<String, String> adminLinks = new HashMap<>(); for (MarmottaSystrayLink link : CDIContext.getInstances(MarmottaSystrayLink.class)) { if (link.getSection() == MarmottaSystrayLink.Section.DEMO) { demoLinks.put(link.getLabel(), link.getLink()); } else if (link.getSection() == MarmottaSystrayLink.Section.ADMIN) { adminLinks.put(link.getLabel(), link.getLink()); } } context.setAttribute("systray.admin", adminLinks); context.setAttribute("systray.demo", demoLinks); } configurationStarted = true; } finally { lock.unlock(); } }
From source file:com.redsqirl.auth.UserInfoBean.java
/** * login// w w w .j a v a 2 s. c o m * * Method to validate permission of the user and call init. * * @return String - success or failure * @author Igor.Souza */ public String login() { logger.warn("login"); setMsnError(null); cancel = false; checkPassword = false; buildBackend = true; setAlreadySignedInOtherMachine(null); setAlreadySignedIn(null); String licenseKey = null; String licence = ""; if (getUserName() == null || "".equals(getUserName())) { setMsnError(getMessageResources("login_error_user_required")); return "failure"; } if (getPassword() == null || "".equals(getPassword())) { setMsnError(getMessageResources("login_error_password_required")); return "failure"; } FacesContext fCtx = FacesContext.getCurrentInstance(); ServletContext sc = (ServletContext) fCtx.getExternalContext().getContext(); HttpSession session = (HttpSession) fCtx.getExternalContext().getSession(true); try { Connection conn = new Connection(hostname); conn.connect(); if (conn.isAuthMethodAvailable(userName, "publickey")) { logger.debug("--> public key auth method supported by server"); } else { logger.debug("--> public key auth method not supported by server"); } if (conn.isAuthMethodAvailable(userName, "keyboard-interactive")) { logger.debug("--> keyboard interactive auth method supported by server"); } else { logger.debug("--> keyboard interactive auth method not supported by server"); } if (conn.isAuthMethodAvailable(userName, "password")) { logger.debug("--> password auth method supported by server"); } else { logger.warn("--> password auth method not supported by server"); } checkPassword = conn.authenticateWithPassword(userName, password); if (!checkPassword) { setMsnError("Authentication Error"); setAlreadySignedInOtherMachine(null); logger.warn("Authentication Error"); return "failure"; } try { File licenseP = new File(WorkflowPrefManager.getPathSystemLicence()); logger.warn("path licence " + WorkflowPrefManager.getPathSystemLicence()); Properties props = new Properties(); logger.warn(ProjectID.get()); String[] value = ProjectID.get().trim().split("-"); if (value != null && value.length > 1) { licenseKey = value[0].replaceAll("[0-9]", "") + value[value.length - 1]; if (licenseP.exists()) { props.load(new FileInputStream(licenseP)); logger.warn(props.toString()); licenseKey = licenseKey.replaceAll("[^A-Za-z0-9]", "").toLowerCase(); logger.warn(licenseKey); licence = props.getProperty(licenseKey); } else { setMsnError("Could not find license key"); logger.warn("Could not find license key"); invalidateSession(); return "failure"; } if (licence == null || licence.isEmpty()) { setMsnError("License key was empty"); logger.warn("License key was empty"); invalidateSession(); return "failure"; } Decrypter decrypt = new Decrypter(); decrypt.decrypt(licence); //setNumberCluster(decrypt.getNumberCluster()); /*File file = new File(WorkflowPrefManager.getPathUsersFolder()); int homes = 0; if(file.exists()){ homes = file.list().length; }*/ Map<String, String> params = new HashMap<String, String>(); //params.put(Decrypter.clusterNb, String.valueOf(homes)); //params.put(Decrypter.mac, decrypt.getMACAddress()); params.put(Decrypter.name, licenseKey); DateFormat formatter = new SimpleDateFormat("yyyy/MM/dd"); params.put(Decrypter.date, formatter.format(new Date())); if (!decrypt.validateExpiredKey(params)) { setMsnError("License Key is expired"); logger.warn("License Key is expired"); invalidateSession(); return "failure"; } boolean valid = decrypt.validateAllValuesSoft(params); if (!valid) { setMsnError("License Key is Invalid"); logger.warn("License Key is Invalid"); invalidateSession(); return "failure"; } } else { setMsnError("Project Version is Invalid"); logger.warn("Project Version is Invalid"); invalidateSession(); return "failure"; } } catch (Exception e) { logger.error(e.getMessage(), e); setMsnError("Failed to get license"); invalidateSession(); return "failure"; } } catch (IOException e) { logger.error(e.getMessage(), e); invalidateSession(); setMsnError("error - Please Contact Your Administrator"); return "failure"; } UsageRecordWriter usageRecordLog = new UsageRecordWriter(licence, userName); Map<String, UsageRecordWriter> sessionUsageRecordWriter = (Map<String, UsageRecordWriter>) sc .getAttribute("usageRecordLog"); if (sessionUsageRecordWriter == null) { sessionUsageRecordWriter = new HashMap<String, UsageRecordWriter>(); } sessionUsageRecordWriter.put(userName, usageRecordLog); sc.setAttribute("usageRecordLog", sessionUsageRecordWriter); @SuppressWarnings("unchecked") Map<String, HttpSession> sessionLoginMap = (Map<String, HttpSession>) sc.getAttribute("sessionLoginMap"); HttpSession sessionLogin = sessionLoginMap.get(userName); if (sessionLogin != null) { logger.warn("validateSecondLogin sessionLogin"); if (sessionLogin.getId().equals(session.getId())) { setAlreadySignedInOtherMachine(null); setAlreadySignedIn("twice"); logger.warn("Already Authenticated twice"); usageRecordLog().addError("ERROR LOGIN", "Already Authenticated twice"); return "failure"; } else if (forceSignIn.equalsIgnoreCase("T")) { //Invalidate the session invalidateSession(sessionLogin); } else { setAlreadySignedInOtherMachine("two"); logger.warn("Already Authenticated two"); usageRecordLog().addError("ERROR LOGIN", "Already Authenticated two"); return "failure"; } } logger.info("update progressbar"); setValueProgressBar(5); logger.info("validateSecondLogin end"); usageRecordLog().addSuccess("LOGIN"); return init(); }
From source file:gov.nih.nci.cadsr.sentinel.database.DBAlertOracle.java
static private synchronized int setupPoolX(HttpSession session_, String dsurl_, String username_, String password_) {/*from ww w .ja v a 2 s.c o m*/ // Get the Servlet Context and see if a pool already exists. ServletContext sc = session_.getServletContext(); if (sc.getAttribute(DBAlert._DATASOURCE) != null) return 0; OracleConnectionPoolDataSource ocpds = (OracleConnectionPoolDataSource) sc.getAttribute(_DBPOOL); if (ocpds != null) return 0; ocpds = setupPool(dsurl_, username_, password_); if (ocpds != null) { // Remember the pool in the Servlet Context. sc.setAttribute(_DBPOOL + ".ds", ocpds); sc.setAttribute(_DBPOOL + ".user", username_); sc.setAttribute(_DBPOOL + ".pswd", password_); return 0; } return -1; }
From source file:edu.cornell.mannlib.vitro.webapp.servlet.setup.WebappDaoSetup.java
private void setUpJenaDataSource(ServletContext ctx, StartupStatus ss) { OntModelSelectorImpl baseOms = new OntModelSelectorImpl(); OntModelSelectorImpl inferenceOms = new OntModelSelectorImpl(); OntModelSelectorImpl unionOms = new OntModelSelectorImpl(); OntModel userAccountsModel = ontModelFromContextAttribute(ctx, "userAccountsOntModel"); baseOms.setUserAccountsModel(userAccountsModel); inferenceOms.setUserAccountsModel(userAccountsModel); unionOms.setUserAccountsModel(userAccountsModel); OntModel displayModel = ontModelFromContextAttribute(ctx, DISPLAY_ONT_MODEL); baseOms.setDisplayModel(displayModel); inferenceOms.setDisplayModel(displayModel); unionOms.setDisplayModel(displayModel); RDFServiceFactory rdfServiceFactory = RDFServiceUtils.getRDFServiceFactory(ctx); RDFService rdfService = rdfServiceFactory.getRDFService(); Dataset dataset = new RDFServiceDataset(rdfService); setStartupDataset(dataset, ctx);//from www. ja v a2 s . c o m // ABox assertions Model aboxAssertions = dataset.getNamedModel(JenaDataSourceSetupBase.JENA_DB_MODEL); baseOms.setABoxModel(ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, aboxAssertions)); // ABox inferences Model aboxInferences = dataset.getNamedModel(JenaDataSourceSetupBase.JENA_INF_MODEL); inferenceOms.setABoxModel(ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, aboxInferences)); // TBox assertions try { Model tboxAssertionsDB = dataset.getNamedModel(JENA_TBOX_ASSERTIONS_MODEL); OntModel tboxAssertions = ModelFactory.createOntologyModel(MEM_ONT_MODEL_SPEC); if (tboxAssertionsDB != null) { long startTime = System.currentTimeMillis(); System.out.println("Copying cached tbox assertions into memory"); tboxAssertions.add(tboxAssertionsDB); System.out.println( (System.currentTimeMillis() - startTime) / 1000 + " seconds to load tbox assertions"); } tboxAssertions.getBaseModel().register(new ModelSynchronizer(tboxAssertionsDB)); baseOms.setTBoxModel(tboxAssertions); } catch (Throwable e) { log.error("Unable to load tbox assertion cache from DB", e); throw new RuntimeException(e); } // TBox inferences try { Model tboxInferencesDB = dataset.getNamedModel(JENA_TBOX_INF_MODEL); OntModel tboxInferences = ModelFactory.createOntologyModel(MEM_ONT_MODEL_SPEC); if (tboxInferencesDB != null) { long startTime = System.currentTimeMillis(); System.out.println("Copying cached tbox inferences into memory"); tboxInferences.add(tboxInferencesDB); System.out.println( (System.currentTimeMillis() - startTime) / 1000 + " seconds to load tbox inferences"); } tboxInferences.getBaseModel().register(new ModelSynchronizer(tboxInferencesDB)); inferenceOms.setTBoxModel(tboxInferences); } catch (Throwable e) { log.error("Unable to load tbox inference cache from DB", e); throw new RuntimeException(e); } // union ABox Model m = ModelFactory.createUnion(baseOms.getABoxModel(), inferenceOms.getABoxModel()); m = ModelFactory.createModelForGraph(new SpecialBulkUpdateHandlerGraph(m.getGraph(), baseOms.getABoxModel().getGraph().getBulkUpdateHandler())); OntModel unionABoxModel = ModelFactory.createOntologyModel(MEM_ONT_MODEL_SPEC, m); unionOms.setABoxModel(unionABoxModel); // union TBox m = ModelFactory.createUnion(baseOms.getTBoxModel(), inferenceOms.getTBoxModel()); m = ModelFactory.createModelForGraph(new SpecialBulkUpdateHandlerGraph(m.getGraph(), baseOms.getTBoxModel().getGraph().getBulkUpdateHandler())); OntModel unionTBoxModel = ModelFactory.createOntologyModel(MEM_ONT_MODEL_SPEC, m); unionOms.setTBoxModel(unionTBoxModel); // Application metadata model is cached in memory. try { Model applicationMetadataModelDB = dataset.getNamedModel(JENA_APPLICATION_METADATA_MODEL); OntModel applicationMetadataModel = ModelFactory.createOntologyModel(MEM_ONT_MODEL_SPEC); long startTime = System.currentTimeMillis(); System.out.println("Copying cached application metadata model into memory"); applicationMetadataModel.add(applicationMetadataModelDB); System.out.println( (System.currentTimeMillis() - startTime) / 1000 + " seconds to load application metadata model " + "assertions of size " + applicationMetadataModel.size()); applicationMetadataModel.getBaseModel().register(new ModelSynchronizer(applicationMetadataModelDB)); if (applicationMetadataModel.size() == 0 /* isFirstStartup() */) { JenaDataSourceSetupBase.thisIsFirstStartup(); applicationMetadataModel.add(InitialJenaModelUtils.loadInitialModel(ctx, getDefaultNamespace(ctx))); } baseOms.setApplicationMetadataModel(applicationMetadataModel); inferenceOms.setApplicationMetadataModel(baseOms.getApplicationMetadataModel()); unionOms.setApplicationMetadataModel(baseOms.getApplicationMetadataModel()); } catch (Throwable e) { log.error("Unable to load application metadata model cache from DB", e); throw new RuntimeException(e); } checkForNamespaceMismatch(baseOms.getApplicationMetadataModel(), ctx); if (isFirstStartup()) { loadDataFromFilesystem(baseOms, ctx); } log.info("Setting up union models and DAO factories"); // create TBox + ABox union models and set up webapp DAO factories Model baseDynamicUnion = ModelFactory.createUnion(baseOms.getABoxModel(), baseOms.getTBoxModel()); baseDynamicUnion = ModelFactory.createModelForGraph(new SpecialBulkUpdateHandlerGraph( baseDynamicUnion.getGraph(), baseOms.getABoxModel().getGraph().getBulkUpdateHandler())); OntModel baseUnion = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, baseDynamicUnion); baseOms.setFullModel(baseUnion); ModelContext.setBaseOntModel(baseOms.getFullModel(), ctx); WebappDaoFactoryConfig config = new WebappDaoFactoryConfig(); config.setDefaultNamespace(getDefaultNamespace(ctx)); WebappDaoFactory baseWadf = new WebappDaoFactorySDB(rdfService, baseOms, config, WebappDaoFactorySDB.SDBDatasetMode.ASSERTIONS_ONLY); ctx.setAttribute("assertionsWebappDaoFactory", baseWadf); OntModel inferenceUnion = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, ModelFactory.createUnion(inferenceOms.getABoxModel(), inferenceOms.getTBoxModel())); inferenceOms.setFullModel(inferenceUnion); ModelContext.setInferenceOntModel(inferenceOms.getFullModel(), ctx); WebappDaoFactory infWadf = new WebappDaoFactorySDB(rdfService, inferenceOms, config, WebappDaoFactorySDB.SDBDatasetMode.INFERENCES_ONLY); ctx.setAttribute("deductionsWebappDaoFactory", infWadf); OntModel masterUnion = ModelFactory.createOntologyModel(DB_ONT_MODEL_SPEC, dataset.getDefaultModel()); unionOms.setFullModel(masterUnion); ctx.setAttribute("jenaOntModel", masterUnion); WebappDaoFactory wadf = new WebappDaoFactorySDB(rdfService, unionOms, config); ctx.setAttribute("webappDaoFactory", wadf); ModelContext.setOntModelSelector(unionOms, ctx); ModelContext.setUnionOntModelSelector(unionOms, ctx); // assertions and inferences ModelContext.setBaseOntModelSelector(baseOms, ctx); // assertions ModelContext.setInferenceOntModelSelector(inferenceOms, ctx); // inferences ctx.setAttribute("defaultNamespace", getDefaultNamespace(ctx)); makeModelMakerFromConnectionProperties(TripleStoreType.RDB, ctx); VitroJenaModelMaker vjmm = getVitroJenaModelMaker(); setVitroJenaModelMaker(vjmm, ctx); makeModelMakerFromConnectionProperties(TripleStoreType.SDB, ctx); RDFServiceModelMaker vsmm = new RDFServiceModelMaker(rdfServiceFactory); setVitroJenaSDBModelMaker(vsmm, ctx); //bdc34: I have no reason for vsmm vs vjmm. //I don't know what are the implications of this choice. setVitroModelSource(new VitroModelSource(vsmm, ctx), ctx); log.info("Model makers set up"); }