Search in sources :

Example 26 with Value

use of org.springframework.beans.factory.annotation.Value in project pinpoint by naver.

the class LoggingEvent method visit.

@Override
public void visit(Field field, Object value) {
    if (logger.isDebugEnabled()) {
        final Value annotation = field.getAnnotation(Value.class);
        logger.debug("{} {} @Value(\"{}\") = {}", field.getType().getSimpleName(), field.getName(), annotation.value(), value);
    }
}
Also used : Value(org.springframework.beans.factory.annotation.Value)

Example 27 with Value

use of org.springframework.beans.factory.annotation.Value in project pinpoint by naver.

the class AgentBaseDataReceiverConfiguration method log.

@PostConstruct
public void log() {
    logger.info("{}", this);
    AnnotationVisitor<Value> visitor = new AnnotationVisitor<>(Value.class);
    visitor.visit(this, new LoggingEvent(logger));
    validate();
}
Also used : LoggingEvent(com.navercorp.pinpoint.common.server.config.LoggingEvent) Value(org.springframework.beans.factory.annotation.Value) AnnotationVisitor(com.navercorp.pinpoint.common.server.config.AnnotationVisitor) PostConstruct(javax.annotation.PostConstruct)

Example 28 with Value

use of org.springframework.beans.factory.annotation.Value in project pinpoint by naver.

the class SpanReceiverConfiguration method log.

@PostConstruct
public void log() {
    logger.info("{}", this);
    AnnotationVisitor<Value> visitor = new AnnotationVisitor<>(Value.class);
    visitor.visit(this, new LoggingEvent(logger));
}
Also used : LoggingEvent(com.navercorp.pinpoint.common.server.config.LoggingEvent) Value(org.springframework.beans.factory.annotation.Value) AnnotationVisitor(com.navercorp.pinpoint.common.server.config.AnnotationVisitor) PostConstruct(javax.annotation.PostConstruct)

Example 29 with Value

use of org.springframework.beans.factory.annotation.Value in project leopard by tanhaichao.

the class SysconfigBeanPostProcessor method update.

