Seam SVN: r12670 - in modules/international/trunk: api/src/main/java/org/jboss/seam/international/timezone and 5 other directories.
by seam-commits@lists.jboss.org
Author: kenfinni
Date: 2010-04-30 16:47:56 -0400 (Fri, 30 Apr 2010)
New Revision: 12670
Added:
modules/international/trunk/api/src/main/java/org/jboss/seam/international/Changed.java
modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/ForwardingTimeZone.java
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/MockLogger.java
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/
Removed:
modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/Changed.java
modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/TimeZoneWrapper.java
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/
Modified:
modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/AvailableTimeZones.java
modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java
modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/UserTimeZoneProducer.java
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/AvailableTimeZoneBean.java
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/AvailableTimeZonesTest.java
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/DefaultTimeZoneTest.java
modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/UserTimeZoneTest.java
Log:
SEAMINTL-1 - Updates to TimeZone handling to use joda-time, forwarding class, resolved available timezone list being modifiable
Copied: modules/international/trunk/api/src/main/java/org/jboss/seam/international/Changed.java (from rev 12663, modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/Changed.java)
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/Changed.java (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/Changed.java 2010-04-30 20:47:56 UTC (rev 12670)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * Qualifier used with Events to signify either a TimeZone or Locale has changed.
+ *
+ * @author Ken Finnigan
+ */
+@Target( { PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+public @interface Changed
+{
+
+}
Deleted: modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/Changed.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/Changed.java 2010-04-30 20:27:09 UTC (rev 12669)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/Changed.java 2010-04-30 20:47:56 UTC (rev 12670)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.international.timezone;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * Change TimeZone of the User.
- *
- * @author Ken Finnigan
- */
-@Target( { PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@Qualifier
-public @interface Changed
-{
-
-}
Added: modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/ForwardingTimeZone.java
===================================================================
--- modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/ForwardingTimeZone.java (rev 0)
+++ modules/international/trunk/api/src/main/java/org/jboss/seam/international/timezone/ForwardingTimeZone.java 2010-04-30 20:47:56 UTC (rev 12670)
@@ -0,0 +1,158 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.timezone;
+
+import java.util.Locale;
+import java.util.TimeZone;
+
+import org.joda.time.DateTimeZone;
+
+/**
+ * Delegating TimeZone.
+ *
+ * @author Ken Finnigan
+ */
+public abstract class ForwardingTimeZone extends DateTimeZone
+{
+ /**
+ * Abstract getter for the delegate
+ *
+ * @return The delegate
+ */
+ protected abstract DateTimeZone delegate();
+
+ protected ForwardingTimeZone(String id)
+ {
+ super(id);
+ }
+
+ @Override
+ public long convertLocalToUTC(long instantLocal, boolean strict)
+ {
+ return delegate().convertLocalToUTC(instantLocal, strict);
+ }
+
+ @Override
+ public long convertUTCToLocal(long instantUTC)
+ {
+ return delegate().convertUTCToLocal(instantUTC);
+ }
+
+ @Override
+ public String getName(long instant, Locale locale)
+ {
+ return delegate().getName(instant, locale);
+ }
+
+ @Override
+ public String getNameKey(long instant)
+ {
+ return delegate().getNameKey(instant);
+ }
+
+ @Override
+ public int getOffset(long instant)
+ {
+ return delegate().getOffset(instant);
+ }
+
+ @Override
+ public int getOffsetFromLocal(long instantLocal)
+ {
+ return delegate().getOffsetFromLocal(instantLocal);
+ }
+
+ @Override
+ public String getShortName(long instant, Locale locale)
+ {
+ return delegate().getShortName(instant, locale);
+ }
+
+ @Override
+ public int getStandardOffset(long instant)
+ {
+ return delegate().getStandardOffset(instant);
+ }
+
+ @Override
+ public boolean isFixed()
+ {
+ return delegate().isFixed();
+ }
+
+ @Override
+ public boolean isStandardOffset(long instant)
+ {
+ return delegate().isStandardOffset(instant);
+ }
+
+ @Override
+ public long nextTransition(long instant)
+ {
+ return delegate().nextTransition(instant);
+ }
+
+ @Override
+ public long previousTransition(long instant)
+ {
+ return delegate().previousTransition(instant);
+ }
+
+ @Override
+ public TimeZone toTimeZone()
+ {
+ return delegate().toTimeZone();
+ }
+
+ /**
+ * Compares an object with the delegate
+ *
+ * @return True if equals, false otherwise
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ return delegate().equals(obj);
+ }
+
+ /**
+ * Gets the hash code of the delegate
+ *
+ * @return The hash code
+ */
+ @Override
+ public int hashCode()
+ {
+ return delegate().hashCode();
+ }
+
+ /**
+ * Returns a string representation
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return delegate().toString();
+ }
+}
Modified: modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/AvailableTimeZones.java
===================================================================
--- modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/AvailableTimeZones.java 2010-04-30 20:27:09 UTC (rev 12669)
+++ modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/AvailableTimeZones.java 2010-04-30 20:47:56 UTC (rev 12670)
@@ -25,12 +25,14 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import java.util.TimeZone;
+import java.util.Set;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
+import org.joda.time.DateTimeZone;
+
/**
* <p>
* Seam component that provides a list of time zones, limited to time zones with
@@ -57,39 +59,38 @@
{
private static final String TIMEZONE_ID_PREFIXES = "^(Africa|America|Asia|Atlantic|Australia|Europe|Indian|Pacific)/.*";
- private boolean wrap = true;
-
@Produces
- private List<TimeZone> timeZones = null;
+ private List<ForwardingTimeZone> timeZones = null;
+ @SuppressWarnings("unchecked")
@PostConstruct
public void init()
{
- timeZones = new ArrayList<TimeZone>();
- final String[] timeZoneIds = TimeZone.getAvailableIDs();
- for (final String id : timeZoneIds)
+ timeZones = new ArrayList<ForwardingTimeZone>();
+ final Set timeZoneIds = DateTimeZone.getAvailableIDs();
+ for (Object object : timeZoneIds)
{
+ String id = (String) object;
if (id.matches(TIMEZONE_ID_PREFIXES))
{
- timeZones.add(wrap ? new TimeZoneWrapper(TimeZone.getTimeZone(id)) : TimeZone.getTimeZone(id));
+ final DateTimeZone dtz = DateTimeZone.forID(id);
+ timeZones.add(new ForwardingTimeZone(id)
+ {
+ @Override
+ protected DateTimeZone delegate()
+ {
+ return dtz;
+ }
+ });
}
}
- Collections.sort(timeZones, new Comparator<TimeZone>()
+ Collections.sort(timeZones, new Comparator<ForwardingTimeZone>()
{
- public int compare(final TimeZone a, final TimeZone b)
+ public int compare(final ForwardingTimeZone a, final ForwardingTimeZone b)
{
return a.getID().compareTo(b.getID());
}
});
+ timeZones = Collections.unmodifiableList(timeZones);
}
-
- public boolean isWrap()
- {
- return wrap;
- }
-
- public void setWrap(boolean wrap)
- {
- this.wrap = wrap;
- }
}
Modified: modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java
===================================================================
--- modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java 2010-04-30 20:27:09 UTC (rev 12669)
+++ modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/DefaultTimeZoneProducer.java 2010-04-30 20:47:56 UTC (rev 12670)
@@ -22,13 +22,16 @@
package org.jboss.seam.international.timezone;
import java.io.Serializable;
-import java.util.TimeZone;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
import javax.inject.Named;
+import org.joda.time.DateTimeZone;
+import org.slf4j.Logger;
+
/**
* Default TimeZone of the application. If configuration of the default TimeZone
* is found that will be used, otherwise the JVM default TimeZone otherwise.
@@ -41,13 +44,46 @@
{
private static final long serialVersionUID = 6181892144731122500L;
+ String defaultTimeZoneId;
+
+ @Inject
+ Logger log;
+
@Produces
@Named
- private TimeZone defaultTimeZone;
+ private DateTimeZone defaultTimeZone = null;
@PostConstruct
public void init()
{
- defaultTimeZone = TimeZone.getDefault();
+ if (null != defaultTimeZoneId)
+ {
+ try
+ {
+ DateTimeZone dtz = DateTimeZone.forID(defaultTimeZoneId);
+ defaultTimeZone = constructTimeZone(dtz);
+ }
+ catch (IllegalArgumentException e)
+ {
+ log.warn("Default TimeZone Id of " + defaultTimeZoneId + " was not found");
+ }
+ }
+ if (null == defaultTimeZone)
+ {
+ DateTimeZone dtz = DateTimeZone.getDefault();
+ defaultTimeZone = constructTimeZone(dtz);
+ }
}
+
+ private ForwardingTimeZone constructTimeZone(final DateTimeZone dtz)
+ {
+ return new ForwardingTimeZone(dtz.getID())
+ {
+ @Override
+ protected DateTimeZone delegate()
+ {
+ return dtz;
+ }
+ };
+ }
}
Deleted: modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/TimeZoneWrapper.java
===================================================================
--- modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/TimeZoneWrapper.java 2010-04-30 20:27:09 UTC (rev 12669)
+++ modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/TimeZoneWrapper.java 2010-04-30 20:47:56 UTC (rev 12670)
@@ -1,142 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.international.timezone;
-
-import java.util.Date;
-import java.util.TimeZone;
-
-/**
- * A wrapper around a TimeZone that provides a more convenience interface to
- * access the time zone information in the UI, in particular in the options of a
- * select menu.
- *
- * @author Dan Allen
- */
-public class TimeZoneWrapper extends TimeZone
-{
- private static final long serialVersionUID = 8504687846433050650L;
-
- private static final int MILLISECONDS_PER_HOUR = 1000 * 60 * 60;
-
- private TimeZone timeZone;
-
- public TimeZoneWrapper(TimeZone tz)
- {
- timeZone = tz;
- setID(tz.getID());
- }
-
- @Override
- public void setID(String id)
- {
- super.setID(id);
- timeZone = TimeZone.getTimeZone(id);
- }
-
- public String getId()
- {
- return timeZone.getID();
- }
-
- public String getLabel()
- {
- StringBuilder label = new StringBuilder(50);
- label.append(getId().replace("_", " "));
- label.append(" (UTC");
- label.append(timeZone.getRawOffset() > 0 ? "+" : "-");
- if (Math.abs(timeZone.getRawOffset()) < MILLISECONDS_PER_HOUR * 10)
- {
- label.append("0");
- }
- label.append(Math.abs(timeZone.getRawOffset()) / MILLISECONDS_PER_HOUR);
- label.append(":00)");
- return label.toString();
- }
-
- public TimeZone getTimeZone()
- {
- return timeZone;
- }
-
- @Override
- public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis)
- {
- return timeZone.getOffset(era, year, month, day, dayOfWeek, millis);
- }
-
- @Override
- public void setRawOffset(int offset)
- {
- timeZone.setRawOffset(offset);
- }
-
- @Override
- public int getRawOffset()
- {
- return timeZone.getRawOffset();
- }
-
- @Override
- public boolean useDaylightTime()
- {
- return timeZone.useDaylightTime();
- }
-
- @Override
- public boolean inDaylightTime(Date date)
- {
- return timeZone.inDaylightTime(date);
- }
-
- @Override
- public Object clone()
- {
- return timeZone.clone();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == null)
- {
- return false;
- }
- if (getClass() != obj.getClass())
- {
- return false;
- }
- final TimeZoneWrapper other = (TimeZoneWrapper) obj;
- if (timeZone != other.timeZone && (timeZone == null || !timeZone.equals(other.timeZone)))
- {
- return false;
- }
- return true;
- }
-
- @Override
- public int hashCode()
- {
- int hash = 7;
- hash = 79 * hash + (timeZone != null ? timeZone.hashCode() : 0);
- return hash;
- }
-}
Modified: modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/UserTimeZoneProducer.java
===================================================================
--- modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/UserTimeZoneProducer.java 2010-04-30 20:27:09 UTC (rev 12669)
+++ modules/international/trunk/impl/src/main/java/org/jboss/seam/international/timezone/UserTimeZoneProducer.java 2010-04-30 20:47:56 UTC (rev 12670)
@@ -22,7 +22,6 @@
package org.jboss.seam.international.timezone;
import java.io.Serializable;
-import java.util.TimeZone;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Observes;
@@ -30,6 +29,9 @@
import javax.inject.Inject;
import javax.inject.Named;
+import org.jboss.seam.international.Changed;
+import org.joda.time.DateTimeZone;
+
/**
* TimeZone for a User Session. Defaults to the TimeZone within DefaultTimeZone
* and is altered when it receives the TimeZoneSelectedEvent.
@@ -45,15 +47,15 @@
@Produces
@UserTimeZone
@Named
- private TimeZone userTimeZone;
+ private DateTimeZone userTimeZone;
@Inject
- public void init(TimeZone defaultTimeZone)
+ public void init(DateTimeZone defaultTimeZone)
{
this.userTimeZone = defaultTimeZone;
}
- public void changeTimeZone(@Observes @Changed TimeZone tz)
+ public void changeTimeZone(@Observes @Changed DateTimeZone tz)
{
this.userTimeZone = tz;
}
Added: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/MockLogger.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/MockLogger.java (rev 0)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/MockLogger.java 2010-04-30 20:47:56 UTC (rev 12670)
@@ -0,0 +1,292 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.international.test;
+
+import org.slf4j.Logger;
+import org.slf4j.Marker;
+
+/**
+ * Provide a completely empty logger implementation for Unit Tests. This entire
+ * class is a no-op; it does <i>nothing</i>.
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
+ *
+ */
+public class MockLogger implements Logger
+{
+
+ public void debug(final String arg0)
+ {
+ }
+
+ public void debug(final String arg0, final Object arg1)
+ {
+ }
+
+ public void debug(final String arg0, final Object[] arg1)
+ {
+ }
+
+ public void debug(final String arg0, final Throwable arg1)
+ {
+ }
+
+ public void debug(final Marker arg0, final String arg1)
+ {
+ }
+
+ public void debug(final String arg0, final Object arg1, final Object arg2)
+ {
+ }
+
+ public void debug(final Marker arg0, final String arg1, final Object arg2)
+ {
+ }
+
+ public void debug(final Marker arg0, final String arg1, final Object[] arg2)
+ {
+ }
+
+ public void debug(final Marker arg0, final String arg1, final Throwable arg2)
+ {
+ }
+
+ public void debug(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+ {
+ }
+
+ public void error(final String arg0)
+ {
+ }
+
+ public void error(final String arg0, final Object arg1)
+ {
+ }
+
+ public void error(final String arg0, final Object[] arg1)
+ {
+ }
+
+ public void error(final String arg0, final Throwable arg1)
+ {
+ }
+
+ public void error(final Marker arg0, final String arg1)
+ {
+ }
+
+ public void error(final String arg0, final Object arg1, final Object arg2)
+ {
+ }
+
+ public void error(final Marker arg0, final String arg1, final Object arg2)
+ {
+ }
+
+ public void error(final Marker arg0, final String arg1, final Object[] arg2)
+ {
+ }
+
+ public void error(final Marker arg0, final String arg1, final Throwable arg2)
+ {
+ }
+
+ public void error(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+ {
+ }
+
+ public String getName()
+ {
+ return null;
+ }
+
+ public void info(final String arg0)
+ {
+ }
+
+ public void info(final String arg0, final Object arg1)
+ {
+ }
+
+ public void info(final String arg0, final Object[] arg1)
+ {
+ }
+
+ public void info(final String arg0, final Throwable arg1)
+ {
+ }
+
+ public void info(final Marker arg0, final String arg1)
+ {
+ }
+
+ public void info(final String arg0, final Object arg1, final Object arg2)
+ {
+ }
+
+ public void info(final Marker arg0, final String arg1, final Object arg2)
+ {
+ }
+
+ public void info(final Marker arg0, final String arg1, final Object[] arg2)
+ {
+ }
+
+ public void info(final Marker arg0, final String arg1, final Throwable arg2)
+ {
+ }
+
+ public void info(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+ {
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return false;
+ }
+
+ public boolean isDebugEnabled(final Marker arg0)
+ {
+ return false;
+ }
+
+ public boolean isErrorEnabled()
+ {
+ return false;
+ }
+
+ public boolean isErrorEnabled(final Marker arg0)
+ {
+ return false;
+ }
+
+ public boolean isInfoEnabled()
+ {
+ return false;
+ }
+
+ public boolean isInfoEnabled(final Marker arg0)
+ {
+ return false;
+ }
+
+ public boolean isTraceEnabled()
+ {
+ return false;
+ }
+
+ public boolean isTraceEnabled(final Marker arg0)
+ {
+ return false;
+ }
+
+ public boolean isWarnEnabled()
+ {
+ return false;
+ }
+
+ public boolean isWarnEnabled(final Marker arg0)
+ {
+ return false;
+ }
+
+ public void trace(final String arg0)
+ {
+ }
+
+ public void trace(final String arg0, final Object arg1)
+ {
+ }
+
+ public void trace(final String arg0, final Object[] arg1)
+ {
+ }
+
+ public void trace(final String arg0, final Throwable arg1)
+ {
+ }
+
+ public void trace(final Marker arg0, final String arg1)
+ {
+ }
+
+ public void trace(final String arg0, final Object arg1, final Object arg2)
+ {
+ }
+
+ public void trace(final Marker arg0, final String arg1, final Object arg2)
+ {
+ }
+
+ public void trace(final Marker arg0, final String arg1, final Object[] arg2)
+ {
+ }
+
+ public void trace(final Marker arg0, final String arg1, final Throwable arg2)
+ {
+ }
+
+ public void trace(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+ {
+ }
+
+ public void warn(final String arg0)
+ {
+ }
+
+ public void warn(final String arg0, final Object arg1)
+ {
+ }
+
+ public void warn(final String arg0, final Object[] arg1)
+ {
+ }
+
+ public void warn(final String arg0, final Throwable arg1)
+ {
+ }
+
+ public void warn(final Marker arg0, final String arg1)
+ {
+ }
+
+ public void warn(final String arg0, final Object arg1, final Object arg2)
+ {
+ }
+
+ public void warn(final Marker arg0, final String arg1, final Object arg2)
+ {
+ }
+
+ public void warn(final Marker arg0, final String arg1, final Object[] arg2)
+ {
+ }
+
+ public void warn(final Marker arg0, final String arg1, final Throwable arg2)
+ {
+ }
+
+ public void warn(final Marker arg0, final String arg1, final Object arg2, final Object arg3)
+ {
+ }
+
+}
Copied: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone (from rev 12663, modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test)
Modified: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/AvailableTimeZoneBean.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/AvailableTimeZoneBean.java 2010-04-29 13:14:28 UTC (rev 12663)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/AvailableTimeZoneBean.java 2010-04-30 20:47:56 UTC (rev 12670)
@@ -19,25 +19,26 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.seam.international.timezone.test;
+package org.jboss.seam.international.test.timezone;
import java.util.List;
-import java.util.TimeZone;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
+import org.joda.time.DateTimeZone;
+
@ApplicationScoped
public class AvailableTimeZoneBean
{
@Inject
- private List<TimeZone> timeZones;
+ private List<DateTimeZone> timeZones;
public AvailableTimeZoneBean()
{
}
- public List<TimeZone> getAvailTimeZones()
+ public List<DateTimeZone> getAvailTimeZones()
{
return timeZones;
}
Modified: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/AvailableTimeZonesTest.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/AvailableTimeZonesTest.java 2010-04-29 13:14:28 UTC (rev 12663)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/AvailableTimeZonesTest.java 2010-04-30 20:47:56 UTC (rev 12670)
@@ -19,10 +19,9 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.seam.international.timezone.test;
+package org.jboss.seam.international.test.timezone;
import java.util.List;
-import java.util.TimeZone;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
@@ -30,11 +29,12 @@
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.seam.international.timezone.AvailableTimeZones;
-import org.jboss.seam.international.timezone.TimeZoneWrapper;
+import org.jboss.seam.international.timezone.ForwardingTimeZone;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.joda.time.DateTimeZone;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -45,19 +45,19 @@
@Deployment
public static JavaArchive createTestArchive()
{
- return Archives.create("availabletimezonetest.jar", JavaArchive.class).addClasses(AvailableTimeZones.class, AvailableTimeZoneBean.class, TimeZoneWrapper.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+ return Archives.create("availabletimezonetest.jar", JavaArchive.class).addClasses(AvailableTimeZones.class, AvailableTimeZoneBean.class, ForwardingTimeZone.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
}
@Inject
Instance<AvailableTimeZoneBean> availBean;
@Inject
- List<TimeZone> timeZones;
+ List<DateTimeZone> timeZones;
@Test
public void testAvailableTimeZonesProducerViaBean()
{
Assert.assertNotNull(availBean);
- List<TimeZone> list = availBean.get().getAvailTimeZones();
+ List<DateTimeZone> list = availBean.get().getAvailTimeZones();
Assert.assertNotNull(list);
Assert.assertTrue(!list.isEmpty());
Assert.assertTrue(list.size() > 0);
Modified: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/DefaultTimeZoneTest.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/DefaultTimeZoneTest.java 2010-04-29 13:14:28 UTC (rev 12663)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/DefaultTimeZoneTest.java 2010-04-30 20:47:56 UTC (rev 12670)
@@ -19,19 +19,19 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.seam.international.timezone.test;
+package org.jboss.seam.international.test.timezone;
-import java.util.TimeZone;
-
import javax.inject.Inject;
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.international.test.MockLogger;
import org.jboss.seam.international.timezone.DefaultTimeZoneProducer;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.joda.time.DateTimeZone;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -42,11 +42,11 @@
@Deployment
public static JavaArchive createTestArchive()
{
- return Archives.create("defaulttimezonetest.jar", JavaArchive.class).addClasses(DefaultTimeZoneProducer.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+ return Archives.create("defaulttimezonetest.jar", JavaArchive.class).addClasses(MockLogger.class, DefaultTimeZoneProducer.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
}
@Inject
- TimeZone timeZone;
+ DateTimeZone timeZone;
@Test
public void testDefaultTimeZoneProducerDirect()
Modified: modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/UserTimeZoneTest.java
===================================================================
--- modules/international/trunk/impl/src/test/java/org/jboss/seam/international/timezone/test/UserTimeZoneTest.java 2010-04-29 13:14:28 UTC (rev 12663)
+++ modules/international/trunk/impl/src/test/java/org/jboss/seam/international/test/timezone/UserTimeZoneTest.java 2010-04-30 20:47:56 UTC (rev 12670)
@@ -19,17 +19,16 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.seam.international.timezone.test;
+package org.jboss.seam.international.test.timezone;
-import java.util.TimeZone;
-
import javax.enterprise.event.Event;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.international.timezone.Changed;
+import org.jboss.seam.international.Changed;
+import org.jboss.seam.international.test.MockLogger;
import org.jboss.seam.international.timezone.DefaultTimeZoneProducer;
import org.jboss.seam.international.timezone.UserTimeZone;
import org.jboss.seam.international.timezone.UserTimeZoneProducer;
@@ -37,6 +36,7 @@
import org.jboss.shrinkwrap.api.Archives;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.joda.time.DateTimeZone;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -47,20 +47,20 @@
@Deployment
public static JavaArchive createTestArchive()
{
- return Archives.create("usertimezonetest.jar", JavaArchive.class).addClasses(UserTimeZoneProducer.class, UserTimeZone.class, DefaultTimeZoneProducer.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+ return Archives.create("usertimezonetest.jar", JavaArchive.class).addClasses(MockLogger.class, UserTimeZoneProducer.class, UserTimeZone.class, DefaultTimeZoneProducer.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
}
@Inject
@UserTimeZone
- TimeZone timeZone;
+ DateTimeZone timeZone;
@Inject
@Changed
- Event<TimeZone> timeZoneEvent;
+ Event<DateTimeZone> timeZoneEvent;
@Inject
@UserTimeZone
- Instance<TimeZone> timeZoneSource;
+ Instance<DateTimeZone> timeZoneSource;
@Test
public void testUserTimeZoneProducerDirect()
@@ -71,11 +71,11 @@
@Test
public void testUserTimeZoneEvent()
{
- TimeZone tijuana = TimeZone.getTimeZone("America/Tijuana");
+ DateTimeZone tijuana = DateTimeZone.forID("America/Tijuana");
Assert.assertNotNull(timeZone);
Assert.assertFalse(timeZone.equals(tijuana));
timeZoneEvent.fire(tijuana);
- TimeZone tz = timeZoneSource.get();
+ DateTimeZone tz = timeZoneSource.get();
Assert.assertNotNull(tz);
Assert.assertTrue(tz.equals(tijuana));
}
14 years, 8 months
Seam SVN: r12669 - in modules/faces/trunk: api/src/main/java/org/jboss/seam/faces/display and 3 other directories.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-04-30 16:27:09 -0400 (Fri, 30 Apr 2010)
New Revision: 12669
Added:
modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/
modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Level.java
modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Message.java
modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Messages.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessage.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessages.java
Modified:
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/context/FlashScopedContext.java
modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml
Log:
Fixed the flash scope
Implemented first generation Messages API
Added: modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Level.java
===================================================================
--- modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Level.java (rev 0)
+++ modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Level.java 2010-04-30 20:27:09 UTC (rev 12669)
@@ -0,0 +1,28 @@
+/**
+ *
+ */
+package org.jboss.seam.faces.display;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+
+/**
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ *
+ */
+public enum Level
+{
+ INFO(FacesMessage.SEVERITY_INFO), WARN(FacesMessage.SEVERITY_WARN), ERROR(FacesMessage.SEVERITY_ERROR), FATAL(FacesMessage.SEVERITY_FATAL);
+
+ private Severity severity;
+
+ Level(final Severity severity)
+ {
+ this.severity = severity;
+ }
+
+ public Severity getSeverity()
+ {
+ return severity;
+ }
+}
\ No newline at end of file
Added: modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Message.java
===================================================================
--- modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Message.java (rev 0)
+++ modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Message.java 2010-04-30 20:27:09 UTC (rev 12669)
@@ -0,0 +1,47 @@
+package org.jboss.seam.faces.display;
+
+import java.io.Serializable;
+
+/**
+ * A convenient message to be displayed to the user as Feedback, Toast, Alerts,
+ * etc... See {@link Messages} for usage.
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ */
+public interface Message extends Serializable
+{
+ /**
+ * Set the message summary to be displayed if the output component is enabled
+ * to display summary. This is the primary text of the message.
+ *
+ * @param message
+ * @return The builder pattern {@link Message}
+ */
+ Message summary(String message);
+
+ /**
+ * Set the message details to be displayed if the output component is enabled
+ * to display detail. This is the secondary text of the message.
+ *
+ * @return The builder pattern {@link Message}
+ */
+ Message details(String details);
+
+ /**
+ * Specifies that this message should be displayed by the corresponding
+ * <code><h:message for="clientId" /></code> tag, where clientId is the
+ * ID of the component to which this message belongs.
+ *
+ * @param The clientId of the component to which this message should be
+ * attached/displayed
+ */
+ Message component(String clientId);
+
+ public Level getLevel();
+
+ public String getMessage();
+
+ public String getDetails();
+
+ public String getClientId();
+}
\ No newline at end of file
Added: modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Messages.java
===================================================================
--- modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Messages.java (rev 0)
+++ modules/faces/trunk/api/src/main/java/org/jboss/seam/faces/display/Messages.java 2010-04-30 20:27:09 UTC (rev 12669)
@@ -0,0 +1,36 @@
+package org.jboss.seam.faces.display;
+
+import java.util.Set;
+
+/**
+ * A convenient way to add messages to be displayed to the user as Feedback
+ * messages, Toast, Alerts, etc...
+ *
+ * Messages can be displayed by using the <code><h:messages /></code> tag
+ * in any given View.
+ *
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ */
+public interface Messages
+{
+ /**
+ * Create a new {@link Message} object and add it to the pending message
+ * cache. Messages remain pending until the Render Response phase is next
+ * invoked. E.g: If a redirect is issued before Render Response occurs,
+ * messages will be displayed during the next Render Response phase unless
+ * {@link Messages#clear()} is called, or the user's Session expires.
+ * <p>
+ * <b>Note:</b> Duplicate messages are ignored.
+ */
+ Message add(Level level);
+
+ /**
+ * Retrieve all pending messages.
+ */
+ Set<Message> getAll();
+
+ /**
+ * Clears all pending messages.
+ */
+ void clear();
+}
\ No newline at end of file
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/context/FlashScopedContext.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/context/FlashScopedContext.java 2010-04-30 16:11:01 UTC (rev 12668)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/context/FlashScopedContext.java 2010-04-30 20:27:09 UTC (rev 12669)
@@ -21,6 +21,7 @@
*/
package org.jboss.seam.faces.context;
+import java.io.IOException;
import java.lang.annotation.Annotation;
import java.util.Map;
import java.util.Map.Entry;
@@ -30,6 +31,7 @@
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
import javax.faces.bean.FlashScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -37,6 +39,9 @@
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
+import javax.faces.event.PreRenderViewEvent;
+import javax.inject.Inject;
+import javax.servlet.ServletRequest;
/**
* This class provides the lifecycle for the new JSF 2 Flash Context
@@ -45,157 +50,183 @@
*/
public class FlashScopedContext implements Context, PhaseListener
{
- private static final long serialVersionUID = -1580689204988513798L;
+ private static final long serialVersionUID = -1580689204988513798L;
- private final static String COMPONENT_MAP_NAME = "org.jboss.seam.faces.flash.componentInstanceMap";
- private final static String CREATIONAL_MAP_NAME = "org.jboss.seam.faces.flash.creationalInstanceMap";
- private final ThreadLocal<Map<Contextual<?>, Object>> lastComponentInstanceMap = new ThreadLocal<Map<Contextual<?>, Object>>();
- private final ThreadLocal<Map<Contextual<?>, CreationalContext<?>>> lastCreationalContextMap = new ThreadLocal<Map<Contextual<?>, CreationalContext<?>>>();
+ final static String COMPONENT_MAP_NAME = "org.jboss.seam.faces.flash.componentInstanceMap";
+ final static String CREATIONAL_MAP_NAME = "org.jboss.seam.faces.flash.creationalInstanceMap";
- @SuppressWarnings("unchecked")
- public <T> T get(final Contextual<T> component)
- {
- assertActive();
- return (T) getComponentInstanceMap().get(component);
- }
+ @SuppressWarnings("unchecked")
+ public <T> T get(final Contextual<T> component)
+ {
+ assertActive();
+ return (T) getComponentInstanceMap().get(component);
+ }
- @SuppressWarnings("unchecked")
- public <T> T get(final Contextual<T> component, final CreationalContext<T> creationalContext)
- {
- assertActive();
+ @SuppressWarnings("unchecked")
+ public <T> T get(final Contextual<T> component, final CreationalContext<T> creationalContext)
+ {
+ assertActive();
- T instance = get(component);
+ T instance = get(component);
- if (instance == null)
- {
- Map<Contextual<?>, CreationalContext<?>> creationalContextMap = getCreationalContextMap();
- Map<Contextual<?>, Object> componentInstanceMap = getComponentInstanceMap();
+ if (instance == null)
+ {
+ Map<Contextual<?>, CreationalContext<?>> creationalContextMap = getCreationalContextMap();
+ Map<Contextual<?>, Object> componentInstanceMap = getComponentInstanceMap();
- synchronized (componentInstanceMap)
+ synchronized (componentInstanceMap)
+ {
+ instance = (T) componentInstanceMap.get(component);
+ if (instance == null)
{
- instance = (T) componentInstanceMap.get(component);
- if (instance == null)
- {
- instance = component.create(creationalContext);
+ instance = component.create(creationalContext);
- if (instance != null)
- {
- componentInstanceMap.put(component, instance);
- creationalContextMap.put(component, creationalContext);
- }
- }
+ if (instance != null)
+ {
+ componentInstanceMap.put(component, instance);
+ creationalContextMap.put(component, creationalContext);
+ }
}
- }
+ }
+ }
- return instance;
- }
+ return instance;
+ }
- public Class<? extends Annotation> getScope()
- {
- return FlashScoped.class;
- }
+ public Class<? extends Annotation> getScope()
+ {
+ return FlashScoped.class;
+ }
- public boolean isActive()
- {
- return getFlash() != null;
- }
+ public boolean isActive()
+ {
+ return getFlash() != null;
+ }
- /**
- * This method should, **in theory**, catch the current instanceMap (which
- * is the previous lifecycle's next instanceMap.) These are the objects that
- * we want cleaned up at the end of the current render-response phase, so we
- * save them here until after the RENDER_RESPONSE phase, because otherwise
- * they would have been destroyed by the Flash, and we would no longer have
- * access to them.
- */
- public void beforePhase(final PhaseEvent event)
- {
- this.lastComponentInstanceMap.set(getComponentInstanceMap());
- this.lastCreationalContextMap.set(getCreationalContextMap());
- }
+ @Inject
+ FacesContext context;
- /**
- * Do the object cleanup using our saved references.
- */
- @SuppressWarnings("unchecked")
- public void afterPhase(final PhaseEvent event)
- {
- // TODO verify that this is actually destroying the beans we want to be
- // destroyed... flash is confusing, tests will make sense of it
- Map<Contextual<?>, Object> componentInstanceMap = lastComponentInstanceMap.get();
- Map<Contextual<?>, CreationalContext<?>> creationalContextMap = lastCreationalContextMap.get();
+ /**
+ * This method ensures that the contextual maps are populated before
+ * rendering occurs (thus, before any contextual objects are created during
+ * the Render Response phase.)
+ * <p>
+ * This method also ensures that the maps are available after Flash.clear()
+ * is called immediately before Render Response is complete.
+ *
+ * @param event
+ * @throws IOException
+ */
+ public void retrieveContextualMaps(@Observes final PreRenderViewEvent event) throws IOException
+ {
+ ExternalContext externalContext = context.getExternalContext();
+ Object temp = externalContext.getRequest();
+ if (temp instanceof ServletRequest)
+ {
+ Object componentMap = getComponentInstanceMap();
+ Object creationalMap = getCreationalContextMap();
- if (componentInstanceMap != null)
- {
- for (Entry<Contextual<?>, Object> componentEntry : componentInstanceMap.entrySet())
+ ServletRequest request = (ServletRequest) temp;
+ request.setAttribute(FlashScopedContext.COMPONENT_MAP_NAME, componentMap);
+ request.setAttribute(FlashScopedContext.CREATIONAL_MAP_NAME, creationalMap);
+ }
+ }
+
+ public void beforePhase(final PhaseEvent event)
+ {
+ }
+
+ /**
+ * This method saves the current scope metadata into the Flash after Restore
+ * View, then destroys the metadata after Render Response. Since the current
+ * request's execution Flash is swapped with the last requests execution
+ * flash for the Render Response phase, the last request's execution flash is
+ * actually the one that gets cleaned up.
+ * <p>
+ * Preserve this request's new metadata. Do the object cleanup using our
+ * saved references from last request.
+ */
+ @SuppressWarnings("unchecked")
+ public void afterPhase(final PhaseEvent event)
+ {
+ if (PhaseId.RENDER_RESPONSE.equals(event.getPhaseId()))
+ {
+ ExternalContext externalContext = event.getFacesContext().getExternalContext();
+ Object temp = externalContext.getRequest();
+ if (temp instanceof ServletRequest)
+ {
+ ServletRequest request = (ServletRequest) temp;
+
+ Map<Contextual<?>, Object> componentInstanceMap = (Map<Contextual<?>, Object>) request.getAttribute(FlashScopedContext.COMPONENT_MAP_NAME);
+ Map<Contextual<?>, CreationalContext<?>> creationalContextMap = (Map<Contextual<?>, CreationalContext<?>>) request.getAttribute(FlashScopedContext.CREATIONAL_MAP_NAME);
+
+ if ((componentInstanceMap != null) && (creationalContextMap != null))
{
- Contextual contextual = componentEntry.getKey();
- Object instance = componentEntry.getValue();
- CreationalContext creational = creationalContextMap.get(contextual);
+ for (Entry<Contextual<?>, Object> componentEntry : componentInstanceMap.entrySet())
+ {
+ Contextual contextual = componentEntry.getKey();
+ Object instance = componentEntry.getValue();
+ CreationalContext creational = creationalContextMap.get(contextual);
- contextual.destroy(instance, creational);
+ contextual.destroy(instance, creational);
+ }
}
- }
+ }
+ }
+ }
- this.lastComponentInstanceMap.remove();
- this.lastCreationalContextMap.remove();
- }
+ public PhaseId getPhaseId()
+ {
+ return PhaseId.ANY_PHASE;
+ }
- public PhaseId getPhaseId()
- {
- return PhaseId.RENDER_RESPONSE;
- }
+ private Flash getFlash()
+ {
+ FacesContext currentInstance = FacesContext.getCurrentInstance();
+ if (currentInstance != null)
+ {
+ ExternalContext externalContext = currentInstance.getExternalContext();
+ return externalContext.getFlash();
+ }
+ return null;
+ }
- private Flash getFlash()
- {
- FacesContext currentInstance = FacesContext.getCurrentInstance();
- if (currentInstance != null)
- {
- ExternalContext externalContext = currentInstance.getExternalContext();
- return externalContext.getFlash();
- }
- return null;
- }
+ private void assertActive()
+ {
+ if (!isActive())
+ {
+ throw new ContextNotActiveException("Seam context with scope annotation @FlashScoped is not active with respect to the current thread");
+ }
+ }
- private void assertActive()
- {
- if (!isActive())
- {
- throw new ContextNotActiveException(
- "Seam context with scope annotation @FlashScoped is not active with respect to the current thread");
- }
- }
+ @SuppressWarnings("unchecked")
+ private Map<Contextual<?>, Object> getComponentInstanceMap()
+ {
+ Flash flash = getFlash();
+ ConcurrentHashMap<Contextual<?>, Object> map = (ConcurrentHashMap<Contextual<?>, Object>) flash.get(COMPONENT_MAP_NAME);
- @SuppressWarnings("unchecked")
- private Map<Contextual<?>, Object> getComponentInstanceMap()
- {
- Flash flash = getFlash();
- ConcurrentHashMap<Contextual<?>, Object> map = (ConcurrentHashMap<Contextual<?>, Object>) flash
- .get(COMPONENT_MAP_NAME);
+ if (map == null)
+ {
+ map = new ConcurrentHashMap<Contextual<?>, Object>();
+ flash.put(COMPONENT_MAP_NAME, map);
+ }
- if (map == null)
- {
- map = new ConcurrentHashMap<Contextual<?>, Object>();
- flash.put(COMPONENT_MAP_NAME, map);
- }
+ return map;
+ }
- return map;
- }
+ @SuppressWarnings("unchecked")
+ private Map<Contextual<?>, CreationalContext<?>> getCreationalContextMap()
+ {
+ Flash flash = getFlash();
+ Map<Contextual<?>, CreationalContext<?>> map = (ConcurrentHashMap<Contextual<?>, CreationalContext<?>>) flash.get(CREATIONAL_MAP_NAME);
- @SuppressWarnings("unchecked")
- private Map<Contextual<?>, CreationalContext<?>> getCreationalContextMap()
- {
- Flash flash = getFlash();
- Map<Contextual<?>, CreationalContext<?>> map = (ConcurrentHashMap<Contextual<?>, CreationalContext<?>>) flash
- .get(CREATIONAL_MAP_NAME);
+ if (map == null)
+ {
+ map = new ConcurrentHashMap<Contextual<?>, CreationalContext<?>>();
+ flash.put(CREATIONAL_MAP_NAME, map);
+ }
- if (map == null)
- {
- map = new ConcurrentHashMap<Contextual<?>, CreationalContext<?>>();
- flash.put(CREATIONAL_MAP_NAME, map);
- }
+ return map;
+ }
- return map;
- }
-
}
Added: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessage.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessage.java (rev 0)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessage.java 2010-04-30 20:27:09 UTC (rev 12669)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.seam.faces.display;
+
+/**
+ * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
+ *
+ */
+public class SeamMessage implements Message
+{
+ private static final long serialVersionUID = 6650116552438358826L;
+
+ private String message;
+ private String details;
+ private String clientId;
+ private final Level level;
+
+ public SeamMessage(final Level level)
+ {
+ this.level = level;
+ }
+
+ public Message component(final String clientId)
+ {
+ this.clientId = clientId;
+ return this;
+ }
+
+ public Message details(final String details)
+ {
+ this.details = details;
+ return this;
+ }
+
+ public Message summary(final String message)
+ {
+ this.message = message;
+ return this;
+ }
+
+ /*
+ * Getters & Setters
+ */
+ public Level getLevel()
+ {
+ return level;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public String getDetails()
+ {
+ return details;
+ }
+
+ public String getClientId()
+ {
+ return clientId;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((clientId == null) ? 0 : clientId.hashCode());
+ result = prime * result + ((details == null) ? 0 : details.hashCode());
+ result = prime * result + ((level == null) ? 0 : level.hashCode());
+ result = prime * result + ((message == null) ? 0 : message.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ SeamMessage other = (SeamMessage) obj;
+ if (clientId == null)
+ {
+ if (other.clientId != null)
+ {
+ return false;
+ }
+ }
+ else if (!clientId.equals(other.clientId))
+ {
+ return false;
+ }
+ if (details == null)
+ {
+ if (other.details != null)
+ {
+ return false;
+ }
+ }
+ else if (!details.equals(other.details))
+ {
+ return false;
+ }
+ if (level == null)
+ {
+ if (other.level != null)
+ {
+ return false;
+ }
+ }
+ else if (!level.equals(other.level))
+ {
+ return false;
+ }
+ if (message == null)
+ {
+ if (other.message != null)
+ {
+ return false;
+ }
+ }
+ else if (!message.equals(other.message))
+ {
+ return false;
+ }
+ return true;
+ }
+
+}
Added: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessages.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessages.java (rev 0)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/SeamMessages.java 2010-04-30 20:27:09 UTC (rev 12669)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.seam.faces.display;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Observes;
+import javax.faces.application.FacesMessage;
+import javax.faces.event.PhaseEvent;
+
+import org.jboss.seam.faces.event.qualifier.Before;
+import org.jboss.seam.faces.event.qualifier.RenderResponse;
+
+/**
+ * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
+ *
+ */
+@SessionScoped
+public class SeamMessages implements Messages, Serializable
+{
+ private static final long serialVersionUID = -2908193057765795662L;
+ private final Set<Message> messages = Collections.synchronizedSet(new HashSet<Message>());
+
+ @SuppressWarnings("unused")
+ private void convert(@Observes @Before @RenderResponse final PhaseEvent event)
+ {
+ for (Message m : messages)
+ {
+ event.getFacesContext().addMessage(m.getClientId(), new FacesMessage(m.getLevel().getSeverity(), m.getMessage(), m.getDetails()));
+ }
+ clear();
+ }
+
+ public void clear()
+ {
+ messages.clear();
+ }
+
+ public Message add(final Level level)
+ {
+ Message result = new SeamMessage(level);
+ messages.add(result);
+ return result;
+ }
+
+ public Set<Message> getAll()
+ {
+ Set<Message> result;
+ synchronized (messages)
+ {
+ result = Collections.unmodifiableSet(messages);
+ }
+ return result;
+ }
+
+}
Modified: modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml
===================================================================
--- modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml 2010-04-30 16:11:01 UTC (rev 12668)
+++ modules/faces/trunk/impl/src/main/resources/META-INF/faces-config.xml 2010-04-30 20:27:09 UTC (rev 12669)
@@ -42,6 +42,10 @@
<system-event-listener-class>org.jboss.seam.faces.event.DelegatingSystemEventListener</system-event-listener-class>
<system-event-class>javax.faces.event.PreDestroyCustomScopeEvent</system-event-class>
</system-event-listener>
+ <system-event-listener>
+ <system-event-listener-class>org.jboss.seam.faces.event.DelegatingSystemEventListener</system-event-listener-class>
+ <system-event-class>javax.faces.event.PreRenderViewEvent</system-event-class>
+ </system-event-listener>
</application>
<component>
14 years, 8 months
Seam SVN: r12668 - in branches/enterprise/JBPAPP_5_0/examples: blog/resources and 8 other directories.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-04-30 12:11:01 -0400 (Fri, 30 Apr 2010)
New Revision: 12668
Added:
branches/enterprise/JBPAPP_5_0/examples/blog/resources/META-INF/cache-configuration.xml
branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/resources/META-INF/cache-configuration.xml
branches/enterprise/JBPAPP_5_0/examples/ui/resources/META-INF/cache-configuration.xml
Removed:
branches/enterprise/JBPAPP_5_0/examples/blog/resources/treecache.xml
branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/resources/treecache.xml
branches/enterprise/JBPAPP_5_0/examples/ui/resources/treecache.xml
Modified:
branches/enterprise/JBPAPP_5_0/examples/blog/resources/WEB-INF/components.xml
branches/enterprise/JBPAPP_5_0/examples/build.xml
branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/resources/WEB-INF/components.xml
branches/enterprise/JBPAPP_5_0/examples/ui/resources/WEB-INF/components.xml
Log:
JBPAPP-4129 - configured blog, ui and chatroom examples with jbosscache-core.jar
Added: branches/enterprise/JBPAPP_5_0/examples/blog/resources/META-INF/cache-configuration.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/blog/resources/META-INF/cache-configuration.xml (rev 0)
+++ branches/enterprise/JBPAPP_5_0/examples/blog/resources/META-INF/cache-configuration.xml 2010-04-30 16:11:01 UTC (rev 12668)
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.0">
+
+
+ <!--
+ isolation levels supported: READ_COMMITTED and REPEATABLE_READ
+ nodeLockingSchemes: mvcc, pessimistic (deprecated), optimistic (deprecated)
+ -->
+ <locking
+ isolationLevel="REPEATABLE_READ"
+ lockParentForChildInsertRemove="false"
+ lockAcquisitionTimeout="20000"
+ nodeLockingScheme="mvcc"
+ writeSkewCheck="false"
+ concurrencyLevel="500"/>
+
+ <!--
+ Used to register a transaction manager and participate in ongoing transactions.
+ -->
+ <transaction
+ transactionManagerLookupClass="org.jboss.cache.transaction.JBossTransactionManagerLookup"
+ syncRollbackPhase="false"
+ syncCommitPhase="false"/>
+
+ <!--
+ Used to register JMX statistics in any available MBean server
+ -->
+ <jmxStatistics
+ enabled="false"/>
+
+ <!--
+ If region based marshalling is used, defines whether new regions are inactive on startup.
+ -->
+ <startup
+ regionsInactiveOnStartup="true"/>
+
+ <!--
+ Used to register JVM shutdown hooks.
+ hookBehavior: DEFAULT, REGISTER, DONT_REGISTER
+ -->
+ <shutdown
+ hookBehavior="DEFAULT"/>
+
+ <!--
+ Used to define async listener notification thread pool size
+ -->
+ <listeners
+ asyncPoolSize="1"
+ asyncQueueSize="1000000"/>
+
+ <!--
+ Used to enable invocation batching and allow the use of Cache.startBatch()/endBatch() methods.
+ -->
+ <invocationBatching
+ enabled="false"/>
+
+ <!--
+ serialization related configuration, used for replication and cache loading
+ -->
+<!-- <serialization
+ objectInputStreamPoolSize="12"
+ objectOutputStreamPoolSize="14"
+ version="3.0.0"
+ marshallerClass="org.jboss.cache.marshall.VersionAwareMarshaller"
+ useLazyDeserialization="false"
+ useRegionBasedMarshalling="false"/> -->
+
+ <!--
+ This element specifies that the cache is clustered.
+ modes supported: replication (r) or invalidation (i).
+ -->
+ <clustering mode="replication" clusterName="JBossCache-cluster">
+
+ <!--
+ Defines whether to retrieve state on startup
+ -->
+ <stateRetrieval timeout="20000" fetchInMemoryState="false"/>
+
+ <!--
+ Network calls are synchronous.
+ -->
+ <sync replTimeout="20000"/>
+ <!--
+ Uncomment this for async replication.
+ -->
+ <!--<async useReplQueue="true" replQueueInterval="10000" replQueueMaxElements="500" serializationExecutorPoolSize="20" serializationExecutorQueueSize="5000000"/>-->
+
+
+ <!--
+ Configures the JGroups channel. Looks up a JGroups config file on the classpath or filesystem. udp.xml
+ ships with jgroups.jar and will be picked up by the class loader.
+ -->
+ <jgroupsConfig>
+
+ <UDP discard_incompatible_packets="true" enable_bundling="false" enable_diagnostics="false" ip_ttl="2"
+ loopback="false" max_bundle_size="64000" max_bundle_timeout="30" mcast_addr="228.10.10.10"
+ mcast_port="45588" mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
+ oob_thread_pool.enabled="true" oob_thread_pool.keep_alive_time="10000" oob_thread_pool.max_threads="4"
+ oob_thread_pool.min_threads="1" oob_thread_pool.queue_enabled="true" oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl" thread_pool.enabled="true"
+ thread_pool.keep_alive_time="30000" thread_pool.max_threads="25" thread_pool.min_threads="1"
+ thread_pool.queue_enabled="true" thread_pool.queue_max_size="10" thread_pool.rejection_policy="Run"
+ tos="8" ucast_recv_buf_size="20000000" ucast_send_buf_size="640000" use_concurrent_stack="true"
+ use_incoming_packet_handler="true"/>
+ <PING num_initial_members="3" timeout="2000"/>
+ <MERGE2 max_interval="30000" min_interval="10000"/>
+ <FD_SOCK/>
+ <FD max_tries="5" shun="true" timeout="10000"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
+ use_mcast_xmit="false"/>
+ <UNICAST timeout="300,600,1200,2400,3600"/>
+ <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000" stability_delay="1000"/>
+ <pbcast.GMS join_timeout="5000" print_local_addr="true" shun="false" view_ack_collection_timeout="5000"
+ view_bundling="true"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER/>
+ <pbcast.FLUSH timeout="0"/>
+
+ </jgroupsConfig>
+ </clustering>
+
+ <!--
+ Cache loaders.
+
+ If passivation is enabled, state is offloaded to the cache loaders ONLY when evicted. Similarly, when the state
+ is accessed again, it is removed from the cache loader and loaded into memory.
+
+ Otherwise, state is always maintained in the cache loader as well as in memory.
+
+ Set 'shared' to true if all instances in the cluster use the same cache loader instance, e.g., are talking to the
+ same database.
+ -->
+ <!-- <loaders passivation="false" shared="false">
+ <preload>
+ <node fqn="/org/jboss"/>
+ <node fqn="/org/tempdata"/>
+ </preload> -->
+
+ <!--
+ we can have multiple cache loaders, which get chained
+ -->
+ <!-- <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="true" fetchPersistentState="true"
+ ignoreModifications="true" purgeOnStartup="true">
+
+ <properties>
+ cache.jdbc.table.name=jbosscache
+ cache.jdbc.table.create=true
+ cache.jdbc.table.drop=true
+ cache.jdbc.table.primarykey=jbosscache_pk
+ cache.jdbc.fqn.column=fqn
+ cache.jdbc.fqn.type=varchar(255)
+ cache.jdbc.node.column=node
+ cache.jdbc.node.type=blob
+ cache.jdbc.parent.column=parent
+ cache.jdbc.sql-concat=1 || 2
+ cache.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver
+ cache.jdbc.url=jdbc:derby:jbossdb;create=true
+ cache.jdbc.user=user1
+ cache.jdbc.password=user1
+ </properties> -->
+ <!-- alternatively use a connection from a datasorce, as per the code sample below-->
+ <!--<properties>-->
+ <!--cache.jdbc.datasource=AllSampleDS-->
+ <!--cache.jdbc.table.name=jbosscache-->
+ <!--cache.jdbc.table.create=true-->
+ <!--cache.jdbc.table.drop=true-->
+ <!--</properties>-->
+ <!-- <singletonStore enabled="true" class="org.jboss.cache.loader.SingletonStoreCacheLoader">
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=20000
+ </properties>
+ </singletonStore>
+ </loader>
+ </loaders> -->
+
+ <!--
+ Define custom interceptors. All custom interceptors need to extend org.jboss.cache.interceptors.base.CommandInterceptor
+ -->
+ <!--
+ <customInterceptors>
+ <interceptor position="first" class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor">
+ <property name="attrOne" value="value1" />
+ <property name="attrTwo" value="value2" />
+ </interceptor>
+ <interceptor position="last" class="org.jboss.cache.config.parsing.custominterceptors.BbbCustomInterceptor"/>
+ <interceptor index="3" class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor"/>
+ <interceptor before="org.jboss.cache.interceptors.CallInterceptor"
+ class="org.jboss.cache.config.parsing.custominterceptors.BbbCustomInterceptor"/>
+ <interceptor after="org.jboss.cache.interceptors.CallInterceptor"
+ class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor"/>
+ </customInterceptors>
+ -->
+</jbosscache>
Modified: branches/enterprise/JBPAPP_5_0/examples/blog/resources/WEB-INF/components.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/blog/resources/WEB-INF/components.xml 2010-04-30 15:57:18 UTC (rev 12667)
+++ branches/enterprise/JBPAPP_5_0/examples/blog/resources/WEB-INF/components.xml 2010-04-30 16:11:01 UTC (rev 12668)
@@ -30,6 +30,8 @@
</theme:available-themes>
</theme:theme-selector>
+ <cache:jboss-cache3-provider auto-create="true" configuration="META-INF/cache-configuration.xml" />
+
<persistence:managed-persistence-context auto-create="true" name="entityManager">
<persistence:persistence-unit-jndi-name>java:/blogEntityManagerFactory</persistence:persistence-unit-jndi-name>
</persistence:managed-persistence-context>
Deleted: branches/enterprise/JBPAPP_5_0/examples/blog/resources/treecache.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/blog/resources/treecache.xml 2010-04-30 15:57:18 UTC (rev 12667)
+++ branches/enterprise/JBPAPP_5_0/examples/blog/resources/treecache.xml 2010-04-30 16:11:01 UTC (rev 12668)
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ===================================================================== -->
-<!-- -->
-<!-- Sample TreeCache Service Configuration -->
-<!-- -->
-<!-- ===================================================================== -->
-
-<server>
-
- <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
-
-
- <!-- ==================================================================== -->
- <!-- Defines TreeCache configuration -->
- <!-- ==================================================================== -->
-
- <mbean code="org.jboss.cache.TreeCache"
- name="jboss.cache:service=TreeCache">
-
- <depends>jboss:service=Naming</depends>
- <depends>jboss:service=TransactionManager</depends>
-
- <!--
- Configure the TransactionManager
- -->
- <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
-
- <!--
- Isolation level : SERIALIZABLE
- REPEATABLE_READ (default)
- READ_COMMITTED
- READ_UNCOMMITTED
- NONE
- -->
- <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
-
- <!--
- Valid modes are LOCAL
- REPL_ASYNC
- REPL_SYNC
- INVALIDATION_ASYNC
- INVALIDATION_SYNC
- -->
- <attribute name="CacheMode">LOCAL</attribute>
-
- <!--
- Just used for async repl: use a replication queue
- -->
- <attribute name="UseReplQueue">false</attribute>
-
- <!--
- Replication interval for replication queue (in ms)
- -->
- <attribute name="ReplQueueInterval">0</attribute>
-
- <!--
- Max number of elements which trigger replication
- -->
- <attribute name="ReplQueueMaxElements">0</attribute>
-
- <!-- Name of cluster. Needs to be the same for all clusters, in order
- to find each other
- -->
- <attribute name="ClusterName">TreeCache-Cluster</attribute>
-
- <!-- JGroups protocol stack properties. Can also be a URL,
- e.g. file:/home/bela/default.xml
- <attribute name="ClusterProperties"></attribute>
- -->
-
- <attribute name="ClusterConfig">
- <config>
- <!-- UDP: if you have a multihomed machine,
- set the bind_addr attribute to the appropriate NIC IP address -->
- <!-- UDP: On Windows machines, because of the media sense feature
- being broken with multicast (even after disabling media sense)
- set the loopback attribute to true -->
- <UDP mcast_addr="228.1.2.3" mcast_port="48866"
- ip_ttl="64" ip_mcast="true"
- mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
- ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
- loopback="false"/>
- <PING timeout="2000" num_initial_members="3"
- up_thread="false" down_thread="false"/>
- <MERGE2 min_interval="10000" max_interval="20000"/>
- <!-- <FD shun="true" up_thread="true" down_thread="true" />-->
- <FD_SOCK/>
- <VERIFY_SUSPECT timeout="1500"
- up_thread="false" down_thread="false"/>
- <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
- max_xmit_size="8192" up_thread="false" down_thread="false"/>
- <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"
- down_thread="false"/>
- <pbcast.STABLE desired_avg_gossip="20000"
- up_thread="false" down_thread="false"/>
- <FRAG frag_size="8192"
- down_thread="false" up_thread="false"/>
- <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
- shun="true" print_local_addr="true"/>
- <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
- </config>
- </attribute>
-
- <!--
- Whether or not to fetch state on joining a cluster
- NOTE this used to be called FetchStateOnStartup and has been renamed to be more descriptive.
- -->
- <attribute name="FetchInMemoryState">true</attribute>
-
- <!--
- The max amount of time (in milliseconds) we wait until the
- initial state (ie. the contents of the cache) are retrieved from
- existing members in a clustered environment
- -->
- <attribute name="InitialStateRetrievalTimeout">20000</attribute>
-
- <!--
- Number of milliseconds to wait until all responses for a
- synchronous call have been received.
- -->
- <attribute name="SyncReplTimeout">20000</attribute>
-
- <!-- Max number of milliseconds to wait for a lock acquisition -->
- <attribute name="LockAcquisitionTimeout">15000</attribute>
-
-
- <!-- Name of the eviction policy class. -->
- <attribute name="EvictionPolicyClass"></attribute>
-
- <!--
- Indicate whether to use marshalling or not. Set this to true if you are running under a scoped
- class loader, e.g., inside an application server. Default is "false".
- -->
- <attribute name="UseMarshalling">false</attribute>
-
- </mbean>
-
-
- <!-- Uncomment to get a graphical view of the TreeCache MBean above -->
- <!-- <mbean code="org.jboss.cache.TreeCacheView" name="jboss.cache:service=TreeCacheView">-->
- <!-- <depends>jboss.cache:service=TreeCache</depends>-->
- <!-- <attribute name="CacheService">jboss.cache:service=TreeCache</attribute>-->
- <!-- </mbean>-->
-
-
-</server>
Modified: branches/enterprise/JBPAPP_5_0/examples/build.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/build.xml 2010-04-30 15:57:18 UTC (rev 12667)
+++ branches/enterprise/JBPAPP_5_0/examples/build.xml 2010-04-30 16:11:01 UTC (rev 12668)
@@ -262,7 +262,7 @@
<!-- Dependencies for using Seam with JBoss Cache (s:cache) -->
<fileset id="cache.jar" dir="${lib.dir}">
- <include name="jboss-cache.jar" if="cache.lib" />
+ <include name="jbosscache-core.jar" if="cache.lib" />
<include name="jboss-aop.jar" if="cache.lib" />
<include name="jgroups.jar" if="cache.lib" />
</fileset>
@@ -404,7 +404,7 @@
<!-- resources to go in the jar for jbosswar -->
<fileset id="noejb.jar.resources" dir="${resources.dir}">
<include name="${example.ds}" />
- <include name="treecache.xml" />
+ <include name="META-INF/cache-configuration.xml" />
<include name="*.jpdl.xml" />
<include name="jbpm.cfg.xml" />
<include name="hibernate.cfg.xml" />
@@ -418,7 +418,7 @@
<include name="META-INF/jboss-structure.xml" />
<include name="META-INF/*-service.xml" />
<include name="META-INF/*-xmbean.xml" />
- <include name="treecache.xml" />
+ <include name="META-INF/cache-configuration.xml" />
<include name="*.jpdl.xml" />
<exclude name=".gpd.*" />
<include name="*.cfg.xml" />
Added: branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/resources/META-INF/cache-configuration.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/resources/META-INF/cache-configuration.xml (rev 0)
+++ branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/resources/META-INF/cache-configuration.xml 2010-04-30 16:11:01 UTC (rev 12668)
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.0">
+
+
+ <!--
+ isolation levels supported: READ_COMMITTED and REPEATABLE_READ
+ nodeLockingSchemes: mvcc, pessimistic (deprecated), optimistic (deprecated)
+ -->
+ <locking
+ isolationLevel="REPEATABLE_READ"
+ lockParentForChildInsertRemove="false"
+ lockAcquisitionTimeout="20000"
+ nodeLockingScheme="mvcc"
+ writeSkewCheck="false"
+ concurrencyLevel="500"/>
+
+ <!--
+ Used to register a transaction manager and participate in ongoing transactions.
+ -->
+ <transaction
+ transactionManagerLookupClass="org.jboss.cache.transaction.JBossTransactionManagerLookup"
+ syncRollbackPhase="false"
+ syncCommitPhase="false"/>
+
+ <!--
+ Used to register JMX statistics in any available MBean server
+ -->
+ <jmxStatistics
+ enabled="false"/>
+
+ <!--
+ If region based marshalling is used, defines whether new regions are inactive on startup.
+ -->
+ <startup
+ regionsInactiveOnStartup="true"/>
+
+ <!--
+ Used to register JVM shutdown hooks.
+ hookBehavior: DEFAULT, REGISTER, DONT_REGISTER
+ -->
+ <shutdown
+ hookBehavior="DEFAULT"/>
+
+ <!--
+ Used to define async listener notification thread pool size
+ -->
+ <listeners
+ asyncPoolSize="1"
+ asyncQueueSize="1000000"/>
+
+ <!--
+ Used to enable invocation batching and allow the use of Cache.startBatch()/endBatch() methods.
+ -->
+ <invocationBatching
+ enabled="false"/>
+
+ <!--
+ serialization related configuration, used for replication and cache loading
+ -->
+<!-- <serialization
+ objectInputStreamPoolSize="12"
+ objectOutputStreamPoolSize="14"
+ version="3.0.0"
+ marshallerClass="org.jboss.cache.marshall.VersionAwareMarshaller"
+ useLazyDeserialization="false"
+ useRegionBasedMarshalling="false"/> -->
+
+ <!--
+ This element specifies that the cache is clustered.
+ modes supported: replication (r) or invalidation (i).
+ -->
+ <clustering mode="replication" clusterName="JBossCache-cluster">
+
+ <!--
+ Defines whether to retrieve state on startup
+ -->
+ <stateRetrieval timeout="20000" fetchInMemoryState="false"/>
+
+ <!--
+ Network calls are synchronous.
+ -->
+ <sync replTimeout="20000"/>
+ <!--
+ Uncomment this for async replication.
+ -->
+ <!--<async useReplQueue="true" replQueueInterval="10000" replQueueMaxElements="500" serializationExecutorPoolSize="20" serializationExecutorQueueSize="5000000"/>-->
+
+
+ <!--
+ Configures the JGroups channel. Looks up a JGroups config file on the classpath or filesystem. udp.xml
+ ships with jgroups.jar and will be picked up by the class loader.
+ -->
+ <jgroupsConfig>
+
+ <UDP discard_incompatible_packets="true" enable_bundling="false" enable_diagnostics="false" ip_ttl="2"
+ loopback="false" max_bundle_size="64000" max_bundle_timeout="30" mcast_addr="228.10.10.10"
+ mcast_port="45588" mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
+ oob_thread_pool.enabled="true" oob_thread_pool.keep_alive_time="10000" oob_thread_pool.max_threads="4"
+ oob_thread_pool.min_threads="1" oob_thread_pool.queue_enabled="true" oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl" thread_pool.enabled="true"
+ thread_pool.keep_alive_time="30000" thread_pool.max_threads="25" thread_pool.min_threads="1"
+ thread_pool.queue_enabled="true" thread_pool.queue_max_size="10" thread_pool.rejection_policy="Run"
+ tos="8" ucast_recv_buf_size="20000000" ucast_send_buf_size="640000" use_concurrent_stack="true"
+ use_incoming_packet_handler="true"/>
+ <PING num_initial_members="3" timeout="2000"/>
+ <MERGE2 max_interval="30000" min_interval="10000"/>
+ <FD_SOCK/>
+ <FD max_tries="5" shun="true" timeout="10000"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
+ use_mcast_xmit="false"/>
+ <UNICAST timeout="300,600,1200,2400,3600"/>
+ <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000" stability_delay="1000"/>
+ <pbcast.GMS join_timeout="5000" print_local_addr="true" shun="false" view_ack_collection_timeout="5000"
+ view_bundling="true"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER/>
+ <pbcast.FLUSH timeout="0"/>
+
+ </jgroupsConfig>
+ </clustering>
+
+ <!--
+ Cache loaders.
+
+ If passivation is enabled, state is offloaded to the cache loaders ONLY when evicted. Similarly, when the state
+ is accessed again, it is removed from the cache loader and loaded into memory.
+
+ Otherwise, state is always maintained in the cache loader as well as in memory.
+
+ Set 'shared' to true if all instances in the cluster use the same cache loader instance, e.g., are talking to the
+ same database.
+ -->
+ <!-- <loaders passivation="false" shared="false">
+ <preload>
+ <node fqn="/org/jboss"/>
+ <node fqn="/org/tempdata"/>
+ </preload> -->
+
+ <!--
+ we can have multiple cache loaders, which get chained
+ -->
+ <!-- <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="true" fetchPersistentState="true"
+ ignoreModifications="true" purgeOnStartup="true">
+
+ <properties>
+ cache.jdbc.table.name=jbosscache
+ cache.jdbc.table.create=true
+ cache.jdbc.table.drop=true
+ cache.jdbc.table.primarykey=jbosscache_pk
+ cache.jdbc.fqn.column=fqn
+ cache.jdbc.fqn.type=varchar(255)
+ cache.jdbc.node.column=node
+ cache.jdbc.node.type=blob
+ cache.jdbc.parent.column=parent
+ cache.jdbc.sql-concat=1 || 2
+ cache.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver
+ cache.jdbc.url=jdbc:derby:jbossdb;create=true
+ cache.jdbc.user=user1
+ cache.jdbc.password=user1
+ </properties> -->
+ <!-- alternatively use a connection from a datasorce, as per the code sample below-->
+ <!--<properties>-->
+ <!--cache.jdbc.datasource=AllSampleDS-->
+ <!--cache.jdbc.table.name=jbosscache-->
+ <!--cache.jdbc.table.create=true-->
+ <!--cache.jdbc.table.drop=true-->
+ <!--</properties>-->
+ <!-- <singletonStore enabled="true" class="org.jboss.cache.loader.SingletonStoreCacheLoader">
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=20000
+ </properties>
+ </singletonStore>
+ </loader>
+ </loaders> -->
+
+ <!--
+ Define custom interceptors. All custom interceptors need to extend org.jboss.cache.interceptors.base.CommandInterceptor
+ -->
+ <!--
+ <customInterceptors>
+ <interceptor position="first" class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor">
+ <property name="attrOne" value="value1" />
+ <property name="attrTwo" value="value2" />
+ </interceptor>
+ <interceptor position="last" class="org.jboss.cache.config.parsing.custominterceptors.BbbCustomInterceptor"/>
+ <interceptor index="3" class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor"/>
+ <interceptor before="org.jboss.cache.interceptors.CallInterceptor"
+ class="org.jboss.cache.config.parsing.custominterceptors.BbbCustomInterceptor"/>
+ <interceptor after="org.jboss.cache.interceptors.CallInterceptor"
+ class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor"/>
+ </customInterceptors>
+ -->
+</jbosscache>
Modified: branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/resources/WEB-INF/components.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/resources/WEB-INF/components.xml 2010-04-30 15:57:18 UTC (rev 12667)
+++ branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/resources/WEB-INF/components.xml 2010-04-30 16:11:01 UTC (rev 12668)
@@ -1,25 +1,29 @@
-<components xmlns="http://jboss.com/products/seam/components">
+<?xml version="1.0" encoding="UTF-8"?>
+<components xmlns="http://jboss.com/products/seam/components"
+ xmlns:core="http://jboss.com/products/seam/core"
+ xmlns:cache="http://jboss.com/products/seam/cache"
+ xmlns:jms="http://jboss.com/products/seam/jms"
+ xmlns:remoting="http://jboss.com/products/seam/remoting"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation=
+ "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.2.xsd
+ http://jboss.com/products/seam/cache http://jboss.com/products/seam/cache-2.2.xsd
+ http://jboss.com/products/seam/remoting http://jboss.com/products/seam/remoting-2.2.xsd
+ http://jboss.com/products/seam/jms http://jboss.com/products/seam/jms-2.2.xsd
+ http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.2.xsd">
- <component name="org.jboss.seam.core.init">
- <property name="jndiPattern">@jndiPattern@</property>
- </component>
+ <core:init jndi-pattern="@jndiPattern@" debug="true" />
- <component name="topicPublisher" class="org.jboss.seam.jms.ManagedTopicPublisher">
- <property name="topicJndiName">topic/chatroomTopic</property>
- </component>
+ <core:manager conversation-timeout="120000"/>
+
+ <cache:jboss-cache3-provider auto-create="true" configuration="META-INF/cache-configuration.xml" />
+
+ <remoting:remoting poll-interval="1" poll-timeout="2" debug="false"/>
+
+ <jms:managed-topic-publisher name="topicPublisher" auto-create="true" topic-jndi-name="topic/chatroomTopic"/>
- <component class="org.jboss.seam.remoting.messaging.SubscriptionRegistry" installed="true">
+ <component class="org.jboss.seam.remoting.messaging.SubscriptionRegistry" installed="true">
<property name="allowedTopics">chatroomTopic</property>
</component>
- <component name="org.jboss.seam.core.manager">
- <property name="conversationTimeout">120000</property>
- </component>
-
- <component name="org.jboss.seam.remoting.remoting">
- <property name="debug">false</property>
- <property name="pollTimeout">2</property>
- <property name="pollInterval">1</property>
- </component>
-
</components>
Deleted: branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/resources/treecache.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/resources/treecache.xml 2010-04-30 15:57:18 UTC (rev 12667)
+++ branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/resources/treecache.xml 2010-04-30 16:11:01 UTC (rev 12668)
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ===================================================================== -->
-<!-- -->
-<!-- Sample TreeCache Service Configuration -->
-<!-- -->
-<!-- ===================================================================== -->
-
-<server>
-
- <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
-
-
- <!-- ==================================================================== -->
- <!-- Defines TreeCache configuration -->
- <!-- ==================================================================== -->
-
- <mbean code="org.jboss.cache.TreeCache"
- name="jboss.cache:service=TreeCache">
-
- <depends>jboss:service=Naming</depends>
- <depends>jboss:service=TransactionManager</depends>
-
- <!--
- Configure the TransactionManager
- -->
- <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
-
- <!--
- Isolation level : SERIALIZABLE
- REPEATABLE_READ (default)
- READ_COMMITTED
- READ_UNCOMMITTED
- NONE
- -->
- <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
-
- <!--
- Valid modes are LOCAL
- REPL_ASYNC
- REPL_SYNC
- INVALIDATION_ASYNC
- INVALIDATION_SYNC
- -->
- <attribute name="CacheMode">REPL_ASYNC</attribute>
-
- <!--
- Just used for async repl: use a replication queue
- -->
- <attribute name="UseReplQueue">false</attribute>
-
- <!--
- Replication interval for replication queue (in ms)
- -->
- <attribute name="ReplQueueInterval">0</attribute>
-
- <!--
- Max number of elements which trigger replication
- -->
- <attribute name="ReplQueueMaxElements">0</attribute>
-
- <!-- Name of cluster. Needs to be the same for all clusters, in order
- to find each other
- -->
- <attribute name="ClusterName">TreeCache-Cluster</attribute>
-
- <!-- JGroups protocol stack properties. Can also be a URL,
- e.g. file:/home/bela/default.xml
- <attribute name="ClusterProperties"></attribute>
- -->
-
- <attribute name="ClusterConfig">
- <config>
- <!-- UDP: if you have a multihomed machine,
- set the bind_addr attribute to the appropriate NIC IP address -->
- <!-- UDP: On Windows machines, because of the media sense feature
- being broken with multicast (even after disabling media sense)
- set the loopback attribute to true -->
- <UDP mcast_addr="228.1.2.3" mcast_port="48866"
- ip_ttl="64" ip_mcast="true"
- mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
- ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
- loopback="false"/>
- <PING timeout="2000" num_initial_members="3"
- up_thread="false" down_thread="false"/>
- <MERGE2 min_interval="10000" max_interval="20000"/>
- <!-- <FD shun="true" up_thread="true" down_thread="true" />-->
- <FD_SOCK/>
- <VERIFY_SUSPECT timeout="1500"
- up_thread="false" down_thread="false"/>
- <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
- max_xmit_size="8192" up_thread="false" down_thread="false"/>
- <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"
- down_thread="false"/>
- <pbcast.STABLE desired_avg_gossip="20000"
- up_thread="false" down_thread="false"/>
- <FRAG frag_size="8192"
- down_thread="false" up_thread="false"/>
- <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
- shun="true" print_local_addr="true"/>
- <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
- </config>
- </attribute>
-
- <!--
- Whether or not to fetch state on joining a cluster
- NOTE this used to be called FetchStateOnStartup and has been renamed to be more descriptive.
- -->
- <attribute name="FetchInMemoryState">true</attribute>
-
- <!--
- The max amount of time (in milliseconds) we wait until the
- initial state (ie. the contents of the cache) are retrieved from
- existing members in a clustered environment
- -->
- <attribute name="InitialStateRetrievalTimeout">20000</attribute>
-
- <!--
- Number of milliseconds to wait until all responses for a
- synchronous call have been received.
- -->
- <attribute name="SyncReplTimeout">20000</attribute>
-
- <!-- Max number of milliseconds to wait for a lock acquisition -->
- <attribute name="LockAcquisitionTimeout">15000</attribute>
-
-
- <!-- Name of the eviction policy class. -->
- <attribute name="EvictionPolicyClass"></attribute>
-
- <!--
- Indicate whether to use marshalling or not. Set this to true if you are running under a scoped
- class loader, e.g., inside an application server. Default is "false".
- -->
- <attribute name="UseMarshalling">false</attribute>
-
- </mbean>
-
-
- <!-- Uncomment to get a graphical view of the TreeCache MBean above -->
- <!-- <mbean code="org.jboss.cache.TreeCacheView" name="jboss.cache:service=TreeCacheView">-->
- <!-- <depends>jboss.cache:service=TreeCache</depends>-->
- <!-- <attribute name="CacheService">jboss.cache:service=TreeCache</attribute>-->
- <!-- </mbean>-->
-
-
-</server>
Added: branches/enterprise/JBPAPP_5_0/examples/ui/resources/META-INF/cache-configuration.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/ui/resources/META-INF/cache-configuration.xml (rev 0)
+++ branches/enterprise/JBPAPP_5_0/examples/ui/resources/META-INF/cache-configuration.xml 2010-04-30 16:11:01 UTC (rev 12668)
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.0">
+
+
+ <!--
+ isolation levels supported: READ_COMMITTED and REPEATABLE_READ
+ nodeLockingSchemes: mvcc, pessimistic (deprecated), optimistic (deprecated)
+ -->
+ <locking
+ isolationLevel="REPEATABLE_READ"
+ lockParentForChildInsertRemove="false"
+ lockAcquisitionTimeout="20000"
+ nodeLockingScheme="mvcc"
+ writeSkewCheck="false"
+ concurrencyLevel="500"/>
+
+ <!--
+ Used to register a transaction manager and participate in ongoing transactions.
+ -->
+ <transaction
+ transactionManagerLookupClass="org.jboss.cache.transaction.JBossTransactionManagerLookup"
+ syncRollbackPhase="false"
+ syncCommitPhase="false"/>
+
+ <!--
+ Used to register JMX statistics in any available MBean server
+ -->
+ <jmxStatistics
+ enabled="false"/>
+
+ <!--
+ If region based marshalling is used, defines whether new regions are inactive on startup.
+ -->
+ <startup
+ regionsInactiveOnStartup="true"/>
+
+ <!--
+ Used to register JVM shutdown hooks.
+ hookBehavior: DEFAULT, REGISTER, DONT_REGISTER
+ -->
+ <shutdown
+ hookBehavior="DEFAULT"/>
+
+ <!--
+ Used to define async listener notification thread pool size
+ -->
+ <listeners
+ asyncPoolSize="1"
+ asyncQueueSize="1000000"/>
+
+ <!--
+ Used to enable invocation batching and allow the use of Cache.startBatch()/endBatch() methods.
+ -->
+ <invocationBatching
+ enabled="false"/>
+
+ <!--
+ serialization related configuration, used for replication and cache loading
+ -->
+<!-- <serialization
+ objectInputStreamPoolSize="12"
+ objectOutputStreamPoolSize="14"
+ version="3.0.0"
+ marshallerClass="org.jboss.cache.marshall.VersionAwareMarshaller"
+ useLazyDeserialization="false"
+ useRegionBasedMarshalling="false"/> -->
+
+ <!--
+ This element specifies that the cache is clustered.
+ modes supported: replication (r) or invalidation (i).
+ -->
+ <clustering mode="replication" clusterName="JBossCache-cluster">
+
+ <!--
+ Defines whether to retrieve state on startup
+ -->
+ <stateRetrieval timeout="20000" fetchInMemoryState="false"/>
+
+ <!--
+ Network calls are synchronous.
+ -->
+ <sync replTimeout="20000"/>
+ <!--
+ Uncomment this for async replication.
+ -->
+ <!--<async useReplQueue="true" replQueueInterval="10000" replQueueMaxElements="500" serializationExecutorPoolSize="20" serializationExecutorQueueSize="5000000"/>-->
+
+
+ <!--
+ Configures the JGroups channel. Looks up a JGroups config file on the classpath or filesystem. udp.xml
+ ships with jgroups.jar and will be picked up by the class loader.
+ -->
+ <jgroupsConfig>
+
+ <UDP discard_incompatible_packets="true" enable_bundling="false" enable_diagnostics="false" ip_ttl="2"
+ loopback="false" max_bundle_size="64000" max_bundle_timeout="30" mcast_addr="228.10.10.10"
+ mcast_port="45588" mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
+ oob_thread_pool.enabled="true" oob_thread_pool.keep_alive_time="10000" oob_thread_pool.max_threads="4"
+ oob_thread_pool.min_threads="1" oob_thread_pool.queue_enabled="true" oob_thread_pool.queue_max_size="10"
+ oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl" thread_pool.enabled="true"
+ thread_pool.keep_alive_time="30000" thread_pool.max_threads="25" thread_pool.min_threads="1"
+ thread_pool.queue_enabled="true" thread_pool.queue_max_size="10" thread_pool.rejection_policy="Run"
+ tos="8" ucast_recv_buf_size="20000000" ucast_send_buf_size="640000" use_concurrent_stack="true"
+ use_incoming_packet_handler="true"/>
+ <PING num_initial_members="3" timeout="2000"/>
+ <MERGE2 max_interval="30000" min_interval="10000"/>
+ <FD_SOCK/>
+ <FD max_tries="5" shun="true" timeout="10000"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800"
+ use_mcast_xmit="false"/>
+ <UNICAST timeout="300,600,1200,2400,3600"/>
+ <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000" stability_delay="1000"/>
+ <pbcast.GMS join_timeout="5000" print_local_addr="true" shun="false" view_ack_collection_timeout="5000"
+ view_bundling="true"/>
+ <FRAG2 frag_size="60000"/>
+ <pbcast.STREAMING_STATE_TRANSFER/>
+ <pbcast.FLUSH timeout="0"/>
+
+ </jgroupsConfig>
+ </clustering>
+
+ <!--
+ Cache loaders.
+
+ If passivation is enabled, state is offloaded to the cache loaders ONLY when evicted. Similarly, when the state
+ is accessed again, it is removed from the cache loader and loaded into memory.
+
+ Otherwise, state is always maintained in the cache loader as well as in memory.
+
+ Set 'shared' to true if all instances in the cluster use the same cache loader instance, e.g., are talking to the
+ same database.
+ -->
+ <!-- <loaders passivation="false" shared="false">
+ <preload>
+ <node fqn="/org/jboss"/>
+ <node fqn="/org/tempdata"/>
+ </preload> -->
+
+ <!--
+ we can have multiple cache loaders, which get chained
+ -->
+ <!-- <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="true" fetchPersistentState="true"
+ ignoreModifications="true" purgeOnStartup="true">
+
+ <properties>
+ cache.jdbc.table.name=jbosscache
+ cache.jdbc.table.create=true
+ cache.jdbc.table.drop=true
+ cache.jdbc.table.primarykey=jbosscache_pk
+ cache.jdbc.fqn.column=fqn
+ cache.jdbc.fqn.type=varchar(255)
+ cache.jdbc.node.column=node
+ cache.jdbc.node.type=blob
+ cache.jdbc.parent.column=parent
+ cache.jdbc.sql-concat=1 || 2
+ cache.jdbc.driver = org.apache.derby.jdbc.EmbeddedDriver
+ cache.jdbc.url=jdbc:derby:jbossdb;create=true
+ cache.jdbc.user=user1
+ cache.jdbc.password=user1
+ </properties> -->
+ <!-- alternatively use a connection from a datasorce, as per the code sample below-->
+ <!--<properties>-->
+ <!--cache.jdbc.datasource=AllSampleDS-->
+ <!--cache.jdbc.table.name=jbosscache-->
+ <!--cache.jdbc.table.create=true-->
+ <!--cache.jdbc.table.drop=true-->
+ <!--</properties>-->
+ <!-- <singletonStore enabled="true" class="org.jboss.cache.loader.SingletonStoreCacheLoader">
+ <properties>
+ pushStateWhenCoordinator=true
+ pushStateWhenCoordinatorTimeout=20000
+ </properties>
+ </singletonStore>
+ </loader>
+ </loaders> -->
+
+ <!--
+ Define custom interceptors. All custom interceptors need to extend org.jboss.cache.interceptors.base.CommandInterceptor
+ -->
+ <!--
+ <customInterceptors>
+ <interceptor position="first" class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor">
+ <property name="attrOne" value="value1" />
+ <property name="attrTwo" value="value2" />
+ </interceptor>
+ <interceptor position="last" class="org.jboss.cache.config.parsing.custominterceptors.BbbCustomInterceptor"/>
+ <interceptor index="3" class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor"/>
+ <interceptor before="org.jboss.cache.interceptors.CallInterceptor"
+ class="org.jboss.cache.config.parsing.custominterceptors.BbbCustomInterceptor"/>
+ <interceptor after="org.jboss.cache.interceptors.CallInterceptor"
+ class="org.jboss.cache.config.parsing.custominterceptors.AaaCustomInterceptor"/>
+ </customInterceptors>
+ -->
+</jbosscache>
Modified: branches/enterprise/JBPAPP_5_0/examples/ui/resources/WEB-INF/components.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/ui/resources/WEB-INF/components.xml 2010-04-30 15:57:18 UTC (rev 12667)
+++ branches/enterprise/JBPAPP_5_0/examples/ui/resources/WEB-INF/components.xml 2010-04-30 16:11:01 UTC (rev 12668)
@@ -3,16 +3,20 @@
xmlns:core="http://jboss.com/products/seam/core"
xmlns:framework="http://jboss.com/products/seam/framework"
xmlns:persistence="http://jboss.com/products/seam/persistence"
+ xmlns:cache="http://jboss.com/products/seam/cache"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.2.xsd
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.2.xsd
http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.2.xsd
+ http://jboss.com/products/seam/cache http://jboss.com/products/seam/cache-2.2.xsd
http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.2.xsd">
<core:init jndi-pattern="jboss-seam-ui-example/#{ejbName}/local" debug="true"/>
<core:manager conversation-timeout="120000"/>
+ <cache:jboss-cache3-provider auto-create="true" configuration="META-INF/cache-configuration.xml" />
+
<persistence:managed-persistence-context name="entityManager" persistence-unit-jndi-name="java:/uiEntityManagerFactory"/>
<framework:entity-query name="countries" ejbql="select c from Country c" />
Deleted: branches/enterprise/JBPAPP_5_0/examples/ui/resources/treecache.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/ui/resources/treecache.xml 2010-04-30 15:57:18 UTC (rev 12667)
+++ branches/enterprise/JBPAPP_5_0/examples/ui/resources/treecache.xml 2010-04-30 16:11:01 UTC (rev 12668)
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ===================================================================== -->
-<!-- -->
-<!-- Sample TreeCache Service Configuration -->
-<!-- -->
-<!-- ===================================================================== -->
-
-<server>
-
- <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
-
-
- <!-- ==================================================================== -->
- <!-- Defines TreeCache configuration -->
- <!-- ==================================================================== -->
-
- <mbean code="org.jboss.cache.TreeCache"
- name="jboss.cache:service=TreeCache">
-
- <depends>jboss:service=Naming</depends>
- <depends>jboss:service=TransactionManager</depends>
-
- <!--
- Configure the TransactionManager
- -->
- <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
-
- <!--
- Isolation level : SERIALIZABLE
- REPEATABLE_READ (default)
- READ_COMMITTED
- READ_UNCOMMITTED
- NONE
- -->
- <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
-
- <!--
- Valid modes are LOCAL
- REPL_ASYNC
- REPL_SYNC
- INVALIDATION_ASYNC
- INVALIDATION_SYNC
- -->
- <attribute name="CacheMode">REPL_ASYNC</attribute>
-
- <!--
- Just used for async repl: use a replication queue
- -->
- <attribute name="UseReplQueue">false</attribute>
-
- <!--
- Replication interval for replication queue (in ms)
- -->
- <attribute name="ReplQueueInterval">0</attribute>
-
- <!--
- Max number of elements which trigger replication
- -->
- <attribute name="ReplQueueMaxElements">0</attribute>
-
- <!-- Name of cluster. Needs to be the same for all clusters, in order
- to find each other
- -->
- <attribute name="ClusterName">TreeCache-Cluster</attribute>
-
- <!-- JGroups protocol stack properties. Can also be a URL,
- e.g. file:/home/bela/default.xml
- <attribute name="ClusterProperties"></attribute>
- -->
-
- <attribute name="ClusterConfig">
- <config>
- <!-- UDP: if you have a multihomed machine,
- set the bind_addr attribute to the appropriate NIC IP address -->
- <!-- UDP: On Windows machines, because of the media sense feature
- being broken with multicast (even after disabling media sense)
- set the loopback attribute to true -->
- <UDP mcast_addr="228.1.2.3" mcast_port="48866"
- ip_ttl="64" ip_mcast="true"
- mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
- ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
- loopback="false"/>
- <PING timeout="2000" num_initial_members="3"
- up_thread="false" down_thread="false"/>
- <MERGE2 min_interval="10000" max_interval="20000"/>
- <!-- <FD shun="true" up_thread="true" down_thread="true" />-->
- <FD_SOCK/>
- <VERIFY_SUSPECT timeout="1500"
- up_thread="false" down_thread="false"/>
- <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"
- max_xmit_size="8192" up_thread="false" down_thread="false"/>
- <UNICAST timeout="600,1200,2400" window_size="100" min_threshold="10"
- down_thread="false"/>
- <pbcast.STABLE desired_avg_gossip="20000"
- up_thread="false" down_thread="false"/>
- <FRAG frag_size="8192"
- down_thread="false" up_thread="false"/>
- <pbcast.GMS join_timeout="5000" join_retry_timeout="2000"
- shun="true" print_local_addr="true"/>
- <pbcast.STATE_TRANSFER up_thread="true" down_thread="true"/>
- </config>
- </attribute>
-
- <!--
- Whether or not to fetch state on joining a cluster
- NOTE this used to be called FetchStateOnStartup and has been renamed to be more descriptive.
- -->
- <attribute name="FetchInMemoryState">true</attribute>
-
- <!--
- The max amount of time (in milliseconds) we wait until the
- initial state (ie. the contents of the cache) are retrieved from
- existing members in a clustered environment
- -->
- <attribute name="InitialStateRetrievalTimeout">20000</attribute>
-
- <!--
- Number of milliseconds to wait until all responses for a
- synchronous call have been received.
- -->
- <attribute name="SyncReplTimeout">20000</attribute>
-
- <!-- Max number of milliseconds to wait for a lock acquisition -->
- <attribute name="LockAcquisitionTimeout">15000</attribute>
-
-
- <!-- Name of the eviction policy class. -->
- <attribute name="EvictionPolicyClass"></attribute>
-
- <!--
- Indicate whether to use marshalling or not. Set this to true if you are running under a scoped
- class loader, e.g., inside an application server. Default is "false".
- -->
- <attribute name="UseMarshalling">false</attribute>
-
- </mbean>
-
-
- <!-- Uncomment to get a graphical view of the TreeCache MBean above -->
- <!-- <mbean code="org.jboss.cache.TreeCacheView" name="jboss.cache:service=TreeCacheView">-->
- <!-- <depends>jboss.cache:service=TreeCache</depends>-->
- <!-- <attribute name="CacheService">jboss.cache:service=TreeCache</attribute>-->
- <!-- </mbean>-->
-
-
-</server>
14 years, 8 months
Seam SVN: r12667 - branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/src/org/jboss/seam/example/remoting/chatroom.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-04-30 11:57:18 -0400 (Fri, 30 Apr 2010)
New Revision: 12667
Modified:
branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/src/org/jboss/seam/example/remoting/chatroom/ChatroomUsers.java
Log:
removed unneeded suppressing warnings
Modified: branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/src/org/jboss/seam/example/remoting/chatroom/ChatroomUsers.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/src/org/jboss/seam/example/remoting/chatroom/ChatroomUsers.java 2010-04-30 15:56:06 UTC (rev 12666)
+++ branches/enterprise/JBPAPP_5_0/examples/remoting/chatroom/src/org/jboss/seam/example/remoting/chatroom/ChatroomUsers.java 2010-04-30 15:57:18 UTC (rev 12667)
@@ -15,10 +15,8 @@
@Scope(ScopeType.STATELESS)
public class ChatroomUsers
{
- @SuppressWarnings("unchecked")
@In CacheProvider cacheProvider;
- @SuppressWarnings("unchecked")
@Unwrap
public Set<String> getUsers() throws CacheException
{
14 years, 8 months
Seam SVN: r12666 - branches/enterprise/JBPAPP_5_0/src/remoting/org/jboss/seam/remoting/messaging.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-04-30 11:56:06 -0400 (Fri, 30 Apr 2010)
New Revision: 12666
Modified:
branches/enterprise/JBPAPP_5_0/src/remoting/org/jboss/seam/remoting/messaging/UserTokens.java
Log:
added implements Serializable
Modified: branches/enterprise/JBPAPP_5_0/src/remoting/org/jboss/seam/remoting/messaging/UserTokens.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/remoting/org/jboss/seam/remoting/messaging/UserTokens.java 2010-04-30 15:55:15 UTC (rev 12665)
+++ branches/enterprise/JBPAPP_5_0/src/remoting/org/jboss/seam/remoting/messaging/UserTokens.java 2010-04-30 15:56:06 UTC (rev 12666)
@@ -1,5 +1,6 @@
package org.jboss.seam.remoting.messaging;
+import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
@@ -10,7 +11,7 @@
@Name("org.jboss.seam.remoting.messaging.SubscriptionRegistry.userTokens")
@Scope(ScopeType.SESSION)
-public class UserTokens
+public class UserTokens implements Serializable
{
Set<String> tokens = new HashSet<String>();
14 years, 8 months
Seam SVN: r12665 - branches/enterprise/JBPAPP_5_0/src/remoting/org/jboss/seam/remoting/messaging.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-04-30 11:55:15 -0400 (Fri, 30 Apr 2010)
New Revision: 12665
Modified:
branches/enterprise/JBPAPP_5_0/src/remoting/org/jboss/seam/remoting/messaging/SubscriptionRegistry.java
Log:
fixed formatting
Modified: branches/enterprise/JBPAPP_5_0/src/remoting/org/jboss/seam/remoting/messaging/SubscriptionRegistry.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/remoting/org/jboss/seam/remoting/messaging/SubscriptionRegistry.java 2010-04-29 20:57:43 UTC (rev 12664)
+++ branches/enterprise/JBPAPP_5_0/src/remoting/org/jboss/seam/remoting/messaging/SubscriptionRegistry.java 2010-04-30 15:55:15 UTC (rev 12665)
@@ -102,31 +102,31 @@
return topicConnection;
}
- public RemoteSubscriber subscribe(String topicName)
- {
- if (!allowedTopics.contains(topicName))
- {
- throw new IllegalArgumentException(String.format(
- "Cannot subscribe to a topic that is not allowed. Topic [%s] is not an " +
- "allowed topic.", topicName));
- }
-
- RemoteSubscriber sub = new RemoteSubscriber(UUID.randomUUID().toString(), topicName);
-
- try {
- subscribe(sub);
- subscriptions.put(sub.getToken(), sub);
-
- // Save the client's token in their session context
- getUserTokens().add(sub.getToken());
-
- return sub;
- }
- catch (Exception ex) {
- log.error(ex);
- return null;
- }
- }
+ public RemoteSubscriber subscribe(String topicName)
+ {
+ if (!allowedTopics.contains(topicName))
+ {
+ throw new IllegalArgumentException(String.format("Cannot subscribe to a topic that is not allowed. Topic [%s] is not an " + "allowed topic.", topicName));
+ }
+
+ RemoteSubscriber sub = new RemoteSubscriber(UUID.randomUUID().toString(), topicName);
+
+ try
+ {
+ subscribe(sub);
+ subscriptions.put(sub.getToken(), sub);
+
+ // Save the client's token in their session context
+ getUserTokens().add(sub.getToken());
+
+ return sub;
+ }
+ catch (Exception ex)
+ {
+ log.error(ex);
+ return null;
+ }
+ }
private void subscribe(RemoteSubscriber sub) throws JMSException, Exception
{
14 years, 8 months
Seam SVN: r12664 - in modules/faces/trunk/impl/src: main/java/org/jboss/seam/faces/environment and 2 other directories.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-04-29 16:57:43 -0400 (Thu, 29 Apr 2010)
New Revision: 12664
Added:
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/display/
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/MockPhaseEventObserver.java
Removed:
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventObserver.java
Modified:
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/SeamApplicationWrapper.java
modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/util/BeanManagerUtils.java
modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java
Log:
* Renamed test class
* Fixed bug where Validator/Converters would cause SeamApplicationWrapper to blow up if CDI could not produce an instance.
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/SeamApplicationWrapper.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/SeamApplicationWrapper.java 2010-04-29 13:14:28 UTC (rev 12663)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/SeamApplicationWrapper.java 2010-04-29 20:57:43 UTC (rev 12664)
@@ -88,19 +88,27 @@
}
@SuppressWarnings("unchecked")
- private <T> T attemptExtension(T result)
+ private <T> T attemptExtension(final T base)
{
- if (result != null)
+ T result = base;
+
+ if (base != null)
{
- if (managerUtils.isDependentScoped(result.getClass()))
+ if (managerUtils.isDependentScoped(base.getClass()))
{
managerUtils.injectNonContextualInstance(result);
}
else
{
- result = (T) managerUtils.getContextualInstance(result.getClass());
+ result = (T) managerUtils.getContextualInstance(base.getClass());
}
}
+
+ if (result == null)
+ {
+ result = base;
+ }
+
return result;
}
}
Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/util/BeanManagerUtils.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/util/BeanManagerUtils.java 2010-04-29 13:14:28 UTC (rev 12663)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/util/BeanManagerUtils.java 2010-04-29 20:57:43 UTC (rev 12664)
@@ -51,9 +51,12 @@
@SuppressWarnings("unchecked")
public void injectNonContextualInstance(final Object instance)
{
- CreationalContext<Object> creationalContext = manager.createCreationalContext(null);
- InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>) manager.createInjectionTarget(manager.createAnnotatedType(instance.getClass()));
- injectionTarget.inject(instance, creationalContext);
+ if (instance != null)
+ {
+ CreationalContext<Object> creationalContext = manager.createCreationalContext(null);
+ InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>) manager.createInjectionTarget(manager.createAnnotatedType(instance.getClass()));
+ injectionTarget.inject(instance, creationalContext);
+ }
}
@SuppressWarnings("unchecked")
@@ -72,14 +75,19 @@
* first result if multiple beans are available.
*
* @param type The class for which to return an instance.
+ * @return The managed instance, or null if none could be provided.
*/
@SuppressWarnings("unchecked")
public <T> T getContextualInstance(final Class<T> type)
{
Bean<T> bean = (Bean<T>) manager.resolve(manager.getBeans(type));
- CreationalContext<T> context = manager.createCreationalContext(bean);
- T result = (T) manager.getReference(bean, type, context);
- return result;
+ if (bean != null)
+ {
+ CreationalContext<T> context = manager.createCreationalContext(bean);
+ T result = (T) manager.getReference(bean, type, context);
+ return result;
+ }
+ return null;
}
/**
Copied: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/MockPhaseEventObserver.java (from rev 12656, modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventObserver.java)
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/MockPhaseEventObserver.java (rev 0)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/MockPhaseEventObserver.java 2010-04-29 20:57:43 UTC (rev 12664)
@@ -0,0 +1,182 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.faces.event;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+
+import org.jboss.seam.faces.event.qualifier.After;
+import org.jboss.seam.faces.event.qualifier.ApplyRequestValues;
+import org.jboss.seam.faces.event.qualifier.Before;
+import org.jboss.seam.faces.event.qualifier.InvokeApplication;
+import org.jboss.seam.faces.event.qualifier.ProcessValidations;
+import org.jboss.seam.faces.event.qualifier.RenderResponse;
+import org.jboss.seam.faces.event.qualifier.RestoreView;
+import org.jboss.seam.faces.event.qualifier.UpdateModelValues;
+
+/**
+ *
+ * @author Nicklas Karlsson
+ *
+ */
+@ApplicationScoped
+public class MockPhaseEventObserver
+{
+ private Map<String, List<PhaseId>> observations = new HashMap<String, List<PhaseId>>();
+
+ private void recordObservation(String id, PhaseId observation)
+ {
+ List<PhaseId> observed = observations.get(id);
+ if (observed == null)
+ {
+ observed = new ArrayList<PhaseId>();
+ observations.put(id, observed);
+ }
+ observed.add(observation);
+ }
+
+ public void reset()
+ {
+ observations.clear();
+ }
+
+ public void assertObservations(String id, PhaseId... observations)
+ {
+ List<PhaseId> observed = this.observations.get(id);
+ assert observed != null && observed.size() == observations.length;
+ assert observed.containsAll(Arrays.asList(observations));
+ }
+
+ public void observeBeforeRenderResponse(@Observes @Before @RenderResponse final PhaseEvent e)
+ {
+ recordObservation("1", e.getPhaseId());
+ }
+
+ public void observeAfterRenderResponse(@Observes @After @RenderResponse final PhaseEvent e)
+ {
+ recordObservation("2", e.getPhaseId());
+ }
+
+ public void observeBeforeApplyRequestValues(@Observes @Before @ApplyRequestValues final PhaseEvent e)
+ {
+ recordObservation("3", e.getPhaseId());
+ }
+
+ public void observeAfterApplyRequestValues(@Observes @After @ApplyRequestValues final PhaseEvent e)
+ {
+ recordObservation("4", e.getPhaseId());
+ }
+
+ public void observeBeforeInvokeApplication(@Observes @Before @InvokeApplication final PhaseEvent e)
+ {
+ recordObservation("5", e.getPhaseId());
+ }
+
+ public void observeAfterInvokeApplication(@Observes @After @InvokeApplication final PhaseEvent e)
+ {
+ recordObservation("6", e.getPhaseId());
+ }
+
+ public void observeBeforeProcessValidations(@Observes @Before @ProcessValidations final PhaseEvent e)
+ {
+ recordObservation("7", e.getPhaseId());
+ }
+
+ public void observeAfterProcessValidations(@Observes @After @ProcessValidations final PhaseEvent e)
+ {
+ recordObservation("8", e.getPhaseId());
+ }
+
+ public void observeBeforeRestoreView(@Observes @Before @RestoreView final PhaseEvent e)
+ {
+ recordObservation("9", e.getPhaseId());
+ }
+
+ public void observeAfterRestoreView(@Observes @After @RestoreView final PhaseEvent e)
+ {
+ recordObservation("10", e.getPhaseId());
+ }
+
+ public void observeBeforeUpdateModelValues(@Observes @Before @UpdateModelValues final PhaseEvent e)
+ {
+ recordObservation("11", e.getPhaseId());
+ }
+
+ public void observeAfterUpdateModelValues(@Observes @After @UpdateModelValues final PhaseEvent e)
+ {
+ recordObservation("12", e.getPhaseId());
+ }
+
+ public void observeAllRenderResponse(@Observes @RenderResponse final PhaseEvent e)
+ {
+ recordObservation("13", e.getPhaseId());
+ }
+
+ public void observeAllApplyRequestValues(@Observes @ApplyRequestValues final PhaseEvent e)
+ {
+ recordObservation("14", e.getPhaseId());
+ }
+
+ public void observeAllInvokeApplication(@Observes @InvokeApplication final PhaseEvent e)
+ {
+ recordObservation("15", e.getPhaseId());
+ }
+
+ public void observeAllProcessValidations(@Observes @ProcessValidations final PhaseEvent e)
+ {
+ recordObservation("16", e.getPhaseId());
+ }
+
+ public void observeAllRestoreView(@Observes @RestoreView final PhaseEvent e)
+ {
+ recordObservation("17", e.getPhaseId());
+ }
+
+ public void observeAllUpdateModelValues(@Observes @UpdateModelValues final PhaseEvent e)
+ {
+ recordObservation("18", e.getPhaseId());
+ }
+
+ public void observeAllBeforeEvents(@Observes @Before final PhaseEvent e)
+ {
+ recordObservation("19", e.getPhaseId());
+ }
+
+ public void observeAllAfterEvents(@Observes @Before final PhaseEvent e)
+ {
+ recordObservation("20", e.getPhaseId());
+ }
+
+ public void observeAllEvents(@Observes final PhaseEvent e)
+ {
+ recordObservation("21", e.getPhaseId());
+ }
+
+}
Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java 2010-04-29 13:14:28 UTC (rev 12663)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java 2010-04-29 20:57:43 UTC (rev 12664)
@@ -66,13 +66,13 @@
@Deployment
public static JavaArchive createTestArchive()
{
- return Archives.create("test.jar", JavaArchive.class).addClasses(PhaseEventObserver.class, PhaseEventBridge.class, BeanManagerAware.class, MockLogger.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
+ return Archives.create("test.jar", JavaArchive.class).addClasses(MockPhaseEventObserver.class, PhaseEventBridge.class, BeanManagerAware.class, MockLogger.class).addManifestResource(new ByteArrayAsset(new byte[0]), ArchivePaths.create("beans.xml"));
}
@Inject
PhaseEventBridge phaseEventBridge;
@Inject
- PhaseEventObserver observer;
+ MockPhaseEventObserver observer;
private final MockFacesContext facesContext = new MockFacesContext();
private final MockLifecycle lifecycle = new MockLifecycle();
Deleted: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventObserver.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventObserver.java 2010-04-29 13:14:28 UTC (rev 12663)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventObserver.java 2010-04-29 20:57:43 UTC (rev 12664)
@@ -1,182 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.faces.event;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Observes;
-import javax.faces.event.PhaseEvent;
-import javax.faces.event.PhaseId;
-
-import org.jboss.seam.faces.event.qualifier.After;
-import org.jboss.seam.faces.event.qualifier.ApplyRequestValues;
-import org.jboss.seam.faces.event.qualifier.Before;
-import org.jboss.seam.faces.event.qualifier.InvokeApplication;
-import org.jboss.seam.faces.event.qualifier.ProcessValidations;
-import org.jboss.seam.faces.event.qualifier.RenderResponse;
-import org.jboss.seam.faces.event.qualifier.RestoreView;
-import org.jboss.seam.faces.event.qualifier.UpdateModelValues;
-
-/**
- *
- * @author Nicklas Karlsson
- *
- */
-@ApplicationScoped
-public class PhaseEventObserver
-{
- private Map<String, List<PhaseId>> observations = new HashMap<String, List<PhaseId>>();
-
- private void recordObservation(String id, PhaseId observation)
- {
- List<PhaseId> observed = observations.get(id);
- if (observed == null)
- {
- observed = new ArrayList<PhaseId>();
- observations.put(id, observed);
- }
- observed.add(observation);
- }
-
- public void reset()
- {
- observations.clear();
- }
-
- public void assertObservations(String id, PhaseId... observations)
- {
- List<PhaseId> observed = this.observations.get(id);
- assert observed != null && observed.size() == observations.length;
- assert observed.containsAll(Arrays.asList(observations));
- }
-
- public void observeBeforeRenderResponse(@Observes @Before @RenderResponse final PhaseEvent e)
- {
- recordObservation("1", e.getPhaseId());
- }
-
- public void observeAfterRenderResponse(@Observes @After @RenderResponse final PhaseEvent e)
- {
- recordObservation("2", e.getPhaseId());
- }
-
- public void observeBeforeApplyRequestValues(@Observes @Before @ApplyRequestValues final PhaseEvent e)
- {
- recordObservation("3", e.getPhaseId());
- }
-
- public void observeAfterApplyRequestValues(@Observes @After @ApplyRequestValues final PhaseEvent e)
- {
- recordObservation("4", e.getPhaseId());
- }
-
- public void observeBeforeInvokeApplication(@Observes @Before @InvokeApplication final PhaseEvent e)
- {
- recordObservation("5", e.getPhaseId());
- }
-
- public void observeAfterInvokeApplication(@Observes @After @InvokeApplication final PhaseEvent e)
- {
- recordObservation("6", e.getPhaseId());
- }
-
- public void observeBeforeProcessValidations(@Observes @Before @ProcessValidations final PhaseEvent e)
- {
- recordObservation("7", e.getPhaseId());
- }
-
- public void observeAfterProcessValidations(@Observes @After @ProcessValidations final PhaseEvent e)
- {
- recordObservation("8", e.getPhaseId());
- }
-
- public void observeBeforeRestoreView(@Observes @Before @RestoreView final PhaseEvent e)
- {
- recordObservation("9", e.getPhaseId());
- }
-
- public void observeAfterRestoreView(@Observes @After @RestoreView final PhaseEvent e)
- {
- recordObservation("10", e.getPhaseId());
- }
-
- public void observeBeforeUpdateModelValues(@Observes @Before @UpdateModelValues final PhaseEvent e)
- {
- recordObservation("11", e.getPhaseId());
- }
-
- public void observeAfterUpdateModelValues(@Observes @After @UpdateModelValues final PhaseEvent e)
- {
- recordObservation("12", e.getPhaseId());
- }
-
- public void observeAllRenderResponse(@Observes @RenderResponse final PhaseEvent e)
- {
- recordObservation("13", e.getPhaseId());
- }
-
- public void observeAllApplyRequestValues(@Observes @ApplyRequestValues final PhaseEvent e)
- {
- recordObservation("14", e.getPhaseId());
- }
-
- public void observeAllInvokeApplication(@Observes @InvokeApplication final PhaseEvent e)
- {
- recordObservation("15", e.getPhaseId());
- }
-
- public void observeAllProcessValidations(@Observes @ProcessValidations final PhaseEvent e)
- {
- recordObservation("16", e.getPhaseId());
- }
-
- public void observeAllRestoreView(@Observes @RestoreView final PhaseEvent e)
- {
- recordObservation("17", e.getPhaseId());
- }
-
- public void observeAllUpdateModelValues(@Observes @UpdateModelValues final PhaseEvent e)
- {
- recordObservation("18", e.getPhaseId());
- }
-
- public void observeAllBeforeEvents(@Observes @Before final PhaseEvent e)
- {
- recordObservation("19", e.getPhaseId());
- }
-
- public void observeAllAfterEvents(@Observes @Before final PhaseEvent e)
- {
- recordObservation("20", e.getPhaseId());
- }
-
- public void observeAllEvents(@Observes final PhaseEvent e)
- {
- recordObservation("21", e.getPhaseId());
- }
-
-}
14 years, 8 months
Seam SVN: r12663 - branches/community/Seam_2_2/build.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-04-29 09:14:28 -0400 (Thu, 29 Apr 2010)
New Revision: 12663
Modified:
branches/community/Seam_2_2/build/ci.build.xml
Log:
fixed deploying into new jboss snapshots repository
Modified: branches/community/Seam_2_2/build/ci.build.xml
===================================================================
--- branches/community/Seam_2_2/build/ci.build.xml 2010-04-28 13:20:52 UTC (rev 12662)
+++ branches/community/Seam_2_2/build/ci.build.xml 2010-04-29 13:14:28 UTC (rev 12663)
@@ -14,6 +14,10 @@
<import file="common.build.xml" />
+ <artifact:remoteRepository id="jboss-snapshots-repository" url="https://repository.jboss.org/nexus/content/repositories/snapshots/">
+ <authentication username="hudson-services" password="${snapshots.password}" />
+ </artifact:remoteRepository>
+
<target name="deploySeamSnapshot" description="Deploy a Seam snapshot to snapshots.jboss.org" depends="initdav, initpoms">
<deploySnapshotPom pom="${root.pom}" />
<deploySnapshotPom pom="${parent.pom}" />
@@ -97,16 +101,16 @@
</target>
<target name="deployExamplesSnapshot" depends="initdav">
- <deployExample name="booking" repositoryId="jboss-snapshots" />
- <deployExampleNoDs name="numberguess" repositoryId="jboss-snapshots" />
- <deployExampleNoDs name="jpa" distdir="dist-jboss" type="war" repositoryId="jboss-snapshots" />
- <deployExample name="dvdstore" path="${seam.dir}/examples/dvdstore" repositoryId="jboss-snapshots" />
+ <deployExample name="booking" repositoryId="jboss-snapshots-repository" />
+ <deployExampleNoDs name="numberguess" repositoryId="jboss-snapshots-repository" />
+ <deployExampleNoDs name="jpa" distdir="dist-jboss" type="war" repositoryId="jboss-snapshots-repository" />
+ <deployExample name="dvdstore" path="${seam.dir}/examples/dvdstore" repositoryId="jboss-snapshots-repository" />
</target>
<target name="deployDocumentation" depends="initdav, initpoms">
<artifact:deploy uniqueVersion="false" file="${docs.pom}" settingsFile="${maven.settings.xml}">
<pom file="${docs.pom}" settingsFile="${maven.settings.xml}" />
- <remoteRepository refId="jboss-snapshots" />
+ <remoteRepository refId="jboss-snapshots-repository" />
<attach file="${doc.ref.dir}/target/docbook/publish/en-US/pdf/seam_reference.pdf" classifier="en-US" type="pdf" />
<attach file="${doc.ref.dir}/target/docbook/publish/fr-FR/pdf/seam_reference.pdf" classifier="fr-FR" type="pdf" />
<attach file="${doc.ref.dir}/target/docbook/publish/it-IT/pdf/seam_reference.pdf" classifier="it-IT" type="pdf" />
@@ -138,7 +142,7 @@
<sequential>
<artifact:deploy uniqueVersion="true">
<pom file="@{pom}" settingsFile="${maven.settings.xml}" />
- <remoteRepository refid="jboss-snapshots" />
+ <remoteRepository refid="jboss-snapshots-repository" />
</artifact:deploy>
</sequential>
</macrodef>
@@ -151,7 +155,7 @@
<artifact:deploy file="@{jar}" uniqueVersion="true">
<pom file="@{pom}" settingsFile="${maven.settings.xml}" />
<attach file="@{srcjar}" classifier="sources" />
- <remoteRepository refid="jboss-snapshots" />
+ <remoteRepository refid="jboss-snapshots-repository" />
</artifact:deploy>
</sequential>
</macrodef>
14 years, 8 months
Seam SVN: r12662 - branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-04-28 09:20:52 -0400 (Wed, 28 Apr 2010)
New Revision: 12662
Modified:
branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Cache.xml
Log:
JBPAPP-4111 documentation changes
Modified: branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Cache.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Cache.xml 2010-04-28 13:07:24 UTC (rev 12661)
+++ branches/enterprise/JBPAPP_5_0/doc/Seam_Reference_Guide/en-US/Cache.xml 2010-04-28 13:20:52 UTC (rev 12662)
@@ -84,7 +84,7 @@
<para>
The application can cache transactional state using the Seam
<literal>cacheProvider</literal> component, which integrates
- JBossCache, JBoss POJO Cache or EHCache into the Seam environment.
+ JBossCache or EHCache into the Seam environment.
This state will be visible to other nodes if your cache supports
running in a clustered mode.
</para>
@@ -119,43 +119,20 @@
<variablelist>
<varlistentry>
<term>
- JBoss Cache 1.x (suitable for use in JBoss 4.2.x or later and other
- containers)
+ JBoss Cache 3.2.x
</term>
<listitem>
<para>
- <literal>org.jboss.cache.TreeCache</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- JBoss Cache 2.x (suitable for use in JBoss 5.x and other
- containers)
- </term>
- <listitem>
- <para>
<literal>org.jboss.cache.Cache</literal>
</para>
</listitem>
- </varlistentry>
+ </varlistentry>
<varlistentry>
<term>
- JBoss POJO Cache 1.x (suitable for use in JBoss 4.2.x or later and other
- containers)
+ EHCache
</term>
<listitem>
<para>
- <literal>org.jboss.cache.aop.PojoCache</literal>
- </para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- EHCache (suitable for use in any container)
- </term>
- <listitem>
- <para>
<literal>net.sf.ehcache.CacheManager</literal>
</para>
</listitem>
@@ -179,68 +156,25 @@
<variablelist>
<varlistentry>
<term>
- JBoss Cache 1.x
+ JBoss Cache 3.2.x
</term>
<listitem>
<itemizedlist>
<listitem>
<para>
- <literal>jboss-cache.jar</literal> - JBoss Cache 1.4.1
+ <literal>jbosscache-core.jar</literal> - JBoss Cache 3.2.x
</para>
</listitem>
<listitem>
<para>
- <literal>jgroups.jar</literal> - JGroups 2.4.1
+ <literal>jgroups.jar</literal> - JGroups 2.6.x
</para>
</listitem>
</itemizedlist>
</listitem>
- </varlistentry>
+ </varlistentry>
<varlistentry>
<term>
- JBoss Cache 2.x
- </term>
- <listitem>
- <itemizedlist>
- <listitem>
- <para>
- <literal>jboss-cache.jar</literal> - JBoss Cache 2.2.0
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>jgroups.jar</literal> - JGroups 2.6.2
- </para>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
- JBoss POJO Cache 1.x
- </term>
- <listitem>
- <itemizedlist>
- <listitem>
- <para>
- <literal>jboss-cache.jar</literal> - JBoss Cache 1.4.1
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>jgroups.jar</literal> - JGroups 2.4.1
- </para>
- </listitem>
- <listitem>
- <para>
- <literal>jboss-aop.jar</literal> - JBoss AOP 1.5.0
- </para>
- </listitem>
- </itemizedlist>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>
EHCache
</term>
<listitem>
@@ -254,16 +188,7 @@
</listitem>
</varlistentry>
</variablelist>
-
- <tip>
- <para>
- If you are using JBoss Cache in containers other than JBoss
- Application Server, look at the JBoss Cache
- <ulink url="http://wiki.jboss.org/wiki/JBossCache">wiki</ulink> page
- for more dependencies.
- </para>
- </tip>
-
+
<para>
For an EAR depoyment of Seam, we recommend that the cache jars and
configuration go directly into the EAR.
@@ -271,7 +196,7 @@
<para>
You'll also need to provide a configuration file for JBossCache. Place
- <literal>treecache.xml</literal> with an appropriate cache
+ <literal>cache-configuration.xml</literal> with an appropriate cache
configuration into the classpath (e.g. the ejb jar or
<literal>WEB-INF/classes</literal>). JBossCache has many scary and
confusing configuration settings, so we won't discuss them here. Please
@@ -279,8 +204,8 @@
</para>
<para>
- You can find a sample <literal>treecache.xml</literal> in
- <literal>examples/blog/resources/treecache.xml</literal>.
+ You can find a sample <literal>cache-configuration.xml</literal> in
+ <literal>examples/blog/resources/META-INF/cache-configuration.xml</literal>.
</para>
<para>
@@ -295,7 +220,7 @@
<programlisting role="XML"><![CDATA[<components xmlns="http://jboss.com/products/seam/components"
xmlns:cache="http://jboss.com/products/seam/cache">
- <cache:jboss-cache-provider configuration="META-INF/cache/treecache.xml" />
+ <cache:jboss-cache3-provider configuration="META-INF/cache/cache-configuration.xml" />
</components>]]></programlisting>
<para>Now you can inject the cache into any Seam component:</para>
@@ -325,8 +250,8 @@
<programlisting role="XML"><![CDATA[<components xmlns="http://jboss.com/products/seam/components"
xmlns:cache="http://jboss.com/products/seam/cache">
- <cache:jboss-cache-provider name="myCache" configuration="myown/cache.xml"/>
- <cache:jboss-cache-provider name="myOtherCache" configuration="myother/cache.xml"/>
+ <cache:jboss-cache3-provider name="myCache" configuration="myown/cache.xml"/>
+ <cache:jboss-cache3-provider name="myOtherCache" configuration="myother/cache.xml"/>
</components>]]></programlisting>
</section>
14 years, 8 months
Seam SVN: r12661 - in branches/enterprise/JBPAPP_5_0: build and 2 other directories.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-04-28 09:07:24 -0400 (Wed, 28 Apr 2010)
New Revision: 12661
Added:
branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossCache3Provider.java
Removed:
branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossCacheProvider.java
branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossPojoCacheProvider.java
Modified:
branches/enterprise/JBPAPP_5_0/build.xml
branches/enterprise/JBPAPP_5_0/build/core.pom.xml
branches/enterprise/JBPAPP_5_0/build/root.pom.xml
branches/enterprise/JBPAPP_5_0/build/ui.pom.xml
branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache-2.2.xsd
branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossCache2Provider.java
Log:
JBPAPP-4111 -removing unsupported jboss-cache version
Modified: branches/enterprise/JBPAPP_5_0/build/core.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/core.pom.xml 2010-04-28 12:02:04 UTC (rev 12660)
+++ branches/enterprise/JBPAPP_5_0/build/core.pom.xml 2010-04-28 13:07:24 UTC (rev 12661)
@@ -196,14 +196,6 @@
<artifactId>ehcache</artifactId>
<optional>true</optional>
</dependency>
-
- <!-- Order matters of jboss:jboss-cache and org.jboss.cache:jbosscache-core -->
-
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-cache</artifactId>
- <optional>true</optional>
- </dependency>
<dependency>
<groupId>org.jboss.cache</groupId>
@@ -211,30 +203,7 @@
<optional>true</optional>
</dependency>
-
-
- <!-- This is actually a dep of jboss-cache, but it doesn't declare it -->
<dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-system</artifactId>
- <optional>true</optional>
- </dependency>
-
- <!-- This is actually a dep of jboss-cache, but it doesn't declare it -->
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-jmx</artifactId>
- <optional>true</optional>
- </dependency>
-
- <!-- This is actually a dep of jboss-cache, but it doesn't declare it -->
- <dependency>
- <groupId>jgroups</groupId>
- <artifactId>jgroups</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<optional>true</optional>
Modified: branches/enterprise/JBPAPP_5_0/build/root.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/root.pom.xml 2010-04-28 12:02:04 UTC (rev 12660)
+++ branches/enterprise/JBPAPP_5_0/build/root.pom.xml 2010-04-28 13:07:24 UTC (rev 12661)
@@ -277,12 +277,6 @@
</exclusion>
</exclusions>
</dependency>
-
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-cache</artifactId>
- <version>1.4.1.SP13</version>
- </dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
@@ -300,7 +294,6 @@
</exclusions>
</dependency>
- <!-- You should adjust this in the initcore task in build.xml as well -->
<dependency>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-core</artifactId>
Modified: branches/enterprise/JBPAPP_5_0/build/ui.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/ui.pom.xml 2010-04-28 12:02:04 UTC (rev 12660)
+++ branches/enterprise/JBPAPP_5_0/build/ui.pom.xml 2010-04-28 13:07:24 UTC (rev 12661)
@@ -127,21 +127,7 @@
</exclusions>
</dependency>
- <!-- This is actually a dep of jboss-cache, but it doesn't declare it -->
<dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-system</artifactId>
- <optional>true</optional>
- </dependency>
-
- <!-- This is actually a dep of jboss-cache, but it doesn't declare it -->
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-jmx</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<optional>true</optional>
Modified: branches/enterprise/JBPAPP_5_0/build.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build.xml 2010-04-28 12:02:04 UTC (rev 12660)
+++ branches/enterprise/JBPAPP_5_0/build.xml 2010-04-28 13:07:24 UTC (rev 12661)
@@ -185,9 +185,6 @@
<target name="initcore" depends="init">
<init classesdir="${classes.core.dir}" srcdir="${src.core.dir}" modulename="core" pom="${core.pom}" />
- <!-- <inlineDependencies id="jbosscache2" scope="compile">
- <dependency groupId="org.jboss.cache" artifactId="jbosscache-core" version="2.2.0.CR6" />
- </inlineDependencies> -->
</target>
<target name="antlr" depends="initcore" description="Generate ANTLR parser">
Modified: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossCache2Provider.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossCache2Provider.java 2010-04-28 12:02:04 UTC (rev 12660)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossCache2Provider.java 2010-04-28 13:07:24 UTC (rev 12661)
@@ -24,10 +24,13 @@
* Implementation of CacheProvider backed by JBoss Cache 2.x. for simple
* objects.
*
+ * @deprecated As of version 2.2.2.EAP, replaced by JbossCache3Provider
+ * @see org.jboss.seam.cache.JbossCache3Provider
* @author Sebastian Hennebrueder
* @author Pete Muir
*/
+@Deprecated
@Name("org.jboss.seam.cache.cacheProvider")
@Scope(APPLICATION)
@BypassInterceptors
Added: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossCache3Provider.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossCache3Provider.java (rev 0)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossCache3Provider.java 2010-04-28 13:07:24 UTC (rev 12661)
@@ -0,0 +1,113 @@
+package org.jboss.seam.cache;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.lang.reflect.Method;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.CacheFactory;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.seam.annotations.AutoCreate;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Destroy;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+import org.jboss.seam.util.Reflections;
+
+/**
+ * Implementation of CacheProvider backed by JBoss Cache 3.x. for simple
+ * objects.
+ *
+ * @author Sebastian Hennebrueder
+ * @author Pete Muir
+ */
+
+@Name("org.jboss.seam.cache.cacheProvider")
+@Scope(APPLICATION)
+@BypassInterceptors
+@Install(value = false, precedence = BUILT_IN, classDependencies = {"org.jboss.cache.Cache", "org.jgroups.MembershipListener"})
+@AutoCreate
+public class JbossCache3Provider
+ extends AbstractJBossCacheProvider<Cache>
+{
+
+ private org.jboss.cache.Cache cache;
+
+ private static final LogProvider log = Logging.getLogProvider(JbossCache3Provider.class);
+
+ private static Method GET;
+ private static Method PUT;
+ private static Method REMOVE;
+ private static Method REMOVE_NODE;
+
+ static {
+ try {
+ GET = Cache.class.getDeclaredMethod("get", Fqn.class, Object.class);
+ PUT = Cache.class.getDeclaredMethod("put", Fqn.class, Object.class, Object.class);
+ REMOVE = Cache.class.getDeclaredMethod("remove", Fqn.class, Object.class);
+ REMOVE_NODE = Cache.class.getDeclaredMethod("removeNode", Fqn.class);
+ } catch (Exception e) {
+ throw new IllegalStateException("Unable to use JBoss Cache 3", e);
+ }
+ }
+
+ @Create
+ public void create() {
+ log.debug("Starting JBoss Cache");
+
+ try {
+ CacheFactory factory = new DefaultCacheFactory();
+ cache = factory.createCache(getConfigurationAsStream());
+
+ cache.create();
+ cache.start();
+ } catch (Exception e) {
+ //log.error(e, e);
+ throw new IllegalStateException("Error starting JBoss Cache", e);
+ }
+ }
+
+ @Destroy
+ public void destroy() {
+ log.debug("Stopping JBoss Cache");
+ try {
+ cache.stop();
+ cache.destroy();
+ cache = null;
+ } catch (Exception e) {
+ throw new IllegalStateException("Error stopping JBoss Cache", e);
+ }
+ }
+
+ @Override
+ public Object get(String region, String key) {
+ return Reflections.invokeAndWrap(GET, cache, getFqn(region), key);
+ }
+
+ @Override
+ public void put(String region, String key, Object object) {
+ Reflections.invokeAndWrap(PUT, cache, getFqn(region), key, object);
+ }
+
+ @Override
+ public void remove(String region, String key) {
+ Reflections.invokeAndWrap(REMOVE, cache, getFqn(region), key);
+ }
+
+ @Override
+ public void clear() {
+ Reflections.invokeAndWrap(REMOVE_NODE, cache, getFqn(null));
+ }
+
+ @Override
+ public Cache getDelegate() {
+ return cache;
+ }
+
+}
\ No newline at end of file
Deleted: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossCacheProvider.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossCacheProvider.java 2010-04-28 12:02:04 UTC (rev 12660)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossCacheProvider.java 2010-04-28 13:07:24 UTC (rev 12661)
@@ -1,142 +0,0 @@
-package org.jboss.seam.cache;
-
-import static org.jboss.seam.ScopeType.APPLICATION;
-import static org.jboss.seam.annotations.Install.BUILT_IN;
-
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Node;
-import org.jboss.cache.PropertyConfigurator;
-import org.jboss.cache.TreeCache;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.Create;
-import org.jboss.seam.annotations.Destroy;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
-import org.jboss.seam.log.LogProvider;
-import org.jboss.seam.log.Logging;
-
-/**
- * Implementation of CacheProvider backed by JBoss Cache 1.x
- *
- * @author Sebastian Hennebrueder
- * @author Pete Muir
- */
-
-@Name("org.jboss.seam.cache.cacheProvider")
-@Scope(APPLICATION)
-@BypassInterceptors
-@Install(precedence = BUILT_IN, classDependencies={"org.jboss.cache.TreeCache", "org.jgroups.MembershipListener"})
-@AutoCreate
-public class JbossCacheProvider extends AbstractJBossCacheProvider<TreeCache>
-{
-
- private TreeCache cache;
-
- private static final LogProvider log = Logging.getLogProvider(JbossCacheProvider.class);
-
- @Create
- public void create()
- {
- log.debug("Starting JBoss Treecache 1.x");
-
- try
- {
- cache = new TreeCache();
- new PropertyConfigurator().configure(cache, getConfigurationAsStream());
- cache.createService();
- cache.startService();
-
- }
- catch (Exception e)
- {
- throw new IllegalStateException("Error starting JBoss Treecache 1.x", e);
- }
- }
-
- @Destroy
- public void destroy()
- {
- log.debug("Stopping JBoss Treecache 1.x");
-
- try
- {
- cache.stopService();
- cache.destroyService();
- }
- catch (RuntimeException e)
- {
- throw new IllegalStateException("Error stopping JBoss Treecache 1.x", e);
- }
- cache = null;
- }
-
- @Override
- public Object get(String region, String key)
- {
- try
- {
- Node node = cache.get(getFqn(region));
- if (node != null)
- {
- return node.get(key);
- }
- else
- {
- return null;
- }
- }
- catch (CacheException e)
- {
- throw new IllegalStateException(String.format("Cache throw exception when trying to get %s from region %s.", key, region), e);
- }
- }
-
- @Override
- public void put(String region, String key, Object object)
- {
- try
- {
- cache.put(getFqn(region), key, object);
- }
- catch (CacheException e)
- {
- throw new IllegalStateException(String.format("JBoss Cache throw exception when adding object for key %s to region %s", key, region), e);
- }
- }
-
- @Override
- public void remove(String region, String key)
- {
- try
- {
- cache.remove(getFqn(region), key);
- }
- catch (CacheException e)
- {
- throw new IllegalStateException(String.format("JBoss Cache throw exception when removing object for key %s in region %s", key, region), e);
- }
-
- }
-
- @Override
- public TreeCache getDelegate()
- {
- return cache;
- }
-
- @Override
- public void clear()
- {
- try
- {
- cache.remove(getFqn(null));
- }
- catch (CacheException e)
- {
- throw new IllegalStateException(String.format("JBoss Cache throw exception when clearing default cache."), e);
- }
- }
-
-}
\ No newline at end of file
Deleted: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossPojoCacheProvider.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossPojoCacheProvider.java 2010-04-28 12:02:04 UTC (rev 12660)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache/JbossPojoCacheProvider.java 2010-04-28 13:07:24 UTC (rev 12661)
@@ -1,135 +0,0 @@
-package org.jboss.seam.cache;
-
-import static org.jboss.seam.ScopeType.APPLICATION;
-import static org.jboss.seam.annotations.Install.BUILT_IN;
-
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Node;
-import org.jboss.cache.aop.PojoCache;
-import org.jboss.seam.annotations.AutoCreate;
-import org.jboss.seam.annotations.Create;
-import org.jboss.seam.annotations.Destroy;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
-import org.jboss.seam.log.LogProvider;
-import org.jboss.seam.log.Logging;
-
-/**
- * Implementation of CacheProvider backed by JBoss POJO Cache 1.x
- *
- * @author Sebastian Hennebrueder
- * @author Pete Muir
- */
-
-@Name("org.jboss.seam.cache.cacheProvider")
-@Scope(APPLICATION)
-@BypassInterceptors
-@Install(value = false, precedence = BUILT_IN, classDependencies={"org.jboss.cache.aop.PojoCache", "org.jgroups.MembershipListener", "org.jboss.aop.Dispatcher"})
-@AutoCreate
-public class JbossPojoCacheProvider extends AbstractJBossCacheProvider<PojoCache>
-{
-
- private PojoCache cache;
-
- private static final LogProvider log = Logging.getLogProvider(JbossPojoCacheProvider.class);
-
- @Create
- public void create()
- {
- log.debug("Starting JBoss POJO Cache 1.x");
-
- try
- {
- cache = new PojoCache();
- new org.jboss.cache.PropertyConfigurator().configure(cache, getConfigurationAsStream());
- cache.createService();
- cache.startService();
-
- }
- catch (Exception e)
- {
- throw new IllegalStateException("Error starting JBoss POJO Cache 1.x", e);
- }
- }
-
- @Destroy
- public void destroy()
- {
- log.debug("Stopping JBoss Treecache 1.x");
-
- try
- {
- cache.stopService();
- cache.destroyService();
- }
- catch (RuntimeException e)
- {
- throw new IllegalStateException("Error stopping JBoss Treecache 1.x", e);
- }
- cache = null;
- }
-
- @Override
- public Object get(String region, String key) {
- try {
- Node node = cache.get(getFqn(region));
- if (node != null) {
- return node.get(key);
- } else {
- return null;
- }
- } catch (CacheException e) {
- throw new IllegalStateException(String.format("Cache throw exception when trying to get %s from region %s.", key, region), e);
- }
- }
-
-
- @Override
- public void put(String region, String key, Object object)
- {
- try
- {
- cache.put(getFqn(region), key, object);
- }
- catch (CacheException e)
- {
- throw new IllegalStateException(String.format("JBoss Cache throw exception when adding object for key %s to region %s", key, region), e);
- }
- }
-
- @Override
- public void remove(String region, String key)
- {
- try
- {
- cache.remove(getFqn(region), key);
- }
- catch (CacheException e)
- {
- throw new IllegalStateException(String.format("JBoss Cache throw exception when removing object for key %s in region %s", key, region), e);
- }
-
- }
-
- @Override
- public PojoCache getDelegate()
- {
- return cache;
- }
-
- @Override
- public void clear()
- {
- try
- {
- cache.remove(getFqn(null));
- }
- catch (CacheException e)
- {
- throw new IllegalStateException(String.format("JBoss Cache throw exception when clearing default cache."), e);
- }
- }
-
-}
\ No newline at end of file
Modified: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache-2.2.xsd
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache-2.2.xsd 2010-04-28 12:02:04 UTC (rev 12660)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/cache-2.2.xsd 2010-04-28 13:07:24 UTC (rev 12661)
@@ -18,9 +18,9 @@
</xs:complexType>
</xs:element>
- <xs:element name="jboss-cache-provider">
+ <xs:element name="jboss-cache3-provider">
<xs:annotation>
- <xs:documentation>The JBoss 1.x Cache provider</xs:documentation>
+ <xs:documentation>The JBoss 3.x Cache provider</xs:documentation>
</xs:annotation>
<xs:complexType mixed="true">
<xs:attributeGroup ref="components:attlist.component" />
@@ -38,16 +38,6 @@
</xs:complexType>
</xs:element>
- <xs:element name="jboss-pojo-cache-provider">
- <xs:annotation>
- <xs:documentation>The JBoss 1.x POJOCache provider</xs:documentation>
- </xs:annotation>
- <xs:complexType mixed="true">
- <xs:attributeGroup ref="components:attlist.component" />
- <xs:attributeGroup ref="cache:attlist.cacheProvider" />
- </xs:complexType>
- </xs:element>
-
<xs:attributeGroup name="attlist.cacheProvider">
<xs:attribute name="default-region" type="components:string" />
<xs:attribute name="configuration" type="components:string" />
14 years, 8 months