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


Java AnnotationLiteral类代码示例

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


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

示例1: getServices

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
/**
 * Retrieves the services that are available for use with the description for each service. 
 * The Services are determined by looking up all of the implementations of the 
 * Customer Service interface that are using the  DataService qualifier annotation. 
 * The DataService annotation contains the service name and description information. 
 * @return Map containing a list of services available and a description of each one.
 */
public Map<String,String> getServices (){
	TreeMap<String,String> services = new TreeMap<String,String>();
	logger.fine("Getting CustomerService Impls");
   	Set<Bean<?>> beans = beanManager.getBeans(CustomerService.class,new AnnotationLiteral<Any>() {
		private static final long serialVersionUID = 1L;});
   	for (Bean<?> bean : beans) {    		
   		for (Annotation qualifer: bean.getQualifiers()){
   			if(DataService.class.getName().equalsIgnoreCase(qualifer.annotationType().getName())){
   				DataService service = (DataService) qualifer;
   				logger.fine("   name="+service.name()+" description="+service.description());
   				services.put(service.name(), service.description());
   			}
   		}
   	}    	
   	return services;
}
 
开发者ID:ibmruntimes,项目名称:acmeair-modular,代码行数:24,代码来源:ServiceLocator.java

示例2: removeUser

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
@RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID, UserGroupMapping.ADMIN_ROLE_ID})
@Override
public Workspace removeUser(String pWorkspaceId, String login) throws UserNotFoundException, AccessRightException, AccountNotFoundException, WorkspaceNotFoundException, FolderNotFoundException, EntityConstraintException, UserNotActiveException, DocumentRevisionNotFoundException {
    Account account = new AccountDAO(em).loadAccount(contextManager.getCallerPrincipalLogin());
    Workspace workspace = new WorkspaceDAO(new Locale(account.getLanguage()), em).loadWorkspace(pWorkspaceId);
    checkAdmin(workspace, account);

    Locale locale = new Locale(account.getLanguage());
    UserDAO userDAO = new UserDAO(locale, em);
    User user = userDAO.loadUser(new UserKey(pWorkspaceId, login));

    userEvent.select(new AnnotationLiteral<Removed>() {
    }).fire(new UserEvent(user));
    userDAO.removeUser(user);

    return workspace;
}
 
开发者ID:polarsys,项目名称:eplmp,代码行数:18,代码来源:UserManagerBean.java

示例3: removeUserGroups

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
@RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID, UserGroupMapping.ADMIN_ROLE_ID})
@Override
public void removeUserGroups(String pWorkspaceId, String[] pIds) throws UserGroupNotFoundException, AccessRightException, AccountNotFoundException, WorkspaceNotFoundException, EntityConstraintException {
    Account account = checkAdmin(pWorkspaceId);
    Locale locale = new Locale(account.getLanguage());
    UserGroupDAO groupDAO = new UserGroupDAO(locale, em);
    for (String id : pIds) {
        UserGroupKey userGroupKey = new UserGroupKey(pWorkspaceId, id);
        if (groupDAO.hasACLConstraint(userGroupKey)) {
            throw new EntityConstraintException(locale, "EntityConstraintException11");
        }
        UserGroup group = groupDAO.loadUserGroup(userGroupKey);
        groupEvent.select(new AnnotationLiteral<Removed>() {
        }).fire(new UserGroupEvent(group));
        groupDAO.removeUserGroup(group);
    }
}
 
开发者ID:polarsys,项目名称:eplmp,代码行数:18,代码来源:UserManagerBean.java

