/** * Creates a clone of this context info object.<p> * * @see java.lang.Object#clone() */ @Override public Object clone() { CmsContextInfo result = new CmsContextInfo(); result.m_encoding = m_encoding; result.m_frozen = false; result.m_locale = m_locale; result.m_localeName = m_localeName; result.m_project = m_project; result.m_projectName = m_projectName; result.m_remoteAddr = m_remoteAddr; result.m_requestedUri = m_requestedUri; result.m_requestTime = m_requestTime; result.m_siteRoot = m_siteRoot; result.m_user = m_user; result.m_userName = m_userName; return result; }
CmsUser user = contextInfo.getUser(); if (user == null) { user = m_securityManager.readUser(null, contextInfo.getUserName()); CmsProject project = contextInfo.getProject(); if (project == null) { project = m_securityManager.readProject(contextInfo.getProjectName()); user, project, contextInfo.getRequestedUri(), contextInfo.getRequestMatcher(), contextInfo.getSiteRoot(), contextInfo.isSecureRequest(), contextInfo.getLocale(), contextInfo.getEncoding(), contextInfo.getRemoteAddr(), contextInfo.getRequestTime(), m_resourceManager.getFolderTranslator(), m_resourceManager.getFileTranslator(), contextInfo.getOuFqn()); context.setDetailResource(contextInfo.getDetailResource());
/** * Creates a new instance, initializing the variables with some reasonable default values.<p> * * The default values are:<dl> * <dt>User name</dt><dd>(configured default guest user)</dd> * <dt>Project name</dt><dd>Online</dd> * <dt>Requested URI</dt><dd>/</dd> * <dt>Site root</dt><dd>/</dd> * <dt>Locale name</dt><dd>(configured default locale name)</dd> * <dt>Encoding</dt><dd>(configured default system encoding)</dd> * <dt>Remote address</dt><dd>127.0.0.1</dd> * <dt>Organizational unit</dt><dd>/</dd> * </dl><p> */ public CmsContextInfo() { setUserName(OpenCms.getDefaultUsers().getUserGuest()); setProjectName(CmsProject.ONLINE_PROJECT_NAME); setRequestedUri("/"); setSiteRoot("/"); setLocaleName(CmsLocaleManager.getDefaultLocale().toString()); setEncoding(OpenCms.getSystemInfo().getDefaultEncoding()); setRemoteAddr(CmsContextInfo.LOCALHOST); setRequestTime(CURRENT_TIME); setOuFqn(""); }
CmsUser user = contextInfo.getUser(); if (user == null) { user = m_securityManager.readUser(null, contextInfo.getUserName()); CmsProject project = contextInfo.getProject(); if (project == null) { project = m_securityManager.readProject(contextInfo.getProjectName()); user, project, contextInfo.getRequestedUri(), contextInfo.getSiteRoot(), contextInfo.getLocale(), contextInfo.getEncoding(), contextInfo.getRemoteAddr(), contextInfo.getRequestTime(), m_resourceManager.getFolderTranslator(), m_resourceManager.getFileTranslator(),
html.append("\t\t<td class='listdetailitem'>\n"); html.append("\t\t\t"); html.append(info.getUserName()); html.append("\n"); html.append("\t\t</td>\n"); html.append("\t\t<td class='listdetailitem'>\n"); html.append("\t\t\t"); html.append(info.getProjectName()); html.append("\n"); html.append("\t\t</td>\n"); html.append("\t\t<td class='listdetailitem'>\n"); html.append("\t\t\t"); html.append(info.getLocaleName()); html.append("\n"); html.append("\t\t</td>\n"); html.append("\t\t<td class='listdetailitem'>\n"); html.append("\t\t\t"); html.append(info.getSiteRoot()); html.append("\n"); html.append("\t\t</td>\n"); html.append("\t\t<td class='listdetailitem'>\n"); html.append("\t\t\t"); html.append(info.getRequestedUri()); html.append("\n"); html.append("\t\t</td>\n");
CmsContextInfo dC = new CmsContextInfo(); m_jobInfo, "contextInfo.siteRoot", dC.getSiteRoot(), PAGES[0], new CmsVfsFileWidget(), m_jobInfo, "contextInfo.requestedUri", dC.getRequestedUri(), PAGES[0], new CmsVfsFileWidget(), m_jobInfo, "contextInfo.localeName", dC.getLocaleName(), PAGES[0], new CmsInputWidget(), m_jobInfo, "contextInfo.encoding", dC.getEncoding(), PAGES[0], new CmsInputWidget(), m_jobInfo, "contextInfo.remoteAddr", dC.getRemoteAddr(),
CmsContextInfo contextInfo = new CmsContextInfo(); contextInfo.setProjectName(tmpProject.getName()); contextInfo.setUserName(cmsAdmin.getRequestContext().getCurrentUser().getName());
CmsContextInfo contextInfo = new CmsContextInfo(m_adminCms.getRequestContext()); contextInfo.setUserName(principal); CmsObject newCms = initCmsObject(m_adminCms, contextInfo); if ((contextInfo.getRequestedUri().startsWith("/system/workplace/")
/** * Revives this publish job.<p> * * @param adminCms an admin cms object * @param publishList a publish list * * @throws CmsException if something goes wrong */ public void revive(CmsObject adminCms, CmsPublishList publishList) throws CmsException { CmsContextInfo context = new CmsContextInfo(adminCms.readUser(m_userId).getName()); CmsProject project = adminCms.readProject(m_projectId); context.setLocale(m_locale); m_cms = OpenCms.initCmsObject(adminCms, context); m_cms.getRequestContext().setCurrentProject(project); m_publishList = publishList; m_publishList.revive(m_cms); }
/** * Returns an independent copy of the provided CmsObject.<p> * * This can be useful in case a permanent reference to a CmsObject is stored. * Changing the request context values (for example project, siteroot) in the new CmsObject * will have no side effects to the CmsObject it was copied form.<p> * * The request time (<code>{@link CmsRequestContext#getRequestTime()}</code>) * is set to the current time.<p> * * @param cms the CmsObject to create a copy of * * @return an independent copy of the provided CmsObject * * @throws CmsException in case the initialization failed * * @see OpenCms#initCmsObject(CmsObject) * @see OpenCms#initCmsObject(CmsObject, CmsContextInfo) * @see OpenCms#initCmsObject(String) */ protected CmsObject initCmsObject(CmsObject cms) throws CmsException { CmsContextInfo contextInfo = new CmsContextInfo(cms.getRequestContext()); contextInfo.setRequestTime(CmsContextInfo.CURRENT_TIME); return initCmsObject(contextInfo); }
/** * Creates a CmsObjectWrapper for the current session.<p> * * @param session the current session * @param connection the tree connection * * @return the correctly configured CmsObjectWrapper for this session * * @throws CmsException if something goes wrong */ public CmsObjectWrapper getCms(SrvSession session, TreeConnection connection) throws CmsException { String userName = session.getClientInformation().getUserName(); userName = CmsJlanUsers.translateUser(userName); CmsContextInfo contextInfo = new CmsContextInfo(m_cms.getRequestContext()); contextInfo.setUserName(userName); CmsObject newCms = OpenCms.initCmsObject(m_cms, contextInfo); newCms.getRequestContext().setSiteRoot(getRoot()); newCms.getRequestContext().setCurrentProject(getProject()); CmsObjectWrapper result = new CmsObjectWrapper(newCms, getWrappers()); result.setAddByteOrderMark(m_addByteOrderMark); result.getRequestContext().setAttribute(CmsXmlContent.AUTO_CORRECTION_ATTRIBUTE, Boolean.TRUE); return result; }
/** * Adds a new job description for the scheduler.<p> * * @param jobInfo the job description to add */ public void addJobFromConfiguration(CmsScheduledJobInfo jobInfo) { m_configuredJobs.add(jobInfo); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key( Messages.INIT_SCHEDULER_CONFIG_JOB_3, jobInfo.getJobName(), jobInfo.getClassName(), jobInfo.getContextInfo().getUserName())); } }
/** * Creates a new instance, initializing the user name as provided and * all other vaiables with the same default values as in {@link #CmsContextInfo()}.<p> * * @param userName the user name to create the context with * * @see #CmsContextInfo() */ public CmsContextInfo(String userName) { this(); setUserName(userName); }
jobElement.addElement(N_CRONEXPRESSION).addCDATA(jobInfo.getCronExpression()); Element contextElement = jobElement.addElement(N_CONTEXT); contextElement.addElement(N_USERNAME).setText(jobInfo.getContextInfo().getUserName()); contextElement.addElement(N_PROJECT).setText(jobInfo.getContextInfo().getProjectName()); contextElement.addElement(N_SITEROOT).setText(jobInfo.getContextInfo().getSiteRoot()); contextElement.addElement(N_REQUESTEDURI).setText(jobInfo.getContextInfo().getRequestedUri()); contextElement.addElement(N_LOCALE).setText(jobInfo.getContextInfo().getLocaleName()); contextElement.addElement(N_ENCODING).setText(jobInfo.getContextInfo().getEncoding()); contextElement.addElement(N_REMOTEADDR).setText(jobInfo.getContextInfo().getRemoteAddr()); Map jobParameters = jobInfo.getConfiguration(); if ((jobParameters != null) && (jobParameters.size() > 0)) {
CmsContextInfo contextInfo = new CmsContextInfo(); contextInfo.setProjectName(projectName); contextInfo.setUserName(cmsAdmin.getRequestContext().getCurrentUser().getName());
CmsContextInfo contextInfo = new CmsContextInfo(m_adminCms.getRequestContext()); contextInfo.setUserName(principal); CmsObject newCms = initCmsObject(m_adminCms, contextInfo); if (contextInfo.getRequestedUri().startsWith("/system/workplace/") && getRoleManager().hasRole(newCms, CmsRole.WORKPLACE_USER)) {
/** * Revives this publish job.<p> * * @param adminCms an admin cms object * @param publishList a publish list * * @throws CmsException if something goes wrong */ public void revive(CmsObject adminCms, CmsPublishList publishList) throws CmsException { CmsContextInfo context = new CmsContextInfo(adminCms.readUser(m_userId).getName()); CmsProject project = adminCms.readProject(m_projectId); context.setLocale(m_locale); m_cms = OpenCms.initCmsObject(adminCms, context); m_cms.getRequestContext().setCurrentProject(project); m_publishList = publishList; m_publishList.revive(m_cms); }
/** * Returns an independent copy of the provided CmsObject.<p> * * This can be useful in case a permanent reference to a CmsObject is stored. * Changing the request context values (for example project, siteroot) in the new CmsObject * will have no side effects to the CmsObject it was copied form.<p> * * The request time (<code>{@link CmsRequestContext#getRequestTime()}</code>) * is set to the current time.<p> * * @param cms the CmsObject to create a copy of * * @return an independent copy of the provided CmsObject * * @throws CmsException in case the initialization failed * * @see OpenCms#initCmsObject(CmsObject) * @see OpenCms#initCmsObject(CmsObject, CmsContextInfo) * @see OpenCms#initCmsObject(String) */ protected CmsObject initCmsObject(CmsObject cms) throws CmsException { CmsContextInfo contextInfo = new CmsContextInfo(cms.getRequestContext()); contextInfo.setRequestTime(CmsContextInfo.CURRENT_TIME); return initCmsObject(contextInfo); }
/** * Adds a new job description for the scheduler.<p> * * @param jobInfo the job description to add */ public void addJobFromConfiguration(CmsScheduledJobInfo jobInfo) { m_configuredJobs.add(jobInfo); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( Messages.get().getBundle().key( Messages.INIT_SCHEDULER_CONFIG_JOB_3, jobInfo.getJobName(), jobInfo.getClassName(), jobInfo.getContextInfo().getUserName())); } }
/** * Creates a new instance, initializing the user name as provided and * all other vaiables with the same default values as in {@link #CmsContextInfo()}.<p> * * @param userName the user name to create the context with * * @see #CmsContextInfo() */ public CmsContextInfo(String userName) { this(); setUserName(userName); }