Java Code Examples for javax.annotation.Resource

The following are top voted examples for showing how to use javax.annotation.Resource. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: incubator-netbeans   File: PersistenceTestCase.java   Source Code and License 6 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    URL persistenceProviderUrl = FileUtil.getArchiveRoot(PersistenceProvider.class.getProtectionDomain().getCodeSource().getLocation());
    ProtectionDomain domain = Resource.class.getProtectionDomain();
    System.out.println("Protection domain: " + domain);
    CodeSource source = domain.getCodeSource();
    System.out.println("Code source: " + source);
    if (source != null) {
        URL location = source.getLocation();
        System.out.println("Location: " + location);
        URL resourceUrl = FileUtil.getArchiveRoot(location);
        addCompileRoots(Arrays.asList(persistenceProviderUrl, resourceUrl));
    } else {
        addCompileRoots(Arrays.asList(persistenceProviderUrl));
    }
}
 
Example 2
Project: testee.fi   File: TopicResourceProvider.java   Source Code and License 5 votes vote down vote up
@Override
public Object resolve(final InjectionPoint injectionPoint) {
    final Resource annotation = injectionPoint.getAnnotated().getAnnotation(Resource.class);
    if (null == annotation) {
        return null;
    }
    if (Topic.class != injectionPoint.getType()) {
        return null;
    }
    return new TestEEfiTopic(annotation.mappedName());
}
 
Example 3
Project: testee.fi   File: ManualResourceProviderBuilder.java   Source Code and License 5 votes vote down vote up
@Override
public Object resolve(final InjectionPoint injectionPoint) {
    if (injectionPoint.getAnnotated().getAnnotation(Resource.class) == null) {
        return null;
    }
    return resources.get(injectionPoint.getAnnotated().getAnnotation(Resource.class).mappedName());
}
 
Example 4
Project: lazycat   File: WebAnnotationSet.java   Source Code and License 5 votes vote down vote up
protected static void loadFieldsAnnotation(Context context, Class<?> classClass) {
	// Initialize the annotations
	Field[] fields = Introspection.getDeclaredFields(classClass);
	if (fields != null && fields.length > 0) {
		for (Field field : fields) {
			Resource annotation = field.getAnnotation(Resource.class);
			if (annotation != null) {
				String defaultName = classClass.getName() + SEPARATOR + field.getName();
				Class<?> defaultType = field.getType();
				addResource(context, annotation, defaultName, defaultType);
			}
		}
	}
}
 
Example 5
Project: esup-ecandidat   File: MainUI.java   Source Code and License 5 votes vote down vote up
/**Ajout d'un menu d'item avec ou sans sous menu
 * @param caption le libelle
 * @param viewName la vue rattachee
 * @param icon l'icon du menu
 * @param itemMenu l'item menu rattache
 * @param mapSubMenu un eventuel sous-menu
 */
private void addItemMenu(String caption, String viewName, com.vaadin.server.Resource icon, LinkedList<SubMenu> subMenus, AccordionItemMenu itemMenu) {
	OneClickButton itemBtn = new OneClickButton(caption, icon);
	Menu menu = new Menu(viewName,subMenus,itemBtn);
	itemBtn.setPrimaryStyleName(ValoTheme.MENU_ITEM);
	/*Pas de sous menu*/
	if (subMenus==null){
		itemBtn.addClickListener(e -> {
			navigateToView(viewName);
		});
		viewButtons.put(viewName, menu);
		if (itemMenu!=null){
			viewAccordion.put(viewName, (String)itemMenu.getData());
		}
	}
	/*Des sous menu, on associe le bouton du menu à chaque vue de sous menu*/
	else{
		subMenus.forEach(e -> {
			viewButtons.put(e.getVue(), menu);
			if (itemMenu!=null){
				viewAccordion.put(e.getVue(), (String)itemMenu.getData());
			}
		});
		itemBtn.addClickListener(e -> {
			navigateToView(subMenus.getFirst().getVue());
		});
		
	}
	if (itemMenu==null){
		menuButtonLayout.addComponent(itemBtn);
	}else{
		itemMenu.addButton(itemBtn);			
	}
	
}
 
