本文整理汇总了Java中org.sakaiproject.tool.api.SessionManager类的典型用法代码示例。如果您正苦于以下问题:Java SessionManager类的具体用法?Java SessionManager怎么用?Java SessionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SessionManager类属于org.sakaiproject.tool.api包,在下文中一共展示了SessionManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUp
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
@Before
public void setUp() {
PowerMockito.mockStatic(ComponentManager.class);
// A mock component manager.
when(ComponentManager.get(any(Class.class))).then(new Answer<Object>() {
private Map<Class, Object> mocks = new HashMap<>();
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
Class classToMock = (Class) invocation.getArguments()[0];
return mocks.computeIfAbsent(classToMock, k -> mock(classToMock));
}
});
// Mock the Session so that ResourceLoader doesn't NPE on init
when(ComponentManager.get(SessionManager.class).getCurrentSession()).thenReturn(mock(Session.class));
siteAction = new SiteAction();
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:17,代码来源:SiteActionTestTools.java
示例2: setUp
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
String runAs = "admin";
voter = (ResourceEventVoter) getService(ResourceEventVoter.class.getName());
helper = (ResourceEventVoterHelper) getService(ResourceEventVoterHelper.class.getName());
chs = (ContentHostingService) getService(ContentHostingService.class.getName());
timeService = (TimeService) getService(TimeService.class.getName());
usageSessionService = (UsageSessionService) getService(UsageSessionService.class.getName());
usageSessionService.startSession(runAs, "localhost", "resourceVoter-integrationTest");
sessionManager = (SessionManager) getService("org.sakaiproject.tool.api.SessionManager");
session = sessionManager.getCurrentSession();
session.setUserEid(runAs);
session.setUserId(runAs);
event = new ResourceEventVoterHelper.ReEvent("content.revise", true, 1,
"/content/group/5c5fdcef-dbb2-415b-9714-b031e4e18bb8/quotes.txt", null);
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:20,代码来源:TestResourceEventVoter.java
示例3: sendAutoUpdate
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
/**
* Send the HTML / Javascript to invoke an automatic update
*
* @param out
* @param req
* The request.
* @param placementId
* The tool's placement id / presence location / part of the delivery address
* @param updateTime
* The time (seconds) between courier checks
* @deprecated
* To avoid inappropriate kernel dependencies, construct this URL in the tool pending relocation of this to courier (see SAK-18481).
*/
public static void sendAutoUpdate(PrintWriter out, HttpServletRequest req, String placementId, int updateTime)
{
String userId = ComponentManager.get(SessionManager.class).getCurrentSessionUserId();
StringBuilder url = new StringBuilder(serverUrl(req));
url.append("/courier/");
url.append(placementId);
url.append("?userId=");
url.append(userId);
out.println("<script type=\"text/javascript\" language=\"JavaScript\">");
out.println("updateTime = " + updateTime + "000;");
out.println("updateUrl = \"" + url.toString() + "\";");
out.println("scheduleUpdate();");
out.println("</script>");
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:29,代码来源:Web.java
示例4: setupServices
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
/**
* Sets up the services needed by the BaseSite to operate
* @param siteService the BSS
* @param sessionManager the SM
* @param userDirectoryService the UDS
* @throws java.lang.IllegalStateException if the services would be null
*/
void setupServices(BaseSiteService siteService, SessionManager sessionManager, UserDirectoryService userDirectoryService) {
this.siteService = siteService;
if (this.siteService == null) {
this.siteService = (BaseSiteService) ComponentManager.get(SiteService.class);
if (this.siteService == null) {
throw new IllegalStateException("Cannot get the SiteService when constructing BaseSite");
}
}
this.authzGroupService = this.siteService.authzGroupService();
this.sessionManager = sessionManager;
if (this.sessionManager == null) {
this.sessionManager = (SessionManager) ComponentManager.get(SessionManager.class);
if (this.sessionManager == null) {
throw new IllegalStateException("Cannot get the SessionManager when constructing BaseSite");
}
}
this.userDirectoryService = userDirectoryService;
if (this.userDirectoryService == null) {
this.userDirectoryService = (UserDirectoryService) ComponentManager.get(UserDirectoryService.class);
if (this.userDirectoryService == null) {
throw new IllegalStateException("Cannot get the UserDirectoryService when constructing BaseSite");
}
}
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:32,代码来源:BaseSite.java
示例5: MySession
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
public MySession(SessionManager sessionManager, String id, ThreadLocalManager threadLocalManager,
IdManager idManager, SessionStore sessionStore, SessionAttributeListener sessionListener,
int inactiveInterval, NonPortableSession nonPortableSession, MutableLong expirationTimeSuggestion,
RebuildBreakdownService rebuildBreakdownService)
{
this.sessionManager = sessionManager;
m_id = id;
this.threadLocalManager = threadLocalManager;
this.idManager = idManager;
this.sessionStore = sessionStore;
this.sessionListener = sessionListener;
m_inactiveInterval = inactiveInterval;
m_nonPortalSession = nonPortableSession;
m_created = System.currentTimeMillis();
m_accessed = m_created;
this.expirationTimeSuggestion = expirationTimeSuggestion;
resetExpirationTimeSuggestion();
// set the TERRACOTTA_CLUSTER flag
resolveTerracottaClusterProperty();
this.rebuildBreakdownService = rebuildBreakdownService;
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:22,代码来源:MySession.java
示例6: MyLittleSession
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
public MyLittleSession(String type, SessionManager sessionManager, String id, Session s, String littleId,
ThreadLocalManager threadLocalManager, SessionAttributeListener sessionListener,
SessionStore sessionStore, NonPortableSession nonPortableSession)
{
this.m_type = type;
this.sessionManager = sessionManager;
this.m_id = id;
this.m_session = s;
this.m_littleId = littleId;
this.threadLocalManager = threadLocalManager;
this.sessionStore = sessionStore;
this.m_nonPortalSession = nonPortableSession;
this.sessionListener = sessionListener;
m_created = System.currentTimeMillis();
m_accessed = m_created;
String clusterTerracotta = System.getProperty("sakai.cluster.terracotta");
TERRACOTTA_CLUSTER = "true".equals(clusterTerracotta);
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:19,代码来源:MyLittleSession.java
示例7: getHelperDoneURL
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
public static final String getHelperDoneURL(Tool tool, SessionManager sessionManager) {
String url = (String) sessionManager.getCurrentToolSession().getAttribute(tool.getId() + Tool.HELPER_DONE_URL);
if (url == null) {
url = "/";
}
return url;
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:8,代码来源:SakaiURLUtil.java
示例8: setUp
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
@Before
public void setUp() throws IdUsedException, IdInvalidException, InconsistentException, PermissionException {
_chs = (ContentHostingService)getService(ContentHostingService.class.getName());
_ags = (AuthzGroupService)getService(AuthzGroupService.class.getName());
SessionManager sm = (SessionManager)getService(SessionManager.class.getName());
Session session = sm.getCurrentSession();
session.setUserEid("admin");
session.setUserId("admin");
ContentCollectionEdit collectionEdit = _chs.addCollection(PHOTOS_COLLECTION);
_chs.commitCollection(collectionEdit);
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:13,代码来源:RoleViewTest.java
示例9: testEmptyResources
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
/**
* Checks the resources of zero bytes are handled correctly.
*/
@Test
public void testEmptyResources() throws Exception {
ContentHostingService ch = getService(ContentHostingService.class);
SessionManager sm = getService(SessionManager.class);
Session session = sm.getCurrentSession();
session.setUserEid("admin");
session.setUserId("admin");
ContentResourceEdit cr;
cr = ch.addResource("/emptyFileStreamed");
cr.setContent(new ByteArrayInputStream(new byte[0]));
ch.commitResource(cr);
cr = ch.addResource("/emptyFileArray");
cr.setContent(new byte[0]);
ch.commitResource(cr);
ContentResource resource;
InputStream stream;
resource = ch.getResource("/emptyFileStreamed");
stream = resource.streamContent();
Assert.assertEquals(0, stream.available());
Assert.assertEquals(0, resource.getContentLength());
Assert.assertEquals(0, resource.getContent().length);
resource = ch.getResource("/emptyFileArray");
stream = resource.streamContent();
Assert.assertEquals(0, stream.available());
Assert.assertEquals(0, resource.getContentLength());
Assert.assertEquals(0, resource.getContent().length);
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:36,代码来源:ContentHostingServiceTest.java
示例10: init
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
public void init()
{
ComponentManager cm = org.sakaiproject.component.cover.ComponentManager
.getInstance();
functionManager = (FunctionManager) load(cm, FunctionManager.class
.getName());
entityManager = (EntityManager) load(cm, EntityManager.class.getName());
securityService = (SecurityService) load(cm, SecurityService.class
.getName());
sessionManager = (SessionManager) load(cm, SessionManager.class
.getName());
siteService = (SiteService) load(cm, SiteService.class.getName());
toolManager = (ToolManager) load(cm, ToolManager.class.getName());
List l = functionManager.getRegisteredFunctions("rwiki."); //$NON-NLS-1$
if (!l.contains(SECURE_READ))
functionManager.registerFunction(SECURE_READ);
if (!l.contains(SECURE_UPDATE))
functionManager.registerFunction(SECURE_UPDATE);
if (!l.contains(SECURE_CREATE))
functionManager.registerFunction(SECURE_CREATE);
if (!l.contains(SECURE_SUPER_ADMIN))
functionManager.registerFunction(SECURE_SUPER_ADMIN);
if (!l.contains(SECURE_ADMIN))
functionManager.registerFunction(SECURE_ADMIN);
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:28,代码来源:RWikiSecurityServiceImpl.java
示例11: init
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
public void init()
{
ComponentManager cm = org.sakaiproject.component.cover.ComponentManager
.getInstance();
sessionManager = (SessionManager) load(cm, SessionManager.class
.getName());
objectService = (RWikiObjectService) load(cm, RWikiObjectService.class
.getName());
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:10,代码来源:SaveCommand.java
示例12: init
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
public void init()
{
ComponentManager cm = org.sakaiproject.component.cover.ComponentManager
.getInstance();
activeToolManager = (ActiveToolManager) load(cm,
ActiveToolManager.class.getName());
sessionManager = (SessionManager) load(cm, SessionManager.class
.getName());
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:10,代码来源:HelperCommand.java
示例13: init
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
sessionManager = (SessionManager) ComponentManager
.get("org.sakaiproject.tool.api.SessionManager");
activeToolManager = (ActiveToolManager) ComponentManager
.get("org.sakaiproject.tool.api.ActiveToolManager");
toolManager = (ToolManager) ComponentManager
.get("org.sakaiproject.tool.api.ToolManager");
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:13,代码来源:UserAuditJsfTool.java
示例14: startSession
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
private void startSession() {
UsageSessionService usageSessionService = getService(UsageSessionService.class);
usageSessionService.startSession("admin", "localhost", "integration-tests");
SessionManager sessionManager = getService(SessionManager.class);
session = sessionManager.getCurrentSession();
session.setUserEid("admin");
session.setUserId("admin");
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:9,代码来源:SiteAliasCleanupNotificationActionIntegrationTest.java
示例15: UsersAction
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
public UsersAction() {
super();
authzGroupService = ComponentManager.get(AuthzGroupService.class);
userDirectoryService = ComponentManager.get(UserDirectoryService.class);
authenticationManager = ComponentManager.get(AuthenticationManager.class);
securityService = ComponentManager.get(SecurityService.class);
contentHostingService = ComponentManager.get(ContentHostingService.class);
usageSessionService = ComponentManager.get(UsageSessionService.class);
sessionManager = ComponentManager.get(SessionManager.class);
threadLocalManager = ComponentManager.get(ThreadLocalManager.class);
this.validationLogic = (ValidationLogic)ComponentManager.get(ValidationLogic.class);
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:13,代码来源:UsersAction.java
示例16: PermissionsHelperAction
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
public PermissionsHelperAction() {
super();
authzGroupService = ComponentManager.get(AuthzGroupService.class);
functionManager = ComponentManager.get(FunctionManager.class);
securityService = ComponentManager.get(SecurityService.class);
entityManager = ComponentManager.get(EntityManager.class);
siteService = ComponentManager.get(SiteService.class);
sessionManager = ComponentManager.get(SessionManager.class);
toolManager = ComponentManager.get(ToolManager.class);
serverConfigurationService = ComponentManager.get(ServerConfigurationService.class);
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:12,代码来源:PermissionsHelperAction.java
示例17: RealmsAction
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
public RealmsAction()
{
authzGroupService = ComponentManager.get(AuthzGroupService.class);
functionManager = ComponentManager.get(FunctionManager.class);
groupProvider = ComponentManager.get(GroupProvider.class);
securityService = ComponentManager.get(SecurityService.class);
sessionManager = ComponentManager.get(SessionManager.class);
toolManager = ComponentManager.get(ToolManager.class);
userDirectoryService = ComponentManager.get(UserDirectoryService.class);
userAuditRegistration = ComponentManager.get(UserAuditRegistration.class);
userAuditService = ComponentManager.get(UserAuditService.class);
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:13,代码来源:RealmsAction.java
示例18: init
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
public void init()
{
ComponentManager cm = org.sakaiproject.component.cover.ComponentManager
.getInstance();
sessionManager = (SessionManager) load(cm, SessionManager.class
.getName());
searchService = (SearchService) load(cm, SearchService.class.getName());
siteService = (SiteService) load(cm, SiteService.class.getName());
toolManager = (ToolManager) load(cm, ToolManager.class.getName());
userDirectoryService = (UserDirectoryService) load(cm, UserDirectoryService.class.getName());
securityService = (SecurityService)load(cm, SecurityService.class.getName());
serverConfigurationService = (ServerConfigurationService) load(cm, ServerConfigurationService.class.getName());
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:15,代码来源:SearchBeanFactoryImpl.java
示例19: setSessionManager
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
/**
* Dependency injection.
*
* @param sessionManager
* The sessionManager to set.
*/
public void setSessionManager(SessionManager sessionManager)
{
if (log.isDebugEnabled())
{
log.debug("setSessionManager(SessionManager " + sessionManager + ")");
}
this.sessionManager = sessionManager;
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:16,代码来源:PersistableHelper.java
示例20: setUp
import org.sakaiproject.tool.api.SessionManager; //导入依赖的package包/类
/**
* Setup test fixture (runs once for each test method called)
*/
public void setUp() throws Exception {
// Fetch the services we need to run the tests
siteService = (SiteService)getService(SiteService.class.getName());
sessionManager = (SessionManager)getService(SessionManager.class.getName());
sectionManager = (SectionManager)getService(SectionManager.class.getName());
Session session = sessionManager.getCurrentSession();
session.setUserId("admin");
session.setUserEid("admin");
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:14,代码来源:CourseManagementIntegrationTest.java
注:本文中的org.sakaiproject.tool.api.SessionManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论