本文整理汇总了Java中org.jboss.seam.Component类的典型用法代码示例。如果您正苦于以下问题:Java Component类的具体用法?Java Component怎么用?Java Component使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Component类属于org.jboss.seam包,在下文中一共展示了Component类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateHighscores
import org.jboss.seam.Component; //导入依赖的package包/类
@Factory("highscores") @SuppressWarnings("unchecked")
public void updateHighscores() {
highscores = new ArrayList<HighscoreSet>();
String platform = (String) Component.getInstance("platform");
Query query = entityManager.createNamedQuery("gameType.byEnabledPlatform");
query.setParameter("platform", platform);
List<GameType> gameTypes=query.getResultList();
for (GameType g : gameTypes)
{
HighscoreSet set=new HighscoreSet();
set.setGameType(g);
if ("accentiurbani".equals(platform)) {
set.setHighscoreAll(updateHighscorePerGameSession(g));
} else if ("elearning".equals(platform)) {
set.setHighscoreDaily(updateHighscorePerGameSessionDistinctPersonDaily(g));
set.setHighscoreAll(updateHighscorePerGameSessionDistinctPerson(g));
} else {
// set.setHighscoreAll(updateHighscore(g));
set.setHighscoreMonthly(updateHighscoreMonthly(g));
set.setHighscoreLastMonth(updateHighscoreLastMonth(g));
set.setHighscoreDaily(updateHighscoreDaily(g));
}
highscores.add(set);
}
}
开发者ID:play4science,项目名称:gwap,代码行数:27,代码来源:HighscoreBean.java
示例2: sessionDestroyed
import org.jboss.seam.Component; //导入依赖的package包/类
@Destroy
public void sessionDestroyed() {
OauthData oauthData = (OauthData) Component.getInstance(OauthData.class, false);
if ((oauthData == null) || StringHelper.isEmpty(oauthData.getSessionState())) {
return;
}
String userUid = oauthData.getUserUid();
log.debug("Calling oxAuth logout method at the end of HTTP session. User: '{0}'", userUid);
try {
String endSessionState = UUID.randomUUID().toString();
EndSessionRequest endSessionRequest = new EndSessionRequest(oauthData.getIdToken(), applicationConfiguration.getLogoutRedirectUrl(), endSessionState);
endSessionRequest.setSessionState(oauthData.getSessionState());
EndSessionClient endSessionClient = new EndSessionClient(applicationConfiguration.getOxAuthEndSessionUrl());
endSessionClient.setRequest(endSessionRequest);
EndSessionResponse endSessionResponse = endSessionClient.exec();
if ((endSessionResponse == null) || (endSessionResponse.getStatus() != 302)) {
log.error("Invalid response code at oxAuth logout. User: '{0}'", userUid);
}
} catch (Exception ex) {
log.error("Exception happened at oxAuth logout. User: '{0}'", ex, userUid);
}
}
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:27,代码来源:AuthenticationSessionService.java
示例3: recreateCentralLdapEntryManager
import org.jboss.seam.Component; //导入依赖的package包/类
@Observer(OxTrustConfiguration.LDAP_CENTRAL_CONFIGUARION_RELOAD_EVENT_TYPE)
public void recreateCentralLdapEntryManager() {
// Backup current references to objects to allow shutdown properly
LdapEntryManager oldCentralLdapEntryManager = (LdapEntryManager) Component.getInstance(LDAP_CENTRAL_ENTRY_MANAGER_NAME);
// Recreate components
if ((oxTrustConfiguration.getLdapCentralConfiguration() != null) && oxTrustConfiguration.getApplicationConfiguration().isUpdateApplianceStatus()) {
createConnectionProvider(oxTrustConfiguration.getLdapCentralConfiguration(), "centralLdapConfiguration", "centralConnectionProvider");
} else {
Contexts.getApplicationContext().remove("centralConnectionProvider");
}
// Destroy old components
Contexts.getApplicationContext().remove(LDAP_CENTRAL_ENTRY_MANAGER_NAME);
if (oldCentralLdapEntryManager != null) {
oldCentralLdapEntryManager.destroy();
log.debug("Destroyed {0}: {1}", LDAP_CENTRAL_ENTRY_MANAGER_NAME, oldCentralLdapEntryManager);
}
}
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:22,代码来源:AppInitializer.java
示例4: uploadImage
import org.jboss.seam.Component; //导入依赖的package包/类
public void uploadImage(FileUploadEvent event) {
UploadedFile uploadedFile = event.getUploadedFile();
this.uploadedImage = null;
try {
GluuImage image = imageService.constructImage((GluuCustomPerson) Component.getInstance("currentPerson"), uploadedFile);
image.setStoreTemporary(true);
if (imageService.createImageFiles(image)) {
this.uploadedImage = image;
}
} finally {
try {
uploadedFile.delete();
} catch (IOException ex) {
log.error("Failed to remove temporary image", ex);
}
}
}
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:18,代码来源:CustomAttributeAction.java
示例5: authenticate
import org.jboss.seam.Component; //导入依赖的package包/类
@Transactional
public boolean authenticate()
{
// Tests that the SFSB can be obtained in both ContextualHttpRequests (authentication and web service invocation)
TestEjbLocal ejb = (TestEjbLocal) Component.getInstance("securedEjb", ScopeType.EVENT);
ejb.foo();
log.debug("Authenticating username/password: " + credentials.getUsername() + "/" + credentials.getPassword());
if (credentials.getUsername().equals(credentials.getPassword())) {
log.info("Authenticated {0}", credentials.getUsername());
if (credentials.getUsername().equals("admin")) {
identity.addRole("admin");
log.info("Admin rights granted for {0}", credentials.getUsername());
}
log.debug("Authentication valid");
return true;
} else {
log.debug("Authentication invalid");
return false;
}
}
开发者ID:windup,项目名称:windup-rulesets,代码行数:23,代码来源:TestAuthenticator.java
示例6: testLoginComponent
import org.jboss.seam.Component; //导入依赖的package包/类
@Test
public void testLoginComponent() throws Exception
{
Identity identity = Identity.instance();
assertFalse(identity.isLoggedIn());
identity.setUsername("gavin");
identity.setPassword("foobar");
identity.login();
User user = (User)Component.getInstance("user");
assertEquals("Gavin King", user.getName());
assertEquals("gavin", user.getUsername());
assertEquals("foobar", user.getPassword());
assertTrue(identity.isLoggedIn());
identity.logout();
assertFalse(identity.isLoggedIn());
identity.setUsername("gavin");
identity.setPassword("tiger");
identity.login();
assertFalse(identity.isLoggedIn());
}
开发者ID:seam2,项目名称:seam-examples-migrated-off-seam2,代码行数:23,代码来源:LoginTest.java
示例7: testLogin
import org.jboss.seam.Component; //导入依赖的package包/类
@Test
public void testLogin() throws Exception
{
Identity identity = Identity.instance();
assertFalse(identity.isLoggedIn());
identity.setUsername("gavin");
identity.setPassword("foobar");
identity.login();
User user = (User)Component.getInstance("user");
assertEquals("Gavin King", user.getName());
assertEquals("gavin", user.getUsername());
assertEquals("foobar", user.getPassword());
assertFalse(Manager.instance().isLongRunningConversation());
assertTrue(identity.isLoggedIn());
identity.logout();
assertTrue(Session.instance().isInvalid());
assertFalse(identity.isLoggedIn());
}
开发者ID:seam2,项目名称:seam-examples-migrated-off-seam2,代码行数:24,代码来源:LoginTest.java
示例8: doTransaction
import org.jboss.seam.Component; //导入依赖的package包/类
@Transactional(TransactionPropagationType.REQUIRED)
public <T> T doTransaction(String queueOwner, boolean persistent, Callback<T> callback, Callback<Void> commitCallback, boolean doStart) {
TransactionContext context = transactionContext.get();
if (context.obsolete) {
transactionContext.remove();
context = transactionContext.get();
}
if (!context.callbacksSet) {
Events events = (Events)Component.getInstance(Events.class);
events.raiseTransactionSuccessEvent("processTransactionSuccess", context);
events.raiseTransactionCompletionEvent("processTransactionComplete", context);
context.callbacksSet = true;
}
T result = callback.action();
if (result instanceof ProcessWrapper) {
log.debug("Adding process " + ((ProcessWrapper)result).getProcessKey() + "(" +
((ProcessWrapper)result).getProcessVersion() + ") to transaction " + context.transactionId);
context.processes.add((ProcessWrapper<Integer>)result);
if (doStart)
context.startProcesses.add((ProcessWrapper<Integer>)result);
}
if (commitCallback != null)
context.commitCallbacks.add(commitCallback);
return result;
}
开发者ID:workplacesystems,项目名称:queuj,代码行数:27,代码来源:SeamTransaction.java
示例9: testLocationNeighbor
import org.jboss.seam.Component; //导入依赖的package包/类
@Test
public void testLocationNeighbor() throws Exception {
new FacesRequest() {
@Override
protected void invokeApplication() throws Exception {
EntityManager em = (EntityManager) Component.getInstance("entityManager");
Location l1 = new Location();
l1.setName("Location 1");
em.persist(l1);
Assert.assertNotNull(l1.getId());
Location l2 = new Location();
l2.setName("Location 2");
em.persist(l2);
l1.getNeighbors().add(l2);
Location l3 = (Location) em.createQuery("from Location l where l = :l1")
.setParameter("l1", l1).getSingleResult();
assertNotNull(l3);
assertEquals(l3.getNeighbors().size(), 1);
assertEquals(l3.getNeighbors().get(0).getId(), l2.getId());
}
}.run();
}
开发者ID:play4science,项目名称:gwap,代码行数:27,代码来源:LocationTest.java
示例10: getWrongAnswers
import org.jboss.seam.Component; //导入依赖的package包/类
private List<Person> getWrongAnswers() {
int level = getQuestionNumber();
WrongAnswerBean wrongAnswerBean = (WrongAnswerBean) Component
.getInstance("wrongAnswerBean");
int year;
if (correctAnswer.getDeath() != null) {
year = correctAnswer.getDeath().getYear() + 1900;
} else {
year = Integer.parseInt(artResource.getDateCreated());
year = year + 30;
}
return wrongAnswerBean.createWrongAnswers(level, year);
}
开发者ID:play4science,项目名称:gwap,代码行数:17,代码来源:QuizQuestionBean.java
示例11: getScoringText
import org.jboss.seam.Component; //导入依赖的package包/类
/**
* @return returns an appropriate messages that shows players how good they were
*/
public String getScoringText() {
if (getScore() <= 0 || (getRoundsLeft() > 0 && getScore() < roundNr)) {
return messages.get("scoring.notGood");
} else {
// calculcate highscore
HighscoreBean highscoreBean = (HighscoreBean) Component.getInstance(HighscoreBean.class);
List<HighscoreSet> highscores = highscoreBean.getHighscores();
for (HighscoreSet highscoreSet : highscores) {
if (highscoreSet.getGameType().getName().equals("elearnTermina")) {
List<Highscore> highscore = highscoreSet.getHighscoreAll();
if (highscore.size() > 0 && (highscore.get(0).getPersonId().equals(person.getId())
|| (person.getPersonConnected() != null && highscore.get(0).getPersonId().equals(person.getPersonConnected().getId())))) {
return messages.get("scoring.goodHighscore");
}
break;
}
}
// check if player chose maximum difficulty
if (gameConfiguration.getBid() < 5 || gameConfiguration.getRoundDuration() > 15)
return messages.get("scoring.goodNotDifficult");
else
return messages.get("scoring.goodDifficult");
}
}
开发者ID:play4science,项目名称:gwap,代码行数:28,代码来源:Termina.java
示例12: loadConfigurationFromLdap
import org.jboss.seam.Component; //导入依赖的package包/类
private LdapOxTrustConfiguration loadConfigurationFromLdap(String ... returnAttributes) {
final LdapEntryManager ldapEntryManager = (LdapEntryManager) Component.getInstance("ldapEntryManager");
final String configurationDn = getConfigurationDn();
// log.info("########## configurationDn = " + configurationDn);
try {
final LdapOxTrustConfiguration conf = ldapEntryManager.find(LdapOxTrustConfiguration.class, configurationDn, returnAttributes);
return conf;
} catch (LdapMappingException ex) {
log.error("Failed to load configuration from LDAP", ex);
}
return null;
}
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:15,代码来源:OxTrustConfiguration.java
示例13: recreateLdapEntryManager
import org.jboss.seam.Component; //导入依赖的package包/类
@Observer(OxTrustConfiguration.LDAP_CONFIGUARION_RELOAD_EVENT_TYPE)
public void recreateLdapEntryManager() {
// Backup current references to objects to allow shutdown properly
LdapEntryManager oldLdapEntryManager = (LdapEntryManager) Component.getInstance(LDAP_ENTRY_MANAGER_NAME);
// Recreate components
createConnectionProvider(oxTrustConfiguration.getLdapConfiguration(), "localLdapConfiguration", "connectionProvider");
// Destroy old components
Contexts.getApplicationContext().remove(LDAP_ENTRY_MANAGER_NAME);
oldLdapEntryManager.destroy();
log.debug("Destroyed {0}: {1}", LDAP_ENTRY_MANAGER_NAME, oldLdapEntryManager);
}
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:15,代码来源:AppInitializer.java
示例14: recreateLdapAuthEntryManagers
import org.jboss.seam.Component; //导入依赖的package包/类
public void recreateLdapAuthEntryManagers() {
// Backup current references to objects to allow shutdown properly
LdapEntryManager oldLdapAuthEntryManager = (LdapEntryManager) Component.getInstance(LDAP_AUTH_ENTRY_MANAGER_NAME);
// Recreate components
createConnectionAuthProvider("ldapAuthConfig", oxTrustConfiguration.getLdapConfiguration().getFileName(), "localLdapAuthConfiguration", "authConnectionProvider");
// Destroy old components
Contexts.getApplicationContext().remove(LDAP_AUTH_ENTRY_MANAGER_NAME);
oldLdapAuthEntryManager.destroy();
log.debug("Destroyed {0}: {1}", LDAP_CENTRAL_ENTRY_MANAGER_NAME, oldLdapAuthEntryManager);
}
开发者ID:AgarwalNeha1,项目名称:gluu,代码行数:14,代码来源:AppInitializer.java
示例15: createResource
import org.jboss.seam.Component; //导入依赖的package包/类
public Object createResource(HttpRequest request, HttpResponse response, InjectorFactory factory)
{
// Push this onto event context so we have it available in ResteasyContextInjectionInterceptor
Contexts.getEventContext().set(ResteasyContextInjectionInterceptor.RE_HTTP_REQUEST_VAR, request);
Contexts.getEventContext().set(ResteasyContextInjectionInterceptor.RE_HTTP_RESPONSE_VAR, response);
log.debug("creating RESTEasy resource instance by looking up Seam component: " + seamComponent.getName());
return Component.getInstance(seamComponent.getName());
}
开发者ID:windup,项目名称:windup-rulesets,代码行数:9,代码来源:SeamResteasyResourceFactory.java
示例16: validate
import org.jboss.seam.Component; //导入依赖的package包/类
@Override
public void validate(FacesContext facesContext, UIComponent uiComponent, Object value)
throws ValidatorException {
UserList userList = (UserList) Component.getInstance("userList");
String messageDetail = null;
String messageSummary = null;
String userName = value.toString();
if (!isValid(userName)) {
messageDetail = ResourceBundle.instance().getString("validator.email");
messageSummary = ResourceBundle.instance().getString("validator.email");
} else {
Integer userId = userList.getUserIdForUsername(userName);
if (userId != null) {
messageDetail = ResourceBundle.instance().getString("org.ideaproject.jsf.validator.USERNAME_TAKEN_detail");
messageSummary = ResourceBundle.instance().getString("org.ideaproject.jsf.validator.USERNAME_TAKEN");
}
}
if (messageDetail != null && messageSummary != null) {
FacesMessage message = new FacesMessage();
message.setSeverity(FacesMessage.SEVERITY_ERROR);
message.setSummary(messageSummary);
message.setDetail(messageDetail);
throw new ValidatorException(message);
}
}
开发者ID:ecollado92,项目名称:TransitDataFeeder,代码行数:28,代码来源:UsernameValidator.java
示例17: execute
import org.jboss.seam.Component; //导入依赖的package包/类
public void execute(ExecutionContext executionContext) throws Exception {
Throwable e = executionContext.getException();
if (ELException.class.isAssignableFrom(e.getClass()) && e.getCause() != null
&& e.getCause() instanceof Exception) {
e = e.getCause();
}
/*
* if this is a transition, we memorize the source, throw an exception and
* reposition the flow from within seam.
*/
Node source = executionContext.getTransitionSource();
if (source != null) {
/*
* if the source of the transition is a decision, handle the failure of
* the transition like the failure of the decision.
*/
while (source instanceof Decision) {
Decision d = (Decision) source;
source = d.getLeavingTransition("failure").getTo();
}
ExceptionHandler handler = (ExceptionHandler) Component
.getInstance(ExceptionHandler.class);
handler.setNode(source.getName());
throw new RuntimeException("caught in transition", e);
} else {
log.error(ExceptionHandler.formatStacktraceForLog(e.getStackTrace()));
}
}
开发者ID:ecollado92,项目名称:TransitDataFeeder,代码行数:31,代码来源:ExceptionAction.java
示例18: beforePhase
import org.jboss.seam.Component; //导入依赖的package包/类
/**
* If the view starts with the view URL provided to the SocialAuth Seam
* component, this listener assumes that it has been redirected here by the
* external provider and verifies if the user is authenticated
*/
public void beforePhase(final PhaseEvent event) {
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext ec = ctx.getExternalContext();
/*
* Parameter 'successUrl' is configured in web.xml and it must be same
* there.
*/
String successUrl = ec.getInitParameter("successUrl");
String viewId = Pages.getCurrentViewId();
String view = successUrl.split("\\.")[0];
if (viewId == null || !viewId.startsWith(view)) {
return;
}
SocialAuth social = (SocialAuth) Component
.getInstance(SocialAuth.class);
try {
social.connect();
} catch (Exception e) {
log.warn(e);
}
Pages.handleOutcome(event.getFacesContext(), null, successUrl);
}
开发者ID:3pillarlabs,项目名称:socialauth,代码行数:33,代码来源:SocialAuthPhaseListener.java
示例19: call
import org.jboss.seam.Component; //导入依赖的package包/类
public IndexingResult call() throws Exception {
IndexingResult indexingResult = new IndexingResult();
Lifecycle.beginCall();
System.out.println("Removing perlemmaFL started.");
this.contextsIndexManager = (ContextsIndexManager) Component
.getInstance("contextsIndexManager");
this.contextsIndexManager.openIndexWriterWithoutCreating();
this.contextsIndexManager.removePerlemmaFl();
this.contextsIndexManager.closeIndexWriter();
Lifecycle.endCall();
this.setTerminated(true);
System.out.println("Removing perlemmaFL finished.");
return indexingResult;
}
开发者ID:lablita,项目名称:ridire-cpi,代码行数:15,代码来源:PerlemmaFLRemover.java
示例20: call
import org.jboss.seam.Component; //导入依赖的package包/类
public IndexingResult call() {
IndexingResult indexingResult = new IndexingResult();
Lifecycle.beginCall();
try {
this.contextsIndexManager = (ContextsIndexManager) Component
.getInstance("contextsIndexManager");
this.contextsIndexManager.deleteSingleCrawledResource(this.crId);
this.percentage = 1.0f;
} catch (Exception e) {
e.printStackTrace();
}
Lifecycle.endCall();
this.setTerminated(true);
return indexingResult;
}
开发者ID:lablita,项目名称:ridire-cpi,代码行数:16,代码来源:SingleResourceRemover.java
注:本文中的org.jboss.seam.Component类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论