[jboss-osgi-commits] JBoss-OSGI SVN: r91205 - in projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky: runtime/osgi and 1 other directory.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Tue Jul 14 08:12:01 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-07-14 08:12:00 -0400 (Tue, 14 Jul 2009)
New Revision: 91205
Modified:
projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java
projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java
projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnectorMBean.java
projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/SocketConnector.java
Log:
Restore stream access via ConnectorMBean
Modified: projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java 2009-07-14 11:37:53 UTC (rev 91204)
+++ projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java 2009-07-14 12:12:00 UTC (rev 91205)
@@ -23,6 +23,12 @@
// $Id$
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -69,4 +75,45 @@
}
throw new IllegalStateException("Cannot find listener to handle: " + testClass + ", we have " + listeners);
}
+
+ protected InputStream process(InputStream reqStream)
+ {
+ Request request = null;
+ Response response = null;
+ try
+ {
+ // Unmarshall the Request
+ ObjectInputStream ois = new ObjectInputStream(reqStream);
+ request = (Request)ois.readObject();
+
+ // Field the request through the abstract connector
+ response = process(request);
+ }
+ catch (Exception ex)
+ {
+ response = new BasicResponse();
+ BasicFailure failure = new BasicFailure(ex.getMessage(), ex);
+ if (request != null)
+ {
+ failure.setClassName(request.getClassName());
+ failure.setMethodName(request.getMethodName());
+ }
+ response.addFailure(failure);
+ }
+
+ // Marshall the Response
+ try
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(response);
+ oos.close();
+
+ return new ByteArrayInputStream(baos.toByteArray());
+ }
+ catch (IOException ex)
+ {
+ throw new IllegalStateException("Cannot marshall response", ex);
+ }
+ }
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java 2009-07-14 11:37:53 UTC (rev 91204)
+++ projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java 2009-07-14 12:12:00 UTC (rev 91205)
@@ -23,6 +23,7 @@
// $Id$
+import java.io.InputStream;
import java.util.Properties;
import javax.management.MBeanServer;
@@ -96,4 +97,10 @@
server.unregisterMBean(OBJECT_NAME);
}
}
+
+ @Override
+ public InputStream process(InputStream reqStream)
+ {
+ return super.process(reqStream);
+ }
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnectorMBean.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnectorMBean.java 2009-07-14 11:37:53 UTC (rev 91204)
+++ projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnectorMBean.java 2009-07-14 12:12:00 UTC (rev 91205)
@@ -23,8 +23,11 @@
//$Id$
-import org.jboss.osgi.husky.runtime.PackageListener;
+import java.io.InputStream;
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+
/**
* The management interface of the {@link JMXConnector}.
*
@@ -33,8 +36,12 @@
*/
public interface JMXConnectorMBean
{
- /*
- * Add a {@link PackageListener} to this connector
+ /**
+ * Consumes the serialized version of an {@link Request} and
+ * return the the {@link Response} from the test run
+ *
+ * @param reqStream the input stream to read the {@link Request} from
+ * @return the input stream to read the {@link Response} from
*/
- void addPackageListener(PackageListener listener);
+ InputStream process(InputStream reqStream);
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/SocketConnector.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/SocketConnector.java 2009-07-14 11:37:53 UTC (rev 91204)
+++ projects/jboss-osgi/trunk/reactor/bundles/husky/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/SocketConnector.java 2009-07-14 12:12:00 UTC (rev 91205)
@@ -23,22 +23,14 @@
// $Id$
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Properties;
-import org.jboss.osgi.husky.Request;
-import org.jboss.osgi.husky.Response;
import org.jboss.osgi.husky.internal.AbstractConnector;
-import org.jboss.osgi.husky.internal.BasicFailure;
-import org.jboss.osgi.husky.internal.BasicResponse;
import org.jboss.osgi.husky.internal.LogServiceTracker;
import org.jboss.osgi.husky.internal.Util;
import org.jboss.osgi.husky.runtime.Connector;
@@ -118,47 +110,6 @@
listenerThread.stopListener();
}
- private InputStream process(InputStream reqStream)
- {
- Request request = null;
- Response response = null;
- try
- {
- // Unmarshall the Request
- ObjectInputStream ois = new ObjectInputStream(reqStream);
- request = (Request)ois.readObject();
-
- // Field the request through the abstract connector
- response = process(request);
- }
- catch (Exception ex)
- {
- response = new BasicResponse();
- BasicFailure failure = new BasicFailure(ex.getMessage(), ex);
- if (request != null)
- {
- failure.setClassName(request.getClassName());
- failure.setMethodName(request.getMethodName());
- }
- response.addFailure(failure);
- }
-
- // Marshall the Response
- try
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(response);
- oos.close();
-
- return new ByteArrayInputStream(baos.toByteArray());
- }
- catch (IOException ex)
- {
- throw new IllegalStateException("Cannot marshall response", ex);
- }
- }
-
class ListenerThread extends Thread
{
private ServerSocket serverSocket;
More information about the jboss-osgi-commits
mailing list