当前位置: 首页>>代码示例>>Java>>正文


Java Profiled类代码示例

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


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

示例1: destroyTicketGrantingTicket

import org.perf4j.aop.Profiled; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * Destroy a TicketGrantingTicket and perform back channel logout. This has the effect of invalidating any
 * Ticket that was derived from the TicketGrantingTicket being destroyed. May throw an
 * {@link IllegalArgumentException} if the TicketGrantingTicket ID is null.
 *
 * @param ticketGrantingTicketId the id of the ticket we want to destroy
 * @return the logout requests.
 */
@Audit(
        action="TICKET_GRANTING_TICKET_DESTROYED",
        actionResolverName="DESTROY_TICKET_GRANTING_TICKET_RESOLVER",
        resourceResolverName="DESTROY_TICKET_GRANTING_TICKET_RESOURCE_RESOLVER")
@Profiled(tag = "DESTROY_TICKET_GRANTING_TICKET", logFailuresSeparately = false)
@Transactional(readOnly = false)
@Override
public List<LogoutRequest> destroyTicketGrantingTicket(final String ticketGrantingTicketId) {
    Assert.notNull(ticketGrantingTicketId);

    logger.debug("Removing ticket [{}] from registry.", ticketGrantingTicketId);
    final TicketGrantingTicket ticket = this.ticketRegistry.getTicket(ticketGrantingTicketId,
            TicketGrantingTicket.class);

    if (ticket == null) {
        logger.debug("TicketGrantingTicket [{}] cannot be found in the ticket registry.", ticketGrantingTicketId);
        return Collections.emptyList();
    }

    logger.debug("Ticket found. Processing logout requests and then deleting the ticket...");
    final List<LogoutRequest> logoutRequests = logoutManager.performLogout(ticket);
    this.ticketRegistry.deleteTicket(ticketGrantingTicketId);

    return logoutRequests;
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:35,代码来源:CentralAuthenticationServiceImpl.java

示例2: createTicketGrantingTicket

import org.perf4j.aop.Profiled; //导入依赖的package包/类
/**
 * @throws IllegalArgumentException if the credentials are null.
 */
@Audit(
    action="TICKET_GRANTING_TICKET",
    actionResolverName="CREATE_TICKET_GRANTING_TICKET_RESOLVER",
    resourceResolverName="CREATE_TICKET_GRANTING_TICKET_RESOURCE_RESOLVER")
@Profiled(tag = "CREATE_TICKET_GRANTING_TICKET", logFailuresSeparately = false)
@Transactional(readOnly = false)
public String createTicketGrantingTicket(final Credential... credentials)
        throws AuthenticationException, TicketException {

    Assert.notNull(credentials, "credentials cannot be null");

    final Authentication authentication = this.authenticationManager.authenticate(credentials);

    final TicketGrantingTicket ticketGrantingTicket = new TicketGrantingTicketImpl(
        this.ticketGrantingTicketUniqueTicketIdGenerator
            .getNewTicketId(TicketGrantingTicket.PREFIX),
        authentication, this.ticketGrantingTicketExpirationPolicy);

    this.ticketRegistry.addTicket(ticketGrantingTicket);
    return ticketGrantingTicket.getId();
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:25,代码来源:CentralAuthenticationServiceImpl.java

示例3: doQuery

import org.perf4j.aop.Profiled; //导入依赖的package包/类
/**
 * Perform match query against specified configuration.
 */
@Profiled(tag="MatchQuery:{$0}", logger=queryTimingLoggerName, logFailuresSeparately=true)
public synchronized List<Map<String,String>> doQuery(String configName, Map<String, String> userSuppliedRecord) throws TooManyMatchesException, UnknownReconciliationServiceException, MatchExecutionException {
	List<Map<String,String>> matches = null;

	LuceneMatcher matcher = getMatcher(configName);

	if (matcher == null) {
		// When no matcher specified with that configuration
		logger.warn("Invalid match configuration «{}» requested", configName);
		return null;
	}

	matches = matcher.getMatches(userSuppliedRecord);
	// Just write out some matches to std out:
	logger.debug("Found some matches: {}", matches.size());
	if (matches.size() < 4) {
		logger.debug("Matches for {} are {}", userSuppliedRecord, matches);
	}

	return matches;
}
 
开发者ID:RBGKew,项目名称:Reconciliation-and-Matching-Framework,代码行数:25,代码来源:ReconciliationService.java

示例4: authenticate

import org.perf4j.aop.Profiled; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
@Audit(
    action="AUTHENTICATION",
    actionResolverName="AUTHENTICATION_RESOLVER",
    resourceResolverName="AUTHENTICATION_RESOURCE_RESOLVER")
@Profiled(tag = "AUTHENTICATE", logFailuresSeparately = false)
public final Authentication authenticate(final Credential... credentials) throws AuthenticationException {

    final AuthenticationBuilder builder = authenticateInternal(credentials);
    final Authentication authentication = builder.build();
    final Principal principal = authentication.getPrincipal();
    if (principal  instanceof NullPrincipal) {
        throw new UnresolvedPrincipalException(authentication);
    }

    for (final HandlerResult result : authentication.getSuccesses().values()) {
        builder.addAttribute(AUTHENTICATION_METHOD_ATTRIBUTE, result.getHandlerName());
    }

    logger.info("Authenticated {} with credentials {}.", principal, Arrays.asList(credentials));
    logger.debug("Attribute map for {}: {}", principal.getId(), principal.getAttributes());

    for (final AuthenticationMetaDataPopulator populator : this.authenticationMetaDataPopulators) {
        for (final Credential credential : credentials) {
            populator.populateAttributes(builder, credential);
        }
    }

    return builder.build();
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:32,代码来源:PolicyBasedAuthenticationManager.java

示例5: grantServiceTicket

import org.perf4j.aop.Profiled; //导入依赖的package包/类
@Audit(
    action="SERVICE_TICKET",
    actionResolverName="GRANT_SERVICE_TICKET_RESOLVER",
    resourceResolverName="GRANT_SERVICE_TICKET_RESOURCE_RESOLVER")
@Profiled(tag = "GRANT_SERVICE_TICKET", logFailuresSeparately = false)
@Transactional(readOnly = false)
public String grantServiceTicket(final String ticketGrantingTicketId,
    final Service service) throws TicketException {
    try {
        return this.grantServiceTicket(ticketGrantingTicketId, service, null);
    } catch (final AuthenticationException e) {
        throw new IllegalStateException("Unexpected authentication exception", e);
    }
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:15,代码来源:CentralAuthenticationServiceImpl.java

示例6: createOneTestDataFailWithEmB

import org.perf4j.aop.Profiled; //导入依赖的package包/类
/**
 * Description : craete a Role for test with name "testData", but failed with exception with EntityManager B <br>
 * Create Time: 2016-09-11 <br>
 * Create by : [email protected] <br>
 *
 */
@Profiled
@Transactional(readOnly = false)
public void createOneTestDataFailWithEmB() {
    Role role = new Role();
    role.setName("testDataB");
    dao.saveTestDataWithEmB(role);
    throw new RuntimeException(CNS_MANUAL_FAIL_MSG);
}
 
开发者ID:jimmyblylee,项目名称:example-spring-hibernate,代码行数:15,代码来源:AppService.java

示例7: getSids

import org.perf4j.aop.Profiled; //导入依赖的package包/类
@Profiled
    @Override
    public List<Sid> getSids(Authentication authentication) {

        Set<CfGroup> groups = null;

        // add current sid to collection based
        // on our authentication
        List<Sid> sids = new ArrayList<Sid>();
        sids.addAll(super.getSids(authentication));

        // find all groups by username
//        try {
            if (authentication.getPrincipal() instanceof UserDetails) {
                String username = ((UserDetails) authentication.getPrincipal()).getUsername();
                //TODO:
                throw new UnsupportedOperationException("TODO");
//                groups = principalDao.loadEffectivePrincipalGroups(userDao.findByUsername(username));
            } else {
                groups = new HashSet<CfGroup>();
            }
//        } catch (RecursiveGroupException e) {
//            groups = new HashSet<CfGroup>();
//        }

        // add groups to sids collection
        for (CfGroup group : groups) {
            sids.add(new PrincipalSid(group.getName()));
        }
        return sids;
    }
 
开发者ID:rafizanbaharum,项目名称:cfi-gov,代码行数:32,代码来源:CfAclSidRetrievalStrategyImpl.java

示例8: findByPeriod

import org.perf4j.aop.Profiled; //导入依赖的package包/类
@Profiled
@Override
public List<CfVote> findByPeriod(CfPeriod period) {
    Session session = sessionFactory.getCurrentSession();
    Query query = session.createQuery("select v from CfVote v where " +
            "v.budget = :period " +
            "and v.metadata.state = :metaState");
    query.setEntity("period", period);
    query.setInteger("metaState", ACTIVE.ordinal());
    return (List<CfVote>) query.list();
}
 
开发者ID:rafizanbaharum,项目名称:cfi-gov,代码行数:12,代码来源:CfVoteDaoImpl.java

示例9: query

import org.perf4j.aop.Profiled; //导入依赖的package包/类
/**
 * This method queries Amazon and returns the results found
 *
 * @param queryParams a MultivaluedMap of the query params to use
 * @return a SearchResponse object which represents query results
 * @throws CloudSearchClientException if the response did not return a 2XX status code
 */
@Override
@Profiled(tag = "CloudSearchReadClient.query")
public SearchResponse query(MultivaluedMap<String, String> queryParams) throws CloudSearchClientException {
    if (this.queryWebResource == null) {
        throw new IllegalStateException("CloudSearchClient not configured for querying cloudsearch");
    }

    ClientResponse clientResponse = null;
    SearchResponse searchResponse = null;

    /* Force request xml results from AWS cloudsearch */
    MultivaluedMap<String, String> myQueryParams = new MultivaluedMapImpl(queryParams);
    myQueryParams.remove(CloudSearchQueryParam.RESULTS_TYPE.getName());
    myQueryParams.add(CloudSearchQueryParam.RESULTS_TYPE.getName(), "xml");

    LOGGER.debug("Querying to {} with query params: {}", this.queryWebResource.getURI(), myQueryParams);
    try {

        clientResponse = this.queryWebResource.path(CLOUDSEARCH_VERSION)
                                              .path("search")
                                              .queryParams(myQueryParams)
                                              .get(ClientResponse.class);


        LOGGER.debug("Received a status of {} for query to {}", clientResponse.getStatus(), this.queryWebResource.getURI());
        checkStatus(clientResponse);

        searchResponse = clientResponse.getEntity(SearchResponse.class);
    } catch(RuntimeException re) {
        throw new CloudSearchRuntimeException(re.getMessage(), re);
    } finally {
        if (clientResponse != null) {
            clientResponse.close();
        }
    }

    return searchResponse;
}
 
开发者ID:homeaway,项目名称:thunderhead,代码行数:46,代码来源:CloudSearchClientImpl.java

示例10: updateDomain

import org.perf4j.aop.Profiled; //导入依赖的package包/类
/**
 * This method will post the SDF to the Amazon. The SDF can have both adds and delete requests
 *
 * @param entity the SDF entity
 * @return returns a UploadResponse object which represents the output returned from Amazon
 * @throws CloudSearchClientException if the response did not return a 2XX status code
 */
@Override
@Profiled(tag = "CloudSearchReadWriteClient.updateDomain")
public UploadResponse updateDomain(SearchDocumentFormat entity) throws CloudSearchClientException {
    if (this.updateWebResource == null) {
        throw new IllegalStateException("CloudSearchClient not configured for updating cloudsearch");
    }

    ClientResponse clientResponse = null;
    UploadResponse uploadResponse = null;

    LOGGER.debug("POSTing to {} with document: {}", this.updateWebResource.getURI(), entity);
    try {
        clientResponse = this.updateWebResource.path(CLOUDSEARCH_VERSION)
                                               .path("documents")
                                               .path("batch")
                                               .accept(MediaType.APPLICATION_XML)
                                               .entity(entity, MediaType.APPLICATION_XML)
                                               .post(ClientResponse.class);

        LOGGER.debug("Received a status of {} for query to {}", clientResponse.getStatus(), this.updateWebResource.getURI());

        checkStatus(clientResponse);

        uploadResponse = clientResponse.getEntity(UploadResponse.class);
    } catch(RuntimeException re) {
        throw new CloudSearchRuntimeException(re.getMessage(), re);
    } finally {
        if(clientResponse != null) {
            clientResponse.close();
        }
    }

    return uploadResponse;
}
 
开发者ID:homeaway,项目名称:thunderhead,代码行数:42,代码来源:CloudSearchClientImpl.java

示例11: delegateTicketGrantingTicket

import org.perf4j.aop.Profiled; //导入依赖的package包/类
/**
 * @throws IllegalArgumentException if the ServiceTicketId or the
 * Credential are null.
 */
@Audit(
    action="PROXY_GRANTING_TICKET",
    actionResolverName="GRANT_PROXY_GRANTING_TICKET_RESOLVER",
    resourceResolverName="GRANT_PROXY_GRANTING_TICKET_RESOURCE_RESOLVER")
@Profiled(tag="GRANT_PROXY_GRANTING_TICKET", logFailuresSeparately = false)
@Transactional(readOnly = false)
public String delegateTicketGrantingTicket(final String serviceTicketId, final Credential... credentials)
        throws AuthenticationException, TicketException {

    Assert.notNull(serviceTicketId, "serviceTicketId cannot be null");
    Assert.notNull(credentials, "credentials cannot be null");

    final ServiceTicket serviceTicket =  this.serviceTicketRegistry.getTicket(serviceTicketId, ServiceTicket.class);

    if (serviceTicket == null || serviceTicket.isExpired()) {
        logger.debug("ServiceTicket [{}] has expired or cannot be found in the ticket registry", serviceTicketId);
        throw new InvalidTicketException(serviceTicketId);
    }

    final RegisteredService registeredService = this.servicesManager
            .findServiceBy(serviceTicket.getService());

    verifyRegisteredServiceProperties(registeredService, serviceTicket.getService());
    
    if (!registeredService.isAllowedToProxy()) {
        logger.warn("ServiceManagement: Service [{}] attempted to proxy, but is not allowed.", serviceTicket.getService().getId());
        throw new UnauthorizedProxyingException();
    }

    final Authentication authentication = this.authenticationManager.authenticate(credentials);

    final TicketGrantingTicket ticketGrantingTicket = serviceTicket
            .grantTicketGrantingTicket(
                    this.ticketGrantingTicketUniqueTicketIdGenerator
                            .getNewTicketId(TicketGrantingTicket.PREFIX),
                    authentication, this.ticketGrantingTicketExpirationPolicy);

    this.ticketRegistry.addTicket(ticketGrantingTicket);

    return ticketGrantingTicket.getId();
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:46,代码来源:CentralAuthenticationServiceImpl.java

示例12: validateServiceTicket

import org.perf4j.aop.Profiled; //导入依赖的package包/类
/**
 * @throws IllegalArgumentException if the ServiceTicketId or the Service
 * are null.
 */
@Audit(
    action="SERVICE_TICKET_VALIDATE",
    actionResolverName="VALIDATE_SERVICE_TICKET_RESOLVER",
    resourceResolverName="VALIDATE_SERVICE_TICKET_RESOURCE_RESOLVER")
@Profiled(tag="VALIDATE_SERVICE_TICKET", logFailuresSeparately = false)
@Transactional(readOnly = false)
public Assertion validateServiceTicket(final String serviceTicketId, final Service service) throws TicketException {
    Assert.notNull(serviceTicketId, "serviceTicketId cannot be null");
    Assert.notNull(service, "service cannot be null");
 
    final ServiceTicket serviceTicket =  this.serviceTicketRegistry.getTicket(serviceTicketId, ServiceTicket.class);

    if (serviceTicket == null) {
        logger.info("ServiceTicket [{}] does not exist.", serviceTicketId);
        throw new InvalidTicketException(serviceTicketId);
    }

    final RegisteredService registeredService = this.servicesManager.findServiceBy(service);

    verifyRegisteredServiceProperties(registeredService, serviceTicket.getService());
    
    try {
        synchronized (serviceTicket) {
            if (serviceTicket.isExpired()) {
                logger.info("ServiceTicket [{}] has expired.", serviceTicketId);
                throw new InvalidTicketException(serviceTicketId);
            }

            if (!serviceTicket.isValidFor(service)) {
                logger.error("ServiceTicket [{}] with service [{}] does not match supplied service [{}]",
                        serviceTicketId, serviceTicket.getService().getId(), service);
                throw new TicketValidationException(serviceTicket.getService());
            }
        }

        final TicketGrantingTicket root = serviceTicket.getGrantingTicket().getRoot();
        final Authentication authentication = getAuthenticationSatisfiedByPolicy(
                root, new ServiceContext(serviceTicket.getService(), registeredService));
        final Principal principal = authentication.getPrincipal();

        Map<String, Object> attributesToRelease = this.defaultAttributeFilter.filter(principal.getId(),
                principal.getAttributes(), registeredService);
        if (registeredService.getAttributeFilter() != null) {
            attributesToRelease = registeredService.getAttributeFilter().filter(principal.getId(),
                    attributesToRelease, registeredService);
        }

        final String principalId = determinePrincipalIdForRegisteredService(principal, registeredService, serviceTicket);
        final Principal modifiedPrincipal = new SimplePrincipal(principalId, attributesToRelease);
        final AuthenticationBuilder builder = AuthenticationBuilder.newInstance(authentication);
        builder.setPrincipal(modifiedPrincipal);

        return new ImmutableAssertion(
                builder.build(),
                serviceTicket.getGrantingTicket().getChainedAuthentications(),
                serviceTicket.getService(),
                serviceTicket.isFromNewLogin());
    } finally {
        if (serviceTicket.isExpired()) {
            this.serviceTicketRegistry.deleteTicket(serviceTicketId);
        }
    }
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:68,代码来源:CentralAuthenticationServiceImpl.java

示例13: updateDomain

import org.perf4j.aop.Profiled; //导入依赖的package包/类
@Profiled(tag = "CloudSearchReadWriteClient.updateDomain")
UploadResponse updateDomain(SearchDocumentFormat entity) throws CloudSearchClientException;
 
开发者ID:homeaway,项目名称:thunderhead,代码行数:3,代码来源:CloudSearchClient.java

示例14: query

import org.perf4j.aop.Profiled; //导入依赖的package包/类
@Profiled(tag = "CloudSearchReadClient.query")
SearchResponse query(MultivaluedMap<String, String> queryParams) throws CloudSearchClientException;
 
开发者ID:homeaway,项目名称:thunderhead,代码行数:3,代码来源:CloudSearchClient.java

示例15: getTestDataCountWithEmB

import org.perf4j.aop.Profiled; //导入依赖的package包/类
/**
 * Description : get the count of Role which name is "testData" with EntityManager B <br>
 * Create Time: 2016-09-11 <br>
 * Create by : [email protected] <br>
 *
 * @return the count of Role with name testDataB
 */
@Profiled
@Transactional(readOnly = true)
public Integer getTestDataCountWithEmB() {
    return dao.getTestDataWithEmB().size();
}
 
开发者ID:jimmyblylee,项目名称:example-spring-hibernate,代码行数:13,代码来源:AppService.java


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