User: pra
Date: 02/03/06 09:27:49
Modified: src/main/org/jboss/mq/il/oil OILClientIL.java
OILClientILService.java OILConstants.java
OILServerIL.java OILServerILService.java
Log:
Commit of JBossMQ new JAAS based security architecture
Revision Changes Path
1.8 +4 -2 jbossmq/src/main/org/jboss/mq/il/oil/OILClientIL.java
Index: OILClientIL.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILClientIL.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- OILClientIL.java 8 Feb 2002 01:06:19 -0000 1.7
+++ OILClientIL.java 6 Mar 2002 17:27:49 -0000 1.8
@@ -31,7 +31,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
* @created August 16, 2001
*/
public final class OILClientIL
@@ -60,6 +60,8 @@
public synchronized void close()
throws Exception
{
+ if ( log.isTraceEnabled())
+ log.trace("Closing OILClientIL");
checkSocket();
out.writeByte(OILConstants.CLOSE);
waitAnswer();
@@ -128,7 +130,7 @@
messages[i].writeExternal(out);
}
if( trace )
- log.trace("Waiting for awnser");
+ log.trace("Waiting for anwser");
waitAnswer();
if( trace )
log.trace("Done");
1.8 +22 -8 jbossmq/src/main/org/jboss/mq/il/oil/OILClientILService.java
Index: OILClientILService.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILClientILService.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- OILClientILService.java 11 Jan 2002 20:18:57 -0000 1.7
+++ OILClientILService.java 6 Mar 2002 17:27:49 -0000 1.8
@@ -30,7 +30,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
* @created August 16, 2001
*/
public final class OILClientILService
@@ -58,6 +58,12 @@
private ServerSocket serverSocket;
/**
+ * Number of OIL Worker threads started.
+ */
+ private static int threadNumber= 0;
+
+
+ /**
* getClientIL method comment.
*
* @return The ClientIL value
@@ -93,11 +99,12 @@
ObjectOutputStream out = null;
ObjectInputStream in = null;
socket = null;
+ int serverPort = serverSocket.getLocalPort();
try
{
if( cat.isDebugEnabled() )
- cat.debug("Waiting for the server to connect to me");
+ cat.debug("Waiting for the server to connect to me on port "
+serverSocket.getLocalPort());
// We may close() before we get a connection so we need to
// periodicaly check to see if we were !running.
@@ -162,8 +169,6 @@
{
try
{
- if( cat.isTraceEnabled() )
- cat.trace("Waiting for message from server.");
code = in.readByte();
}
catch (java.io.InterruptedIOException e)
@@ -172,6 +177,7 @@
}
catch (IOException e)
{
+ // Server has gone, bye, bye
break;
}
@@ -216,7 +222,7 @@
}
catch (IOException e)
{
- connection.asynchFailure("Connection failure", e);
+ connection.asynchFailure("Connection failure(1)", e);
break; // exit the loop
}
}
@@ -239,7 +245,7 @@
}
catch (IOException e2)
{
- connection.asynchFailure("Connection failure", e2);
+ connection.asynchFailure("Connection failure(2)", e2);
break;
}
}
@@ -249,7 +255,7 @@
//
try
{
- cat.debug("Closing receiver connections.");
+ cat.debug("Closing receiver connections on port: " + serverPort);
out.close();
in.close();
socket.close();
@@ -275,7 +281,7 @@
{
running = true;
- worker = new Thread(connection.threadGroup, this, "OILClientILService");
+ worker = new Thread(connection.threadGroup, this, "OILClientILService-"
+threadNumber++);
worker.setDaemon(true);
worker.start();
@@ -287,8 +293,16 @@
public void stop()
throws java.lang.Exception
{
+ cat.trace("Stop called on OILClientService");
running = false;
worker.interrupt();
}
}
// vim:expandtab:tabstop=3:shiftwidth=3
+
+
+
+
+
+
+
1.2 +2 -1 jbossmq/src/main/org/jboss/mq/il/oil/OILConstants.java
Index: OILConstants.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILConstants.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- OILConstants.java 11 Jan 2002 20:18:57 -0000 1.1
+++ OILConstants.java 6 Mar 2002 17:27:49 -0000 1.2
@@ -10,7 +10,7 @@
*
*
* @author Brian Weaver ([EMAIL PROTECTED])
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
* @created January 10, 2002
*/
final class OILConstants
@@ -48,6 +48,7 @@
final static int PING = 27;
final static int PONG = 28;
final static int CLOSE = 29;
+ final static int AUTHENTICATE = 30;
}
/*
vim:tabstop=3:expandtab:shiftwidth=3
1.8 +20 -4 jbossmq/src/main/org/jboss/mq/il/oil/OILServerIL.java
Index: OILServerIL.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILServerIL.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- OILServerIL.java 2 Feb 2002 04:02:23 -0000 1.7
+++ OILServerIL.java 6 Mar 2002 17:27:49 -0000 1.8
@@ -29,15 +29,13 @@
import org.jboss.mq.TransactionRequest;
import org.jboss.mq.il.ServerIL;
-import org.jboss.mq.il.uil.multiplexor.SocketMultiplexor;
-import org.jboss.mq.server.JMSServer;
/**
* The JVM implementation of the ServerIL object
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @author Norbert Lataille ([EMAIL PROTECTED])
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
* @created August 16, 2001
*/
public final class OILServerIL
@@ -250,6 +248,24 @@
/**
* #Description of the Method
*
+ * @param userName Description of Parameter
+ * @param password Description of Parameter
+ * @return Description of the Returned Value
+ * @exception JMSException Description of Exception
+ * @exception Exception Description of Exception
+ */
+ public synchronized String authenticate(String userName, String password)
+ throws JMSException, Exception
+ {
+ checkConnection();
+ out.writeByte(OILConstants.AUTHENTICATE);
+ out.writeObject(userName);
+ out.writeObject(password);
+ return (String)waitAnswer();
+ }
+ /**
+ * #Description of the Method
+ *
* @return Description of the Returned Value
* @exception CloneNotSupportedException Description of Exception
*/
@@ -348,7 +364,7 @@
* @exception JMSException Description of Exception
* @exception Exception Description of Exception
*/
- public synchronized void destroySubscription(DurableSubscriptionID id)
+ public synchronized void destroySubscription(ConnectionToken
dc,DurableSubscriptionID id)
throws JMSException, Exception
{
checkConnection();
1.20 +27 -13 jbossmq/src/main/org/jboss/mq/il/oil/OILServerILService.java
Index: OILServerILService.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILServerILService.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- OILServerILService.java 17 Feb 2002 17:50:44 -0000 1.19
+++ OILServerILService.java 6 Mar 2002 17:27:49 -0000 1.20
@@ -38,15 +38,16 @@
import org.jboss.mq.il.ServerIL;
import org.jboss.mq.il.ServerILJMXService;
import org.jboss.mq.il.ServerILFactory;
-import org.jboss.mq.server.JMSServer;
+import org.jboss.mq.server.JMSServerInvoker;
import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.logging.Logger;
/**
* Implements the ServerILJMXService which is used to manage the JVM IL.
*
* @author Hiram Chirino ([EMAIL PROTECTED])
- * @version $Revision: 1.19 $
+ * @version $Revision: 1.20 $
*/
public final class OILServerILService
extends org.jboss.mq.il.ServerILJMXService
@@ -63,8 +64,8 @@
/**
* The JMS server where requests are forwarded to.
*/
- private static JMSServer server;
-
+ //private static JMSServerInvoker server;
+ private JMSServerInvoker server;
/**
* The listening socket that receives incomming connections
* for servicing.
@@ -129,6 +130,13 @@
private ObjectInputStream in;
/**
+ * Clients logger instance.
+ *
+ * I get methodNotFound errors on the global log object.
+ */
+ private Logger log;
+
+ /**
* Allocates a new runnable instance to process requests from
* the server's client and pass them to the JMS server. The
* passed socket is used for all communications between the
@@ -142,6 +150,7 @@
Client(Socket s)
throws IOException
{
+ log = Logger.getLogger(getClass());
this.sock = s;
this.out= new ObjectOutputStream(new
BufferedOutputStream(this.sock.getOutputStream()));
this.out.flush();
@@ -198,6 +207,7 @@
switch (code)
{
case OILConstants.SET_SPY_DISTRIBUTED_CONNECTION:
+ // assert connectionToken == null
connectionToken = (ConnectionToken)in.readObject();
break;
@@ -216,7 +226,10 @@
break;
case OILConstants.CHECK_ID:
- server.checkID((String)in.readObject());
+ String ID = (String)in.readObject();
+ server.checkID(ID);
+ if (connectionToken != null)
+ connectionToken.setClientID(ID);
break;
case OILConstants.CONNECTION_CLOSING:
@@ -238,6 +251,8 @@
case OILConstants.GET_ID:
result = server.getID();
+ if (connectionToken != null)
+ connectionToken.setClientID((String)result);
break;
case OILConstants.GET_TEMPORARY_QUEUE:
@@ -271,7 +286,7 @@
break;
case OILConstants.DESTROY_SUBSCRIPTION:
-
server.destroySubscription((DurableSubscriptionID)in.readObject());
+
server.destroySubscription(connectionToken,(DurableSubscriptionID)in.readObject());
break;
case OILConstants.CHECK_USER:
@@ -282,6 +297,10 @@
server.ping(connectionToken, in.readLong());
break;
+ case OILConstants.AUTHENTICATE:
+ result = server.authenticate((String)in.readObject(),
(String)in.readObject());
+ break;
+
default:
throw new RemoteException("Bad method code !");
}
@@ -322,12 +341,7 @@
if (closed)
break;
-
- //DEBUG-pra
- e.printStackTrace();
- System.out.println("Logger: " + log.getClass());
-
- log.info("Client request resulted in a server exception: ", e);
+ log.warn("Client request resulted in a server exception: ", e);
try
{
@@ -516,7 +530,7 @@
if(log.isInfoEnabled())
log.info("JBossMQ OIL service available at : " + socketAddress + ":" +
serverSocket.getLocalPort());
- new Thread(server.threadGroup, this, "OIL Worker Server").start();
+ new Thread(server.getThreadGroup(), this, "OIL Worker Server").start();
/* We need to check the socketAddress against "0.0.0.0/0.0.0.0"
because this is not a valid address on Win32 while it is for
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development