• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LoginException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.jcr.LoginException的典型用法代码示例。如果您正苦于以下问题:Java LoginException类的具体用法?Java LoginException怎么用?Java LoginException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LoginException类属于javax.jcr包,在下文中一共展示了LoginException类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: activate

import javax.jcr.LoginException; //导入依赖的package包/类
protected void activate(ComponentContext ctx) {
    try {
        session = repository.loginService("serviceUser", null);
        observationManager = session.getWorkspace().getObservationManager();

        String[] nodeTypes = {"cq:PageContent"};
        int eventTypes = Event.PROPERTY_ADDED | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED;
        observationManager.addEventListener(this, eventTypes, "/content", true, null, nodeTypes, true);

        log.info("Activated JCR event listener");
    } catch (LoginException le) {
        log.error("Error activating JCR event listener: {}", le.getMessage());
    } catch (Exception e) {
        log.error("Error activating JCR event listener", e);
    }
}
 
开发者ID:HS2-SOLUTIONS,项目名称:hs2-aem-commons,代码行数:17,代码来源:PropagatePropertyInheritanceCancelled.java


示例2: get

import javax.jcr.LoginException; //导入依赖的package包/类
private byte[] get(final String path) throws LoginException, RepositoryException, IOException {
	byte[] ret = null;
	Session session = null;
	try {
		session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
		Binary b = session.getRootNode().getProperty(path).getBinary();
		ret = IOUtils.toByteArray(b.getStream());
		b.dispose();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		if (session != null) {
			session.logout();
		}
	}
	return ret;
}
 
开发者ID:justcoke,项目名称:dropwizard-jcr-module,代码行数:18,代码来源:JcrDAO.java


示例3: handleRequest

import javax.jcr.LoginException; //导入依赖的package包/类
public Response handleRequest(Message m, ClassResourceInfo resourceClass) {
    AuthorizationPolicy policy = m.get(AuthorizationPolicy.class);
    if (policy != null) {
        String username = policy.getUserName();
        String password = policy.getPassword();
        try {
            session = JcrSessionUtil.createSession(username, password);
            if (isAuthenticated(session)) {
                HttpServletRequest request = (HttpServletRequest) m.get(AbstractHTTPDestination.HTTP_REQUEST);
                request.setAttribute(AuthenticationConstants.HIPPO_SESSION, session);
                return null;
            } else {
                throw new UnauthorizedException();
            }
        } catch (LoginException e) {
            log.debug("Login failed: {}", e);
            throw new UnauthorizedException(e.getMessage());
        }
    }
    throw new UnauthorizedException();
}
 
开发者ID:jreijn,项目名称:hippo-addon-restful-webservices,代码行数:22,代码来源:HippoAuthenticationRequestHandler.java


示例4: testNewUserSession