示例4: checkWorkspaceReadAccess

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
@RolesAllowed({UserGroupMapping.REGULAR_USER_ROLE_ID})
@Override
public User checkWorkspaceReadAccess(String pWorkspaceId) throws UserNotFoundException, UserNotActiveException, WorkspaceNotFoundException, WorkspaceNotEnabledException {
    String login = contextManager.getCallerPrincipalLogin();
    UserDAO userDAO = new UserDAO(em);
    WorkspaceUserMembership userMS = userDAO.loadUserMembership(new WorkspaceUserMembershipKey(pWorkspaceId, pWorkspaceId, login));
    Workspace wks = new WorkspaceDAO(em).loadWorkspace(pWorkspaceId);
    User user = userDAO.loadUser(new UserKey(pWorkspaceId, login));
    Locale locale = new Locale(user.getLanguage());

    if (!wks.isEnabled()) {
        throw new WorkspaceNotEnabledException(locale, pWorkspaceId);
    } else if (userMS != null) {
        user = userMS.getMember();
    } else if (!wks.getAdmin().getLogin().equals(login)) {
        WorkspaceUserGroupMembership[] groupMS = new UserGroupDAO(em).getUserGroupMemberships(pWorkspaceId, user);
        if (groupMS.length == 0) {
            throw new UserNotActiveException(locale, login);
        }
    }

    workspaceAccessEvent.select(new AnnotationLiteral<Read>() {
    }).fire(new WorkspaceAccessEvent(user));

    return user;
}
 
开发者ID:polarsys,项目名称:eplmp,代码行数:27,代码来源:UserManagerBean.java

示例5: deleteTag

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
@RolesAllowed(UserGroupMapping.REGULAR_USER_ROLE_ID)
@Override
public void deleteTag(TagKey pKey) throws WorkspaceNotFoundException, AccessRightException, TagNotFoundException, UserNotFoundException, WorkspaceNotEnabledException {
    User user = userManager.checkWorkspaceWriteAccess(pKey.getWorkspace());
    Locale userLocale = new Locale(user.getLanguage());
    Tag tagToRemove = new Tag(user.getWorkspace(), pKey.getLabel());
    List<DocumentRevision> docRs = new DocumentRevisionDAO(userLocale, em).findDocRsByTag(tagToRemove);
    for (DocumentRevision docR : docRs) {
        docR.getTags().remove(tagToRemove);
    }
    List<ChangeItem> changeItems = new ChangeItemDAO(userLocale, em).findChangeItemByTag(pKey.getWorkspace(), tagToRemove);
    for (ChangeItem changeItem : changeItems) {
        changeItem.getTags().remove(tagToRemove);
    }

    List<PartRevision> partRevisions = new PartRevisionDAO(userLocale, em).findPartByTag(tagToRemove);
    for (PartRevision partRevision : partRevisions) {
        partRevision.getTags().remove(tagToRemove);
    }

    tagEvent.select(new AnnotationLiteral<Removed>() {
    }).fire(new TagEvent(tagToRemove));

    new TagDAO(userLocale, em).removeTag(pKey);
}
 
开发者ID:polarsys,项目名称:eplmp,代码行数:26,代码来源:DocumentManagerBean.java

示例6: removeTag

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
@RolesAllowed(UserGroupMapping.REGULAR_USER_ROLE_ID)
@Override
public DocumentRevision removeTag(DocumentRevisionKey pDocRPK, String pTag)
        throws UserNotFoundException, WorkspaceNotFoundException, UserNotActiveException, AccessRightException, DocumentRevisionNotFoundException, NotAllowedException, WorkspaceNotEnabledException {

    User user = checkDocumentRevisionWriteAccess(pDocRPK);

    DocumentRevision docR = getDocumentRevision(pDocRPK);
    Tag tagToRemove = new Tag(user.getWorkspace(), pTag);
    docR.getTags().remove(tagToRemove);

    tagEvent.select(new AnnotationLiteral<Untagged>() {
    }).fire(new TagEvent(tagToRemove, docR));

    if (isCheckoutByAnotherUser(user, docR)) {
        em.detach(docR);
        docR.removeLastIteration();
    }

    for (DocumentIteration documentIteration : docR.getDocumentIterations()) {
        indexerManager.indexDocumentIteration(documentIteration);
    }
    return docR;
}
 
开发者ID:polarsys,项目名称:eplmp,代码行数:25,代码来源:DocumentManagerBean.java