Example 6
Project: jvm-sandbox   File: DefaultProviderManager.java   Source Code and License 5 votes vote down vote up
private void injectResource(final Object provider) throws IllegalAccessException {
    final Field[] resourceFieldArray = FieldUtils.getFieldsWithAnnotation(provider.getClass(), Resource.class);
    if (ArrayUtils.isEmpty(resourceFieldArray)) {
        return;
    }
    for (final Field resourceField : resourceFieldArray) {
        final Class<?> fieldType = resourceField.getType();
        // ConfigInfo注入
        if (ConfigInfo.class.isAssignableFrom(fieldType)) {
            final ConfigInfo configInfo = new DefaultConfigInfo(cfg);
            FieldUtils.writeField(resourceField, provider, configInfo, true);
        }
    }
}
 
Example 7
Project: lemon   File: AccountLogService.java   Source Code and License 4 votes vote down vote up
@Resource
public void setAccountLockService(AccountLockService accountLockService) {
    this.accountLockService = accountLockService;
}
 
Example 8
Project: lemon   File: AccountInfoController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setAccountInfoManager(AccountInfoManager accountInfoManager) {
    this.accountInfoManager = accountInfoManager;
}
 
Example 9
Project: lemon   File: AuthService.java   Source Code and License 4 votes vote down vote up
@Resource
public void setAccessManager(AccessManager accessManager) {
    this.accessManager = accessManager;
}
 
Example 10
Project: lemon   File: IndexController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
    this.jdbcTemplate = jdbcTemplate;
}
 
Example 11
Project: lemon   File: BpmConfCountersignController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setBpmConfNodeManager(BpmConfNodeManager bpmConfNodeManager) {
    this.bpmConfNodeManager = bpmConfNodeManager;
}
 
Example 12
Project: lemon   File: TaskInfoController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setExportor(Exportor exportor) {
    this.exportor = exportor;
}
 
Example 13
Project: lemon   File: AccountLogConsumer.java   Source Code and License 4 votes vote down vote up
@Resource
public void setAccountLogService(AccountLogService accountLogService) {
    this.accountLogService = accountLogService;
}
 
Example 14
Project: lemon   File: BpmConfAssignController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setTaskDefinitionConnector(
        TaskDefinitionConnector taskDefinitionConnector) {
    this.taskDefinitionConnector = taskDefinitionConnector;
}
 
Example 15
Project: lemon   File: BpmConfCountersignController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setTaskDefinitionConnector(
        TaskDefinitionConnector taskDefinitionConnector) {
    this.taskDefinitionConnector = taskDefinitionConnector;
}
 
Example 16
Project: lemon   File: SpecialAuthenticationHandler.java   Source Code and License 4 votes vote down vote up
@Resource
public void setAccountInfoManager(AccountInfoManager accountInfoManager) {
    this.accountInfoManager = accountInfoManager;
}
 
Example 17
Project: lemon   File: PartyStructController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setPartyEntityManager(PartyEntityManager partyEntityManager) {
    this.partyEntityManager = partyEntityManager;
}
 
Example 18
Project: lemon   File: WorkCalendarService.java   Source Code and License 4 votes vote down vote up
@Resource
public void setWorkcalRuleManager(WorkcalRuleManager workcalRuleManager) {
    this.workcalRuleManager = workcalRuleManager;
}
 
Example 19
Project: lemon   File: PartyStructController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setMessageHelper(MessageHelper messageHelper) {
    this.messageHelper = messageHelper;
}
 
Example 20
Project: lemon   File: MeetingRoomController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setTenantHolder(TenantHolder tenantHolder) {
    this.tenantHolder = tenantHolder;
}
 
Example 21
Project: lemon   File: FormTemplateController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setTenantHolder(TenantHolder tenantHolder) {
    this.tenantHolder = tenantHolder;
}
 
