Skip to content

Commit

Permalink
Merge pull request #34 from qtc-de/develop
Browse files Browse the repository at this point in the history
Resolve #33
  • Loading branch information
qtc-de authored Jul 23, 2022
2 parents 6ce2540 + 759570f commit 9d3984f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 21 deletions.
60 changes: 41 additions & 19 deletions plugins/GenericPrint.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
import java.util.Map;
import java.util.Map.Entry;

import de.qtc.rmg.internal.ExceptionHandler;
import de.qtc.rmg.io.Logger;
import de.qtc.rmg.utils.RMGUtils;
import de.qtc.rmg.utils.RemoteObjectWrapper;
import de.qtc.rmg.plugin.IResponseHandler;
import de.qtc.rmg.utils.ActivatableWrapper;
import de.qtc.rmg.utils.RemoteObjectWrapper;
import de.qtc.rmg.utils.UnicastWrapper;

/**
* GenericPrint is an rmg ResponseHandler plugin that attempts to print all incoming
Expand Down Expand Up @@ -115,31 +117,51 @@ public void handleArray(Object o)
public void handleRemote(Remote o)
{
try {
RemoteObjectWrapper liveRef = new RemoteObjectWrapper(o);
RemoteObjectWrapper objectWrapper = RemoteObjectWrapper.getInstance(o);

Logger.printlnYellow("Printing RemoteObject:");
Logger.increaseIndent();
if (objectWrapper instanceof UnicastWrapper)
{
UnicastWrapper wrapper = (UnicastWrapper)objectWrapper;

String csf = "default";
String ssf = "default";
String csf = "default";
String ssf = "default";

if(liveRef.csf != null)
csf = liveRef.csf.getClass().getName();
if(wrapper.csf != null)
csf = wrapper.csf.getClass().getName();

if(liveRef.ssf != null)
ssf = liveRef.ssf.getClass().getName();
if(wrapper.ssf != null)
ssf = wrapper.ssf.getClass().getName();

Logger.printlnMixedBlue("Remote Class:\t\t", liveRef.className);
Logger.printlnMixedBlue("Endpoint:\t\t", liveRef.getTarget());
Logger.printlnMixedBlue("ObjID:\t\t\t", liveRef.objID.toString());
Logger.printlnMixedBlue("ClientSocketFactory:\t", csf);
Logger.printlnMixedBlue("ServerSocketFactory:\t", ssf);
Logger.printlnYellow("Printing unicast RemoteObject:");
Logger.increaseIndent();
Logger.printlnMixedBlue("Remote Class:\t\t", wrapper.className);
Logger.printlnMixedBlue("Endpoint:\t\t", wrapper.getTarget());
Logger.printlnMixedBlue("ObjID:\t\t\t", wrapper.objID.toString());
Logger.printlnMixedBlue("ClientSocketFactory:\t", csf);
Logger.printlnMixedBlue("ServerSocketFactory:\t", ssf);
}

else if(objectWrapper instanceof ActivatableWrapper)
{
ActivatableWrapper wrapper = (ActivatableWrapper)objectWrapper;

Logger.printlnYellow("Printing activatable RemoteObject:");
Logger.increaseIndent();
Logger.printlnMixedBlue("Remote Class:\t\t", wrapper.className);
Logger.printlnMixedBlue("Activator:\t\t", wrapper.getActivatorEndpoint());
Logger.printlnMixedBlue("ActivationID:\t\t", wrapper.activationUID.toString());
}

else
Logger.eprintlnYellow("Unsupported object type.");

Logger.decreaseIndent();

} catch (Exception e) {
Logger.eprintlnMixedYellow("Caught", e.getClass().getName(), "when constructing AccesibleLiveRef.");
RMGUtils.exit();
ExceptionHandler.unexpectedException(e, "constructing", "RemoteObjectWrapper", true);
}

finally {
Logger.decreaseIndent();
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/de/qtc/rmg/utils/ActivatableWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class ActivatableWrapper extends RemoteObjectWrapper

/**
* ActivatableWrapper is constructed from a remote object. It expects the underlying RemoteRef to
* be an ActivatableRef and attempts tp extract the ActivationID from it. The ActivationID is then
* be an ActivatableRef and attempts to extract the ActivationID from it. The ActivationID is then
* used to obtain the actual UID used for activation and the reference to the Activator.
*
* To provide compatibility to newer Java versions, the constructor uses reflection to perform operations
Expand Down Expand Up @@ -197,4 +197,4 @@ public Remote getRemote()
return null;
}
}
}
}

0 comments on commit 9d3984f

Please sign in to comment.