@Override
public boolean update() {
    this.sysconfigDao.loadData();
    for (FieldInfo fieldInfo : fieldList) {
        Field field = fieldInfo.getField();
        Value annotation = field.getAnnotation(Value.class);
        Object value = resolveValue(annotation, field);
        String sysconfigId = annotation.value().replace("${", "").replace("}", "");
        logger.info("update sysconfigId:" + sysconfigId + " value:" + value);
        if (value == null) {
            throw new NullPointerException("参数值怎么会为空?");
        }
        try {
            field.set(fieldInfo.getBean(), value);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
    lmodify = new Date();
    return true;
}
Also used : Field(java.lang.reflect.Field) Value(org.springframework.beans.factory.annotation.Value) Date(java.util.Date)

Example 30 with Value

use of org.springframework.beans.factory.annotation.Value in project vorto by eclipse.

the class ModelRepositoryController method getUserModels.

// ##################### Downloads ################################
@GetMapping(value = { "/mine/download" })
public void getUserModels(Principal principal, final HttpServletResponse response) {
    List<ModelId> userModels = Lists.newArrayList();
    User user = accountService.getUser(principal.getName());
    Collection<Namespace> namespaces = null;
    try {
        namespaces = userNamespaceRoleService.getNamespaces(user, user);
    } catch (OperationForbiddenException | DoesNotExistException e) {
        LOGGER.error(e.getMessage(), e);
    }
    for (Namespace namespace : namespaces) {
        IModelRepository modelRepo = getModelRepository(namespace.getWorkspaceId());
        List<ModelInfo> modelInfos = modelRepo.search(String.format("author:%s", user.getUsername()));
        List<ModelId> modelIds = modelInfos.stream().map(modelInfo -> modelInfo.getId()).collect(Collectors.toList());
        userModels.addAll(modelIds);
    }
    LOGGER.info("Exporting information models for user - results: " + userModels.size());
    sendAsZipFile(response, user.getUsername() + "-models.zip", getModelsAndDependencies(userModels));
}
Also used : IModelRepository(org.eclipse.vorto.repository.core.IModelRepository) InfomodelTemplate(org.eclipse.vorto.repository.web.core.templates.InfomodelTemplate) RequestParam(org.springframework.web.bind.annotation.RequestParam) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) ApiParam(io.swagger.annotations.ApiParam) Autowired(org.springframework.beans.factory.annotation.Autowired) ModelAlreadyExistsException(org.eclipse.vorto.repository.core.ModelAlreadyExistsException) ModelInfo(org.eclipse.vorto.repository.core.ModelInfo) RequestContextHolder(org.springframework.web.context.request.RequestContextHolder) Future(java.util.concurrent.Future) Map(java.util.Map) Diagnostic(org.eclipse.vorto.repository.core.Diagnostic) AsyncModelMappingsFetcher(org.eclipse.vorto.repository.web.core.async.AsyncModelMappingsFetcher) SecurityContextHolder(org.springframework.security.core.context.SecurityContextHolder) ModelParserFactory(org.eclipse.vorto.repository.core.impl.parser.ModelParserFactory) PostMapping(org.springframework.web.bind.annotation.PostMapping) AsyncModelLinksFetcher(org.eclipse.vorto.repository.web.core.async.AsyncModelLinksFetcher) NotAuthorizedException(org.eclipse.vorto.repository.web.core.exceptions.NotAuthorizedException) User(org.eclipse.vorto.repository.domain.User) Namespace(org.eclipse.vorto.repository.domain.Namespace) RestController(org.springframework.web.bind.annotation.RestController) Executors(java.util.concurrent.Executors) IOUtils(org.apache.commons.io.IOUtils) Permission(org.eclipse.vorto.repository.core.PolicyEntry.Permission) DefaultUserAccountService(org.eclipse.vorto.repository.account.impl.DefaultUserAccountService) ZipOutputStream(java.util.zip.ZipOutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ModelFullDetailsDTO(org.eclipse.vorto.repository.web.api.v1.dto.ModelFullDetailsDTO) ControllerUtils(org.eclipse.vorto.repository.web.ControllerUtils) ModelLink(org.eclipse.vorto.repository.web.api.v1.dto.ModelLink) IModelRepository(org.eclipse.vorto.repository.core.IModelRepository) Value(org.springframework.beans.factory.annotation.Value) RequestBody(org.springframework.web.bind.annotation.RequestBody) FatalModelRepositoryException(org.eclipse.vorto.repository.core.FatalModelRepositoryException) IWorkflowService(org.eclipse.vorto.repository.workflow.IWorkflowService) Lists(com.google.common.collect.Lists) Attachment(org.eclipse.vorto.repository.core.Attachment) AsyncModelSyntaxFetcher(org.eclipse.vorto.repository.web.core.async.AsyncModelSyntaxFetcher) UserRepositoryRoleService(org.eclipse.vorto.repository.services.UserRepositoryRoleService) ModelProperty(org.eclipse.vorto.model.ModelProperty) ModelNotReleasedException(org.eclipse.vorto.repository.model.ModelNotReleasedException) GenericApplicationException(org.eclipse.vorto.repository.web.GenericApplicationException) IOException(java.io.IOException) IModelPolicyManager(org.eclipse.vorto.repository.core.IModelPolicyManager) NamespaceService(org.eclipse.vorto.repository.services.NamespaceService) ExecutionException(java.util.concurrent.ExecutionException) HttpStatus(org.springframework.http.HttpStatus) ApiResponse(io.swagger.annotations.ApiResponse) AttachmentValidator(org.eclipse.vorto.repository.core.impl.validation.AttachmentValidator) AttachResult(org.eclipse.vorto.repository.web.api.v1.dto.AttachResult) ModelTemplate(org.eclipse.vorto.repository.web.core.templates.ModelTemplate) PathVariable(org.springframework.web.bind.annotation.PathVariable) ValidationReport(org.eclipse.vorto.repository.importer.ValidationReport) DoesNotExistException(org.eclipse.vorto.repository.services.exceptions.DoesNotExistException) ApiOperation(io.swagger.annotations.ApiOperation) Logger(org.apache.log4j.Logger) AbstractRepositoryController(org.eclipse.vorto.repository.web.AbstractRepositoryController) ByteArrayInputStream(java.io.ByteArrayInputStream) PutMapping(org.springframework.web.bind.annotation.PutMapping) ModelMinimalInfoDTO(org.eclipse.vorto.repository.web.api.v1.dto.ModelMinimalInfoDTO) ZipEntry(java.util.zip.ZipEntry) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping) AsyncWorkflowActionsFetcher(org.eclipse.vorto.repository.web.core.async.AsyncWorkflowActionsFetcher) FileContent(org.eclipse.vorto.repository.core.FileContent) IDiagnostics(org.eclipse.vorto.repository.core.IDiagnostics) Collection(java.util.Collection) ModelValidationHelper(org.eclipse.vorto.repository.core.impl.utils.ModelValidationHelper) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) OperationForbiddenException(org.eclipse.vorto.repository.services.exceptions.OperationForbiddenException) Collectors(java.util.stream.Collectors) ModelId(org.eclipse.vorto.model.ModelId) Objects(java.util.Objects) List(java.util.List) Principal(java.security.Principal) Optional(java.util.Optional) WorkflowException(org.eclipse.vorto.repository.workflow.WorkflowException) Authentication(org.springframework.security.core.Authentication) IUserContext(org.eclipse.vorto.repository.core.IUserContext) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) HashMap(java.util.HashMap) ApiResponses(io.swagger.annotations.ApiResponses) AsyncModelAttachmentsFetcher(org.eclipse.vorto.repository.web.core.async.AsyncModelAttachmentsFetcher) Status(org.eclipse.vorto.repository.web.Status) GetMapping(org.springframework.web.bind.annotation.GetMapping) ExecutorService(java.util.concurrent.ExecutorService) ModelContent(org.eclipse.vorto.repository.web.core.dto.ModelContent) ModelNamespaceNotOfficialException(org.eclipse.vorto.repository.model.ModelNamespaceNotOfficialException) AsyncModelReferenceFetcher(org.eclipse.vorto.repository.web.core.async.AsyncModelReferenceFetcher) IBulkOperationsService(org.eclipse.vorto.repository.model.IBulkOperationsService) UserNamespaceRoleService(org.eclipse.vorto.repository.services.UserNamespaceRoleService) HttpServletResponse(javax.servlet.http.HttpServletResponse) PolicyEntry(org.eclipse.vorto.repository.core.PolicyEntry) ValidationException(org.eclipse.vorto.repository.core.impl.validation.ValidationException) ModelType(org.eclipse.vorto.model.ModelType) TimeUnit(java.util.concurrent.TimeUnit) ModelResource(org.eclipse.vorto.repository.core.ModelResource) PrincipalType(org.eclipse.vorto.repository.core.PolicyEntry.PrincipalType) MultipartFile(org.springframework.web.multipart.MultipartFile) ResponseEntity(org.springframework.http.ResponseEntity) UserContext(org.eclipse.vorto.repository.core.impl.UserContext) OperationForbiddenException(org.eclipse.vorto.repository.services.exceptions.OperationForbiddenException) DoesNotExistException(org.eclipse.vorto.repository.services.exceptions.DoesNotExistException) ModelInfo(org.eclipse.vorto.repository.core.ModelInfo) User(org.eclipse.vorto.repository.domain.User) ModelId(org.eclipse.vorto.model.ModelId) Namespace(org.eclipse.vorto.repository.domain.Namespace) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

Value (org.springframework.beans.factory.annotation.Value)71 Autowired (org.springframework.beans.factory.annotation.Autowired)33 IOException (java.io.IOException)29 Collectors (java.util.stream.Collectors)29 List (java.util.List)24 Logger (org.slf4j.Logger)23 LoggerFactory (org.slf4j.LoggerFactory)23 PathVariable (org.springframework.web.bind.annotation.PathVariable)20 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)20 ArrayList (java.util.ArrayList)18 RequestParam (org.springframework.web.bind.annotation.RequestParam)18 Map (java.util.Map)17 Optional (java.util.Optional)17 HttpServletResponse (javax.servlet.http.HttpServletResponse)16 RestController (org.springframework.web.bind.annotation.RestController)16 RequestMethod (org.springframework.web.bind.annotation.RequestMethod)15 Stream (java.util.stream.Stream)14 HttpStatus (org.springframework.http.HttpStatus)14 ApiOperation (io.swagger.annotations.ApiOperation)13 ApiParam (io.swagger.annotations.ApiParam)12