Example 22
Project: lemon   File: TemporaryPasswordGeneratorImpl.java   Source Code and License 4 votes vote down vote up
@Resource
public void setAccountInfoManager(AccountInfoManager accountInfoManager) {
    this.accountInfoManager = accountInfoManager;
}
 
Example 23
Project: lemon   File: HumanTaskConnectorImpl.java   Source Code and License 4 votes vote down vote up
@Resource
public void setTaskInfoManager(TaskInfoManager taskInfoManager) {
    this.taskInfoManager = taskInfoManager;
}
 
Example 24
Project: lemon   File: PlmKanbanResource.java   Source Code and License 4 votes vote down vote up
@Resource
public void setUserConnector(UserConnector userConnector) {
    this.userConnector = userConnector;
}
 
Example 25
Project: lemon   File: BpmConfNoticeController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setTaskDefinitionConnector(
        TaskDefinitionConnector taskDefinitionConnector) {
    this.taskDefinitionConnector = taskDefinitionConnector;
}
 
Example 26
Project: lemon   File: MenuController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setMessageHelper(MessageHelper messageHelper) {
    this.messageHelper = messageHelper;
}
 
Example 27
Project: WeiXing_xmu-2016-MrCode   File: CustomerServiceImpl.java   Source Code and License 4 votes vote down vote up
@Resource(name="customerDaoImpl")
public void setBaseDao(BaseDaoImpl<Customer> baseDao){
	super.setBaseDao(baseDao);
}
 
Example 28
Project: lemon   File: CmsCommentController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setCurrentUserHolder(CurrentUserHolder currentUserHolder) {
    this.currentUserHolder = currentUserHolder;
}
 
Example 29
Project: lemon   File: SendmailHistoryController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setTenantHolder(TenantHolder tenantHolder) {
    this.tenantHolder = tenantHolder;
}
 
Example 30
Project: lemon   File: PermController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setMessageHelper(MessageHelper messageHelper) {
    this.messageHelper = messageHelper;
}
 
Example 31
Project: lemon   File: WhitelistAppController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setExportor(Exportor exportor) {
    this.exportor = exportor;
}
 
Example 32
Project: lemon   File: AdminBatchController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setMessageHelper(MessageHelper messageHelper) {
    this.messageHelper = messageHelper;
}
 
Example 33
Project: lemon   File: BpmConfNodeController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setBpmConfNodeManager(BpmConfNodeManager bpmConfNodeManager) {
    this.bpmConfNodeManager = bpmConfNodeManager;
}
 
Example 34
Project: lemon   File: TreeController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setPartyStructTypeManager(
        PartyStructTypeManager partyStructTypeManager) {
    this.partyStructTypeManager = partyStructTypeManager;
}
 
Example 35
Project: lemon   File: CardInfoController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setExportor(Exportor exportor) {
    this.exportor = exportor;
}
 
Example 36
Project: lemon   File: BpmProcessController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setBpmConfOperationManager(
        BpmConfOperationManager bpmConfOperationManager) {
    this.bpmConfOperationManager = bpmConfOperationManager;
}
 
Example 37
Project: lemon   File: HumantaskPortalController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setCurrentUserHolder(CurrentUserHolder currentUserHolder) {
    this.currentUserHolder = currentUserHolder;
}
 
Example 38
Project: lemon   File: VisitorInfoController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setVisitorInfoManager(VisitorInfoManager visitorInfoManager) {
    this.visitorInfoManager = visitorInfoManager;
}
 
Example 39
Project: lemon   File: MsgInfoController.java   Source Code and License 4 votes vote down vote up
@Resource
public void setMessageHelper(MessageHelper messageHelper) {
    this.messageHelper = messageHelper;
}
 
Example 40
Project: easy-test   File: SimpleJsonProcessorImpl.java   Source Code and License 4 votes vote down vote up
@Resource(name = "simpleMybatisMapper")
public void setDataBaseMapper(DataBaseMapper dataBaseMapper) {
    super.setDataBaseMapper(dataBaseMapper);
}