本文整理汇总了Java中org.sakaiproject.component.cover.ServerConfigurationService类的典型用法代码示例。如果您正苦于以下问题:Java ServerConfigurationService类的具体用法?Java ServerConfigurationService怎么用?Java ServerConfigurationService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerConfigurationService类属于org.sakaiproject.component.cover包,在下文中一共展示了ServerConfigurationService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adjustCssSkinFolder
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
/**
* Captures the (yes) overly complex rules for the skin folder naming convention
*
* @param <code>skinFolder</code>
* The folder where the skins are to be found.
* @return <code>skinFolder</code> The adjusted folder where the skins can be found.
*/
public static String adjustCssSkinFolder(String skinFolder)
{
if (skinFolder == null)
{
skinFolder = ServerConfigurationService.getString("skin.default");
if ( skinFolder == null ) skinFolder = ""; // Not likely - not good if it happens
}
String prefix = ServerConfigurationService.getString(PORTAL_SKIN_NEOPREFIX_PROPERTY, PORTAL_SKIN_NEOPREFIX_DEFAULT);
if (prefix == null) prefix = "";
String templates = ServerConfigurationService.getString("portal.templates", "neoskin");
if ( "neoskin".equals(templates) && !skinFolder.startsWith(prefix) ) skinFolder = prefix + skinFolder;
return skinFolder;
}
示例2: isFutureTermSelected
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
/**
* Determine whether the selected term is considered of "future term"
* @param state
*/
private void isFutureTermSelected(SessionState state) {
AcademicSession t = (AcademicSession) state.getAttribute(STATE_TERM_SELECTED);
int weeks = 0;
Calendar c = (Calendar) Calendar.getInstance().clone();
try {
weeks = Integer
.parseInt(ServerConfigurationService
.getString(
"roster.available.weeks.before.term.start",
"0"));
c.add(Calendar.DATE, weeks * 7);
} catch (Exception ignore) {
}
if (t != null && t.getStartDate() != null && c.getTimeInMillis() < t.getStartDate().getTime()) {
// if a future term is selected
state.setAttribute(STATE_FUTURE_TERM_SELECTED,
Boolean.TRUE);
} else {
state.setAttribute(STATE_FUTURE_TERM_SELECTED,
Boolean.FALSE);
}
}
示例3: getActiveBannersJSON
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
private String getActiveBannersJSON() {
JSONArray banners = new JSONArray();
String serverId = ServerConfigurationService.getString("serverId", "localhost");
User currentUser = UserDirectoryService.getCurrentUser();
if (currentUser != null && currentUser.getId() != null && !"".equals(currentUser.getId())) {
for (Banner banner : getBanners().getRelevantBanners(serverId, currentUser.getId())) {
try {
JSONObject bannerData = new JSONObject();
bannerData.put("id", banner.getUuid());
bannerData.put("message", banner.getMessage());
bannerData.put("dismissible", banner.isDismissible());
bannerData.put("dismissed", banner.isDismissed());
bannerData.put("type", banner.getType());
banners.add(bannerData);
} catch (Exception e) {
log.warn("Error processing banner: " + banner, e);
}
}
}
return banners.toJSONString();
}
示例4: buildOpaqueUrlExistingContext
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
/**
* Setup for Opaque URL Export ("URL exists").
*/
protected void buildOpaqueUrlExistingContext(VelocityPortlet portlet, Context context, RunData runData, CalendarActionState state)
{
String calId = state.getPrimaryCalendarReference();
Reference calendarRef = EntityManager.newReference(calId);
String opaqueUrl = ServerConfigurationService.getAccessUrl()
+ CalendarService.calendarOpaqueUrlReference(calendarRef);
String icalInfoArr[] = {String.valueOf(ServerConfigurationService.getInt("calendar.export.next.months",12)),
String.valueOf(ServerConfigurationService.getInt("calendar.export.previous.months",6))};
String icalInfoStr = rb.getFormattedMessage("ical.info",icalInfoArr);
context.put("icalInfoStr",icalInfoStr);
context.put("opaqueUrl", opaqueUrl);
context.put("webcalUrl", opaqueUrl.replaceFirst("http", "webcal"));
context.put("isMyWorkspace", isOnWorkspaceTab());
context.put("form-regenerate", BUTTON + "doOpaqueUrlRegenerate");
context.put("form-delete", BUTTON + "doOpaqueUrlDelete");
context.put("form-cancel", BUTTON + "doCancel");
buildMenu(portlet, context, runData, state);
}
示例5: renderHead
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
@Override
public void renderHead(final IHeaderResponse response) {
super.renderHead(response);
final String version = ServerConfigurationService.getString("portal.cdn.version", "");
// Drag and Drop (requires jQueryUI)
response.render(
JavaScriptHeaderItem.forUrl(String.format("/library/webjars/jquery-ui/1.12.1/jquery-ui.min.js?version=%s", version)));
// chart requires ChartJS
response.render(
JavaScriptHeaderItem.forUrl(String.format("/gradebookng-tool/webjars/chartjs/2.7.0/Chart.min.js?version=%s", version)));
response.render(CssHeaderItem.forUrl(String.format("/gradebookng-tool/styles/gradebook-settings.css?version=%s", version)));
response.render(JavaScriptHeaderItem.forUrl(String.format("/gradebookng-tool/scripts/gradebook-settings.js?version=%s", version)));
}
示例6: getValue
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
protected String getValue(String fileType, String mapType, ContentTypeImageService service, String pathPrefix) {
if (mapType.equals(JsfContentTypeMapTag.MAP_TYPE_IMAGE)) {
String imgPath = service.getContentTypeImage(fileType);
String url = ServerConfigurationService.getServerUrl();
return url + pathPrefix + imgPath;
}
else if (mapType.equals(JsfContentTypeMapTag.MAP_TYPE_NAME)) {
return service.getContentTypeDisplayName(fileType);
}
else if (mapType.equals(JsfContentTypeMapTag.MAP_TYPE_EXTENSION)) {
return service.getContentTypeExtension(fileType);
}
else {
return null;
}
}
示例7: getOptionalAttributes
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
/**
* Get the Map of optional attributes from sakai.properties
*
* First list defines the attribute , second the display value. If no display value the attribute name is used.
*
* Format is:
*
* user.additional.attribute.count=3
* user.additional.attribute.1=att1
* user.additional.attribute.2=att2
* user.additional.attribute.3=att3
*
* user.additional.attribute.display.att1=Attribute 1
* user.additional.attribute.display.att2=Attribute 2
* user.additional.attribute.display.att3=Attribute 3
* @return
*/
private Map<String,String> getOptionalAttributes() {
Map<String,String> atts = new LinkedHashMap<String,String>();
String configs[] = ServerConfigurationService.getStrings("user.additional.attribute");
if (configs != null) {
for (int i = 0; i < configs.length; i++) {
String key = configs[i];
if (!key.isEmpty()) {
String value = ServerConfigurationService.getString("user.additional.attribute.display." + key, key);
atts.put(key, value);
}
}
}
return atts;
}
示例8: init
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
protected void init() throws Exception {
log.info("init()");
if ("true".equals(ServerConfigurationService.getString( //$NON-NLS-1$
"search.enable", "false"))) //$NON-NLS-1$ //$NON-NLS-2$
{
for (Iterator i = addEvents.iterator(); i.hasNext();)
{
getSearchService().registerFunction((String) i.next());
}
for (Iterator i = removeEvents.iterator(); i.hasNext();)
{
getSearchService().registerFunction((String) i.next());
}
getSearchIndexBuilder().registerEntityContentProducer(this);
}
contextualUserDisplayService = (ContextualUserDisplayService) ComponentManager.get("org.sakaiproject.user.api.ContextualUserDisplayService");
}
示例9: init
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
/**
* Final initialization, once all dependencies are set.
*/
public void init()
{
log.info("{}.init()", this);
if (ServerConfigurationService.getString(SakaiBLTIUtil.BASICLTI_ENCRYPTION_KEY, null) == null) {
log.error("BasicLTI secrets in database unencrypted, please set {}", SakaiBLTIUtil.BASICLTI_ENCRYPTION_KEY);
}
try
{
// register as an entity producer
EntityManager.registerEntityProducer(this,REFERENCE_ROOT);
}
catch (Throwable t)
{
log.warn("init(): {}", t.getMessage());
}
if ( ltiService == null ) ltiService = (LTIService) ComponentManager.get("org.sakaiproject.lti.api.LTIService");
if ( ltiExportService == null ) ltiExportService = (LTIExportService)ComponentManager.get("org.sakaiproject.lti.api.LTIExportService");
}
示例10: getUrl
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
public String getUrl() {
loadContent();
// If I return null here, it appears that I cause an NPE in LB
if ( content == null ) return getErrorUrl();
String ret = (String) content.get("launch_url");
if ( ltiService != null && tool != null && ltiService.isMaintain(getSiteId())
&& LTIService.LTI_SECRET_INCOMPLETE.equals((String) tool.get(LTIService.LTI_SECRET))
&& LTIService.LTI_SECRET_INCOMPLETE.equals((String) tool.get(LTIService.LTI_CONSUMERKEY)) ) {
String toolId = getCurrentTool("sakai.siteinfo");
if ( toolId != null ) {
ret = editItemUrl(toolId);
return ret;
}
}
ret = ServerConfigurationService.getServerUrl() + ret;
return ret;
}
示例11: loginToSakai
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
/**
* <p>Login to sakai and start a user session. This users is intended
* to be one of the 'hard wired' users; admin, postmaster, or synchrobot.</p>
* <p>( this list of users can be extended; add the user via UI, update
* the sakai_users table so their EID matches ID, add them to the
* admin realm, restart )</p>
* @param whoAs - who to log in as
*/
protected void loginToSakai(String whoAs) {
serverName = ServerConfigurationService.getServerName();
log.debug(" AutoSubmitAssessmentsJob Logging into Sakai on " + serverName + " as " + whoAs);
UsageSession session = UsageSessionService.startSession(whoAs, serverName, "AutoSubmitAssessmentsJob");
if (session == null)
{
EventTrackingService.post(EventTrackingService.newEvent(SamigoConstants.EVENT_AUTO_SUBMIT_JOB_ERROR, whoAs + " unable to log into " + serverName, true));
return;
}
Session sakaiSession = SessionManager.getCurrentSession();
sakaiSession.setUserId(whoAs);
sakaiSession.setUserEid(whoAs);
// update the user's externally provided realm definitions
authzGroupService.refreshUser(whoAs);
// post the login events
EventTrackingService.post(EventTrackingService.newEvent(UsageSessionService.EVENT_LOGIN, whoAs + " running " + serverName, true));
}
示例12: getToSiteNoReply
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
/**
* Format a to address, to the related site, but with no reply.
*
* @param event
* The event that matched criteria to cause the notification.
* @return a to address, to the related site, but with no reply.
*/
protected String getToSiteNoReply(Event event)
{
Reference ref = EntityManager.newReference(event.getResource());
// use either the configured site, or if not configured, the site (context) of the resource
String siteId = (getSite() != null) ? getSite() : ref.getContext();
// get a site title
String title = siteId;
try
{
Site site = SiteService.getSite(siteId);
title = site.getTitle();
}
catch (Exception ignore)
{
}
return "\"" + title + "\" <"+ ServerConfigurationService.getString("setup.request","[email protected]" + ServerConfigurationService.getServerName()) + ">";
}
示例13: doLogout
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
/**
* Process a logout
*
* @param req
* Request object
* @param res
* Response object
* @param session
* Current session
* @param returnPath
* if not null, the path to use for the end-user browser redirect
* after the logout is complete. Leave null to use the configured
* logged out URL.
* @throws IOException
*/
public void doLogout(HttpServletRequest req, HttpServletResponse res,
Session session, String returnPath) throws ToolException
{
// SAK-16370 to allow multiple logout urls
String loggedOutUrl = null;
String userType = UserDirectoryService.getCurrentUser().getType();
if(userType == null) {
loggedOutUrl = ServerConfigurationService.getLoggedOutUrl();
} else {
loggedOutUrl = ServerConfigurationService.getString("loggedOutUrl." + userType, ServerConfigurationService.getLoggedOutUrl());
}
if ( returnPath != null )
{
loggedOutUrl = loggedOutUrl + returnPath;
}
session.setAttribute(Tool.HELPER_DONE_URL, loggedOutUrl);
ActiveTool tool = ActiveToolManager.getActiveTool("sakai.login");
String context = req.getContextPath() + req.getServletPath() + "/logout";
tool.help(req, res, context, "/logout");
}
示例14: isAvailable
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
public boolean isAvailable()
{
if (!setup)
{
if (!experimental)
{
available = true;
}
else if (ServerConfigurationService.getBoolean("wiki.experimental",
false))
{
available = true;
}
else
{
available = false;
}
setup = true;
}
return available;
}
示例15: getCssToolBase
import org.sakaiproject.component.cover.ServerConfigurationService; //导入依赖的package包/类
/**
* Returns a URL for the tool_base.css suitable for putting in an href= field.
*
* @return <code>cssToolBase</code> URL for the tool_base.css
*/
public static String getCssToolBase()
{
String skinRepo = ServerConfigurationService.getString("skin.repo");
String cssToolBase = skinRepo + "/tool_base.css";
return cssToolBase;
}