JBoss portal CAS SSO
by Boudreau Luc
Hello,
I'm fairly new to the JBoss architecture and I'm trying to setup the
portal to authenticate against CAS. We use CAS because we are also
running Pentaho on the JBoss AS. We used ACEGI modules to setup an
authentication bridge, but I get an error message which is pretty
deceiving.
I'd like to debug the whole portal and ACEGI classes, but I can't find
any helpful documentation on how to setup an Eclipse environment which
would do the job. How can checkout/build/deploy the source code and
debug it ? It looks like the portal code is fragmented in about thirty
different Eclipse subprojects and frankly, I'm a bit confused. Where do
I start ?
Thanks for the help.
Luc
18Â years, 8Â months
[JBossCache] - Re:
by manik.surtaniï¼ jboss.com
You could write an SVN-based cache loader - basically a loader that uses SVN to read contents, generate the cache objects.
You would probably configure this not to use an eviction policy though, since you don't want objects to expire, rather to trigger an eviction when SVN detects a change. So you would have to write your own code to listen for changes in SVN, and when a key has changed, manually evict the key (or all affected keys) from the cache using the cache.evict() API.
Once the keys are evicted, the next call that comes in for this key will trigger a load from the CacheLoader, which could then build the object on demand.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071213#4071213
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071213
18Â years, 8Â months
[JBossCache] - Re: Data integrity in a clustered jboss cache
by manik.surtaniï¼ jboss.com
You would need to use transactions and REPL_SYNC if you want to achieve proper coherence, although this may not be the most performant with SERIALIZABLE. You could use REPEATABLE_READ, but some transactions may roll back due to upgrade exceptions and the like when you have a write collission - something you would have to deal with using a retry.
Regarding Spring declaring transactions on the cache, I'm afraid I cannot help you here as I do not know Spring that well. You would have to declare a TransactionManagerLookup in the cache configuration, and you could do something like:
| cache.getTransactionManager().begin();
| // .. do stuff with your cache ..
| cache.getTransactionManager().commit();
|
with the cache instance that Spring injects into your code.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071211#4071211
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071211
18Â years, 8Â months
[JBoss Seam] - Re: EntityConverter: Entity Manager not found
by mgrouch
EntityConverter and <s:convertEntity /> have serious limitation in both
Seam 2.0 and 1.2.1.GA - they require entity to be Seam managed.
I've solved this by not using <s:convertEntity />.
Instead I've created generic class EntitySelector which returns
list of Ids and converter. I'd extend this class for each dropdown (you probably would want to have a backing bean for dropdown anyway).
public abstract class EntitySelector<ID extends Serializable, ENTITY extends Serializable> implements Serializable {
|
| private final static Log log = LogFactory.getLog(EntitySelector.class);
|
| private static final int DEFAULT_SIZE = 0;
| private EntitySelectorConverter<ID, ENTITY> converter;
|
| private Map<String, ENTITY> lookupMap = new HashMap<String, ENTITY>(DEFAULT_SIZE);
| private List<ID> keyList = new ArrayList<ID>(DEFAULT_SIZE);
| private List<ENTITY> values = new ArrayList<ENTITY>(DEFAULT_SIZE);
|
| public static Object getId(Object bean) {
| Class<?> clazz = bean.getClass();
| log.trace("bean.getClass(): #0", clazz);
| if (!clazz.isAnnotationPresent(javax.persistence.Entity.class)) {
| // this better be instrumented proxy class
| clazz = clazz.getSuperclass();
| log.trace("bean.getClass().getSuperclass(): #0", clazz);
| }
| return Entity.forClass(clazz).getIdentifier(bean);
| }
|
| public ID getId(ENTITY bean) {
| return (ID) EntitySelector.getId((Object) bean);
| }
|
| public EntitySelector() {
| converter = new EntitySelectorConverter<ID, ENTITY>(this);
| }
|
| public void init(List<ENTITY> entities, Comparator<ENTITY> comparator) {
| if (entities != null) {
| values = entities;
| if (comparator != null) {
| Collections.sort(values, comparator);
| }
| final int size = values.size();
| lookupMap = new HashMap<String, ENTITY>(size);
| keyList = new ArrayList<ID>(size);
| for (ENTITY entity : entities) {
| ID key = getId(entity);
| String strKey = key.toString();
| lookupMap.put(strKey, entity);
| keyList.add(key);
| }
| }
| }
|
| @WebRemote
| public Map<String, ENTITY> getLookupMap() {
| return lookupMap;
| }
|
| @WebRemote
| public List<ID> getKeyList() {
| return keyList;
| }
|
| @WebRemote
| public List<ENTITY> getValues() {
| return values;
| }
|
| @WebRemote
| public ENTITY getByKey(String strKey) {
| ENTITY entity = null;
| if (lookupMap != null) {
| entity = lookupMap.get(strKey);
| }
| return entity;
| }
|
| public EntitySelectorConverter<ID, ENTITY> getConverter() {
| return converter;
| }
| }
public class EntitySelectorConverter<ID extends Serializable, ENTITY extends Serializable>
| implements javax.faces.convert.Converter, Serializable {
|
| private final static Log log = LogFactory.getLog(EntitySelectorConverter.class);
|
| private EntitySelector<ID, ENTITY> entitySelector;
|
| public EntitySelectorConverter(EntitySelector<ID, ENTITY> selector) {
| log.trace("EntitySelectorConverter selector=#0", selector);
| entitySelector = selector;
| }
|
| public String getAsString(FacesContext facesContext, UIComponent cmp,
| Object entity) throws ConverterException {
| if (entity == null) {
| return null;
| }
| ID id = entitySelector.getId((ENTITY) entity);
| log.trace("EntitySelectorConverter getAsString=#0 id=#1", entity, id);
| return id.toString();
| }
|
| public Object getAsObject(FacesContext facesContext, UIComponent cmp,
| String value) throws ConverterException {
| ENTITY entity = entitySelector.getByKey(value);
| log.trace("EntitySelectorConverter getAsObject=#0, entity=#1", value, entity);
| return entity;
| }
| }
This is how you would use it
@Name("timeZones")
| public class TimeZoneBean extends EntitySelector<String, TimeZone> {
|
| @Create
| public void create() {
| List<TimeZone> timeZones = ...
| init(timeZones, null);
| }
| }
And source tag:
<ui:component xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:a="https://ajax4jsf.dev.java.net/ajax"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:w="http://facelets-tags.com/tags"
| xmlns:rich="http://richfaces.ajax4jsf.org/rich">
| <h:selectOneMenu id="#{id}" styleClass="formtext" required="#{required}" value="#{value}" converter="#{timeZones.converter}" rendered="#{empty rendered ? true : rendered}">
| <s:selectItems value="#{timeZones.values}" var="timeZoneVar" noSelectionLabel="#{noSelectionLabel}" hideNoSelectionLabel="#{hideNoSelectionLabel}"
| label="#{timeZoneVar.timeZoneId}" />
| </h:selectOneMenu>
| </ui:component>
Please, let me know what you think about this approach.
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071208#4071208
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071208
18Â years, 8Â months
[JBoss jBPM] - Re: showing image of current process stage
by yairfr
here it is.
you need to print via JSPout the output. to see.
th function get the process instance id
| public StringBuffer showProcessImage (long processInstanceId) {
| byte[] gpdBytes = null;
| byte[] imageBytes = null;
| Token currentToken=null;
| String currentTokenColor = "red";
| long taskInstanceId=0;
| StringBuffer Sb = new StringBuffer();
| TaskInstance taskInstance=null;
| JbpmContext context = conf.createJbpmContext();
| GraphSession graphSession = context.getGraphSession();
| ProcessInstance pi = graphSession.loadProcessInstance(processInstanceId);
|
| TaskMgmtInstance tmi = pi.getTaskMgmtInstance();
| try {
| Collection tis = tmi.getUnfinishedTasks(pi.getRootToken());
|
| Iterator taskInstances = tis.iterator();
| if (taskInstances.hasNext()) {
| TaskInstance ti = (TaskInstance)taskInstances.next();
| taskInstanceId = ti.getId();
| taskInstance = context.getTaskMgmtSession().loadTaskInstance(taskInstanceId);
| }
| else //process has finished
| {
| Collection allTasks = tmi.getTaskInstances();
| Iterator AlltaskInstances = allTasks.iterator();
| TaskInstance LastInstance=null;
| while (AlltaskInstances.hasNext()) {
| LastInstance = (TaskInstance)AlltaskInstances.next();
| }
| taskInstanceId = LastInstance.getId();
| taskInstance = context.getTaskMgmtSession().loadTaskInstance(taskInstanceId);
| }
|
| currentToken = taskInstance.getToken();
| ProcessDefinition processDefinition = currentToken.getProcessInstance().getProcessDefinition();
| //String NodeName = currentToken.getProcessInstance().getRootToken().getNode().getName();
|
| FileDefinition fileDefinition = processDefinition.getFileDefinition();
| if (fileDefinition == null) {
| fileDefinition = new FileDefinition();
| processDefinition.addDefinition(fileDefinition);
| }
|
| String Path = Configuration.instance().GetParameter("","ProcessPath");
|
| Path += processDefinition.getName();
|
| addFileResourceToFileDefinition(fileDefinition, Path, "processimage.jpg");
| addFileResourceToFileDefinition(fileDefinition, Path, "gpd.xml");
|
|
| if (new File(Path + "\\gpd.xml").exists())
| {
| //if(fileDefinition!=null)
| //{
| //gpdBytes = fileDefinition.getBytes("gpd.xml");
| gpdBytes = processDefinition.getFileDefinition().getBytes("gpd.xml");
| imageBytes = processDefinition.getFileDefinition().getBytes("processimage.jpg");
|
| if (gpdBytes != null && imageBytes != null) {
| int borderWidth = 4;
| Element rootDiagramElement = DocumentHelper.parseText(new String(gpdBytes)).getRootElement();
| int[] boxConstraint;
| int[] imageDimension = extractImageDimension(rootDiagramElement);
| //String imageLink = "processimage?definitionId="+ processDefinition.getId();
| String imageLink = Path + "\\processimage.jpg";
|
|
| //jspOut.println("</div>");
| //}
| //else {
| boxConstraint = extractBoxConstraint(rootDiagramElement,currentToken);
|
| Sb.append("<script language='javascript'>");
| Sb.append("window.contentHeight = " + imageDimension[1] +";");
| Sb.append("window.contentWidth=" + imageDimension[0]+";");
| Sb.append("</script>");
| Sb.append("<table border=0 cellspacing=0 cellpadding=0 width="
| + imageDimension[0]
| + " height="
| + imageDimension[1] + ">");
| Sb.append(" <tr>");
| Sb.append(" <td width=" + imageDimension[0]
| + " height=" + imageDimension[1]
| + " style=\"background-image:url(" + imageLink
| + ")\" valign=top>");
| Sb.append(" <table border=0 cellspacing=0 cellpadding=0>");
| Sb.append(" <tr>");
| Sb.append(" <td width="
| + (boxConstraint[0] - borderWidth)
| + " height="
| + (boxConstraint[1] - borderWidth)
| + " style=\"background-color:transparent;\"></td>");
|
|
| Sb.append(" </tr>");
| Sb.append(" <tr>");
| Sb.append(" <td style=\"background-color:transparent;\"></td>");
| Sb.append(" <td style=\"border-color:"
| + currentTokenColor
| + "; border-width:"
| + borderWidth
| + "px; border-style:groove; background-color:transparent;\" width="
| + boxConstraint[2]
| + " height="
| + (boxConstraint[3] + (2 * borderWidth))
| + "> </td>");
| Sb.append(" </tr>");
| Sb.append(" </table>");
| Sb.append(" </td>");
| Sb.append(" </tr>");
| Sb.append("</table>");
| }
| }
| }
| catch (Exception e) {
| e.printStackTrace();
| //throw new JspException("table couldn't be displayed", e);
| }
|
| context.close();
|
| taskInstanceId = -1;
| gpdBytes = null;
| imageBytes = null;
| currentToken = null;
| return Sb;
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071207#4071207
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071207
18Â years, 8Â months