You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(7) |
Jul
(26) |
Aug
(85) |
Sep
(141) |
Oct
(85) |
Nov
(60) |
Dec
(29) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(38) |
Feb
(78) |
Mar
(10) |
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <tre...@us...> - 2007-11-20 20:28:36
|
Revision: 593
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=593&view=rev
Author: trevorolio
Date: 2007-11-20 12:28:39 -0800 (Tue, 20 Nov 2007)
Log Message:
-----------
Improve the test applet to avoid false negatives for Java3D on Vista Home.
Modified Paths:
--------------
maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/Java3DTester.java
maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/RenderingTest.java
Modified: maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/Java3DTester.java
===================================================================
--- maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/Java3DTester.java 2007-11-19 20:44:43 UTC (rev 592)
+++ maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/Java3DTester.java 2007-11-20 20:28:39 UTC (rev 593)
@@ -4,7 +4,6 @@
import java.awt.BorderLayout;
import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsEnvironment;
import java.awt.Panel;
import javax.media.j3d.BranchGroup;
@@ -17,7 +16,10 @@
public boolean canStartJava3D() {
try {
setLayout(new BorderLayout());
- GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
+ GraphicsConfiguration config = RenderingTest.get3DGraphicsConfiguration();
+ if(config == null){
+ return false;
+ }
Canvas3D canvas3D = new Canvas3D(config);
add("Center", canvas3D);
BranchGroup scene = new BranchGroup();
Modified: maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/RenderingTest.java
===================================================================
--- maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/RenderingTest.java 2007-11-19 20:44:43 UTC (rev 592)
+++ maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/RenderingTest.java 2007-11-20 20:28:39 UTC (rev 593)
@@ -89,7 +89,7 @@
universe.getViewingPlatform().setNominalViewingTransform();
}
- private static GraphicsConfiguration get3DGraphicsConfiguration() {
+ public static GraphicsConfiguration get3DGraphicsConfiguration() {
GraphicsConfigTemplate3D configTemplate = new GraphicsConfigTemplate3D();
configTemplate.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
configTemplate.setDoubleBuffer(GraphicsConfigTemplate.PREFERRED);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-19 20:44:45
|
Revision: 592
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=592&view=rev
Author: trevorolio
Date: 2007-11-19 12:44:43 -0800 (Mon, 19 Nov 2007)
Log Message:
-----------
A couple of tweaks:
Caused Log to init at class initialization instead of first log (which had concurrency errors).
CometProto no longer throws null pointer exceptions during shutdown if the wrapper is already null (not thread safe, though).
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometProto.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/Log.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometProto.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometProto.java 2007-11-19 19:44:11 UTC (rev 591)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometProto.java 2007-11-19 20:44:43 UTC (rev 592)
@@ -8,19 +8,25 @@
public class CometProto implements AsyncProto {
private Writer writer;
+
private LineOrientedCRLFSocket input;
+
private Locator local;
+
private Locator remote;
+
private boolean needsChunking;
- StringBuffer buffer=new StringBuffer();
-
+
+ StringBuffer buffer = new StringBuffer();
+
public CometProto(Writer writer, InputStream input, Locator remote, Locator local, boolean needsChunking) {
- this.writer=writer;
- this.input=new LineOrientedCRLFSocket(input);
- this.local=local;
- this.remote=remote;
- this.needsChunking=needsChunking;
+ this.writer = writer;
+ this.input = new LineOrientedCRLFSocket(input);
+ this.local = local;
+ this.remote = remote;
+ this.needsChunking = needsChunking;
}
+
public Locator getLocalLocator() {
return local;
}
@@ -34,49 +40,49 @@
}
public void prepareOutput() throws IOException {
- //no effect in comment
+ //no effect in comment
}
public String readLine() throws IOException {
- if (input==null) {
+ if (input == null) {
throw new IOException("Can't read on a stream that is already closed [readLine].");
}
- String chunkLine=input.waitForNextLine();
- String dataLine=input.waitForNextLine();
-
+ String chunkLine = input.waitForNextLine();
+ String dataLine = input.waitForNextLine();
+
if (chunkLine.equals("0")) {
throw new NegativeReadValueException("Read EOC from server! Closing!");
}
-
+
try {
- int len=Integer.parseInt(chunkLine,16);
- if (len!=dataLine.length()) {
- Log.error("Whoa! Chunk wasn't the size we expected:"+chunkLine+"->"+dataLine);
+ int len = Integer.parseInt(chunkLine, 16);
+ if (len != dataLine.length()) {
+ Log.error("Whoa! Chunk wasn't the size we expected:" + chunkLine + "->" + dataLine);
}
} catch (NumberFormatException e) {
- Log.error("Whoa! Chunk line wasn't well formed:"+chunkLine);
+ Log.error("Whoa! Chunk line wasn't well formed:" + chunkLine);
}
-
+
buffer.append(dataLine);
return CometClient.pullOutNextMessage(buffer);
}
-/* public String readString(int length) throws IOException {
- throw new IOException("Not implemented for this protocol");
- if (input==null) {
- throw new IOException("Can't read on a stream that is already closed [readString].");
- }
- String next=input.waitForNextLine();
- if (next.length()!=length) {
- throw new IOException("We are out of sync with the protocol!");
- }
- return next;
-
- }*/
+ /* public String readString(int length) throws IOException {
+ throw new IOException("Not implemented for this protocol");
+ if (input==null) {
+ throw new IOException("Can't read on a stream that is already closed [readString].");
+ }
+ String next=input.waitForNextLine();
+ if (next.length()!=length) {
+ throw new IOException("We are out of sync with the protocol!");
+ }
+ return next;
+
+ }*/
public void sendMessage(String command, String message) throws IOException {
- String bunch=command+"$"+message;
- if (writer==null) {
+ String bunch = command + "$" + message;
+ if (writer == null) {
throw new IOException("Can't write on a stream that is already closed [sendMessage].");
}
if (needsChunking) {
@@ -90,28 +96,28 @@
}
}
}
-
+
public void shutdown() {
Log.info("Shutting down Comet Proto, flushing...");
- if (writer!=null) {
+ if (writer != null) {
try {
writer.flush();
} catch (IOException e) {
- Log.error("Problem attempting to flush comet proto buffers:"+e.getMessage());
+ Log.error("Problem attempting to flush comet proto buffers:" + e.getMessage());
}
- }
- //again, a horrible modularity break: we *know* that needs chunking implies we are on the
- //client side
- if (needsChunking) {
- try {
- Log.info("Closing client-side connection to server since we are shutting down.");
- writer.close();
- } catch (IOException e) {
- Log.error("Unable to close connection to server:"+e.getMessage());
+ //again, a horrible modularity break: we *know* that needs chunking implies we are on the
+ //client side
+ if (needsChunking) {
+ try {
+ Log.info("Closing client-side connection to server since we are shutting down.");
+ writer.close();
+ } catch (IOException e) {
+ Log.error("Unable to close connection to server:" + e.getMessage());
+ }
}
}
- input=null;
- writer=null;
+ input = null;
+ writer = null;
}
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/Log.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/Log.java 2007-11-19 19:44:11 UTC (rev 591)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/Log.java 2007-11-19 20:44:43 UTC (rev 592)
@@ -66,6 +66,11 @@
SpaceEvent.THING_START_MOTION_EVENT,
SpaceEvent.SHAPE_START_MOTION_EVENT
};
+
+ static {
+ faultInLogger();
+ }
+
public static void faultInLogger() {
try {
if (faultedInAlready) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-11-19 19:44:08
|
Revision: 591
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=591&view=rev
Author: iansmith
Date: 2007-11-19 11:44:11 -0800 (Mon, 19 Nov 2007)
Log Message:
-----------
Added better debug info during shutdown, added a flush that may solve the problem of zombie avatars on EC2.
Added support for an "out of service" filter, but it's not enabled yet.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/SenderQueue.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/TCPChannel.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometClient.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometProto.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/Log.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SimMessageHandler.java
maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/ViewerApplet.java
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/OutOfServiceFilter.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java 2007-11-19 14:41:43 UTC (rev 590)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java 2007-11-19 19:44:11 UTC (rev 591)
@@ -692,8 +692,11 @@
}
public void cleanup() {
+ Log.info("About to try to clean up the message channel object");
messageChannel.cleanup();
+ Log.info("Clearing all waiting messages becuse we are doing cleanup:"+waitingMessages.size());
waitingMessages.clear();
+ Log.info("Done cleaning up SpaceClient.Messenger");
}
public void heartbeat() throws IOException {
@@ -749,13 +752,18 @@
public void cleanup() {
cleanedUp = true;
try {
+ Log.info("In space client cleanup, about to send logout message:"+accountDoc.getUsername());
messageChannel.sendMessage(new Message(messageChannel.getLocalLocator(), messageChannel.getRemoteLocator(), space.getSpaceID(), new PayloadFactory.LogoutPayload(accountDoc.getUsername())));
+ Log.info("Success sending logout message");
} catch (Exception e) {
+ Log.error("Problem sending logout message:"+e.getMessage());
}
if (heartbeatTimer!=null) { //there is a race condition at startup that makes this necessary
heartbeatTimer.cancel();
}
+ Log.info("Cleaning up messenger in spaceclient...");
messenger.cleanup();
+ Log.info("Done with all spaceclient cleanup.");
}
public InputStream getPageContentStream(long thingID, long pageID) {
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/SenderQueue.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/SenderQueue.java 2007-11-19 14:41:43 UTC (rev 590)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/SenderQueue.java 2007-11-19 19:44:11 UTC (rev 591)
@@ -47,8 +47,10 @@
public void cleanup() {
cleaned = true;
+ Log.info("About to shut down the client proto of the sender queue...");
clientProto.shutdown();
if (messageQueue != null) {
+ Log.info("About to close the message queue associated with the SenderQueue");
messageQueue.close();
}
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/TCPChannel.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/TCPChannel.java 2007-11-19 14:41:43 UTC (rev 590)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/TCPChannel.java 2007-11-19 19:44:11 UTC (rev 591)
@@ -91,19 +91,23 @@
public void cleanup() {
//cleaned = true;
try {
+ Log.info("Cleaning up the TCP channel "+getLocalLocator());
if (readerThread!=null) {
+ Log.info("Reader thread about to be cleaned up...");
readerThread.cleanup();
}
} catch (Exception e) {
- Log.info("TCPChannel: Trying to cleanup to readerThread:"+(e.getClass().getName()),e);
+ Log.error("TCPChannel: Trying to cleanup to readerThread:"+(e.getClass().getName()),e);
}
try {
if (senderQueue!=null) {
+ Log.info("Sender queue about to be cleaned up...");
senderQueue.cleanup();
}
} catch (Exception e) {
- Log.info("TCPChannel: Trying to cleanup to senderQueue:"+(e.getClass().getName()),e);
+ Log.error("TCPChannel: Trying to cleanup to senderQueue:"+(e.getClass().getName()),e);
}
+ Log.info("About to tell listener that the TCP channel is now closed.");
listener.channelClosed(this);
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometClient.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometClient.java 2007-11-19 14:41:43 UTC (rev 590)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometClient.java 2007-11-19 19:44:11 UTC (rev 591)
@@ -136,6 +136,5 @@
}
}
-
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometProto.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometProto.java 2007-11-19 14:41:43 UTC (rev 590)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometProto.java 2007-11-19 19:44:11 UTC (rev 591)
@@ -92,11 +92,24 @@
}
public void shutdown() {
- //this isn't really what we'd like to do, but we would need a bunch of machinery to know
- //if it was safe to call "close" b/c that would break the comet servlet which reuses
- //these objects... the client side probably *should* call close.
-
- //how should we synchronize this?
+ Log.info("Shutting down Comet Proto, flushing...");
+ if (writer!=null) {
+ try {
+ writer.flush();
+ } catch (IOException e) {
+ Log.error("Problem attempting to flush comet proto buffers:"+e.getMessage());
+ }
+ }
+ //again, a horrible modularity break: we *know* that needs chunking implies we are on the
+ //client side
+ if (needsChunking) {
+ try {
+ Log.info("Closing client-side connection to server since we are shutting down.");
+ writer.close();
+ } catch (IOException e) {
+ Log.error("Unable to close connection to server:"+e.getMessage());
+ }
+ }
input=null;
writer=null;
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/Log.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/Log.java 2007-11-19 14:41:43 UTC (rev 590)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/Log.java 2007-11-19 19:44:11 UTC (rev 591)
@@ -118,9 +118,11 @@
}
private static void useLog4jOrSimple(Object msg,Method method) {
+ faultInLogger();
useLog4jOrSimple(msg, null,method);
}
private static void useLog4jOrSimple(Object msg, Object throwable, Method method) {
+ faultInLogger();
useLog4jOrSimple(msg, reallyALogger, throwable,method);
}
@@ -150,6 +152,7 @@
}
public static void info(Object msg, Throwable t) {
+ faultInLogger();
useLog4jOrSimple(msg, t, m_info_throw);
}
@@ -164,6 +167,7 @@
}
public static void error(Object msg, Throwable t) {
+ faultInLogger();
useLog4jOrSimple(msg, t, m_error_throw);
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SimMessageHandler.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SimMessageHandler.java 2007-11-19 14:41:43 UTC (rev 590)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SimMessageHandler.java 2007-11-19 19:44:11 UTC (rev 591)
@@ -85,7 +85,9 @@
} else if (message.getPayload() instanceof PayloadFactory.LoggedOutPayload) {
PayloadFactory.LoggedOutPayload payload = (PayloadFactory.LoggedOutPayload) message.getPayload();
+ Log.info("Client "+payload.getUsername()+" sent logged out!");
spaceSim.userLoggedOut(payload.getUsername());
+ Log.info("Sim finished telling the spacesim about the logout.");
} else {
Log.error("Sim received unknown payload in this message: " + message);
}
Added: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/OutOfServiceFilter.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/OutOfServiceFilter.java (rev 0)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/OutOfServiceFilter.java 2007-11-19 19:44:11 UTC (rev 591)
@@ -0,0 +1,32 @@
+package com.ogoglio.site;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+public class OutOfServiceFilter implements Filter {
+
+ private long lastTimeCheck=0L;
+ private static final long FREQUENCY_IN_MS= 15000;
+
+ public void destroy() {
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+ long now=System.currentTimeMillis();
+ long diff=now - lastTimeCheck;
+ if (diff<FREQUENCY_IN_MS) {
+ chain.doFilter(request, response);
+ }
+ lastTimeCheck=now;
+ }
+
+ public void init(FilterConfig config) throws ServletException {
+ }
+
+}
Modified: maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/ViewerApplet.java
===================================================================
--- maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/ViewerApplet.java 2007-11-19 14:41:43 UTC (rev 590)
+++ maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/ViewerApplet.java 2007-11-19 19:44:11 UTC (rev 591)
@@ -134,31 +134,26 @@
}
public void destroy() {
- System.out.println("Destroying " + this + ": " + renderer + ", " + spaceClient);
+ performAShutdown("DESTROY");
+ }
+
+ private void performAShutdown(String method) {
+
+ Log.info("Destroying " + this + ": " + renderer + ", " + spaceClient+" b/c "+method+" called on applet");
if (renderer != null) {
renderer.stopRenderer();
}
if (spaceClient != null) {
+ Log.info("Trynig to run spaceclient cleanup.");
spaceClient.cleanup();
}
System.gc();
Runtime.getRuntime().runFinalization();
- System.out.println("Destroyed " + this + ": " + renderer + ", " + spaceClient);
+ Log.info("Destroyed " + this + ": " + renderer + ", " + spaceClient);
}
public void stop() {
- System.out.println("Stopping " + this + ": " + renderer + ", " + spaceClient);
- if (renderer != null) {
- renderer.stopRenderer();
- }
- if (spaceClient != null) {
- spaceClient.cleanup();
- }
- renderer = null;
- spaceClient = null;
- System.gc();
- Runtime.getRuntime().runFinalization();
- System.out.println("Stopped " + this + ": " + renderer + ", " + spaceClient);
+ performAShutdown("STOP");
}
public boolean completedInitialLoad() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-19 14:41:39
|
Revision: 590
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=590&view=rev
Author: trevorolio
Date: 2007-11-19 06:41:43 -0800 (Mon, 19 Nov 2007)
Log Message:
-----------
Added the capability for the login link can be set by spaceui embedding pages, so third party apps can control where login occurs and returnTo capabilities.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2007-11-18 16:05:25 UTC (rev 589)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2007-11-19 14:41:43 UTC (rev 590)
@@ -10,6 +10,7 @@
var movable = true;
var spaceDiv = null;
var chatHistory = null;
+var signinURL = "signin.html";
function handleSpaceDoc(xml){
if(xml == null){
@@ -28,7 +29,7 @@
enterAsGuest(null);
} else if(allowsGuests){
var guestMessage = "<div style='width: 100%; text-align: center; margin-top: 20px; font-weight: bold; color: #000;'>";
- guestMessage += "<a href='signin.html'>Click here to login</a>";
+ guestMessage += "<a href='" + signinURL + "'>Click here to login</a>";
guestMessage += "<h1>or</h1>";
guestMessage += "Enter a name: ";
guestMessage += "<form action='index.html' onsubmit='enterAsGuest(this.guestNameInput.value); return false;'>";
@@ -38,7 +39,7 @@
guestMessage += "</div>";
spaceDiv.innerHTML = guestMessage;
} else {
- spaceDiv.innerHTML = "You must <a href='signin.html'>sign in</a> to enter this space." ;
+ spaceDiv.innerHTML = "You must <a href='" + signinURL + "'>sign in</a> to enter this space." ;
}
} else {
enterTheSpace();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-18 16:05:20
|
Revision: 589
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=589&view=rev
Author: trevorolio
Date: 2007-11-18 08:05:25 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
Don't copy .svn directories from children of the main template directory.
Modified Paths:
--------------
maven/trunk/dev-plugins/src/main/java/com/ogoglio/plugin/StaticVelocityMojo.java
Modified: maven/trunk/dev-plugins/src/main/java/com/ogoglio/plugin/StaticVelocityMojo.java
===================================================================
--- maven/trunk/dev-plugins/src/main/java/com/ogoglio/plugin/StaticVelocityMojo.java 2007-11-17 16:36:42 UTC (rev 588)
+++ maven/trunk/dev-plugins/src/main/java/com/ogoglio/plugin/StaticVelocityMojo.java 2007-11-18 16:05:25 UTC (rev 589)
@@ -87,6 +87,9 @@
newDir.mkdir();
File[] children = source.listFiles();
for (int i = 0; i < children.length; i++) {
+ if(children[i].getName().equals(".svn")){
+ continue;
+ }
copy(children[i], newDir);
}
} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-17 16:36:37
|
Revision: 588
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=588&view=rev
Author: trevorolio
Date: 2007-11-17 08:36:42 -0800 (Sat, 17 Nov 2007)
Log Message:
-----------
Tweaked the Java3D setup to fall back to aliased, single buffered if the graphics board doesn't support it, which makes us run on lesser machines and also on the Parallels emulator on OS X Intel machines, making life much easier for Macish developers who want to maintain support WinIE.
Used this fact to fix IE+Java quirks (e.g. no String[] passing over liveconnect) so that the majority of browser installations can once again use Ogoglio.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java 2007-11-17 16:36:31 UTC (rev 587)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java 2007-11-17 16:36:42 UTC (rev 588)
@@ -126,7 +126,11 @@
setCapabilities(sceneRoot);
setCapabilities(usersGroup);
setCapabilities(worldGroup);
- canvas = new J3DCanvas(getGraphicsConfiguration(), offScreen);
+ GraphicsConfiguration graphicsConfig = getGraphicsConfiguration();
+ if (graphicsConfig == null) {
+ throw new IllegalStateException("Cannot create a 3D graphics configuration.");
+ }
+ canvas = new J3DCanvas(graphicsConfig, offScreen);
camera = new J3DCamera();
}
@@ -614,8 +618,8 @@
if (renderable.getUser().getSeat() == null) {
usersGroup.removeChild((J3DUserRenderable) renderable);
} else {
- J3DThingRenderable thingRenderable = (J3DThingRenderable)getThingRenderable(renderable.getUser().getSeat().getThingID());
- thingRenderable.removeSitter((J3DUserRenderable)renderable);
+ J3DThingRenderable thingRenderable = (J3DThingRenderable) getThingRenderable(renderable.getUser().getSeat().getThingID());
+ thingRenderable.removeSitter((J3DUserRenderable) renderable);
}
((J3DUserRenderable) renderable).cleanup();
}
@@ -679,7 +683,7 @@
}
BufferedImage customSkin = null;
- if(!offScreen && !user.getUsername().startsWith(WebConstants.GUEST_COOKIE_PREFIX)){
+ if (!offScreen && !user.getUsername().startsWith(WebConstants.GUEST_COOKIE_PREFIX)) {
customSkin = dataManager.getBodyTexture(user.getUsername(), bodyConfig.getBodyConfigurationID());
}
@@ -733,26 +737,19 @@
return renderable;
}
- private static GraphicsConfiguration getGraphicsConfiguration() {
+ public static GraphicsConfiguration getGraphicsConfiguration() {
GraphicsConfigTemplate3D configTemplate = new GraphicsConfigTemplate3D();
- GraphicsEnvironment graphicsEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
- GraphicsDevice device = graphicsEnv.getDefaultScreenDevice();
- configTemplate.setSceneAntialiasing(GraphicsConfigTemplate.REQUIRED);
- configTemplate.setDoubleBuffer(GraphicsConfigTemplate.REQUIRED);
- return device.getBestConfiguration(configTemplate);
- }
+ configTemplate.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
+ configTemplate.setDoubleBuffer(GraphicsConfigTemplate.PREFERRED);
+ GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(configTemplate);
+ if (config != null) {
+ return config;
+ }
- /*
- private void setBackgroundColor(Color4f color) {
- background.setColor(color.x, color.y, color.z);
+ GraphicsConfigTemplate3D weakConfigTemplate = new GraphicsConfigTemplate3D();
+ return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
}
- private void addDirectionalLight(Color3f color, Vector3f direction) {
- DirectionalLight lightD1 = new DirectionalLight(color, direction);
- lightD1.setInfluencingBounds(DEFAULT_SPACE_BOUNDS);
- sceneRoot.addChild(lightD1);
- }
- */
public Canvas getCanvas() {
return canvas;
}
@@ -795,10 +792,10 @@
return worldGroup;
}
- public J3DPicker getPicker(){
+ public J3DPicker getPicker() {
return picker;
}
-
+
private final static Vector3d DOWN_VEC = new Vector3d(0.0, -1.0, 0.0);
public class LandHeightMonitor {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-17 16:36:27
|
Revision: 587
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=587&view=rev
Author: trevorolio
Date: 2007-11-17 08:36:31 -0800 (Sat, 17 Nov 2007)
Log Message:
-----------
Tweaked the Java3D setup to fall back to aliased, single buffered if the graphics board doesn't support it, which makes us run on lesser machines and also on the Parallels emulator on OS X Intel machines, making life much easier for Macish developers who want to maintain support WinIE.
Used this fact to fix IE+Java quirks (e.g. no String[] passing over liveconnect) so that the majority of browser installations can once again use Ogoglio.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js 2007-11-17 16:36:17 UTC (rev 586)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.js 2007-11-17 16:36:31 UTC (rev 587)
@@ -64,43 +64,42 @@
}
bodyDataListXML = xml;
- setTimeout("awaitInitialLoad();", 1000);
+ awaitInitialLoad();
}
function awaitInitialLoad(){
var editor = document.getElementById("viewer");
- if(editor != null && editor.completedInitialLoad()){
+ if(typeof editor != "undefined" && editor != null && typeof editor.completedInitialLoad != "undefined" && editor.completedInitialLoad()){
initControls();
return;
}
- setTimeout("awaitInitialLoad();", 500);
+ window.setTimeout("awaitInitialLoad()", 1000);
}
function initControls(){
var editor = document.getElementById("viewer");
- var morphNames = editor.getMorphNames();
- var textureNames = editor.getBaseTextureNames();
var baseTextureName = bodyXML.getAttribute("basetexturename");
var defaultBodyID = +bodyXML.getAttribute("bodyconfigurationid");
var ownerUsername = bodyXML.getAttribute("ownerusername");
var morphHTML = "";
- for(var i = morphNames.length - 1; i >= 0; i--){
- var settingValue = editor.getMorphSetting(morphNames[i]);
- morphHTML += "<h4>" + morphNames[i] + ":</h4>";
- morphHTML += "<form onsubmit='changeMorph(\"" + morphNames[i] + "\", 0.1);return false;'><input type='submit' value='+' name='" + morphNames[i] + "'></form>";
- morphHTML += " <span id='" + morphNames[i] + " setting'>" + formatSettingValue(settingValue) + "</span> ";
- morphHTML += "<form onsubmit='changeMorph(\"" + morphNames[i] + "\", -0.1);return false;'><input type='submit' value='-' name='" + morphNames[i] + "'></form>";
+ for(var i = editor.getMorphCount() - 1; i >= 0; i--){
+ var morphName = editor.getMorphName(i);
+ var settingValue = editor.getMorphSetting(morphName);
+ morphHTML += "<h4>" + morphName + ":</h4>";
+ morphHTML += "<form onsubmit='changeMorph(\"" + morphName + "\", 0.1);return false;'><input type='submit' value='+' name='" + morphName + "'></form>";
+ morphHTML += " <span id='" + morphName + " setting'>" + formatSettingValue(settingValue) + "</span> ";
+ morphHTML += "<form onsubmit='changeMorph(\"" + morphName + "\", -0.1);return false;'><input type='submit' value='-' name='" + morphName + "'></form>";
}
morphControls.innerHTML = morphHTML;
- var animationNames = editor.getAnimationNames();
var animationHTML = "";
- for(var i = 0; i < animationNames.length; i++){
- if(animationNames[i] == "default"){
+ for(var i = 0; i < editor.getAnimationCount(); i++){
+ var name = editor.getAnimationName(i);
+ if(name == "default"){
continue;
}
- animationHTML += "<form onsubmit='playAnimation(\"" + animationNames[i] + "\"); return false;'><input type='submit' value='" + animationNames[i] + "'/></form>";
+ animationHTML += "<form onsubmit='playAnimation(\"" + name + "\"); return false;'><input type='submit' value='" + name + "'/></form>";
}
animationControls.innerHTML = animationHTML;
@@ -111,9 +110,10 @@
} else {
textureHTML += "<option value='Default'>Default</option>";
}
- for(var i=0; i < textureNames.length; i++){
- var selectedText = textureNames[i] == baseTextureName ? "selected='selected'" : "";
- textureHTML += "<option " + selectedText + " value='" + textureNames[i] + "'>" + textureNames[i] + "</option>";
+ for(var i=0; i < editor.getBaseTextureCount(); i++){
+ var name = editor.getBaseTextureName(i);
+ var selectedText = name == baseTextureName ? "selected='selected'" : "";
+ textureHTML += "<option " + selectedText + " value='" + name + "'>" + name + "</option>";
}
textureHTML += "</select></form>";
textureSelectionDiv.innerHTML = textureHTML;
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2007-11-17 16:36:17 UTC (rev 586)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js 2007-11-17 16:36:31 UTC (rev 587)
@@ -172,19 +172,25 @@
return text.substring(0, maxLength - eLength) + (elipseText == null ? "" : elipseText);
}
-function popUp(URL, decorated, width, height) {
- var id = "page-" + new Date().getTime();
+function popUp(url, decorated, width, height) {
+ var id = "page" + new Date().getTime();
var params = "";
if(typeof width != "undefined"){
- params += ",width=" + width;
+ params += "width=" + width;
}
if(typeof height != undefined){
- params += ",height=" + height;
+ if(params.length > 0){
+ params += ",";
+ }
+ params += "height=" + height;
}
- if(decorated == null || decorated == true){
- params += ',toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1';
+ if(typeof decorated == "undefined" || decorated == null || decorated == true){
+ if(params.length > 0){
+ params += ",";
+ }
+ params += 'toolbar=yes,scrollbars=yes,location=yes,statusbar=yes,menubar=yes,resizable';
}
- return window.open(URL, id, params);
+ return window.open(url, id, params);
}
function getLoginCookie(){
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2007-11-17 16:36:17 UTC (rev 586)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js 2007-11-17 16:36:31 UTC (rev 587)
@@ -119,7 +119,7 @@
displayName = displayName + "";
link = link + "";
- displayChatMessage("Link: <a onclick='popUp(this.href, true); return false;' href='" + link + "'>" + escapeHTML(displayName) + "</a>");
+ displayChatMessage("Link: <a onclick='popUp(\"" + link + "\", true); return false;' href='javascript:void(0);'>" + escapeHTML(displayName) + "</a>");
}
//called by the viewer applet
@@ -240,10 +240,11 @@
infoActionDiv.style.width = "100%";
infoActionDiv.style.textAlign = "right";
var closeActionAnchor = document.createElement("a");
- closeActionAnchor.setAttribute("href", "error.html");
- closeActionAnchor.setAttribute("onclick", "removeInfoPanel(" + id + "); return false;");
+ closeActionAnchor.setAttribute("href", "javascript:void(0);");
+ closeActionAnchor.setAttribute("onclick", "removeInfoPanel('" + id + "'); return false;");
closeActionAnchor.appendChild(document.createTextNode("close"));
infoActionDiv.appendChild(closeActionAnchor);
+ closeActionAnchor.parentNode.innerHTML = closeActionAnchor.parentNode.innerHTML; //THIS LOOKS POINTLESS, but it fixes IE's broken DOM for anchor onclick
infoPanelElement.appendChild(infoActionDiv);
var panelHTMLWrapper = document.createElement("iframe");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-17 16:36:15
|
Revision: 586
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=586&view=rev
Author: trevorolio
Date: 2007-11-17 08:36:17 -0800 (Sat, 17 Nov 2007)
Log Message:
-----------
Tweaked the Java3D setup to fall back to aliased, single buffered if the graphics board doesn't support it, which makes us run on lesser machines and also on the Parallels emulator on OS X Intel machines, making life much easier for Macish developers who want to maintain support WinIE.
Used this fact to fix IE+Java quirks (e.g. no String[] passing over liveconnect) so that the majority of browser installations can once again use Ogoglio.
Added Paths:
-----------
maven/trunk/ogoglio/src/main/resources/scripts/profileViewerApplet.sh
Added: maven/trunk/ogoglio/src/main/resources/scripts/profileViewerApplet.sh
===================================================================
--- maven/trunk/ogoglio/src/main/resources/scripts/profileViewerApplet.sh (rev 0)
+++ maven/trunk/ogoglio/src/main/resources/scripts/profileViewerApplet.sh 2007-11-17 16:36:17 UTC (rev 586)
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# assumes you are in the dir with this script
+# assumes everything is built in other directories
+
+_YH_="/Applications/YourKit Java Profiler 6.0.15.app"
+if [ `uname` = 'Linux' ] ; then
+ if [ "`uname -a | grep x86_64`" ] ; then
+ # Assume Linux AMD 64 has 64-bit Java
+ export LD_LIBRARY_PATH="$_YH_/bin/linux-amd64:$LD_LIBRARY_PATH"
+ else
+ # 32-bit Java
+ export LD_LIBRARY_PATH="$_YH_/bin/linux-x86-32:$LD_LIBRARY_PATH"
+ fi
+elif [ `uname` = 'Darwin' ] ; then
+ # Mac OS X
+ export DYLD_LIBRARY_PATH="$_YH_/bin/mac:$DYLD_LIBRARY_PATH"
+elif [ `uname` = 'SunOS' ] ; then
+ # Solaris, unlike Linux, probes entire LD_LIBRARY_PATH instead of stopping after first improper shared library
+ LD_LIBRARY_PATH="$_YH_/bin/solaris-sparc-32:$_YH_/bin/solaris-sparc-64:$_YH_/bin/solaris-x86-32:$_YH_/bin/solaris-x86-64:$LD_LIBRARY_PATH"
+ export LD_LIBRARY_PATH
+else
+ echo "YourKit Java Profiler 6.0.15: Unsupported platform: `uname`"
+ exit
+fi
+JAVA_TOOL_OPTIONS="-agentlib:yjpagent=sessionname=Viewer $JAVA_TOOL_OPTIONS"
+export JAVA_TOOL_OPTIONS
+
+INT_TEST=../../../../../ogoglio-integration-test/target/test-classes
+COMMON=../../../../../ogoglio-common/target/ogoglio-common-0.0.1-SNAPSHOT.jar
+LIVEC=~/.m2/repository/netscape/liveConnect/1.0/liveConnect-1.0.jar
+APPLET=../../../../../ogoglio-viewer-applet/target/ogoglio-viewer-applet-0.0.1-SNAPSHOT.jar
+
+SPACE=$1
+
+JAVA_OPTS="-Xrunyjpagent:sessionname=Viewer $JAVA_OPTS"
+
+java $JAVA_OPTS -Xmx512M -DAppletTestWindow.space=$SPACE -classpath $INT_TEST\:$COMMON\:$LIVEC\:$APPLET com.ogoglio.client.test.AppletTestWindow $2
Property changes on: maven/trunk/ogoglio/src/main/resources/scripts/profileViewerApplet.sh
___________________________________________________________________
Name: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-17 16:36:07
|
Revision: 585
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=585&view=rev
Author: trevorolio
Date: 2007-11-17 08:36:11 -0800 (Sat, 17 Nov 2007)
Log Message:
-----------
Tweaked the Java3D setup to fall back to aliased, single buffered if the graphics board doesn't support it, which makes us run on lesser machines and also on the Parallels emulator on OS X Intel machines, making life much easier for Macish developers who want to maintain support WinIE.
Used this fact to fix IE+Java quirks (e.g. no String[] passing over liveconnect) so that the majority of browser installations can once again use Ogoglio.
Modified Paths:
--------------
maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/ViewerApplet.java
Modified: maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/ViewerApplet.java
===================================================================
--- maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/ViewerApplet.java 2007-11-17 16:36:05 UTC (rev 584)
+++ maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/ViewerApplet.java 2007-11-17 16:36:11 UTC (rev 585)
@@ -207,7 +207,10 @@
}
win.call("focusCommandField", null); // Call a JavaScript function
} catch (Exception e) {
- e.printStackTrace();
+ if (!printedLiveConnectErrorMessage) {
+ Log.error("Could not use LiveConnect (ignoring future errors): " + e);
+ printedLiveConnectErrorMessage = true;
+ }
}
}
@@ -292,13 +295,16 @@
try {
JSObject win = JSObject.getWindow(this); // get handle to a window.
if (win == null) {
- Log.error("Could not do live connect. Check that mayscript is true in the applet tag.");
+ Log.warn("Could not do live connect. Check that mayscript is true in the applet tag.");
return;
}
String[] args = { message };
win.call("displayChatMessage", args); // Call a JavaScript function
} catch (Exception e) {
- e.printStackTrace();
+ if (!printedLiveConnectErrorMessage) {
+ Log.warn("Could not use LiveConnect (ignoring future errors): " + e);
+ printedLiveConnectErrorMessage = true;
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-17 16:36:02
|
Revision: 584
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=584&view=rev
Author: trevorolio
Date: 2007-11-17 08:36:05 -0800 (Sat, 17 Nov 2007)
Log Message:
-----------
Tweaked the Java3D setup to fall back to aliased, single buffered if the graphics board doesn't support it, which makes us run on lesser machines and also on the Parallels emulator on OS X Intel machines, making life much easier for Macish developers who want to maintain support WinIE.
Used this fact to fix IE+Java quirks (e.g. no String[] passing over liveconnect) so that the majority of browser installations can once again use Ogoglio.
Modified Paths:
--------------
maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
Modified: maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
===================================================================
--- maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-11-17 16:36:00 UTC (rev 583)
+++ maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-11-17 16:36:05 UTC (rev 584)
@@ -17,10 +17,6 @@
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
-import java.awt.GraphicsConfigTemplate;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
import java.awt.Panel;
import java.awt.image.BufferedImage;
import java.io.IOException;
@@ -34,7 +30,6 @@
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.DirectionalLight;
-import javax.media.j3d.GraphicsConfigTemplate3D;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.media.j3d.View;
@@ -59,6 +54,7 @@
import com.ogoglio.viewer.j3d.J3DCameraMotionBehavior;
import com.ogoglio.viewer.j3d.J3DCanvas;
import com.ogoglio.viewer.j3d.J3DDataManager;
+import com.ogoglio.viewer.j3d.J3DRenderer;
import com.ogoglio.viewer.j3d.J3DUniverse;
import com.ogoglio.viewer.j3d.J3DUserRenderable;
import com.ogoglio.viewer.j3d.body.MorphDeltaMap;
@@ -67,6 +63,10 @@
import com.ogoglio.xml.BodyConfigurationDocument;
import com.ogoglio.xml.BodyDataDocument;
+/*
+ * NOTE: String arrays don't function in LiveConnect in IE, so we use the getXXXCount and getXXX(index) pattern
+ */
+
public class BodyEditorApplet extends Applet {
private URI serviceURI = null;
@@ -120,6 +120,21 @@
bodyPanel.renderable.repaintSkinTexture();
}
+ public int getMorphCount() {
+ if (bodyPanel.bodyData == null) {
+ return 0;
+ }
+ return bodyPanel.bodyData.getMorphDeltaMaps().length;
+ }
+
+ public String getMorphName(int index){
+ String[] names = getMorphNames();
+ if(index < 0 || index > names.length - 1){
+ return null;
+ }
+ return names[index];
+ }
+
public String[] getMorphNames() {
if (bodyPanel.bodyData == null) {
return new String[0];
@@ -147,6 +162,18 @@
bodyPanel.renderable.updateMorphs();
}
+ public int getAnimationCount(){
+ return getAnimationNames().length;
+ }
+
+ public String getAnimationName(int index){
+ String[] names = getAnimationNames();
+ if(index < 0 || index > names.length - 1){
+ return null;
+ }
+ return names[index];
+ }
+
public String[] getAnimationNames() {
if (user == null || bodyPanel == null || bodyPanel.renderable == null) {
return new String[0];
@@ -173,6 +200,18 @@
return new BodyConfigurationDocument(user.getBodyConfiguration()).toElement().toString();
}
+ public int getBaseTextureCount(){
+ return getBaseTextureNames().length;
+ }
+
+ public String getBaseTextureName(int index){
+ String[] names = getBaseTextureNames();
+ if(index < 0 || index > names.length - 1){
+ return null;
+ }
+ return names[index];
+ }
+
public String[] getBaseTextureNames() {
if (user == null || bodyPanel == null || bodyPanel.bodyData == null) {
return null;
@@ -193,8 +232,8 @@
saveBodyConfiguration();
updateTextures();
}
-
- public void setBodyData(long bodyDataID){
+
+ public void setBodyData(long bodyDataID) {
if (user == null || bodyPanel == null || bodyPanel.renderable == null) {
return;
}
@@ -214,17 +253,17 @@
e.printStackTrace();
}
}
-
- public void setDefaultBodyConfiguration(long bodyConfigurationID){
+
+ public void setDefaultBodyConfiguration(long bodyConfigurationID) {
if (user == null || bodyPanel == null || bodyPanel.renderable == null) {
return;
}
- if(user.getBodyConfiguration().getBodyDataID() == bodyConfigurationID){
+ if (user.getBodyConfiguration().getBodyDataID() == bodyConfigurationID) {
return;
}
try {
BodyConfigurationDocument doc = webClient.getBodyConfiguration(user.getUsername(), bodyConfigurationID);
- if(doc == null){
+ if (doc == null) {
System.err.println("Could not fetch body config");
return;
}
@@ -233,13 +272,13 @@
bodyPanel.renderable.initBody(bodyPanel.bodyData, dataManager.getBodyTexture(user.getUsername(), user.getBodyConfiguration().getBodyConfigurationID()));
accountDoc.setBodyConfigurationID(bodyConfigurationID);
webClient.updateAccount(accountDoc);
-
- } catch(IOException e){
+
+ } catch (IOException e) {
System.err.println("Could not fetch body config: " + e);
return;
}
}
-
+
private class SpacelessUser extends User {
public SpacelessUser(String username, BodyConfigurationDocument bodyConfigDoc) {
super(new Space(new SpacelessContext(), 1, "Space", "nobody", false, 0), username, new Transform3D(), new BodyConfiguration(bodyConfigDoc), null);
@@ -286,14 +325,14 @@
setLayout(new BorderLayout());
universe = new J3DUniverse();
- canvas = new J3DCanvas(get3DConfiguration(), false);
+ canvas = new J3DCanvas(J3DRenderer.getGraphicsConfiguration(), false);
camera = new J3DCamera();
camera.setCanvas(canvas);
add(canvas, BorderLayout.CENTER);
setupUniverse();
}
-
+
public boolean initUserRenderable() {
try {
bodyData = dataManager.getBodyData(user.getBodyConfiguration().getBodyDataID());
@@ -306,12 +345,12 @@
}
}
- public void fetchNewBodyConfiguration() throws IOException{
+ public void fetchNewBodyConfiguration() throws IOException {
user.setBodyConfiguration(new BodyConfiguration(webClient.getDefaultBodyConfiguration(accountDoc.getUsername())));
bodyData = dataManager.getBodyData(user.getBodyConfiguration().getBodyDataID());
renderable.initBody(bodyData, dataManager.getBodyTexture(user.getUsername(), user.getBodyConfiguration().getBodyConfigurationID()));
}
-
+
private void addDirectionalLight(Color3f color, Vector3f direction) {
DirectionalLight lightD1 = new DirectionalLight(color, direction);
lightD1.setInfluencingBounds(bounds);
@@ -459,13 +498,4 @@
add(errorLabel);
}
}
-
- private GraphicsConfiguration get3DConfiguration() {
- GraphicsConfigTemplate3D configTemplate = new GraphicsConfigTemplate3D();
- GraphicsEnvironment graphicsEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
- GraphicsDevice device = graphicsEnv.getDefaultScreenDevice();
- configTemplate.setSceneAntialiasing(GraphicsConfigTemplate.REQUIRED);
- configTemplate.setDoubleBuffer(GraphicsConfigTemplate.REQUIRED);
- return device.getBestConfiguration(configTemplate);
- }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-17 16:35:58
|
Revision: 583
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=583&view=rev
Author: trevorolio
Date: 2007-11-17 08:36:00 -0800 (Sat, 17 Nov 2007)
Log Message:
-----------
Tweaked the Java3D setup to fall back to aliased, single buffered if the graphics board doesn't support it, which makes us run on lesser machines and also on the Parallels emulator on OS X Intel machines, making life much easier for Macish developers who want to maintain support WinIE.
Used this fact to fix IE+Java quirks (e.g. no String[] passing over liveconnect) so that the majority of browser installations can once again use Ogoglio.
Modified Paths:
--------------
maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/Java3DTester.java
maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/RenderingTest.java
Modified: maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/Java3DTester.java
===================================================================
--- maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/Java3DTester.java 2007-11-15 02:59:34 UTC (rev 582)
+++ maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/Java3DTester.java 2007-11-17 16:36:00 UTC (rev 583)
@@ -4,6 +4,7 @@
import java.awt.BorderLayout;
import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
import java.awt.Panel;
import javax.media.j3d.BranchGroup;
@@ -16,7 +17,7 @@
public boolean canStartJava3D() {
try {
setLayout(new BorderLayout());
- GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
+ GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
Canvas3D canvas3D = new Canvas3D(config);
add("Center", canvas3D);
BranchGroup scene = new BranchGroup();
Modified: maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/RenderingTest.java
===================================================================
--- maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/RenderingTest.java 2007-11-15 02:59:34 UTC (rev 582)
+++ maven/trunk/ogoglio-test-applet/src/main/java/com/ogoglio/testapplet/RenderingTest.java 2007-11-17 16:36:00 UTC (rev 583)
@@ -3,6 +3,7 @@
import java.applet.Applet;
import java.awt.BorderLayout;
+import java.awt.GraphicsConfigTemplate;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment;
@@ -40,8 +41,10 @@
}
private void add3DCanvas() {
- GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D();
- GraphicsConfiguration graphicsEnv = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(template);
+ GraphicsConfiguration graphicsEnv = get3DGraphicsConfiguration();
+ if(graphicsEnv == null){
+ throw new IllegalStateException("Cannot create 3D graphics configuration.");
+ }
Canvas3D canvas = new Canvas3D(graphicsEnv);
add(canvas, BorderLayout.CENTER);
@@ -85,4 +88,17 @@
universe.addBranchGraph(root);
universe.getViewingPlatform().setNominalViewingTransform();
}
+
+ private static GraphicsConfiguration get3DGraphicsConfiguration() {
+ GraphicsConfigTemplate3D configTemplate = new GraphicsConfigTemplate3D();
+ configTemplate.setSceneAntialiasing(GraphicsConfigTemplate.PREFERRED);
+ configTemplate.setDoubleBuffer(GraphicsConfigTemplate.PREFERRED);
+ GraphicsConfiguration config = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(configTemplate);
+ if (config != null) {
+ return config;
+ }
+
+ return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-11-15 02:59:30
|
Revision: 582
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=582&view=rev
Author: iansmith
Date: 2007-11-14 18:59:34 -0800 (Wed, 14 Nov 2007)
Log Message:
-----------
Added some support for getting status information from a server running on linux. This is installed in /og/status and /og/status/all to get information about a cluster. You can use the parameter "?format=xml" or "?format=human" to control which output you want.
The servlet remembers the last ten status updates and shows you these in the results.
It tries to be smart about "clusters of one machine."
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/ServiceDocument.java
maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/MediaService.java
maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/StatusServlet.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/ServiceDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/ServiceDocument.java 2007-11-14 21:17:12 UTC (rev 581)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/ServiceDocument.java 2007-11-15 02:59:34 UTC (rev 582)
@@ -1,5 +1,8 @@
package com.ogoglio.xml;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+
import nanoxml.XMLElement;
public class ServiceDocument {
@@ -16,8 +19,18 @@
data = new XMLElement(NAME);
data.setAttribute(USER_COUNT, userCount);
data.setAttribute(SIM_COUNT, simCount);
+
+ data.addChild(getMemoryChild());
}
+ public XMLElement getMemoryChild() {
+ MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
+ XMLElement result= new XMLElement("memory");
+ result.setAttribute("heapMemoryUsage", memoryBean.getHeapMemoryUsage());
+ result.setAttribute("nonHeapMemoryUsage", memoryBean.getNonHeapMemoryUsage());
+ return result;
+ }
+
public ServiceDocument(XMLElement data) {
if (!NAME.equals(data.getName())) {
throw new IllegalArgumentException("data is not named " + NAME + ": " + data);
Modified: maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java 2007-11-14 21:17:12 UTC (rev 581)
+++ maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java 2007-11-15 02:59:34 UTC (rev 582)
@@ -21,6 +21,7 @@
import java.net.Socket;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URL;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;
@@ -50,6 +51,7 @@
import com.ogoglio.client.model.Thing;
import com.ogoglio.client.model.User;
import com.ogoglio.util.Log;
+import com.ogoglio.util.OgoglioSpecBase;
import com.ogoglio.util.PropStorage;
import com.ogoglio.util.StreamUtils;
import com.ogoglio.util.UIConstants;
@@ -70,6 +72,7 @@
import com.ogoglio.xml.TemplateSupportFileDocument;
import com.ogoglio.xml.ThingDocument;
import com.ogoglio.xml.UserDocument;
+import com.sun.corba.se.impl.javax.rmi.CORBA.Util;
import com.sun.org.apache.xalan.internal.xsltc.compiler.Template;
public class ClientTest extends TestCase {
@@ -968,6 +971,50 @@
return newTemplateDoc;
}
+ private XMLElement getStatusXML() throws IOException, URISyntaxException {
+ InputStream s=new URI(serviceURI1.toString()+"status?format=xml").toURL().openConnection().getInputStream();
+ XMLElement result=XMLElement.parseElementFromString(StreamUtils.readInput(s));
+ s.close();
+ return result;
+ }
+
+ public void testStatus() throws IOException, URISyntaxException {
+ try {
+
+ InputStream forEffect=new URI(serviceURI1.toString()+"status?clear=true").toURL().openConnection().getInputStream();
+ forEffect.close();
+
+ //it's pretty hard to know what *should* be in the status message unless you dummy
+ //up a bunch of stuff in /proc ....this test, thus, is very weak
+
+ checkStatusReportChildren(1);
+
+ getStatusXML();
+ getStatusXML();
+
+ checkStatusReportChildren(4);
+
+ forEffect=new URI(serviceURI1.toString()+"status?clear=true").toURL().openConnection().getInputStream();
+ forEffect.close();
+
+ checkStatusReportChildren(1);//make sure clear works and wasn't lucky above
+
+
+ } catch (IOException e) {
+ if (e.getMessage().startsWith("Server returned HTTP response code: 412")) {
+ Log.info("Ignoring response code 412 for status URL. You probably aren't on linux.");
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ private XMLElement checkStatusReportChildren(int n) throws IOException, URISyntaxException {
+ XMLElement element=getStatusXML();
+ assertEquals(element.getName(),"statusreports");
+ assertEquals(n,element.getChildren().size());
+ return element;
+ }
private void assertStreamsEqual(InputStream input1, InputStream input2) throws IOException {
if(input1 == null || input2 == null){
fail("Not equal, null inputs: " + input1 + ", " + input2);
@@ -1181,5 +1228,4 @@
}
}
-
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/MediaService.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/MediaService.java 2007-11-14 21:17:12 UTC (rev 581)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/MediaService.java 2007-11-15 02:59:34 UTC (rev 582)
@@ -39,6 +39,7 @@
private static final String BODY_TEXTURE_PREFIX = "bodyTexture-";
private MediaStore store = null;
+ private URI mediaURI;
public MediaService(URI mediaURI) throws IOException {
ArgumentUtils.assertNotNull(mediaURI);
@@ -50,8 +51,12 @@
} else {
throw new IllegalStateException("Could not create a store for " + mediaURI + " with scheme " + mediaURI.getScheme());
}
+ this.mediaURI=mediaURI;
}
+ public URI getMediaURI() {
+ return mediaURI;
+ }
public static String getTemplateScriptName(long templateID) {
return MediaService.TEMPLATE_SCRIPT_PREFIX + templateID + MediaService.TEMPLATE_SCRIPT_SUFFIX;
}
Added: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/StatusServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/StatusServlet.java (rev 0)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/StatusServlet.java 2007-11-15 02:59:34 UTC (rev 582)
@@ -0,0 +1,615 @@
+package com.ogoglio.site;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.net.URL;
+import java.sql.Time;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import nanoxml.XMLElement;
+
+import com.ogoglio.appdev.persist.PersistException;
+import com.ogoglio.appdev.servlet.SiteResource;
+import com.ogoglio.persist.SimPersistTasks;
+import com.ogoglio.persist.SimRecord;
+import com.ogoglio.util.Log;
+import com.ogoglio.util.NetworkUtils;
+import com.ogoglio.util.StreamUtils;
+
+public class StatusServlet extends OgoglioServletBase {
+
+ private List recentChecks = new ArrayList();
+
+ private static final int MAX_RECENT_CHECKS = 10;
+
+ public SiteResource createBaseResource(ServletConfig servletConfig) {
+ return new StatusResource();
+ }
+
+ private class FSData {
+ public String root;
+
+ public double size;
+
+ public double used;
+
+ public double available;
+
+ public double percentAvailable() {
+ return available / size * 100.0;
+ }
+
+ public double percentUsed() {
+ return used / size * 100.0;
+ }
+
+ public FSData deepCopy() {
+ FSData result = new FSData();
+ result.size = size;
+ result.root = root;
+ result.used = used;
+ result.available = available;
+ return result;
+ }
+ }
+
+ private class StatusData {
+ public long timestamp;
+
+ public double load_1min;
+
+ public double load_5min;
+
+ public double load_15min;
+
+ public int totalMemory_kb;
+
+ public int freeMemory_kb;
+
+ public double memPercentAvail;
+
+ public FSData[] fs;
+
+ public double netIn_mb;
+
+ public double netOut_mb;
+
+ public int userCount;
+
+ public int simCount;
+
+ public StatusData deepCopy() {
+ StatusData result = new StatusData();
+ result.timestamp = timestamp;
+ result.load_1min = load_1min;
+ result.load_5min = load_5min;
+ result.load_15min = load_15min;
+ result.totalMemory_kb = totalMemory_kb;
+ result.freeMemory_kb = freeMemory_kb;
+ result.memPercentAvail = memPercentAvail;
+ result.fs = new FSData[fs.length];
+ result.netIn_mb = netIn_mb;
+ result.netOut_mb = netOut_mb;
+ result.userCount = userCount;
+ result.simCount = simCount;
+ for (int i = 0; i < fs.length; ++i) {
+ result.fs[i] = fs[i].deepCopy();
+ }
+ return result;
+ }
+ }
+
+ private String frontDoorGetText(String uri,String suffix) throws IOException {
+ InputStream s = new URL(uri + suffix).openConnection().getInputStream();
+ String result = StreamUtils.readInput(s);
+ s.close();
+ return result;
+ }
+
+ private XMLElement frontDoorGetXML(String uri,String suffix) throws IOException {
+ InputStream s = new URL(uri + suffix).openConnection().getInputStream();
+ XMLElement result = XMLElement.parseElementFromString(StreamUtils.readInput(s));
+ s.close();
+ return result;
+ }
+
+ private boolean shouldBeHumanReadable(HttpServletRequest request) {
+ String format = request.getParameter("format");
+ if ((format == null) || (format.equalsIgnoreCase("human"))) {
+ return true;
+ }
+ return false;
+ }
+
+ private class StatusResource extends SiteResource {
+
+ private static final String NETWORK_OUT_MB = "out";
+
+ private static final String NETWORK_IN_MB = "in";
+
+ public static final String NETWORK = "network";
+
+ public static final String AVAILABLE_FS_GB = "available";
+
+ public static final String PERCENT_USED_FS = "percentUsed";
+
+ public static final String USED_FS_GB = "used";
+
+ public static final String SIZE_FS_GB = "size";
+
+ public static final String ROOT_OF_FS = "root";
+
+ public static final String FILESYSTEM = "filesystem";
+
+ public static final String FILESYSTEMS = "filesystems";
+
+ public static final String FREE_MEM_KB = "free";
+
+ public static final String TOTAL_MEM_KB = "total";
+
+ public static final String MEMORY = "memory";
+
+ public static final String MIN_15 = "min15";
+
+ public static final String MIN_5 = "min5";
+
+ public static final String MIN_1 = "min1";
+
+ public static final String LOADAVERAGE = "loadaverage";
+
+ public static final String STATUSREPORT = "statusreport";
+
+ public static final String STATUSREPORTS = "statusreports";
+
+ private static final String PERCENT_AVAILABLE_MEM = "available";
+
+ public StatusResource() {
+ super("status");
+ addSubResource(new AllStatusResource());
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
+ if (!haveSlashProc()) {
+ response.setStatus(HttpServletResponse.SC_PRECONDITION_FAILED);
+ return;
+ }
+
+ //maybe trying to clear out the history?
+ if (request.getParameter("clear") != null) {
+ synchronized (recentChecks) {
+ recentChecks.clear();
+ }
+ response.setStatus(HttpServletResponse.SC_OK);
+ return;
+ }
+
+ try {
+ StatusData data = computeCurrentStatus();
+ List copy = new ArrayList();
+ addCurrentStatusToListAndCopy(data, copy);
+
+ StringBuffer buffer = new StringBuffer();
+ String type;
+ if (shouldBeHumanReadable(request)) {
+ formatForHuman(buffer, copy);
+ type = "text/plain";
+ } else {
+ formatXML(buffer, copy);
+ type = "text/xml";
+ }
+ sendStringResponse(buffer.toString(), type, response);
+ response.setStatus(HttpServletResponse.SC_OK);
+ } catch (IOException e) {
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ Log.error("Trying to read the load average!", e);
+ }
+
+ }
+
+ private void addCurrentStatusToListAndCopy(StatusData data, List copy) {
+ synchronized (recentChecks) {
+ if (recentChecks.size() == MAX_RECENT_CHECKS) {
+ recentChecks.remove(0);
+ }
+ recentChecks.add(data);
+ for (int i = 0; i < recentChecks.size(); ++i) {
+ copy.add(((StatusData) recentChecks.get(i)).deepCopy());
+ }
+ }
+ }
+
+ private StatusData computeCurrentStatus() throws IOException {
+ StatusData data = new StatusData();
+ data.timestamp = System.currentTimeMillis();
+
+ getLoadAvg(data);
+ getMemoryInfo(data);
+ getDiskAvailable(data);
+ getNetworkInfo(data);
+ addSpaceInfo(data);
+ return data;
+ }
+
+ private void addSpaceInfo(StatusData data) throws IOException {
+ XMLElement space = frontDoorGetXML(getBaseUrl(),"space");
+ data.simCount = space.getIntAttribute("simcount");
+ data.userCount = space.getIntAttribute("usercount");
+
+ }
+
+ private void formatXML(StringBuffer buffer, List copy) {
+ XMLElement root = new XMLElement();
+ root.setName(STATUSREPORTS);
+ for (int i = copy.size() - 1; i >= 0; --i) {
+ XMLElement status = new XMLElement();
+ status.setName(STATUSREPORT);
+ StatusData sd = (StatusData) copy.get(i);
+ status.setAttribute("time", sd.timestamp);
+
+ XMLElement load = new XMLElement();
+ load.setName(LOADAVERAGE);
+ load.setAttribute(MIN_1, sd.load_1min);
+ load.setAttribute(MIN_5, sd.load_5min);
+ load.setAttribute(MIN_15, sd.load_15min);
+ status.addChild(load);
+
+ XMLElement memory = new XMLElement();
+ memory.setName(MEMORY);
+ memory.setAttribute(TOTAL_MEM_KB, sd.totalMemory_kb);
+ memory.setAttribute(FREE_MEM_KB, sd.freeMemory_kb);
+ memory.setAttribute(PERCENT_AVAILABLE_MEM, sd.memPercentAvail);
+ status.addChild(memory);
+
+ XMLElement filesystems = new XMLElement();
+ filesystems.setName(FILESYSTEMS);
+ for (int j = 0; j < sd.fs.length; ++j) {
+ XMLElement fs = new XMLElement();
+ fs.setName(FILESYSTEM);
+ fs.setAttribute(ROOT_OF_FS, sd.fs[j].root);
+ fs.setAttribute(SIZE_FS_GB, sd.fs[j].size);
+ fs.setAttribute(AVAILABLE_FS_GB, sd.fs[j].available);
+ fs.setAttribute(USED_FS_GB, sd.fs[j].used);
+ fs.setAttribute(PERCENT_USED_FS, sd.fs[j].percentUsed());
+ filesystems.addChild(fs);
+ }
+ status.addChild(filesystems);
+
+ XMLElement network = new XMLElement();
+ network.setName(NETWORK);
+ network.setAttribute(NETWORK_IN_MB, sd.netIn_mb);
+ network.setAttribute(NETWORK_OUT_MB, sd.netIn_mb);
+ status.addChild(network);
+
+ root.addChild(status);
+ }
+ buffer.append(root.toString());
+ }
+
+ private void formatForHuman(StringBuffer buffer, List copy) {
+ for (int i = copy.size() - 1; i >= 0; --i) {
+ StatusData sd = (StatusData) copy.get(i);
+ buffer.append("Time:" + new Time(sd.timestamp).toString() + "\n");
+ buffer.append("load average 1 min:" + sd.load_1min + "\n");
+ buffer.append("load average 5 min:" + sd.load_5min + "\n");
+ buffer.append("load average 15 min:" + sd.load_15min + "\n");
+
+ String per = "" + sd.memPercentAvail;
+
+ buffer.append("Total memory (kB) :" + sd.totalMemory_kb + "\n");
+ buffer.append("Free memory (kB) :" + sd.freeMemory_kb + "\n");
+ buffer.append("Available :" + per.substring(0, 5) + "% (approximately free + cache)\n");
+ buffer.append("Network in (mB) :" + sd.netIn_mb + "\n");
+ buffer.append("Network out (mB) :" + sd.netOut_mb + "\n");
+ if (i > 0) {
+ StatusData prev = (StatusData) copy.get(i - 1);
+ double inDiff = sd.netIn_mb - prev.netIn_mb;
+ double outDiff = sd.netOut_mb - prev.netOut_mb;
+ double timeDiff = (sd.timestamp - prev.timestamp) / 1000.0;
+ double inAvg = inDiff / timeDiff;
+ double outAvg = outDiff / timeDiff;
+ if (inAvg < 0.001) {
+ inAvg = 0.0;
+ }
+ if (outAvg < 0.001) {
+ outAvg = 0.0;
+ }
+ buffer.append("Network in mB/s :" + inAvg + "\n");
+ buffer.append("Network out mB/s :" + outAvg + "\n");
+ }
+ int width = "load average 1 min".length();
+ for (int j = 0; j < sd.fs.length; ++j) {
+ double used = sd.fs[j].percentUsed();
+ if (used < 0.1) {
+ used = 0.0;
+ }
+ per = "" + used;
+ if (per.length() > 5) {
+ per = per.substring(0, 5);
+ }
+ if (sd.fs[j].root.length() < width) {
+ buffer.append(sd.fs[j].root);
+ for (int k = sd.fs[j].root.length(); k < width; ++k) {
+ buffer.append(" ");
+ }
+ buffer.append(":" + per + "% full\n");
+ } else {
+ buffer.append(sd.fs[j].root + ":" + per + "% full\n");
+ }
+ }
+ buffer.append("User count :" + sd.userCount + "\n");
+ buffer.append("Sim count :" + sd.simCount + "\n");
+ buffer.append("-----------------------------------------------\n");
+ }
+
+ }
+
+ private void getDiskAvailable(StatusData data) throws IOException {
+ String[] cmdarray = { "/bin/df" };
+ Process df = Runtime.getRuntime().exec(cmdarray);
+ InputStream is = df.getInputStream();
+ InputStreamReader reader = new InputStreamReader(is);
+ BufferedReader dfoutput = new BufferedReader(reader);
+ dfoutput.readLine(); //ignore first line
+ String line;
+ List all = new ArrayList();
+ do {
+ line = dfoutput.readLine();
+ if (line == null)
+ continue;
+
+ FSData fsData = new FSData();
+ StringTokenizer tokenizer = new StringTokenizer(line);
+ tokenizer.nextToken(); //ignore unix mount name
+ fsData.size = toFloatGigs(tokenizer.nextToken());
+ fsData.used = toFloatGigs(tokenizer.nextToken());
+ fsData.available = toFloatGigs(tokenizer.nextToken());
+ tokenizer.nextToken(); //ignore percent, don't need it
+ fsData.root = tokenizer.nextToken();
+ all.add(fsData);
+ } while (line != null);
+
+ dfoutput.close();
+
+ data.fs = new FSData[all.size()];
+ for (int i = 0; i < all.size(); ++i) {
+ data.fs[i] = (FSData) all.get(i);
+ }
+ }
+
+ private double toFloatGigs(String token) throws IOException {
+ try {
+ double result = Double.parseDouble(token);
+ return result / 1000000.0; //convert to gigs from k
+ } catch (NumberFormatException e) {
+ throw new IOException("Unable to parse result of df:" + token);
+ }
+ }
+
+ private void getLoadAvg(StatusData data) throws IOException {
+ File load = new File("/proc/loadavg");
+ BufferedReader reader = new BufferedReader(new FileReader(load));
+ String line = reader.readLine();
+ StringTokenizer tokenizer = new StringTokenizer(line, " ");
+ String oneMin = tokenizer.nextToken();
+ String fiveMin = tokenizer.nextToken();
+ String fifteenMin = tokenizer.nextToken();
+ try {
+ data.load_1min = Double.parseDouble(oneMin);
+ data.load_5min = Double.parseDouble(fiveMin);
+ data.load_15min = Double.parseDouble(fifteenMin);
+ reader.close();
+ } catch (NumberFormatException e) {
+ throw new IOException("Unable to understand the format of the /proc/loadavg file:" + e.getMessage());
+ }
+ }
+
+ private void getNetworkInfo(StatusData data) throws IOException {
+ File load = new File("/proc/net/dev");
+ BufferedReader reader = new BufferedReader(new FileReader(load));
+ reader.readLine();
+ reader.readLine();//drop first two lines, they are headings
+ String line;
+ StringTokenizer tokenizer;
+ do {
+ line = reader.readLine();
+ tokenizer = new StringTokenizer(line, " :");
+ } while (!tokenizer.nextToken().startsWith("eth"));
+ String rcvBytes = tokenizer.nextToken();
+ for (int i = 0; i < 7; ++i) {
+ tokenizer.nextToken();//ignore fields we don't need
+ }
+ String sentBytes = tokenizer.nextToken();
+ try {
+ data.netIn_mb = Double.parseDouble(rcvBytes) / 1000000.0;
+ data.netOut_mb = Double.parseDouble(sentBytes) / 1000000.0;
+ } catch (NumberFormatException e) {
+ throw new IOException("Can't understand format of network information!" + line);
+ }
+ }
+
+ private void getMemoryInfo(StatusData data) throws IOException {
+
+ File load = new File("/proc/meminfo");
+ BufferedReader reader = new BufferedReader(new FileReader(load));
+ String memTotal = reader.readLine();
+ String memFree = reader.readLine();
+ reader.readLine(); //buffers
+ String cached = reader.readLine();
+ reader.close();
+
+ try {
+ int total = Integer.parseInt(parseMemLine(memTotal, "MemTotal:"));
+ int free = Integer.parseInt(parseMemLine(memFree, "MemFree:"));
+ int cache = Integer.parseInt(parseMemLine(cached, "Cached:"));
+ int totalAvail = free + cache;
+ data.memPercentAvail = ((double) totalAvail) / ((double) total) * 100.0;
+ data.totalMemory_kb = total;
+ data.freeMemory_kb = free;
+
+ } catch (NumberFormatException e) {
+ throw new IOException("Unable to understand the format of the /proc/meminfo file:" + e.getMessage());
+ }
+ }
+
+ private String parseMemLine(String line, String expectedFirst) throws IOException {
+ StringTokenizer tokenizer = new StringTokenizer(line, " ");
+ String first = tokenizer.nextToken();
+ String second = tokenizer.nextToken();
+ if (!expectedFirst.equals(first)) {
+ throw new IOException("Whoa! Line wasn't what we expected from /proc/meminfo! Expected:" + expectedFirst + " but was " + first);
+ }
+ return second;
+ }
+
+ public boolean haveSlashProc() {
+ File load = new File("/proc/loadavg");
+ if (!load.exists()) {
+ return false;
+ }
+ if (!load.canRead()) {
+ return false;
+ }
+ return true;
+ }
+
+ }
+
+ private class AllStatusResource extends SiteResource {
+ private static final String STATUS_HUMAN = "status?format=human";
+
+ private static final String STATUS_XML = "status?format=xml";
+
+ public AllStatusResource() {
+ super("all");
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
+ StringBuffer buffer = new StringBuffer();
+ String type;
+ if (shouldBeHumanReadable(request)) {
+ formatForHuman(buffer);
+ type = "text/plain";
+ } else {
+ try {
+ formatXML(buffer);
+ } catch (PersistException e) {
+ Log.error("Unable to do a status check!", e);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return;
+ } catch (IOException e) {
+ Log.error("Unable to do a status check!", e);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return;
+ }
+ type = "text/xml";
+ }
+ sendStringResponse(buffer.toString(), type, response);
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
+
+ private void formatXML(StringBuffer buffer) throws IOException, PersistException {
+ XMLElement cluster = new XMLElement();
+ cluster.setName("cluster");
+
+ XMLElement webapp = new XMLElement();
+ webapp.setName("webapp");
+ webapp.setAttribute("uri", getBaseUrl());
+ XMLElement statusReports = frontDoorGetXML(getBaseUrl(),STATUS_XML);
+ webapp.addChild(statusReports);
+ cluster.addChild(webapp);
+ SimRecord[] simRecord = SimPersistTasks.findSims(getSessionFactory());
+ for (int i = 0; i < simRecord.length; ++i) {
+ SimRecord sim = simRecord[i];
+ try {
+ XMLElement s=new XMLElement();
+ s.setName("sim");
+ s.setAttribute("uri", sim.getSimURI());
+ if (isOnLocalhost(sim)) {
+ s.setAttribute("ignored", true);
+ } else {
+ statusReports = frontDoorGetXML(dodgyConversionOfSimURI(sim.getSimURI().toString()),STATUS_XML);
+ s.addChild(statusReports);
+ }
+ cluster.addChild(s);
+ } catch (IOException e) {
+ Log.info("Unable to get XML from sim URI:"+sim.getSimURI(),e);
+ }
+ }
+ String mediaURI = getMediaService().getMediaURI().toString();
+ XMLElement media=new XMLElement();
+ media.setName("mediaserver");
+ media.setAttribute("uri", mediaURI);
+ if (!mediaURI.startsWith("file:")) {
+ statusReports = frontDoorGetXML(mediaURI,STATUS_XML);
+ media.addChild(statusReports);
+ } else {
+ media.setAttribute("ignored", true);
+ }
+ cluster.addChild(media);
+ buffer.append(cluster.toString());
+ }
+
+ private boolean isOnLocalhost(SimRecord sim) {
+ return sim.getSimURI().toString().indexOf("127.0.0.1")!=-1;
+ }
+
+ private String dodgyConversionOfSimURI(String simURI) {
+ String result;
+ String standardSIMSuffix="/og/sim/";
+ if (!simURI.endsWith(standardSIMSuffix)) {
+ Log.error("Don't understand the sim URI we got, so we can't convert to a status URI:"+simURI);
+ return simURI; //not a great answer, but it'll cause IOExceptions elsewhere
+ }
+ result=simURI.substring(0,simURI.length()-standardSIMSuffix.length()) + "/og/status";
+ Log.warn("Somewhat dodgy: Converting the URI "+simURI +" to "+result+" for status report!");
+ return result;
+ }
+ private void formatForHuman(StringBuffer buffer) {
+ buffer.append("WebApp Server:" + getBaseUrl() + "\n");
+
+ try {
+ String statusReports = frontDoorGetText(getBaseUrl(),STATUS_HUMAN);
+ buffer.append("===============================================\n");
+ buffer.append(statusReports);
+ SimRecord[] simRecord = SimPersistTasks.findSims(getSessionFactory());
+ for (int i = 0; i < simRecord.length; ++i) {
+ SimRecord sim = simRecord[i];
+ try {
+ buffer.append("Sim Server:" + sim.getDisplayName() + " [" + sim.getSimID() + "] " + sim.getSimURI() + "\n");
+ buffer.append("===============================================\n");
+ if (!isOnLocalhost(sim)) {
+ statusReports = frontDoorGetText(dodgyConversionOfSimURI(sim.getSimURI().toString()),STATUS_HUMAN);
+ buffer.append(statusReports);
+ }
+ } catch (IOException e) {
+ // swallow it b/c there can be sims in DB that are down
+ }
+ }
+ String mediaURI = getMediaService().getMediaURI().toString();
+ buffer.append("Media Server:" + mediaURI+"\n");
+ buffer.append("===============================================\n");
+ if (!mediaURI.startsWith("file:")) {
+ statusReports = frontDoorGetText(mediaURI,STATUS_HUMAN);
+ buffer.append(statusReports);
+ }
+ } catch (IOException e) {
+ buffer.append("Could not contact other status applet:" + e.getMessage());
+ } catch (PersistException e) {
+ buffer.append("Unable to contact database [PersistException]:" + e.getMessage());
+ }
+ }
+ }
+
+}
Modified: maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml 2007-11-14 21:17:12 UTC (rev 581)
+++ maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml 2007-11-15 02:59:34 UTC (rev 582)
@@ -36,6 +36,12 @@
<load-on-startup>1</load-on-startup>
</servlet>
+ <servlet>
+ <servlet-name>StatusServlet</servlet-name>
+ <servlet-class>com.ogoglio.site.StatusServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
<servlet-mapping>
<servlet-name>AccountServlet</servlet-name>
<url-pattern>/account/*</url-pattern>
@@ -66,6 +72,11 @@
<url-pattern>/comet/*</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>StatusServlet</servlet-name>
+ <url-pattern>/status/*</url-pattern>
+ </servlet-mapping>
+
<error-page>
<error-code>404</error-code>
<location>/notFound.html</location>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-14 21:17:09
|
Revision: 581
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=581&view=rev
Author: trevorolio
Date: 2007-11-14 13:17:12 -0800 (Wed, 14 Nov 2007)
Log Message:
-----------
Added a few skin colors to Andrea and scaled skin textures down even further to 256x256
Modified Paths:
--------------
maven/trunk/ogoglio-bodies/ogoglio-body-andrea/src/main/resources/texture/body.jpg
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Blue Skin.jpg
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Green Skin.jpg
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Red Skin.jpg
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/body.jpg
Added Paths:
-----------
maven/trunk/ogoglio-bodies/ogoglio-body-andrea/src/main/resources/texture/Blue Skin.jpg
maven/trunk/ogoglio-bodies/ogoglio-body-andrea/src/main/resources/texture/Green Skin.jpg
maven/trunk/ogoglio-bodies/ogoglio-body-andrea/src/main/resources/texture/Red Skin.jpg
Added: maven/trunk/ogoglio-bodies/ogoglio-body-andrea/src/main/resources/texture/Blue Skin.jpg
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-bodies/ogoglio-body-andrea/src/main/resources/texture/Blue Skin.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: maven/trunk/ogoglio-bodies/ogoglio-body-andrea/src/main/resources/texture/Green Skin.jpg
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-bodies/ogoglio-body-andrea/src/main/resources/texture/Green Skin.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: maven/trunk/ogoglio-bodies/ogoglio-body-andrea/src/main/resources/texture/Red Skin.jpg
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-bodies/ogoglio-body-andrea/src/main/resources/texture/Red Skin.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: maven/trunk/ogoglio-bodies/ogoglio-body-andrea/src/main/resources/texture/body.jpg
===================================================================
(Binary files differ)
Modified: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Blue Skin.jpg
===================================================================
(Binary files differ)
Modified: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Green Skin.jpg
===================================================================
(Binary files differ)
Modified: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Red Skin.jpg
===================================================================
(Binary files differ)
Modified: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/body.jpg
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-14 18:04:03
|
Revision: 580
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=580&view=rev
Author: trevorolio
Date: 2007-11-14 10:04:08 -0800 (Wed, 14 Nov 2007)
Log Message:
-----------
Added colored skins for Mike.
Changed the publicity of account information so profile pages are more useful.
Added Paths:
-----------
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Green Skin.jpg
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Red Skin.jpg
Removed Paths:
-------------
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Meet Us In Orbit.jpg
Added: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Green Skin.jpg
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Green Skin.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Meet Us In Orbit.jpg
===================================================================
(Binary files differ)
Added: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Red Skin.jpg
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Red Skin.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-14 18:04:00
|
Revision: 579
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=579&view=rev
Author: trevorolio
Date: 2007-11-14 10:04:04 -0800 (Wed, 14 Nov 2007)
Log Message:
-----------
Added colored skins for Mike.
Changed the publicity of account information so profile pages are more useful.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2007-11-13 17:30:42 UTC (rev 578)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2007-11-14 18:04:04 UTC (rev 579)
@@ -86,7 +86,7 @@
if (authed) {
result = new AccountDocument(account.getUsername(), account.getAccountlevel(), account.getFirstName(), account.getLastName(), account.getHomepage(), null, account.getEmail(), account.getCreationDate(), null, account.getFrozenUntil(), account.getDefaultBodyConfigurationID());
} else {
- result = new AccountDocument(account.getUsername(), null, null, null, null, null, null, account.getCreationDate(), null, account.getFrozenUntil(), -1);
+ result = new AccountDocument(account.getUsername(), account.getAccountlevel(), account.getFirstName(), account.getLastName(), account.getHomepage(), null, null, account.getCreationDate(), null, account.getFrozenUntil(), account.getDefaultBodyConfigurationID());
}
return result;
}
@@ -446,7 +446,7 @@
private class AccountResource extends AuthenticatedSiteResource {
public AccountResource() {
- super(SiteResource.WILDCARD_ELEMENT, true, getSessionFactory());
+ super(SiteResource.WILDCARD_ELEMENT, false, getSessionFactory());
addSubResource(new SpacesResource());
addSubResource(new TemplatesResource());
addSubResource(new MembershipResource());
@@ -462,13 +462,13 @@
}
AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
-
if (requestedAccount == null) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
- AccountDocument result = createAccountDocument(requestedAccount, authedAccount.equals(requestedAccount) || AccountDocument.ACCOUNT_LEVEL_ADMIN.equals(authedAccount.getAccountlevel()));
+ boolean authed = authedAccount != null && (authedAccount.equals(requestedAccount) || AccountDocument.ACCOUNT_LEVEL_ADMIN.equals(authedAccount.getAccountlevel()));
+ AccountDocument result = createAccountDocument(requestedAccount, authed);
response.setStatus(HttpServletResponse.SC_OK);
response.setContentType("text/xml");
response.getOutputStream().write(result.toString().getBytes());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-13 17:30:42
|
Revision: 577
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=577&view=rev
Author: trevorolio
Date: 2007-11-13 09:30:39 -0800 (Tue, 13 Nov 2007)
Log Message:
-----------
Removed log4j dependencies from the poms.
Modified Paths:
--------------
maven/trunk/ogoglio/pom.xml
Modified: maven/trunk/ogoglio/pom.xml
===================================================================
--- maven/trunk/ogoglio/pom.xml 2007-11-13 17:30:36 UTC (rev 576)
+++ maven/trunk/ogoglio/pom.xml 2007-11-13 17:30:39 UTC (rev 577)
@@ -61,12 +61,6 @@
<dependencyManagement>
<dependencies>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.12</version>
- <scope>compile</scope>
- </dependency>
</dependencies>
</dependencyManagement>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-13 17:30:42
|
Revision: 578
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=578&view=rev
Author: trevorolio
Date: 2007-11-13 09:30:42 -0800 (Tue, 13 Nov 2007)
Log Message:
-----------
Removed log4j dependencies from the poms.
Modified Paths:
--------------
maven/trunk/ogoglio-common/pom.xml
Modified: maven/trunk/ogoglio-common/pom.xml
===================================================================
--- maven/trunk/ogoglio-common/pom.xml 2007-11-13 17:30:39 UTC (rev 577)
+++ maven/trunk/ogoglio-common/pom.xml 2007-11-13 17:30:42 UTC (rev 578)
@@ -25,11 +25,6 @@
<!-- things we need to build/run -->
<dependencies>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
-
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-13 17:30:32
|
Revision: 576
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=576&view=rev
Author: trevorolio
Date: 2007-11-13 09:30:36 -0800 (Tue, 13 Nov 2007)
Log Message:
-----------
Removed log4j dependencies from the poms.
Modified Paths:
--------------
maven/trunk/ogoglio-integration-test/pom.xml
Modified: maven/trunk/ogoglio-integration-test/pom.xml
===================================================================
--- maven/trunk/ogoglio-integration-test/pom.xml 2007-11-13 17:30:34 UTC (rev 575)
+++ maven/trunk/ogoglio-integration-test/pom.xml 2007-11-13 17:30:36 UTC (rev 576)
@@ -31,7 +31,6 @@
<filtering>false</filtering>
<directory>src/test/resources</directory>
<includes>
- <include>log4j.properties</include>
<include>mail/*</include>
<include>sample-art3d/*</include>
</includes>
@@ -92,14 +91,6 @@
<artifactId>ogoglio-body-editor-applet</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
-
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <!-- version, scope, optional inherited but overwritable -->
- </dependency>
-
-
</dependencies>
</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-13 17:30:30
|
Revision: 575
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=575&view=rev
Author: trevorolio
Date: 2007-11-13 09:30:34 -0800 (Tue, 13 Nov 2007)
Log Message:
-----------
Removed log4j dependencies from the poms.
Modified Paths:
--------------
maven/trunk/ogoglio-server/pom.xml
Modified: maven/trunk/ogoglio-server/pom.xml
===================================================================
--- maven/trunk/ogoglio-server/pom.xml 2007-11-13 00:44:33 UTC (rev 574)
+++ maven/trunk/ogoglio-server/pom.xml 2007-11-13 17:30:34 UTC (rev 575)
@@ -41,12 +41,6 @@
</includes>
</resource>
<resource>
- <directory>src/main/resources/log4j</directory>
- <includes>
- <include>log4j.properties</include>
- </includes>
- </resource>
- <resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
@@ -76,7 +70,6 @@
<filtering>false</filtering>
<directory>src/test/resources</directory>
<includes>
- <include>log4j.properties</include>
<include>mail/*</include>
<include>templates/*</include>
</includes>
@@ -290,12 +283,6 @@
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <!-- version, scope, optional inherited but overwritable -->
- </dependency>
-
- <dependency>
<groupId>com.sun</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-11-13 00:44:28
|
Revision: 574
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=574&view=rev
Author: iansmith
Date: 2007-11-12 16:44:33 -0800 (Mon, 12 Nov 2007)
Log Message:
-----------
Removed ancient log4j.properties files.
This should be done in one place your $CATALINA_HOME/lib/log4j.properties file.
Modified Paths:
--------------
maven/trunk/ogoglio-server/.classpath
Removed Paths:
-------------
maven/trunk/ogoglio-integration-test/src/test/resources/log4j.properties
maven/trunk/ogoglio-server/src/main/resources/log4j/
Deleted: maven/trunk/ogoglio-integration-test/src/test/resources/log4j.properties
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/resources/log4j.properties 2007-11-13 00:39:09 UTC (rev 573)
+++ maven/trunk/ogoglio-integration-test/src/test/resources/log4j.properties 2007-11-13 00:44:33 UTC (rev 574)
@@ -1,49 +0,0 @@
-### direct log messages to stdout ###
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
-
-### direct messages to file hibernate.log ###
-#log4j.appender.file=org.apache.log4j.FileAppender
-#log4j.appender.file.File=hibernate.log
-#log4j.appender.file.layout=org.apache.log4j.PatternLayout
-#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
-
-### set log levels - for more verbose logging change 'info' to 'debug' ###
-
-log4j.rootLogger=warn, stdout
-
-log4j.logger.com.ogoglio=debug
-
-log4j.logger.org.hibernate=error
-#log4j.logger.org.hibernate=debug
-
-### log HQL query parser activity
-#log4j.logger.org.hibernate.hql.ast.AST=debug
-
-### log just the SQL
-#log4j.logger.org.hibernate.SQL=debug
-
-### log JDBC bind parameters ###
-#log4j.logger.org.hibernate.type=info
-#log4j.logger.org.hibernate.type=debug
-
-### log schema export/update ###
-#log4j.logger.org.hibernate.tool.hbm2ddl=info
-
-### log HQL parse trees
-#log4j.logger.org.hibernate.hql=debug
-
-### log cache activity ###
-#log4j.logger.org.hibernate.cache=debug
-
-### log transaction activity
-#log4j.logger.org.hibernate.transaction=debug
-
-### log JDBC resource acquisition
-#log4j.logger.org.hibernate.jdbc=debug
-
-### enable the following line if you want to track down connection ###
-### leakages when using DriverManagerConnectionProvider ###
-#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
Modified: maven/trunk/ogoglio-server/.classpath
===================================================================
--- maven/trunk/ogoglio-server/.classpath 2007-11-13 00:39:09 UTC (rev 573)
+++ maven/trunk/ogoglio-server/.classpath 2007-11-13 00:44:33 UTC (rev 574)
@@ -4,7 +4,6 @@
<classpathentry excluding="**" kind="src" output="src/main/resources/siteTemplates" path="src/main/resources/siteTemplates"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="src/main/resources/hibernate" path="src/main/resources/hibernate"/>
- <classpathentry excluding="**" kind="src" output="src/main/resources/log4j" path="src/main/resources/log4j"/>
<classpathentry excluding="**" kind="src" output="src/test/resources" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-11-13 00:39:05
|
Revision: 573
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=573&view=rev
Author: iansmith
Date: 2007-11-12 16:39:09 -0800 (Mon, 12 Nov 2007)
Log Message:
-----------
Added support for logging using log4j if you have it. Otherwise, no effect.
A
Modified Paths:
--------------
maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/MigratedResourceServlet.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProtoFactory.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/Log.java
maven/trunk/ogoglio-common/src/test/java/com/ogoglio/loadtest/MultiuserTests.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java
Modified: maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/MigratedResourceServlet.java
===================================================================
--- maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/MigratedResourceServlet.java 2007-11-12 17:37:16 UTC (rev 572)
+++ maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/MigratedResourceServlet.java 2007-11-13 00:39:09 UTC (rev 573)
@@ -50,14 +50,14 @@
private SessionFactory getOrCreateHibernateSessionFactory(ServletConfig config, Context context) {
SessionFactory sessionFactory = (SessionFactory) config.getServletContext().getAttribute(HIBERNATE_SESSION_FACTORY_KEY);
if (sessionFactory == null) {
- Log.test(config.getServletName() + ": checking DB version");
+ Log.info(config.getServletName() + ": checking DB version");
MigrationSupport ms = getMigration();
if (!ms.verifyVersion(config, context)) {
throw new IllegalStateException("Cannot find a DB configuration for hibernate!");
}
sessionFactory = ms.getCurrentConfiguration().configure().buildSessionFactory();
config.getServletContext().setAttribute(HIBERNATE_SESSION_FACTORY_KEY, sessionFactory);
- Log.test(config.getServletName() + ": DB version OK");
+ //Log.info(config.getServletName() + ": DB version OK");
}
return sessionFactory;
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProtoFactory.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProtoFactory.java 2007-11-12 17:37:16 UTC (rev 572)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProtoFactory.java 2007-11-13 00:39:09 UTC (rev 573)
@@ -41,6 +41,15 @@
}
}
+ public static AsyncProto getDefaultClient(URI uri) throws IOException {
+ if (USE_SIMPLE_SOCKET) {
+ return simpleSocketProto(uri.getHost(), uri.getPort());
+ } else {
+ return cometProto(uri);
+ }
+ }
+
+
private static AsyncProto cometProto(URI cometURI) throws IOException {
//return new CometClient(host,selector).getProto();
return CometClient.getProto(cometURI);
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/Log.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/Log.java 2007-11-12 17:37:16 UTC (rev 572)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/Log.java 2007-11-13 00:39:09 UTC (rev 573)
@@ -2,10 +2,14 @@
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import com.ogoglio.xml.SpaceEvent;
+
public class Log {
- private static class Logger {
+ private static class SimpleLogger {
public void debug(Object msg) {
System.out.println(msg);
@@ -42,41 +46,163 @@
}
}
- static Logger log = new Logger();
+ static SimpleLogger simple = new SimpleLogger();
+ static boolean haveLog4J = false;
+ static Object reallyALogger=null;
+ static Object reallyTheSpaceLogger=null;
+ static boolean faultedInAlready=false;
+ static Method m_debug=null;
+ static Method m_info=null;
+ static Method m_info_throw=null;
+ static Method m_warn=null;
+ static Method m_error=null;
+ static Method m_error_throw=null;
+ static Method m_trace=null;
+ static Method m_test=null;
+ static Method m_logMemory=null;
+ static String[] ignoredSpaceEventNames = {
+ SpaceEvent.USER_START_MOTION_EVENT,
+ SpaceEvent.THING_START_MOTION_EVENT,
+ SpaceEvent.SHAPE_START_MOTION_EVENT
+ };
+ public static void faultInLogger() {
+ try {
+ if (faultedInAlready) {
+ return;
+ }
+ faultedInAlready=true;
+ //do we have linkage to log4j?
+ Class clazz=Class.forName("org.apache.log4j.Logger");
+ Object[] arrayOfOneInstWithString = new Object[] {"com.ogoglio"};
+ Object[] arrayOfOneInstWithSpaceString = new Object[] {"com.ogoglio.space"};
+
+ Class[] arrayOfOneClass = new Class[] {new Object().getClass()};
+ Class[] arrayOfTwoClasses = new Class[] {new Object().getClass(), new Throwable().getClass()};
+
+ haveLog4J=true;
+ Method m=clazz.getMethod("getLogger", new Class[] { "".getClass()});
+ //setup the methods
+ reallyALogger=m.invoke(null, arrayOfOneInstWithString);
+ reallyTheSpaceLogger=m.invoke(null, arrayOfOneInstWithSpaceString);
+ m_debug=clazz.getMethod("debug",arrayOfOneClass);
+ m_info=clazz.getMethod("info",arrayOfOneClass);
+ m_info_throw=clazz.getMethod("info",arrayOfTwoClasses);
+ m_warn=clazz.getMethod("warn",arrayOfOneClass);
+ m_error=clazz.getMethod("error",arrayOfOneClass);
+ m_error_throw=clazz.getMethod("error",arrayOfTwoClasses);
+ m_trace=clazz.getMethod("info",arrayOfOneClass);
+ m_test=clazz.getMethod("debug",arrayOfOneClass);
+ m_logMemory=clazz.getMethod("info",arrayOfOneClass);
+
+
+
+ } catch (IllegalAccessException e) {
+ haveLog4J=false;
+ simple.warn("Something went wrong in log4j init [illegalaccess]:"+e.getMessage());
+ } catch (InvocationTargetException e) {
+ haveLog4J=false;
+ simple.warn("Something went wrong in log4j init [invocationtarget]:"+e.getMessage());
+ } catch (NoSuchMethodException e) {
+ haveLog4J=false;
+ simple.warn("Something went wrong in log4j init [nosuchmethod]:"+e.getMessage());
+ } catch (ClassNotFoundException exception) {
+ haveLog4J=false;
+ simple.warn("Didn't find log4j, so using a simple logger.");
+ }
+ }
+
public static void debug(Object msg) {
- log.debug(msg);
+ faultInLogger();
+ useLog4jOrSimple(msg, m_debug);
}
+ private static void useLog4jOrSimple(Object msg,Method method) {
+ useLog4jOrSimple(msg, null,method);
+ }
+ private static void useLog4jOrSimple(Object msg, Object throwable, Method method) {
+ useLog4jOrSimple(msg, reallyALogger, throwable,method);
+ }
+
+ private static void useLog4jOrSimple(Object msg, Object logger, Object throwable, Method method) {
+ try {
+ if (haveLog4J) {
+ if (throwable==null) {
+ method.invoke(logger, new Object[] {msg});
+ } else {
+ method.invoke(logger, new Object[] {msg,throwable});
+ }
+ } else {
+ simple.debug(msg);
+ }
+ } catch (InvocationTargetException ex) {
+ haveLog4J=false;
+ simple.debug("Probablem using log4j [invocationtarget]:"+ex.getMessage());
+ } catch (IllegalAccessException ex) {
+ haveLog4J=false;
+ simple.debug("Probably using log4j [illegalaccess]:"+ex.getMessage());
+ }
+ }
+
public static void info(Object msg) {
- log.info(msg);
+ faultInLogger();
+ useLog4jOrSimple(msg, m_info);
}
public static void info(Object msg, Throwable t) {
- log.info(msg, t);
+ useLog4jOrSimple(msg, t, m_info_throw);
}
public static void warn(Object msg) {
- log.warn(msg);
+ faultInLogger();
+ useLog4jOrSimple(msg, m_warn);
}
public static void error(Object msg) {
- log.error(msg);
+ faultInLogger();
+ useLog4jOrSimple(msg, m_error);
}
public static void error(Object msg, Throwable t) {
- log.error(msg, t);
+ useLog4jOrSimple(msg, t, m_error_throw);
}
public static void trace(Object msg) {
- log.trace(msg);
+ faultInLogger();
+ useLog4jOrSimple(msg, m_trace);
}
public static void test(Object msg) {
- log.debug("TEST:" + msg);
+ faultInLogger();
+ useLog4jOrSimple("TEST:"+msg, m_debug);
}
public static void logMemoryUsage(){
- log.logMemoryUsage();
+ faultInLogger();
+ MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
+ useLog4jOrSimple("\tHeap: " + (memoryBean.getHeapMemoryUsage().getUsed() / 1024 / 1024f) + "MB / " + (memoryBean.getHeapMemoryUsage().getCommitted() / 1024 / 1024f) + "MB / " + (memoryBean.getHeapMemoryUsage().getMax() / 1024 / 1024f) + "MB",m_info);
+ useLog4jOrSimple("\tNon: " + (memoryBean.getNonHeapMemoryUsage().getUsed() / 1024 / 1024f) + "MB / " + (memoryBean.getNonHeapMemoryUsage().getCommitted() / 1024 / 1024f) + "MB / " + (memoryBean.getNonHeapMemoryUsage().getMax() / 1024 / 1024f) + "MB", m_info);
}
+
+ public static void logSpaceEvent(SpaceEvent event) {
+ faultInLogger();
+ if (!haveLog4J) {
+ return;//don't bother unless we have fancy logging capabilities
+ }
+ String n=event.getName();
+ for (int i=0; i<ignoredSpaceEventNames.length;++i) {
+ //reduce size of logs a bit
+ if (n.equals(ignoredSpaceEventNames[i])) {
+ return;
+ }
+ }
+ useLog4jOrSimple(event.toString(), reallyTheSpaceLogger, null, m_info);
+ }
+ public static void logSpaceEvent(String msg) {
+ faultInLogger();
+ if (!haveLog4J) {
+ return;
+ }
+ useLog4jOrSimple(msg, reallyTheSpaceLogger, null, m_info);
+ }
}
Modified: maven/trunk/ogoglio-common/src/test/java/com/ogoglio/loadtest/MultiuserTests.java
===================================================================
--- maven/trunk/ogoglio-common/src/test/java/com/ogoglio/loadtest/MultiuserTests.java 2007-11-12 17:37:16 UTC (rev 572)
+++ maven/trunk/ogoglio-common/src/test/java/com/ogoglio/loadtest/MultiuserTests.java 2007-11-13 00:39:09 UTC (rev 573)
@@ -65,7 +65,7 @@
for (int i = 0; i < numRobots; i++) {
startPosition.setTranslation(new Vector3d(0, 0, -50));
tests.addRobot(startPosition, true);
- Log.test("Added robot " + (i + 1) + " of " + numRobots);
+ Log.info("Added robot " + (i + 1) + " of " + numRobots);
Thread.sleep(1000);
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-11-12 17:37:16 UTC (rev 572)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-11-13 00:39:09 UTC (rev 573)
@@ -188,7 +188,7 @@
}
public void startSim() {
- simThread.setName("space-sim-thread-"+Thread.currentThread().getId());
+ simThread.setName("space-"+space.getSpaceID());
//Log.info("Starting up thread: "+simThread.getName());
simThread.start();
}
@@ -201,14 +201,16 @@
BlockingQueue queue = new BlockingQueue();
public SimThread() {
- super("SimThread");
+ super();
setDaemon(true);
}
public void run() {
+ Log.logSpaceEvent("SPACE START:"+space.getDisplayName()+","+space.getSpaceID());
while (!cleaned) {
try {
SpaceEvent event = (SpaceEvent) queue.dequeue();
+ Log.logSpaceEvent(event);
if (cleaned) {
return;
}
@@ -428,6 +430,8 @@
Log.error("Error handling space event", e);
}
}
+ Log.logSpaceEvent("SPACE STOP:"+space.getDisplayName()+","+space.getSpaceID());
+
}
private String markdownChatMessage(String chatMessage) {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java 2007-11-12 17:37:16 UTC (rev 572)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java 2007-11-13 00:39:09 UTC (rev 573)
@@ -16,6 +16,7 @@
import java.io.IOException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Timer;
import java.util.TimerTask;
@@ -57,7 +58,7 @@
private NetworkChannelServer channelServer = null;
private SessionFactory sessionFactory = null;
-
+
private SimChannelHandler simMessageHandler = new SimChannelHandler();
private ClientMessageHandler clientMessageHandler = new ClientMessageHandler();
@@ -68,13 +69,9 @@
private static final long HEARTBEAT_INTERVAL_TO_SIM = 5000;
- //needed because we are CLIENT of the sim servlet and need to know how to reach it
- private WebAPIDescriptor descriptor;
-
public MessageProxy(SessionFactory sessionFactory, WebAPIDescriptor descriptor) throws IOException {
ArgumentUtils.assertNotNull(sessionFactory);
this.sessionFactory = sessionFactory;
- this.descriptor = descriptor;
channelServer = new NetworkChannelServer(clientMessageHandler, descriptor.getCometProxyURI(), true, this);
Log.info("Started Message Proxy on port " + channelServer.getLocator().getPort() + " with target of " + descriptor.getCometSimURI());
outgoingHeartbeatTimer.schedule(new OutgoingHeartbeatTask(), 5000, 60000);
@@ -203,7 +200,7 @@
sendMessageToSpace(locatorAuth.uri, locatorAuth.spaceID, simMessage);
return;
} else if (request.getPayload() instanceof PayloadFactory.LogoutPayload) {
- request.getPayload(); //XXX is this necessary?
+ request.getPayload(); //XXX is this necessary? is there a side effect??
logout(request.getOrigin());
return;
} else if (request.getPayload() instanceof PayloadFactory.SpaceEventPayload) {
@@ -321,13 +318,16 @@
simChannel = (TCPChannel) simChannels.getForward(uri);
if (simChannel == null) {
try {
- /*Object selector=AsyncProtoFactory.getDefaultInfo().getSimSpecificSelector();
- AsyncProto proto=AsyncProtoFactory.getDefaultClient(uri.getHost(), selector);*/
- AsyncProto proto = AsyncProtoFactory.getDefaultClient(descriptor, false);
+ //the reason we don't use the service API descriptor here is that in the case
+ //of splitting across multiple machines (sims on different machine from the
+ //webapp) the sim isn't actually part of the service URI space, it has it's
+ //own location, communicated out of band (via the DB)
+ URI cometURI=representativeURIToCometUR(uri);
+ AsyncProto proto=AsyncProtoFactory.getDefaultClient(cometURI);
simChannel = new TCPChannel(proto, simMessageHandler, false, simMessageHandler, true, "sim-client");
} catch (IOException e) {
e.printStackTrace();
- throw new NoSuchDestinationException("Could not open a channel to " + uri);
+ throw new NoSuchDestinationException("Could not open a channel to " + uri + "(original exception was:"+e.getMessage());
}
simChannels.put(uri, simChannel);
}
@@ -336,6 +336,21 @@
simChannel.sendMessage(message);
}
+ private URI representativeURIToCometUR(URI representativeURI) throws IOException {
+ String cometPath="/og/comet/sim";
+
+ if (!representativeURI.getPath().endsWith("/og/sim/")) {
+ throw new IOException("Can't understand the path well enough to convert this to a comet URI:"+representativeURI.getPath());
+ }
+ try {
+ URI result=new URI(representativeURI.getScheme(),null,representativeURI.getHost(),representativeURI.getPort(),cometPath,null,null);
+ Log.warn("Somewhat dodgy: Converting the URI "+representativeURI+" to "+result+" for comet!");
+ return result;
+ } catch (URISyntaxException e) {
+ throw new IOException("Our converted URI was not well formed! Started with:"+representativeURI);
+ }
+ }
+
public void channelAdded(TCPChannel channel) {
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-12 17:37:13
|
Revision: 572
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=572&view=rev
Author: trevorolio
Date: 2007-11-12 09:37:16 -0800 (Mon, 12 Nov 2007)
Log Message:
-----------
Fixed a bug in which the sim comet connection was dropped due to heartbeat timing miscalculation, causing events generated via web api to not make their way back to connected clients if there were no client originated comet events. Hello, edge case.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SimMessageHandler.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SimMessageHandler.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SimMessageHandler.java 2007-11-12 17:37:13 UTC (rev 571)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SimMessageHandler.java 2007-11-12 17:37:16 UTC (rev 572)
@@ -55,6 +55,7 @@
if (!(message.getPayload() instanceof PayloadFactory.HeartbeatPayload)) {
Log.error("Somebody sent message with the 'heartbeat' space id:"+message.getPayload());
}
+
//Log.info("Sim is ignoring heartbeat from proxy.");
return;
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-11-12 17:37:13 UTC (rev 571)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-11-12 17:37:16 UTC (rev 572)
@@ -357,7 +357,6 @@
}
page.setContentType(event.getStringProperty(SpaceEvent.CONTENT_TYPE));
listener.generatedSpaceEvent(event, SpaceSimulator.this);
-
} else if (SpaceEvent.UPDATE_PAGE_CONTENT_EVENT.equals(event.getName())) {
long thingID = event.getLongProperty(SpaceEvent.THING_ID).longValue();
long pageID = event.getLongProperty(SpaceEvent.PAGE_ID).longValue();
@@ -371,7 +370,6 @@
}
page.setContentType(event.getStringProperty(SpaceEvent.CONTENT_TYPE));
listener.generatedSpaceEvent(event, SpaceSimulator.this);
-
} else if (SpaceEvent.TEXT_SAY_EVENT.equals(event.getName())) {
String username = event.getStringProperty(SpaceEvent.USERNAME);
User user = space.getUser(username);
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java 2007-11-12 17:37:13 UTC (rev 571)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java 2007-11-12 17:37:16 UTC (rev 572)
@@ -63,20 +63,20 @@
private ClientMessageHandler clientMessageHandler = new ClientMessageHandler();
private Timer outgoingHeartbeatTimer = new Timer();
-
- private long lastIncomingHeartbeat = 0L;
+ private long lastSentSimHeartbeat = 0L;
+
private static final long HEARTBEAT_INTERVAL_TO_SIM = 5000;
-
+
//needed because we are CLIENT of the sim servlet and need to know how to reach it
private WebAPIDescriptor descriptor;
-
+
public MessageProxy(SessionFactory sessionFactory, WebAPIDescriptor descriptor) throws IOException {
ArgumentUtils.assertNotNull(sessionFactory);
this.sessionFactory = sessionFactory;
- this.descriptor=descriptor;
+ this.descriptor = descriptor;
channelServer = new NetworkChannelServer(clientMessageHandler, descriptor.getCometProxyURI(), true, this);
- Log.info("Started Message Proxy on port " + channelServer.getLocator().getPort()+" with target of "+descriptor.getCometSimURI());
+ Log.info("Started Message Proxy on port " + channelServer.getLocator().getPort() + " with target of " + descriptor.getCometSimURI());
outgoingHeartbeatTimer.schedule(new OutgoingHeartbeatTask(), 5000, 60000);
}
@@ -85,7 +85,7 @@
PayloadFactory.HeartbeatPayload payload = new PayloadFactory.HeartbeatPayload();
Object[] locators = locatorAuths.getKeys();
for (int i = 0; i < locators.length; i++) {
- Locator remoteLocator = (Locator)locators[i];
+ Locator remoteLocator = (Locator) locators[i];
Message message = new Message(getLocator(), remoteLocator, 1, payload);
try {
channelServer.sendMessage(message);
@@ -94,14 +94,14 @@
Log.error("Heartbeat failure to " + remoteLocator, e);
logout(remoteLocator);
} catch (NoSuchDestinationException e1) {
- Log.error("Could not logout locator (" +remoteLocator +") with failed heartbeat",e1);
+ Log.error("Could not logout locator (" + remoteLocator + ") with failed heartbeat", e1);
}
}
-
+
}
}
}
-
+
public void cleanup() {
channelServer.cleanup();
outgoingHeartbeatTimer.cancel();
@@ -120,7 +120,7 @@
return channelServer.getLocator().getPort();
}
*/
-
+
private class ClientMessageHandler implements MessageHandler {
public void handleMessage(Message request, TCPChannel sourceChannel) throws NoSuchDestinationException {
try {
@@ -153,46 +153,46 @@
}
SpaceRecord spaceRecord = SpacePersistTasks.findSpaceBySpaceID(payload.getSpaceID(), sessionFactory);
- if(spaceRecord == null) {
+ if (spaceRecord == null) {
Log.error("Got an auth message for an unknown space: " + payload.getSpaceID());
Message failureMessage = new Message(channelServer.getLocator(), request.getOrigin(), payload.getSpaceID(), new PayloadFactory.AuthenticationFailurePayload("Could not find that space."));
sourceChannel.sendMessage(failureMessage);
return;
}
-
+
SimRecord simRecord = SpacePersistTasks.findOrAssignSim(spaceRecord, sessionFactory);
- if(simRecord == null) { //Oh, crap. Couldn't assign a sim
+ if (simRecord == null) { //Oh, crap. Couldn't assign a sim
Log.error("Could not assign sim for space " + spaceRecord.getSpaceID());
Message failureMessage = new Message(channelServer.getLocator(), request.getOrigin(), payload.getSpaceID(), new PayloadFactory.AuthenticationFailurePayload("Could not find a simulator for that space."));
sourceChannel.sendMessage(failureMessage);
return;
}
-
- if(username.startsWith(WebConstants.GUEST_COOKIE_PREFIX)) {
+
+ if (username.startsWith(WebConstants.GUEST_COOKIE_PREFIX)) {
URI userListURI = WebAPIUtil.appendToURI(simRecord.getSimURI(), "space/" + spaceRecord.getSpaceID() + "/user/");
XMLElement element = new WebAPIClientWire().fetchAuthenticatedXML(userListURI, null);
- if(element == null) {
+ if (element == null) {
Log.error("Could not get space user count for guest: " + payload.getSpaceID());
Message failureMessage = new Message(channelServer.getLocator(), request.getOrigin(), payload.getSpaceID(), new PayloadFactory.AuthenticationFailurePayload("Error reading that space's user count."));
sourceChannel.sendMessage(failureMessage);
return;
}
- if(!"list".equals(element.getName())){
+ if (!"list".equals(element.getName())) {
Log.error("Could not get list of users for space user count for guest: " + payload.getSpaceID());
Message failureMessage = new Message(channelServer.getLocator(), request.getOrigin(), payload.getSpaceID(), new PayloadFactory.AuthenticationFailurePayload("Error reading that space's user list."));
sourceChannel.sendMessage(failureMessage);
return;
-
+
}
int userCount = element.getChildren(UserDocument.NAME).length;
- if(userCount >= spaceRecord.getMaxGuests()) {
+ if (userCount >= spaceRecord.getMaxGuests()) {
Log.error("Refused guest to space " + spaceRecord.getSpaceID() + " for reasons of max guest limit: " + spaceRecord.getMaxGuests());
Message failureMessage = new Message(channelServer.getLocator(), request.getOrigin(), payload.getSpaceID(), new PayloadFactory.AuthenticationFailurePayload("This space has reached its guest limit."));
sourceChannel.sendMessage(failureMessage);
return;
}
}
-
+
LocatorAuth locatorAuth = new LocatorAuth(payload.getSpaceID(), username, simRecord.getSimURI());
locatorAuths.put(request.getOrigin(), locatorAuth);
@@ -200,7 +200,7 @@
sourceChannel.sendMessage(message);
Message simMessage = new Message(channelServer.getLocator(), request.getOrigin(), payload.getSpaceID(), new PayloadFactory.AuthenticatedPayload(username));
- sendMessageToSpace(locatorAuth.uri,locatorAuth.spaceID, simMessage);
+ sendMessageToSpace(locatorAuth.uri, locatorAuth.spaceID, simMessage);
return;
} else if (request.getPayload() instanceof PayloadFactory.LogoutPayload) {
request.getPayload(); //XXX is this necessary?
@@ -219,12 +219,12 @@
event.setProperty(SpaceEvent.USERNAME, locatorAuth.username);
payload.setSpaceEvent(event);
- sendMessageToSpace(locatorAuth.uri,locatorAuth.spaceID, request);
+ sendMessageToSpace(locatorAuth.uri, locatorAuth.spaceID, request);
} else if (request.getPayload() instanceof PayloadFactory.HeartbeatPayload) {
- long now=System.currentTimeMillis();
- long diff = now-lastIncomingHeartbeat;
- lastIncomingHeartbeat=now;
- if (diff>HEARTBEAT_INTERVAL_TO_SIM) {
+ long now = System.currentTimeMillis();
+ long diff = now - lastSentSimHeartbeat;
+ if (diff > HEARTBEAT_INTERVAL_TO_SIM) {
+ lastSentSimHeartbeat = now;
heartbeatToSims();
}
} else {
@@ -242,15 +242,14 @@
return;
}
Message message = new Message(remoteLocator, getLocator(), locatorAuth.spaceID, new PayloadFactory.LoggedOutPayload(locatorAuth.username));
- sendMessageToSpace(locatorAuth.uri,locatorAuth.spaceID, message);
+ sendMessageToSpace(locatorAuth.uri, locatorAuth.spaceID, message);
}
private void heartbeatToSims() throws NoSuchDestinationException {
- //Log.info("Refreshing all sims...");
synchronized (simChannels) {
Object[] channels = (Object[]) simChannels.getValues();
- for (int i=0; i<channels.length;++i) {
- URI uri=(URI)simChannels.getBackward(channels[i]);
+ for (int i = 0; i < channels.length; ++i) {
+ URI uri = (URI) simChannels.getBackward(channels[i]);
Message message = new Message(channelServer.getLocator(), getLocator(), Sim.NO_SPACE_ID, new PayloadFactory.HeartbeatPayload());
sendMessageToSpace(uri, Sim.NO_SPACE_ID, message);
}
@@ -267,13 +266,13 @@
}
private void sendToUser(Message message) {
- final PayloadFactory.ProxiedSpaceEventPayload proxyPayload = (PayloadFactory.ProxiedSpaceEventPayload)message.getPayload();
+ final PayloadFactory.ProxiedSpaceEventPayload proxyPayload = (PayloadFactory.ProxiedSpaceEventPayload) message.getPayload();
Object[] spaceClientLocators = locatorAuths.getKeys(new TwoWayMap.Filter() {
public boolean matches(Object obj) {
return ((LocatorAuth) obj).username.equals(proxyPayload.getUsername());
}
});
-
+
PayloadFactory.SpaceEventPayload eventPayload = new PayloadFactory.SpaceEventPayload(proxyPayload.getSpaceEvent());
for (int i = 0; i < spaceClientLocators.length; i++) {
Locator remoteLocator = (Locator) spaceClientLocators[i];
@@ -281,30 +280,30 @@
try {
channelServer.sendMessage(individualMessage);
} catch (Throwable e) {
- Log.error("Could not send a message to client at " + remoteLocator,e);
+ Log.error("Could not send a message to client at " + remoteLocator, e);
}
}
}
-
+
//Distribute the sim message to all clients authed to that space
//TODO fix me: this is way way too expensive just to send a sim message
private void sendToAll(final Message message) {
Object[] auths = locatorAuths.getValues();
for (int i = 0; i < auths.length; i++) {
- LocatorAuth auth = (LocatorAuth)auths[i];
- if(auth.spaceID != message.getSpaceID()) {
- continue;
+ LocatorAuth auth = (LocatorAuth) auths[i];
+ if (auth.spaceID != message.getSpaceID()) {
+ continue;
}
Locator remoteLocator = (Locator) locatorAuths.getBackward(auth);
- if(remoteLocator == null) {
+ if (remoteLocator == null) {
continue;
}
Message individualMessage = new Message(getLocator(), remoteLocator, message.getSpaceID(), message.getPayload());
try {
channelServer.sendMessage(individualMessage);
} catch (Throwable e) {
- Log.error("Could not send a message to a client at " + remoteLocator,e);
+ Log.error("Could not send a message to a client at " + remoteLocator, e);
}
}
}
@@ -324,7 +323,7 @@
try {
/*Object selector=AsyncProtoFactory.getDefaultInfo().getSimSpecificSelector();
AsyncProto proto=AsyncProtoFactory.getDefaultClient(uri.getHost(), selector);*/
- AsyncProto proto=AsyncProtoFactory.getDefaultClient(descriptor, false);
+ AsyncProto proto = AsyncProtoFactory.getDefaultClient(descriptor, false);
simChannel = new TCPChannel(proto, simMessageHandler, false, simMessageHandler, true, "sim-client");
} catch (IOException e) {
e.printStackTrace();
@@ -360,7 +359,7 @@
public LocatorAuth(long spaceID, String username, URI uri) {
this.spaceID = spaceID;
this.username = username;
- this.uri=uri;
+ this.uri = uri;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-12 17:37:09
|
Revision: 571
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=571&view=rev
Author: trevorolio
Date: 2007-11-12 09:37:13 -0800 (Mon, 12 Nov 2007)
Log Message:
-----------
Fixed a bug in which the sim comet connection was dropped due to heartbeat timing miscalculation, causing events generated via web api to not make their way back to connected clients if there were no client originated comet events. Hello, edge case.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java 2007-11-11 14:35:36 UTC (rev 570)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java 2007-11-12 17:37:13 UTC (rev 571)
@@ -418,6 +418,7 @@
if (!page.getContentType().equals(event.getStringProperty(SpaceEvent.CONTENT_TYPE))) {
page.setContentType(event.getStringProperty(SpaceEvent.CONTENT_TYPE));
}
+
} else if (SpaceEvent.UPDATE_PAGE_CONTENT_EVENT.equals(event.getName())) {
long thingID = event.getLongProperty(SpaceEvent.THING_ID).longValue();
Thing thing = space.getThing(thingID);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-11 14:35:32
|
Revision: 570
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=570&view=rev
Author: trevorolio
Date: 2007-11-11 06:35:36 -0800 (Sun, 11 Nov 2007)
Log Message:
-----------
Profiling the client revealed that most of our heap was spent on body textures, so I reduced Mike's body textures to 512x512 which looks much the same but greatly reduces his memory footprint.
Ideally we would look at memory usage and dynamically downsample textures and refetch them from cache should space reappeare, but that isn't happening just yet.
Modified Paths:
--------------
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Blue Skin.jpg
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Meet Us In Orbit.jpg
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/body.jpg
Modified: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Blue Skin.jpg
===================================================================
(Binary files differ)
Modified: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/Meet Us In Orbit.jpg
===================================================================
(Binary files differ)
Modified: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/texture/body.jpg
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-11-10 23:19:14
|
Revision: 569
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=569&view=rev
Author: trevorolio
Date: 2007-11-10 15:19:18 -0800 (Sat, 10 Nov 2007)
Log Message:
-----------
Removed a couple of server-side texture loads which slipped through the cracks, including all pages! That was a triple whammy because the space simulator fetched and rendered the page contents as well as used memory for the resulting texture. This week I'm very thankful for my profiler, which now indicates that the server is loading no textures into memory.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-11-10 23:19:14 UTC (rev 568)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-11-10 23:19:18 UTC (rev 569)
@@ -93,7 +93,6 @@
space = new Space(new SimulatorSpaceContext(), spaceDocument.getSpaceID(), spaceDocument.getDisplayName(), spaceDocument.getOwnerUsername(), spaceDocument.getDisplaySea(), spaceDocument.getSeaLevel());
- //TODO evaluate whether we should stop using Java3D on the sim side to calculate collision and motion (gut feeling: hell yes!)
renderer = new J3DRenderer(space, null, new InSimInputListener(), templateDataProvider, new InSimBodyDataProvider(), true);
renderer.startRenderer();
renderer.setSimCamera(); //Sigh, you have to add a view before it will schedule the behavior
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|