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-08-31 19:43:28
|
Revision: 311
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=311&view=rev
Author: trevorolio
Date: 2007-08-31 12:43:28 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Fixed the nastiness in the script engine in which we mangled javascript function calls using Strings. Now we use Rhino's API to find and call the functions with java argument arrays.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java 2007-08-31 19:41:31 UTC (rev 310)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java 2007-08-31 19:43:28 UTC (rev 311)
@@ -15,8 +15,6 @@
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.Map;
import java.util.Vector;
@@ -24,6 +22,7 @@
import org.mozilla.javascript.Context;
import org.mozilla.javascript.EcmaError;
+import org.mozilla.javascript.Function;
import org.mozilla.javascript.ScriptableObject;
import org.mozilla.javascript.Undefined;
@@ -51,22 +50,16 @@
private ScriptSpace scriptSpace = null;
- public static final String CONSTRUCT_SCRIPT_PREFIX = "if(typeof construct == \"function\") { construct(";
+ public static final String CONSTRUCT_FUNCTION_NAME = "construct";
- public static final String CONSTRUCT_SCRIPT_SUFFIX = "); }";
+ public static final String ONSERVICE_FUNCTION_NAME = "onService";
- public static final String ONCLICK_SCRIPT_PREFIX = "if(typeof onClick == \"function\") { onClick(";
+ private static final String ONCLICK_FUNCTION_NAME = "onClick";
- public static final String ONCLICK_SCRIPT_SUFFIX = "); }";
+ private static final String ONCONTEXTCLICK_FUNCTION_NAME = "onContextClick";
- public static final String ONCONTEXTCLICK_SCRIPT_PREFIX = "if(typeof onContextClick == \"function\") { onContextClick(";
+ private static final String ONCONTEXTMENUITEMCHOSEN_FUNCTION_NAME = "onContextMenuItemChosen";
- public static final String CONTEXT_ITEM_SELECTED = "if(typeof onContextMenuItemChosen == \"function\") { onContextMenuItemChosen(";
-
- public static final String SERVICE_SCRIPT_PREFIX = "if(typeof onService == \"function\") { onService(";
-
- public static final String SERVICE_SCRIPT_SUFFIX = "); }";
-
public SpaceScriptEngine(SpaceSimulator spaceSimulator) {
ArgumentUtils.assertNotNull(spaceSimulator);
this.spaceSimulator = spaceSimulator;
@@ -121,14 +114,23 @@
spaceSimulator.log("Constructed scriptless thing " + thing.getThingID());
return;
}
- script += CONSTRUCT_SCRIPT_PREFIX + thing.getThingID() + CONSTRUCT_SCRIPT_SUFFIX;
-
Context context = Context.enter();
try {
ScriptableObject thingScope = createThingScope(context);
- String result = evaluateScript(context, thingScope, script);
+ Object scriptResult = context.evaluateString(thingScope, script, "<cmd>", 1, null);
+ //the scriptResult will usually be the Function object for the last function defined in the template script
+ //which we usually don't care about
+ spaceSimulator.log("Initialized thing script: " + thing.getThingID());
+
+ Object[] functionArgs = { new Double(thing.getThingID()) };
+ Object callResult = callJavascriptFunction(context, thingScope, CONSTRUCT_FUNCTION_NAME, functionArgs);
+
thingScopes.put(new Long(thing.getThingID()), thingScope);
- spaceSimulator.log("Constructed thing " + thing.getThingID() + ": " + result);
+ spaceSimulator.log("Constructed thing " + thing.getThingID() + ": " + callResult);
+ } catch (EcmaError e) {
+ spaceSimulator.log("Error initializing or constructing thing " + thing.getThingID() + " at line " + e.lineNumber() + ": " + e.getErrorMessage());
+ } catch (Throwable e) {
+ spaceSimulator.log("Error initializing or constructing thing " + thing.getThingID() + ": " + e);
} finally {
Context.exit();
}
@@ -139,7 +141,7 @@
}
public void handleSpaceEvent(SpaceEvent event) {
- if ((SpaceEvent.THING_CLICKED_EVENT.equals(event.getName())) || (SpaceEvent.THING_CONTEXT_CLICKED_EVENT.equals(event.getName()))) {
+ if (SpaceEvent.THING_CLICKED_EVENT.equals(event.getName())) {
Long thingID = event.getLongProperty(SpaceEvent.THING_ID);
if (thingID == null) {
return;
@@ -149,31 +151,75 @@
return;
}
+ String functionName = ONCLICK_FUNCTION_NAME;
+ Object[] functionArgs = new Object[2];
+ functionArgs[0] = event.getStringProperty(SpaceEvent.USERNAME);
+ functionArgs[1] = event.getStringProperty(SpaceEvent.SHAPE_NAME);
+ Context context = Context.enter();
+ try {
+ Object result = callJavascriptFunction(context, thingScope, functionName, functionArgs);
+ spaceSimulator.log("Click script returned: " + Context.toString(result));
+ } finally {
+ Context.exit();
+ }
+ } else if (SpaceEvent.THING_CONTEXT_CLICKED_EVENT.equals(event.getName())) {
+ Long thingID = event.getLongProperty(SpaceEvent.THING_ID);
+ if (thingID == null) {
+ return;
+ }
+ ScriptableObject thingScope = getThingScope(thingID.longValue());
+ if (thingScope == null) {
+ return;
+ }
+
String shapeName = event.getStringProperty(SpaceEvent.SHAPE_NAME);
- String script = null;
- String prefix = ONCLICK_SCRIPT_PREFIX;
+ String username = event.getStringProperty(SpaceEvent.USERNAME);
+ long nonce = event.getLongProperty(SpaceEvent.NONCE).longValue();
- if (SpaceEvent.THING_CONTEXT_CLICKED_EVENT.equals(event.getName())) {
- prefix = ONCONTEXTCLICK_SCRIPT_PREFIX;
- }
- String username = event.getStringProperty(SpaceEvent.USERNAME);
- if (shapeName != null) {
- script = prefix + "\"" + username + "\", \"" + event.getStringProperty(SpaceEvent.SHAPE_NAME) + "\"" + ONCLICK_SCRIPT_SUFFIX;
- } else {
- script = prefix + "\"" + username + "\", null" + ONCLICK_SCRIPT_SUFFIX;
- }
+ String functionName = ONCONTEXTCLICK_FUNCTION_NAME;
+
+ Object[] functionArgs = new Object[2];
+ functionArgs[0] = username;
+ functionArgs[1] = shapeName;
+
+ SpaceEvent resultEvent = new SpaceEvent(SpaceEvent.CONTEXT_MENU_DATA_EVENT);
+ resultEvent.setProperty(SpaceEvent.NONCE, new Long(nonce));
+
Context context = Context.enter();
try {
- //the context click is called for value, the regular click for effect
- if (SpaceEvent.THING_CONTEXT_CLICKED_EVENT.equals(event.getName())) {
- String errorToClient = processScriptForContextMenuInfo(thingScope, username, event.getLongProperty(SpaceEvent.NONCE).longValue(), script, context);
+ Object callResult = callJavascriptFunction(context, thingScope, functionName, functionArgs);
+ if (callResult == null) { //no function or logged function error
+ spaceSimulator.log("No context on " + thingID);
+ spaceSimulator.getListener().generatedSpaceEventForUser(username, resultEvent, spaceSimulator);
+ return;
+ }
- if (errorToClient != null) {
- spaceSimulator.log("Error in contextmenuclick handler:" + errorToClient);
+ Object[] resultArray = convertScriptResultToArray(callResult);
+ if (resultArray == null) {
+ spaceSimulator.log("No context array on " + thingID + ": " + callResult);
+ spaceSimulator.getListener().generatedSpaceEventForUser(username, resultEvent, spaceSimulator);
+ return;
+ }
+
+ for (int i = 0; i < resultArray.length; ++i) {
+ ScriptableObject candidate = (ScriptableObject) resultArray[i];
+ if (!(candidate.getClassName().equals(ScriptContextMenuInfo.JS_CLASS_NAME))) {
+ spaceSimulator.log("Javascript Error: onContextClick(...) returned an array with things other than ContextMenuInfos: " + thingID);
+ spaceSimulator.getListener().generatedSpaceEventForUser(username, resultEvent, spaceSimulator);
+ return;
}
- } else {
- spaceSimulator.log("Click script : " + evaluateScript(context, thingScope, script));
}
+
+ //this is so we can use the same types on the client side
+ Vector changedTypeObjects = new Vector();
+ for (int i = 0; i < resultArray.length; ++i) {
+ ScriptContextMenuInfo infoWithJSBaggage = (ScriptContextMenuInfo) resultArray[i];
+ ContextMenuInfo infoNoJS = new ContextMenuInfo();
+ infoNoJS.setValues(infoWithJSBaggage.getUserVisibleString(), infoWithJSBaggage.getEnabled(), infoWithJSBaggage.getId());
+ changedTypeObjects.add(infoNoJS);
+ }
+ resultEvent.setContextMenu(changedTypeObjects);
+ spaceSimulator.getListener().generatedSpaceEventForUser(username, resultEvent, spaceSimulator);
} finally {
Context.exit();
}
@@ -188,16 +234,14 @@
}
Context context = Context.enter();
+
String username = event.getStringProperty(SpaceEvent.USERNAME);
- String script = CONTEXT_ITEM_SELECTED + "\"" + username + "\", \"" + event.getStringProperty(SpaceEvent.CONTEXT_MENU_DATA_ITEM_ID) + "\"" + ONCLICK_SCRIPT_SUFFIX;
- String result = evaluateScript(context, thingScope, script);
- spaceSimulator.log("Item selected script : " + result);
- try {
- new URL(result); //for effect of parsing it to determine if ok
- spaceSimulator.showLinkToUser(username, result, result);
- } catch (MalformedURLException e) {
- //not a URL, so we are done, assume the call was for effect
- }
+ String dataItemID = event.getStringProperty(SpaceEvent.CONTEXT_MENU_DATA_ITEM_ID);
+ Object[] functionArgs = { username, dataItemID };
+ String functionName = ONCONTEXTMENUITEMCHOSEN_FUNCTION_NAME;
+ Object callResult = callJavascriptFunction(context, thingScope, functionName, functionArgs);
+ spaceSimulator.log("Item selected script returned " + Context.toString(callResult));
+
} else if (SpaceEvent.ADD_THING_EVENT.equals(event.getName())) {
try {
Thing thing = spaceSimulator.getSpace().getThing(event.getLongProperty(SpaceEvent.THING_ID).longValue());
@@ -211,40 +255,6 @@
}
}
- private String processScriptForContextMenuInfo(ScriptableObject thingScope, String username, long nonce, String script, Context context) {
- Vector arrayOfObjects = new Vector();
- String result = evaluateScriptForArray(context, thingScope, script, arrayOfObjects);
- String errorToClient = null;
- if (result != null) {
- spaceSimulator.log("Error in script:" + result);
- errorToClient = result;
- } else {
- for (int i = 0; i < arrayOfObjects.size(); ++i) {
- ScriptableObject candidate = (ScriptableObject) arrayOfObjects.get(i);
- if (!(candidate.getClassName().equals(ScriptContextMenuInfo.JS_CLASS_NAME))) {
- errorToClient = "Should be an array of ContextMenuInfo items but had " + candidate.getClassName() + " in the array1";
- }
- }
- }
- SpaceEvent event = new SpaceEvent(SpaceEvent.CONTEXT_MENU_DATA_EVENT);
- event.setProperty(SpaceEvent.NONCE, new Long(nonce));
- if (errorToClient != null) {
- event.setProperty(SpaceEvent.CONTEXT_MENU_DATA_GENERATION_ERROR, errorToClient);
- } else {
- //this is so we can use the same types on the client side
- Vector changedTypeObjects = new Vector();
- for (int i = 0; i < arrayOfObjects.size(); ++i) {
- ScriptContextMenuInfo infoWithJSBaggage = (ScriptContextMenuInfo) arrayOfObjects.get(i);
- ContextMenuInfo infoNoJS = new ContextMenuInfo();
- infoNoJS.setValues(infoWithJSBaggage.getUserVisibleString(), infoWithJSBaggage.getEnabled(), infoWithJSBaggage.getId());
- changedTypeObjects.add(infoNoJS);
- }
- event.setContextMenu(changedTypeObjects);
- }
- spaceSimulator.getListener().generatedSpaceEventForUser(username, event, spaceSimulator);
- return errorToClient;
- }
-
private ScriptableObject createThingScope(Context context) {
ScriptableObject scriptScope = (ScriptableObject) context.newObject(globalScope);
scriptScope.setPrototype(globalScope);
@@ -252,54 +262,41 @@
return scriptScope;
}
- private String evaluateScript(Context context, ScriptableObject scriptScope, String script) {
- try {
- Object result = context.evaluateString(scriptScope, script, "<cmd>", 1, null);
- if (result == null) {
- return "null";
- } else if (result instanceof Undefined) {
- return "undefined";
- } else {
- return result.toString();
- }
- } catch (EcmaError error) {
- return getMessage(error);
- } catch (Throwable e) {
- return "Error: " + e;
+ private Object callJavascriptFunction(Context context, ScriptableObject thingScope, String functionName, Object[] functionArgs) {
+ Object functionObject = thingScope.get(functionName, thingScope);
+ if (!(functionObject instanceof Function)) {
+ return null;
+ } else {
+ Function function = (Function) functionObject;
+ return function.call(context, thingScope, thingScope, functionArgs);
}
}
- // dodgy: this returns an error message or null if things are ok
- private String evaluateScriptForArray(Context context, ScriptableObject scriptScope, String script, Vector valuesFound) {
- try {
- Object result = context.evaluateString(scriptScope, script, "<cmd>", 1, null);
- if (result == null) {
- return "null returned by javascript";
- } else if (result instanceof Undefined) {
- return "undefined value returned from javascript";
- } else if (!(result instanceof ScriptableObject)) {
- return "unexpected return type from javascript";
- }
+ private Object[] convertScriptResultToArray(Object result) {
+ if (result == null) {
+ return null;
+ } else if (result instanceof Undefined) {
+ return null;
+ } else if (!(result instanceof ScriptableObject)) {
+ return null;
+ }
- ScriptableObject obj = (ScriptableObject) result;
- if (!(obj.getClassName().equals("Array"))) {
- return "Expected Array result but got " + obj.getClassName();
- }
- Object length_raw = obj.get("length", obj);
- if ((length_raw == null) || (!(length_raw instanceof java.lang.Number))) {
- return "Internal error! Can't understand length of array in javascript!";
- }
- Number length = (Number) length_raw;
- for (int i = 0; i < length.intValue(); ++i) {
- valuesFound.add(obj.get(i, obj));
- }
+ ScriptableObject obj = (ScriptableObject) result;
+ if (!(obj.getClassName().equals("Array"))) {
+ spaceSimulator.log("Javascript Error: cannot convert " + obj.getClassName() + " to Array");
return null;
- } catch (EcmaError error) {
- return "Javascript Error:" + error.getMessage();
- } catch (Throwable e) {
- spaceSimulator.log("Caught a throwabe when evaluating script for array:" + e.getMessage());
- return "(Internal) Error:" + e.getMessage();
}
+ Object length_raw = obj.get("length", obj);
+ if ((length_raw == null) || (!(length_raw instanceof java.lang.Number))) {
+ spaceSimulator.log("Javascript error: Can't understand length of array in javascript: " + obj);
+ return null;
+ }
+ int length = ((Number) length_raw).intValue();
+ Object[] resultArray = new Object[length];
+ for (int i = 0; i < length; ++i) {
+ resultArray[i] = obj.get(i, obj);
+ }
+ return resultArray;
}
public ScriptHTTPResponse callThingService(long thingID, String method, Map parameterMap) {
@@ -311,20 +308,35 @@
}
//TODO actually pass the parameter map
- String script = SERVICE_SCRIPT_PREFIX + SERVICE_SCRIPT_SUFFIX;
+ String[] parameterNames = (String[]) parameterMap.keySet().toArray(new String[0]);
+ String[] parameterValues = new String[parameterNames.length];
+ for (int i = 0; i < parameterValues.length; i++) {
+ Object value = parameterMap.get(parameterNames[i]);
+ if (value instanceof String) {
+ parameterValues[i] = (String) parameterMap.get(parameterNames[i]);
+ } else if(value instanceof String[]){
+ String[] array = (String[])value;
+ for (int j = 0; j < array.length; j++) {
+ System.out.println(parameterNames[i] + ": " + array[j]);
+ }
+ } else {
+ System.err.println("Got an unhandled parameter type: " + parameterMap.get(parameterNames[i]).getClass());
+ }
+ }
+ Object[] functionArgs = { method, parameterNames, parameterValues };
Context context = Context.enter();
try {
- Object result = context.evaluateString(thingScope, script, "<cmd>", 1, null);
- if (result == null || result instanceof Undefined) {
+ Object callResult = callJavascriptFunction(context, thingScope, ONSERVICE_FUNCTION_NAME, functionArgs);
+ if (callResult == null || callResult instanceof Undefined) {
ScriptHTTPResponse response = new ScriptHTTPResponse();
response.jsConstructor(200, "", "text/plain");
return response;
- } else if (result instanceof ScriptHTTPResponse) {
- return (ScriptHTTPResponse) result;
+ } else if (callResult instanceof ScriptHTTPResponse) {
+ return (ScriptHTTPResponse) callResult;
} else {
- spaceSimulator.log("Javascript Error: onService returned " + result);
+ spaceSimulator.log("Javascript Error: onService returned " + callResult);
ScriptHTTPResponse response = new ScriptHTTPResponse();
- response.jsConstructor(500, "Javascript Error: onService returned " + result, null);
+ response.jsConstructor(500, "Javascript Error: onService returned " + callResult, null);
return response;
}
} catch (EcmaError error) {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-08-31 19:41:31 UTC (rev 310)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-08-31 19:43:28 UTC (rev 311)
@@ -786,6 +786,10 @@
}
Map parameterMap = request.getParameterMap();
+ //Tomcat is f'ing broken in that if there are no parameters it actually adds one with the key String "null" and a "" value: TFS
+ if(parameterMap.size() == 1 && (parameterMap.containsKey("null"))){
+ parameterMap = new HashMap();
+ }
ScriptHTTPResponse scriptResponse = simulator.callThingHTTPService(thingID, request.getMethod(), parameterMap);
response.setStatus(scriptResponse.getStatus());
if(scriptResponse.getStatus() != 200){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-31 19:41:30
|
Revision: 310
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=310&view=rev
Author: trevorolio
Date: 2007-08-31 12:41:31 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Set the logging output to ogoglio/target/tomcat5x.{log,out}
Modified Paths:
--------------
maven/trunk/ogoglio/pom.xml
Modified: maven/trunk/ogoglio/pom.xml
===================================================================
--- maven/trunk/ogoglio/pom.xml 2007-08-31 16:41:56 UTC (rev 309)
+++ maven/trunk/ogoglio/pom.xml 2007-08-31 19:41:31 UTC (rev 310)
@@ -22,6 +22,8 @@
<container>
<containerId>tomcat5x</containerId>
<home>${cargo.tomcat5x.home}</home>
+ <log>${project.build.directory}/tomcat5x.log</log>
+ <output>${project.build.directory}/tomcat5x.out</output>
</container>
<!-- tomcat configuration -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-31 16:41:58
|
Revision: 309
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=309&view=rev
Author: trevorolio
Date: 2007-08-31 09:41:56 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Tweaked the server pom to correctly bind the html generation to the code-generation build phase.
Modified Paths:
--------------
maven/trunk/ogoglio-server/pom.xml
Modified: maven/trunk/ogoglio-server/pom.xml
===================================================================
--- maven/trunk/ogoglio-server/pom.xml 2007-08-31 16:41:11 UTC (rev 308)
+++ maven/trunk/ogoglio-server/pom.xml 2007-08-31 16:41:56 UTC (rev 309)
@@ -104,7 +104,7 @@
<artifactId>dev-plugins</artifactId>
<executions>
<execution>
- <phase>prepare-package</phase>
+ <phase>generate-sources</phase>
<goals>
<goal>buildHtml</goal>
</goals>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-31 16:41:20
|
Revision: 308
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=308&view=rev
Author: trevorolio
Date: 2007-08-31 09:41:11 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Added the blessed code formatter for Eclipse.
Added Paths:
-----------
maven/trunk/ogoglio/src/main/resources/eclipse/
maven/trunk/ogoglio/src/main/resources/eclipse/EclipseCodeFormatStyle.xml
Added: maven/trunk/ogoglio/src/main/resources/eclipse/EclipseCodeFormatStyle.xml
===================================================================
--- maven/trunk/ogoglio/src/main/resources/eclipse/EclipseCodeFormatStyle.xml (rev 0)
+++ maven/trunk/ogoglio/src/main/resources/eclipse/EclipseCodeFormatStyle.xml 2007-08-31 16:41:11 UTC (rev 308)
@@ -0,0 +1,251 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<profiles version="10">
+<profile name="Transmutable Style" version="10">
+<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_comments" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="400"/>
+<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
+<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
+<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="400"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
+<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
+<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
+<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
+<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
+</profile>
+</profiles>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-08-31 16:31:20
|
Revision: 307
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=307&view=rev
Author: iansmith
Date: 2007-08-31 09:31:18 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Fixed cargo config problem with delpoy.
Modified Paths:
--------------
maven/trunk/ogoglio-server/pom.xml
Modified: maven/trunk/ogoglio-server/pom.xml
===================================================================
--- maven/trunk/ogoglio-server/pom.xml 2007-08-31 15:31:42 UTC (rev 306)
+++ maven/trunk/ogoglio-server/pom.xml 2007-08-31 16:31:18 UTC (rev 307)
@@ -17,7 +17,7 @@
<url>${my.local.repo}</url>
</snapshotRepository>
</distributionManagement>
-
+
<!-- -->
<!-- profiles -->
<!-- -->
@@ -119,7 +119,7 @@
</execution>
</executions>
</plugin>
-
+
<!-- DEPENDENCY PLUGIN: We need to pull in applets -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -186,30 +186,32 @@
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>0.3-SNAPSHOT</version>
+ <configuration>
+ <container>
+ <containerId>tomcat5x</containerId>
+ </container>
+ <!-- Configuration to use with the container -->
+ <configuration>
+ <type>existing</type>
+ <home>${ogoglio.tmp.tomcat5x}</home>
+ <!-- Deployer configuration -->
+ <deployables>
+ <deployable>
+ <properties>
+ <context>${pom.artifactId}</context>
+ </properties>
+ </deployable>
+ </deployables>
+ </configuration>
+ </configuration>
<executions>
<execution>
<id>install</id>
- <phase>integration-test</phase> <!-- just must be after packaging -->
- <goals><goal>deploy</goal></goals>
+ <phase>integration-test</phase><!-- just must be after packaging -->
+ <goals>
+ <goal>deploy</goal>
+ </goals>
<!-- CARGO CONFIG -->
- <configuration>
- <container>
- <containerId>tomcat5x</containerId>
- </container>
- <!-- Configuration to use with the container -->
- <configuration>
- <type>existing</type>
- <home>${ogoglio.tmp.tomcat5x}</home>
- <!-- Deployer configuration -->
- <deployables>
- <deployable>
- <properties>
- <context>${pom.artifactId}</context>
- </properties>
- </deployable>
- </deployables>
- </configuration>
- </configuration>
</execution>
</executions>
</plugin>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-08-31 16:30:10
|
Revision: 304
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=304&view=rev
Author: iansmith
Date: 2007-08-31 08:15:02 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Massive upgrade in pom logic.
Tomcat now behaves properly.
Converted server to use null velocity templates.
Modified Paths:
--------------
maven/trunk/ogoglio/pom.xml
maven/trunk/ogoglio-appdev/pom.xml
maven/trunk/ogoglio-body-editor-applet/pom.xml
maven/trunk/ogoglio-common/pom.xml
maven/trunk/ogoglio-integration-test/pom.xml
maven/trunk/ogoglio-server/pom.xml
maven/trunk/ogoglio-test-applet/pom.xml
maven/trunk/ogoglio-viewer-applet/pom.xml
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/GrayCheckmark.gif
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/GreenCheckmark.gif
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/account.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/admin.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/browserTests.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/createAccount.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/doorPopup.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/icons/
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/index.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/inventory.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/licenses.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/reset.css
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/signin.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/site.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/space.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceEditor.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceEmbed.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spacePopulation.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceSettings.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/spaceui.js
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/style.css
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/templateEditor.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/thingPopup.html
Removed Paths:
-------------
maven/trunk/ogoglio-server/src/main/webapp/GrayCheckmark.gif
maven/trunk/ogoglio-server/src/main/webapp/GreenCheckmark.gif
maven/trunk/ogoglio-server/src/main/webapp/account.html
maven/trunk/ogoglio-server/src/main/webapp/admin.html
maven/trunk/ogoglio-server/src/main/webapp/body.html
maven/trunk/ogoglio-server/src/main/webapp/browserTests.js
maven/trunk/ogoglio-server/src/main/webapp/createAccount.html
maven/trunk/ogoglio-server/src/main/webapp/doorPopup.html
maven/trunk/ogoglio-server/src/main/webapp/icons/
maven/trunk/ogoglio-server/src/main/webapp/index.html
maven/trunk/ogoglio-server/src/main/webapp/inventory.html
maven/trunk/ogoglio-server/src/main/webapp/licenses.html
maven/trunk/ogoglio-server/src/main/webapp/ogoglio.js
maven/trunk/ogoglio-server/src/main/webapp/reset.css
maven/trunk/ogoglio-server/src/main/webapp/signin.html
maven/trunk/ogoglio-server/src/main/webapp/site.js
maven/trunk/ogoglio-server/src/main/webapp/space.html
maven/trunk/ogoglio-server/src/main/webapp/spaceEditor.html
maven/trunk/ogoglio-server/src/main/webapp/spaceEmbed.html
maven/trunk/ogoglio-server/src/main/webapp/spacePopulation.html
maven/trunk/ogoglio-server/src/main/webapp/spaceSettings.html
maven/trunk/ogoglio-server/src/main/webapp/spaceui.js
maven/trunk/ogoglio-server/src/main/webapp/style.css
maven/trunk/ogoglio-server/src/main/webapp/templateEditor.html
maven/trunk/ogoglio-server/src/main/webapp/thingPopup.html
Modified: maven/trunk/ogoglio/pom.xml
===================================================================
--- maven/trunk/ogoglio/pom.xml 2007-08-31 14:21:53 UTC (rev 303)
+++ maven/trunk/ogoglio/pom.xml 2007-08-31 15:15:02 UTC (rev 304)
@@ -26,7 +26,7 @@
<!-- tomcat configuration -->
<configuration>
- <home>/tmp/tomcat5x</home>
+ <home>${ogoglio.tmp.tomcat5x}</home>
<properties>
<cargo.servlet.port>
8080
Modified: maven/trunk/ogoglio-appdev/pom.xml
===================================================================
--- maven/trunk/ogoglio-appdev/pom.xml 2007-08-31 14:21:53 UTC (rev 303)
+++ maven/trunk/ogoglio-appdev/pom.xml 2007-08-31 15:15:02 UTC (rev 304)
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-appdev</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
@@ -37,7 +37,7 @@
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-common</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Modified: maven/trunk/ogoglio-body-editor-applet/pom.xml
===================================================================
--- maven/trunk/ogoglio-body-editor-applet/pom.xml 2007-08-31 14:21:53 UTC (rev 303)
+++ maven/trunk/ogoglio-body-editor-applet/pom.xml 2007-08-31 15:15:02 UTC (rev 304)
@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-body-editor-applet</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
@@ -39,7 +39,7 @@
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-common</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Modified: maven/trunk/ogoglio-common/pom.xml
===================================================================
--- maven/trunk/ogoglio-common/pom.xml 2007-08-31 14:21:53 UTC (rev 303)
+++ maven/trunk/ogoglio-common/pom.xml 2007-08-31 15:15:02 UTC (rev 304)
@@ -7,7 +7,7 @@
<!-- About this project -->
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-common</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<build>
Modified: maven/trunk/ogoglio-integration-test/pom.xml
===================================================================
--- maven/trunk/ogoglio-integration-test/pom.xml 2007-08-31 14:21:53 UTC (rev 303)
+++ maven/trunk/ogoglio-integration-test/pom.xml 2007-08-31 15:15:02 UTC (rev 304)
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-integration-test</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
@@ -86,109 +86,8 @@
</execution>
</executions>
</plugin>
- <!-- CARGO FOR STOP/START THE SERVER -->
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <version>0.3-SNAPSHOT</version>
- <executions>
- <execution>
- <id>get-up</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- <configuration>
- <wait>false</wait>
- </configuration>
- </execution>
-
- <execution>
- <id>get-down</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
-
- <configuration>
- <wait>true</wait>
- <type>runtime</type>
- </configuration>
- </execution>
- <execution>
- <!-- get rid of leftover tomcat's if they exist -->
- <id>kill if exists</id>
- <phase>test</phase> <!-- just needs to be before integration test -->
- <goals>
- <goal>stop</goal>
- </goals>
- <configuration>
- <type>runtime</type>
- <wait>false</wait>
- </configuration>
- </execution>
- </executions>
-
- <!-- CARGO CONFIG -->
- <configuration>
- <!-- tomcat 5.5 running on the same machine...-->
- <container>
- <containerId>tomcat5x</containerId>
- <home>${cargo.tomcat5x.home}</home>
- <type>installed</type>
- <log>
- ${project.build.directory}/tomcat5x.log
- </log>
- <output>
- ${project.build.directory}/tomcat5x.out
- </output>
- <logLevel>debug</logLevel>
- </container>
-
- <!-- tomcat configuration -->
- <configuration>
- <home>${project.build.directory}/tomcat5x</home>
- <properties>
- <cargo.servlet.port>
- 8080
- </cargo.servlet.port>
- <cargo.logging>high</cargo.logging>
- </properties>
- <!-- our app to deploy -->
- <deployables>
- <deployable>
-
- <groupId>com.ogoglio</groupId>
- <artifactId>ogoglio-server</artifactId>
- <type>war</type>
-
- <properties>
- <context>ogoglio-server</context>
- </properties>
-
- </deployable>
- </deployables>
-
- </configuration>
- </configuration>
-
- </plugin>
-
</plugins>
</build>
- <!-- -->
- <!-- PLUGIN REPOS -->
- <!-- -->
- <pluginRepositories>
- <!-- CARGO -->
- <pluginRepository>
- <id>codehaus snapshot repository</id>
- <url>http://snapshots.repository.codehaus.org/</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- </pluginRepository>
- </pluginRepositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -201,18 +100,18 @@
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-server</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-common</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-viewer-applet</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
Modified: maven/trunk/ogoglio-server/pom.xml
===================================================================
--- maven/trunk/ogoglio-server/pom.xml 2007-08-31 14:21:53 UTC (rev 303)
+++ maven/trunk/ogoglio-server/pom.xml 2007-08-31 15:15:02 UTC (rev 304)
@@ -7,7 +7,16 @@
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-server</artifactId>
<packaging>war</packaging>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <distributionManagement>
+ <snapshotRepository>
+ <id>local-disk</id>
+ <uniqueVersion>false</uniqueVersion>
+ <name>local disk</name>
+ <url>${my.local.repo}</url>
+ </snapshotRepository>
+ </distributionManagement>
<!-- -->
<!-- profiles -->
@@ -59,8 +68,12 @@
<include>mail/*</include>
</includes>
</resource>
-
-
+ <resource>
+ <directory>src/main/resources</directory>
+ <excludes>
+ <exclude>siteTemplates</exclude>
+ </excludes>
+ </resource>
</resources>
<!-- -->
@@ -85,11 +98,29 @@
<!-- PLUGINS -->
<!-- -->
<plugins>
- <!-- CARGO -->
-
-
+ <!-- our own plugin for building the static code -->
+ <plugin>
+ <groupId>com.ogoglio</groupId>
+ <artifactId>dev-plugins</artifactId>
+ <executions>
+ <execution>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>buildHtml</goal>
+ </goals>
+ <configuration>
+ <templateDirectory>
+ src/main/resources/siteTemplates
+ </templateDirectory>
+ <targetDirectory>
+ target/${artifactId}-${version}
+ </targetDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
<!-- DEPENDENCY PLUGIN: We need to pull in applets -->
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@@ -101,25 +132,35 @@
<goal>copy</goal>
</goals>
<configuration>
- <outputDirectory>${project.build.directory}/ogoglio-server-0.0.1</outputDirectory>
+ <outputDirectory>
+ ${project.build.directory}/ogoglio-server-0.0.1
+ </outputDirectory>
<overwriteIfNewer>true</overwriteIfNewer>
<stripVersion>true</stripVersion>
<artifactItems>
<artifactItem>
<groupId>com.ogoglio</groupId>
- <artifactId>ogoglio-viewer-applet</artifactId>
+ <artifactId>
+ ogoglio-viewer-applet
+ </artifactId>
</artifactItem>
<artifactItem>
<groupId>com.ogoglio</groupId>
- <artifactId>ogoglio-body-editor-applet</artifactId>
+ <artifactId>
+ ogoglio-body-editor-applet
+ </artifactId>
</artifactItem>
<artifactItem>
<groupId>com.ogoglio</groupId>
- <artifactId>ogoglio-test-applet</artifactId>
+ <artifactId>
+ ogoglio-test-applet
+ </artifactId>
</artifactItem>
<artifactItem>
<groupId>com.ogoglio</groupId>
- <artifactId>ogoglio-common</artifactId>
+ <artifactId>
+ ogoglio-common
+ </artifactId>
</artifactItem>
</artifactItems>
</configuration>
@@ -140,7 +181,38 @@
</webResources>
</configuration>
</plugin>
-
+ <!-- CARGO FOR DEPLOY SERVER -->
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>0.3-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>install</id>
+ <phase>integration-test</phase> <!-- just must be after packaging -->
+ <goals><goal>deploy</goal></goals>
+ <!-- CARGO CONFIG -->
+ <configuration>
+ <container>
+ <containerId>tomcat5x</containerId>
+ </container>
+ <!-- Configuration to use with the container -->
+ <configuration>
+ <type>existing</type>
+ <home>${ogoglio.tmp.tomcat5x}</home>
+ <!-- Deployer configuration -->
+ <deployables>
+ <deployable>
+ <properties>
+ <context>${pom.artifactId}</context>
+ </properties>
+ </deployable>
+ </deployables>
+ </configuration>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
@@ -195,33 +267,32 @@
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-common</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-appdev</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
</dependency>
-
<!-- -->
<!-- BOGUS DEPENDENCIES-->
<!-- -->
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-viewer-applet</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-body-editor-applet</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.ogoglio</groupId>
<artifactId>ogoglio-test-applet</artifactId>
- <version>0.0.1</version>
+ <version>0.0.1-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/GrayCheckmark.gif
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/GrayCheckmark.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/GreenCheckmark.gif
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/GreenCheckmark.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/account.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/account.html (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/account.html 2007-08-31 15:15:02 UTC (rev 304)
@@ -0,0 +1,269 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<link rel="stylesheet" href="style.css" type="text/css" />
+<script type="text/javascript" src="ogoglio.js"></script>
+<script type="text/javascript" src="site.js"></script>
+
+<title>Ogoglio Example: account</title>
+<style type="text/css">
+#main {
+ overflow: hidden;
+ width: 750px;
+}
+
+#content {
+ width: 500px;
+ border-right: 250px solid #FFF;
+ margin-right: -250px;
+ float: left;
+}
+
+#rail {
+ background-color: #FFF;
+ width: 250px;
+ float: left;
+}
+
+.section {
+ border: solid 1px #CCD;
+ border-top: solid 5px #CCD;
+ margin: 0px 25px 10px 0px;
+ padding: 0px 5px 5px 5px;
+}
+
+#profileTable th {
+ text-align: right;
+}
+
+.includedFeedItem {
+ margin-top: 10px;
+}
+</style>
+<script type="text/javascript">
+var requestedUsername = locationParameters['username'];
+var spaceListXML = null;
+
+var mainElement = null;
+var titleUserElement = null;
+//var titleAccountElement = null;
+var inventoryLink = null;
+var spaceListTable = null;
+var spaceMembershipTable = null;
+var profileTable = null;
+var profileGoButton = null;
+var bodyLink = null;
+
+function handleAuth(){
+ if(requestedUsername == null){
+ mainElement.innerHTML = "<h2>No Account Requested</h2>";
+ return;
+ }
+
+ if(authedUsername == null || (authedUsername != requestedUsername)){
+ mainElement.innerHTML = "<h2>You're not logged in to this account.</h2>";
+ return;
+ }
+
+ inventoryLink.innerHTML = "<a href='inventory.html?username=" + requestedUsername + "'>Check your inventory »</a>"
+
+ requestAccountDocument(requestedUsername, handleAccount);
+ requestSpaceList(requestedUsername, handleSpaceList);
+ requestAccountMembership(requestedUsername, handleMembership);
+}
+
+function handleMembership(membershipXML){
+ if(membershipXML == null) return;
+
+ var tableHTML = "";
+ for(var i=0; i < membershipXML.childNodes.length; i++){
+ var spaceID = membershipXML.childNodes[i].getAttribute("spaceid");
+ var banned = membershipXML.childNodes[i].getAttribute("banned");
+ var role = membershipXML.childNodes[i].getAttribute("role");
+ if(i == 0){
+ tableHTML += "<tr><th>role</th><th>space</th></tr>"
+ }
+ tableHTML += "<tr>";
+ if("true" == banned){
+ tableHTML += "<td>banned</td>";
+ } else {
+ tableHTML += "<td>" + escapeHTML(role) + "</td>";
+ }
+ tableHTML += "<td><a href='space.html?spaceID=" + spaceID + "'>Space " + escapeHTML(spaceID) + "</a></td>";
+ tableHTML += "</tr>";
+ }
+ spaceMembershipTable.innerHTML = "<table>" + tableHTML + "</table>";
+}
+
+function createNewSpace(spaceName){
+ createSpace(requestedUsername, spaceName, handleNewSpace);
+}
+
+function handleNewSpace(xml){
+ requestSpaceList(requestedUsername, handleSpaceList);
+}
+
+function handleSpaceList(xml){
+ if(xml == null) return;
+
+ spaceListXML = xml;
+ setSpaceListFromSpaceListXML();
+}
+
+function setSpaceListFromSpaceListXML() {
+ if(spaceListXML == null){
+ return;
+ }
+ var tableHTML = "";
+ for(var i=0; i < spaceListXML.childNodes.length; i++){
+ var spaceID = spaceListXML.childNodes[i].getAttribute("spaceid");
+ var displayName = spaceListXML.childNodes[i].getAttribute("displayname");
+ tableHTML += "<tr>";
+ tableHTML += "<td>" + escapeHTML(displayName) + "</td>";
+ tableHTML += "<td><form onsubmit='document.location.href=\"space.html?spaceID=" + spaceID + "\"; return false;'><input type='submit' value='view'/></form></td>";
+ tableHTML += "<td><form onsubmit='document.location.href=\"spaceEditor.html?spaceID=" + spaceID + "\"; return false;'><input type='submit' value='edit'/></form></td>";
+ tableHTML += "</tr>";
+ }
+ spaceListTable.innerHTML = "<table>" + tableHTML + "</table>";
+}
+
+function handleAccount(xml){
+ if(xml == null){
+ return;
+ }
+ accountXML = xml;
+
+ titleUserElement.innerHTML = "User: " + accountXML.getAttribute("username");
+ //titleAccountElement.innerHTML = "Account Type: " + accountXML.getAttribute("accountlevel");
+ bodyLink.innerHTML = "<a href='body.html?bodyID=" + accountXML.getAttribute('defaultbodyid') + "'>Edit your body »</a>"
+ setProfileFromAccountXML();
+}
+
+function setProfileFromAccountXML(){
+ var tableHTML = generateProfileRow("email", "email", accountXML.getAttribute("email"), false);
+ tableHTML += generateProfileRow("first name", "firstname", accountXML.getAttribute("firstname"), false);
+ tableHTML += generateProfileRow("last name", "lastname", accountXML.getAttribute("lastname"), false);
+ tableHTML += generateProfileRow("homepage", "homepage", accountXML.getAttribute("homepage"), true);
+ profileTable.innerHTML = "<table>" + tableHTML + "</table>";
+}
+
+function profileGo(){
+ if(profileGoButton.value == "edit"){
+ var tableHTML = "<tr><th>email:</th><td>" + accountXML.getAttribute("email") + "</td><td></td></tr>";
+ tableHTML += generateProfileInput("first name", "firstname", accountXML.getAttribute("firstname"));
+ tableHTML += generateProfileInput("last name", "lastname", accountXML.getAttribute("lastname"));
+ tableHTML += generateProfileInput("homepage", "homepage", accountXML.getAttribute("homepage"));
+ tableHTML += generateProfileInput("password", "password", null, "blank leaves as-is");
+ tableHTML += generateProfileInput("again", "password2", null);
+ profileTable.innerHTML = "<table>" + tableHTML + "</table>";
+ profileGoButton.value = "save";
+ } else if(profileGoButton.value == "save"){
+ if(document.getElementById('password').value != document.getElementById('password2').value){
+ alert("Passwords 1 and 2 don't match.");
+ return;
+ }
+
+ profileGoButton.value = "edit";
+
+ accountXML.setAttribute("firstname", escapeHTML(document.getElementById("firstname").value));
+ accountXML.setAttribute("lastname", escapeHTML(document.getElementById("lastname").value));
+ accountXML.setAttribute("homepage", escapeHTML(document.getElementById("homepage").value));
+ accountXML.setAttribute("password", escapeHTML(document.getElementById("password").value));
+ updateAccountDocument(accountXML, handleAccount);
+ profileTable.innerHTML = "saving...";
+ }
+}
+
+function generateProfileRow(heading, field, value, link){
+ if(value == null || value.length === 0){
+ return "";
+ }
+ if(link){
+ return "<tr><th>" + heading + ":</th><td><a rel='nofollow' href='" + escapeHTML(value) +"'>" + escapeHTML(value) + "</a></td></tr>\n";
+ } else {
+ return "<tr><th>" + heading + ":</th><td>" + escapeHTML(value) + "</td></tr>\n";
+ }
+}
+
+function generateProfileInput(heading, field, value, comment) {
+ var nonNullValue = value == null ? "" : value;
+ var nonNullComment = comment == null ? "" : comment;
+ var result = "<tr><th>" + heading + ":</th><td><input id='" + field + "' name='" + field + "' type='text' value='" + escapeHTML(nonNullValue) + "' /></td><td>" + escapeHTML(nonNullComment) + "</td></tr>\n";
+ return result;
+}
+
+function init(){
+ populateMemberMenuItem();
+
+ titleUserElement = document.getElementById("titleUser");
+ //titleAccountElement = document.getElementById("titleAccount");
+ mainElement = document.getElementById("main");
+ inventoryLink = document.getElementById("inventoryLink");
+ spaceListTable = document.getElementById("spaceListTable");
+ spaceMembershipTable = document.getElementById("spaceMembershipTable");
+ profileGoButton = document.getElementById("profileGoButton");
+ profileTable = document.getElementById("profileTable");
+ bodyLink = document.getElementById("bodyLink");
+
+ addAuthListeners(handleAuth, handleAuth);
+}
+</script>
+</head>
+<body onload="init();">
+<div id="header">
+ <strong><a href="index.html">Ogoglio Example</a></strong>
+ <span id="search">
+ <!-- <form style="margin: 0px;" method="get" action="http://www.google.com/search">
+ <input type="text" size="20" name="q"/>
+ <input type="hidden" name="q" value="site:example.com"/>
+ <input type="submit" value="find"/>
+ </form> -->
+ </span>
+</div> <!-- end header -->
+
+<div id="headerMenu">
+ <a href="index.html">Home</a>
+ <span id="memberMenuItem"> </span>
+</div> <!-- end header menu -->
+
+<div id="main">
+ <h2 id="titleUser">User: loading...</h2>
+ <!-- <h3 id="titleAccount">Account Type: loading...</h3> -->
+
+ <div id="content">
+ <div class="section">
+ <h3>Profile: <input id="profileGoButton" onclick="profileGo(); return false;" type="submit" value="edit"/></h3>
+ <form id='profileForm'>
+ <div id="profileTable">
+ loading...
+ </div>
+ </form>
+ </div>
+
+ <div class="section">
+ <h3>Your spaces:</h3>
+ <div id="spaceListTable">
+ loading...
+ </div>
+ <form onsubmit="createNewSpace('New Space'); return false;"><input type="submit" value="create a new space"/></form>
+ </div>
+
+ <p class="navLink" id="bodyLink"></p>
+ <p class="navLink" id="inventoryLink"></p>
+ </div><!-- end content -->
+
+ <div id="rail">
+ <div class="section">
+ <h3>Space membership:</h3>
+ <div id="spaceMembershipTable">
+ loading...
+ </div>
+ </div>
+ </div><!-- end rail -->
+</div> <!-- end main -->
+<div id="footer">
+
+</div>
+<!-- Copyright 2007 Transmutable (http://transmutable.com/) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.-->
+</body>
+</html>
\ No newline at end of file
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/admin.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/admin.html (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/admin.html 2007-08-31 15:15:02 UTC (rev 304)
@@ -0,0 +1,264 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<link rel="stylesheet" href="style.css" type="text/css" />
+<script type="text/javascript" src="/og/ogoglio.js"></script>
+<script type="text/javascript" src="site.js"></script>
+
+<title>Ogoglio Example: admin</title>
+
+<style type="text/css">
+#main {
+ overflow: hidden;
+ width: 7680px;
+}
+
+#content {
+ width: 768px;
+ float: left;
+}
+
+#rail {
+ background-color: #FFF;
+ width: 250px;
+ float: left;
+}
+
+.section {
+ border: solid 1px #CCD;
+ border-top: solid 5px #CCD;
+ margin: 0px 25px 10px 0px;
+ padding: 0px 5px 5px 5px;
+}
+
+#profileTable th {
+ text-align: right;
+}
+
+.includedFeedItem {
+ margin-top: 10px;
+}
+</style>
+<script type="text/javascript">
+var requestedUsername = locationParameters['username'];
+
+var mainElement = null;
+var titleUserElement = null;
+var profileTable = null;
+var profileGoButton = null;
+var freezeDiv = null;
+var levelDiv = null;
+
+function handleAuth(){
+ if(requestedUsername == null){
+ mainElement.innerHTML = "<h2>No Account Requested</h2>";
+ return;
+ }
+
+ if(authedUsername == null){
+ mainElement.innerHTML = "<h2>You must log in as an admin.</h2>";
+ return;
+ }
+ requestAccountDocument(authedUsername, handleAdminTest);
+}
+
+function handleAdminTest(xml){
+ if(xml == null){
+ mainElement.innerHTML = "<h2>There was an error checking your account for admin access.</h2>";
+ return;
+ }
+ if("admin" != xml.getAttribute("accountlevel")){
+ mainElement.innerHTML = "<h2>You must be an admin to use this page.</h2>";
+ return;
+ }
+ requestAccountDocument(requestedUsername, handleAccount);
+}
+
+function handleAccount(xml){
+ if(xml == null){
+ mainElement.innerHTML = "<h2>Could not find that user: " + requestedUsername + "</h2>";
+ return;
+ }
+ accountXML = xml;
+
+ titleUserElement.innerHTML = "Administer User: " + accountXML.getAttribute("username");
+ setProfileFromAccountXML();
+}
+
+function setProfileFromAccountXML(){
+ var tableHTML = generateProfileRow("email", "email", accountXML.getAttribute("email"), false);
+ tableHTML += generateProfileRow("first name", "firstname", accountXML.getAttribute("firstname"), false);
+ tableHTML += generateProfileRow("last name", "lastname", accountXML.getAttribute("lastname"), false);
+ tableHTML += generateProfileRow("homepage", "homepage", accountXML.getAttribute("homepage"), true);
+ profileTable.innerHTML = "<table>" + tableHTML + "</table>";
+
+ var freezeHTML = "";
+ if(accountXML.getAttribute("frozenuntil")){
+ var date = new Date();
+ date.setTime(accountXML.getAttribute("frozenuntil"));
+ freezeHTML += "frozen until:<div style='color: #F00; margin: 10px;'>" + date + "</div>";
+ freezeHTML += "<form onsubmit='freezeGo(); return false;'><input type='submit' value='thaw' /></form>";
+ } else {
+ freezeHTML += "not frozen:<br/><br/>";
+ freezeHTML += "<form onsubmit='freezeGo(); return false;'><input type='submit' value='freeze' /></form>";
+ }
+ freezeDiv.innerHTML = freezeHTML;
+
+ //basic, advanced, pro, or admin
+ var levelHTML = "";
+ levelHTML += '<form id="levelForm">';
+ levelHTML += '<select onchange="levelFormGo(); return false;" id="levelSelect" name="level">';
+ levelHTML += '<option value="basic">basic</option>';
+ levelHTML += '<option value="advanced">advanced</option>';
+ levelHTML += '<option value="pro">pro</option>';
+ levelHTML += '<option value="admin">admin</option>';
+ levelHTML += '</select>';
+ levelHTML += '</form>';
+ levelDiv.innerHTML = levelHTML;
+
+ var currentLevel = accountXML.getAttribute("accountlevel");
+ var levelForm = document.getElementById("levelForm");
+ if(currentLevel == 'basic'){
+ levelForm.levelSelect.selectedIndex = 0;
+ } else if (currentLevel == 'advanced'){
+ levelForm.levelSelect.selectedIndex = 1;
+ } else if (currentLevel == 'pro'){
+ levelForm.levelSelect.selectedIndex = 2;
+ } else if (currentLevel == 'admin'){
+ levelForm.levelSelect.selectedIndex = 3;
+ }
+}
+
+function levelFormGo(){
+ var currentLevel = accountXML.getAttribute("accountlevel");
+ var levelForm = document.getElementById("levelForm");
+ var newLevel = levelForm.levelSelect.options[levelForm.levelSelect.selectedIndex].value;
+ if(newLevel == currentLevel){
+ return;
+ }
+ accountXML.setAttribute("accountlevel", newLevel);
+ updateAccountDocument(accountXML, handleAccount);
+}
+
+function freezeGo(){
+ if(accountXML.getAttribute("frozenuntil")){
+ accountXML.setAttribute("frozenuntil", 1000);
+ updateAccountDocument(accountXML, handleAccount);
+ profileTable.innerHTML = "thawing...";
+ } else {
+ accountXML.setAttribute("frozenuntil", new Date().getTime() + 1135296000000);
+ updateAccountDocument(accountXML, handleAccount);
+ profileTable.innerHTML = "freezing...";
+ }
+}
+
+function profileGo(){
+ if(profileGoButton.value == "edit"){
+ var tableHTML = "<tr><th>email:</th><td>" + accountXML.getAttribute("email") + "</td><td></td></tr>";
+ tableHTML += generateProfileInput("first name", "firstname", accountXML.getAttribute("firstname"));
+ tableHTML += generateProfileInput("last name", "lastname", accountXML.getAttribute("lastname"));
+ tableHTML += generateProfileInput("homepage", "homepage", accountXML.getAttribute("homepage"));
+ tableHTML += generateProfileInput("password", "password", null, "blank leaves as-is");
+ tableHTML += generateProfileInput("again", "password2", null);
+
+ profileTable.innerHTML = "<table>" + tableHTML + "</table>";
+ profileGoButton.value = "save";
+ } else if(profileGoButton.value == "save"){
+ if(document.getElementById('password').value != document.getElementById('password2').value){
+ alert("Passwords 1 and 2 don't match.");
+ return;
+ }
+
+ profileGoButton.value = "edit";
+
+ accountXML.setAttribute("firstname", escapeHTML(document.getElementById("firstname").value));
+ accountXML.setAttribute("lastname", escapeHTML(document.getElementById("lastname").value));
+ accountXML.setAttribute("homepage", escapeHTML(document.getElementById("homepage").value));
+ accountXML.setAttribute("password", escapeHTML(document.getElementById("password").value));
+ updateAccountDocument(accountXML, handleAccount);
+ profileTable.innerHTML = "saving...";
+ }
+}
+
+function generateProfileRow(heading, field, value, link){
+ if(value == null || value.length === 0){
+ return "";
+ }
+ if(link){
+ return "<tr><th>" + heading + ":</th><td><a rel='nofollow' href='" + escapeHTML(value) +"'>" + escapeHTML(value) + "</a></td></tr>\n";
+ } else {
+ return "<tr><th>" + heading + ":</th><td>" + escapeHTML(value) + "</td></tr>\n";
+ }
+}
+
+function generateProfileInput(heading, field, value, comment) {
+ var nonNullValue = value == null ? "" : value;
+ var nonNullComment = comment == null ? "" : comment;
+ var result = "<tr><th>" + heading + ":</th><td><input id='" + field + "' name='" + field + "' type='text' value='" + escapeHTML(nonNullValue) + "' /></td><td>" + escapeHTML(nonNullComment) + "</td></tr>\n";
+ return result;
+}
+
+function init(){
+ populateMemberMenuItem();
+
+ titleUserElement = document.getElementById("titleUser");
+ mainElement = document.getElementById("main");
+ profileGoButton = document.getElementById("profileGoButton");
+ profileTable = document.getElementById("profileTable");
+ freezeDiv = document.getElementById("freezeDiv");
+ levelDiv = document.getElementById("levelDiv");
+
+ addAuthListeners(handleAuth, handleAuth);
+}
+</script>
+</head>
+<body onload="init();">
+<div id="header">
+ <strong><a href="index.html">Ogoglio Example</a></strong>
+ <span id="search">
+ <!-- <form style="margin: 0px;" method="get" action="http://www.google.com/search">
+ <input type="text" size="20" name="q"/>
+ <input type="hidden" name="q" value="site:example.com"/>
+ <input type="submit" value="find"/>
+ </form> -->
+ </span>
+</div> <!-- end header -->
+
+<div id="headerMenu">
+ <a href="index.html">Home</a>
+ <span id="memberMenuItem"> </span>
+</div> <!-- end header menu -->
+
+<div id="main">
+ <h2 style="color: #4F4;" id="titleUser">Administer User: loading...</h2>
+
+ <div id="content">
+ <div class="section">
+ <h3>Profile: <input id="profileGoButton" onclick="profileGo(); return false;" type="submit" value="edit"/></h3>
+ <form id='profileForm'>
+ <div id="profileTable">
+ loading...
+ </div>
+ </form>
+ </div>
+ <div class="section">
+ <h3>Account level:</h3>
+ <div id="levelDiv">
+ loading...
+ </div>
+ </div>
+
+ <div class="section">
+ <h3>Account status:</h3>
+ <div id="freezeDiv">
+ loading...
+ </div>
+ </div>
+ </div><!-- end content -->
+</div> <!-- end main -->
+<div id="footer">
+
+</div>
+<!-- Copyright 2007 Transmutable (http://transmutable.com/) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.-->
+</body>
+</html>
\ No newline at end of file
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html 2007-08-31 15:15:02 UTC (rev 304)
@@ -0,0 +1,127 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<link rel="stylesheet" href="style.css" type="text/css" />
+<script type="text/javascript" src="/og/ogoglio.js"></script>
+<script type="text/javascript" src="site.js"></script>
+
+<title>Ogoglio Example: body</title>
+<style type="text/css">
+#main {
+ overflow: hidden;
+ width: 750px;
+}
+
+.section {
+ border: solid 1px #CCD;
+ border-top: solid 5px #CCD;
+ margin: 0px 25px 10px 0px;
+ padding: 0px 5px 5px 5px;
+}
+
+p {
+ margin: 10px 0px 10px 0px;
+}
+
+#appletDiv {
+ width: 500px;
+ height: 500px;
+}
+</style>
+
+<script type="text/javascript">
+var bodyID = locationParameters['bodyID'];
+var loginCookie = getCookie('loginCookie');
+
+var titleElement = null;
+var mainElement = null;
+var titleElement = null;
+var appletDiv = null;
+
+var bodyXML = null;
+
+function handleAuth(){
+ if(loginCookie == null){
+ mainElement.innerHTML = "<h2>Please sign in to use this page.</h2>";
+ return;
+ }
+
+ if(bodyID == null){
+ mainElement.innerHTML = "<h2>Error: somehow you arrived here without the parameters.</h2> (dang)";
+ return;
+ }
+
+ if(authedUsername == null){
+ mainElement.innerHTML = "<h2>Please log in.</h2>";
+ return;
+ }
+
+ requestBodyDocument(authedUsername, bodyID, handleBody);
+}
+
+function handleBody(xml){
+ if(xml == null) {
+ mainElement.innerHTML = "Couldn't read body information.";
+ return;
+ }
+ bodyXML = xml;
+ titleElement.innerHTML = escapeHTML(bodyXML.getAttribute("displayname"));
+ writeApplet();
+}
+
+function writeApplet(){
+ if(loginCookie == null){
+ appletDiv.innerHTML = "No cookie. Please sign in or register as a guest.";
+ return;
+ }
+ var serviceURI = getServiceURI();
+ var html = "<applet id='viewer' codebase='" + serviceURI + "' code='com.ogoglio.bodyeditor.BodyEditorApplet' archive='ogoglio-common.jar,ogoglio-body-editor-applet.jar' width='500' height='500' mayscript='true'>";
+ html += "<param name='loginCookie' value='" + loginCookie + "' />";
+ html += "<param name='serviceURI' value='" + getServiceURI() + "' />";
+ html += "<param name='image' value='" + appPath + "/icons/32x32/face-monkey.png' />";
+ html += "</applet>";
+
+ appletDiv.innerHTML = html;
+}
+
+function init(){
+ populateMemberMenuItem();
+
+ titleElement = document.getElementById("title");
+ mainElement = document.getElementById("main");
+ appletDiv = document.getElementById("appletDiv");
+
+ addAuthListeners(handleAuth, handleAuth);
+}
+</script>
+</head>
+<body onload="init();">
+
+<div id="header">
+ <strong><a href="index.html">Ogoglio Example</a></strong>
+ <span id="search">
+ <!-- <form style="margin: 0px;" method="get" action="http://www.google.com/search">
+ <input type="text" size="20" name="q"/>
+ <input type="hidden" name="q" value="site:example.com"/>
+ <input type="submit" value="find"/>
+ </form> -->
+ </span>
+</div> <!-- end header -->
+
+<div id="headerMenu">
+ <a href="index.html">Home</a>
+ <span id="memberMenuItem"> </span>
+</div> <!-- end header menu -->
+
+<div id="main">
+ <h2 id="title">Loading...</h2>
+ <div id="appletDiv"> </div>
+
+</div> <!-- end main -->
+
+<div id="footer">
+
+</div>
+<!-- Copyright 2007 Transmutable (http://transmutable.com/) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.-->
+</body>
+</html>
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/browserTests.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/browserTests.js (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/browserTests.js 2007-08-31 15:15:02 UTC (rev 304)
@@ -0,0 +1,160 @@
+var testedCookieName = 'ogoglioBrowserTested';
+
+var requirementTests = new Array();
+var hasTestedCookie = getCookie(testedCookieName) == "true";
+
+function PlatformTest(theTitle, theDescription, theFailureMessage, theTestFunction){
+ var that = this;
+ this.title = theTitle;
+ this.description = theDescription;
+ this.failureMessage = theFailureMessage;
+ this.testFunction = theTestFunction;
+}
+
+PlatformTest.prototype.runTest = function (testSpan) {
+ return this.testFunction(testSpan);
+}
+
+function testJavascript(){
+ return true;
+}
+requirementTests[requirementTests.length] = new PlatformTest("Checking that Javascript is enabled", "", "You must enable Javascript.", testJavascript);
+
+
+function testJava(testSpan){
+ try {
+ var jarURI = getServiceURI() + "/ogoglio-test-applet.jar";
+ var appletHTML = "<applet id='testApplet' name='testApplet' code='com.ogoglio.testapplet.TestApplet' archive='" + jarURI + "' width='1' height='1'></applet>";
+ testSpan.innerHTML = appletHTML;
+ while(typeof document.testApplet == "undefined"){
+ for(i=0; i < 100; i++) setTimeout('this = "something";', 5000);
+ }
+ if((typeof document.testApplet == "undefined")) {
+ requirementTests[1].failureMessage = "Unfortunately, Java support was not found in this browser.<br/>" + javaErrorMessage;
+ return false;
+ }
+ if(!document.testApplet.doesExist()){
+ requirementTests[1].failureMessage = "Unfortunately, we could not communicate with the applet.<br/>" + javaErrorMessage;
+ return false;
+ }
+ if(!document.testApplet.hasAcceptableJava()){
+ requirementTests[1].failureMessage = "Unfortunately, this version of java is not supported: " + document.testApplet.getJavaVersion() + "<br/>" + javaErrorMessage;
+ return false;
+ }
+ if(!document.testApplet.hasJava3D()){
+ var j3dVersion = document.testApplet.getJava3DVersion();
+ if(j3dVersion == null){
+ requirementTests[1].failureMessage = "Unfortunately, you do not have Java3D installed.<br/>" + javaErrorMessage;
+ } else {
+ requirementTests[1].failureMessage = "Unfortunately, this version of Java3D is not supported: " + j3dVersion + javaErrorMessage + "<br/>";
+ }
+ return false;
+ }
+ if(!document.testApplet.canStartJava3D()){
+ requirementTests[1].failureMessage = "Unfortunately, you have Java3D but it can not initialize." + javaErrorMessage + "<br/>";
+ }
+ return true;
+ } catch (error){
+ requirementTests[1].failureMessage = "Unfortunately, Java support was not found in this browser." + javaErrorMessage + "<br/>";
+ return false;
+ }
+ return false;
+}
+var javaErrorMessage = "<br/><br/>Please check that Java support is enabled in your browser preferences.";
+javaErrorMessage += "<br/>If your computer needs Java, use the online installer from <a href='http://java.com/en/download/manual.jsp'>Java.com</a>.<br/>";
+javaErrorMessage += "<br/>If your computer needs Java3D, a quick installer is available <a href='http://java.sun.com/products/java-media/3D/download.html'>here</a>.";
+requirementTests[requirementTests.length] = new PlatformTest("Checking for Java support", "Java displays the 3D views.", javaErrorMessage, testJava);
+
+var currentTestIndex = -1;
+var running = false;
+
+function BrowserTester(){
+ this.listener = null;
+}
+
+BrowserTester.prototype.runTests = function(aCallback){
+ this.callback = aCallback;
+ currentTestIndex = 0;
+ running = true;
+ setTimeout("browserTester.test();", 100);
+}
+
+BrowserTester.prototype.test = function(){
+ var watchdog = setTimeout("browserTester.timedOut();", 10000);
+
+ var title = document.getElementById("requirementTitle" + currentTestIndex);
+ var description = document.getElementById("requirementDescription" + currentTestIndex);
+ var testSpan = document.getElementById("requirementTest" + currentTestIndex);
+
+ title.style.color = "#000";
+ description.style.color = "#000";
+
+ if(requirementTests[currentTestIndex].runTest(testSpan) == true){
+ clearTimeout(watchdog);
+ this.succeed();
+ } else {
+ clearTimeout(watchdog);
+ this.fail();
+ }
+}
+
+BrowserTester.prototype.succeed = function(){
+ if(running == false) return;
+
+ var title = document.getElementById("requirementTitle" + currentTestIndex);
+ var description = document.getElementById("requirementDescription" + currentTestIndex);
+ var testSpan = document.getElementById("requirementTest" + currentTestIndex);
+
+ title.style.color = "#0F0";
+ title.innerHTML = title.innerHTML + "<img id='requirementCheck" + currentTestIndex + "' align='center' src='" + getServiceURI() + "/GreenCheckmark.gif'/>";
+ description.style.color = "#0F0";
+
+ currentTestIndex++;
+ if(currentTestIndex >= requirementTests.length){
+ running = false;
+ this.callback(true);
+ } else {
+ setTimeout("browserTester.test(" + currentTestIndex + ");", 100);
+ }
+}
+
+BrowserTester.prototype.fail = function(){
+ if(running == false) return;
+ running = false;
+
+ var title = document.getElementById("requirementTitle" + currentTestIndex);
+ var description = document.getElementById("requirementDescription" + currentTestIndex);
+ var testSpan = document.getElementById("requirementTest" + currentTestIndex);
+
+ title.style.color = "#FF0000";
+ description.style.color = "#000";
+ var message = requirementTests[currentTestIndex].failureMessage;
+ description.innerHTML = message;
+ this.callback(false);
+}
+
+BrowserTester.prototype.timedOut = function(){
+ if(running == false) return;
+ running = false;
+ this.fail();
+}
+
+var browserTester = new BrowserTester();
+
+
+function writeRequirementTestUI(targetElement){
+ var html = "<ol style='margin: 10px;'>";
+ for(var i=0; i < requirementTests.length; i++){
+ html += "<li id='requirementLI" + i + "'>";
+ html += "<h2 id='requirementTitle" + i + "'>";
+ html += requirementTests[i].title + ": ";
+ html += "</h2>";
+ html += "<p id='requirementDescription" + i + "' >" + requirementTests[i].description + "</p>";
+ html += "<span id='requirementTest" + i + "'> </span>";
+ html += "</li>";
+ }
+ html += "</ol>";
+ targetElement.innerHTML = html;
+}
+
+// Copyright 2007 Transmutable (http://transmutable.com/) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Added: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/createAccount.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/createAccount.html (rev 0)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/createAccount.html 2007-08-31 15:15:02 UTC (rev 304)
@@ -0,0 +1,775 @@
+var appPath = "/og"; //do not put a slash on the end
+
+function getServiceURI(){
+ var locLink = document.location;
+ return locLink.protocol + "//" + locLink.host + appPath;
+}
+
+
+//BEGIN GENERAL UTILS
+function parseLocationParameters(){
+ var paramPhrases = location.search.substring(1, location.search.length).split("&");
+ var paramDict = new Object();
+ for(var i=0; i < paramPhrases.length; i++){
+ paramDict[paramPhrases[i].split("=")[0]] = paramPhrases[i].split("=")[1];
+ }
+ return paramDict;
+}
+
+var locationParameters = parseLocationParameters();
+
+function getFloatParameter(paramName, defaultValue){
+ var value = locationParameters[paramName];
+ if(typeof value == 'undefined' || value == null){
+ return defaultValue;
+ }
+ try {
+ return parseFloat(value);
+ } catch (error){
+ return defaultValue;
+ }
+}
+
+function getIntParameter(paramName, defaultValue){
+ var value = locationParameters[paramName];
+ if(typeof value == 'undefined' || value == null){
+ return defaultValue;
+ }
+ try {
+ return parseInt(value);
+ } catch (error){
+ return defaultValue;
+ }
+}
+
+var isIE = false;
+if (window.ActiveXObject) {
+ isIE = true;
+}
+
+function XMLRequestManager(theURL, theListener){
+ var that = this;
+ this.url = theURL;
+ this.listener = theListener;
+ this.request = getXMLHttpRequest();
+ this.method = "GET";
+
+ function processRequestChange() {
+ if(that.request.readyState == 4){
+ if(that.request.status == 200){
+ if(that.request.responseXML && that.request.responseXML.documentElement && that.listener.handleResponseXML ){
+ that.listener.handleResponseXML(that.request.responseXML);
+ } else if(that.request.responseText != "undefined" && that.listener.handleResponseText){
+ that.listener.handleResponseText(that.request.responseText);
+ } else {
+ that.listener.handleFailure("Found the file, but it is not a handled type (text or xml)");
+ }
+ } else {
+ that.listener.handleFailure(that.request.statusText);
+ }
+ }
+ }
+ this.request.onreadystatechange = processRequestChange;
+}
+
+XMLRequestManager.prototype.setMethod = function (newMethod) {
+ this.method = newMethod;
+}
+
+XMLRequestManager.prototype.send = function (data, contentType) {
+ if(this.method == "DELETE"){ //a workaround for WebKit's tendency to do only GET and POST
+ if(this.url.indexOf("?") == -1){
+ this.url += "?method=DELETE";
+ } else {
+ this.url += "&method=DELETE";
+ }
+ }
+
+ this.request.open(this.method, this.url, true);
+ if(data){
+ if(contentType != null){
+ this.request.setRequestHeader('Content-Type', contentType);
+ } else {
+ this.request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+ }
+ this.request.send(data);
+ } else if(isIE){
+ this.request.send();
+ } else {
+ this.request.send(null);
+ }
+}
+
+
+function BasicHTTPListener(callbackFunction) {
+ this.callback = callbackFunction;
+}
+
+BasicHTTPListener.prototype.handleResponseXML = function (responseXML) {
+ this.callback(responseXML.documentElement);
+}
+
+BasicHTTPListener.prototype.handleResponseText = function (responseText) {
+ this.callback(responseText);
+}
+
+BasicHTTPListener.prototype.handleFailure = function (statusText) {
+ this.callback(null);
+}
+
+function getXMLHttpRequest(){
+ if (window.XMLHttpRequest) {
+ return new XMLHttpRequest();
+ } else if (window.ActiveXObject) {
+ return new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ return null;
+}
+
+function getFirstChildByTagName(localName, parentNode){
+ var children = parentNode.childNodes;
+ for(var i=0; children[i]; i++){
+ if(children[i].name == localName || children[i].nodeName == localName || children[i].localName == localName){
+ return children[i];
+ }
+ }
+}
+
+function trim(str) {
+ return str.replace(/^\s*|\s*$/g,"");
+}
+
+function shorten(str, len){
+ if(typeof str == "undefined" || str == null || str.length <= len){
+ return str;
+ }
+ return str.substring(0, len);
+}
+
+function trimPX(value){
+ if(value.indexOf("px") != -1){
+ value = value.substring(0, value.indexOf("px"));
+ }
+ return value;
+}
+
+function clip(text, maxLength, elipseText){
+ var eLength = elipseText == null ? 0 : elipseText.length;
+ if(text == null || text.length <= maxLength){
+ return text;
+ }
+ return text.substring(0, maxLength - eLength) + (elipseText == null ? "" : elipseText);
+}
+
+function popUp(URL, decorated, width, height) {
+ var id = "page-" + new Date().getTime();
+ var params = "";
+ if(typeof width != "undefined"){
+ params += ",width=" + width;
+ }
+ if(typeof height != undefined){
+ params += ",height=" + height;
+ }
+ if(decorated == null || decorated == true){
+ params += ',toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1';
+ }
+ return window.open(URL, id, params);
+}
+
+function getCookie(name) {
+ var dc = document.cookie;
+ var prefix = name + "=";
+ var begin = dc.indexOf("; " + prefix);
+ if (begin == -1) {
+ begin = dc.indexOf(prefix);
+ if (begin != 0) return null;
+ } else {
+ begin += 2;
+ }
+ var end = document.cookie.indexOf(";", begin);
+ if (end == -1) {
+ end = dc.length;
+ }
+ return unescapeHTML(dc.substring(begin + prefix.length, end));
+}
+
+function debug(message){
+ var debugDiv = document.getElementById('debugMessages');
+ if(debugDiv == null || typeof debugDiv == "undefined"){
+ return;
+ }
+ debugDiv.innerHTML += message + "<br/>";
+}
+//this only serializes simple XML and it casts all tag and attribute names to lower case
+//TODO handle all the various warts of XML
+function serializeXML(xml){
+ var result = "<" + xml.tagName.toLowerCase();
+
+ var attributes = xml.attributes;
+ for (var i = 0; i < attributes.length; i++){
+ result += " " + attributes.item(i).name.toLowerCase() + "='" + escapeHTML(attributes.item(i).value) + "'";
+ }
+ var hasText = (typeof xml.text != "undefined") && xml.text.length != 0;
+
+ if(!hasText && xml.childNodes.length == 0){
+ result += " />";
+
+ return result;
+ } else {
+ result += ">";
+ }
+
+ if(hasText){
+ result += xml.text;
+ }
+
+ for(var i = 0; i < xml.childNodes.length; i++){
+ result += serializeXML(xml.childNodes[i]);
+ }
+ result += "</" + xml.tagName.toLowerCase() + ">";
+ return result;
+}
+
+function escapeHTML(xml){
+ if(xml == null || xml.length == 0){
+ return xml;
+ }
+ return xml.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
+};
+
+function unescapeHTML(xml){
+ return xml.replace(/'/g,"'").replace(/"/g,"\"").replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&");
+};
+
+// BEGIN QUATERION CLASS
+
+function Quaternion(wValue, xValue, yValue, zValue){
+ this.w = wValue;
+ this.x = xValue;
+ this.y = yValue;
+ this.z = zValue;
+ this.normalize();
+}
+
+Quaternion.prototype.set = function(wValue, xValue, yValue, zValue){
+ this.w = wValue;
+ this.x = xValue;
+ this.y = yValue;
+ this.z = zValue;
+ this.normalize();
+}
+
+Quaternion.prototype.normalize = function(){
+ var norm = (this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
+
+ if (norm > 0.0) {
+ norm = 1.0 / Math.sqrt(norm);
+ this.x *= norm;
+ this.y *= norm;
+ this.z *= norm;
+ this.w *= norm;
+ } else {
+ this.x = 0.0;
+ this.y = 0.0;
+ this.z = 0.0;
+ this.w = 0.0;
+ }
+}
+
+Quaternion.prototype.mul = function(q1){
+ var nw = this.w * q1.w - this.x * q1.x - this.y * q1.y - this.z * q1.z;
+ var nx = this.w * q1.x + q1.w * this.x + this.y * q1.z - this.z * q1.y;
+ var ny = this.w * q1.y + q1.w * this.y - this.x * q1.z + this.z * q1.x;
+ this.z = this.w * q1.z + q1.w * this.z + this.x * q1.y - this.y * q1.x;
+ this.w = nw;
+ this.x = nx;
+ this.y = ny;
+ this.normalize();
+}
+
+Quaternion.prototype.rotateEuler = function(rotX, rotY, rotZ){
+ var quat = new Quaternion(1, 0, 0, 0);
+ quat.setEuler(rotX, rotY, rotZ);
+ this.mul(quat);
+}
+
+Quaternion.prototype.toString = function(){
+ return "<" + this.w + ", " + this.x + ", " + this.y + ", " + this.z + ">";
+}
+
+Quaternion.prototype.setEuler = function(rotX, rotY, rotZ){
+ var c1 = Math.cos(rotY / 2);
+ var c2 = Math.cos(rotX / 2);
+ var c3 = Math.cos(rotZ / 2);
+ var s1 = Math.sin(rotY / 2);
+ var s2 = Math.sin(rotX / 2);
+ var s3 = Math.sin(rotZ / 2);
+
+ this.w = (c1 * c2 * c3) - (s1 * s2 * s3);
+ this.x = (s1 * s2 * c3) + (c1 * c2 * s3);
+ this.y = (s1 * c2 * c3) + (c1 * s2 * s3);
+ this.z = (c1 * s2 * c3) - (s1 * c2 * s3);
+ this.normalize();
+}
+
+Quaternion.prototype.getEuler = function(){
+ var heading = 0;
+ var attitude = 0;
+ var bank = 0;
+ if(this.x * this.y + this.z * this.w == 0.5){ //North Pole
+ attitude = Math.PI / 2;
+ bank = 0;
+ heading = 2 * Math.atan2(this.x, this.w);
+ } else if (this.x * this.y + this.z * this.w == -0.5) { // South Pole
+ attitude = -Math.PI / 2;
+ heading = -2 * Math.atan2(this.x, this.w)
+ bank = 0;
+ } else {
+ heading = Math.atan2(2 * this.y * this.w - 2 * this.x * this.z, 1 - 2 * (this.y * this.y) - 2 * (this.z * this.z)) % (2 * Math.PI);
+ attitude = Math.asin(2 * this.x * this.y + 2 * this.z * this.w) % (2 * Math.PI);
+ bank = Math.atan2(2 * this.x * this.w - 2 * this.y * this.z , 1 - 2 * (this.x * this.x) - 2 * (this.z * this.z)) % (2 * Math.PI);
+ }
+ return new Array(cleanRotation(attitude), cleanRotation(heading), cleanRotation(bank));
+}
+
+function cleanRotation(rotation){ //in radians
+ while(rotation < 0){
+ rotation += 2 * Math.PI;
+ }
+ while(rotation >= 2 * Math.PI){
+ rotation -= 2 * Math.PI;
+ }
+ if(rotation < 0.0001){
+ return 0;
+ }
+ return rotation.toFixed(4);
+}
+
+//BEGIN AUTH UTILS
+
+var completedAuthRequest = false;
+var authedUsername = null;
+var authedUserLevel = null;
+var errorText = null;
+
+
+function logout(){
+ var logoutRequestManager = new XMLRequestManager(appPath + "/auth?logout=true", new AuthListener());
+ logoutRequestManager.send();
+}
+
+function addAuthListeners(authFunction, failedFunction){
+ authedListeners[authedListeners.length] = authFunction;
+ failedListeners[failedListeners.length] = failedFunction;
+ if(completedAuthRequest){
+ if(authedUsername == null){
+ failedFunction();
+ } else {
+ authFunction();
+ }
+ }
+}
+
+var authedListeners = new Array();
+var failedListeners = new Array();
+
+function AuthListener() {
+}
+
+AuthListener.prototype.handleResponseXML = function (responseXML) {
+ var xmlDoc = responseXML.documentElement;
+ var successAttribute = xmlDoc.getAttribute('authenticated');
+ var idAttribute = xmlDoc.getAttribute('username');
+ var levelAttribute = xmlDoc.getAttribute('accountlevel');
+
+ if(successAttribute == "true" && typeof idAttribute != "undefined" && typeof levelAttribute != "undefined") {
+ authedUsername = idAttribute;
+ authedUserLevel = levelAttribute;
+
+ for(var i=0; i < authedListeners.length; i++){
+ authedListeners[i]();
+ }
+ completedAuthRequest = true;
+ } else {
+ authedUsername = null;
+ for(var i=0; i < authedListeners.length; i++){
+ authedListeners[i]();
+ }
+ completedAuthRequest = true;
+ }
+}
+
+AuthListener.prototype.handleFailure = function (statusText) {
+ for(var i=0;i < failedListeners.length; i++){
+ failedListeners[i]();
+ }
+ errorText = statusText;
+ completedAuthRequest = true;
+ authedUsername = null;
+}
+
+var authRequestManager = new XMLRequestManager(appPath + "/auth", new AuthListener());
+authRequestManager.send();
+
+function login(username, password){
+ if(!username || trim(username).length == 0 || !password || trim(password).length == 0){
+ return;
+ }
+
+ var manager = new XMLRequestManager(appPath + "/auth", new AuthListener());
+
+ manager.setMethod("POST");
+ manager.send("username=" + trim(username) + "&password=" + trim(password));
+}
+
+function requestMyAuthDocument(listener){
+ new XMLRequestManager(appPath + "/auth/me", new BasicHTTPListener(listener)).send();
+}
+
+function requestGuestCookie(listener){
+ var manager = new XMLRequestManager(appPath + "/auth/guest", new BasicHTTPListener(listener));
+ manager.setMethod("POST");
+ manager.send();
+}
+
+// BEGIN ACCOUNT UTILS
+
+function createAccount(username, email, listener){
+ var xml = document.createElement("account");
+ xml.setAttribute("username", username);
+ xml.setAttribute("email", email);
+ xml.setAttribute("accountlevel", "basic");
+ var manager = new XMLRequ...
[truncated message content] |
|
From: <ian...@us...> - 2007-08-31 15:42:33
|
Revision: 306
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=306&view=rev
Author: iansmith
Date: 2007-08-31 08:31:42 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Moved plugin repo to sourceforge.
Added Paths:
-----------
maven/trunk/dev-plugins/.classpath
maven/trunk/dev-plugins/.project
maven/trunk/dev-plugins/pom.xml
maven/trunk/dev-plugins/src/
maven/trunk/dev-plugins/src/main/
maven/trunk/dev-plugins/src/main/java/
maven/trunk/dev-plugins/src/main/java/com/
maven/trunk/dev-plugins/src/main/java/com/transmutable/
maven/trunk/dev-plugins/src/main/java/com/transmutable/plugin/
maven/trunk/dev-plugins/src/main/java/com/transmutable/plugin/StaticVelocitySitePlugin.java
maven/trunk/dev-plugins/src/main/resources/
maven/trunk/dev-plugins/src/test/
maven/trunk/dev-plugins/src/test/java/
maven/trunk/dev-plugins/src/test/resources/
Property Changed:
----------------
maven/trunk/dev-plugins/
Property changes on: maven/trunk/dev-plugins
___________________________________________________________________
Name: svn:ignore
+ target
Added: maven/trunk/dev-plugins/.classpath
===================================================================
--- maven/trunk/dev-plugins/.classpath (rev 0)
+++ maven/trunk/dev-plugins/.classpath 2007-08-31 15:31:42 UTC (rev 306)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="src" output="target/test-classes" 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"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: maven/trunk/dev-plugins/.project
===================================================================
--- maven/trunk/dev-plugins/.project (rev 0)
+++ maven/trunk/dev-plugins/.project 2007-08-31 15:31:42 UTC (rev 306)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>dev-plugins</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: maven/trunk/dev-plugins/pom.xml
===================================================================
--- maven/trunk/dev-plugins/pom.xml (rev 0)
+++ maven/trunk/dev-plugins/pom.xml 2007-08-31 15:31:42 UTC (rev 306)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.ogoglio</groupId>
+ <artifactId>dev-plugins</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip><!-- this is critical to avoid running unit tests -->
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>1.5</version>
+ </dependency>
+ </dependencies>
+
+</project>
+
Added: maven/trunk/dev-plugins/src/main/java/com/transmutable/plugin/StaticVelocitySitePlugin.java
===================================================================
--- maven/trunk/dev-plugins/src/main/java/com/transmutable/plugin/StaticVelocitySitePlugin.java (rev 0)
+++ maven/trunk/dev-plugins/src/main/java/com/transmutable/plugin/StaticVelocitySitePlugin.java 2007-08-31 15:31:42 UTC (rev 306)
@@ -0,0 +1,103 @@
+package com.transmutable.plugin;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.velocity.exception.ResourceNotFoundException;
+
+/**
+ * @goal buildHtml
+ */
+public class StaticVelocitySitePlugin extends AbstractMojo {
+
+ /**
+ * @parameter
+ */
+ private File templateDirectory;
+ /**
+ * @parameter
+ */
+ private File targetDirectory;
+
+ public void execute() throws MojoExecutionException {
+
+ if (targetDirectory.exists()==false) {
+ if (targetDirectory.mkdir()==false) {
+ getLog().error("Unable to create target directory:"+targetDirectory.getName());
+ throw new MojoExecutionException("Bad target directory");
+ }
+ }
+
+ try {
+ VelocityEngine engine = new VelocityEngine();
+ engine.setProperty("file.resource.loader.path", templateDirectory.getCanonicalPath());
+ engine.init();
+
+ VelocityContext velocityContext = new VelocityContext();
+
+ File[] children = templateDirectory.listFiles();
+ for (int i = 0; children != null && i < children.length; i++) {
+ if (children[i].getName().endsWith(".html")) {
+ Template template = engine.getTemplate(children[i].getName());
+ File output = new File(targetDirectory, children[i].getName());
+ BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(output)));
+ template.merge(velocityContext, writer);
+ writer.flush();
+ writer.close();
+ } else if (children[i].getName().endsWith(".vm")) { //ignore velocity fragments
+ continue;
+ } else if(children[i].getName().equals(".svn")) { //ignore svn dir
+ continue;
+ } else {
+ copy(children[i], targetDirectory);
+ }
+ }
+ } catch (ResourceNotFoundException rnfe) {
+ getLog().error(rnfe);
+ throw new MojoExecutionException("Can't find resource",rnfe);
+ } catch (ParseErrorException pee) {
+ getLog().warn("Syntax error in template:" + pee);
+ throw new MojoExecutionException("Bad syntax",pee);
+ } catch (Exception e) {
+ throw new MojoExecutionException("Unexpected exception",e);
+ }
+
+ }
+
+ private void copy(File source, File destinationDirectory) throws IOException {
+ if(source.isDirectory()){
+ File newDir = new File(destinationDirectory, source.getName());
+ newDir.mkdir();
+ File[] children = source.listFiles();
+ for (int i = 0; i < children.length; i++) {
+ copy(children[i], newDir);
+ }
+ } else {
+ File newFile = new File(destinationDirectory, source.getName());
+ if(newFile.exists() && source.lastModified() == newFile.lastModified()){
+ return;
+ }
+ FileOutputStream output = new FileOutputStream(newFile);
+ FileInputStream input = new FileInputStream(source);
+ byte[] buff = new byte[2048];
+ int read = 0;
+ while( (read = input.read(buff)) > 0){
+ output.write(buff, 0, read);
+ }
+ output.flush();
+ output.close();
+ input.close();
+ }
+ }
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-08-31 15:30:02
|
Revision: 305
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=305&view=rev
Author: iansmith
Date: 2007-08-31 08:29:32 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Initial import.
Added Paths:
-----------
maven/trunk/dev-plugins/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-08-31 14:36:30
|
Revision: 303
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=303&view=rev
Author: iansmith
Date: 2007-08-31 07:21:53 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Initial commit of ogoglio project pom.
Added Paths:
-----------
maven/trunk/ogoglio/.classpath
maven/trunk/ogoglio/.project
maven/trunk/ogoglio/pom.xml
maven/trunk/ogoglio/src/
maven/trunk/ogoglio/src/main/
maven/trunk/ogoglio/src/main/java/
maven/trunk/ogoglio/src/main/resources/
maven/trunk/ogoglio/src/test/
maven/trunk/ogoglio/src/test/java/
maven/trunk/ogoglio/src/test/resources/
Property Changed:
----------------
maven/trunk/ogoglio/
Property changes on: maven/trunk/ogoglio
___________________________________________________________________
Name: svn:ignore
+ target
Added: maven/trunk/ogoglio/.classpath
===================================================================
--- maven/trunk/ogoglio/.classpath (rev 0)
+++ maven/trunk/ogoglio/.classpath 2007-08-31 14:21:53 UTC (rev 303)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="src" output="target/test-classes" 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"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: maven/trunk/ogoglio/.project
===================================================================
--- maven/trunk/ogoglio/.project (rev 0)
+++ maven/trunk/ogoglio/.project 2007-08-31 14:21:53 UTC (rev 303)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>ogoglio</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: maven/trunk/ogoglio/pom.xml
===================================================================
--- maven/trunk/ogoglio/pom.xml (rev 0)
+++ maven/trunk/ogoglio/pom.xml 2007-08-31 14:21:53 UTC (rev 303)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>ogoglio</groupId>
+ <artifactId>ogoglio</artifactId>
+ <version>0.0.1-snapshot</version>
+ <packaging>pom</packaging>
+
+ <build>
+ <plugins>
+ <!-- CARGO FOR STOP/START THE SERVER -->
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>0.3-SNAPSHOT</version>
+ <!-- CARGO CONFIG -->
+
+ <configuration>
+ <!-- tomcat 5.5 running on the same machine...-->
+ <container>
+ <containerId>tomcat5x</containerId>
+ <home>${cargo.tomcat5x.home}</home>
+ </container>
+
+ <!-- tomcat configuration -->
+ <configuration>
+ <home>/tmp/tomcat5x</home>
+ <properties>
+ <cargo.servlet.port>
+ 8080
+ </cargo.servlet.port>
+ </properties>
+ <!-- nothing to deploy -->
+ <deployables></deployables>
+ </configuration>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-08-31 14:36:30
|
Revision: 302
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=302&view=rev
Author: iansmith
Date: 2007-08-31 07:21:16 -0700 (Fri, 31 Aug 2007)
Log Message:
-----------
Initial import.
Added Paths:
-----------
maven/trunk/ogoglio/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-31 03:40:43
|
Revision: 301
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=301&view=rev
Author: trevorolio
Date: 2007-08-30 20:40:40 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Added a bridge between the external URL space and things, so now template scripts can be directly addressed via HTTP, and info panels are just iFrames showing a thing's service page.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/MultiuserTests.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIDescriptor.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/SpaceEvent.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/MultiuserTests.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/MultiuserTests.java 2007-08-31 03:40:36 UTC (rev 300)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/MultiuserTests.java 2007-08-31 03:40:40 UTC (rev 301)
@@ -109,9 +109,7 @@
public void contextItemChosen(Thing thing, long nonce, String id) {
}
- public void receivedInfoPanel(long sourceThingID, String panelHTML) {
- // TODO Auto-generated method stub
-
+ public void receivedInfoPanel(long sourceThingID, String nonce) {
}
}
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-08-31 03:40:36 UTC (rev 300)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java 2007-08-31 03:40:40 UTC (rev 301)
@@ -522,9 +522,9 @@
listener.receivedLink(displayName, link);
} else if (SpaceEvent.SHOW_INFO_PANEL_EVENT.equals(event.getName())) {
- String panelHTML = event.getStringProperty(SpaceEvent.INFO_PANEL_HTML);
+ String nonce = event.getStringProperty(SpaceEvent.INFO_PANEL_NONCE);
long sourceThingID = event.getLongProperty(SpaceEvent.THING_ID).longValue();
- listener.receivedInfoPanel(sourceThingID, panelHTML);
+ listener.receivedInfoPanel(sourceThingID, nonce);
} else if (SpaceEvent.RELOAD_THING_EVENT.equals(event.getName())) {
long thingID = event.getLongProperty(SpaceEvent.THING_ID).longValue();
@@ -655,7 +655,7 @@
public interface Listener {
public void receivedChatMessage(String username, String message);
- public void receivedInfoPanel(long sourceThingID, String panelHTML);
+ public void receivedInfoPanel(long sourceThingID, String nonce);
public void contextItemChosen(Thing thing, long nonce, String id);
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java 2007-08-31 03:40:36 UTC (rev 300)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java 2007-08-31 03:40:40 UTC (rev 301)
@@ -371,6 +371,14 @@
return (ThingDocument[]) results.toArray(new ThingDocument[0]);
}
+ public String getThingService(long spaceID, long thingID) throws IOException {
+ InputStream stream = wire.fetchAuthenticatedStream(descriptor.getThingServiceURI(spaceID, thingID), authenticator.getAuthCookie());
+ if(stream == null){
+ return null;
+ }
+ return StreamUtils.readInput(stream);
+ }
+
public PageDocument[] getPageDocuments(long spaceID, long thingID) throws IOException {
Vector results = new Vector();
@@ -512,5 +520,5 @@
public WebAPIClientWire getWire() {
return wire;
}
+}
-}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIDescriptor.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIDescriptor.java 2007-08-31 03:40:36 UTC (rev 300)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIDescriptor.java 2007-08-31 03:40:40 UTC (rev 301)
@@ -99,6 +99,10 @@
return WebAPIUtil.appendToURI(getThingsURI(spaceID), thingID + "/");
}
+ public URI getThingServiceURI(long spaceID, long thingID) {
+ return WebAPIUtil.appendToURI(getThingURI(spaceID, thingID), "service/");
+ }
+
public URI getReloadThingURI(long spaceID, long thingID) {
return WebAPIUtil.appendToURI(getThingsURI(spaceID), thingID + "/?reload=true");
}
@@ -158,5 +162,4 @@
public URI getServiceStateURI() {
return WebAPIUtil.appendToURI(getSpacesURI(), "state/");
}
-
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/SpaceEvent.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/SpaceEvent.java 2007-08-31 03:40:36 UTC (rev 300)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/SpaceEvent.java 2007-08-31 03:40:40 UTC (rev 301)
@@ -219,7 +219,7 @@
public static final String SHOW_INFO_PANEL_EVENT = "ShowInfoPanelEvent";
- public static final String INFO_PANEL_HTML = "infoPanelHTML";
+ public static final String INFO_PANEL_NONCE = "infoPanelNonce";
private String name = null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-31 03:40:40
|
Revision: 300
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=300&view=rev
Author: trevorolio
Date: 2007-08-30 20:40:36 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Added a bridge between the external URL space and things, so now template scripts can be directly addressed via HTTP, and info panels are just iFrames showing a thing's service page.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
maven/trunk/ogoglio-server/src/main/webapp/spaceui.js
maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptHTTPResponse.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-08-31 03:40:29 UTC (rev 299)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-08-31 03:40:36 UTC (rev 300)
@@ -36,6 +36,7 @@
import com.ogoglio.client.model.Template;
import com.ogoglio.client.model.Thing;
import com.ogoglio.client.model.User;
+import com.ogoglio.sim.script.ScriptHTTPResponse;
import com.ogoglio.sim.script.SpaceScriptEngine;
import com.ogoglio.util.ArgumentUtils;
import com.ogoglio.util.BlockingQueue;
@@ -454,11 +455,11 @@
listener.generatedSpaceEventForUser(username, spaceEvent, this);
}
- public void showInfoPanelToUser(long sourceThingID, String username, String infoPanelHTML) {
+ public void showInfoPanelToUser(long sourceThingID, String username, String nonce) {
SpaceEvent spaceEvent = new SpaceEvent(SpaceEvent.SHOW_INFO_PANEL_EVENT);
spaceEvent.setProperty(SpaceEvent.USERNAME, username);
spaceEvent.setProperty(SpaceEvent.THING_ID, new Long(sourceThingID));
- spaceEvent.setProperty(SpaceEvent.INFO_PANEL_HTML, infoPanelHTML);
+ spaceEvent.setProperty(SpaceEvent.INFO_PANEL_NONCE, nonce);
listener.generatedSpaceEventForUser(username, spaceEvent, this);
}
@@ -979,6 +980,17 @@
thing.reload();
}
+ public ScriptHTTPResponse callThingHTTPService(long thingID, String method, Map parameterMap) {
+ Thing thing = space.getThing(thingID);
+ if(thing == null){
+ ScriptHTTPResponse response = new ScriptHTTPResponse();
+ response.jsConstructor(404, null, null);
+ return response;
+ } else {
+ return scriptEngine.callThingService(thingID, method, parameterMap);
+ }
+ }
+
public Map getSettings() {
synchronized (settings) {
return (Map) settings.clone();
Added: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptHTTPResponse.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptHTTPResponse.java (rev 0)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptHTTPResponse.java 2007-08-31 03:40:36 UTC (rev 300)
@@ -0,0 +1,56 @@
+package com.ogoglio.sim.script;
+
+import org.mozilla.javascript.ScriptableObject;
+
+
+public class ScriptHTTPResponse extends ScriptableObject {
+
+ private int status = -1;
+
+ private String message = null;
+
+ private String mimeType = null;
+
+ public void jsConstructor(double status, String message, String mimeType) {
+ this.status = (int)status;
+ this.message = message;
+ this.mimeType = mimeType;
+ }
+
+ public double jsGet_status() {
+ return status;
+ }
+
+ public String jsGet_message() {
+ return message;
+ }
+
+ public String jsGet_mimeType(){
+ return mimeType;
+ }
+
+ public String getClassName() {
+ return "HTTPResponse";
+ }
+
+ public Object getDefaultValue(Object hint) {
+ return toString();
+ }
+
+ public String toString() {
+ return getClassName();
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public String getMIMEType() {
+ return mimeType;
+ }
+
+}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java 2007-08-31 03:40:29 UTC (rev 299)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java 2007-08-31 03:40:36 UTC (rev 300)
@@ -108,8 +108,8 @@
return spaceSimulator.removeSetting(key);
}
- public void jsFunction_showInfoPanel(double sourceThingID, String username, String infoPanelHTML){
- spaceSimulator.showInfoPanelToUser((long)sourceThingID, username, infoPanelHTML);
+ public void jsFunction_showInfoPanel(double sourceThingID, String username, String nonce){
+ spaceSimulator.showInfoPanelToUser((long)sourceThingID, username, nonce);
}
public void jsFunction_log(String message) {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java 2007-08-31 03:40:29 UTC (rev 299)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/SpaceScriptEngine.java 2007-08-31 03:40:36 UTC (rev 300)
@@ -17,6 +17,7 @@
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Map;
import java.util.Vector;
import javax.media.j3d.Transform3D;
@@ -56,11 +57,16 @@
public static final String ONCLICK_SCRIPT_PREFIX = "if(typeof onClick == \"function\") { onClick(";
+ public static final String ONCLICK_SCRIPT_SUFFIX = "); }";
+
public static final String ONCONTEXTCLICK_SCRIPT_PREFIX = "if(typeof onContextClick == \"function\") { onContextClick(";
public static final String CONTEXT_ITEM_SELECTED = "if(typeof onContextMenuItemChosen == \"function\") { onContextMenuItemChosen(";
- public static final String ONCLICK_SCRIPT_SUFFIX = "); }";
+ public static final String SERVICE_SCRIPT_PREFIX = "if(typeof onService == \"function\") { onService(";
+
+ public static final String SERVICE_SCRIPT_SUFFIX = "); }";
+
public SpaceScriptEngine(SpaceSimulator spaceSimulator) {
ArgumentUtils.assertNotNull(spaceSimulator);
this.spaceSimulator = spaceSimulator;
@@ -76,8 +82,9 @@
ScriptableObject.defineClass(globalScope, ScriptSpace.class);
ScriptableObject.defineClass(globalScope, ScriptMath.class);
ScriptableObject.defineClass(globalScope, ScriptHTTPRequest.class);
+ ScriptableObject.defineClass(globalScope, ScriptHTTPResponse.class);
ScriptableObject.defineClass(globalScope, ScriptContextMenuInfo.class);
-
+
scriptSpace = (ScriptSpace) constructorContext.newObject(globalScope, "Space", new Object[0]);
scriptSpace.setSpaceSimulator(spaceSimulator);
globalScope.put("space", globalScope, scriptSpace);
@@ -127,13 +134,17 @@
}
}
+ private ScriptableObject getThingScope(long thingID) {
+ return (ScriptableObject) thingScopes.getForward(new Long(thingID));
+ }
+
public void handleSpaceEvent(SpaceEvent event) {
if ((SpaceEvent.THING_CLICKED_EVENT.equals(event.getName())) || (SpaceEvent.THING_CONTEXT_CLICKED_EVENT.equals(event.getName()))) {
Long thingID = event.getLongProperty(SpaceEvent.THING_ID);
if (thingID == null) {
return;
}
- ScriptableObject thingScope = (ScriptableObject) thingScopes.getForward(thingID);
+ ScriptableObject thingScope = getThingScope(thingID.longValue());
if (thingScope == null) {
return;
}
@@ -155,11 +166,10 @@
try {
//the context click is called for value, the regular click for effect
if (SpaceEvent.THING_CONTEXT_CLICKED_EVENT.equals(event.getName())) {
- String errorToClient = processScriptForContextMenuInfo(thingScope,username, event.getLongProperty(SpaceEvent.NONCE).longValue(),
- script, context);
-
- if (errorToClient!=null) {
- spaceSimulator.log("Error in contextmenuclick handler:"+errorToClient);
+ String errorToClient = processScriptForContextMenuInfo(thingScope, username, event.getLongProperty(SpaceEvent.NONCE).longValue(), script, context);
+
+ if (errorToClient != null) {
+ spaceSimulator.log("Error in contextmenuclick handler:" + errorToClient);
}
} else {
spaceSimulator.log("Click script : " + evaluateScript(context, thingScope, script));
@@ -172,13 +182,14 @@
if (thingID == null) {
return;
}
- ScriptableObject thingScope = (ScriptableObject) thingScopes.getForward(thingID);
+ ScriptableObject thingScope = getThingScope(thingID.longValue());
if (thingScope == null) {
return;
}
+
Context context = Context.enter();
String username = event.getStringProperty(SpaceEvent.USERNAME);
- String script = CONTEXT_ITEM_SELECTED + "\"" + username + "\", \"" + event.getStringProperty(SpaceEvent.CONTEXT_MENU_DATA_ITEM_ID) + "\"" + ONCLICK_SCRIPT_SUFFIX ;
+ String script = CONTEXT_ITEM_SELECTED + "\"" + username + "\", \"" + event.getStringProperty(SpaceEvent.CONTEXT_MENU_DATA_ITEM_ID) + "\"" + ONCLICK_SCRIPT_SUFFIX;
String result = evaluateScript(context, thingScope, script);
spaceSimulator.log("Item selected script : " + result);
try {
@@ -188,7 +199,7 @@
//not a URL, so we are done, assume the call was for effect
}
} else if (SpaceEvent.ADD_THING_EVENT.equals(event.getName())) {
- try {
+ try {
Thing thing = spaceSimulator.getSpace().getThing(event.getLongProperty(SpaceEvent.THING_ID).longValue());
if (thing != null) {
constructThingScript(thing);
@@ -198,41 +209,34 @@
}
}
-
- //find the scripts that could response
-
- //for each responding script
- // hand the event and the script to an interpreter queue
-
}
private String processScriptForContextMenuInfo(ScriptableObject thingScope, String username, long nonce, String script, Context context) {
- Vector arrayOfObjects=new Vector();
+ Vector arrayOfObjects = new Vector();
String result = evaluateScriptForArray(context, thingScope, script, arrayOfObjects);
String errorToClient = null;
- if (result!=null) {
- spaceSimulator.log("Error in script:"+result);
+ if (result != null) {
+ spaceSimulator.log("Error in script:" + result);
errorToClient = result;
} else {
- for (int i=0; i<arrayOfObjects.size();++i) {
- ScriptableObject candidate = (ScriptableObject)arrayOfObjects.get(i);
+ for (int i = 0; i < arrayOfObjects.size(); ++i) {
+ ScriptableObject candidate = (ScriptableObject) arrayOfObjects.get(i);
if (!(candidate.getClassName().equals(ScriptContextMenuInfo.JS_CLASS_NAME))) {
- errorToClient = "Should be an array of ContextMenuInfo items but had "+candidate.getClassName() +" in the array1";
+ errorToClient = "Should be an array of ContextMenuInfo items but had " + candidate.getClassName() + " in the array1";
}
}
}
SpaceEvent event = new SpaceEvent(SpaceEvent.CONTEXT_MENU_DATA_EVENT);
event.setProperty(SpaceEvent.NONCE, new Long(nonce));
- if (errorToClient!=null) {
- event.setProperty(SpaceEvent.CONTEXT_MENU_DATA_GENERATION_ERROR,errorToClient);
+ if (errorToClient != null) {
+ event.setProperty(SpaceEvent.CONTEXT_MENU_DATA_GENERATION_ERROR, errorToClient);
} else {
//this is so we can use the same types on the client side
- Vector changedTypeObjects=new Vector();
- for (int i=0; i<arrayOfObjects.size();++i) {
- ScriptContextMenuInfo infoWithJSBaggage=(ScriptContextMenuInfo)arrayOfObjects.get(i);
- ContextMenuInfo infoNoJS=new ContextMenuInfo();
- infoNoJS.setValues(infoWithJSBaggage.getUserVisibleString(),
- infoWithJSBaggage.getEnabled(), infoWithJSBaggage.getId());
+ Vector changedTypeObjects = new Vector();
+ for (int i = 0; i < arrayOfObjects.size(); ++i) {
+ ScriptContextMenuInfo infoWithJSBaggage = (ScriptContextMenuInfo) arrayOfObjects.get(i);
+ ContextMenuInfo infoNoJS = new ContextMenuInfo();
+ infoNoJS.setValues(infoWithJSBaggage.getUserVisibleString(), infoWithJSBaggage.getEnabled(), infoWithJSBaggage.getId());
changedTypeObjects.add(infoNoJS);
}
event.setContextMenu(changedTypeObjects);
@@ -264,7 +268,7 @@
return "Error: " + e;
}
}
-
+
// dodgy: this returns an error message or null if things are ok
private String evaluateScriptForArray(Context context, ScriptableObject scriptScope, String script, Vector valuesFound) {
try {
@@ -276,27 +280,66 @@
} else if (!(result instanceof ScriptableObject)) {
return "unexpected return type from javascript";
}
-
- ScriptableObject obj=(ScriptableObject)result;
+
+ ScriptableObject obj = (ScriptableObject) result;
if (!(obj.getClassName().equals("Array"))) {
- return "Expected Array result but got "+obj.getClassName();
+ return "Expected Array result but got " + obj.getClassName();
}
Object length_raw = obj.get("length", obj);
- if ((length_raw==null) || (!(length_raw instanceof java.lang.Number))){
+ if ((length_raw == null) || (!(length_raw instanceof java.lang.Number))) {
return "Internal error! Can't understand length of array in javascript!";
}
- Number length= (Number)length_raw;
- for (int i=0; i<length.intValue();++i) {
+ Number length = (Number) length_raw;
+ for (int i = 0; i < length.intValue(); ++i) {
valuesFound.add(obj.get(i, obj));
}
return null;
} catch (EcmaError error) {
- return "Javascript Error:"+error.getMessage();
+ return "Javascript Error:" + error.getMessage();
} catch (Throwable e) {
- spaceSimulator.log("Caught a throwabe when evaluating script for array:"+e.getMessage());
- return "(Internal) Error:"+e.getMessage();
- }
+ spaceSimulator.log("Caught a throwabe when evaluating script for array:" + e.getMessage());
+ return "(Internal) Error:" + e.getMessage();
+ }
}
+
+ public ScriptHTTPResponse callThingService(long thingID, String method, Map parameterMap) {
+ ScriptableObject thingScope = getThingScope(thingID);
+ if (thingScope == null) {
+ ScriptHTTPResponse response = new ScriptHTTPResponse();
+ response.jsConstructor(200, "", "text/plain");
+ return response;
+ }
+
+ //TODO actually pass the parameter map
+ String script = SERVICE_SCRIPT_PREFIX + SERVICE_SCRIPT_SUFFIX;
+ Context context = Context.enter();
+ try {
+ Object result = context.evaluateString(thingScope, script, "<cmd>", 1, null);
+ if (result == null || result instanceof Undefined) {
+ ScriptHTTPResponse response = new ScriptHTTPResponse();
+ response.jsConstructor(200, "", "text/plain");
+ return response;
+ } else if (result instanceof ScriptHTTPResponse) {
+ return (ScriptHTTPResponse) result;
+ } else {
+ spaceSimulator.log("Javascript Error: onService returned " + result);
+ ScriptHTTPResponse response = new ScriptHTTPResponse();
+ response.jsConstructor(500, "Javascript Error: onService returned " + result, null);
+ return response;
+ }
+ } catch (EcmaError error) {
+ spaceSimulator.log("Javascript Error: in onService: " + error.getErrorMessage());
+ ScriptHTTPResponse response = new ScriptHTTPResponse();
+ response.jsConstructor(500, "Javascript Error: in onService: " + error.getErrorMessage(), null);
+ return response;
+ } catch (Throwable e) {
+ spaceSimulator.log("Javascript Error: in onService: " + e);
+ ScriptHTTPResponse response = new ScriptHTTPResponse();
+ response.jsConstructor(500, "Javascript Error: in onService: " + e, null);
+ return response;
+ }
+ }
+
public static String getMessage(EcmaError e) {
return "Error at line " + e.lineNumber() + " column " + e.columnNumber() + (e.lineSource() == null ? " " : "(" + e.lineSource() + ")") + e.getErrorMessage();
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-08-31 03:40:29 UTC (rev 299)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-08-31 03:40:36 UTC (rev 300)
@@ -41,9 +41,9 @@
import com.ogoglio.sim.SpaceSimulator;
import com.ogoglio.sim.script.ScriptContextFactory;
import com.ogoglio.sim.script.ScriptHTTPRequest;
+import com.ogoglio.sim.script.ScriptHTTPResponse;
import com.ogoglio.site.AuthServlet;
import com.ogoglio.site.OgoglioServletBase;
-import com.ogoglio.site.SiteInfo;
import com.ogoglio.site.SpaceServlet;
import com.ogoglio.util.StreamUtils;
import com.ogoglio.xml.DoorDocument;
@@ -748,11 +748,63 @@
}
}
+ private class ThingServiceResource extends SiteResource {
+ public ThingServiceResource() {
+ super("service");
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
+ doScriptService(request, response, pathElements);
+ }
+
+ public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
+ doScriptService(request, response, pathElements);
+ }
+
+ public void doScriptService(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
+ try {
+ long spaceID = Long.parseLong(pathElements[2]);
+ SpaceRecord spaceRecord = SpacePersistTasks.findSpaceBySpaceID(spaceID, getSessionFactory());
+ if (spaceRecord == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+
+ AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
+ if (authedAccount == null) {
+ response.setStatus(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
+
+ SpaceSimulator simulator = sim.getOrCreateSpaceSimulator(spaceRecord);
+
+ long thingID = Long.parseLong(pathElements[4]);
+ ThingDocument thingDoc = simulator.getThingDocument(thingID);
+ if(thingDoc == null){
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+
+ Map parameterMap = request.getParameterMap();
+ ScriptHTTPResponse scriptResponse = simulator.callThingHTTPService(thingID, request.getMethod(), parameterMap);
+ response.setStatus(scriptResponse.getStatus());
+ if(scriptResponse.getStatus() != 200){
+ return;
+ }
+ sendStringResponse(scriptResponse.getMessage(), scriptResponse.getMIMEType(), response);
+ } catch (PersistException e){
+ e.printStackTrace();
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ }
+ }
+
private class ThingResource extends SiteResource {
public ThingResource() {
super(SiteResource.LONG_ELEMENT);
addSubResource(new PagesResource());
+ addSubResource(new ThingServiceResource());
}
public void doDelete(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
Modified: maven/trunk/ogoglio-server/src/main/webapp/spaceui.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/spaceui.js 2007-08-31 03:40:29 UTC (rev 299)
+++ maven/trunk/ogoglio-server/src/main/webapp/spaceui.js 2007-08-31 03:40:36 UTC (rev 300)
@@ -200,7 +200,7 @@
//############## Start Info Panel Functions ##################
var infoPanels = new Array();
-function addInfoPanel(id, panelHTML){
+function addInfoPanel(id, nonce){
var infoDiv = document.getElementById("infoDiv");
if(infoDiv == null){
return;
@@ -217,15 +217,22 @@
infoActionDiv.style.textAlign = "right";
infoActionDiv.style.backgroundColor = "#F00";
var closeActionAnchor = document.createElement("a");
- closeActionAnchor.setAttribute("href", "hmmm.html");
+ closeActionAnchor.setAttribute("href", "error.html");
closeActionAnchor.setAttribute("onclick", "removeInfoPanel(" + id + "); return false;");
closeActionAnchor.appendChild(document.createTextNode("close"));
infoActionDiv.appendChild(closeActionAnchor);
infoPanelElement.appendChild(infoActionDiv);
- var panelHTMLWrapperDiv = document.createElement("div");
- panelHTMLWrapperDiv.innerHTML = panelHTML;
- infoPanelElement.appendChild(panelHTMLWrapperDiv);
+ var panelHTMLWrapper = document.createElement("iframe");
+ panelHTMLWrapper.setAttribute("width", "270");
+ panelHTMLWrapper.setAttribute("height", "270");
+ var spaceID = locationParameters["spaceID"];
+ var thingURI = getServiceURI() + "/space/" + spaceID + "/thing/" + id + "/service";
+ if(nonce != null){
+ thingURI += "?nonce=" + nonce;
+ }
+ panelHTMLWrapper.setAttribute("src", thingURI);
+ infoPanelElement.appendChild(panelHTMLWrapper);
if(infoPanels[id] != null){
infoDiv.replaceChild(infoPanelElement, infoPanels[id]);
@@ -237,15 +244,6 @@
}
}
-Array.prototype.remove=function(s){
- for(i=0;i<this .length;i++){
- if(s==this[i]) {
- this.splice(i, 1);
- break;
- }
- }
-}
-
function removeInfoPanel(id){
var infoDiv = document.getElementById("infoDiv");
if(infoDiv == null){
@@ -255,7 +253,7 @@
return;
}
infoDiv.removeChild(infoPanels[id]);
- infoPanels.remove(infoPanels[id]);
+ infoPanels[id] = null;
}
// Copyright 2007 Transmutable (http://transmutable.com/) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Modified: maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java
===================================================================
--- maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java 2007-08-31 03:40:29 UTC (rev 299)
+++ maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java 2007-08-31 03:40:36 UTC (rev 300)
@@ -45,7 +45,7 @@
listener.scriptMap.put(new Long(2), constructorScript);
listener.objMap.put(new Long(2), "templates/TestCube.obj");
listener.resourceMap.put(new Long(2), "templates/TestCube.mtl");
- thingDoc = spaceSimulator.addThing(templateDoc2.getTemplateID(), templateDoc2.getOwnerUsername(), templateDoc2.getDisplayName(), "trevor", 2, new Transform3D());
+ thingDoc = spaceSimulator.addThing(templateDoc2.getTemplateID(), templateDoc2.getOwnerUsername(), templateDoc2.getDisplayName(), "trevor", 2, new Transform3D());
assertTrue(spaceSimulator.removeThing(thingDoc.getThingID()));
try {
@@ -54,7 +54,8 @@
e.printStackTrace();
}
} finally {
- spaceSimulator.cleanup();
+ if (spaceSimulator != null)
+ spaceSimulator.cleanup();
}
}
@@ -81,7 +82,7 @@
HashMap templateMap = new HashMap(); //Long templateIDs to TemplateDocuments
HashMap objMap = new HashMap(); //Long templateIDs to obj resource names
-
+
HashMap resourceMap = new HashMap(); //Long templateIDs to template resource names
public void generatedSpaceEvent(SpaceEvent event, SpaceSimulator spaceSimulator) {
@@ -99,16 +100,16 @@
}
public InputStream getTemplateGeometryStream(long templateID, int lodIndex) {
- String resourcePath = (String)objMap.get(new Long(templateID));
- if(resourcePath == null){
+ String resourcePath = (String) objMap.get(new Long(templateID));
+ if (resourcePath == null) {
return null;
}
return UIConstants.getResource(resourcePath);
}
public InputStream getTemplateResourceStream(long templateID, String name) {
- String resourcePath = (String)resourceMap.get(new Long(templateID));
- if(resourcePath == null){
+ String resourcePath = (String) resourceMap.get(new Long(templateID));
+ if (resourcePath == null) {
return null;
}
return UIConstants.getResource(resourcePath);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-31 03:40:33
|
Revision: 299
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=299&view=rev
Author: trevorolio
Date: 2007-08-30 20:40:29 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Added a bridge between the external URL space and things, so now template scripts can be directly addressed via HTTP, and info panels are just iFrames showing a thing's service page.
Modified Paths:
--------------
maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java
maven/trunk/ogoglio-integration-test/src/test/resources/sample-art3d/TestCube.js
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-08-31 03:40:25 UTC (rev 298)
+++ maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java 2007-08-31 03:40:29 UTC (rev 299)
@@ -99,15 +99,13 @@
public void testWebAdmin() {
try {
- PropStorage ps=new PropStorage();
- if (ps.loadPropertySet(PropStorage.BOOTSTRAP_PROPS)==false) {
- fail("unable to load properties bootstrap.properties!");
- }
-
- WebAPIAuthenticator adminAuthenticator = new WebAPIAuthenticatorFactory().authenticate(wire1, descriptor1,
- ps.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "bootstrapUser"),
- ps.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "bootstrapUserPW"));
-
+ PropStorage ps = new PropStorage();
+ if (ps.loadPropertySet(PropStorage.BOOTSTRAP_PROPS) == false) {
+ fail("unable to load properties bootstrap.properties!");
+ }
+
+ WebAPIAuthenticator adminAuthenticator = new WebAPIAuthenticatorFactory().authenticate(wire1, descriptor1, ps.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "bootstrapUser"), ps.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "bootstrapUserPW"));
+
assertNotNull("got null auth cookie", adminAuthenticator.getAuthCookie());
WebAPIClient adminWebClient = new WebAPIClient(descriptor1, adminAuthenticator, wire1);
@@ -116,7 +114,7 @@
assertNotNull(adminWebClient.getAccountDocument(USERNAME1));
assertNotNull(adminWebClient.getAccountDocument(USERNAME2));
-
+
WebAPIAuthenticator basicAuthenticator = new WebAPIAuthenticatorFactory().authenticate(wire1, descriptor1, USERNAME1, PASSWORD1);
assertNotNull("got null auth cookie", basicAuthenticator.getAuthCookie());
WebAPIClient basicWebClient = new WebAPIClient(descriptor1, basicAuthenticator, wire1);
@@ -215,6 +213,8 @@
thingDocs = webClient1.getThingDocuments(spaceDocument.getSpaceID());
assertEquals(1, thingDocs.length);
+ checkThingScripting(webClient1, thingDocs[0], spaceDocument);
+
checkPageManipulation(webClient1, thingDocs[0], spaceDocument);
//figure out the last template added
@@ -248,9 +248,30 @@
}
+ private void checkThingScripting(WebAPIClient webClient, ThingDocument thingDocument, SpaceDocument spaceDocument) throws IOException {
+ //make sure script will return a value
+ String script = webClient.getTemplateScript(webClient.getAuthenticator().getUsername(), thingDocument.getTemplateID());
+ assertNotNull(script);
+ assertFalse(script.indexOf("onService(") == -1);
+
+ //look for the monkey
+ String thingServiceResponse = webClient.getThingService(spaceDocument.getSpaceID(), thingDocument.getThingID());
+ assertEquals("monkey", thingServiceResponse);
+
+ //try with no script
+ webClient.updateTemplateScript(webClient.getAuthenticator().getUsername(), thingDocument.getTemplateID(), "");
+ webClient.reloadThing(spaceDocument.getSpaceID(), thingDocument.getThingID());
+ thingServiceResponse = webClient.getThingService(spaceDocument.getSpaceID(), thingDocument.getThingID());
+ assertEquals("", thingServiceResponse);
+
+ //reinstall script
+ webClient.updateTemplateScript(webClient.getAuthenticator().getUsername(), thingDocument.getTemplateID(), script);
+ webClient.reloadThing(spaceDocument.getSpaceID(), thingDocument.getThingID());
+ }
+
private UserDocument[] verifyUserDocsBySize(WebAPIClient webClient1, long spaceID, int expectedLen, String expectedUsername) throws IOException {
UserDocument[] userDocs = webClient1.getUserDocuments(spaceID);
- assertEquals(expectedLen,userDocs.length);
+ assertEquals(expectedLen, userDocs.length);
if (expectedUsername != null) {
assertEquals(expectedUsername, userDocs[0].getUsername());
}
@@ -745,9 +766,7 @@
public void contextItemChosen(Thing thing, long nonce, String id) {
}
- public void receivedInfoPanel(long sourceThingID, String panelHTML) {
- // TODO Auto-generated method stub
-
+ public void receivedInfoPanel(long sourceThingID, String nonce) {
}
}
Modified: maven/trunk/ogoglio-integration-test/src/test/resources/sample-art3d/TestCube.js
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/resources/sample-art3d/TestCube.js 2007-08-31 03:40:25 UTC (rev 298)
+++ maven/trunk/ogoglio-integration-test/src/test/resources/sample-art3d/TestCube.js 2007-08-31 03:40:29 UTC (rev 299)
@@ -5,8 +5,6 @@
}
function onClick(person, shapeName){
- space.log(person + " clicked " + thingID + " on its " + shapeName);
-
var currentPosition = space.getThingPosition(thingID);
var path = new SplinePath(2000, false, false);
@@ -15,28 +13,20 @@
path.addKeyFrame(new SplineKeyFrame(currentPosition.x, currentPosition.y, currentPosition.z, 2 * math.PI, 1));
space.startThingMotion(thingID, path);
+ return person + " clicked on " + shapeName + " in thing " + thingID;
}
function onContextClick(person, shapeName){
- space.log(person + " context clicked " + thingID + " on its " + shapeName);
-
- i1 = new ContextMenuInfo("Google",true,"google");
- i2 = new ContextMenuInfo("Yahoo",true,"yahoo");
- i3 = new ContextMenuInfo("Altavista",false,"NOTUSED");
- i4 = new ContextMenuInfo("Transmutable",true,"transmutable");
-
- return new Array(i1,i2,i3,i4);
+ var moveItem = new ContextMenuInfo("Move",true,"move");
+ var monkeyItem = new ContextMenuInfo("Monkey", true, "monkey");
+ var deadItem = new ContextMenuInfo("Groove",false,"groove");
+ return new Array(moveItem, monkeyItem, deadItem);
}
-function onContextMenuItemChosen(username,id)
-{
- var key = "favoriteSite";
- var preferred = space.getSetting(key);
-
- space.putSetting(key,id);
-
- //causes browser to jump to that page!
- return "http://www."+id+".com/";
+function onContextMenuItemChosen(username,id){
+ space.showInfoPanel(thingID, username, id);
}
-
+function onService(){
+ return new HTTPResponse(200, "monkey", "text/plain");
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-31 03:40:26
|
Revision: 298
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=298&view=rev
Author: trevorolio
Date: 2007-08-30 20:40:25 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Added a bridge between the external URL space and things, so now template scripts can be directly addressed via HTTP, and info panels are just iFrames showing a thing's service page.
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-08-30 20:40:07 UTC (rev 297)
+++ maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/ViewerApplet.java 2007-08-31 03:40:25 UTC (rev 298)
@@ -215,14 +215,14 @@
}
}
- private void showInfoPanel(long sourceThingID, String panelHTML) {
+ private void showInfoPanel(long sourceThingID, String nonce) {
try {
JSObject win = JSObject.getWindow(this); // get handle to a window.
if (win == null) {
System.err.println("Could not do live connect. Check that mayscript is true in the applet tag.");
return;
}
- String[] args = { sourceThingID + "", panelHTML };
+ String[] args = { sourceThingID + "", nonce };
win.call("addInfoPanel", args); // Call a JavaScript function
} catch (Exception e) {
if(!printedLiveConnectErrorMessage) {
@@ -331,8 +331,8 @@
public void contextItemChosen(Thing thing, long nonce, String id) {
}
- public void receivedInfoPanel(long sourceThingID, String panelHTML) {
- showInfoPanel(sourceThingID, panelHTML);
+ public void receivedInfoPanel(long sourceThingID, String nonce) {
+ showInfoPanel(sourceThingID, nonce);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-30 20:40:13
|
Revision: 297
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=297&view=rev
Author: trevorolio
Date: 2007-08-30 13:40:07 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Updated the info panel code and TestCube.js to reflect the change.
Modified Paths:
--------------
maven/trunk/ogoglio-server/pom.xml
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java
maven/trunk/ogoglio-server/src/main/webapp/spaceui.js
maven/trunk/ogoglio-server/src/main/webapp/thingPopup.html
maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.js
Modified: maven/trunk/ogoglio-server/pom.xml
===================================================================
--- maven/trunk/ogoglio-server/pom.xml 2007-08-30 19:00:17 UTC (rev 296)
+++ maven/trunk/ogoglio-server/pom.xml 2007-08-30 20:40:07 UTC (rev 297)
@@ -46,14 +46,21 @@
<include>migration-*.xml</include>
</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>
+ <include>mail/*</include>
+ </includes>
+ </resource>
+
</resources>
<!-- -->
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java 2007-08-30 19:00:17 UTC (rev 296)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java 2007-08-30 20:40:07 UTC (rev 297)
@@ -35,6 +35,7 @@
import com.ogoglio.client.model.Page;
import com.ogoglio.client.model.Shape;
import com.ogoglio.client.model.Thing;
+import com.ogoglio.client.model.User;
import com.ogoglio.sim.SpaceSimulator;
import com.ogoglio.util.ArgumentUtils;
import com.ogoglio.viewer.j3d.J3DSplineKeyFrame;
@@ -86,6 +87,15 @@
return System.currentTimeMillis();
}
+ public String[] jsFunction_getUsernames(){
+ User[] users = spaceSimulator.getSpace().getUsers();
+ String[] result = new String[users.length];
+ for (int i = 0; i < result.length; i++) {
+ result[i] = users[i].getUsername();
+ }
+ return result;
+ }
+
public String jsFunction_getSetting(String key) {
return spaceSimulator.getSetting(key);
}
@@ -151,6 +161,15 @@
spaceSimulator.setPageContent((long) thingID, (long) pageID, Page.TEXT_PLAIN, content);
}
+ public double[] jsFunction_getThingIDs(){
+ Thing[] things = spaceSimulator.getSpace().getThings();
+ double[] result = new double[things.length];
+ for (int i = 0; i < result.length; i++) {
+ result[i] = things[i].getThingID();
+ }
+ return result;
+ }
+
public ScriptPoint jsFunction_getThingPosition(double thingID) {
Thing thing = spaceSimulator.getSpace().getThing((long) thingID);
if (thing == null) {
Modified: maven/trunk/ogoglio-server/src/main/webapp/spaceui.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/spaceui.js 2007-08-30 19:00:17 UTC (rev 296)
+++ maven/trunk/ogoglio-server/src/main/webapp/spaceui.js 2007-08-30 20:40:07 UTC (rev 297)
@@ -205,25 +205,47 @@
if(infoDiv == null){
return;
}
+
var panelID = "infoPanel-" + id;
var infoPanelElement = document.createElement("div");
infoPanelElement.setAttribute("id", panelID);
infoPanelElement.setAttribute("class", "infoPanel");
- infoPanelElement.innerHTML = panelHTML;
+ infoPanelElement.style["background-color"] = "#EEE";
+
+ var infoActionDiv = document.createElement("div");
+ infoActionDiv.style.width = "100%";
+ infoActionDiv.style.textAlign = "right";
+ infoActionDiv.style.backgroundColor = "#F00";
+ var closeActionAnchor = document.createElement("a");
+ closeActionAnchor.setAttribute("href", "hmmm.html");
+ closeActionAnchor.setAttribute("onclick", "removeInfoPanel(" + id + "); return false;");
+ closeActionAnchor.appendChild(document.createTextNode("close"));
+ infoActionDiv.appendChild(closeActionAnchor);
+ infoPanelElement.appendChild(infoActionDiv);
+ var panelHTMLWrapperDiv = document.createElement("div");
+ panelHTMLWrapperDiv.innerHTML = panelHTML;
+ infoPanelElement.appendChild(panelHTMLWrapperDiv);
+
if(infoPanels[id] != null){
infoDiv.replaceChild(infoPanelElement, infoPanels[id]);
infoPanels[id] = infoPanelElement;
} else {
- var tempElement = document.createElement("div");
- infoDiv.appendChild(tempElement);
infoDiv.appendChild(infoPanelElement);
- infoDiv.removeChild(tempElement);
infoPanels[id] = infoPanelElement;
- infoPanels[id].focus();
+ infoPanelElement.focus();
}
}
+Array.prototype.remove=function(s){
+ for(i=0;i<this .length;i++){
+ if(s==this[i]) {
+ this.splice(i, 1);
+ break;
+ }
+ }
+}
+
function removeInfoPanel(id){
var infoDiv = document.getElementById("infoDiv");
if(infoDiv == null){
@@ -233,7 +255,7 @@
return;
}
infoDiv.removeChild(infoPanels[id]);
- infoPanels[id] = null;
+ infoPanels.remove(infoPanels[id]);
}
// Copyright 2007 Transmutable (http://transmutable.com/) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Modified: maven/trunk/ogoglio-server/src/main/webapp/thingPopup.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/thingPopup.html 2007-08-30 19:00:17 UTC (rev 296)
+++ maven/trunk/ogoglio-server/src/main/webapp/thingPopup.html 2007-08-30 20:40:07 UTC (rev 297)
@@ -57,7 +57,7 @@
}
thingXML = xml;
- title.innerHTML = "Thing: " + xml.getAttribute('displayname');
+ title.innerHTML = escapeHTML(xml.getAttribute('displayname'));
xPosInput.value = parseFloat(thingXML.getAttribute('x')).toFixed(2);
yPosInput.value = parseFloat(thingXML.getAttribute('y')).toFixed(2);
zPosInput.value = parseFloat(thingXML.getAttribute('z')).toFixed(2);
@@ -193,7 +193,7 @@
<style type="text/css">
.section input[type=submit] {
- width: 100px;
+ width: 60px;
}
.section input[type=text] {
width: 70px;
Modified: maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.js
===================================================================
--- maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.js 2007-08-30 19:00:17 UTC (rev 296)
+++ maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.js 2007-08-30 20:40:07 UTC (rev 297)
@@ -18,25 +18,23 @@
}
function onContextClick(person, shapeName){
- space.log(person + " context clicked " + thingID + " on its " + shapeName);
-
- i1 = new ContextMenuInfo("Google",true,"google");
- i2 = new ContextMenuInfo("Yahoo",true,"yahoo");
- i3 = new ContextMenuInfo("Altavista",false,"NOTUSED");
- i4 = new ContextMenuInfo("Transmutable",true,"transmutable");
-
- return new Array(i1,i2,i3,i4);
+ var moveItem = new ContextMenuInfo("Move",true,"move");
+ var monkeyItem = new ContextMenuInfo("Monkey", true, "monkey");
+ var deadItem = new ContextMenuInfo("Groove",false,"groove");
+ return new Array(moveItem, monkeyItem, deadItem);
}
-function onContextMenuItemChosen(username,id)
-{
- var key = "favoriteSite";
- var preferred = space.getSetting(key);
-
- space.putSetting(key,id);
-
- //causes browser to jump to that page!
- return "http://www."+id+".com/";
+function onContextMenuItemChosen(username,id){
+ if(id == "move"){
+ var iFrameURL = "/og/thingPopup.html?thingID=" + thingID + "&spaceID=" + space.id;
+ var style = "width: 270px; height: 420px;";
+ space.showInfoPanel(thingID, username, "<iframe src='" + iFrameURL + "' style='" + style + "' />");
+ return "Showed move info panel";
+ } else if (id == "monkey") {
+ space.showInfoPanel(thingID, username, "<div><img src='/og/icons/32x32/face-monkey.png'/></div> ");
+ return "Showed Monkey";
+ } else {
+ return "Unknown item";
+ }
}
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-08-30 19:00:25
|
Revision: 296
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=296&view=rev
Author: iansmith
Date: 2007-08-30 12:00:17 -0700 (Thu, 30 Aug 2007)
Log Message:
-----------
Added support for multiple, different versioning of the database code. Needed to support multiple apps.
Modified Paths:
--------------
maven/trunk/ogoglio-appdev/.classpath
maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/Migration.java
maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/MigrationSupport.java
maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/test/DBZapTest.java
maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/AbstractRemoteServlet.java
maven/trunk/ogoglio-integration-test/pom.xml
maven/trunk/ogoglio-integration-test/src/test/resources/bootstrap.properties
maven/trunk/ogoglio-integration-test/src/test/resources/test-config.properties
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/AccountsForTesting.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/OgoglioServerMigration.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/ServiceInitializationPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
maven/trunk/ogoglio-server/src/main/resources/hibernate/hibernate.cfg.xml
maven/trunk/ogoglio-server/src/test/resources/bootstrap.properties
maven/trunk/ogoglio-server/src/test/resources/test-config.properties
Removed Paths:
-------------
maven/trunk/ogoglio-appdev/src/test/resources/
Modified: maven/trunk/ogoglio-appdev/.classpath
===================================================================
--- maven/trunk/ogoglio-appdev/.classpath 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-appdev/.classpath 2007-08-30 19:00:17 UTC (rev 296)
@@ -3,7 +3,6 @@
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="src/main/resources" path="src/main/resources"/>
- <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"/>
<classpathentry kind="output" path="target/classes"/>
Modified: maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/Migration.java
===================================================================
--- maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/Migration.java 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/Migration.java 2007-08-30 19:00:17 UTC (rev 296)
@@ -1,12 +1,12 @@
package com.ogoglio.appdev.migrate;
-import java.util.Properties;
-
import javax.naming.Context;
import javax.servlet.ServletConfig;
import org.hibernate.SessionFactory;
+import com.ogoglio.appdev.persist.PersistException;
+
public interface Migration {
/*
@@ -16,7 +16,8 @@
*
* Return false if things went wrong.
*/
- public boolean patch(SessionFactory sessionFactory, ServletConfig servletConfig, Context ctx, int from, int to);
+ public boolean patch(SessionFactory sessionFactory, ServletConfig servletConfig, Context ctx,
+ int from, int to) throws PersistException;
/*O
* The receiver should use this call to populate the database with data that would be useful
@@ -24,6 +25,6 @@
*
* Return false if things went wrong.
*/
- public boolean populate(SessionFactory sessionFactory, int from, int to);
+ public boolean populate(SessionFactory sessionFactory, int from, int to) throws PersistException;
}
Modified: maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/MigrationSupport.java
===================================================================
--- maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/MigrationSupport.java 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/MigrationSupport.java 2007-08-30 19:00:17 UTC (rev 296)
@@ -24,17 +24,18 @@
public MigrationSupport() {
}
- public abstract int versionNumber();
- public abstract Migration[] migrationList();
+ public abstract int getVersionNumber();
+ public abstract Migration[] getMigrationList();
+ public abstract String getResourcePath();
public boolean verifyVersion(ServletConfig servletConf, Context ctx) {
try {
SessionFactory sessionFactory = getCurrentConfiguration().buildSessionFactory();
int version = DBVersionPersistTasks.findVersion(sessionFactory);
- if (version != versionNumber()) {
- System.err.println("DB Version Mismatch! Expected (" + versionNumber() + ") but got " + version + "!");
+ if (version != getVersionNumber()) {
+ System.err.println("DB Version Mismatch! Expected (" + getVersionNumber() + ") but got " + version + "!");
sessionFactory.close();
- return tryUpgrade(servletConf, ctx, version, versionNumber(),
+ return tryUpgrade(servletConf, ctx, version, getVersionNumber(),
DDL_MODE_UPDATE, true, null);
}
sessionFactory.close();
@@ -69,11 +70,11 @@
if (!initVersionOnly(true,null)) {
return false;
}
- return tryUpgrade(conf, ctx, 0, versionNumber(), DDL_MODE_UPDATE, true,null);
+ return tryUpgrade(conf, ctx, 0, getVersionNumber(), DDL_MODE_UPDATE, true,null);
}
public Configuration getCurrentConfiguration() {
- return createConfigurationForHibernate(versionNumber(), null, true, null);
+ return createConfigurationForHibernate(getVersionNumber(), null, true, null);
}
public Configuration createConfigurationForHibernate(int num, String autoSetting, boolean useJNDI, PropStorage ps) {
@@ -86,7 +87,7 @@
} else {
configuration.addProperties(ps.getAllProps(PropStorage.TEST_CONFIG_PROPS));
}
- configuration.addInputStream(UIConstants.getResource("com/ogoglio/migrate/migration-" + num + ".xml"));
+ configuration.addInputStream(UIConstants.getResource(getResourcePath()+"/migration-" + num + ".xml"));
return configuration.configure();
}
@@ -101,8 +102,8 @@
public boolean tryUpgrade(ServletConfig servletConfig, Context ctx, int db_is,
int db_wants_to_be, boolean isUpdate, boolean useJNDI, PropStorage propStore) {
- if (migrationList().length != versionNumber()) {
- System.out.println("Internal error! Migration list length should be " + versionNumber() + " but is " + migrationList().length + "!");
+ if (getMigrationList().length != getVersionNumber()) {
+ System.out.println("Internal error! Migration list length should be " + getVersionNumber() + " but is " + getMigrationList().length + "!");
return false;
}
boolean canMigrate = false;
@@ -134,9 +135,9 @@
for (int i = db_is; i < db_wants_to_be; ++i) {
- Migration current = migrationList()[i];
+ Migration current = getMigrationList()[i];
System.out.println("------------------------------------------------\n");
- System.out.println("DB: Attempting migration from " + i + " to " + (i + 1) + "...");
+ System.out.println("DB: Attempting migration from " + i + " to " + (i + 1) + " with auto HBM:"+hbm_auto_flag);
//try to get hibernate to do the work
Configuration config = createConfigurationForHibernate(i + 1, hbm_auto_flag, useJNDI, propStore);
@@ -149,21 +150,30 @@
}
setVersionNumberOfDbViaQuery(factory, i + 1, expectedRecords);
- if (!current.patch(factory, servletConfig, ctx, i, i + 1)) {
- factory.close();
- return false;
- }
-
- if (!isUpdate) {
- //we need to go ahead and create the data
- if (!current.populate(factory, i, i+1)) {
- System.out.println("FART: Whoa! Populate failed!"+i);
+ try {
+ if (!current.patch(factory, servletConfig, ctx, i, i + 1)) {
factory.close();
return false;
}
- System.out.println("FART: Populate ok!"+i);
+ } catch (PersistException e) {
+ System.err.println("Whoa! Patch failed at revision!"+(i+1)+" on class "+current.getClass().getName());
+ System.err.println("Whoa! Persistance layer problem was:"+e.getMessage());
}
+ try {
+ if (!isUpdate) {
+ //we need to go ahead and create the data
+ if (!current.populate(factory, i, i+1)) {
+ System.err.println("Whoa! Populate failed at revision!"+(i+1)+" on class "+current.getClass().getName());
+ factory.close();
+ return false;
+ }
+ }
+ } catch (PersistException e) {
+ System.err.println("Whoa! Populate failed at revision!"+(i+1)+" on class "+current.getClass().getName());
+ System.err.println("Whoa! Persistance layer problem was:"+e.getMessage());
+ }
+
factory.close();
System.out.println("------------------------------------------------\n");
}
@@ -180,6 +190,6 @@
return false;
}
- return tryUpgrade(null, null, 0, versionNumber(), DDL_MODE_CREATE, false, ps);
+ return tryUpgrade(null, null, 0, getVersionNumber(), DDL_MODE_CREATE, false, ps);
}
}
Modified: maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/test/DBZapTest.java
===================================================================
--- maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/test/DBZapTest.java 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/test/DBZapTest.java 2007-08-30 19:00:17 UTC (rev 296)
@@ -28,7 +28,7 @@
}
//if we are here, db stuff worked, but we still need to avoid all the jndi stuff
- sessionFactory = support.createConfigurationForHibernate(getMigrationSupport().versionNumber(), null, false, ps).buildSessionFactory();
+ sessionFactory = support.createConfigurationForHibernate(getMigrationSupport().getVersionNumber(), null, false, ps).buildSessionFactory();
} catch (Exception e) {
System.out.println("-------");
e.printStackTrace(System.out);
Modified: maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/AbstractRemoteServlet.java
===================================================================
--- maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/AbstractRemoteServlet.java 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/AbstractRemoteServlet.java 2007-08-30 19:00:17 UTC (rev 296)
@@ -62,7 +62,6 @@
throw new ServletException("Failed because of Ogoglio service auth failure: " + e);
}
}
-
super.service(request, response);
}
Modified: maven/trunk/ogoglio-integration-test/pom.xml
===================================================================
--- maven/trunk/ogoglio-integration-test/pom.xml 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-integration-test/pom.xml 2007-08-30 19:00:17 UTC (rev 296)
@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>ogoglio-integration-test</groupId>
+ <groupId>com.ogoglio</groupId>
<artifactId>ogoglio-integration-test</artifactId>
<version>0.0.1</version>
<packaging>pom</packaging>
Modified: maven/trunk/ogoglio-integration-test/src/test/resources/bootstrap.properties
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/resources/bootstrap.properties 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-integration-test/src/test/resources/bootstrap.properties 2007-08-30 19:00:17 UTC (rev 296)
@@ -1,2 +1,4 @@
+allBootstrapUsers=${ogoglio.allBootstrapUsers}
+allBootstrapUsersPW=${ogoglio.allBootstrapUsersPW}
bootstrapUser=${ogoglio.bootstrapUser}
bootstrapUserPW=${ogoglio.bootstrapUserPW}
Modified: maven/trunk/ogoglio-integration-test/src/test/resources/test-config.properties
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/resources/test-config.properties 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-integration-test/src/test/resources/test-config.properties 2007-08-30 19:00:17 UTC (rev 296)
@@ -18,6 +18,8 @@
#for doing tests that need bootstrap
ogoglio.baseURL=${ogoglio.baseURL}
+ogoglio.allBootstrapUsers=${ogoglio.allBootstrapUsers}
+ogoglio.allBootstrapUsersPW=${ogoglio.allBootstrapUsersPW}
ogoglio.bootstrapUser=${ogoglio.bootstrapUser}
ogoglio.bootstrapUserPW=${ogoglio.bootstrapUserPW}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/AccountsForTesting.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/AccountsForTesting.java 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/AccountsForTesting.java 2007-08-30 19:00:17 UTC (rev 296)
@@ -1,6 +1,7 @@
package com.ogoglio.migrate;
import java.net.URI;
+import java.util.regex.Pattern;
import javax.naming.Context;
import javax.servlet.ServletConfig;
@@ -8,6 +9,7 @@
import org.hibernate.SessionFactory;
import com.ogoglio.appdev.migrate.Migration;
+import com.ogoglio.appdev.persist.PersistException;
import com.ogoglio.persist.ServiceInitializationPersistTasks;
import com.ogoglio.util.PropStorage;
@@ -17,7 +19,7 @@
public boolean patch(SessionFactory sessionFactory, ServletConfig config, Context ctx, int from, int to) {
return true;
}
- public boolean populate(SessionFactory sessionFactory, int from, int to) {
+ public boolean populate(SessionFactory sessionFactory, int from, int to) throws PersistException{
if ((from != 0) || (to != 1)) {
System.out.println("Migration called in the wrong place! Expected 0->1 but was:" + from + "->" + to + "!");
@@ -26,35 +28,40 @@
}
try {
- String uriString, user, pw;
+ String uriString, users, pws;
PropStorage zap=new PropStorage();
- System.out.println("FART1--->populate:"+(zap.loadPropertySet(PropStorage.BOOTSTRAP_PROPS))+","+
- zap.loadPropertySet(PropStorage.BASIC_PROPS));
-
if (zap.loadPropertySet(PropStorage.BOOTSTRAP_PROPS)==false) {
return false;
}
if (zap.loadPropertySet(PropStorage.BASIC_PROPS)==false) {
return false;
}
- System.out.println("FART2--->populate:");
uriString = zap.getKeyFromSet(PropStorage.BASIC_PROPS, "ogoglio.baseUrl");
- user=zap.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "bootstrapUser");
- pw=zap.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "bootstrapUserPW");
+ users=zap.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "allBootstrapUsers");
+ pws=zap.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "allBootstrapUsersPW");
- if ((uriString==null) || (user==null) || (pw==null)) {
- System.out.println("URI FART:"+(uriString==null));
- System.out.println("USER FART:"+(user==null));
- System.out.println("PW FART:"+(pw==null));
+ if ((uriString==null) || (users==null) || (pws==null)) {
+ System.err.println("URI Offender in settings.xml:"+(uriString==null));
+ System.err.println("USERS Offender in settings.xml:"+(users==null));
+ System.err.println("PWS Offender in settings.xml:"+(pws==null));
return false;
}
+
+ String[] userList = users.split(Pattern.quote(","));
+ String[] pwList = pws.split(Pattern.quote(","));
- System.out.println("FART3--->uriString:"+uriString);
+ if (userList.length!=pwList.length) {
+ System.err.println("Whoa! Settings.xml gave us a bootstrap user list and pw list of different lengths!");
+ return false;
+ }
URI uri = new URI(uriString);
- //actual work
+
+ for (int i=0; i<userList.length;++i) {
+ ServiceInitializationPersistTasks.initializeBootstrapAccount(sessionFactory, uri.getHost(), userList[i], pwList[i]);
+ }
+
ServiceInitializationPersistTasks.initializeLocalSim(uri, sessionFactory);
- ServiceInitializationPersistTasks.initializeBootstrapAccount(sessionFactory, uri.getHost(), user, pw);
ServiceInitializationPersistTasks.initializeServiceState(sessionFactory);
return true;
} catch (Exception e) {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/OgoglioServerMigration.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/OgoglioServerMigration.java 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/OgoglioServerMigration.java 2007-08-30 19:00:17 UTC (rev 296)
@@ -13,14 +13,16 @@
// this is the set of semantic migrations, in order
private static final Migration[] migration = { new AccountsForTesting() };
- public Migration[] migrationList() {
+ public Migration[] getMigrationList() {
return migration;
}
- public int versionNumber() {
+ public int getVersionNumber() {
return DB_VERSION_NUMBER;
}
+ public String getResourcePath() { return "com/ogoglio/migrate"; }
+
private OgoglioServerMigration() {
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/ServiceInitializationPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/ServiceInitializationPersistTasks.java 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/ServiceInitializationPersistTasks.java 2007-08-30 19:00:17 UTC (rev 296)
@@ -42,7 +42,7 @@
if (accountRec != null) {
return;
}
- accountRec = AccountPersistTasks.createAccount(user, "admin", "library@"+host, sessionFactory);
+ accountRec = AccountPersistTasks.createAccount(user, "admin", user+"@"+host, sessionFactory);
accountRec.setPassword(pw);
AccountPersistTasks.update(accountRec, sessionFactory);
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-08-30 19:00:17 UTC (rev 296)
@@ -321,21 +321,17 @@
public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
long spaceID = Long.parseLong(pathElements[2]);
try {
- System.out.println("do POST fart: SIM:"+spaceID);
SpaceRecord spaceRecord = SpacePersistTasks.findSpaceBySpaceID(spaceID, getSessionFactory());
if (spaceRecord == null) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
- System.out.println("do POST2 fart: SIM:"+spaceID);
-
AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
if (authedAccount != null && !authedAccount.getUsername().equals(spaceRecord.getOwnerUsername())) {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
return;
}
- System.out.println("do POST3 fart: authed acct:"+authedAccount.getUsername());
String value = getFirstStringValue(request);
if (value == null || value.trim().length() == 0) {
System.err.println("Posted null value: " + request.getContentType());
@@ -343,11 +339,9 @@
return;
}
- System.out.println("do POST4 fart: value:"+value);
SpaceSimulator simulator = sim.getOrCreateSpaceSimulator(spaceRecord);
simulator.putSetting(pathElements[pathElements.length - 1], value);
sendStringResponse(value, "text/plain", response);
- System.out.println("do POST5 fart: value:"+value);
} catch (PersistException e) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
Modified: maven/trunk/ogoglio-server/src/main/resources/hibernate/hibernate.cfg.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/hibernate/hibernate.cfg.xml 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-server/src/main/resources/hibernate/hibernate.cfg.xml 2007-08-30 19:00:17 UTC (rev 296)
@@ -9,13 +9,10 @@
<hibernate-configuration>
<session-factory>
- <!-- to use JNDI to find the data source -->
- <!-- we expect this context (java:comp/env) to have been created by the abstract resource servlet AND we expect the
- particular value (jdbc/space) to have been created in the context.xml of the server -->
- <!--
- <property name="connection.datasource">java:comp/env/jdbc/space</property>
- <property name="show_sql">false</property>
+ <!-- only mysql supported now
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
+ <property name="show_sql">true</property>
-->
+
</session-factory>
</hibernate-configuration>
Modified: maven/trunk/ogoglio-server/src/test/resources/bootstrap.properties
===================================================================
--- maven/trunk/ogoglio-server/src/test/resources/bootstrap.properties 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-server/src/test/resources/bootstrap.properties 2007-08-30 19:00:17 UTC (rev 296)
@@ -1,2 +1,4 @@
+allBootstrapUsers=${ogoglio.allBootstrapUsers}
+allBootstrapUsersPW=${ogoglio.allBootstrapUsersPW}
bootstrapUser=${ogoglio.bootstrapUser}
bootstrapUserPW=${ogoglio.bootstrapUserPW}
Modified: maven/trunk/ogoglio-server/src/test/resources/test-config.properties
===================================================================
--- maven/trunk/ogoglio-server/src/test/resources/test-config.properties 2007-08-30 00:59:14 UTC (rev 295)
+++ maven/trunk/ogoglio-server/src/test/resources/test-config.properties 2007-08-30 19:00:17 UTC (rev 296)
@@ -18,6 +18,8 @@
#for doing tests that need bootstrap
ogoglio.baseURL=${ogoglio.baseURL}
+ogoglio.allBootstrapUsers=${ogoglio.allBootstrapUsers}
+ogoglio.allBootstrapUsersPW=${ogoglio.allBootstrapUsersPW}
ogoglio.bootstrapUser=${ogoglio.bootstrapUser}
ogoglio.bootstrapUserPW=${ogoglio.bootstrapUserPW}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-30 00:59:11
|
Revision: 295
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=295&view=rev
Author: trevorolio
Date: 2007-08-29 17:59:14 -0700 (Wed, 29 Aug 2007)
Log Message:
-----------
Added the path from a template script to the info panel.
Cannot send information in the other direction, yet.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/MultiuserTests.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/SpaceEvent.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/MultiuserTests.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/MultiuserTests.java 2007-08-30 00:59:09 UTC (rev 294)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/MultiuserTests.java 2007-08-30 00:59:14 UTC (rev 295)
@@ -109,6 +109,11 @@
public void contextItemChosen(Thing thing, long nonce, String id) {
}
+ public void receivedInfoPanel(long sourceThingID, String panelHTML) {
+ // TODO Auto-generated method stub
+
+ }
+
}
private class WanderThread extends Thread {
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-08-30 00:59:09 UTC (rev 294)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java 2007-08-30 00:59:14 UTC (rev 295)
@@ -521,6 +521,11 @@
String link = event.getStringProperty(SpaceEvent.LINK);
listener.receivedLink(displayName, link);
+ } else if (SpaceEvent.SHOW_INFO_PANEL_EVENT.equals(event.getName())) {
+ String panelHTML = event.getStringProperty(SpaceEvent.INFO_PANEL_HTML);
+ long sourceThingID = event.getLongProperty(SpaceEvent.THING_ID).longValue();
+ listener.receivedInfoPanel(sourceThingID, panelHTML);
+
} else if (SpaceEvent.RELOAD_THING_EVENT.equals(event.getName())) {
long thingID = event.getLongProperty(SpaceEvent.THING_ID).longValue();
Thing thing = space.getThing(thingID);
@@ -650,6 +655,8 @@
public interface Listener {
public void receivedChatMessage(String username, String message);
+ public void receivedInfoPanel(long sourceThingID, String panelHTML);
+
public void contextItemChosen(Thing thing, long nonce, String id);
public void receivedContextMenuData(long nonce, String errorIfAny, Vector contextMenu);
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/SpaceEvent.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/SpaceEvent.java 2007-08-30 00:59:09 UTC (rev 294)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/SpaceEvent.java 2007-08-30 00:59:14 UTC (rev 295)
@@ -217,6 +217,10 @@
public static final String THING_CONTEXT_SELECTION_MADE_EVENT = "contextMenuItemChosen";
+ public static final String SHOW_INFO_PANEL_EVENT = "ShowInfoPanelEvent";
+
+ public static final String INFO_PANEL_HTML = "infoPanelHTML";
+
private String name = null;
private HashMap properties = new HashMap();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-30 00:59:06
|
Revision: 294
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=294&view=rev
Author: trevorolio
Date: 2007-08-29 17:59:09 -0700 (Wed, 29 Aug 2007)
Log Message:
-----------
Added the path from a template script to the info panel.
Cannot send information in the other direction, yet.
Modified Paths:
--------------
maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java
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-08-30 00:59:03 UTC (rev 293)
+++ maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java 2007-08-30 00:59:09 UTC (rev 294)
@@ -745,6 +745,11 @@
public void contextItemChosen(Thing thing, long nonce, String id) {
}
+ public void receivedInfoPanel(long sourceThingID, String panelHTML) {
+ // TODO Auto-generated method stub
+
+ }
+
}
private class TestListener implements Space.Listener {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-30 00:59:00
|
Revision: 293
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=293&view=rev
Author: trevorolio
Date: 2007-08-29 17:59:03 -0700 (Wed, 29 Aug 2007)
Log Message:
-----------
Added the path from a template script to the info panel.
Cannot send information in the other direction, yet.
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-08-30 00:58:59 UTC (rev 292)
+++ maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/ViewerApplet.java 2007-08-30 00:59:03 UTC (rev 293)
@@ -208,10 +208,30 @@
String[] args = { displayName, link };
win.call("displayLink", args); // Call a JavaScript function
} catch (Exception e) {
- e.printStackTrace();
+ if(!printedLiveConnectErrorMessage) {
+ System.err.println("Could not use LiveConnect (ignoring future errors): " + e);
+ printedLiveConnectErrorMessage = true;
+ }
}
}
-
+
+ private void showInfoPanel(long sourceThingID, String panelHTML) {
+ try {
+ JSObject win = JSObject.getWindow(this); // get handle to a window.
+ if (win == null) {
+ System.err.println("Could not do live connect. Check that mayscript is true in the applet tag.");
+ return;
+ }
+ String[] args = { sourceThingID + "", panelHTML };
+ win.call("addInfoPanel", args); // Call a JavaScript function
+ } catch (Exception e) {
+ if(!printedLiveConnectErrorMessage) {
+ System.err.println("Could not use LiveConnect (ignoring future errors): " + e);
+ printedLiveConnectErrorMessage = true;
+ }
+ }
+ }
+
boolean printedLiveConnectErrorMessage = false;
private void messageBrowser(long sourceThingID, String message) {
try {
@@ -310,8 +330,10 @@
public void contextItemChosen(Thing thing, long nonce, String id) {
}
-
-
+
+ public void receivedInfoPanel(long sourceThingID, String panelHTML) {
+ showInfoPanel(sourceThingID, panelHTML);
+ }
}
private class ThingGeneratedPopup extends JPopupMenu {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-30 00:59:00
|
Revision: 292
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=292&view=rev
Author: trevorolio
Date: 2007-08-29 17:58:59 -0700 (Wed, 29 Aug 2007)
Log Message:
-----------
Added the path from a template script to the info panel.
Cannot send information in the other direction, yet.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java
maven/trunk/ogoglio-server/src/main/webapp/space.html
maven/trunk/ogoglio-server/src/main/webapp/spaceui.js
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-08-29 21:43:58 UTC (rev 291)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-08-30 00:58:59 UTC (rev 292)
@@ -454,6 +454,14 @@
listener.generatedSpaceEventForUser(username, spaceEvent, this);
}
+ public void showInfoPanelToUser(long sourceThingID, String username, String infoPanelHTML) {
+ SpaceEvent spaceEvent = new SpaceEvent(SpaceEvent.SHOW_INFO_PANEL_EVENT);
+ spaceEvent.setProperty(SpaceEvent.USERNAME, username);
+ spaceEvent.setProperty(SpaceEvent.THING_ID, new Long(sourceThingID));
+ spaceEvent.setProperty(SpaceEvent.INFO_PANEL_HTML, infoPanelHTML);
+ listener.generatedSpaceEventForUser(username, spaceEvent, this);
+ }
+
public DoorDocument addDoor(String displayName, long templateID, String templateOwner, URI link, Transform3D transform) {
Template template = getTemplate(templateID);
Door door = new Door(space, template, -1, displayName, link, transform);
@@ -1048,5 +1056,4 @@
public void mouseContextClickedThing(Thing thing, String name, int x, int y) {
}
}
-
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java 2007-08-29 21:43:58 UTC (rev 291)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/script/ScriptSpace.java 2007-08-30 00:58:59 UTC (rev 292)
@@ -98,6 +98,10 @@
return spaceSimulator.removeSetting(key);
}
+ public void jsFunction_showInfoPanel(double sourceThingID, String username, String infoPanelHTML){
+ spaceSimulator.showInfoPanelToUser((long)sourceThingID, username, infoPanelHTML);
+ }
+
public void jsFunction_log(String message) {
spaceSimulator.log(message);
}
Modified: maven/trunk/ogoglio-server/src/main/webapp/space.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/space.html 2007-08-29 21:43:58 UTC (rev 291)
+++ maven/trunk/ogoglio-server/src/main/webapp/space.html 2007-08-30 00:58:59 UTC (rev 292)
@@ -11,6 +11,10 @@
<script type="text/javascript" src="/og/spaceui.js"></script>
<style type="text/css">
+body {
+ width: 1050px;
+}
+
#spaceDiv {
width: 758px;
height: 500px;
@@ -41,6 +45,23 @@
#sendCommandButton {
width: 90px;
}
+
+#infoDiv {
+ float:right;
+ padding: 10px 0px 10px 0px;
+ width: 270px;
+ height: 580px;
+ background-color: #FFF;
+}
+
+.infoPanel {
+ width: 100%;
+ padding: 2px;
+ margin: 0px 0px 10px 0px;
+ border-style: solid;
+ border-width: 10px 1px 1px 1px;
+ border-color: #CCD;
+}
</style>
<script type="text/javascript">
@@ -70,6 +91,9 @@
</div> <!-- end header menu -->
<div style="margin: 0px;">
+ <div id="infoDiv"> </div>
+
+ </div>
<div id="spaceDiv">
<noscript><div style="width: 100%; text-align: center; color: #911;">You must enable javascript to view this page.</div></noscript>
</div>
Modified: maven/trunk/ogoglio-server/src/main/webapp/spaceui.js
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/spaceui.js 2007-08-29 21:43:58 UTC (rev 291)
+++ maven/trunk/ogoglio-server/src/main/webapp/spaceui.js 2007-08-30 00:58:59 UTC (rev 292)
@@ -136,6 +136,7 @@
chatHistory.innerHTML += "<strong>" + username + "</strong>: " + markupChatMessage(text) + "<br />";
chatHistory.scrollTop = chatHistory.scrollHeight;
+ focusCommandField();
}
var emoteIconBase = appPath + "/icons/16x16/";
@@ -196,4 +197,43 @@
addAuthListeners(spaceHandleAuth, spaceHandleAuth);
}
+//############## Start Info Panel Functions ##################
+var infoPanels = new Array();
+
+function addInfoPanel(id, panelHTML){
+ var infoDiv = document.getElementById("infoDiv");
+ if(infoDiv == null){
+ return;
+ }
+ var panelID = "infoPanel-" + id;
+ var infoPanelElement = document.createElement("div");
+ infoPanelElement.setAttribute("id", panelID);
+ infoPanelElement.setAttribute("class", "infoPanel");
+ infoPanelElement.innerHTML = panelHTML;
+
+ if(infoPanels[id] != null){
+ infoDiv.replaceChild(infoPanelElement, infoPanels[id]);
+ infoPanels[id] = infoPanelElement;
+ } else {
+ var tempElement = document.createElement("div");
+ infoDiv.appendChild(tempElement);
+ infoDiv.appendChild(infoPanelElement);
+ infoDiv.removeChild(tempElement);
+ infoPanels[id] = infoPanelElement;
+ infoPanels[id].focus();
+ }
+}
+
+function removeInfoPanel(id){
+ var infoDiv = document.getElementById("infoDiv");
+ if(infoDiv == null){
+ return;
+ }
+ if(infoPanels[id] == null){
+ return;
+ }
+ infoDiv.removeChild(infoPanels[id]);
+ infoPanels[id] = null;
+}
+
// Copyright 2007 Transmutable (http://transmutable.com/) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-08-29 21:44:04
|
Revision: 291
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=291&view=rev
Author: iansmith
Date: 2007-08-29 14:43:58 -0700 (Wed, 29 Aug 2007)
Log Message:
-----------
Removed file leftover from merge.
Reorganized servlet heirarchy in appdev to accomodate transmutable.
Whitespace changes in context.xml. sheesh.
Modified Paths:
--------------
maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/AbstractRemoteServlet.java
maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml
Removed Paths:
-------------
maven/trunk/ogoglio-integration-test/src/test/resources/bootstrapUser.properties
Modified: maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/AbstractRemoteServlet.java
===================================================================
--- maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/AbstractRemoteServlet.java 2007-08-29 20:55:24 UTC (rev 290)
+++ maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/AbstractRemoteServlet.java 2007-08-29 21:43:58 UTC (rev 291)
@@ -20,7 +20,7 @@
import com.ogoglio.util.ArgumentUtils;
import com.ogoglio.xml.AuthDocument;
-public abstract class AbstractRemoteServlet extends AbstractResourceServlet {
+public abstract class AbstractRemoteServlet extends MigratedResourceServlet {
private WebAPIClient ogoglioClient = null;
Deleted: maven/trunk/ogoglio-integration-test/src/test/resources/bootstrapUser.properties
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/resources/bootstrapUser.properties 2007-08-29 20:55:24 UTC (rev 290)
+++ maven/trunk/ogoglio-integration-test/src/test/resources/bootstrapUser.properties 2007-08-29 21:43:58 UTC (rev 291)
@@ -1,2 +0,0 @@
-bootstrapUser=${ogoglio.bootstrapUser}
-bootstrapUserPW=${ogoglio.bootstrapUserPW}
Modified: maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml 2007-08-29 20:55:24 UTC (rev 290)
+++ maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml 2007-08-29 21:43:58 UTC (rev 291)
@@ -14,6 +14,7 @@
show_sql="false"
maxIdle="5"
maxActive="50" />
+
<Environment name="ogoglio/oktoZapDB" value="false" type="java.lang.String"/> <!-- not running tests! -->
<Environment name="ogoglio/okToMigrateDB" value="${ogoglio.okToMigrateDB}" type="java.lang.String"/>
<Environment name="ogoglio/mediaURL" value="${ogoglio.mediaURL}" type="java.lang.String"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-08-29 20:55:22
|
Revision: 290
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=290&view=rev
Author: iansmith
Date: 2007-08-29 13:55:24 -0700 (Wed, 29 Aug 2007)
Log Message:
-----------
New support for migrations and better support for test resources.
Modified Paths:
--------------
maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/Migration.java
maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/MigrationSupport.java
maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/test/DBZapTest.java
maven/trunk/ogoglio-common/.classpath
maven/trunk/ogoglio-common/pom.xml
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/WebConstants.java
maven/trunk/ogoglio-integration-test/pom.xml
maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java
maven/trunk/ogoglio-server/.classpath
maven/trunk/ogoglio-server/pom.xml
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/AccountsForTesting.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AuthServlet.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java
maven/trunk/ogoglio-server/src/test/java/com/ogoglio/persist/test/PersistTest.java
Added Paths:
-----------
maven/trunk/ogoglio-appdev/src/test/resources/basic.properties
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/PropStorage.java
maven/trunk/ogoglio-integration-test/src/test/resources/basic-config.properties
maven/trunk/ogoglio-integration-test/src/test/resources/bootstrap.properties
maven/trunk/ogoglio-integration-test/src/test/resources/test-config.properties
maven/trunk/ogoglio-server/src/test/resources/basic-config.properties
maven/trunk/ogoglio-server/src/test/resources/bootstrap.properties
maven/trunk/ogoglio-viewer-applet/src/test/java/com/ogoglio/viewer/test/
maven/trunk/ogoglio-viewer-applet/src/test/java/com/ogoglio/viewer/test/AppletTestWindow.java
Modified: maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/Migration.java
===================================================================
--- maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/Migration.java 2007-08-29 00:48:02 UTC (rev 289)
+++ maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/Migration.java 2007-08-29 20:55:24 UTC (rev 290)
@@ -9,6 +9,21 @@
public interface Migration {
- public boolean migrate(SessionFactory sessionFactory, ServletConfig servletConfig, Context ctx, Properties testConfig, int from, int to);
+ /*
+ * Called to move a running database from one version to another. The receiver should
+ * take actions that are required to make the new schema work properly, such as fixing
+ * pointers that may have been put out-of-date.
+ *
+ * Return false if things went wrong.
+ */
+ public boolean patch(SessionFactory sessionFactory, ServletConfig servletConfig, Context ctx, int from, int to);
+ /*O
+ * The receiver should use this call to populate the database with data that would be useful
+ * to sample programs or a user such as example user accounts, etc.
+ *
+ * Return false if things went wrong.
+ */
+ public boolean populate(SessionFactory sessionFactory, int from, int to);
+
}
Modified: maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/MigrationSupport.java
===================================================================
--- maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/MigrationSupport.java 2007-08-29 00:48:02 UTC (rev 289)
+++ maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/MigrationSupport.java 2007-08-29 20:55:24 UTC (rev 290)
@@ -1,9 +1,5 @@
package com.ogoglio.appdev.migrate;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
import javax.naming.Context;
import javax.naming.NamingException;
import javax.servlet.ServletConfig;
@@ -12,13 +8,19 @@
import org.hibernate.cfg.Configuration;
import com.ogoglio.appdev.persist.PersistException;
+import com.ogoglio.util.PropStorage;
import com.ogoglio.viewer.render.UIConstants;
+
+
public abstract class MigrationSupport {
//check on migration okayness
public static final String MIGRATION_KEY = "ogoglio/okToMigrateDB";
+ public static final boolean DDL_MODE_UPDATE=true;
+ public static final boolean DDL_MODE_CREATE=false;
+
public MigrationSupport() {
}
@@ -32,7 +34,8 @@
if (version != versionNumber()) {
System.err.println("DB Version Mismatch! Expected (" + versionNumber() + ") but got " + version + "!");
sessionFactory.close();
- return tryUpgrade(servletConf, ctx, version, versionNumber(), "update", true);
+ return tryUpgrade(servletConf, ctx, version, versionNumber(),
+ DDL_MODE_UPDATE, true, null);
}
sessionFactory.close();
return true; // we are at the expected version
@@ -42,12 +45,12 @@
return false;
}
System.err.println("Unable to figure out DB version number. Likely this is a fresh database....(" + e.innerThrowable.getClass().getName() + ")");
- return initialize_version(servletConf, ctx, true);
+ return initVersionAndUpgrade(servletConf, ctx);
}
}
- public boolean initialize_version(ServletConfig conf, Context ctx, boolean useJNDI) {
- Configuration configuration = createConfigurationForHibernate(0, "create", useJNDI);
+ public boolean initVersionOnly(boolean useJNDI, PropStorage propStore) {
+ Configuration configuration = createConfigurationForHibernate(0, "create", useJNDI, propStore);
try {
SessionFactory factory = configuration.buildSessionFactory();
if (setVersionNumberOfDbViaQuery(factory, 0, 0) == false) {
@@ -55,19 +58,25 @@
return false;
}
factory.close();
- return tryUpgrade(conf, ctx, 0, versionNumber(), "create", useJNDI);
- } catch (Throwable e) {
- System.err.println("Error trying initialized DB:" + e.getMessage());
+ return true;
+ } catch (Throwable t) {
+ System.err.println("Error trying initialized DB:" + t.getMessage());
return false;
}
-
}
+
+ public boolean initVersionAndUpgrade(ServletConfig conf, Context ctx) {
+ if (!initVersionOnly(true,null)) {
+ return false;
+ }
+ return tryUpgrade(conf, ctx, 0, versionNumber(), DDL_MODE_UPDATE, true,null);
+ }
public Configuration getCurrentConfiguration() {
- return createConfigurationForHibernate(versionNumber(), null, true);
+ return createConfigurationForHibernate(versionNumber(), null, true, null);
}
- public Configuration createConfigurationForHibernate(int num, String autoSetting, boolean useJNDI) {
+ public Configuration createConfigurationForHibernate(int num, String autoSetting, boolean useJNDI, PropStorage ps) {
Configuration configuration = new Configuration();
if (autoSetting != null) {
configuration.setProperty("hibernate.hbm2ddl.auto", autoSetting);
@@ -75,14 +84,7 @@
if (useJNDI) {
configuration.setProperty("hibernate.connection.datasource", "java:comp/env/jdbc/space");
} else {
- Properties p = new Properties();
- try {
- p.load(getClass().getResourceAsStream("/test-config.properties"));
- configuration.addProperties(p);
- } catch (IOException e) {
- System.err.println("Unable to find the test configuration file!" + e.getMessage());
- return configuration.configure();
- }
+ configuration.addProperties(ps.getAllProps(PropStorage.TEST_CONFIG_PROPS));
}
configuration.addInputStream(UIConstants.getResource("com/ogoglio/migrate/migration-" + num + ".xml"));
return configuration.configure();
@@ -97,35 +99,39 @@
}
}
- public boolean tryUpgrade(ServletConfig servletConfig, Context ctx, int db_is, int db_wants_to_be, String ddlMode, boolean useJNDI) {
+ public boolean tryUpgrade(ServletConfig servletConfig, Context ctx, int db_is,
+ int db_wants_to_be, boolean isUpdate, boolean useJNDI, PropStorage propStore) {
if (migrationList().length != versionNumber()) {
System.out.println("Internal error! Migration list length should be " + versionNumber() + " but is " + migrationList().length + "!");
return false;
}
- Properties testConfig = new Properties();
boolean canMigrate = false;
- if (ctx == null) {
- //in test mode
- testConfig = getTestConfig();
- if ("true".equals(testConfig.getProperty("ogoglio.okToMigrateDB"))) {
- canMigrate = true;
- }
- } else {
- //not testing, but might be integration testing
- try {
- String migrate = (String) ctx.lookup(MIGRATION_KEY);
- if ("true".equals(migrate)) {
- canMigrate = true;
- }
- } catch (NamingException e) {
- System.err.println("Naming exception trying to access " + MIGRATION_KEY + " from naming context!");
- }
+
+ //check the flags
+ try {
+ String migrate;
+ if (useJNDI) {
+ migrate = (String) ctx.lookup(MIGRATION_KEY);
+ } else {
+ migrate= propStore.getKeyFromSet(PropStorage.TEST_CONFIG_PROPS, "ogoglio.okToMigrateDB");
+ }
+ if ("true".equals(migrate)) {
+ canMigrate = true;
+ }
+ } catch (NamingException e) {
+ System.err.println("Naming exception trying to access " + MIGRATION_KEY + " from naming context!");
+ canMigrate=false;
}
if (!canMigrate) {
System.err.println("Cannot migrate data! Property ogoglio.okToMigrateDB is false or non-existent!");
return false;
}
+ String hbm_auto_flag="update";
+ if (!isUpdate) {
+ hbm_auto_flag="create";
+ }
+
for (int i = db_is; i < db_wants_to_be; ++i) {
Migration current = migrationList()[i];
@@ -133,38 +139,47 @@
System.out.println("DB: Attempting migration from " + i + " to " + (i + 1) + "...");
//try to get hibernate to do the work
- Configuration config = createConfigurationForHibernate(i + 1, ddlMode, useJNDI);
+ Configuration config = createConfigurationForHibernate(i + 1, hbm_auto_flag, useJNDI, propStore);
SessionFactory factory = config.buildSessionFactory();
//subtle: if the ddlMode is create, hibernate blows away all the data (including our version number record)
int expectedRecords = 1;
- if ("create".equals(ddlMode)) {
+ if (!isUpdate) {
expectedRecords = 0;
}
setVersionNumberOfDbViaQuery(factory, i + 1, expectedRecords);
- if (!current.migrate(factory, servletConfig, ctx, testConfig, i, i + 1)) {
+ if (!current.patch(factory, servletConfig, ctx, i, i + 1)) {
factory.close();
return false;
}
+
+ if (!isUpdate) {
+ //we need to go ahead and create the data
+ if (!current.populate(factory, i, i+1)) {
+ System.out.println("FART: Whoa! Populate failed!"+i);
+ factory.close();
+ return false;
+ }
+ System.out.println("FART: Populate ok!"+i);
+ }
+
factory.close();
System.out.println("------------------------------------------------\n");
}
return true;
}
- public Properties getTestConfig() {
- Properties testConfig = new Properties();
- InputStream is = getClass().getResourceAsStream("/test-config.properties");
- if (is == null) {
- System.err.println("Warning! Unable to find test-config.properties! Probably something is broken!");
- } else {
- try {
- testConfig.load(is);
- } catch (IOException e) {
- System.err.println("Warning! Error reading test-config.properties! " + e.getMessage());
- }
- }
- return testConfig;
- }
+ public boolean destroyAllData() {
+ PropStorage ps =new PropStorage();
+ if (ps.loadPropertySet(PropStorage.TEST_CONFIG_PROPS)==false) {
+ return false;
+ }
+
+ if (initVersionOnly(false, ps)==false) {
+ return false;
+ }
+
+ return tryUpgrade(null, null, 0, versionNumber(), DDL_MODE_CREATE, false, ps);
+ }
}
Modified: maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/test/DBZapTest.java
===================================================================
--- maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/test/DBZapTest.java 2007-08-29 00:48:02 UTC (rev 289)
+++ maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/migrate/test/DBZapTest.java 2007-08-29 20:55:24 UTC (rev 290)
@@ -5,6 +5,7 @@
import org.hibernate.SessionFactory;
import com.ogoglio.appdev.migrate.MigrationSupport;
+import com.ogoglio.util.PropStorage;
public abstract class DBZapTest extends TestCase {
@@ -15,15 +16,19 @@
public void setUp() {
try {
MigrationSupport support = getMigrationSupport();
- if (!("true".equals(support.getTestConfig().getProperty("ogoglio.okToZapDB")))) {
+ PropStorage ps=new PropStorage();
+ if (ps.loadPropertySet(PropStorage.TEST_CONFIG_PROPS)==false) {
+ fail("Can't load test configuration for hibernate properties!");
+ }
+ if (!("true".equals(ps.getKeyFromSet(PropStorage.TEST_CONFIG_PROPS,"ogoglio.okToZapDB")))) {
fail("Whoa! Shouldn't be running tests without setting the ogoglio.okToZapDB property!");
}
- if (support.initialize_version(null, null, false) == false) {
+ if (support.destroyAllData() == false) {
fail("can't get DB set up: trying to initialize it in the test code");
}
//if we are here, db stuff worked, but we still need to avoid all the jndi stuff
- sessionFactory = support.createConfigurationForHibernate(getMigrationSupport().versionNumber(), null, false).buildSessionFactory();
+ sessionFactory = support.createConfigurationForHibernate(getMigrationSupport().versionNumber(), null, false, ps).buildSessionFactory();
} catch (Exception e) {
System.out.println("-------");
e.printStackTrace(System.out);
Added: maven/trunk/ogoglio-appdev/src/test/resources/basic.properties
===================================================================
--- maven/trunk/ogoglio-appdev/src/test/resources/basic.properties (rev 0)
+++ maven/trunk/ogoglio-appdev/src/test/resources/basic.properties 2007-08-29 20:55:24 UTC (rev 290)
@@ -0,0 +1,4 @@
+# basic info needed for some tests
+ogoglio.testSpaceNumber = ${ogoglio.testSpaceNumber}
+ogoglio.baseUrl = ${ogoglio.baseURL}
+
Modified: maven/trunk/ogoglio-common/.classpath
===================================================================
--- maven/trunk/ogoglio-common/.classpath 2007-08-29 00:48:02 UTC (rev 289)
+++ maven/trunk/ogoglio-common/.classpath 2007-08-29 20:55:24 UTC (rev 290)
@@ -2,9 +2,7 @@
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/test/java"/>
- <classpathentry excluding="**" output="src/main/resources/avatar" kind="src" path="src/main/resources/avatar"/>
- <classpathentry excluding="**" output="src/main/resources/templates" kind="src" path="src/main/resources/templates"/>
- <classpathentry excluding="**" output="src/test/resources" kind="src" path="src/test/resources"/>
+ <classpathentry excluding="**" kind="src" output="src/main/resources/templates" path="src/main/resources/templates"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Modified: maven/trunk/ogoglio-common/pom.xml
===================================================================
--- maven/trunk/ogoglio-common/pom.xml 2007-08-29 00:48:02 UTC (rev 289)
+++ maven/trunk/ogoglio-common/pom.xml 2007-08-29 20:55:24 UTC (rev 290)
@@ -13,14 +13,7 @@
<build>
<resources>
<!-- FILTER RESOURCES FOR SOME CONSTANTS-->
- <!--
<resource>
- <directory>src/main/resources/testing_constants</directory>
- <filtering>true</filtering>
- </resource>
- -->
-
- <resource>
<targetPath>avatar</targetPath>
<directory>src/main/resources/avatar</directory>
</resource>
Added: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/PropStorage.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/PropStorage.java (rev 0)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/PropStorage.java 2007-08-29 20:55:24 UTC (rev 290)
@@ -0,0 +1,55 @@
+package com.ogoglio.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/*
+ * This is used by test and utility code to manipulate the DB and avoid having production
+ * jars that contain property files that have private information.
+ */
+public class PropStorage {
+
+ public static final String TEST_CONFIG_PROPS="test-config.properties";
+ public static final String BOOTSTRAP_PROPS="bootstrap.properties";
+ public static final String BASIC_PROPS = "basic-config.properties";
+
+
+
+ private Map propMap = new HashMap();
+
+ public PropStorage() {}
+
+ public boolean loadPropertySet(String propsetNameAndPath) {
+ if (!propMap.containsKey(propsetNameAndPath)) {
+ InputStream is;
+ is = UIConstants.class.getClassLoader().getResourceAsStream(propsetNameAndPath);
+ if (is== null) {
+ is= UIConstants.class.getResourceAsStream(propsetNameAndPath);
+ }
+ if (is==null) {
+ return false;
+ }
+ Properties props=new Properties();
+ try {
+ props.load(is);
+ propMap.put(propsetNameAndPath,props);
+ } catch (IOException e) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public String getKeyFromSet(String propSetName, String key) {
+ Properties props=(Properties)propMap.get(propSetName);
+ return props.getProperty(key);
+ }
+
+ public Properties getAllProps(String propsetNameAndPath) {
+ return (Properties)propMap.get(propsetNameAndPath);
+ }
+
+}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/WebConstants.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/WebConstants.java 2007-08-29 00:48:02 UTC (rev 289)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/WebConstants.java 2007-08-29 20:55:24 UTC (rev 290)
@@ -1,8 +1,5 @@
package com.ogoglio.util;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
public class WebConstants {
public static final String AUTH_USERNAME_PARAM = "username";
Modified: maven/trunk/ogoglio-integration-test/pom.xml
===================================================================
--- maven/trunk/ogoglio-integration-test/pom.xml 2007-08-29 00:48:02 UTC (rev 289)
+++ maven/trunk/ogoglio-integration-test/pom.xml 2007-08-29 20:55:24 UTC (rev 290)
@@ -9,13 +9,23 @@
<packaging>pom</packaging>
<build>
+ <!-- -->
+ <!-- TEST RESOURCES -->
+ <!-- -->
<testResources>
<testResource>
- <targetPath></targetPath>
- <directory>src/test/resources/</directory>
+ <directory>src/test/resources</directory>
<filtering>true</filtering>
+ <includes>
+ <include>test-config.properties</include>
+ <include>basic-config.properties</include>
+ <include>bootstrap.properties</include>
+ <include>mail/*</include>
+ <include>sample-art3d/*</include>
+ </includes>
</testResource>
</testResources>
+
<plugins>
<!-- COMPILER needed b/c POM packaging by default doesn't build the tests -->
<plugin>
@@ -99,8 +109,10 @@
<goals>
<goal>stop</goal>
</goals>
+
<configuration>
<wait>true</wait>
+ <type>runtime</type>
</configuration>
</execution>
<execution>
@@ -110,7 +122,8 @@
<goals>
<goal>stop</goal>
</goals>
- <configuration>
+ <configuration>
+ <type>runtime</type>
<wait>false</wait>
</configuration>
</execution>
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-08-29 00:48:02 UTC (rev 289)
+++ maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java 2007-08-29 20:55:24 UTC (rev 290)
@@ -41,8 +41,10 @@
import com.ogoglio.client.model.SplinePath;
import com.ogoglio.client.model.Thing;
import com.ogoglio.client.model.User;
+import com.ogoglio.util.PropStorage;
import com.ogoglio.util.StreamUtils;
import com.ogoglio.util.WebConstants;
+import com.ogoglio.viewer.render.UIConstants;
import com.ogoglio.xml.AccountDocument;
import com.ogoglio.xml.AuthDocument;
import com.ogoglio.xml.BodyDocument;
@@ -97,7 +99,15 @@
public void testWebAdmin() {
try {
- WebAPIAuthenticator adminAuthenticator = new WebAPIAuthenticatorFactory().authenticate(wire1, descriptor1, BootstrapInfo.getBootstrapUsername(), BootstrapInfo.getBootstrapUserPW());
+ PropStorage ps=new PropStorage();
+ if (ps.loadPropertySet(PropStorage.BOOTSTRAP_PROPS)==false) {
+ fail("unable to load properties bootstrap.properties!");
+ }
+
+ WebAPIAuthenticator adminAuthenticator = new WebAPIAuthenticatorFactory().authenticate(wire1, descriptor1,
+ ps.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "bootstrapUser"),
+ ps.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "bootstrapUserPW"));
+
assertNotNull("got null auth cookie", adminAuthenticator.getAuthCookie());
WebAPIClient adminWebClient = new WebAPIClient(descriptor1, adminAuthenticator, wire1);
@@ -240,7 +250,7 @@
private UserDocument[] verifyUserDocsBySize(WebAPIClient webClient1, long spaceID, int expectedLen, String expectedUsername) throws IOException {
UserDocument[] userDocs = webClient1.getUserDocuments(spaceID);
- assertTrue(userDocs.length == expectedLen);
+ assertEquals(expectedLen,userDocs.length);
if (expectedUsername != null) {
assertEquals(expectedUsername, userDocs[0].getUsername());
}
@@ -422,6 +432,7 @@
SpaceClient guestSpaceClient1 = new SpaceClient(spaceID, serviceURI1, guestCookie1, new TestSpaceClientListener());
try {
Thread.sleep(1000);
+ Thread.yield();
} catch (InterruptedException e) {
e.printStackTrace();
}
@@ -533,11 +544,10 @@
String CUBE_GIF = "TestCube.gif";
String CUBE_MATERIAL = "TestCube.mtl";
- Class clazz = getClass();
- webClient1.uploadTemplateGeometryStream(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), 0, clazz.getResourceAsStream("/sample-art3d/TestCube.obj"));
- webClient1.uploadTemplateResourceStream(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), CUBE_MATERIAL, clazz.getResourceAsStream("/sample-art3d/TestCube.mtl"));
- webClient1.uploadTemplateResourceStream(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), CUBE_GIF, clazz.getResourceAsStream("/sample-art3d/TestCube.gif"));
- webClient1.updateTemplateScript(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), StreamUtils.readInput(clazz.getResourceAsStream("/sample-art3d/TestCube.js")));
+ webClient1.uploadTemplateGeometryStream(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), 0, UIConstants.getResource("sample-art3d/TestCube.obj"));
+ webClient1.uploadTemplateResourceStream(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), CUBE_MATERIAL, UIConstants.getResource("sample-art3d/TestCube.mtl"));
+ webClient1.uploadTemplateResourceStream(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), CUBE_GIF, UIConstants.getResource("sample-art3d/TestCube.gif"));
+ webClient1.updateTemplateScript(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID(), StreamUtils.readInput(UIConstants.getResource("sample-art3d/TestCube.js")));
baseDoc = webClient1.getTemplateDocument(newTemplateDoc.getOwnerUsername(), newTemplateDoc.getTemplateID());
//make sure the sequence right above didn't take more than 1 sec
Added: maven/trunk/ogoglio-integration-test/src/test/resources/basic-config.properties
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/resources/basic-config.properties (rev 0)
+++ maven/trunk/ogoglio-integration-test/src/test/resources/basic-config.properties 2007-08-29 20:55:24 UTC (rev 290)
@@ -0,0 +1,4 @@
+# basic info needed for some tests
+ogoglio.testSpaceNumber = ${ogoglio.testSpaceNumber}
+ogoglio.baseUrl = ${ogoglio.baseURL}
+
Added: maven/trunk/ogoglio-integration-test/src/test/resources/bootstrap.properties
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/resources/bootstrap.properties (rev 0)
+++ maven/trunk/ogoglio-integration-test/src/test/resources/bootstrap.properties 2007-08-29 20:55:24 UTC (rev 290)
@@ -0,0 +1,2 @@
+bootstrapUser=${ogoglio.bootstrapUser}
+bootstrapUserPW=${ogoglio.bootstrapUserPW}
Added: maven/trunk/ogoglio-integration-test/src/test/resources/test-config.properties
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/resources/test-config.properties (rev 0)
+++ maven/trunk/ogoglio-integration-test/src/test/resources/test-config.properties 2007-08-29 20:55:24 UTC (rev 290)
@@ -0,0 +1,28 @@
+# this is needed for running tests because tomcat isn't
+# actually around when these tests get run so we need
+# to use the DB via the simple c3po connection manager
+# (supplied with hibernate)
+
+hibernate.connection.driver_class = com.mysql.jdbc.Driver
+hibernate.connection.url = ${ogoglio.mysql.url}
+hibernate.connection.username = ${ogoglio.mysql.user}
+hibernate.connection.password = ${ogoglio.mysql.password}
+hibernate.show_sql=false
+hibernate.dialect=org.hibernate.dialect.MySQLDialect
+
+#copied from the web
+#hibernate.c3p0.min_size=5
+#hibernate.c3p0.max_size=20
+#hibernate.c3p0.timeout=1800
+#hibernate.c3p0.max_statements=50
+
+#for doing tests that need bootstrap
+ogoglio.baseURL=${ogoglio.baseURL}
+ogoglio.bootstrapUser=${ogoglio.bootstrapUser}
+ogoglio.bootstrapUserPW=${ogoglio.bootstrapUserPW}
+
+#can destroy the db?
+ogoglio.okToZapDB=${ogoglio.okToZapDB}
+#can migrate data?
+ogoglio.okToMigrateDB=${ogoglio.okToMigrateDB}
+
Modified: maven/trunk/ogoglio-server/.classpath
===================================================================
--- maven/trunk/ogoglio-server/.classpath 2007-08-29 00:48:02 UTC (rev 289)
+++ maven/trunk/ogoglio-server/.classpath 2007-08-29 20:55:24 UTC (rev 290)
@@ -1,9 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <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">
<attributes>
- <attribute value="/usr/local/jdk1.5.0_12/jre/lib/i386" name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY"/>
+ <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="/usr/local/jdk1.5.0_12/jre/lib/i386"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
Modified: maven/trunk/ogoglio-server/pom.xml
===================================================================
--- maven/trunk/ogoglio-server/pom.xml 2007-08-29 00:48:02 UTC (rev 289)
+++ maven/trunk/ogoglio-server/pom.xml 2007-08-29 20:55:24 UTC (rev 290)
@@ -65,6 +65,8 @@
<filtering>true</filtering>
<includes>
<include>test-config.properties</include>
+ <include>basic-config.properties</include>
+ <include>bootstrap.properties</include>
<include>mail/*</include>
<include>templates/*</include>
</includes>
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/AccountsForTesting.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/AccountsForTesting.java 2007-08-29 00:48:02 UTC (rev 289)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/AccountsForTesting.java 2007-08-29 20:55:24 UTC (rev 290)
@@ -1,7 +1,6 @@
package com.ogoglio.migrate;
import java.net.URI;
-import java.util.Properties;
import javax.naming.Context;
import javax.servlet.ServletConfig;
@@ -9,35 +8,49 @@
import org.hibernate.SessionFactory;
import com.ogoglio.appdev.migrate.Migration;
-import com.ogoglio.appdev.servlet.AbstractResourceServlet;
import com.ogoglio.persist.ServiceInitializationPersistTasks;
+import com.ogoglio.util.PropStorage;
+
public class AccountsForTesting implements Migration {
- private static final String BOOTSTRAP_ACCT_USER_KEY = "ogoglio/bootstrapUser";
+ public boolean patch(SessionFactory sessionFactory, ServletConfig config, Context ctx, int from, int to) {
+ return true;
+ }
+ public boolean populate(SessionFactory sessionFactory, int from, int to) {
- private static final String BOOTSTRAP_ACCT_PW_KEY = "ogoglio/bootstrapUserPW";
-
- public boolean migrate(SessionFactory sessionFactory, ServletConfig NOTUSED, Context ctx, Properties testConfig, int from, int to) {
-
if ((from != 0) || (to != 1)) {
System.out.println("Migration called in the wrong place! Expected 0->1 but was:" + from + "->" + to + "!");
System.out.println("Migration called in the wrong place! Check the ordering of migration array!");
return false;
}
try {
+
String uriString, user, pw;
- //if null, we are test mode
- if (ctx == null) {
- uriString = testConfig.getProperty(AbstractResourceServlet.OGOGLIO_BASE_URL_KEY.replace('/', '.'));
- user = testConfig.getProperty(BOOTSTRAP_ACCT_USER_KEY.replace('/', '.'));
- pw = testConfig.getProperty(BOOTSTRAP_ACCT_PW_KEY.replace('/', '.'));
- } else {
- uriString = (String) ctx.lookup(AbstractResourceServlet.OGOGLIO_BASE_URL_KEY);
- user = (String) ctx.lookup(BOOTSTRAP_ACCT_USER_KEY);
- pw = (String) ctx.lookup(BOOTSTRAP_ACCT_PW_KEY);
+ PropStorage zap=new PropStorage();
+ System.out.println("FART1--->populate:"+(zap.loadPropertySet(PropStorage.BOOTSTRAP_PROPS))+","+
+ zap.loadPropertySet(PropStorage.BASIC_PROPS));
+
+ if (zap.loadPropertySet(PropStorage.BOOTSTRAP_PROPS)==false) {
+ return false;
}
+ if (zap.loadPropertySet(PropStorage.BASIC_PROPS)==false) {
+ return false;
+ }
+ System.out.println("FART2--->populate:");
+ uriString = zap.getKeyFromSet(PropStorage.BASIC_PROPS, "ogoglio.baseUrl");
+ user=zap.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "bootstrapUser");
+ pw=zap.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "bootstrapUserPW");
+
+ if ((uriString==null) || (user==null) || (pw==null)) {
+ System.out.println("URI FART:"+(uriString==null));
+ System.out.println("USER FART:"+(user==null));
+ System.out.println("PW FART:"+(pw==null));
+ return false;
+ }
+
+ System.out.println("FART3--->uriString:"+uriString);
URI uri = new URI(uriString);
//actual work
ServiceInitializationPersistTasks.initializeLocalSim(uri, sessionFactory);
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AuthServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AuthServlet.java 2007-08-29 00:48:02 UTC (rev 289)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AuthServlet.java 2007-08-29 20:55:24 UTC (rev 290)
@@ -50,7 +50,7 @@
if (cookie == null) {
return false;
}
- return cookie.startsWith(GUEST_COOKIE_PREFIX);
+ return cookie.startsWith(WebConstants.GUEST_COOKIE_PREFIX);
}
public static AccountRecord getAuthedAccountRecord(HttpServletRequest request, SessionFactory hibernateSessionFactory) throws PersistException {
@@ -238,13 +238,11 @@
public static final String COOKIE_CHARS = "abcdefghijklmnopqrstuvwxyz1234567890";
- public static final String GUEST_COOKIE_PREFIX = "guest";
-
public static final String[] GUEST_NAMES = { "Moon", "Spoon", "Plume", "Bloom", "Thyme", "Rhyme", "Steel", "Boat", "Vase", "Book", "Screen", "Fenestra", "Farmer", "Door", "Squid", "Rocket", "Picker", "Page", "Lawn", "Food", "Plate", "Bean", "Horse", "Cat", "Fireplace", "Frame", "Chair", "Table", "Sofa", "Stair", "Counter", "Shelf", "Phone", "Robot", "Tree", "Key" };
private String generateGuestCookie() {
StringBuffer result = new StringBuffer();
- result.append(GUEST_COOKIE_PREFIX);
+ result.append(WebConstants.GUEST_COOKIE_PREFIX);
for (int i = 0; i < 3; i++) {
result.append("_" + GUEST_NAMES[Math.abs(random.nextInt()) % GUEST_NAMES.length]);
}
@@ -254,7 +252,7 @@
private String generateAuthCookie(boolean guest) {
StringBuffer result = new StringBuffer(14);
if (guest) {
- result.append(GUEST_COOKIE_PREFIX);
+ result.append(WebConstants.GUEST_COOKIE_PREFIX);
} else {
result.append("tr");
}
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-08-29 00:48:02 UTC (rev 289)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java 2007-08-29 20:55:24 UTC (rev 290)
@@ -40,6 +40,7 @@
import com.ogoglio.persist.SpaceRecord;
import com.ogoglio.util.ArgumentUtils;
import com.ogoglio.util.TwoWayMap;
+import com.ogoglio.util.WebConstants;
import com.ogoglio.xml.SpaceEvent;
import com.ogoglio.xml.UserDocument;
@@ -124,7 +125,7 @@
String username = null;
long bodyID = -1;
- if (payload.getLoginCookie().startsWith(AuthServlet.GUEST_COOKIE_PREFIX)) {
+ if (payload.getLoginCookie().startsWith(WebConstants.GUEST_COOKIE_PREFIX)) {
if (!SpacePersistTasks.canReadSpace(null, payload.getSpaceID(), sessionFactory)) {
Message failureMessage = new Message(channelServer.getLocator(), request.getOrigin(), payload.getSpaceID(), new PayloadFactory.AuthenticationFailurePayload("Guests are not allowed in this space."));
sourceChannel.sendMessage(failureMessage);
@@ -161,7 +162,7 @@
return;
}
- if(username.startsWith(AuthServlet.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) {
Modified: maven/trunk/ogoglio-server/src/test/java/com/ogoglio/persist/test/PersistTest.java
===================================================================
--- maven/trunk/ogoglio-server/src/test/java/com/ogoglio/persist/test/PersistTest.java 2007-08-29 00:48:02 UTC (rev 289)
+++ maven/trunk/ogoglio-server/src/test/java/com/ogoglio/persist/test/PersistTest.java 2007-08-29 20:55:24 UTC (rev 290)
@@ -68,6 +68,7 @@
}
}
public void setUp() {
+
super.setUp();
username1 = AccountRecord.cleanUsername("MoonUnitZappa");
email1 = AccountRecord.cleanEmail("mu...@ex...");
Added: maven/trunk/ogoglio-server/src/test/resources/basic-config.properties
===================================================================
--- maven/trunk/ogoglio-server/src/test/resources/basic-config.properties (rev 0)
+++ maven/trunk/ogoglio-server/src/test/resources/basic-config.properties 2007-08-29 20:55:24 UTC (rev 290)
@@ -0,0 +1,4 @@
+# basic info needed for some tests
+ogoglio.testSpaceNumber = ${ogoglio.testSpaceNumber}
+ogoglio.baseUrl = ${ogoglio.baseURL}
+
Added: maven/trunk/ogoglio-server/src/test/resources/bootstrap.properties
===================================================================
--- maven/trunk/ogoglio-server/src/test/resources/bootstrap.properties (rev 0)
+++ maven/trunk/ogoglio-server/src/test/resources/bootstrap.properties 2007-08-29 20:55:24 UTC (rev 290)
@@ -0,0 +1,2 @@
+bootstrapUser=${ogoglio.bootstrapUser}
+bootstrapUserPW=${ogoglio.bootstrapUserPW}
Copied: maven/trunk/ogoglio-viewer-applet/src/test/java/com/ogoglio/viewer/test/AppletTestWindow.java (from rev 277, maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/AppletTestWindow.java)
===================================================================
--- maven/trunk/ogoglio-viewer-applet/src/test/java/com/ogoglio/viewer/test/AppletTestWindow.java (rev 0)
+++ maven/trunk/ogoglio-viewer-applet/src/test/java/com/ogoglio/viewer/test/AppletTestWindow.java 2007-08-29 20:55:24 UTC (rev 290)
@@ -0,0 +1,162 @@
+/* Copyright 2007 Transmutable (http://transmutable.com/)
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. */
+
+package com.ogoglio.viewer.test;
+
+import java.applet.Applet;
+import java.applet.AppletContext;
+import java.applet.AppletStub;
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+
+import com.ogoglio.client.WebAPIAuthenticator;
+import com.ogoglio.client.WebAPIClientWire;
+import com.ogoglio.client.WebAPIDescriptor;
+import com.ogoglio.util.PropStorage;
+import com.ogoglio.util.WebConstants;
+import com.ogoglio.viewer.applet.ViewerApplet;
+
+public class AppletTestWindow extends Frame {
+
+ //static Dimension appDimension = new Dimension(640, 500);
+ //static Dimension appDimension = new Dimension(500, 522);
+ static Dimension appDimension = new Dimension(1000, 640);
+
+ Applet applet = null;
+
+ EnvironmentStub clientStub1 = null;
+
+ String host = "127.0.0.1:8080";
+
+ String serviceURI = "http://" + host + "/og/";
+
+ URL codeBase = getURL(serviceURI);
+
+ static boolean fullScreen = false;
+
+ public AppletTestWindow() {
+ setLayout(new BorderLayout());
+ setSize(appDimension);
+ setLocation(30, 50);
+ setResizable(false);
+ if (fullScreen) {
+ this.setUndecorated(true);
+ }
+ PropStorage ps=new PropStorage();
+ if (!ps.loadPropertySet(PropStorage.BOOTSTRAP_PROPS)) {
+ System.out.println("Can't find bootstrap properties!");
+ System.exit(1);
+ }
+ if (!ps.loadPropertySet(PropStorage.BASIC_PROPS)) {
+ System.out.println("Can't find basic properties!");
+ System.exit(1);
+ }
+ HashMap parameters1 = new HashMap();
+ try {
+ WebAPIAuthenticator authenticator = new WebAPIAuthenticator(new WebAPIClientWire(), new WebAPIDescriptor(new URI(serviceURI)),
+ ps.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "bootstrapUser"),
+ ps.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "bootstrapUserPW"));
+ parameters1.put(WebConstants.AUTH_COOKIE, authenticator.getAuthCookie());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ //parameters1.put("loginCookie", "guestApplet_Test_Window2");
+
+ parameters1.put("spaceID", "" + ps.getKeyFromSet(PropStorage.BASIC_PROPS, "testSpaceNumber"));
+ parameters1.put("serviceURI", serviceURI);
+
+ //parameters1.put("x", "0");
+ //parameters1.put("y", "1000");
+ //parameters1.put("z", "0");
+ //parameters1.put("rx", "-1.6");
+ //parameters1.put("ry", "0");
+ //parameters1.put("rz", "0");
+
+ //parameters1.put("movable", "false");
+
+ clientStub1 = new EnvironmentStub(parameters1);
+ applet = new ViewerApplet();
+ //applet = new BodyEditorApplet();
+ applet.setStub(clientStub1);
+ add(applet, BorderLayout.CENTER);
+ }
+
+ private class EnvironmentStub implements AppletStub {
+
+ HashMap parameters = null;
+
+ public EnvironmentStub(HashMap parameters) {
+ this.parameters = parameters;
+ }
+
+ public void appletResize(int width, int height) {
+ }
+
+ public AppletContext getAppletContext() {
+ return null;
+ }
+
+ public URL getCodeBase() {
+ return codeBase;
+ }
+
+ public URL getDocumentBase() {
+ return codeBase;
+ }
+
+ public String getParameter(String name) {
+ return (String) parameters.get(name);
+ }
+
+ public boolean isActive() {
+ return true;
+ }
+
+ }
+
+ public void start() {
+ applet.init();
+ applet.start();
+ }
+
+ private static URL getURL(String url) {
+ try {
+ return new URL(url);
+ } catch (MalformedURLException e) {
+ throw new IllegalStateException("Bad url: " + url);
+ }
+ }
+
+ public static void main(String[] args) {
+ GraphicsEnvironment graphicsEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsDevice device = graphicsEnv.getDefaultScreenDevice();
+ if (fullScreen) {
+ appDimension = new Dimension(device.getDisplayMode().getWidth(), device.getDisplayMode().getWidth());
+ }
+ AppletTestWindow test = new AppletTestWindow();
+ test.setVisible(true);
+ if (fullScreen) {
+ device.setFullScreenWindow(test);
+ }
+ test.start();
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-29 00:48:03
|
Revision: 289
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=289&view=rev
Author: trevorolio
Date: 2007-08-28 17:48:02 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
HTML typo
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/webapp/body.html
Modified: maven/trunk/ogoglio-server/src/main/webapp/body.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/body.html 2007-08-28 23:53:35 UTC (rev 288)
+++ maven/trunk/ogoglio-server/src/main/webapp/body.html 2007-08-29 00:48:02 UTC (rev 289)
@@ -42,7 +42,7 @@
function handleAuth(){
if(loginCookie == null){
- mainElement.innerHTML = "<h2>Pleae sign in to use this page.</h2>";
+ mainElement.innerHTML = "<h2>Please sign in to use this page.</h2>";
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-28 23:53:34
|
Revision: 288
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=288&view=rev
Author: trevorolio
Date: 2007-08-28 16:53:35 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Removed the test window and moved it into the integration tests module.
Removed Paths:
-------------
maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/AppletTestWindow.java
Deleted: maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/AppletTestWindow.java
===================================================================
--- maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/AppletTestWindow.java 2007-08-28 23:53:00 UTC (rev 287)
+++ maven/trunk/ogoglio-viewer-applet/src/main/java/com/ogoglio/viewer/applet/AppletTestWindow.java 2007-08-28 23:53:35 UTC (rev 288)
@@ -1,151 +0,0 @@
-/* Copyright 2007 Transmutable (http://transmutable.com/)
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. */
-
-package com.ogoglio.viewer.applet;
-
-import java.applet.Applet;
-import java.applet.AppletContext;
-import java.applet.AppletStub;
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.Frame;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.HashMap;
-
-import com.ogoglio.client.WebAPIAuthenticator;
-import com.ogoglio.client.WebAPIClientWire;
-import com.ogoglio.client.WebAPIDescriptor;
-import com.ogoglio.util.WebConstants;
-
-public class AppletTestWindow extends Frame {
-
- //static Dimension appDimension = new Dimension(640, 500);
- //static Dimension appDimension = new Dimension(500, 522);
- static Dimension appDimension = new Dimension(1000, 640);
-
- Applet applet = null;
-
- EnvironmentStub clientStub1 = null;
-
- String host = "127.0.0.1:8080";
-
- String serviceURI = "http://" + host + "/og/";
-
- URL codeBase = getURL(serviceURI);
-
- static boolean fullScreen = false;
-
- public AppletTestWindow() {
- setLayout(new BorderLayout());
- setSize(appDimension);
- setLocation(30, 50);
- setResizable(false);
- if (fullScreen) {
- this.setUndecorated(true);
- }
-
- HashMap parameters1 = new HashMap();
- System.out.println("HERE FART:"+WebConstants.getBootstrapUsername());
- try {
- WebAPIAuthenticator authenticator = new WebAPIAuthenticator(new WebAPIClientWire(), new WebAPIDescriptor(new URI(serviceURI)), WebConstants.getBootstrapUsername(), WebConstants.getBootstrapUserPW());
- parameters1.put("loginCookie", authenticator.getAuthCookie());
- } catch (Exception e) {
- e.printStackTrace();
- }
- //parameters1.put("loginCookie", "guestApplet_Test_Window2");
-
- parameters1.put("spaceID", "" + 4);
- parameters1.put("serviceURI", serviceURI);
-
- //parameters1.put("x", "0");
- //parameters1.put("y", "1000");
- //parameters1.put("z", "0");
- //parameters1.put("rx", "-1.6");
- //parameters1.put("ry", "0");
- //parameters1.put("rz", "0");
-
- //parameters1.put("movable", "false");
-
- clientStub1 = new EnvironmentStub(parameters1);
- applet = new ViewerApplet();
- //applet = new BodyEditorApplet();
- applet.setStub(clientStub1);
- add(applet, BorderLayout.CENTER);
- }
-
- private class EnvironmentStub implements AppletStub {
-
- HashMap parameters = null;
-
- public EnvironmentStub(HashMap parameters) {
- this.parameters = parameters;
- }
-
- public void appletResize(int width, int height) {
- }
-
- public AppletContext getAppletContext() {
- return null;
- }
-
- public URL getCodeBase() {
- return codeBase;
- }
-
- public URL getDocumentBase() {
- return codeBase;
- }
-
- public String getParameter(String name) {
- return (String) parameters.get(name);
- }
-
- public boolean isActive() {
- return true;
- }
-
- }
-
- public void start() {
- applet.init();
- applet.start();
- }
-
- private static URL getURL(String url) {
- try {
- return new URL(url);
- } catch (MalformedURLException e) {
- throw new IllegalStateException("Bad url: " + url);
- }
- }
-
- public static void main(String[] args) {
- GraphicsEnvironment graphicsEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
- GraphicsDevice device = graphicsEnv.getDefaultScreenDevice();
- if (fullScreen) {
- appDimension = new Dimension(device.getDisplayMode().getWidth(), device.getDisplayMode().getWidth());
- }
- AppletTestWindow test = new AppletTestWindow();
- test.setVisible(true);
- if (fullScreen) {
- device.setFullScreenWindow(test);
- }
- test.start();
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-08-28 23:53:05
|
Revision: 287
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=287&view=rev
Author: trevorolio
Date: 2007-08-28 16:53:00 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Added test template resources.
Removed some debug printlns.
Modified Paths:
--------------
maven/trunk/ogoglio-server/.classpath
maven/trunk/ogoglio-server/pom.xml
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/mail/MailClient.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
maven/trunk/ogoglio-server/src/test/java/com/ogoglio/persist/test/PersistTest.java
maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java
Added Paths:
-----------
maven/trunk/ogoglio-server/src/test/resources/templates/
maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.gif
maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.js
maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.mtl
maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.obj
Modified: maven/trunk/ogoglio-server/.classpath
===================================================================
--- maven/trunk/ogoglio-server/.classpath 2007-08-28 23:51:30 UTC (rev 286)
+++ maven/trunk/ogoglio-server/.classpath 2007-08-28 23:53:00 UTC (rev 287)
@@ -1,14 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <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/hibernate" path="src/test/resources/hibernate"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
- <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="/usr/local/jdk1.5.0_12/jre/lib/i386"/>
+ <attribute value="/usr/local/jdk1.5.0_12/jre/lib/i386" name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
Modified: maven/trunk/ogoglio-server/pom.xml
===================================================================
--- maven/trunk/ogoglio-server/pom.xml 2007-08-28 23:51:30 UTC (rev 286)
+++ maven/trunk/ogoglio-server/pom.xml 2007-08-28 23:53:00 UTC (rev 287)
@@ -66,6 +66,7 @@
<includes>
<include>test-config.properties</include>
<include>mail/*</include>
+ <include>templates/*</include>
</includes>
</testResource>
</testResources>
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/mail/MailClient.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/mail/MailClient.java 2007-08-28 23:51:30 UTC (rev 286)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/mail/MailClient.java 2007-08-28 23:53:00 UTC (rev 287)
@@ -38,10 +38,10 @@
public MailClient() {
writeToDisk = false;
}
-
+
public void sendEmail(String to, String from, String subject, String body) throws MailSendException {
try {
- if (writeToDisk) {
+ if (writeToDisk) {
sendToDisk(to, from, subject, body);
} else {
sendViaContextSession(to, from, subject, body);
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-08-28 23:51:30 UTC (rev 286)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-08-28 23:53:00 UTC (rev 287)
@@ -154,7 +154,6 @@
public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
try {
long spaceID = Long.parseLong(pathElements[pathElements.length - 1]);
- System.out.println("FART TRYING TO GET SPACE DOC FOR "+spaceID);
SpaceRecord spaceRecord = SpacePersistTasks.findSpaceBySpaceID(spaceID, getSessionFactory());
if (spaceRecord == null) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
@@ -265,7 +264,6 @@
public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
long spaceID = Long.parseLong(pathElements[2]);
try {
- System.out.println("SIM FART GET:"+spaceID);
SpaceRecord spaceRecord = SpacePersistTasks.findSpaceBySpaceID(spaceID, getSessionFactory());
if (spaceRecord == null) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
@@ -278,14 +276,12 @@
return;
}
- System.out.println("SIM FART GET2:"+authedAccount.getUsername());
SpaceSimulator simulator = sim.getOrCreateSpaceSimulator(spaceRecord);
String value = simulator.getSetting(pathElements[pathElements.length - 1]);
if (value == null) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
}
- System.out.println("SIM FART GET3:"+value);
sendStringResponse(value, "text/plain", response);
} catch (PersistException e) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
Modified: maven/trunk/ogoglio-server/src/test/java/com/ogoglio/persist/test/PersistTest.java
===================================================================
--- maven/trunk/ogoglio-server/src/test/java/com/ogoglio/persist/test/PersistTest.java 2007-08-28 23:51:30 UTC (rev 286)
+++ maven/trunk/ogoglio-server/src/test/java/com/ogoglio/persist/test/PersistTest.java 2007-08-28 23:53:00 UTC (rev 287)
@@ -68,9 +68,6 @@
}
}
public void setUp() {
-
- System.out.println("FART FART FART:" +(getClass().getResourceAsStream("com/ogoglio/migrate/migration-0.xml")==null));
-
super.setUp();
username1 = AccountRecord.cleanUsername("MoonUnitZappa");
email1 = AccountRecord.cleanEmail("mu...@ex...");
Modified: maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java
===================================================================
--- maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java 2007-08-28 23:51:30 UTC (rev 286)
+++ maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java 2007-08-28 23:53:00 UTC (rev 287)
@@ -4,60 +4,68 @@
import java.io.InputStream;
import java.util.HashMap;
+import javax.media.j3d.Transform3D;
+
import junit.framework.TestCase;
import com.ogoglio.sim.SpaceSimulator;
+import com.ogoglio.viewer.render.UIConstants;
import com.ogoglio.xml.SpaceDocument;
import com.ogoglio.xml.SpaceEvent;
import com.ogoglio.xml.TemplateDocument;
+import com.ogoglio.xml.ThingDocument;
public class ScriptTest extends TestCase {
public static final String simplestScript = "var i = 0; i++; ++i";
-
+
public static final String constructorScript = "function construct(thingID) { return 'script constructed ' + thingID; }";
//TODO test the script API for regressions
-
+
public void testSpaceScriptEngine() {
-
+
TestSpaceListener listener = new TestSpaceListener();
SpaceSimulator spaceSimulator = null;
- // try {
+ try {
SpaceDocument spaceDocument = new SpaceDocument(1, "Space", "trevor", true, 0, false, 0, 1);
spaceSimulator = new SpaceSimulator(spaceDocument, listener);
spaceSimulator.startSim();
-
+
TemplateDocument templateDoc1 = new TemplateDocument(1, "Template 1", "trevor", "A cool template", null);
listener.templateMap.put(new Long(1), templateDoc1);
listener.scriptMap.put(new Long(1), simplestScript);
- //ThingDocument thingDoc = spaceSimulator.addThing(templateDoc1.getTemplateID(), templateDoc1.getOwnerUsername(), templateDoc1.getDisplayName(), "trevor", 1, new Transform3D());
- //assertTrue(spaceSimulator.removeThing(thingDoc.getThingID()));
+ listener.objMap.put(new Long(1), "templates/TestCube.obj");
+ listener.resourceMap.put(new Long(1), "templates/TestCube.mtl");
+ ThingDocument thingDoc = spaceSimulator.addThing(templateDoc1.getTemplateID(), templateDoc1.getOwnerUsername(), templateDoc1.getDisplayName(), "trevor", 1, new Transform3D());
+ assertTrue(spaceSimulator.removeThing(thingDoc.getThingID()));
TemplateDocument templateDoc2 = new TemplateDocument(2, "Template 2", "trevor", "Another cool template", null);
listener.templateMap.put(new Long(2), templateDoc2);
listener.scriptMap.put(new Long(2), constructorScript);
- //thingDoc = spaceSimulator.addThing(templateDoc2.getTemplateID(), templateDoc2.getOwnerUsername(), templateDoc2.getDisplayName(), "trevor", 2, new Transform3D());
- //assertTrue(spaceSimulator.removeThing(thingDoc.getThingID()));
+ listener.objMap.put(new Long(2), "templates/TestCube.obj");
+ listener.resourceMap.put(new Long(2), "templates/TestCube.mtl");
+ thingDoc = spaceSimulator.addThing(templateDoc2.getTemplateID(), templateDoc2.getOwnerUsername(), templateDoc2.getDisplayName(), "trevor", 2, new Transform3D());
+ assertTrue(spaceSimulator.removeThing(thingDoc.getThingID()));
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
- // }finally {
- // spaceSimulator.cleanup();
- // }
+ } finally {
+ spaceSimulator.cleanup();
+ }
}
private static void delete(File dir) {
File[] children = dir.listFiles();
- if(children == null) {
+ if (children == null) {
return;
}
for (int i = 0; i < children.length; i++) {
- if(children[i].isDirectory()) {
+ if (children[i].isDirectory()) {
delete(children[i]);
} else {
children[i].delete();
@@ -65,34 +73,45 @@
}
dir.delete();
}
-
-
+
private class TestSpaceListener implements SpaceSimulator.Listener {
HashMap scriptMap = new HashMap(); //Long templateIDs to String scripts
-
+
HashMap templateMap = new HashMap(); //Long templateIDs to TemplateDocuments
+
+ HashMap objMap = new HashMap(); //Long templateIDs to obj resource names
+ HashMap resourceMap = new HashMap(); //Long templateIDs to template resource names
+
public void generatedSpaceEvent(SpaceEvent event, SpaceSimulator spaceSimulator) {
}
public String getTemplateScript(long templateID) {
- return (String)scriptMap.get(new Long(templateID));
+ return (String) scriptMap.get(new Long(templateID));
}
public TemplateDocument getTemplateDocument(long templateID) {
- return (TemplateDocument)templateMap.get(new Long(templateID));
+ return (TemplateDocument) templateMap.get(new Long(templateID));
}
public void requestSave(SpaceSimulator simulator) {
}
public InputStream getTemplateGeometryStream(long templateID, int lodIndex) {
- return null;
+ String resourcePath = (String)objMap.get(new Long(templateID));
+ if(resourcePath == null){
+ return null;
+ }
+ return UIConstants.getResource(resourcePath);
}
public InputStream getTemplateResourceStream(long templateID, String name) {
- return null;
+ String resourcePath = (String)resourceMap.get(new Long(templateID));
+ if(resourcePath == null){
+ return null;
+ }
+ return UIConstants.getResource(resourcePath);
}
public boolean setPageContent(long spaceID, long thingID, long pageID, String content) {
Added: maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.gif
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.js
===================================================================
--- maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.js (rev 0)
+++ maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.js 2007-08-28 23:53:00 UTC (rev 287)
@@ -0,0 +1,42 @@
+var thingID = -1;
+
+function construct(id){
+ thingID = id;
+}
+
+function onClick(person, shapeName){
+ space.log(person + " clicked " + thingID + " on its " + shapeName);
+
+ var currentPosition = space.getThingPosition(thingID);
+
+ var path = new SplinePath(2000, false, false);
+ path.addKeyFrame(new SplineKeyFrame(currentPosition.x, currentPosition.y, currentPosition.z, 0, 0));
+ path.addKeyFrame(new SplineKeyFrame(currentPosition.x, currentPosition.y + 1, currentPosition.z, math.PI, 0.5));
+ path.addKeyFrame(new SplineKeyFrame(currentPosition.x, currentPosition.y, currentPosition.z, 2 * math.PI, 1));
+
+ space.startThingMotion(thingID, path);
+}
+
+function onContextClick(person, shapeName){
+ space.log(person + " context clicked " + thingID + " on its " + shapeName);
+
+ i1 = new ContextMenuInfo("Google",true,"google");
+ i2 = new ContextMenuInfo("Yahoo",true,"yahoo");
+ i3 = new ContextMenuInfo("Altavista",false,"NOTUSED");
+ i4 = new ContextMenuInfo("Transmutable",true,"transmutable");
+
+ return new Array(i1,i2,i3,i4);
+}
+
+function onContextMenuItemChosen(username,id)
+{
+ var key = "favoriteSite";
+ var preferred = space.getSetting(key);
+
+ space.putSetting(key,id);
+
+ //causes browser to jump to that page!
+ return "http://www."+id+".com/";
+}
+
+
Added: maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.mtl
===================================================================
--- maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.mtl (rev 0)
+++ maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.mtl 2007-08-28 23:53:00 UTC (rev 287)
@@ -0,0 +1,13 @@
+# Blender3D MTL File: TestCube.blend
+# Material Count: 1
+newmtl Material_Numbers.gif
+Ns 96.078431
+Ka 0.000000 0.000000 0.000000
+Kd 0.640000 0.640000 0.640000
+Ks 0.500000 0.500000 0.500000
+Ni 1.000000
+d 1.000000
+illum 2
+map_Kd TestCube.gif
+
+
Added: maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.obj
===================================================================
--- maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.obj (rev 0)
+++ maven/trunk/ogoglio-server/src/test/resources/templates/TestCube.obj 2007-08-28 23:53:00 UTC (rev 287)
@@ -0,0 +1,44 @@
+# Blender3D v243 OBJ File: TestCube.blend
+# www.blender3d.org
+mtllib TestCube.mtl
+o Cube
+v 1.000000 2.000000 -1.000000
+v 1.000000 0.000000 -1.000000
+v -1.000000 0.000000 -1.000000
+v -1.000000 2.000000 -1.000000
+v 1.000000 2.000000 1.000000
+v 0.999999 -0.000001 1.000000
+v -1.000000 0.000000 1.000000
+v -1.000000 2.000000 1.000000
+vt 0.499999 0.249999 0.0
+vt 0.499999 0.499999 0.0
+vt 0.250000 0.499999 0.0
+vt 0.250000 0.249999 0.0
+vt 0.500000 0.999999 0.0
+vt 0.249999 0.999999 0.0
+vt 0.249999 0.749998 0.0
+vt 0.500000 0.749998 0.0
+vt 0.749999 0.499998 0.0
+vt 0.749999 0.749998 0.0
+vt 0.500000 0.749998 0.0
+vt 0.499999 0.499999 0.0
+vt 0.499999 0.499999 0.0
+vt 0.500000 0.749998 0.0
+vt 0.249999 0.749998 0.0
+vt 0.250000 0.499999 0.0
+vt 0.250000 0.499999 0.0
+vt 0.249999 0.749998 0.0
+vt 0.000000 0.749998 0.0
+vt 0.000000 0.499999 0.0
+vt 0.499999 0.000000 0.0
+vt 0.499999 0.249999 0.0
+vt 0.250000 0.249999 0.0
+vt 0.249999 0.000000 0.0
+usemtl Material_Numbers.gif
+s 1
+f 1/1 2/2 3/3 4/4
+f 5/5 8/6 7/7 6/8
+f 1/9 5/10 6/11 2/12
+f 2/13 6/14 7/15 3/16
+f 3/17 7/18 8/19 4/20
+f 5/21 1/22 4/23 8/24
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|