示例7: removeTag

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
@RolesAllowed(UserGroupMapping.REGULAR_USER_ROLE_ID)
@Override
public PartRevision removeTag(PartRevisionKey partRevisionKey, String tagName) throws UserNotFoundException, WorkspaceNotFoundException, UserNotActiveException, PartRevisionNotFoundException, AccessRightException, WorkspaceNotEnabledException {
    User user = checkPartRevisionWriteAccess(partRevisionKey);

    PartRevision partRevision = getPartRevision(partRevisionKey);
    Tag tagToRemove = new Tag(user.getWorkspace(), tagName);
    partRevision.getTags().remove(tagToRemove);

    tagEvent.select(new AnnotationLiteral<Untagged>() {
    }).fire(new TagEvent(tagToRemove, partRevision));

    if (isCheckoutByAnotherUser(user, partRevision)) {
        em.detach(partRevision);
        partRevision.removeLastIteration();
    }

    for (PartIteration partIteration : partRevision.getPartIterations()) {
        indexerManager.indexPartIteration(partIteration);
    }
    return partRevision;
}
 
开发者ID:polarsys,项目名称:eplmp,代码行数:23,代码来源:ProductManagerBean.java

示例8: persist

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
@Transactional
public boolean persist()
{
    final EntityManager entityManager = getEntityManager();
    entityManager.persist(getInstance());
    entityManager.flush();
    for (ManagedPersistenceContext context : managedPersistenceContexts) {
        final Object id = context.getProvider().getId(getInstance(), getEntityManager());
        if (id != null) {
            assignId(id);
            break;
        }
    }
    beanManager.fireEvent(getInstance(), new AnnotationLiteral<EntityPersisted>() {
    });
    return true;
}
 
开发者ID:Inspiredsoft,项目名称:parco,代码行数:18,代码来源:EntityHome.java

示例9: start

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
@Override
public void start(Stage initStage) throws Exception {
    final Stage primaryStage = new Stage(StageStyle.DECORATED);
    Task<ObservableValue<Stage>> mainStageTask = new Task<ObservableValue<Stage>>() {
        @Override
        protected ObservableValue<Stage> call() throws Exception {
            Weld weld = new Weld();
            WeldContainer container = weld.initialize(); // Initialize Weld CDI
            primaryStage.setTitle("StudyGuide");
            primaryStage.setOnCloseRequest(event -> {
                logger.debug("Closing down Weld.");
                weld.shutdown();
            });
            primaryStage.getIcons().add(new Image(StudyGuideApplication.class.getResourceAsStream(logoResource)));
            container.event().select(Stage.class, new AnnotationLiteral<StartupStage>() {
            }).fire(primaryStage);
            return new ReadOnlyObjectWrapper<>(primaryStage);
        }
    };
    mainStageTask.exceptionProperty().addListener((observable, oldValue, newValue) -> {
        Platform.runLater(() -> {
            throw new IllegalStateException("Main stage loading failed.", newValue);
        });
    });
    showSplashScreen(initStage, mainStageTask);
}
 
开发者ID:oskopek,项目名称:StudyGuide,代码行数:27,代码来源:StudyGuideApplication.java

示例10: initialize

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
/**
 * {@inheritDoc}.
 */
@Override
@SuppressWarnings("rawtypes")
public void initialize(final Unique annotation) {
	qualifier = new AnnotationLiteral() {
		private static final long serialVersionUID = 1L;

		@Override
		public Class annotationType() {
			return annotation.qualifier();
		}
	};
	type = annotation.type();
	paths = annotation.path();
	hints = annotation.hints();
}
 
开发者ID:clairton,项目名称:unique-validator,代码行数:19,代码来源:UniqueValidator.java

示例11: ClientProxyBean

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
/**
 * Public constructor.
 *
 * @param serviceName   The name of the ESB Service being proxied to.
 * @param proxyInterface The proxy Interface.
 * @param qualifiers     The CDI bean qualifiers.  Copied from the injection point.
 * @param beanDeploymentMetaData Deployment metadata.
 */
