[jboss-cvs] JBossAS SVN: r68139 - in branches/Branch_4_2: server and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Dec 11 10:37:01 EST 2007
Author: csaldanh
Date: 2007-12-11 10:37:01 -0500 (Tue, 11 Dec 2007)
New Revision: 68139
Added:
branches/Branch_4_2/server/src/main/org/jboss/verifier/event/EventGeneratorSupport.java
branches/Branch_4_2/server/src/main/org/jboss/verifier/event/Library.java
Modified:
branches/Branch_4_2/build/build-distr.xml
branches/Branch_4_2/build/build-thirdparty.xml
branches/Branch_4_2/server/.classpath
branches/Branch_4_2/server/build.xml
branches/Branch_4_2/server/src/main/org/jboss/verifier/event/VerificationEventGenerator.java
branches/Branch_4_2/server/src/main/org/jboss/verifier/event/VerificationEventGeneratorSupport.java
branches/Branch_4_2/server/src/main/org/jboss/verifier/factory/VerificationEventFactory.java
branches/Branch_4_2/server/src/main/org/jboss/verifier/strategy/AbstractVerifier.java
branches/Branch_4_2/server/src/main/org/jboss/verifier/strategy/VerificationContext.java
branches/Branch_4_2/server/src/main/org/jboss/verifier/strategy/VerificationStrategy.java
Log:
Got rid of gjt-jpl-util and gjt-jpl-pattern (JBAS-4148)
Modified: branches/Branch_4_2/build/build-distr.xml
===================================================================
--- branches/Branch_4_2/build/build-distr.xml 2007-12-11 15:34:55 UTC (rev 68138)
+++ branches/Branch_4_2/build/build-distr.xml 2007-12-11 15:37:01 UTC (rev 68139)
@@ -302,9 +302,6 @@
</fileset>
</copy>
<copy todir="${install.all.lib}" filtering="no">
- <fileset dir="${gjt.jpl-util.lib}">
- <include name="*.jar"/>
- </fileset>
<fileset dir="${apache.bcel.lib}">
<include name="bcel.jar"/>
</fileset>
Modified: branches/Branch_4_2/build/build-thirdparty.xml
===================================================================
--- branches/Branch_4_2/build/build-thirdparty.xml 2007-12-11 15:34:55 UTC (rev 68138)
+++ branches/Branch_4_2/build/build-thirdparty.xml 2007-12-11 15:37:01 UTC (rev 68139)
@@ -68,7 +68,6 @@
<componentref name="beanshell" version="1.3.0-brew"/>
<componentref name="cglib" version="2.1.3-brew"/>
<componentref name="dom4j" version="1.6.1-brew"/>
- <componentref name="gjt-jpl-util" version="1.0"/>
<componentref name="gnu-getopt" version="1.0.12-brew"/>
<componentref name="hibernate" version="3.2.4.SP1_CP01-brew"/>
<componentref name="hibernate-annotations" version="3.2.1.GA"/>
Modified: branches/Branch_4_2/server/.classpath
===================================================================
--- branches/Branch_4_2/server/.classpath 2007-12-11 15:34:55 UTC (rev 68138)
+++ branches/Branch_4_2/server/.classpath 2007-12-11 15:37:01 UTC (rev 68139)
@@ -11,8 +11,6 @@
<classpathentry kind="src" path="/transaction"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/thirdparty/apache-bcel/lib/bcel.jar"/>
- <classpathentry kind="lib" path="/thirdparty/gjt-jpl-util/lib/jpl-pattern.jar"/>
- <classpathentry kind="lib" path="/thirdparty/gjt-jpl-util/lib/jpl-util.jar"/>
<classpathentry kind="lib" path="/thirdparty/apache-log4j/lib/log4j.jar"/>
<classpathentry kind="lib" path="/thirdparty/oswego-concurrent/lib/concurrent.jar"/>
<classpathentry kind="lib" path="/thirdparty/gnu-getopt/lib/getopt.jar"/>
Modified: branches/Branch_4_2/server/build.xml
===================================================================
--- branches/Branch_4_2/server/build.xml 2007-12-11 15:34:55 UTC (rev 68138)
+++ branches/Branch_4_2/server/build.xml 2007-12-11 15:37:01 UTC (rev 68139)
@@ -82,7 +82,6 @@
<path refid="apache.log4j.classpath"/>
<path refid="apache.bcel.classpath"/>
<path refid="apache.commons.classpath"/>
- <path refid="gjt.jpl-util.classpath"/>
<path refid="gnu.getopt.classpath"/>
<path refid="ibm.wsdl4j.classpath"/>
<path refid="jboss.microcontainer.classpath"/>
Added: branches/Branch_4_2/server/src/main/org/jboss/verifier/event/EventGeneratorSupport.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/verifier/event/EventGeneratorSupport.java (rev 0)
+++ branches/Branch_4_2/server/src/main/org/jboss/verifier/event/EventGeneratorSupport.java 2007-12-11 15:37:01 UTC (rev 68139)
@@ -0,0 +1,278 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.gjt.lindfors.util; Taken from Juha Lindfors implementation as stated in
+package org.jboss.verifier.event;
+
+/*
+ * Class org.jboss.verifier.event.EventGeneratorSupport (refer Class org.gjt.lindfors.util.EventGeneratorSupport at gjt.org)
+ * Copyright (C) 1999 Juha Lindfors
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * This package and its source code is available at www.gjt.org
+ * $Id: EventGeneratorSupport.java,v 1.4 2007/12/06 11:31:15 csaldanh at redhat.com Exp $
+ *
+ * You can reach the author by sending email to jpl at gjt.org or
+ * directly to jplindfo at helsinki.fi.
+ */
+
+// standard imports
+import java.util.*;
+import java.awt.*;
+import java.io.*;
+
+// dependencies to non-standard packages and classes
+
+
+
+/**
+ * Support class for objects implementing the
+ * {@link org.gjt.lindfors.util.EventGenerator EventGenerator} interface.
+ * Contains implementations for addListener, removeListener, and hasListeners.
+ *
+ * <p>
+ *
+ * Every effort has been made to try to achieve thread-safety in
+ * EventGeneratorSupport class. Of course, this doesn't mean
+ * nasty race conditions and dead locks don't exist. I'm just
+ * not aware of them :)
+ *
+ * <p>
+ *
+ * For more detailed documentation, refer to the
+ * <a href="http://www.gjt.org/%7ejpl/org_gjt_lindfors_util/index.html">
+ *
+ * Util Library Tutorial
+ *
+ * </a> and
+ *
+ * <a href="http://www.gjt.org/%7ejpl/org_gjt_lindfors_util/specs/index.html">
+ *
+ * Util Library Specifications
+ *
+ * </a>. See Also:
+ *
+ * <a href="http://www.artima.com/designtechniques/index.html">
+ *
+ * The Event Generator Idiom
+ *
+ * </a> by Bill Venners.
+ *
+ *
+ * @see org.gjt.lindfors.util.EventGenerator
+ *
+ * @author Juha Lindfors
+ * @version $Revision: 1.4 $
+ * @since JDK1.1
+ */
+public abstract class EventGeneratorSupport implements Serializable, Cloneable{
+
+ /*
+ * [TODO] Implement different algorithms for listener notification. Use the
+ * one implemented in this class as default, and implement high
+ * performance notifications. Use strategy pattern to allow any
+ * number of algorithms to be added.
+ *
+ * [TODO] write performance tests to compare the implementations
+ *
+ * [TODO] Could use Doug Lea's latch implementation here. Prettier than
+ * using a mutex :P
+ *
+ * [TODO] The use of this class could be used as an example of bridge.
+ * Also, the concrete implementations usually act as adapters (not
+ * allowing just any listener to be added, but a specific type).
+ * Can subclassing be used as an adapter pattern?
+ */
+
+ /**
+ * Vector for storing the registered listeners. Vector will use lazy
+ * instantiation and will be constructed only upon request. To ensure
+ * proper behaviour in a multi-threaded environment, use the private
+ * getListInstance method any time you need a reference to this vector.
+ */
+ private transient Vector list = null;
+
+ /**
+ * Clone of listener list. This clone is used as a snapshot of the listener
+ * list. The clone is updated every time a listener is either registered
+ * or unregistered. This way we can avoid cloning the listener list for
+ * the getListeners method call which is usually called by the event
+ * firing methods. Since we don't have to clone the listener list for every
+ * event notification, we gain a significantly better performance.
+ */
+ private transient Vector clone = null;
+
+ /**
+ * Mutex lock for instantiating the listener collection.
+ */
+ private transient final boolean[] MUTEX = new boolean[0];
+
+
+ /**
+ * Always use this method to get a reference to listener collection.
+ * This guarantees thread safety.
+ */
+ private Vector getListInstance() {
+ synchronized (MUTEX) {
+ if (list == null) {
+ list = new Vector();
+ clone = (Vector)list.clone();
+ }
+ }
+ return list;
+ }
+
+ /**
+ * Constructs support object.
+ */
+ public EventGeneratorSupport() {}
+
+
+ /**
+ * Checks if any registered listeners exist.
+ *
+ * @return true if one or more listeners exist, false otherwise
+ */
+ public boolean hasListeners() {
+ if (list == null) // lazy list, not instantiated
+ return false;
+
+ if (list.size() == 0) // instantiated but empty
+ return false;
+
+ return true;
+ }
+
+
+ /**
+ * Returns the listeners registered to this object.
+ *
+ * @return enumeration of registered listener objects
+ */
+ protected Enumeration getListeners() {
+ if (list == null)
+ return new Enumeration() {
+
+ public boolean hasMoreElements() {
+ return false;
+ }
+
+ public Object nextElement() {
+ return null;
+ }
+ };
+
+ Vector v = (Vector)list.clone();
+ return v.elements();
+ }
+
+ /**
+ * Registers a new listener to this object. Duplicate listeners are
+ * discarded.
+ *
+ * <p>
+ *
+ * This method is marked as protected and is supposed to be used only by
+ * the concrete implementations of generator support classes. The concrete
+ * subclasses must ensure only the correct type of listeners are allowed
+ * to register, as this method allows any listener to be added, therefore
+ * not being type safe.
+ *
+ * @param listener the listener object
+ */
+ protected void addListener(EventListener listener) {
+ synchronized (MUTEX) {
+ Vector v = getListInstance();
+ if (!v.contains(listener))
+ v.addElement(listener);
+ }
+ }
+
+ /**
+ * Unregisters a listener from this object. It is safe to attempt to
+ * unregister non-existant listeners.
+ *
+ * @param listener the listener object
+ */
+ protected void removeListener(EventListener listener) {
+ if (list != null) {
+ list.removeElement(listener);
+ }
+ }
+
+ /**
+ * Returns a string representation of this EventGeneratorSupport object.
+ *
+ * <p>
+ *
+ * The output will be similar to the following form:<br>
+ * <pre>
+ * EventGeneratorSupport[Registered Listeners=1]
+ * </pre>
+ */
+ public String toString() {
+ int count;
+
+ // don't want to instantiate listener just to tell it has zero elements
+ if (list == null)
+ count = 0;
+ else count = getListInstance().size();
+
+ return Library.getClassName(this) + "[Registered Listeners=" + count + "]";
+ }
+
+ /**
+ * [PENDING]
+ */
+ public Component toComponent() {
+ // [FIXME] this exception class has disappeared!
+ //throw new UnsupportedOperationException("not implemented yet.");
+ return null;
+ }
+
+ /**
+ * [PENDING]
+ */
+ public Object clone() {
+ // [FIXME] this exception class has disappeared!
+ //throw new UnsupportedOperationException("not implemented yet.");
+ return null;
+ }
+
+}
+
+
Added: branches/Branch_4_2/server/src/main/org/jboss/verifier/event/Library.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/verifier/event/Library.java (rev 0)
+++ branches/Branch_4_2/server/src/main/org/jboss/verifier/event/Library.java 2007-12-11 15:37:01 UTC (rev 68139)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.verifier.event;
+
+/*
+ * Class org.jboss.verifier.event.Library (refer Class org.gjt.lindfors.util.Library at www.gjt.org)
+ * Copyright (C) 1999 Juha Lindfors
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * This package and its source code is available at www.jboss.org
+ * $Id: Library.java 3217 2007-12-06 11:28:57Z csaldanh at redhat.com $
+ *
+ * You can reach the author by sending email to jpl at gjt.org or
+ * directly to jplindfo at helsinki.fi.
+ */
+
+
+/**
+ * Collection of miscellaneous utility methods.
+ * <p>
+ * For more detailed documentation, refer to the
+ * <a href="http://www.gjt.org/%7ejpl/org_gjt_lindfors_util/index.html">
+ * Util Library Developer's Guide</a>
+ *
+ * @author Juha Lindfors
+ * @version $Revision: 1.1 $
+ * @since JDK1.1
+ */
+public class Library {
+
+ private Library() {}
+
+ /**
+ * Returns the class name of an object. This method returns only the
+ * name of the class, not a fully qualified class name with package
+ * information. For fully qualified class name, use
+ * <code>getClass().getName()</code>.
+ *
+ * @param obj object whose class name is wanted
+ *
+ * @return object's class name, without package information
+ *
+ * @see java.lang.Object#getClass()
+ */
+ public static String getClassName(Object obj) {
+ String str = obj.getClass().getName();
+ int index = str.lastIndexOf('.');
+ return str.substring(index+1);
+ }
+}
+
Modified: branches/Branch_4_2/server/src/main/org/jboss/verifier/event/VerificationEventGenerator.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/verifier/event/VerificationEventGenerator.java 2007-12-11 15:34:55 UTC (rev 68138)
+++ branches/Branch_4_2/server/src/main/org/jboss/verifier/event/VerificationEventGenerator.java 2007-12-11 15:37:01 UTC (rev 68139)
@@ -47,8 +47,6 @@
-// non-standard class dependencies
-import org.gjt.lindfors.util.EventGenerator;
/**
@@ -63,7 +61,7 @@
* @version $Revision$
* @since JDK 1.3
*/
-public interface VerificationEventGenerator extends EventGenerator {
+public interface VerificationEventGenerator {
abstract void addVerificationListener(VerificationListener listener);
abstract void removeVerificationListener(VerificationListener listener);
Modified: branches/Branch_4_2/server/src/main/org/jboss/verifier/event/VerificationEventGeneratorSupport.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/verifier/event/VerificationEventGeneratorSupport.java 2007-12-11 15:34:55 UTC (rev 68138)
+++ branches/Branch_4_2/server/src/main/org/jboss/verifier/event/VerificationEventGeneratorSupport.java 2007-12-11 15:37:01 UTC (rev 68139)
@@ -51,7 +51,12 @@
// non-standard class dependencies
-import org.gjt.lindfors.util.EventGeneratorSupport;
+/*
+ * import org.gjt.lindfors.util.EventGeneratorSupport; to org.jboss.verifier.event.EventGeneratorSupport;
+ * Trying to replace gjt-util, hence adding EventGeneratorSupport.java to this package
+ * which is taken from Juha Lindfors implementation found at the following reference:
+ * Refer org.gjt.lindfors.util.EventGeneratorSupport at www.gjt.org
+ */
import org.jboss.verifier.strategy.VerificationContext;
Modified: branches/Branch_4_2/server/src/main/org/jboss/verifier/factory/VerificationEventFactory.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/verifier/factory/VerificationEventFactory.java 2007-12-11 15:34:55 UTC (rev 68138)
+++ branches/Branch_4_2/server/src/main/org/jboss/verifier/factory/VerificationEventFactory.java 2007-12-11 15:37:01 UTC (rev 68139)
@@ -47,7 +47,6 @@
// non-standard class dependencies
-import org.gjt.lindfors.pattern.AbstractFactory;
import org.jboss.verifier.Section;
import org.jboss.verifier.event.VerificationEventGenerator;
@@ -66,7 +65,7 @@
* @version $Revision$
* @since JDK 1.3
*/
-public interface VerificationEventFactory extends AbstractFactory {
+public interface VerificationEventFactory {
VerificationEvent createSpecViolationEvent(
VerificationEventGenerator source,
Modified: branches/Branch_4_2/server/src/main/org/jboss/verifier/strategy/AbstractVerifier.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/verifier/strategy/AbstractVerifier.java 2007-12-11 15:34:55 UTC (rev 68138)
+++ branches/Branch_4_2/server/src/main/org/jboss/verifier/strategy/AbstractVerifier.java 2007-12-11 15:37:01 UTC (rev 68139)
@@ -23,7 +23,6 @@
// standard imports
-import org.gjt.lindfors.pattern.StrategyContext;
import org.jboss.logging.Logger;
import org.jboss.metadata.BeanMetaData;
import org.jboss.metadata.EntityMetaData;
@@ -1165,7 +1164,7 @@
*
* @return the client object using this algorithm implementation
*/
- public StrategyContext getContext()
+ public VerificationContext getContext()
{
return context;
}
Modified: branches/Branch_4_2/server/src/main/org/jboss/verifier/strategy/VerificationContext.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/verifier/strategy/VerificationContext.java 2007-12-11 15:34:55 UTC (rev 68138)
+++ branches/Branch_4_2/server/src/main/org/jboss/verifier/strategy/VerificationContext.java 2007-12-11 15:37:01 UTC (rev 68139)
@@ -49,7 +49,6 @@
import java.net.URL;
// non-standard class dependencies
-import org.gjt.lindfors.pattern.StrategyContext;
import org.jboss.verifier.event.VerificationEventGenerator;
@@ -68,7 +67,7 @@
* @since JDK 1.3
*/
public interface VerificationContext
- extends StrategyContext, VerificationEventGenerator
+ extends VerificationEventGenerator
{
/*
Modified: branches/Branch_4_2/server/src/main/org/jboss/verifier/strategy/VerificationStrategy.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/verifier/strategy/VerificationStrategy.java 2007-12-11 15:34:55 UTC (rev 68138)
+++ branches/Branch_4_2/server/src/main/org/jboss/verifier/strategy/VerificationStrategy.java 2007-12-11 15:37:01 UTC (rev 68139)
@@ -47,8 +47,6 @@
// standard imports
import java.util.Iterator;
-// non-standard class dependencies
-import org.gjt.lindfors.pattern.Strategy;
import org.jboss.metadata.EntityMetaData;
import org.jboss.metadata.MessageDrivenMetaData;
@@ -60,7 +58,6 @@
* @since JDK 1.3
*/
public interface VerificationStrategy
- extends Strategy
{
/**
* Does the entity check
More information about the jboss-cvs-commits
mailing list