JBoss Remoting SVN: r3476 - remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/java.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-22 04:45:44 -0500 (Fri, 22 Feb 2008)
New Revision: 3476
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/java/JavaSerializationManager.java
Log:
JBREM-900: receiveObjectVersion*_2() always update object stream's classloader.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/java/JavaSerializationManager.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/java/JavaSerializationManager.java 2008-02-22 09:41:57 UTC (rev 3475)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/serialization/impl/java/JavaSerializationManager.java 2008-02-22 09:45:44 UTC (rev 3476)
@@ -145,10 +145,7 @@
Object obj = null;
if(inputStream instanceof ObjectInputStreamWithClassLoader)
{
- if(((ObjectInputStreamWithClassLoader) inputStream).getClassLoader() == null)
- {
- ((ObjectInputStreamWithClassLoader) inputStream).setClassLoader(customClassLoader);
- }
+ ((ObjectInputStreamWithClassLoader) inputStream).setClassLoader(customClassLoader);
objInputStream = (ObjectInputStream) inputStream;
}
/*else if(inputStream instanceof JBossObjectInputStream)
@@ -205,10 +202,7 @@
Object obj = null;
if(inputStream instanceof ObjectInputStreamWithClassLoader)
{
- if(((ObjectInputStreamWithClassLoader) inputStream).getClassLoader() == null)
- {
- ((ObjectInputStreamWithClassLoader) inputStream).setClassLoader(customClassLoader);
- }
+ ((ObjectInputStreamWithClassLoader) inputStream).setClassLoader(customClassLoader);
objInputStream = (ObjectInputStream) inputStream;
}
/*else if(inputStream instanceof JBossObjectInputStream)
16 years, 9 months
JBoss Remoting SVN: r3475 - remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/serializable.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-22 04:41:57 -0500 (Fri, 22 Feb 2008)
New Revision: 3475
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/serializable/SerializableUnMarshaller.java
Log:
JBREM-900: (1) Implements UpdateableClassloaderUnMarshaller; (2) eliminated direct reference to customClassLoader.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/serializable/SerializableUnMarshaller.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/serializable/SerializableUnMarshaller.java 2008-02-22 09:39:54 UTC (rev 3474)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/serializable/SerializableUnMarshaller.java 2008-02-22 09:41:57 UTC (rev 3475)
@@ -26,11 +26,13 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
+import java.lang.ref.WeakReference;
import java.util.Map;
import org.jboss.remoting.Version;
import org.jboss.remoting.marshal.PreferredStreamUnMarshaller;
import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.marshal.UpdateableClassloaderUnMarshaller;
import org.jboss.remoting.marshal.VersionedUnMarshaller;
import org.jboss.remoting.serialization.SerializationManager;
import org.jboss.remoting.serialization.SerializationStreamFactory;
@@ -40,13 +42,14 @@
*
* @author <a href="mailto:tom@jboss.org">Tom Elrod</a>
*/
-public class SerializableUnMarshaller implements PreferredStreamUnMarshaller, VersionedUnMarshaller
+public class SerializableUnMarshaller
+implements PreferredStreamUnMarshaller, VersionedUnMarshaller, UpdateableClassloaderUnMarshaller
{
static final long serialVersionUID = -1554017376768780738L;
public final static String DATATYPE = "serializable";
- protected ClassLoader customClassLoader = null;
+ protected ClassLoader customClassLoader;
protected String serializationType;
@@ -69,7 +72,7 @@
{
BufferedInputStream bis = new BufferedInputStream(inputStream);
SerializationManager manager = SerializationStreamFactory.getManagerInstance(getSerializationType());
- return manager.createInput(bis, customClassLoader);
+ return manager.createInput(bis, getClassLoader());
}
}
@@ -117,7 +120,7 @@
public Object read(InputStream inputStream, Map metadata, int version) throws IOException, ClassNotFoundException
{
ObjectInputStream ois = (ObjectInputStream) getMarshallingStream(inputStream, null);
- return SerializationStreamFactory.getManagerInstance(getSerializationType()).receiveObject(ois, customClassLoader, version);
+ return SerializationStreamFactory.getManagerInstance(getSerializationType()).receiveObject(ois, getClassLoader(), version);
}
@@ -131,12 +134,17 @@
{
this.customClassLoader = classloader;
}
+
+ public ClassLoader getClassLoader()
+ {
+ return customClassLoader;
+ }
public UnMarshaller cloneUnMarshaller()
throws CloneNotSupportedException
{
SerializableUnMarshaller unmarshaller = new SerializableUnMarshaller();
- unmarshaller.setClassLoader(this.customClassLoader);
+ unmarshaller.setClassLoader(getClassLoader());
return unmarshaller;
}
16 years, 9 months
JBoss Remoting SVN: r3474 - remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/http.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-22 04:39:54 -0500 (Fri, 22 Feb 2008)
New Revision: 3474
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java
Log:
JBREM-900: Eliminated direct reference to customClassLoader.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java 2008-02-22 09:37:57 UTC (rev 3473)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/http/HTTPUnMarshaller.java 2008-02-22 09:39:54 UTC (rev 3474)
@@ -197,7 +197,7 @@
public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
{
HTTPUnMarshaller unmarshaller = new HTTPUnMarshaller();
- unmarshaller.setClassLoader(this.customClassLoader);
+ unmarshaller.setClassLoader(getClassLoader());
return unmarshaller;
}
16 years, 9 months
JBoss Remoting SVN: r3473 - remoting2/branches/2.x/src/main/org/jboss/remoting/marshal.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-22 04:37:57 -0500 (Fri, 22 Feb 2008)
New Revision: 3473
Added:
remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/UpdateableClassloaderUnMarshaller.java
Log:
JBREM-900: New interface with getClassLoader().
Added: remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/UpdateableClassloaderUnMarshaller.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/UpdateableClassloaderUnMarshaller.java (rev 0)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/marshal/UpdateableClassloaderUnMarshaller.java 2008-02-22 09:37:57 UTC (rev 3473)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* 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.remoting.marshal;
+
+
+/**
+ * Adds ClassLoader getter().
+ *
+ * @author <a href="ron.sigal(a)jboss.com">Ron Sigal</a>
+ * @version $Revision: 1.1 $
+ * <p>
+ * Copyright Feb 21, 2008
+ * </p>
+ */
+public interface UpdateableClassloaderUnMarshaller extends UnMarshaller
+{
+ ClassLoader getClassLoader();
+}
+
16 years, 9 months
JBoss Remoting SVN: r3472 - remoting2/branches/2.x/src/main/org/jboss/remoting/loading.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-22 04:37:18 -0500 (Fri, 22 Feb 2008)
New Revision: 3472
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/loading/RemotingClassLoader.java
Log:
JBREM-900: Introduced reference counter.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/loading/RemotingClassLoader.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/loading/RemotingClassLoader.java 2008-02-22 09:36:22 UTC (rev 3471)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/loading/RemotingClassLoader.java 2008-02-22 09:37:18 UTC (rev 3472)
@@ -31,6 +31,7 @@
public class RemotingClassLoader extends ClassLoader
{
private ClassLoader userClassLoader = null;
+ private int referenceCounter;
protected static final Logger log = Logger.getLogger(RemotingClassLoader.class);
protected static final boolean isTrace = log.isTraceEnabled();
@@ -39,7 +40,28 @@
{
super(remotingClassLoader);
this.userClassLoader = userClassLoader;
+ referenceCounter = 1;
}
+
+ public synchronized void setUserClassLoader(ClassLoader userClassLoader)
+ throws Exception
+ {
+ if (userClassLoader == null)
+ {
+ this.userClassLoader = userClassLoader;
+ }
+ else if (this.userClassLoader != userClassLoader)
+ {
+ throw new Exception("Attempting to change existing userClassLoader");
+ }
+ referenceCounter++;
+ }
+
+ public synchronized void unsetUserClassLoader()
+ {
+ if (--referenceCounter == 0)
+ userClassLoader = null;
+ }
public Class loadClass(String name) throws ClassNotFoundException
{
16 years, 9 months
JBoss Remoting SVN: r3471 - remoting2/branches/2.x/src/main/org/jboss/remoting.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2008-02-22 04:36:22 -0500 (Fri, 22 Feb 2008)
New Revision: 3471
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
Log:
JBREM-900: Introduced a WeakHashMap of unmarshallers.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
===================================================================
--- remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2008-02-21 18:17:50 UTC (rev 3470)
+++ remoting2/branches/2.x/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2008-02-22 09:36:22 UTC (rev 3471)
@@ -7,13 +7,16 @@
import org.jboss.remoting.marshal.MarshalFactory;
import org.jboss.remoting.marshal.Marshaller;
import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.marshal.UpdateableClassloaderUnMarshaller;
import org.jboss.remoting.transport.ClientInvoker;
import org.jboss.util.id.GUID;
import java.io.IOException;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.WeakHashMap;
/**
* MicroRemoteClientInvoker is an abstract client part handler that implements the bulk of the heavy
@@ -37,7 +40,7 @@
protected boolean connected = false;
private Marshaller marshaller;
- private UnMarshaller unmarshaller;
+ private Map unmarshallers = new WeakHashMap();
private String dataType;
private final Object clientLeaseLock = new Object();
private LeasePinger leasePinger = null;
@@ -65,9 +68,8 @@
if (trace) { log.trace(this + "(" + (++invokeCount) + ") invoking " + invocationReq); }
+ // Set up marshaller.
Marshaller marshaller = getMarshaller();
- UnMarshaller unmarshaller = getUnMarshaller();
-
if (marshaller == null)
{
// try by locator (in case marshaller class name specified)
@@ -80,34 +82,61 @@
{
// went as far as possible to find a marshaller, will have to give up
throw new InvalidMarshallingResource(
- "Can not find a valid marshaller for data type: " + getDataType());
+ "Can not find a valid marshaller for data type: " + getDataType());
}
- setMarshaller(marshaller);
}
+ setMarshaller(marshaller);
}
- if (unmarshaller == null)
+ // Set up unmarshaller.
+ UnMarshaller unmarshaller = null;
+ RemotingClassLoader rcl = null;
+ synchronized (unmarshallers)
{
- // creating a new classloader containing the remoting class loader (for remote classloading)
- // and the current thread's class loader. This allows to load remoting classes as well as
- // user's classes.
- ClassLoader remotingClassLoader =
- new RemotingClassLoader(getClassLoader(), Thread.currentThread().getContextClassLoader());
-
- // try by locator (in case unmarshaller class name specified)
- unmarshaller = MarshalFactory.getUnMarshaller(getLocator(), getClassLoader());
+ unmarshaller = getUnMarshaller();
if (unmarshaller == null)
{
- unmarshaller = MarshalFactory.getUnMarshaller(getDataType(), getSerializationType());
+ // try by locator (in case unmarshaller class name specified)
+ unmarshaller = MarshalFactory.getUnMarshaller(getLocator(), getClassLoader());
if (unmarshaller == null)
{
- // went as far as possible to find a unmarshaller, will have to give up
- throw new InvalidMarshallingResource(
- "Can not find a valid unmarshaller for data type: " + getDataType());
+ unmarshaller = MarshalFactory.getUnMarshaller(getDataType(), getSerializationType());
+ if (unmarshaller == null)
+ {
+ // went as far as possible to find a unmarshaller, will have to give up
+ throw new InvalidMarshallingResource(
+ "Can not find a valid unmarshaller for data type: " + getDataType());
+ }
}
setUnMarshaller(unmarshaller);
}
- unmarshaller.setClassLoader(remotingClassLoader);
+
+ // Each unmarshaller gets a RemotingClassloader classloader containing the
+ // remoting class loader (for remote classloading) and the current thread's
+ // class loader. This allows to load remoting classes as well as user's
+ // classes. If possible, will simply reset context classloader on existing
+ // RemotingClassLoader.
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ if (unmarshaller instanceof UpdateableClassloaderUnMarshaller)
+ {
+ UpdateableClassloaderUnMarshaller uclum = (UpdateableClassloaderUnMarshaller) unmarshaller;
+ ClassLoader cl = uclum.getClassLoader();
+ if (cl instanceof RemotingClassLoader)
+ {
+ rcl = (RemotingClassLoader) cl;
+ rcl.setUserClassLoader(contextClassLoader);
+ }
+ else
+ {
+ rcl = new RemotingClassLoader(getClassLoader(), contextClassLoader);
+ unmarshaller.setClassLoader(rcl);
+ }
+ }
+ else
+ {
+ rcl = new RemotingClassLoader(getClassLoader(), contextClassLoader);
+ unmarshaller.setClassLoader(rcl);
+ }
}
// if raw, then send only param of invocation request
@@ -122,9 +151,17 @@
payload = invocationReq;
}
- returnValue =
- transport(invocationReq.getSessionId(), payload, metadata, marshaller, unmarshaller);
-
+ try
+ {
+ String sessionId = invocationReq.getSessionId();
+ returnValue = transport(sessionId, payload, metadata, marshaller, unmarshaller);
+ }
+ finally
+ {
+ // Delete reference to current thread's context classloader.
+ rcl.unsetUserClassLoader();
+ }
+
// Now check if is remoting response and process
if (returnValue instanceof InvocationResponse)
{
@@ -313,12 +350,18 @@
public void setUnMarshaller(UnMarshaller unmarshaller)
{
- this.unmarshaller = unmarshaller;
+ synchronized (unmarshallers)
+ {
+ unmarshallers.put(Thread.currentThread().getContextClassLoader(), unmarshaller);
+ }
}
public UnMarshaller getUnMarshaller()
{
- return this.unmarshaller;
+ synchronized (unmarshallers)
+ {
+ return (UnMarshaller)unmarshallers.get(Thread.currentThread().getContextClassLoader());
+ }
}
public String getSessionId()
16 years, 9 months
JBoss Remoting SVN: r3470 - in remoting3/trunk: srp/src/main/java/org/jboss/cx/remoting/core/security/sasl and 1 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-02-21 13:17:50 -0500 (Thu, 21 Feb 2008)
New Revision: 3470
Added:
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/BufferFactory.java
Removed:
remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/BufferFactory.java
remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/ExceptionUtil.java
remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/Resource.java
remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/URIUtil.java
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/stream/Streams.java
remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/AbstractSrpSaslParticipant.java
Log:
Delete and move a bunch of unused stuff out of the util package
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/stream/Streams.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/stream/Streams.java 2008-02-21 18:11:00 UTC (rev 3469)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/stream/Streams.java 2008-02-21 18:17:50 UTC (rev 3470)
@@ -2,13 +2,9 @@
import java.io.EOFException;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;
-import org.jboss.cx.remoting.core.util.BufferFactory;
/**
*
@@ -17,24 +13,6 @@
private Streams() {
}
- private static final ByteBuffer emptyBuffer = ByteBuffer.allocate(0);
-
- public static InputStream getInputStream(ObjectSource<ByteBuffer> source, boolean propagateClose) {
- return new ByteBufferSourceInputStream(source, propagateClose);
- }
-
- public static OutputStream getOutputStream(ObjectSink<ByteBuffer> sink, final BufferFactory bufferFactory, final boolean propagateFlush, boolean propagateClose) {
- return new ByteBufferSinkOutputStream(sink, bufferFactory, propagateFlush, propagateClose);
- }
-
- public static ObjectSource<ByteBuffer> getObjectSource(InputStream stream, final BufferFactory bufferFactory, boolean propagateClose) {
- return new InputStreamByteBufferSource(stream, bufferFactory, propagateClose);
- }
-
- public static ObjectSink<ByteBuffer> getObjectSink(OutputStream stream, boolean propagateFlush, boolean propagateClose) {
- return new OutputStreamByteBufferSink(stream, propagateFlush, propagateClose);
- }
-
public static <T> ObjectSink<T> getCollectionObjectSink(Collection<T> target) {
return new CollectionObjectSink<T>(target);
}
@@ -43,258 +21,6 @@
return new IteratorObjectSource<T>(iterator);
}
- private static final class ByteBufferSourceInputStream extends InputStream {
- private final ObjectSource<ByteBuffer> source;
- private ByteBuffer current = emptyBuffer;
- private final boolean propagateClose;
-
- public void close() throws IOException {
- if (propagateClose) {
- source.close();
- }
- }
-
- private ByteBufferSourceInputStream(final ObjectSource<ByteBuffer> source, final boolean propagateClose) {
- this.source = source;
- this.propagateClose = propagateClose;
- }
-
- public int read() throws IOException {
- if (current == null) {
- return -1;
- }
- while (!current.hasRemaining()) {
- if (!next()) {
- return -1;
- }
- }
- return current.get() & 0xff;
- }
-
- public int read(byte b[], int off, int len) throws IOException {
- if (current == null) {
- return -1;
- }
- final int total = len;
- loop:
- while (len > 0) {
- while (!current.hasRemaining()) {
- if (!next()) {
- break loop;
- }
- }
- final int count = Math.min(len, current.remaining());
- current.get(b, off, count);
- len -= count;
- off += count;
- }
- return total - len;
- }
-
- public long skip(long n) throws IOException {
- final long total = n;
- loop:
- while (n > 0L) {
- while (!current.hasRemaining()) {
- if (!next()) {
- break loop;
- }
- }
- // since remaining is an int, the result will always fit in an int
- final int count = (int) Math.min(n, (long) current.remaining());
- current.position(current.position() + count);
- n -= (long) count;
- }
- return total - n;
- }
-
- public int available() throws IOException {
- return current == null ? 0 : current.remaining();
- }
-
- private boolean next() throws IOException {
- if (source.hasNext()) {
- current = source.next();
- return true;
- } else {
- current = null;
- return false;
- }
- }
- }
-
- private static final class ByteBufferSinkOutputStream extends OutputStream {
- private final ObjectSink<ByteBuffer> sink;
- private final boolean propagateClose;
- private final boolean propagateFlush;
- private final BufferFactory bufferFactory;
-
- private ByteBuffer buffer;
-
- public void close() throws IOException {
- if (propagateClose) {
- sink.close();
- }
- }
-
- private ByteBufferSinkOutputStream(final ObjectSink<ByteBuffer> sink, final BufferFactory bufferFactory, final boolean propagateFlush, final boolean propagateClose) {
- this.sink = sink;
- this.bufferFactory = bufferFactory;
- this.propagateClose = propagateClose;
- this.propagateFlush = propagateFlush;
- }
-
- public void write(int b) throws IOException {
- if (buffer == null) {
- buffer = bufferFactory.create();
- }
- buffer.put((byte) b);
- if (!buffer.hasRemaining()) {
- doFlush();
- }
- }
-
- public void write(byte b[], int off, int len) throws IOException {
- while (len > 0) {
- if (buffer == null) {
- buffer = bufferFactory.create();
- }
- final int count = Math.min(buffer.remaining(), len);
- buffer.put(b, off, count);
- len -= count;
- off += count;
- if (!buffer.hasRemaining()) {
- doFlush();
- }
- }
- }
-
- public void flush() throws IOException {
- if (buffer == null) {
- buffer = bufferFactory.create();
- }
- if (buffer.position() > 0) {
- doFlush();
- }
- if (propagateFlush) {
- sink.flush();
- }
- }
-
- private void doFlush() throws IOException {
- buffer.flip();
- try {
- sink.accept(buffer);
- } finally {
- buffer = null;
- }
- }
- }
-
- private static final class InputStreamByteBufferSource implements ObjectSource<ByteBuffer> {
- private final InputStream stream;
- private final boolean propagateClose;
- private final BufferFactory bufferFactory;
-
- private ByteBuffer buffer;
-
- public InputStreamByteBufferSource(final InputStream stream, final BufferFactory bufferFactory, final boolean propagateClose) {
- this.stream = stream;
- this.bufferFactory = bufferFactory;
- this.propagateClose = propagateClose;
- }
-
- public boolean hasNext() throws IOException {
- return buffer != null && buffer.hasRemaining() || populate();
- }
-
- public ByteBuffer next() throws IOException {
- if (buffer == null || !buffer.hasRemaining()) {
- if (!populate()) {
- throw new EOFException("End of file reached");
- }
- }
- try {
- return buffer;
- } finally {
- buffer = null;
- }
- }
-
- private boolean populate() throws IOException {
- if (buffer == null) {
- buffer = bufferFactory.create();
- }
- int count;
- int pos = buffer.position();
- int rem = buffer.remaining();
- while (rem > 0 && (count = stream.read(buffer.array(), pos, rem)) > 0) {
- pos += count;
- rem -= count;
- }
- buffer.position(pos);
- return buffer.hasRemaining();
- }
-
- public void close() throws IOException {
- if (propagateClose) {
- stream.close();
- }
- }
- }
-
- private static final class OutputStreamByteBufferSink implements ObjectSink<ByteBuffer> {
- private final OutputStream stream;
- private final boolean propagateClose;
- private final boolean propagateFlush;
- private byte[] tempStore;
-
- public OutputStreamByteBufferSink(final OutputStream stream, final boolean propagateFlush, final boolean propagateClose) {
- this.stream = stream;
- this.propagateClose = propagateClose;
- this.propagateFlush = propagateFlush;
- }
-
- public void accept(final ByteBuffer buffer) throws IOException {
- if (!buffer.hasRemaining()) {
- return;
- }
- if (buffer.hasArray()) {
- // Optimization: we can write data directly from the buffer array, avoid a copy
- final byte[] bytes = buffer.array();
- final int offs = buffer.arrayOffset();
- final int len = buffer.remaining();
- stream.write(bytes, offs, len);
- buffer.clear();
- } else {
- // gotta copy the data out a bit at a time
- final byte[] tempStore;
- if (this.tempStore == null) {
- tempStore = this.tempStore = new byte[1024];
- } else {
- tempStore = this.tempStore;
- }
- while (buffer.hasRemaining()) {
- int count = Math.min(buffer.remaining(), tempStore.length);
- buffer.get(tempStore, 0, count);
- stream.write(tempStore, 0, count);
- }
- }
- }
-
- public void flush() throws IOException {
- if (propagateFlush) {
- stream.flush();
- }
- }
-
- public void close() throws IOException {
- if (propagateClose) {
- stream.close();
- }
- }
- }
-
private static final class CollectionObjectSink<T> implements ObjectSink<T> {
private final Collection<T> target;
Modified: remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/AbstractSrpSaslParticipant.java
===================================================================
--- remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/AbstractSrpSaslParticipant.java 2008-02-21 18:11:00 UTC (rev 3469)
+++ remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/AbstractSrpSaslParticipant.java 2008-02-21 18:17:50 UTC (rev 3470)
@@ -18,7 +18,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
-import org.jboss.cx.remoting.core.util.BufferFactory;
+import org.jboss.cx.remoting.core.security.sasl.BufferFactory;
import org.jboss.cx.remoting.core.util.IoUtil;
import javax.crypto.BadPaddingException;
Copied: remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/BufferFactory.java (from rev 3461, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/BufferFactory.java)
===================================================================
--- remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/BufferFactory.java (rev 0)
+++ remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/BufferFactory.java 2008-02-21 18:17:50 UTC (rev 3470)
@@ -0,0 +1,59 @@
+package org.jboss.cx.remoting.core.security.sasl;
+
+import java.nio.ByteBuffer;
+
+/**
+ *
+ */
+public abstract class BufferFactory {
+ protected final int size;
+ protected final boolean direct;
+
+ protected BufferFactory(final int size, final boolean direct) {
+ this.size = size;
+ this.direct = direct;
+ }
+
+ public abstract ByteBuffer create();
+
+ public final int getSize() {
+ return size;
+ }
+
+ public final boolean isDirect() {
+ return direct;
+ }
+
+ public static BufferFactory create(int size, boolean direct) throws IllegalArgumentException {
+ if (size < 0) {
+ throw new IllegalArgumentException("Negative buffer size given");
+ }
+ if (direct) {
+ return new DirectFactoryImpl(size);
+ } else {
+ return new HeapFactoryImpl(size);
+ }
+ }
+
+ private static final class HeapFactoryImpl extends BufferFactory {
+
+ private HeapFactoryImpl(final int size) {
+ super(size, false);
+ }
+
+ public ByteBuffer create() {
+ return ByteBuffer.allocate(size);
+ }
+ }
+
+ private static final class DirectFactoryImpl extends BufferFactory {
+
+ private DirectFactoryImpl(final int size) {
+ super(size, true);
+ }
+
+ public ByteBuffer create() {
+ return ByteBuffer.allocateDirect(size);
+ }
+ }
+}
Deleted: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/BufferFactory.java
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/BufferFactory.java 2008-02-21 18:11:00 UTC (rev 3469)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/BufferFactory.java 2008-02-21 18:17:50 UTC (rev 3470)
@@ -1,59 +0,0 @@
-package org.jboss.cx.remoting.core.util;
-
-import java.nio.ByteBuffer;
-
-/**
- *
- */
-public abstract class BufferFactory {
- protected final int size;
- protected final boolean direct;
-
- protected BufferFactory(final int size, final boolean direct) {
- this.size = size;
- this.direct = direct;
- }
-
- public abstract ByteBuffer create();
-
- public final int getSize() {
- return size;
- }
-
- public final boolean isDirect() {
- return direct;
- }
-
- public static BufferFactory create(int size, boolean direct) throws IllegalArgumentException {
- if (size < 0) {
- throw new IllegalArgumentException("Negative buffer size given");
- }
- if (direct) {
- return new DirectFactoryImpl(size);
- } else {
- return new HeapFactoryImpl(size);
- }
- }
-
- private static final class HeapFactoryImpl extends BufferFactory {
-
- private HeapFactoryImpl(final int size) {
- super(size, false);
- }
-
- public ByteBuffer create() {
- return ByteBuffer.allocate(size);
- }
- }
-
- private static final class DirectFactoryImpl extends BufferFactory {
-
- private DirectFactoryImpl(final int size) {
- super(size, true);
- }
-
- public ByteBuffer create() {
- return ByteBuffer.allocateDirect(size);
- }
- }
-}
Deleted: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/ExceptionUtil.java
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/ExceptionUtil.java 2008-02-21 18:11:00 UTC (rev 3469)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/ExceptionUtil.java 2008-02-21 18:17:50 UTC (rev 3470)
@@ -1,77 +0,0 @@
-package org.jboss.cx.remoting.core.util;
-
-import java.io.EOFException;
-import java.io.IOException;
-
-import javax.transaction.xa.XAException;
-
-/**
- *
- */
-public final class ExceptionUtil {
- private ExceptionUtil() {
- }
-
- public static IOException ioException(String msg, Exception wrap) {
- final String newMsg;
- final String wrapMessage = wrap.getMessage();
- if (msg == null) {
- if (wrapMessage == null) {
- newMsg = "No message";
- } else {
- newMsg = wrapMessage;
- }
- } else {
- if (wrapMessage == null) {
- newMsg = msg;
- } else {
- newMsg = msg + ": " + wrapMessage;
- }
- }
- IOException ioException = new IOException(newMsg);
- ioException.setStackTrace(wrap.getStackTrace());
- return ioException;
- }
-
- public static XAException xaException(String msg, Exception wrap) {
- final String newMsg;
- final String wrapMessage = wrap.getMessage();
- if (msg == null) {
- if (wrapMessage == null) {
- newMsg = "No message";
- } else {
- newMsg = wrapMessage;
- }
- } else {
- if (wrapMessage == null) {
- newMsg = msg;
- } else {
- newMsg = msg + ": " + wrapMessage;
- }
- }
- XAException xaException = new XAException(newMsg);
- xaException.setStackTrace(wrap.getStackTrace());
- return xaException;
- }
-
- public static EOFException eofException(String msg, Exception wrap) {
- final String newMsg;
- final String wrapMessage = wrap.getMessage();
- if (msg == null) {
- if (wrapMessage == null) {
- newMsg = "No message";
- } else {
- newMsg = wrapMessage;
- }
- } else {
- if (wrapMessage == null) {
- newMsg = msg;
- } else {
- newMsg = msg + ": " + wrapMessage;
- }
- }
- EOFException eofException = new EOFException(newMsg);
- eofException.setStackTrace(wrap.getStackTrace());
- return eofException;
- }
-}
Deleted: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/Resource.java
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/Resource.java 2008-02-21 18:11:00 UTC (rev 3469)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/Resource.java 2008-02-21 18:17:50 UTC (rev 3470)
@@ -1,146 +0,0 @@
-package org.jboss.cx.remoting.core.util;
-
-/**
- *
- */
-public final class Resource {
- private int count;
- private final Object monitor = new Object();
- private State state = State.DOWN;
-
- private enum State {
- UP,
- STOPPING,
- DOWN,
- DEAD,
- }
-
- public Resource() { /*nothing*/ }
-
- public final boolean isStateUp() {
- return state == State.UP;
- }
-
- public final boolean isStateStopping() {
- return state == State.STOPPING;
- }
-
- public final boolean isStateDown() {
- return state == State.DOWN;
- }
-
- public final boolean isStateDead() {
- return state == State.DEAD;
- }
-
- public final void doAcquire() throws IllegalStateException {
- synchronized(monitor) {
- if (state != State.UP) {
- throw new IllegalStateException("Resource may not be acquired (not up)");
- }
- count ++;
- }
- }
-
- public final void doRelease() throws IllegalStateException {
- synchronized(monitor) {
- if (state == State.DEAD || state == State.DOWN) {
- throw new IllegalStateException("Resource may not be released (down)");
- }
- if (count == 0) {
- throw new IllegalStateException("Resource may not be released (count is zero)");
- }
- count --;
- monitor.notify();
- }
- }
-
- public final void doStart(final Runnable postStartAction) throws IllegalStateException {
- synchronized(monitor) {
- if (state == State.DEAD) {
- throw new IllegalStateException("Registration has been unregistered and may not be started again");
- }
- if (state != State.DOWN) {
- throw new IllegalStateException("Resource not stopped");
- }
- // DOWN -> UP
- state = State.UP;
- count = 0;
- }
- if (postStartAction != null) {
- postStartAction.run();
- }
- }
-
- public final void doTerminate(final Runnable postTerminateAction) throws IllegalStateException {
- synchronized(monitor) {
- if (state == State.DEAD) {
- return;
- }
- if (state != State.DOWN) {
- throw new IllegalStateException("Resource is not down");
- }
- // DOWN -> DEAD
- state = State.DEAD;
- }
- if (postTerminateAction != null) {
- postTerminateAction.run();
- }
- }
-
- public final void doStop(Runnable shutdownOperation, final Runnable postShutdownAction) throws IllegalStateException {
- synchronized(monitor) {
- if (state == State.DOWN) {
- return;
- }
- if (state != State.UP) {
- throw new IllegalStateException("Resource is not up");
- }
- // UP -> STOPPING
- state = State.STOPPING;
- }
- if (shutdownOperation != null) {
- shutdownOperation.run();
- }
- // state is still STOPPING since nothing changes the state from that except this code
- boolean intr = Thread.interrupted();
- try {
- synchronized (monitor) {
- while (count > 0) {
- try {
- monitor.wait();
- } catch (InterruptedException e) {
- intr = Thread.interrupted();
- }
- }
- // STOPPING -> DOWN
- state = State.DOWN;
- }
- if (postShutdownAction != null) {
- postShutdownAction.run();
- }
- } finally {
- if (intr) {
- Thread.currentThread().interrupt();
- }
- }
- }
-
- public final void runIfUp(Runnable operation) {
- synchronized(monitor) {
- if (state != State.UP) {
- throw new IllegalStateException("Resource is not up");
- }
- operation.run();
- }
- }
-
- public final void runIfDown(Runnable operation) {
- synchronized(monitor) {
- if (state != State.DOWN) {
- throw new IllegalStateException("Configuration may not be changed in state " + state.toString());
- }
- operation.run();
- }
- }
-}
Deleted: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/URIUtil.java
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/URIUtil.java 2008-02-21 18:11:00 UTC (rev 3469)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/URIUtil.java 2008-02-21 18:17:50 UTC (rev 3470)
@@ -1,24 +0,0 @@
-package org.jboss.cx.remoting.core.util;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- *
- */
-public final class URIUtil {
- private URIUtil() { /* empty */ }
-
- public static String getAbsolutePath(URI baseUri, String relativePath) {
- try {
- return getAbsolutePath(baseUri, new URI(null, null, relativePath, null));
- } catch (URISyntaxException e) {
- throw new IllegalArgumentException(e.getMessage());
- }
- }
-
- public static String getAbsolutePath(URI baseUri, URI relativePath) {
- return baseUri.resolve(relativePath).getPath();
- }
-
-}
16 years, 9 months
JBoss Remoting SVN: r3469 - in remoting3/trunk: version/src/main/java/org/jboss/cx/remoting/version and 1 other directory.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-02-21 13:11:00 -0500 (Thu, 21 Feb 2008)
New Revision: 3469
Modified:
remoting3/trunk/build.xml
remoting3/trunk/version/src/main/java/org/jboss/cx/remoting/version/Version.java
Log:
Add API javadoc generation
Modified: remoting3/trunk/build.xml
===================================================================
--- remoting3/trunk/build.xml 2008-02-21 17:22:04 UTC (rev 3468)
+++ remoting3/trunk/build.xml 2008-02-21 18:11:00 UTC (rev 3469)
@@ -1193,6 +1193,23 @@
</jar>
</target>
+ <!-- ============================================== -->
+ <!-- JAVADOCS -->
+ <!-- ============================================== -->
+
+ <target name="api-javadoc" depends="api,util">
+ <delete dir="api/target/main/docs"/>
+ <mkdir dir="api/target/main/docs"/>
+ <javadoc destdir="api/target/main/docs" author="false" version="false" use="false" windowtitle="JBoss Remoting API">
+ <packageset dir="api/src/main/java"/>
+ <packageset dir="util/src/main/java"/>
+ <doctitle><![CDATA[<h1>JBoss Remoting 3</h1>]]></doctitle>
+ <bottom><![CDATA[<i>Copyright © 2008 JBoss, a division of Red Hat, Inc.</i>]]></bottom>
+ <link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
+ <classpath location="util/target/main/classes"/>
+ </javadoc>
+ </target>
+
<!-- Default targets - keep depends in alpha order by category name -->
<!-- These targets should explicitly list all modules, even if they will be built by other modules -->
Modified: remoting3/trunk/version/src/main/java/org/jboss/cx/remoting/version/Version.java
===================================================================
--- remoting3/trunk/version/src/main/java/org/jboss/cx/remoting/version/Version.java 2008-02-21 17:22:04 UTC (rev 3468)
+++ remoting3/trunk/version/src/main/java/org/jboss/cx/remoting/version/Version.java 2008-02-21 18:11:00 UTC (rev 3469)
@@ -7,6 +7,6 @@
public static final String VERSION = "3.0.0-M2";
public static void main(String[] args) {
- System.out.println(VERSION);
+ System.out.print(VERSION);
}
}
16 years, 9 months
JBoss Remoting SVN: r3468 - remoting3/trunk.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-02-21 12:22:04 -0500 (Thu, 21 Feb 2008)
New Revision: 3468
Modified:
remoting3/trunk/build.xml
Log:
Add more jars
Modified: remoting3/trunk/build.xml
===================================================================
--- remoting3/trunk/build.xml 2008-02-21 16:57:01 UTC (rev 3467)
+++ remoting3/trunk/build.xml 2008-02-21 17:22:04 UTC (rev 3468)
@@ -1080,6 +1080,81 @@
<!-- JARS - Keep in alpha order by jar name -->
<!-- ============================================== -->
+ <target name="api-jar" description="Build the API JAR" depends="api,util,version">
+ <delete file="jboss-remoting-api.jar"/>
+ <jar jarfile="jboss-remoting-api.jar">
+ <manifest>
+ <attribute name="Created-By" value="${java.vm.version} (${java.vm.vendor})"/>
+ <attribute name="Specification-Title" value="JBoss Remoting"/>
+ <attribute name="Specification-Version" value="${version}"/>
+ <attribute name="Specification-Vendor" value="JBoss (http://www.jboss.org/)"/>
+ <attribute name="Implementation-Title" value="JBoss Remoting (API)"/>
+ <attribute name="Implementation-URL" value="http://labs.jboss.org/jbossremoting/"/>
+ <attribute name="Implementation-Version" value="${version}"/>
+ <attribute name="Implementation-Vendor" value="JBoss, a division of Red Hat, Inc."/>
+ <attribute name="Implementation-Vendor-Id" value="http://www.jboss.org"/>
+ </manifest>
+ <zipfileset dir="api/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ <zipfileset dir="util/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ </jar>
+ </target>
+
+ <target name="core-jar" description="Build the Core JAR" depends="core,log-jboss,version">
+ <delete file="jboss-remoting-core.jar"/>
+ <jar jarfile="jboss-remoting-core.jar">
+ <manifest>
+ <attribute name="Created-By" value="${java.vm.version} (${java.vm.vendor})"/>
+ <attribute name="Specification-Title" value="JBoss Remoting"/>
+ <attribute name="Specification-Version" value="${version}"/>
+ <attribute name="Specification-Vendor" value="JBoss (http://www.jboss.org/)"/>
+ <attribute name="Implementation-Title" value="JBoss Remoting (Core)"/>
+ <attribute name="Implementation-URL" value="http://labs.jboss.org/jbossremoting/"/>
+ <attribute name="Implementation-Version" value="${version}"/>
+ <attribute name="Implementation-Vendor" value="JBoss, a division of Red Hat, Inc."/>
+ <attribute name="Implementation-Vendor-Id" value="http://www.jboss.org"/>
+ </manifest>
+ <zipfileset dir="core/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ <zipfileset dir="log-jboss/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ <zipfileset dir="version/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ </jar>
+ </target>
+
+ <target name="jrpp-jar" description="Build the JRPP JAR" depends="jrpp,mina-sasl,srp,version">
+ <delete file="jboss-remoting-jrpp.jar"/>
+ <jar jarfile="jboss-remoting-jrpp.jar">
+ <manifest>
+ <attribute name="Created-By" value="${java.vm.version} (${java.vm.vendor})"/>
+ <attribute name="Specification-Title" value="JBoss Remoting"/>
+ <attribute name="Specification-Version" value="${version}"/>
+ <attribute name="Specification-Vendor" value="JBoss (http://www.jboss.org/)"/>
+ <attribute name="Implementation-Title" value="JBoss Remoting (JRPP)"/>
+ <attribute name="Implementation-URL" value="http://labs.jboss.org/jbossremoting/"/>
+ <attribute name="Implementation-Version" value="${version}"/>
+ <attribute name="Implementation-Vendor" value="JBoss, a division of Red Hat, Inc."/>
+ <attribute name="Implementation-Vendor-Id" value="http://www.jboss.org"/>
+ </manifest>
+ <zipfileset dir="jrpp/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ <zipfileset dir="mina-sasl/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ <zipfileset dir="srp/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ </jar>
+ </target>
+
<target name="standalone-jar" description="Build the standalone JAR" depends="api,core,jrpp,log-jul,srp,standalone,util,version">
<delete file="jboss-remoting-standalone.jar"/>
<jar jarfile="jboss-remoting-standalone.jar">
@@ -1151,13 +1226,17 @@
<target name="clean-log" description="Clean all log targets" depends="log-jboss.clean,log-jul.clean"/>
+ <!-- JARs: These should be the third-to-last targets in the file -->
+
+ <target name="all-jars" description="Build all the JARs" depends="api-jar,core-jar,jrpp-jar,standalone-jar"/>
+
<!-- fetch: These should be the second-to-last targets in the file -->
<target name="all-fetch" description="Pre-fetch all external libraries" depends="lib.jboss-common-core,lib.jboss-common-logging-spi,lib.jbossmc-deployers-core-spi,lib.jbossmc-deployers-spi,lib.jbossmc-deployers-structure-spi,lib.jbossmc-kernel,lib.jbossmc-managed,lib.jbossxb,lib.mina,lib.servlet"/>
<!-- all: These should be the last targets in the file -->
- <target name="all" description="Build everything" depends="all-core,all-http,all-interceptors,all-jrpp,all-log"/>
+ <target name="all" description="Build everything" depends="all-core,all-http,all-interceptors,all-jrpp,all-log,all-jars"/>
<target name="clean" description="Clean out all build files" depends="clean-core,clean-http,clean-interceptors,clean-jrpp,clean-log"/>
16 years, 9 months
JBoss Remoting SVN: r3467 - in remoting3/trunk: core/src/main/java/org/jboss/cx/remoting/core and 9 other directories.
by jboss-remoting-commits@lists.jboss.org
Author: david.lloyd(a)jboss.com
Date: 2008-02-21 11:57:01 -0500 (Thu, 21 Feb 2008)
New Revision: 3467
Added:
remoting3/trunk/version/
remoting3/trunk/version/src/
remoting3/trunk/version/src/main/
remoting3/trunk/version/src/main/java/
remoting3/trunk/version/src/main/java/org/
remoting3/trunk/version/src/main/java/org/jboss/
remoting3/trunk/version/src/main/java/org/jboss/cx/
remoting3/trunk/version/src/main/java/org/jboss/cx/remoting/
remoting3/trunk/version/src/main/java/org/jboss/cx/remoting/version/
remoting3/trunk/version/src/main/java/org/jboss/cx/remoting/version/Version.java
Modified:
remoting3/trunk/build.xml
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java
Log:
Add standalone jar target
Modified: remoting3/trunk/build.xml
===================================================================
--- remoting3/trunk/build.xml 2008-02-21 16:12:31 UTC (rev 3466)
+++ remoting3/trunk/build.xml 2008-02-21 16:57:01 UTC (rev 3467)
@@ -247,6 +247,7 @@
<path refid="api.classpath"/>
<path refid="log-jul.classpath"/>
<path refid="util.classpath"/>
+ <path refid="version.classpath"/>
</classpath>
</javac>
<touch file="core/target/main/.lastcompile" verbose="false"/>
@@ -256,7 +257,7 @@
<delete dir="core/target"/>
</target>
- <target name="core" description="Build the core module" depends="api,log-jul,util,core.compile">
+ <target name="core" description="Build the core module" depends="api,log-jul,util,version,core.compile">
<path id="core.classpath">
<pathelement location="core/target/main/classes"/>
</path>
@@ -1038,6 +1039,85 @@
</path>
</target>
+ <!-- version module -->
+
+ <target name="version.compile.depcheck">
+ <mkdir dir="version/target/main"/>
+ <uptodate property="version.compile.uptodate" targetfile="version/target/main/.lastcompile">
+ <srcfiles dir="version/src/main/java">
+ <include name="**/"/>
+ <include name="**/*.java"/>
+ <exclude name="**/.*"/>
+ </srcfiles>
+ </uptodate>
+ </target>
+
+ <target name="version.compile" depends="version.compile.depcheck" unless="version.compile.uptodate">
+ <mkdir dir="version/target/main/classes"/>
+ <javac
+ source="${javac.source}"
+ target="${javac.target}"
+ srcdir="version/src/main/java"
+ destdir="version/target/main/classes"
+ debug="true">
+ <compilerarg value="-Xlint:unchecked"/>
+ </javac>
+ <touch file="version/target/main/.lastcompile" verbose="false"/>
+ </target>
+
+ <target name="version.clean">
+ <delete dir="version/target"/>
+ </target>
+
+ <target name="version" description="Build the version module" depends="version.compile">
+ <path id="version.classpath">
+ <pathelement location="version/target/main/classes"/>
+ </path>
+ <java classpathref="version.classpath" classname="org.jboss.cx.remoting.version.Version" outputproperty="version"/>
+ </target>
+
+ <!-- ============================================== -->
+ <!-- JARS - Keep in alpha order by jar name -->
+ <!-- ============================================== -->
+
+ <target name="standalone-jar" description="Build the standalone JAR" depends="api,core,jrpp,log-jul,srp,standalone,util,version">
+ <delete file="jboss-remoting-standalone.jar"/>
+ <jar jarfile="jboss-remoting-standalone.jar">
+ <manifest>
+ <attribute name="Created-By" value="${java.vm.version} (${java.vm.vendor})"/>
+ <attribute name="Specification-Title" value="JBoss Remoting"/>
+ <attribute name="Specification-Version" value="${version}"/>
+ <attribute name="Specification-Vendor" value="JBoss (http://www.jboss.org/)"/>
+ <attribute name="Implementation-Title" value="JBoss Remoting - Standalone Version"/>
+ <attribute name="Implementation-URL" value="http://labs.jboss.org/jbossremoting/"/>
+ <attribute name="Implementation-Version" value="${version}"/>
+ <attribute name="Implementation-Vendor" value="JBoss, a division of Red Hat, Inc."/>
+ <attribute name="Implementation-Vendor-Id" value="http://www.jboss.org"/>
+ </manifest>
+ <zipfileset dir="api/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ <zipfileset dir="core/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ <zipfileset dir="jrpp/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ <zipfileset dir="log-jul/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ <zipfileset dir="srp/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ <zipfileset dir="standalone/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ <zipfileset dir="util/target/main/classes">
+ <include name="**/*.class"/>
+ </zipfileset>
+ </jar>
+ </target>
+
<!-- Default targets - keep depends in alpha order by category name -->
<!-- These targets should explicitly list all modules, even if they will be built by other modules -->
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java 2008-02-21 16:12:31 UTC (rev 3466)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java 2008-02-21 16:57:01 UTC (rev 3467)
@@ -19,6 +19,8 @@
import org.jboss.cx.remoting.ServiceDeploymentSpec;
import org.jboss.cx.remoting.ServiceLocator;
import org.jboss.cx.remoting.Session;
+import org.jboss.cx.remoting.version.Version;
+import org.jboss.cx.remoting.log.Logger;
import org.jboss.cx.remoting.core.util.AtomicStateMachine;
import org.jboss.cx.remoting.core.util.AttributeMap;
import org.jboss.cx.remoting.core.util.CollectionUtil;
@@ -48,6 +50,10 @@
private final AtomicStateMachine<State> state = AtomicStateMachine.start(State.UP);
private final ExecutorService executor;
+ static {
+ Logger.getLogger("org.jboss.cx.remoting").info("JBoss Remoting version %s", Version.VERSION);
+ }
+
private enum State {
UP,
DOWN,
Property changes on: remoting3/trunk/version
___________________________________________________________________
Name: svn:ignore
+ *.iml
target
Added: remoting3/trunk/version/src/main/java/org/jboss/cx/remoting/version/Version.java
===================================================================
--- remoting3/trunk/version/src/main/java/org/jboss/cx/remoting/version/Version.java (rev 0)
+++ remoting3/trunk/version/src/main/java/org/jboss/cx/remoting/version/Version.java 2008-02-21 16:57:01 UTC (rev 3467)
@@ -0,0 +1,12 @@
+package org.jboss.cx.remoting.version;
+
+/**
+ *
+ */
+public final class Version {
+ public static final String VERSION = "3.0.0-M2";
+
+ public static void main(String[] args) {
+ System.out.println(VERSION);
+ }
+}
16 years, 9 months