public ClientProxyBean(String serviceName, Class<?> proxyInterface, Set<Annotation> qualifiers, BeanDeploymentMetaData beanDeploymentMetaData) {
    this._serviceName = serviceName;
    this._serviceInterface = proxyInterface;

    if (qualifiers != null) {
        this._qualifiers = qualifiers;
    } else {
        this._qualifiers = new HashSet<Annotation>();
        this._qualifiers.add(new AnnotationLiteral<Default>() {
        });
        this._qualifiers.add(new AnnotationLiteral<Any>() {
        });
    }

    _proxyBean = Proxy.newProxyInstance(beanDeploymentMetaData.getDeploymentClassLoader(),
            new Class[]{_serviceInterface},
            new ClientProxyInvocationHandler(_serviceInterface));
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:27,代码来源:ClientProxyBean.java

示例12: initMetrics

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
public void initMetrics() throws IOException {
    String hostname = metricNameService.getHostName();

    Observable.from(beanManager.getBeans(Object.class, new AnnotationLiteral<Any>() {}))
            .map(Bean::getBeanClass)
            .filter(this::isRESTHandler)
            .flatMap(c -> Observable.from(c.getMethods()))
            .filter(this::isRESTHandlerMethod)
            .subscribe(
                    method -> {
                        HTTPMethod httpMethod = getHttpMethod(method);
                        String uri = getURI(method);
                        if (isWrite(method, uri)) {
                            register(RESTMetaData.forWrite(httpMethod, uri, hostname));
                        } else {
                            register(RESTMetaData.forRead(httpMethod, uri, hostname));
                        }
                    },
                    t -> logger.warn("Failed to register meta data for REST metrics", t),
                    () -> {}
            );
}
 
开发者ID:hawkular,项目名称:hawkular-metrics,代码行数:23,代码来源:RESTMetrics.java

示例13: sendMessageToProducer

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
@Test
public void sendMessageToProducer(@Uri("direct:produce") ProducerTemplate producer) throws InterruptedException {
    long random =  Math.round(Math.random() * Long.MAX_VALUE);

    produced.expectedMessageCount(1);
    produced.expectedBodiesReceived(random);
    produced.message(0).predicate(exchange -> {
        EventMetadata metadata = exchange.getIn().getHeader("metadata", EventMetadata.class);
        return metadata.getType().equals(Long.class) && metadata.getQualifiers().equals(new HashSet<>(Arrays.asList(new AnnotationLiteral<Any>() {}, new AnnotationLiteral<Default>() {})));
    });

    consumed.expectedMessageCount(1);
    consumed.expectedBodiesReceived(random);

    producer.sendBody(random);

    assertIsSatisfied(2L, TimeUnit.SECONDS, consumed, produced);
}
 
开发者ID:astefanutti,项目名称:camel-cdi,代码行数:19,代码来源:RawEventEndpointTest.java

示例14: getBeanInstance

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static <T> T getBeanInstance(final Class<T> type) throws Exception {
	BeanManager beanManager = getBeanManager();

       final Set<Bean<?>> beans = beanManager.getBeans(Object.class,new AnnotationLiteral<Any>() {

		private static final long serialVersionUID = 3612602223649004820L;});
       
       for (Bean<?> iterateBean : beans) {
           if(iterateBean.getBeanClass().getName() == type.getName()){
           	Bean<T> bean = (Bean<T>) iterateBean;
               final CreationalContext<T> creationalContext = beanManager.createCreationalContext(bean);
               return (T) beanManager.getReference(bean, type,creationalContext);
           }
       }
       return null;
}
 
开发者ID:cgi-soa-masterclass,项目名称:onlinepay,代码行数:18,代码来源:InjectingConstraintValidatorFactory.java

示例15: cacheBeans

import javax.enterprise.util.AnnotationLiteral; //导入依赖的package包/类
@PostConstruct
public void cacheBeans() {
    LOG.info("> Initializing ProviderTypes. ");
    final Set<Bean<?>> beans = beanManager.getBeans(ProviderType.class,
                                                    new AnnotationLiteral<Any>() {
                                                    });
    for (final Bean b : beans) {
        try {
            // I don't want to register the CDI proxy, I need a fresh instance :(
            ProviderType pt = (ProviderType) b.getBeanClass().newInstance();
            LOG.info("> Registering ProviderType: " + pt.getProviderTypeName());
            runtimeRegistry.registerProviderType(pt);
        } catch (InstantiationException | IllegalAccessException ex) {
            LOG.error("Something went wrong with registering Provider Types!",
                      ex);
        }
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:19,代码来源:RestRuntimeProvisioningServiceImpl.java


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