import javax.jcr.LoginException; //导入依赖的package包/类
@Test
public void testNewUserSession() throws LoginException, RepositoryException {
  final JcrSessionFactory sf = getSessionFactory();
  Session session = null;
  try {
    session = sf.newUserSession(
        new SimpleCredentials("anonymous", new char[0]));
    assertThat(session.isLive()).isTrue();
    assertThat(session.getUserID()).isEqualTo("anonymous");
  } finally {
    if (session != null) session.logout();
  }
  try {
    sf.newUserSession(new SimpleCredentials("doesnotexist", new char[0]));
    fail("Should not succeed.");
  } catch (RuntimeException re) {
    assertThat(re.getCause()).isInstanceOf(LoginException.class);
  }
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:20,代码来源:JcrSessionFactoryTest.java


示例5: activate

import javax.jcr.LoginException; //导入依赖的package包/类
@Activate
public void activate(final Map<String, String> config) throws RepositoryException {
    componentsWithSharedProperties = new HashMap<>();

    // Schedule the initial calculation of components that have shared/global property dialogs.
    scheduleSharedComponentsMapUpdate();

    try {
        // Add an event listener on the /apps directory for component adds/removals to recalculate
        // the set of components that have shared/global property dialogs.
        respositorySession = repository.loginService(SERVICE_NAME, null);
        observationManager = respositorySession.getWorkspace().getObservationManager();

        // Need to listen for "nt:folder" else "nt:unstructured" nodes created/deleted from
        // CRD DE are not captured.
        String[] nodeTypes = {"nt:folder", "nt:unstructured"};
        int eventTypes = Event.NODE_ADDED | Event.NODE_REMOVED;
        observationManager.addEventListener(this, eventTypes, "/apps", true, null, nodeTypes, true);

        log.info("Activated JCR event listener for components with shared/global properties");
    } catch (LoginException le) {
        log.error("Could not get an admin resource resolver to listen for components with shared/global properties");
    } catch (Exception e) {
        log.error("Error activating JCR event listener for components with shared/global properties", e);
    }
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:27,代码来源:SharedComponentPropertiesPageInfoProvider.java


示例6: testCreateNodeWithAuthentication

import javax.jcr.LoginException; //导入依赖的package包/类
@Test
public void testCreateNodeWithAuthentication() throws Exception {
    Exchange exchange = createExchangeWithBody("<message>hello!</message>");
    Exchange out = template.send("direct:a", exchange);
    assertNotNull(out);
    String uuid = out.getOut().getBody(String.class);
    assertNull("Expected body to be null, found JCR node UUID", uuid);
    assertTrue("Wrong exception type", out.getException() instanceof LoginException);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:10,代码来源:JcrAuthLoginFailureTest.java


示例7: checkLogin

import javax.jcr.LoginException; //导入依赖的package包/类
private boolean checkLogin(Repository repository) throws RepositoryException {
	boolean loginSuccessful = true;
	Credentials credentials = new SimpleCredentials(userId, userPassword.toCharArray());
	try {
		repository.login(credentials).logout();
	} catch (LoginException e) {
		loginSuccessful = false;
	}
	return loginSuccessful;
}
 
开发者ID:Cognifide,项目名称:APM,代码行数:11,代码来源:CheckPassword.java


示例8: executePagedNodesQuery

import javax.jcr.LoginException; //导入依赖的package包/类
/**
 * Fetching paged node items.
 *
 * @param statement     SQL2 statement
 * @param maxResultSize Max results returned
 * @param pageNumber    paging number
 * @param workspace     Workspace in repostory.
 * @param nodeType      Node type.
 * @throws javax.jcr.LoginException Login exception.
 * @throws RepositoryException Handling RepositoryException.
 */
protected void executePagedNodesQuery(String statement, int maxResultSize, int pageNumber, String workspace, String nodeType) throws LoginException, RepositoryException {
    List<Node> nodeList = new ArrayList<Node>(0);
    List<Node> nodeListPaged = new ArrayList<Node>(0);
    NodeIterator items = QueryUtil.search(workspace, statement, Query.JCR_SQL2, nodeType);
    while (items.hasNext()) {
        nodeList.add(new I18nNodeWrapper(items.nextNode()));
    }
    int total = nodeList.size();

    // Paging result set
    int startRow = (maxResultSize * (pageNumber - 1));
    int newLimit = maxResultSize;
    if (total > startRow) {
        if (total < startRow + maxResultSize) {
            newLimit = total - startRow;
        }
        nodeListPaged = nodeList.subList(startRow, startRow + newLimit);
    }

    int calcNumPages = total / maxResultSize;
    if ((total % maxResultSize) > 0) {
        calcNumPages++;
    }
    // Set template model properties
    setCount(total);
    setNumPages(calcNumPages);
    setSearchResults(templatingFunctions.asContentMapList(nodeListPaged));
}
 
开发者ID:tricode,项目名称:magnolia-blog,代码行数:40,代码来源:BlogSearchRenderableDefinition.java


示例9: initialise

import javax.jcr.LoginException; //导入依赖的package包/类
public void initialise(Session session) throws LoginException, RepositoryException {
	final NamespaceRegistry registry = session.getWorkspace().getNamespaceRegistry();
	
	if (!Arrays.asList(registry.getPrefixes()).contains("ocm")) {
		session.getWorkspace().getNamespaceRegistry().registerNamespace("ocm", "http://jackrabbit.apache.org/ocm");
	}
	
	Node rootNode = session.getRootNode();
	for( String nodeName : this.mainNodes){
		if(!rootNode.hasNode(nodeName)){
			rootNode.addNode(nodeName);
		}
	}
	session.save();
}
 
开发者ID:cheetah100,项目名称:gravity,代码行数:16,代码来源:OcmMapperFactory.java


示例10: createSession

import javax.jcr.LoginException; //导入依赖的package包/类
/**
 * Creates a JCR session based upon the provided credentials
 * @param username the username
 * @param password the password
 * @return a {@link javax.jcr.Session}
 * @throws LoginException
 */
public static Session createSession(String username, String password) throws LoginException {
    Session session = null;
    try {
        final HippoRepository repository = HippoRepositoryFactory.getHippoRepository();
        session = repository.login(username, password.toCharArray());
    } catch (LoginException le) {
        throw new LoginException(le);
    } catch (RepositoryException e) {
        log.error("An exception occurred: {}", e);
    }
    return session;
}
 
开发者ID:jreijn,项目名称:hippo-addon-restful-webservices,代码行数:20,代码来源:JcrSessionUtil.java


示例11: mockRepository

import javax.jcr.LoginException; //导入依赖的package包/类
public static Repository mockRepository() throws LoginException,
                                         RepositoryException {
    final Repository mockRepo = mock(Repository.class);
    when(mockRepo.login()).thenReturn(
            mock(org.modeshape.jcr.api.Session.class, Mockito.withSettings().extraInterfaces(Session.class)));
    return mockRepo;
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:8,代码来源:TestHelpers.java


示例12: login

import javax.jcr.LoginException; //导入依赖的package包/类
@Override
public Session login() throws LoginException, RepositoryException {
	return adminSession = repository.login();
}
 
开发者ID:justcoke,项目名称:dropwizard-jcr-module,代码行数:5,代码来源:ManagedRepositoryImpl.java


示例13: fetch

import javax.jcr.LoginException; //导入依赖的package包/类
public byte[] fetch(final String path) throws LoginException, RepositoryException, IOException {
	if (repository == null) {
		throw new RepositoryException("repo failed to initialize");
	}
	return get(path);
}
 
开发者ID:justcoke,项目名称:dropwizard-jcr-module,代码行数:7,代码来源:JcrDAO.java


示例14: store

import javax.jcr.LoginException; //导入依赖的package包/类
public void store(final String path, final byte[] content) throws LoginException, RepositoryException {
	if (repository == null) {
		throw new RepositoryException("repo failed to initialize");
	}
	set(path, content);
}
 
开发者ID:justcoke,项目名称:dropwizard-jcr-module,代码行数:7,代码来源:JcrDAO.java


示例15: fetchRepositoryNull

import javax.jcr.LoginException; //导入依赖的package包/类
@Test(expected = RepositoryException.class)
public void fetchRepositoryNull() throws LoginException, RepositoryException, IOException {
	warehouse = new JcrDAO(null);
	warehouse.fetch("");
}
 
开发者ID:justcoke,项目名称:dropwizard-jcr-module,代码行数:6,代码来源:WarehouseTest.java


示例16: impersonate

import javax.jcr.LoginException; //导入依赖的package包/类
@Override
public Session impersonate(Credentials credentials) throws LoginException, RepositoryException {
    return this;
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:SessionImpl.java


示例17: login

import javax.jcr.LoginException; //导入依赖的package包/类
@Override
public Session login(Credentials credentials, String workspaceName) throws LoginException, NoSuchWorkspaceException, RepositoryException {
    return session;
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:RepositoryImpl.java


示例18: loginService

import javax.jcr.LoginException; //导入依赖的package包/类
@Override
public Session loginService(String s, String s1) throws LoginException, RepositoryException {
    return session;
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:RepositoryImpl.java


示例19: translateException

import javax.jcr.LoginException; //导入依赖的package包/类
/**
 * Jcr exception translator - it converts specific JSR-170 checked exceptions into unchecked Spring DA
 * exception.
 * @author Guillaume Bort <[email protected]>
 * @author Costin Leau
 * @author Sergio Bossa
 * @author Salvatore Incandela
 * @param ex
 * @return
 */
public static DataAccessException translateException(RepositoryException ex) {
    if (ex instanceof AccessDeniedException) {
        return new DataRetrievalFailureException("Access denied to this data", ex);
    }
    if (ex instanceof ConstraintViolationException) {
        return new DataIntegrityViolationException("Constraint has been violated", ex);
    }
    if (ex instanceof InvalidItemStateException) {
        return new ConcurrencyFailureException("Invalid item state", ex);
    }
    if (ex instanceof InvalidQueryException) {
        return new DataRetrievalFailureException("Invalid query", ex);
    }
    if (ex instanceof InvalidSerializedDataException) {
        return new DataRetrievalFailureException("Invalid serialized data", ex);
    }
    if (ex instanceof ItemExistsException) {
        return new DataIntegrityViolationException("An item already exists", ex);
    }
    if (ex instanceof ItemNotFoundException) {
        return new DataRetrievalFailureException("Item not found", ex);
    }
    if (ex instanceof LoginException) {
        return new DataAccessResourceFailureException("Bad login", ex);
    }
    if (ex instanceof LockException) {
        return new ConcurrencyFailureException("Item is locked", ex);
    }
    if (ex instanceof MergeException) {
        return new DataIntegrityViolationException("Merge failed", ex);
    }
    if (ex instanceof NamespaceException) {
        return new InvalidDataAccessApiUsageException("Namespace not registred", ex);
    }
    if (ex instanceof NoSuchNodeTypeException) {
        return new InvalidDataAccessApiUsageException("No such node type", ex);
    }
    if (ex instanceof NoSuchWorkspaceException) {
        return new DataAccessResourceFailureException("Workspace not found", ex);
    }
    if (ex instanceof PathNotFoundException) {
        return new DataRetrievalFailureException("Path not found", ex);
    }
    if (ex instanceof ReferentialIntegrityException) {
        return new DataIntegrityViolationException("Referential integrity violated", ex);
    }
    if (ex instanceof UnsupportedRepositoryOperationException) {
        return new InvalidDataAccessApiUsageException("Unsupported operation", ex);
    }
    if (ex instanceof ValueFormatException) {
        return new InvalidDataAccessApiUsageException("Incorrect value format", ex);
    }
    if (ex instanceof VersionException) {
        return new DataIntegrityViolationException("Invalid version graph operation", ex);
    }
    // fallback
    return new JcrSystemException(ex);
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:69,代码来源:SessionFactoryUtils.java



注:本文中的javax.jcr.LoginException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FieldAccessor类代码示例发布时间:2022-05-21
下一篇:
Java SpringSocialConfigurer类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap