本文整理汇总了Java中org.exoplatform.container.ExoContainer类的典型用法代码示例。如果您正苦于以下问题:Java ExoContainer类的具体用法?Java ExoContainer怎么用?Java ExoContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExoContainer类属于org.exoplatform.container包,在下文中一共展示了ExoContainer类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProvider
import org.exoplatform.container.ExoContainer; //导入依赖的package包/类
public <T> Provider<? extends T> getProvider(final Class<T> implementationType)
{
return new Provider<T>() {
public T get() {
ExoContainer container = ExoContainerContext.getCurrentContainer();
T ret = (T)container.getComponentInstance(implementationType);
if(ret == null)
{
PortalContainer portalContainer = PortalContainer.getInstance();
ret = (T)portalContainer.getComponentInstanceOfType(implementationType);
if(ret == null)
{
RootContainer rootContainer = RootContainer.getInstance();
ret = (T)rootContainer.getComponentInstanceOfType(implementationType);
}
}
return ret;
}
};
}
示例2: getService
import org.exoplatform.container.ExoContainer; //导入依赖的package包/类
/**
* Gets the service.
*
* @param clazz the class
* @param containerName the container's name
*
* @return the service
*/
public static <T> T getService(Class<T> clazz, String containerName) {
ExoContainer container = ExoContainerContext.getCurrentContainer();
if (containerName != null) {
container = RootContainer.getInstance().getPortalContainer(containerName);
}
if (container.getComponentInstanceOfType(clazz)==null) {
containerName = PortalContainer.getCurrentPortalContainerName();
container = RootContainer.getInstance().getPortalContainer(containerName);
}
return clazz.cast(container.getComponentInstanceOfType(clazz));
}
示例3: getRestName
import org.exoplatform.container.ExoContainer; //导入依赖的package包/类
public static String getRestName() {
ExoContainer container = ExoContainerContext.getCurrentContainer();
PortalContainerInfo containerInfo = (PortalContainerInfo) container .getComponentInstanceOfType(PortalContainerInfo.class);
String portalName = containerInfo.getContainerName();
PortalContainerConfig portalContainerConfig = WCMCoreUtils.getService(PortalContainerConfig.class);
return portalContainerConfig.getRestContextName(portalName);
}
示例4: registerNodeTypes
import org.exoplatform.container.ExoContainer; //导入依赖的package包/类
public void registerNodeTypes(String nodeTypeFilesName, int alreadyExistsBehaviour) throws Exception {
ExoContainer container = ExoContainerContext.getCurrentContainer();
ConfigurationManager configurationService = (ConfigurationManager) container.getComponentInstanceOfType(ConfigurationManager.class);
InputStream isXml = configurationService.getInputStream(nodeTypeFilesName);
ExtendedNodeTypeManager ntManager = this.repositoryService.getCurrentRepository().getNodeTypeManager();
LOG.info("\nTrying register node types from xml-file " + nodeTypeFilesName);
ntManager.registerNodeTypes(isXml, alreadyExistsBehaviour, NodeTypeDataManager.TEXT_XML);
LOG.info("\nNode types were registered from xml-file " + nodeTypeFilesName);
}
示例5: login
import org.exoplatform.container.ExoContainer; //导入依赖的package包/类
@Override
public boolean login() throws LoginException {
try {
ExoContainer container = getContainer();
HttpServletRequest servletRequest = getCurrentHttpServletRequest();
if (servletRequest == null) {
log.debug("HttpServletRequest is null. SMRedHatPortalLoginModule will be ignored.");
return false;
}
String username = SSOUtils.getSMUser(servletRequest);
log.debug("username: " + username);
if (username == null || "".equals(username.trim())) {
log.debug("SiteMinder user not found");
return false;
} else {
log.debug("SiteMinder user found");
addUserToPlatformUsers(username);
}
establishSecurityContext(container, username);
if (log.isTraceEnabled()) {
log.trace("Successfully established security context for user " + username);
}
return true;
} catch (Exception e) {
if (log.isTraceEnabled()) {
log.trace("Exception in login module", e);
}
throw new LoginException("OAuth login failed due to exception: " + e.getClass() + ": " + e.getMessage());
}
}
示例6: establishSecurityContext
import org.exoplatform.container.ExoContainer; //导入依赖的package包/类
protected void establishSecurityContext(ExoContainer container, String username) throws Exception {
Authenticator authenticator = (Authenticator) container.getComponentInstanceOfType(Authenticator.class);
if (authenticator == null) {
throw new LoginException("No Authenticator component found, check your configuration");
}
Identity identity = authenticator.createIdentity(username);
sharedState.put("exo.security.identity", identity);
sharedState.put("javax.security.auth.login.name", username);
subject.getPublicCredentials().add(new UsernameCredential(username));
}
示例7: getPortalName
import org.exoplatform.container.ExoContainer; //导入依赖的package包/类
public static String getPortalName() {
ExoContainer container = ExoContainerContext.getCurrentContainer();
PortalContainerInfo containerInfo = (PortalContainerInfo) container
.getComponentInstanceOfType(PortalContainerInfo.class);
return containerInfo.getContainerName();
}