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-10-15 13:04:49
|
Revision: 492
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=492&view=rev
Author: trevorolio
Date: 2007-10-15 06:04:46 -0700 (Mon, 15 Oct 2007)
Log Message:
-----------
Added a body texture web resource, backed by the media service. This is used in conjunction with body configurations to provide users with skin customization.
Still to come in texture land:
the body editor UI needs some design love to incorporate the texture upload form
body loading takes too long and shows no progress information
a base skin texture with decal textures baked on top
Modified Paths:
--------------
maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
Modified: maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
===================================================================
--- maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-15 13:04:39 UTC (rev 491)
+++ maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-15 13:04:46 UTC (rev 492)
@@ -157,7 +157,7 @@
public boolean addUserRenderable() {
try {
bodyData = dataManager.getBodyData(user.getBodyConfiguration().getBodyDataID());
- renderable = new J3DUserRenderable(user, bodyData);
+ renderable = new J3DUserRenderable(user, bodyData, dataManager.getBodyTexture(user.getUsername(), user.getBodyConfiguration().getBodyConfigurationID()));
userGroup.addChild(renderable);
westPanel.morphList.initList();
eastPanel.animationList.initAnimationList();
@@ -376,7 +376,7 @@
}
user.getBodyConfiguration().setBodyDataID(bodyDataDocuments[i].getBodyDataID());
bodyPanel.bodyData = dataManager.getBodyData(bodyDataDocuments[i].getBodyDataID());
- bodyPanel.renderable.initBody(bodyPanel.bodyData);
+ bodyPanel.renderable.initBody(bodyPanel.bodyData, dataManager.getBodyTexture(user.getUsername(), user.getBodyConfiguration().getBodyConfigurationID()));
westPanel.morphList.initList();
eastPanel.animationList.initAnimationList();
}
@@ -535,6 +535,10 @@
}
}
+ public InputStream getBodyTexture(String username, long bodyConfigurationID) {
+ return webClient.getBodyTexture(username, bodyConfigurationID);
+ }
+
}
//TODO make the error panel less ugly
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-15 13:04:38
|
Revision: 491
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=491&view=rev
Author: trevorolio
Date: 2007-10-15 06:04:39 -0700 (Mon, 15 Oct 2007)
Log Message:
-----------
Added a body texture web resource, backed by the media service. This is used in conjunction with body configurations to provide users with skin customization.
Still to come in texture land:
the body editor UI needs some design love to incorporate the texture upload form
body loading takes too long and shows no progress information
a base skin texture with decal textures baked on top
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/MediaService.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/TemplateResource.java
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/ogoglio.js
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyTextureRecord.java
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/MediaService.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/MediaService.java 2007-10-10 23:31:38 UTC (rev 490)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/media/MediaService.java 2007-10-15 13:04:39 UTC (rev 491)
@@ -36,6 +36,8 @@
public static final String PAGE_CONTENT_PREFIX = "pageContent-";
+ private static final String BODY_TEXTURE_PREFIX = "bodyTexture-";
+
private MediaStore store = null;
public MediaService(URI mediaURI) throws IOException {
@@ -78,6 +80,11 @@
return PAGE_CONTENT_PREFIX + spaceID + "-" + thingID + "-" + pageID;
}
+ public static String getBodyTextureName(long bodyConfigurationID) {
+ return BODY_TEXTURE_PREFIX + bodyConfigurationID;
+ }
+
+
public boolean write(String name, String value) throws IOException {
return store.write(name, value);
}
Added: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyTextureRecord.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyTextureRecord.java (rev 0)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyTextureRecord.java 2007-10-15 13:04:39 UTC (rev 491)
@@ -0,0 +1,48 @@
+package com.ogoglio.persist;
+
+import com.ogoglio.util.ArgumentUtils;
+
+public class BodyTextureRecord {
+
+ private long bodyTextureID = -1;
+
+ private long bodyConfigurationID = -1;
+
+ private String displayName = null;
+
+ public BodyTextureRecord() {
+ }
+
+ public BodyTextureRecord(long bodyConfigurationID, String displayName) {
+ ArgumentUtils.assertNotNegative(bodyConfigurationID);
+ this.bodyConfigurationID = bodyConfigurationID;
+ ArgumentUtils.assertNotNull(displayName);
+ this.displayName = displayName;
+ }
+
+ public long getBodyTextureID() {
+ return bodyTextureID;
+ }
+
+ public void setBodyTextureID(long bodyTextureID) {
+ this.bodyTextureID = bodyTextureID;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ ArgumentUtils.assertNotNull(displayName);
+ this.displayName = displayName;
+ }
+
+ public long getBodyConfigurationID() {
+ return bodyConfigurationID;
+ }
+
+ public void setBodyConfigurationID(long bodyConfigurationID) {
+ this.bodyConfigurationID = bodyConfigurationID;
+ }
+
+}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java 2007-10-10 23:31:38 UTC (rev 490)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java 2007-10-15 13:04:39 UTC (rev 491)
@@ -57,6 +57,8 @@
public static final long VACANCY_TIME_TILL_SHUTDOWN = 1 * 60 * 1000;
+ public static final long MAX_BODY_TEXTURE_SIZE = MAX_GEOMETRY_RESOURCE_SIZE;
+
private SimMessageHandler messageHandler = null;
private TwoWayMap spaceSimulators = new TwoWayMap(); //Maps Long spaceIDs to SpaceSimulators
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-10-10 23:31:38 UTC (rev 490)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-10-15 13:04:39 UTC (rev 491)
@@ -1012,6 +1012,10 @@
public ZipInputStream getBodyData(long bodyDataID) {
return new ZipInputStream(getClass().getClassLoader().getResourceAsStream("ogoglio-body-sim.jar"));
}
+
+ public InputStream getBodyTexture(String username, long bodyConfigurationID) {
+ return null;
+ }
}
private class InSimTemplateDataProvider implements TemplateDataProvider {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2007-10-10 23:31:38 UTC (rev 490)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2007-10-15 13:04:39 UTC (rev 491)
@@ -14,6 +14,7 @@
package com.ogoglio.site;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Map;
@@ -29,17 +30,20 @@
import com.ogoglio.appdev.persist.PersistException;
import com.ogoglio.appdev.servlet.Four04SiteResource;
import com.ogoglio.appdev.servlet.SiteResource;
+import com.ogoglio.client.DecoratedInputStream;
import com.ogoglio.client.WebAPIClientWire;
import com.ogoglio.client.WebAPIUtil;
import com.ogoglio.mail.MailClient;
import com.ogoglio.mail.MailFormatter;
import com.ogoglio.mail.MailSendException;
import com.ogoglio.mail.MailTemplateFactory;
+import com.ogoglio.media.MediaService;
import com.ogoglio.persist.AccountPersistTasks;
import com.ogoglio.persist.AccountRecord;
import com.ogoglio.persist.BodyConfigurationRecord;
import com.ogoglio.persist.BodyPersistTasks;
import com.ogoglio.persist.BodySettingRecord;
+import com.ogoglio.persist.BodyTextureRecord;
import com.ogoglio.persist.PendingEmailValidationRecord;
import com.ogoglio.persist.PendingEmailValidationTasks;
import com.ogoglio.persist.PossessionPersistTasks;
@@ -53,7 +57,9 @@
import com.ogoglio.persist.SpaceRecord;
import com.ogoglio.persist.TemplatePersistTasks;
import com.ogoglio.persist.TemplateRecord;
+import com.ogoglio.sim.Sim;
import com.ogoglio.util.Log;
+import com.ogoglio.util.StreamUtils;
import com.ogoglio.xml.AccountDocument;
import com.ogoglio.xml.BodyConfigurationDocument;
import com.ogoglio.xml.PossessionDocument;
@@ -178,9 +184,114 @@
return false;
}
+ private class BodyTextureResource extends AuthenticatedSiteResource {
+ public BodyTextureResource() {
+ super("texture", false, getSessionFactory());
+ }
+
+ public void doDelete(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws ServletException, IOException, PersistException {
+ BodyConfigurationRecord configRecord = getBodyConfigurationRecord(request, authedAccount, pathElements);
+ if (configRecord == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+
+ getMediaService().delete(MediaService.getBodyTextureName(configRecord.getBodyConfigurationID()));
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
+
+
+ public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws ServletException, IOException, PersistException {
+ BodyConfigurationRecord configRecord = getBodyConfigurationRecord(request, authedAccount, pathElements);
+ if (configRecord == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+
+ InputStream fileInput = null;
+ if (request.getContentType() != null && request.getContentType().startsWith("multipart/form-data")) {
+ fileInput = getFirstFile(request, Sim.MAX_GEOMETRY_SIZE);
+ System.out.println("File input: " + fileInput);
+ if (fileInput == null) {
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ return;
+ }
+ } else {
+ fileInput = request.getInputStream();
+ System.out.println("inputolio: " + fileInput);
+ }
+
+ if (!getMediaService().write(MediaService.getBodyTextureName(configRecord.getBodyConfigurationID()), fileInput, Sim.MAX_BODY_TEXTURE_SIZE)) {
+ Log.error("Could not write body texture");
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return;
+ }
+
+ response.setStatus(HttpServletResponse.SC_OK);
+ return;
+ }
+
+ public void doHead(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws ServletException, IOException, PersistException {
+ BodyConfigurationRecord configRecord = getBodyConfigurationRecord(request, authedAccount, pathElements);
+ if (configRecord == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+
+ String mediaName = MediaService.getBodyTextureName(configRecord.getBodyConfigurationID());
+ long length = getMediaService().getSize(mediaName);
+ if (length == -1) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+
+ long lastModified = getMediaService().getLastModified(mediaName);
+ setCachable(response);
+ response.setStatus(HttpServletResponse.SC_OK);
+ response.setContentLength((int) length);
+ response.setDateHeader("Last-Modified", lastModified);
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, IOException {
+ BodyConfigurationRecord configRecord = getBodyConfigurationRecord(request, authedAccount, pathElements);
+ if (configRecord == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+ DecoratedInputStream data = getMediaService().getData(MediaService.getBodyTextureName(configRecord.getBodyConfigurationID()));
+ if (data == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+ response.setStatus(HttpServletResponse.SC_OK);
+ setCachable(response);
+ if (data.getMimeType() != null) {
+ response.setContentType(data.getMimeType());
+ }
+ if (data.getLength() > -1) {
+ response.setContentLength((int) data.getLength());
+ }
+ StreamUtils.write(data, response.getOutputStream());
+ }
+
+ private BodyConfigurationRecord getBodyConfigurationRecord(HttpServletRequest request, AccountRecord authedAccount, String[] pathElements) throws PersistException {
+ String username = pathElements[pathElements.length - 4];
+ if (!requestOkForBody(request, username, authedAccount)) {
+ return null;
+ }
+ long bodyConfigID = Long.parseLong(pathElements[pathElements.length - 2]);
+ BodyConfigurationRecord record = BodyPersistTasks.findBodyConfigurationByID(bodyConfigID, getSessionFactory());
+ if (record == null || !username.equals(record.getOwnerUsername())) {
+ return null;
+ }
+ return record;
+ }
+ }
+
private class BodyResource extends AuthenticatedSiteResource {
public BodyResource() {
super(SiteResource.LONG_ELEMENT, false, getSessionFactory());
+ addSubResource(new BodyTextureResource());
}
public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, IOException {
@@ -197,7 +308,6 @@
return;
}
BodySettingRecord[] settingRecords = BodyPersistTasks.findBodySettingsByConfigurationID(bodyConfigID, getSessionFactory());
-
sendStringResponse(DocumentFactory.documentFromRecord(record, settingRecords).toString(), "text/xml", response);
}
@@ -237,12 +347,11 @@
return;
}
BodyConfigurationRecord record = BodyPersistTasks.findBodyConfigurationByID(authedAccount.getDefaultBodyConfigurationID(), getSessionFactory());
- if(record == null){
+ if (record == null) {
throw new IllegalStateException("Account has a bogus body configuration record.. " + authedAccount.getDefaultBodyConfigurationID());
}
-
- BodySettingRecord[] settingRecords = BodyPersistTasks.findBodySettingsByConfigurationID(record.getBodyConfigurationID(), getSessionFactory());
- sendStringResponse(DocumentFactory.documentFromRecord(record, settingRecords).toString(), "text/xml", response);
+
+ sendStringResponse(createBodyConfigurationDocument(record).toString(), "text/xml", response);
}
}
@@ -262,7 +371,7 @@
BodyConfigurationRecord[] configRecs = BodyPersistTasks.findBodyConfigurationsByUsername(username, getSessionFactory());
XMLElement list = new XMLElement("list");
for (int i = 0; i < configRecs.length; i++) {
- list.addChild(DocumentFactory.documentFromRecord(configRecs[i], BodyPersistTasks.findBodySettingsByConfigurationID(configRecs[i].getBodyConfigurationID(), getSessionFactory())).toElement());
+ list.addChild(createBodyConfigurationDocument(configRecs[i]).toElement());
}
sendStringResponse(list.toString(), "text/xml", response);
}
@@ -283,10 +392,15 @@
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return;
}
- sendStringResponse(DocumentFactory.documentFromRecord(record, BodyPersistTasks.findBodySettingsByConfigurationID(record.getBodyConfigurationID(), getSessionFactory())).toString(), "text/xml", response);
+ sendStringResponse(createBodyConfigurationDocument(record).toString(), "text/xml", response);
}
}
+ private BodyConfigurationDocument createBodyConfigurationDocument(BodyConfigurationRecord record) throws PersistException {
+ BodySettingRecord[] settingRecords = BodyPersistTasks.findBodySettingsByConfigurationID(record.getBodyConfigurationID(), getSessionFactory());
+ return DocumentFactory.documentFromRecord(record, settingRecords);
+ }
+
private void sendValidationMail(PendingEmailValidationRecord validationRecord) throws MailSendException {
String from = "robot@" + getSiteInfo().getHost();
String validationURL = getSiteInfo().getBaseUrl() + "account/validate?" + SECRET_PARAMETER + "=" + validationRecord.getSecret();
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/TemplateResource.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/TemplateResource.java 2007-10-10 23:31:38 UTC (rev 490)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/TemplateResource.java 2007-10-15 13:04:39 UTC (rev 491)
@@ -29,567 +29,569 @@
import com.ogoglio.xml.server.DocumentFactory;
public class TemplateResource extends AuthenticatedSiteResource {
- private SessionFactory sessionFactory;
- private MediaService mediaService;
+ private SessionFactory sessionFactory;
- public TemplateResource(SessionFactory factory, MediaService service) {
- super(SiteResource.LONG_ELEMENT, false, factory);
- addSubResource(new TemplateGeometryResource());
- addSubResource(new TemplateScriptResource(factory));
- sessionFactory=factory;
- mediaService=service;
- }
- public SessionFactory getSessionFactory() {
- return sessionFactory;
- }
- public InputStream getFirstFile(HttpServletRequest request,long maxSize) throws IOException {
- return AbstractResourceServlet.getFirstFile(request, maxSize);
- }
- public MediaService getMediaService() {
- return mediaService;
- }
- public void setCachable(HttpServletResponse response) {
- AbstractResourceServlet.setCachable(response);
- }
- public String getFirstStringValue(HttpServletRequest request) throws IOException {
- return AbstractResourceServlet.getFirstStringValue(request);
- }
+ private MediaService mediaService;
+ public TemplateResource(SessionFactory factory, MediaService service) {
+ super(SiteResource.LONG_ELEMENT, false, factory);
+ addSubResource(new TemplateGeometryResource());
+ addSubResource(new TemplateScriptResource(factory));
+ sessionFactory = factory;
+ mediaService = service;
+ }
- public void doDelete(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
- AccountRecord requestedAccount = verifyAccountFromPathElements(response, pathElements);
- if (requestedAccount==null) {
- return;
- }
+ public SessionFactory getSessionFactory() {
+ return sessionFactory;
+ }
- TemplateRecord record = verifyTemplateIDFromPathElements(response, pathElements);
- if (record==null) {
- return;
- }
- if (!TemplatePersistTasks.deleteTemplate(record, getSessionFactory())) {
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- return;
- }
- response.setStatus(HttpServletResponse.SC_OK);
- }
+ public InputStream getFirstFile(HttpServletRequest request, long maxSize) throws IOException {
+ return AbstractResourceServlet.getFirstFile(request, maxSize);
+ }
- public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
- AccountRecord requestedAccount = verifyAccountFromPathElements(response, pathElements);
- if (requestedAccount==null) {
- return;
- }
+ public MediaService getMediaService() {
+ return mediaService;
+ }
- TemplateRecord record = verifyTemplateIDFromPathElements(response, pathElements);
- if (record==null) {
- return;
- }
+ public void setCachable(HttpServletResponse response) {
+ AbstractResourceServlet.setCachable(response);
+ }
- if (authedAccount == null || !requestedAccount.getUsername().equals(authedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
+ public String getFirstStringValue(HttpServletRequest request) throws IOException {
+ return AbstractResourceServlet.getFirstStringValue(request);
+ }
- TemplateDocument newDoc = new TemplateDocument(parseXML(request.getInputStream()));
- TemplateRecord updatedRec = TemplatePersistTasks.update(newDoc, record, getSessionFactory());
- if (updatedRec == null) {
- response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- return;
- }
+ public void doDelete(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
+ AccountRecord requestedAccount = verifyAccountFromPathElements(response, pathElements);
+ if (requestedAccount == null) {
+ return;
+ }
- newDoc = DocumentFactory.documentFromRecord(updatedRec);
+ TemplateRecord record = verifyTemplateIDFromPathElements(response, pathElements);
+ if (record == null) {
+ return;
+ }
+ if (!TemplatePersistTasks.deleteTemplate(record, getSessionFactory())) {
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return;
+ }
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
- sendStringResponse(newDoc.toString(), "text/xml", response);
- }
+ public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
+ AccountRecord requestedAccount = verifyAccountFromPathElements(response, pathElements);
+ if (requestedAccount == null) {
+ return;
+ }
- private TemplateRecord verifyTemplateIDFromPathElements(HttpServletResponse response, String[] pathElements) throws PersistException {
- long templateID = Long.parseLong(pathElements[pathElements.length - 1]);
- TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
- if (record == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return null;
- }
- return record;
- }
+ TemplateRecord record = verifyTemplateIDFromPathElements(response, pathElements);
+ if (record == null) {
+ return;
+ }
- private AccountRecord verifyAccountFromPathElements(HttpServletResponse response, String[] pathElements) throws PersistException {
- String usernameParam = pathElements[pathElements.length - 3];
- AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
- if (requestedAccount == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return null;
- }
- return requestedAccount;
- }
+ if (authedAccount == null || !requestedAccount.getUsername().equals(authedAccount.getUsername())) {
+ response.setStatus(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
- public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
- AccountRecord requestedAccount = verifyAccountFromPathElements(response, pathElements);
- if (requestedAccount==null) {
- return;
- }
+ TemplateDocument newDoc = new TemplateDocument(parseXML(request.getInputStream()));
+ TemplateRecord updatedRec = TemplatePersistTasks.update(newDoc, record, getSessionFactory());
+ if (updatedRec == null) {
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ return;
+ }
- TemplateRecord record = verifyTemplateIDFromPathElements(response, pathElements);
- if (record==null) {
- return;
- }
- TemplateDocument result = DocumentFactory.documentFromRecord(record);
- sendStringResponse(result.toString(), "text/xml", response);
+ newDoc = DocumentFactory.documentFromRecord(updatedRec);
- }
+ sendStringResponse(newDoc.toString(), "text/xml", response);
+ }
+ private TemplateRecord verifyTemplateIDFromPathElements(HttpServletResponse response, String[] pathElements) throws PersistException {
+ long templateID = Long.parseLong(pathElements[pathElements.length - 1]);
+ TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
+ if (record == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return null;
+ }
+ return record;
+ }
-// to prevent repetition between post and delete
- private abstract class TemplateSupportFileAction {
- public abstract void doGeometryAction(HttpServletRequest request, HttpServletResponse response,
- String[] pathElements, long templateID) throws PersistException, IOException;
- public abstract void doMaterialFileAction(HttpServletRequest request, HttpServletResponse response,
- String[] pathElements, long templateID) throws IOException, PersistException;
+ private AccountRecord verifyAccountFromPathElements(HttpServletResponse response, String[] pathElements) throws PersistException {
+ String usernameParam = pathElements[pathElements.length - 3];
+ AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
+ if (requestedAccount == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return null;
+ }
+ return requestedAccount;
+ }
- void destroyARecordInATemplateSetOfSupportFiles(HttpServletResponse response, TemplateRecord template, TemplateSupportFileRecord rec) throws PersistException {
- if (rec==null) {
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- return;
- }
- template.getSupportFiles().remove(rec); //destroy pointer
- TemplatePersistTasks.update(template, getSessionFactory());
- response.setStatus(HttpServletResponse.SC_OK);
- }
- public String templateGeometryNameFromPathElements(long templateID, String[] pathElements, int[] hackReturn) {
- int LOD=-2995;
- try {
- LOD=Integer.parseInt(pathElements[pathElements.length -1]);
- hackReturn[0]=LOD;
- } catch (NumberFormatException e) {
- return null;
- }
- return MediaService.getTemplateGeometryName(templateID, LOD);
- }
- }
+ public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
+ AccountRecord requestedAccount = verifyAccountFromPathElements(response, pathElements);
+ if (requestedAccount == null) {
+ return;
+ }
- class TemplateSupportFilePost extends TemplateSupportFileAction{
- public void doGeometryAction(HttpServletRequest request, HttpServletResponse response,
- String[] pathElements, long templateID) throws PersistException, IOException{
- InputStream fileInput;
- //is this coming from a browser?
- if (request.getContentType() != null && request.getContentType().startsWith("multipart/form-data")) {
- fileInput = getFirstFile(request, Sim.MAX_GEOMETRY_SIZE);
- if (fileInput == null) {
- response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- return;
- }
- } else {
- //coming from a sensible browser, just get the file input
- fileInput=request.getInputStream();
- }
- int[] lodHack=new int[1];
- String templateGeometryName = templateGeometryNameFromPathElements(templateID, pathElements,lodHack);
+ TemplateRecord record = verifyTemplateIDFromPathElements(response, pathElements);
+ if (record == null) {
+ return;
+ }
+ TemplateDocument result = DocumentFactory.documentFromRecord(record);
+ sendStringResponse(result.toString(), "text/xml", response);
+
+ }
+
+ // to prevent repetition between post and delete
+ private abstract class TemplateSupportFileAction {
+ public abstract void doGeometryAction(HttpServletRequest request, HttpServletResponse response, String[] pathElements, long templateID) throws PersistException, IOException;
+
+ public abstract void doMaterialFileAction(HttpServletRequest request, HttpServletResponse response, String[] pathElements, long templateID) throws IOException, PersistException;
+
+ void destroyARecordInATemplateSetOfSupportFiles(HttpServletResponse response, TemplateRecord template, TemplateSupportFileRecord rec) throws PersistException {
+ if (rec == null) {
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return;
+ }
+ template.getSupportFiles().remove(rec); //destroy pointer
+ TemplatePersistTasks.update(template, getSessionFactory());
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
+
+ public String templateGeometryNameFromPathElements(long templateID, String[] pathElements, int[] hackReturn) {
+ int LOD = -2995;
+ try {
+ LOD = Integer.parseInt(pathElements[pathElements.length - 1]);
+ hackReturn[0] = LOD;
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ return MediaService.getTemplateGeometryName(templateID, LOD);
+ }
+ }
+
+ class TemplateSupportFilePost extends TemplateSupportFileAction {
+ public void doGeometryAction(HttpServletRequest request, HttpServletResponse response, String[] pathElements, long templateID) throws PersistException, IOException {
+ InputStream fileInput;
+ //is this coming from a browser?
+ if (request.getContentType() != null && request.getContentType().startsWith("multipart/form-data")) {
+ fileInput = getFirstFile(request, Sim.MAX_GEOMETRY_SIZE);
+ if (fileInput == null) {
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ return;
+ }
+ } else {
+ //coming from a sensible browser, just get the file input
+ fileInput = request.getInputStream();
+ }
+ int[] lodHack = new int[1];
+ String templateGeometryName = templateGeometryNameFromPathElements(templateID, pathElements, lodHack);
ArgumentUtils.assertNotNull(templateGeometryName);
- getMediaService().write(templateGeometryName, fileInput, Sim.MAX_GEOMETRY_SIZE);
- TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
- TemplatePersistTasks.updateGeometryFileTemplateLastModified(record, lodHack[0], true,getSessionFactory());
- response.setStatus(HttpServletResponse.SC_OK);
- }
- public void doMaterialFileAction(HttpServletRequest request, HttpServletResponse response,
- String[] pathElements, long templateID) throws IOException, PersistException{
- InputStream fileInput;
- //from a browser?
- if (request.getContentType() != null && request.getContentType().startsWith("multipart/form-data")) {
- fileInput = getFirstFile(request, Sim.MAX_GEOMETRY_RESOURCE_SIZE);
- if (fileInput == null) {
- response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- return;
- }
- } else {
- fileInput=request.getInputStream();
- }
- String rawName=pathElements[pathElements.length -1 ];
- String templateResourceName = MediaService.getTemplateResourceName(templateID, rawName);
- getMediaService().write(templateResourceName, fileInput, Sim.MAX_GEOMETRY_RESOURCE_SIZE);
- TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
- TemplatePersistTasks.updateSupportFileTemplateLastModified(record, rawName, true,getSessionFactory());
- response.setStatus(HttpServletResponse.SC_OK);
- }
- }
- class TemplateSupportFileDelete extends TemplateSupportFileAction{
- public void doGeometryAction(HttpServletRequest request, HttpServletResponse response,
- String[] pathElements, long templateID) throws PersistException, IOException{
- int[] lodHack=new int[1];
- String templateGeometryName = templateGeometryNameFromPathElements(templateID,pathElements,lodHack);
- if (templateGeometryName==null) {
- response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- return;
- }
- getMediaService().delete(templateGeometryName); //destroy the content
- TemplateRecord template = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
- destroyARecordInATemplateSetOfSupportFiles(response, template, template.findGeometryFileRec(lodHack[0]));
- }
- public void doMaterialFileAction(HttpServletRequest request, HttpServletResponse response,
- String[] pathElements, long templateID) throws IOException, PersistException{
+ getMediaService().write(templateGeometryName, fileInput, Sim.MAX_GEOMETRY_SIZE);
+ TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
+ TemplatePersistTasks.updateGeometryFileTemplateLastModified(record, lodHack[0], true, getSessionFactory());
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
- String rawName=pathElements[pathElements.length -1 ];
- String templateResourceName = MediaService.getTemplateResourceName(templateID, pathElements[pathElements.length -1 ]);
- getMediaService().delete(templateResourceName);//destroy content
- TemplateRecord template = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
- destroyARecordInATemplateSetOfSupportFiles(response, template, template.findSupportFile(rawName));
- }
- }
- class TemplateGeometryResource extends DescendingSiteResource {
- public TemplateGeometryResource() {
- super("geometry");
- }
+ public void doMaterialFileAction(HttpServletRequest request, HttpServletResponse response, String[] pathElements, long templateID) throws IOException, PersistException {
+ InputStream fileInput;
+ //from a browser?
+ if (request.getContentType() != null && request.getContentType().startsWith("multipart/form-data")) {
+ fileInput = getFirstFile(request, Sim.MAX_GEOMETRY_RESOURCE_SIZE);
+ if (fileInput == null) {
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ return;
+ }
+ } else {
+ fileInput = request.getInputStream();
+ }
+ String rawName = pathElements[pathElements.length - 1];
+ String templateResourceName = MediaService.getTemplateResourceName(templateID, rawName);
+ getMediaService().write(templateResourceName, fileInput, Sim.MAX_GEOMETRY_RESOURCE_SIZE);
+ TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
+ TemplatePersistTasks.updateSupportFileTemplateLastModified(record, rawName, true, getSessionFactory());
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
+ }
- public void doDelete(HttpServletRequest request, HttpServletResponse response,
- String[] pathElements) throws ServletException, IOException {
- doSomething(request, response, pathElements, new TemplateSupportFileDelete());
- }
- public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
- doSomething(request,response,pathElements,new TemplateSupportFilePost());
- }
- public void doSomething(HttpServletRequest request, HttpServletResponse response,
- String[] pathElements, TemplateSupportFileAction action) throws ServletException, IOException {
- String usernameParam = pathElements[1];
- try {
- AccountRecord authedAccount = getAuthedAccount(request, response);
- if (authedAccount==null) {
- return;
- }
- AccountRecord requestedAccount = getRequestedAccount(response, usernameParam);
- if (requestedAccount==null) {
- return;
- }
+ class TemplateSupportFileDelete extends TemplateSupportFileAction {
+ public void doGeometryAction(HttpServletRequest request, HttpServletResponse response, String[] pathElements, long templateID) throws PersistException, IOException {
+ int[] lodHack = new int[1];
+ String templateGeometryName = templateGeometryNameFromPathElements(templateID, pathElements, lodHack);
+ if (templateGeometryName == null) {
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ return;
+ }
+ getMediaService().delete(templateGeometryName); //destroy the content
+ TemplateRecord template = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
+ destroyARecordInATemplateSetOfSupportFiles(response, template, template.findGeometryFileRec(lodHack[0]));
+ }
- if (verifyAccountHolderIsOk(response, authedAccount, requestedAccount)==false) {
- return;
- }
+ public void doMaterialFileAction(HttpServletRequest request, HttpServletResponse response, String[] pathElements, long templateID) throws IOException, PersistException {
- Long tid = checkTemplateIDIsOk(response, authedAccount, requestedAccount, pathElements);
- if (tid==null) {
- return;
- }
- long templateID = tid.longValue();
+ String rawName = pathElements[pathElements.length - 1];
+ String templateResourceName = MediaService.getTemplateResourceName(templateID, pathElements[pathElements.length - 1]);
+ getMediaService().delete(templateResourceName);//destroy content
+ TemplateRecord template = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
+ destroyARecordInATemplateSetOfSupportFiles(response, template, template.findSupportFile(rawName));
+ }
+ }
- //trying to post to just /template/<TID>/geometry
- if (pathElements.length == 5) {
- response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- }
- //trying to post to /geometry/data but requires an LOD number
- if (pathElements.length == 6 && "data".equals(pathElements[pathElements.length - 1])) {
- response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
- return;
- };
- //posting to /geometry/data/<number>
- if (pathElements.length == 7 && "data".equals(pathElements[pathElements.length - 2])) {
- action.doGeometryAction(request, response, pathElements, templateID);
- } else {
- action.doMaterialFileAction(request, response, pathElements, templateID);
- }
- return;
- } catch (PersistException e) {
- Log.info("Got Persist Exception:" +e.getMessage());
- handlePersistException(response, e);
- return;
- }
- }
+ class TemplateGeometryResource extends DescendingSiteResource {
+ public TemplateGeometryResource() {
+ super("geometry");
+ }
+ public void doDelete(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
+ handleRequest(request, response, pathElements, new TemplateSupportFileDelete());
+ }
- private void handlePersistException(HttpServletResponse response, PersistException e) {
- e.printStackTrace();
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
+ public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
+ handleRequest(request, response, pathElements, new TemplateSupportFilePost());
+ }
- private Long checkTemplateIDIsOk(HttpServletResponse response, AccountRecord authedAccount, AccountRecord requestedAccount,String[] pathElements) throws PersistException {
- long templateID = Long.parseLong(pathElements[3]);
- TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
- if (record == null || !record.getOwnerUsername().equals(requestedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return null;
- }
- return new Long(templateID);
- }
+ public void handleRequest(HttpServletRequest request, HttpServletResponse response, String[] pathElements, TemplateSupportFileAction action) throws ServletException, IOException {
+ String usernameParam = pathElements[1];
+ try {
+ AccountRecord authedAccount = getAuthedAccount(request, response);
+ if (authedAccount == null) {
+ return;
+ }
+ AccountRecord requestedAccount = getRequestedAccount(response, usernameParam);
+ if (requestedAccount == null) {
+ return;
+ }
- private boolean verifyAccountHolderIsOk(HttpServletResponse response, AccountRecord authedAccount, AccountRecord requestedAccount) {
- if (!requestedAccount.getUsername().equals(authedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- return false;
- }
- return true;
- }
+ if (verifyAccountHolderIsOk(response, authedAccount, requestedAccount) == false) {
+ return;
+ }
+ Long tid = checkTemplateIDIsOk(response, authedAccount, requestedAccount, pathElements);
+ if (tid == null) {
+ return;
+ }
+ long templateID = tid.longValue();
- private AccountRecord getRequestedAccount(HttpServletResponse response, String usernameParam) throws PersistException {
- AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
- if (requestedAccount == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return null;
- }
- return requestedAccount;
- }
+ //trying to post to just /template/<TID>/geometry
+ if (pathElements.length == 5) {
+ response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+ return;
+ }
+ //trying to post to /geometry/data but requires an LOD number
+ if (pathElements.length == 6 && "data".equals(pathElements[pathElements.length - 1])) {
+ response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+ return;
+ }
+ ;
+ //posting to /geometry/data/<number>
+ if (pathElements.length == 7 && "data".equals(pathElements[pathElements.length - 2])) {
+ action.doGeometryAction(request, response, pathElements, templateID);
+ } else {
+ action.doMaterialFileAction(request, response, pathElements, templateID);
+ }
+ return;
+ } catch (PersistException e) {
+ Log.info("Got Persist Exception:" + e.getMessage());
+ handlePersistException(response, e);
+ return;
+ }
+ }
+ private void handlePersistException(HttpServletResponse response, PersistException e) {
+ e.printStackTrace();
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
- private AccountRecord getAuthedAccount(HttpServletRequest request, HttpServletResponse response) throws PersistException {
- AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
- if (authedAccount == null) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- return null;
- }
- return authedAccount;
- }
- public void doPut(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
- String usernameParam = pathElements[1];
- Log.warn("Put called on a template geometry resource???");
- for (int i=0; i<pathElements.length;++i) Log.warn("PUT: "+i+" ->"+pathElements[i]);
- try {
- AccountRecord authedAccount = getAuthedAccount(request, response);
- if (authedAccount==null) {
- return;
- }
- AccountRecord requestedAccount = getRequestedAccount(response, usernameParam);
- if (requestedAccount==null) {
- return;
- }
+ private Long checkTemplateIDIsOk(HttpServletResponse response, AccountRecord authedAccount, AccountRecord requestedAccount, String[] pathElements) throws PersistException {
+ long templateID = Long.parseLong(pathElements[3]);
+ TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
+ if (record == null || !record.getOwnerUsername().equals(requestedAccount.getUsername())) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return null;
+ }
+ return new Long(templateID);
+ }
- if (verifyAccountHolderIsOk(response, authedAccount, requestedAccount)==false) {
- return;
- }
+ private boolean verifyAccountHolderIsOk(HttpServletResponse response, AccountRecord authedAccount, AccountRecord requestedAccount) {
+ if (!requestedAccount.getUsername().equals(authedAccount.getUsername())) {
+ response.setStatus(HttpServletResponse.SC_FORBIDDEN);
+ return false;
+ }
+ return true;
+ }
- String geomFileName = verifyParamsAreOk(response,pathElements);
- if (geomFileName==null) {
- return;
- }
- Long tid = checkTemplateIDIsOk(response, authedAccount, requestedAccount, pathElements);
- if (tid==null) {
- return;
- }
- } catch (PersistException e) {
- handlePersistException(response, e);
- }
- }
- private String verifyParamsAreOk(HttpServletResponse response, String[] pathElements) {
- if (pathElements.length!=7) {
- response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
- return null;
- }
- if ((pathElements[4].equals("geometry")==false) || (pathElements[5].equals("data")==false)) {
- response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
- return null;
- }
+ private AccountRecord getRequestedAccount(HttpServletResponse response, String usernameParam) throws PersistException {
+ AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
+ if (requestedAccount == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return null;
+ }
+ return requestedAccount;
+ }
- if ((pathElements[6]==null) || (pathElements[6].equals("")==true) || (pathElements[6].indexOf('-')!=-1)) {
- response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- return null;
- }
- return pathElements[6];
- }
+ private AccountRecord getAuthedAccount(HttpServletRequest request, HttpServletResponse response) throws PersistException {
+ AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
+ if (authedAccount == null) {
+ response.setStatus(HttpServletResponse.SC_FORBIDDEN);
+ return null;
+ }
+ return authedAccount;
+ }
+ public void doPut(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
+ String usernameParam = pathElements[1];
+ Log.warn("Put called on a template geometry resource???");
+ for (int i = 0; i < pathElements.length; ++i)
+ Log.warn("PUT: " + i + " ->" + pathElements[i]);
+ try {
+ AccountRecord authedAccount = getAuthedAccount(request, response);
+ if (authedAccount == null) {
+ return;
+ }
+ AccountRecord requestedAccount = getRequestedAccount(response, usernameParam);
+ if (requestedAccount == null) {
+ return;
+ }
- public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
- String usernameParam = pathElements[1];
- try {
- AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
- if (authedAccount == null && !AuthServlet.isGuest(request)) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
+ if (verifyAccountHolderIsOk(response, authedAccount, requestedAccount) == false) {
+ return;
+ }
- AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
- if (requestedAccount == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
+ String geomFileName = verifyParamsAreOk(response, pathElements);
+ if (geomFileName == null) {
+ return;
+ }
+ Long tid = checkTemplateIDIsOk(response, authedAccount, requestedAccount, pathElements);
+ if (tid == null) {
+ return;
+ }
+ } catch (PersistException e) {
+ handlePersistException(response, e);
+ }
+ }
- long templateID = Long.parseLong(pathElements[3]);
- TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
- if (record == null || !record.getOwnerUsername().equals(requestedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
+ private String verifyParamsAreOk(HttpServletResponse response, String[] pathElements) {
+ if (pathElements.length != 7) {
+ response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+ return null;
+ }
+ if ((pathElements[4].equals("geometry") == false) || (pathElements[5].equals("data") == false)) {
+ response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+ return null;
+ }
- if (pathElements.length == 5) {
- sendStringResponse("This is where a geometry document would be.", "text/plain", response);
- return;
- }
+ if ((pathElements[6] == null) || (pathElements[6].equals("") == true) || (pathElements[6].indexOf('-') != -1)) {
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ return null;
+ }
+ return pathElements[6];
+ }
- DecoratedInputStream data = null;
- if (pathElements.length == 7 && "data".equals(pathElements[pathElements.length - 2])) {
- data = getMediaService().getData(MediaService.getTemplateGeometryName(templateID, Integer.parseInt(pathElements[pathElements.length - 1])));
- } else {
- data = getMediaService().getData(MediaService.getTemplateResourceName(templateID, pathElements[pathElements.length - 1]));
- }
- if (data == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
- response.setStatus(HttpServletResponse.SC_OK);
- setCachable(response);
- if (data.getMimeType() != null) {
- response.setContentType(data.getMimeType());
- }
- if ("gzip".equals(request.getHeader("Accept-encoding"))) {
- response.setHeader("Content-encoding", "gzip");
- StreamUtils.write(data, new GZIPOutputStream(response.getOutputStream()));
- } else {
- if (data.getLength() > -1) {
- response.setContentLength((int) data.getLength());
- }
- StreamUtils.write(data, response.getOutputStream());
- }
- } catch (PersistException e) {
- handlePersistException(response, e);
- return;
- }
- }
+ public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
+ String usernameParam = pathElements[1];
+ try {
+ AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
+ if (authedAccount == null && !AuthServlet.isGuest(request)) {
+ response.setStatus(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
- public void doHead(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
- String usernameParam = pathElements[1];
- try {
- AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
- if (authedAccount == null && !AuthServlet.isGuest(request)) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
+ AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
+ if (requestedAccount == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
- AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
- if (requestedAccount == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
+ long templateID = Long.parseLong(pathElements[3]);
+ TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
+ if (record == null || !record.getOwnerUsername().equals(requestedAccount.getUsername())) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
- long templateID = Long.parseLong(pathElements[3]);
- TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
- if (record == null || !record.getOwnerUsername().equals(requestedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
+ if (pathElements.length == 5) {
+ sendStringResponse("This is where a geometry document would be.", "text/plain", response);
+ return;
+ }
- if (pathElements.length == 5) {
- sendStringResponse("This is where a geometry document would be.", "text/plain", response);
- return;
- }
+ DecoratedInputStream data = null;
+ if (pathElements.length == 7 && "data".equals(pathElements[pathElements.length - 2])) {
+ data = getMediaService().getData(MediaService.getTemplateGeometryName(templateID, Integer.parseInt(pathElements[pathElements.length - 1])));
+ } else {
+ data = getMediaService().getData(MediaService.getTemplateResourceName(templateID, pathElements[pathElements.length - 1]));
+ }
+ if (data == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+ response.setStatus(HttpServletResponse.SC_OK);
+ setCachable(response);
+ if (data.getMimeType() != null) {
+ response.setContentType(data.getMimeType());
+ }
+ if ("gzip".equals(request.getHeader("Accept-encoding"))) {
+ response.setHeader("Content-encoding", "gzip");
+ StreamUtils.write(data, new GZIPOutputStream(response.getOutputStream()));
+ } else {
+ if (data.getLength() > -1) {
+ response.setContentLength((int) data.getLength());
+ }
+ StreamUtils.write(data, response.getOutputStream());
+ }
+ } catch (PersistException e) {
+ handlePersistException(response, e);
+ return;
+ }
+ }
- String mediaName = null;
- if (pathElements.length == 7 && "data".equals(pathElements[pathElements.length - 2])) {
- mediaName = MediaService.getTemplateGeometryName(templateID, Integer.parseInt(pathElements[pathElements.length - 1]));
- } else {
- mediaName = MediaService.getTemplateResourceName(templateID, pathElements[pathElements.length - 1]);
- }
+ public void doHead(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
+ String usernameParam = pathElements[1];
+ try {
+ AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
+ if (authedAccount == null && !AuthServlet.isGuest(request)) {
+ response.setStatus(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
- long length = getMediaService().getSize(mediaName);
- if (length == -1) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
+ AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
+ if (requestedAccount == null) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
- long lastModified = getMediaService().getLastModified(mediaName);
+ long templateID = Long.parseLong(pathElements[3]);
+ TemplateRecord record = TemplatePersistTasks.findTemplateByTemplateID(templateID, getSessionFactory());
+ if (record == null || !record.getOwnerUsername().equals(requestedAccount.getUsername())) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
- setCachable(response);
- response.setStatus(HttpServletResponse.SC_OK);
- response.setContentLength((int) length);
- response.setDateHeader("Last-Modified", lastModified);
- } catch (PersistException e) {
- handlePersistException(response, e);
- return;
- }
- }
- }
+ if (pathElements.length == 5) {
+ sendStringResponse("This is where a geometry document would be.", "text/plain", response);
+ return;
+ }
- class TemplateScriptResource extends AuthenticatedSiteResource {
- public TemplateScriptResource(SessionFactory sessionFactory) {
- super("script", true, sessionFactory);
- }
+ String mediaName = null;
+ if (pathElements.length == 7 && "data".equals(pathElements[pathElements.length - 2])) {
+ mediaName = MediaService.getTemplateGeometryName(templateID, Integer.parseInt(pathElements[pathElements.length - 1]));
+ } else {
+ mediaName = MediaService.getTemplateResourceName(templateID, pathElements[pathElements.length - 1]);
+ }
- public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
- AccountRecord requestedAccount = verifyAccount(response, pathElements);
- if (requestedAccount==null) {
- return;
- }
- TemplateRecord record = verifyTemplateExists(response, pathElements, requestedAccount);
- if (record==null) {
- return;
- }
- String script = getFirstStringValue(request);
- if (script == null) {
- InputStream scriptStream = getFirstFile(request, Sim.MAX_SCRIPT_SIZE);
- if (scriptStream == null) {
- response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- return;
- }
- script = StreamUtils.readInput(scriptStream);
- }
- if (!getMediaService().write(MediaService.getTemplateScriptName(record.getTemplateID()), script)) {
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- return;
- }
+ long length = getMediaService().getSize(mediaName);
+ if (length == -1) {
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
- TemplatePersistTasks.updateScriptFilePropOfTemplate(record,true,sessionFactory);
+ long lastM...
[truncated message content] |
|
From: <ian...@us...> - 2007-10-10 23:31:35
|
Revision: 490
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=490&view=rev
Author: iansmith
Date: 2007-10-10 16:31:38 -0700 (Wed, 10 Oct 2007)
Log Message:
-----------
Refactored the existing socket code into package and can pass all the tests against the new abstract API (AsyncProto).
No functional effect, but this readies to switch to a new underlying protocol, Comet, real soon now.
If you are not running on the apache portable runtime the CometServlet won't do anything. Since it is not in the code path right now, it's not a functional change.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/NetworkChannelServer.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/SenderQueue.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/TCPChannel.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/TCPMessageReader.java
maven/trunk/ogoglio-server/pom.xml
maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml
Added Paths:
-----------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProto.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProtoFactory.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProtoServer.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometClient.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/SimpleSocketAsync.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/SimpleSocketAsyncServer.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/CometServlet.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/NetworkChannelServer.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/NetworkChannelServer.java 2007-10-08 12:51:24 UTC (rev 489)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/NetworkChannelServer.java 2007-10-10 23:31:38 UTC (rev 490)
@@ -19,6 +19,9 @@
import java.net.Socket;
import java.util.Vector;
+import com.ogoglio.message.proto.AsyncProto;
+import com.ogoglio.message.proto.AsyncProtoFactory;
+import com.ogoglio.message.proto.AsyncProtoServer;
import com.ogoglio.util.BlockingQueue;
import com.ogoglio.util.Log;
import com.ogoglio.util.NetworkUtils;
@@ -27,7 +30,7 @@
private Vector channels = new Vector();
- private ServerSocket serverSocket = null;
+ private AsyncProtoServer serverProto = null;
private ChannelSocketListenerThread listenerThread = new ChannelSocketListenerThread();
@@ -35,21 +38,13 @@
private MessageHandler messageHandler = null;
- private Listener listener = null;
-
private boolean ensureOrigin = false;
- public NetworkChannelServer(MessageHandler messageHandler, boolean ensureOrigin, Listener listener) {
- this(messageHandler, 0, ensureOrigin, listener);
- }
-
+ private Listener listener;
+
public NetworkChannelServer(MessageHandler messageHandler, int port, boolean ensureOrigin, Listener listener) {
try {
- if (port == -1) {
- serverSocket = new ServerSocket(0);
- } else {
- serverSocket = new ServerSocket(port);
- }
+ serverProto= AsyncProtoFactory.getDefaultServer(port);
} catch (IOException e) {
throw new IllegalStateException("Could not open a server socket: " + e);
}
@@ -58,13 +53,12 @@
if (listener == null) {
throw new IllegalArgumentException("bad listener " + listener);
}
- this.listener = listener;
+ this.listener=listener;
listenerThread.start();
}
public interface Listener {
public void channelAdded(TCPChannel channel);
-
public void channelRemoved(TCPChannel channel);
}
@@ -115,13 +109,13 @@
}
public Locator getLocator() {
- return new Locator(NetworkUtils.getLocalHostAddress(), serverSocket.getLocalPort());
+ return new Locator(NetworkUtils.getLocalHostAddress(), serverProto.getLocalPort());
}
public void cleanup() {
cleaned = true;
try {
- serverSocket.close();
+ serverProto.shutdown();
} catch (Exception e) {
Log.info("Trying to close server socket of NCServer",e);
// don't care
@@ -142,11 +136,11 @@
public void run() {
while (!cleaned) {
try {
- Socket clientSocket = serverSocket.accept();
- if (clientSocket == null) {
+ AsyncProto clientProto = serverProto.waitForClient();
+ if (clientProto == null) {
break;
}
- TCPChannel channel = new TCPChannel(clientSocket, messageHandler, ensureOrigin, NetworkChannelServer.this);
+ TCPChannel channel = new TCPChannel(clientProto, messageHandler, ensureOrigin, NetworkChannelServer.this);
addChannel(channel);
listener.channelAdded(channel);
} catch (IOException e) {
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/SenderQueue.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/SenderQueue.java 2007-10-08 12:51:24 UTC (rev 489)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/SenderQueue.java 2007-10-10 23:31:38 UTC (rev 490)
@@ -18,6 +18,7 @@
import java.io.OutputStream;
import java.net.Socket;
+import com.ogoglio.message.proto.AsyncProto;
import com.ogoglio.util.BlockingQueue;
import com.ogoglio.util.Log;
@@ -26,16 +27,15 @@
private BlockingQueue messageQueue = new BlockingQueue();
- private Socket clientSocket = null;
+ private AsyncProto clientProto;
- private OutputStream socketOutput = null;
-
private boolean cleaned = false;
- public SenderQueue(Socket clientSocket, int maxSize) {
+ public SenderQueue(AsyncProto clientProto, int maxSize) {
messageQueue.setMaxSize(maxSize);
+ this.clientProto = clientProto;
try {
- socketOutput = clientSocket.getOutputStream();
+ this.clientProto.prepareOutput();
} catch (IOException e) {
throw new IllegalStateException("Could not get socket output stream: " + e);
}
@@ -47,18 +47,9 @@
public void cleanup() {
cleaned = true;
- try {
- if (clientSocket!=null) {
- clientSocket.close();
- }
- if (socketOutput!=null) {
- socketOutput.close();
- }
- if (messageQueue!=null) {
- messageQueue.close();
- }
- } catch (IOException e) {
- Log.info("IOException trying cleanup SenderQueue",e);
+ clientProto.shutdown();
+ if (messageQueue != null) {
+ messageQueue.close();
}
}
@@ -70,8 +61,7 @@
String messageString = message.toString();
Command command = new Command(Command.MESSAGE, messageString.length());
try {
- socketOutput.write((command + "\n").getBytes());
- socketOutput.write(messageString.getBytes());
+ clientProto.sendMessage(command.toString(),messageString);
} catch (IOException e) {
if (!cleaned) {
e.printStackTrace();
@@ -92,7 +82,7 @@
Message message = (Message) messageQueue.dequeue();
unsafeSendMessage(message);
} catch (Throwable e) {
- Log.error("Could not send message",e);
+ Log.error("Could not send message", e);
break;
}
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/TCPChannel.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/TCPChannel.java 2007-10-08 12:51:24 UTC (rev 489)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/TCPChannel.java 2007-10-10 23:31:38 UTC (rev 490)
@@ -15,9 +15,9 @@
package com.ogoglio.message;
import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.Socket;
+import com.ogoglio.message.proto.AsyncProto;
+import com.ogoglio.message.proto.AsyncProtoFactory;
import com.ogoglio.util.Log;
import com.ogoglio.util.NetworkUtils;
import com.ogoglio.util.BlockingQueue.QueueClosedException;
@@ -25,7 +25,7 @@
public class TCPChannel implements TCPMessageReader.Listener {
- private Socket clientSocket = null;
+ private AsyncProto clientProto = null;
private String remoteHostName = null;
@@ -44,13 +44,13 @@
private boolean ensureOrigin = false;
public TCPChannel(String remoteHost, int remotePort, MessageHandler messageHandler, boolean ensureOrigin, Listener listener) throws IOException {
- this(new Socket(remoteHost, remotePort), messageHandler, ensureOrigin, listener);
+ this(AsyncProtoFactory.getDefaultClient(remoteHost, remotePort), messageHandler, ensureOrigin, listener);
}
- public TCPChannel(Socket clientSocket, MessageHandler message_handler, boolean ensureOrigin, Listener listener) {
- this.clientSocket = clientSocket;
- remoteHostName = ((InetSocketAddress) clientSocket.getRemoteSocketAddress()).getAddress().getHostAddress();
- remoteHostPort = ((InetSocketAddress) clientSocket.getRemoteSocketAddress()).getPort();
+ public TCPChannel(AsyncProto proto, MessageHandler message_handler, boolean ensureOrigin, Listener listener) {
+ this.clientProto= proto;
+ remoteHostName = clientProto.getRemoteAddress().getAddress().getHostAddress();
+ remoteHostPort = clientProto.getRemoteAddress().getPort();
if (message_handler == null) {
throw new IllegalArgumentException("bad message handler " + message_handler);
}
@@ -62,10 +62,10 @@
this.listener = listener;
// TODO Don't spand two threads for each socket! No effing way!
- senderQueue = new SenderQueue(clientSocket, 1000); //TODO what should the max queue size be?
+ senderQueue = new SenderQueue(clientProto, 1000); //TODO what should the max queue size be?
senderQueue.start();
- readerThread = new TCPMessageReader(clientSocket, message_handler, this);
+ readerThread = new TCPMessageReader(clientProto, message_handler, this);
readerThread.start();
}
@@ -75,7 +75,7 @@
}
public Locator getLocalLocator() {
- return new Locator(NetworkUtils.getLocalHostAddress(), clientSocket.getLocalPort());
+ return new Locator(NetworkUtils.getLocalHostAddress(), clientProto.getLocalPort());
}
public Locator getRemoteLocator() {
@@ -122,7 +122,7 @@
}
public String toString() {
- return "TCPChannel from " + NetworkUtils.getLocalHostAddress() + ":" + clientSocket.getLocalPort() + " to " + remoteHostName + ":" + remoteHostPort;
+ return "TCPChannel from " + NetworkUtils.getLocalHostAddress() + ":" + clientProto.getLocalPort() + " to " + remoteHostName + ":" + remoteHostPort;
}
public void socketClosed() {
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/TCPMessageReader.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/TCPMessageReader.java 2007-10-08 12:51:24 UTC (rev 489)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/TCPMessageReader.java 2007-10-10 23:31:38 UTC (rev 490)
@@ -15,30 +15,14 @@
package com.ogoglio.message;
import java.io.IOException;
-import java.io.InputStream;
-import java.net.InetSocketAddress;
-import java.net.Socket;
+import com.ogoglio.message.proto.AsyncProto;
import com.ogoglio.util.Log;
public class TCPMessageReader extends Thread {
- //TODO make this not suck ass
-
- public static int MAX_COMMAND_LENGTH = 2048; //TODO decide whether 2048 bytes is enough for a max command length
-
- public static int MAX_MESSAGE_LENGTH = 2048; //TODO decide whether 2048 bytes is enough for a max message length
-
private boolean cleaned = false;
- private boolean inCommandState = true;
-
- private StringBuffer commandBuffer = new StringBuffer();
-
- private StringBuffer messageBuffer = new StringBuffer();
-
- private InputStream socketInput = null;
-
private MessageHandler messageHandler = null;
private TCPChannel channel = null;
@@ -46,20 +30,17 @@
private String remoteHostName = null;
private int remotePort = -1;
+
+ private AsyncProto clientProto=null;
- public TCPMessageReader(Socket clientSocket, MessageHandler messageHandler, TCPChannel channel) {
+ public TCPMessageReader(AsyncProto clientProto, MessageHandler messageHandler, TCPChannel channel) {
super("TCPMessageReader");
setDaemon(true);
- if (clientSocket == null) {
- throw new IllegalArgumentException("bad socket " + clientSocket);
+ if (clientProto == null) {
+ throw new IllegalArgumentException("bad protocol to TCPMessageReader" + clientProto);
}
- try {
- socketInput = clientSocket.getInputStream();
- } catch (IOException e) {
- throw new IllegalStateException("Couldn't get client socket input stream " + e);
- }
- remoteHostName = ((InetSocketAddress) clientSocket.getRemoteSocketAddress()).getAddress().getHostAddress();
- remotePort = ((InetSocketAddress) clientSocket.getRemoteSocketAddress()).getPort();
+ remoteHostName = clientProto.getRemoteAddress().getAddress().getHostAddress();
+ remotePort = clientProto.getRemoteAddress().getPort();
if (messageHandler == null) {
throw new IllegalArgumentException("bad message handler: " + messageHandler);
}
@@ -68,6 +49,14 @@
throw new IllegalArgumentException("bad listener " + channel);
}
this.channel = channel;
+ this.clientProto = clientProto;
+
+ try {
+ this.clientProto.prepareInput();
+ } catch (IOException e) {
+ throw new IllegalStateException("Couldn't get client socket input stream " + e);
+ }
+
}
public interface Listener {
@@ -76,65 +65,38 @@
public void cleanup() {
cleaned = true;
- try {
- if (socketInput!=null) {
- socketInput.close();
- }
- } catch (IOException e) {
- Log.info("IOException caught trying to clean up TCPMessageReader",e);
- }
+
+ clientProto.shutdown();
}
public void run() {
try {
Command command = new Command();
while (!cleaned) {
- int inInt = socketInput.read(); //TODO speed up message reading by using a receiving buffer
+ String commandLine = clientProto.readLine();
if (cleaned) {
- return;
+ return;//somebody shut us down during our wait
}
- if (inInt == -1) {
- channel.socketClosed();
+ if (commandLine==null) {
+ channel.socketClosed(); //other side went bye-bye
return;
}
- char inChar = (char) inInt;
- if (inCommandState) {
- if (commandBuffer.length() > MAX_COMMAND_LENGTH - 1) {
- throw new IllegalStateException("Command exceeds max length: " + commandBuffer);
- }
-
- if (inChar == '\r') { // this shouldn't happen, but people are silly
- continue;
- }
- if (inChar != '\n') {
- commandBuffer.append(inChar);
- } else {
- command.reset(commandBuffer.toString());
- commandBuffer.delete(0, commandBuffer.length());
- inCommandState = false;
- }
- } else {
- if (messageBuffer.length() > MAX_MESSAGE_LENGTH - 1) {
- throw new IllegalStateException("Message exceeds max length: " + messageBuffer);
- }
-
- messageBuffer.append(inChar);
- if (messageBuffer.length() == command.getMessageLength()) {
- Message message = Message.parseMessage(messageBuffer.toString());
- if (channel.ensureOrigin()) {
- message.getOrigin().setHost(remoteHostName);
- message.getOrigin().setPort(remotePort);
- }
- try {
- messageHandler.handleMessage(message, channel);
- } catch (Throwable e) {
- Log.error("Error handling message",e);
- e.printStackTrace();
- }
- messageBuffer.delete(0, messageBuffer.length());
- inCommandState = true;
- }
+ command.reset(commandLine);
+ if (!command.getType().equals(Command.MESSAGE)) {
+ throw new IllegalStateException("Whoa! Bad message type!"+command.getType());
}
+ String msg = clientProto.readString(command.getMessageLength());
+ Message message = Message.parseMessage(msg);
+ if (channel.ensureOrigin()) {
+ message.getOrigin().setHost(remoteHostName);
+ message.getOrigin().setPort(remotePort);
+ }
+ try {
+ messageHandler.handleMessage(message, channel);
+ } catch (Throwable e) {
+ Log.error("Error handling message",e);
+ e.printStackTrace();
+ }
}
} catch (Exception e) {
if (!cleaned) {
Added: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProto.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProto.java (rev 0)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProto.java 2007-10-10 23:31:38 UTC (rev 490)
@@ -0,0 +1,54 @@
+package com.ogoglio.message.proto;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+
+/**
+ * This class represents the notion of a protocol that can be sent over a socket. The
+ * simplest possible implementation is a socket, but it could be implemented on top of
+ * something else (in our case, COMET). Note that this is used by BOTH client and server
+ * once the two are connected.
+ *
+ * @author iansmith
+ *
+ */
+public interface AsyncProto {
+
+ /**
+ * The caller needs to be able to get at the endpoint to which this proto is speaking.
+ */
+ public InetSocketAddress getRemoteAddress();
+ /**
+ * The caller needs to get the port we are talking on.
+ */
+ public int getLocalPort();
+ /**
+ * Deal with various shutdown issues.
+ */
+ public void shutdown();
+ /**
+ * Pump out a message with a given command header.
+ */
+ public void sendMessage(String command, String message) throws IOException;
+ /**
+ * Read in a line terminated by CRLF. If the socket gets closed we return null. We return
+ * "" if the line was empty. IOException means something really unexpected happened.
+ */
+ public String readLine() throws IOException;
+ /**
+ * Read in a string that is known to be a given number of bytes. Again, we return null if
+ * the socket closes but "" for a zero length string. IOException means something bad happened.
+ */
+ public String readString(int length) throws IOException;
+ /**
+ * Insure that we are ready for writing to the output.
+ * @throws IOException
+ */
+ public void prepareOutput() throws IOException;
+ /**
+ * Insure that we are ready for reading from the input.
+ * @throws IOException
+ */
+ public void prepareInput() throws IOException;
+
+}
Added: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProtoFactory.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProtoFactory.java (rev 0)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProtoFactory.java 2007-10-10 23:31:38 UTC (rev 490)
@@ -0,0 +1,35 @@
+package com.ogoglio.message.proto;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+
+/**
+ * This is a factory for other classes to get a handle on our async protocol handler and so
+ * we can "throw the switch" in exactly one place if we want to switch protocols.
+ *
+ * @author iansmith
+ *
+ */
+public class AsyncProtoFactory {
+
+ /**
+ * Get a handler for this protocol. This is the client side call.
+ *
+ * @param host
+ * @param port
+ * @return
+ * @throws IOException
+ */
+ public static AsyncProto getDefaultClient(String host, int port) throws IOException {
+ return new SimpleSocketAsync(host,port);
+ }
+ /**
+ * Become a serevr who waits for connections.
+ *
+ * If we are going to wait on a port, you pass it here. Note that you may not end up waiting
+ * on that port if the underlying protocol doesn't need to.
+ */
+ public static AsyncProtoServer getDefaultServer(int port) throws IOException {
+ return new SimpleSocketAsyncServer(port);
+ }
+}
Added: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProtoServer.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProtoServer.java (rev 0)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/AsyncProtoServer.java 2007-10-10 23:31:38 UTC (rev 490)
@@ -0,0 +1,20 @@
+package com.ogoglio.message.proto;
+
+import java.io.IOException;
+
+public interface AsyncProtoServer {
+ /**
+ * Wait for a client to show up and connect to us. If he does, return the object of the right type.
+ */
+ public AsyncProto waitForClient() throws IOException ;
+
+ /**
+ * Clean up
+ */
+ public void shutdown() throws IOException;
+
+ /**
+ * Get the local port, if there is one
+ */
+ public int getLocalPort();
+}
\ No newline at end of file
Added: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometClient.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometClient.java (rev 0)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/CometClient.java 2007-10-10 23:31:38 UTC (rev 490)
@@ -0,0 +1,84 @@
+package com.ogoglio.message.proto;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.HttpURLConnection;
+import java.net.Socket;
+import java.net.URL;
+import java.net.URLConnection;
+
+import com.ogoglio.message.MessageHandler;
+import com.ogoglio.message.TCPChannel;
+import com.ogoglio.message.TCPChannel.Listener;
+
+public class CometClient {
+
+ //comet works over HTTP
+ private HttpURLConnection connection;
+
+ //most people just want to read/write to it
+ public OutputStream os;
+ public InputStream is;
+
+ private static final String CRLF="\r\n";
+ private static final String EOC = "0"+CRLF+CRLF; //end of chunk
+
+ public CometClient(String remoteHost, int remotePort, MessageHandler messageHandler, boolean ensureOrigin, Listener listener) throws IOException {
+ Socket socket=new Socket(remoteHost,remotePort);
+ is = socket.getInputStream();
+ os = socket.getOutputStream();
+
+ StringBuffer buff=new StringBuffer();
+ buff.append("POST /og/comet HTTP/1.1"+CRLF);
+ buff.append("content-type: text/plain"+CRLF);
+ buff.append("host: "+remoteHost+":"+remotePort+CRLF);
+ buff.append("connection: keep-alive"+CRLF);
+ buff.append("user-agent: ogoglio/viewer"+CRLF);
+ //if you omit this, the server generates the "end" immediately
+ buff.append("content-length: 17"+CRLF);
+ //buff.append("accept= text/plain"+CRLF);
+ buff.append("method: POST"+CRLF);
+ //buff.append("transfer-encoding= chunked"+CRLF);
+ buff.append(CRLF);
+ os.write(buff.toString().getBytes());
+ os.flush();
+
+ }
+
+
+ public static void main(String[] argv) {
+
+ try {
+ CometClient client=new CometClient("localhost",8080,null,false,null);
+ OutputStreamWriter wr=new OutputStreamWriter(client.os);
+ PrintWriter pr=new PrintWriter(wr);
+ StringBuffer data=new StringBuffer();
+ data.append(argv[0]+":"+argv[1]+"\n");
+
+ pr.print(data.toString());
+ pr.flush();
+
+
+ InputStreamReader isr=new InputStreamReader(client.is);
+ BufferedReader rd=new BufferedReader(isr);
+ String line=null;
+ do {
+ line=rd.readLine();
+ if (line!=null) {
+ System.out.println("<--:"+line);
+ }
+ } while (rd!=null);
+
+ } catch (IOException e) {
+ System.out.println("WHOA! IO EXCEPTION");
+ e.printStackTrace();
+ }
+ }
+
+
+}
Added: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/SimpleSocketAsync.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/SimpleSocketAsync.java (rev 0)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/SimpleSocketAsync.java 2007-10-10 23:31:38 UTC (rev 490)
@@ -0,0 +1,121 @@
+package com.ogoglio.message.proto;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+
+import com.ogoglio.util.Log;
+
+/**
+ * This is a simple impementation of a custom async proto that works on a standard TCP
+ * socket in the naive way.
+ *
+ * @author iansmith
+ *
+ */
+public class SimpleSocketAsync implements AsyncProto {
+
+ public static int MAX_COMMAND_LENGTH = 2048; //TODO decide whether 2048 bytes is enough for a max command length
+
+ public static int MAX_MESSAGE_LENGTH = 2048; //TODO decide whether 2048 bytes is enough for a max message length
+
+ private Socket socket = null;
+
+ private OutputStream socketOutput = null;
+
+ private InputStream socketInput = null;
+
+ private StringBuffer commandBuffer = new StringBuffer();
+
+ private StringBuffer messageBuffer = new StringBuffer();
+
+ public SimpleSocketAsync(String host, int port) throws IOException {
+ this(new Socket(host, port));
+ }
+
+ public SimpleSocketAsync(Socket socket) {
+ this.socket=socket;
+ }
+
+ public InetSocketAddress getRemoteAddress() {
+ return (InetSocketAddress) socket.getRemoteSocketAddress();
+ }
+
+ public int getLocalPort() {
+ return socket.getLocalPort();
+ }
+
+ public void shutdown() {
+ try {
+ if (socket != null) {
+ socket.close();
+ }
+ } catch (IOException e) {
+ Log.error("Unable to cleanup and shutdown SimpleSocketAsyncProto!", e);
+ }
+ }
+
+ public void sendMessage(String command, String message) throws IOException {
+ socketOutput.write((command + "\n").getBytes());
+ socketOutput.write(message.getBytes());
+
+ }
+
+ public String readLine() throws IOException {
+ boolean EOL = false;
+ do {
+ int inInt = socketInput.read(); //TODO speed up message reading by using a receiving buffer
+ if (inInt == -1) {
+ return null;
+ }
+ if (commandBuffer.length() > MAX_COMMAND_LENGTH - 1) {
+ throw new IllegalStateException("Command exceeds max length: " + commandBuffer);
+ }
+ char inChar = (char) inInt;
+ if (inChar == '\r') { // this shouldn't happen, but people are silly
+ continue;
+ }
+ if (inChar != '\n') {
+ commandBuffer.append(inChar);
+ } else {
+ EOL = true;
+ }
+ } while (!EOL);
+ String result = commandBuffer.toString();
+ commandBuffer.delete(0, commandBuffer.length());
+ return result;
+ }
+
+ public String readString(int length) throws IOException {
+ int ct = 0;
+ while (ct < length) {
+ int inInt = socketInput.read(); //TODO speed up message reading by using a receiving buffer
+ if (inInt == -1) {
+ return null;
+ }
+ if (messageBuffer.length() > MAX_MESSAGE_LENGTH - 1) {
+ throw new IllegalStateException("Message exceeds max length: " + messageBuffer);
+ }
+ char inChar = (char) inInt;
+ messageBuffer.append(inChar);
+ ++ct;
+ }
+ String result = messageBuffer.toString();
+ messageBuffer.delete(0, messageBuffer.length());
+ return result;
+ }
+
+ public void prepareOutput() throws IOException {
+ if (socketOutput == null) {
+ socketOutput = socket.getOutputStream();
+ }
+ }
+
+ public void prepareInput() throws IOException {
+ if (socketInput == null) {
+ socketInput = socket.getInputStream();
+ }
+ }
+}
Added: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/SimpleSocketAsyncServer.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/SimpleSocketAsyncServer.java (rev 0)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/proto/SimpleSocketAsyncServer.java 2007-10-10 23:31:38 UTC (rev 490)
@@ -0,0 +1,37 @@
+package com.ogoglio.message.proto;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+public class SimpleSocketAsyncServer implements AsyncProtoServer {
+
+ private ServerSocket serverSocket;
+
+ public SimpleSocketAsyncServer(int port) throws IOException {
+ if (port == -1) {
+ serverSocket = new ServerSocket(0);
+ } else {
+ serverSocket = new ServerSocket(port);
+ }
+ }
+ /**
+ * Wait for a client to show up and connect to us. If he does, return the object of the right type.
+ */
+ public AsyncProto waitForClient() throws IOException {
+ Socket socket=serverSocket.accept();
+ return new SimpleSocketAsync(socket);
+ }
+ /**
+ * Clean up
+ */
+ public void shutdown() throws IOException {
+ serverSocket.close();
+ }
+ /**
+ * Get the local port, if there is one
+ */
+ public int getLocalPort() {
+ return serverSocket.getLocalPort();
+ }
+}
Modified: maven/trunk/ogoglio-server/pom.xml
===================================================================
--- maven/trunk/ogoglio-server/pom.xml 2007-10-08 12:51:24 UTC (rev 489)
+++ maven/trunk/ogoglio-server/pom.xml 2007-10-10 23:31:38 UTC (rev 490)
@@ -262,10 +262,16 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.3</version>
+ <version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>6.0.14</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>rhino</groupId>
<artifactId>js</artifactId>
<version>1.6R6</version>
Added: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/CometServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/CometServlet.java (rev 0)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/CometServlet.java 2007-10-10 23:31:38 UTC (rev 490)
@@ -0,0 +1,165 @@
+package com.ogoglio.site;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.catalina.CometEvent;
+import org.apache.catalina.CometProcessor;
+
+import com.ogoglio.util.Log;
+
+public class CometServlet extends HttpServlet implements CometProcessor {
+
+ protected ArrayList connections = new ArrayList();
+
+ protected MessageSender messageSender = null;
+
+ public void init() throws ServletException {
+ messageSender = new MessageSender();
+ Thread messageSenderThread = new Thread(messageSender, "MessageSender[" + getServletContext() + "]");
+ messageSenderThread.setDaemon(true);
+ messageSenderThread.start();
+ }
+
+ public void destroy() {
+ connections.clear();
+ messageSender.stop();
+ messageSender = null;
+ }
+
+ /**
+ * Process the given Comet event.
+ *
+ * @param event The Comet event that will be processed
+ * @throws IOException
+ * @throws ServletException
+ */
+ public void event(CometEvent event) throws IOException, ServletException {
+ HttpServletRequest request = event.getHttpServletRequest();
+ HttpServletResponse response = event.getHttpServletResponse();
+ if (event.getEventType() == CometEvent.EventType.BEGIN) {
+ //event.setTimeout(60000);
+ Log.info("Begin for session: " + request.getSession(true).getId());
+ PrintWriter writer = response.getWriter();
+ response.setContentType("text/plain");
+ writer.println("<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">");
+ writer.println("<head><title>JSP Chat</title></head><body bgcolor=\"#FFFFFF\">");
+ writer.flush();
+ synchronized (connections) {
+ connections.add(response);
+ }
+ //drainDataBuffer(event, request);
+ } else if (event.getEventType() == CometEvent.EventType.ERROR) {
+ Log.error("Error for session: " + request.getSession(true).getId()+"-->"+event.getEventSubType());
+ if (event.getEventSubType()==CometEvent.EventSubType.TIMEOUT) {
+ Log.info("Timeout ignored!");
+ return;
+ }
+ synchronized (connections) {
+ connections.remove(response);
+ }
+ event.close();
+ } else if (event.getEventType() == CometEvent.EventType.END) {
+ Log.info("End for session: " + request.getSession(true).getId());
+ synchronized (connections) {
+ connections.remove(response);
+ }
+ PrintWriter writer = response.getWriter();
+ writer.println("</body></html>");
+ event.close();
+ } else if (event.getEventType() == CometEvent.EventType.READ) {
+ drainDataBuffer(event, request);
+ }
+ }
+
+ private void drainDataBuffer(CometEvent event, HttpServletRequest request) throws IOException {
+ InputStream is = request.getInputStream();
+ byte[] buf = new byte[512];
+ do {
+ int n = is.read(buf); //can throw an IOException
+ if (n > 0) {
+ Log.info("Read " + n + " bytes: " + new String(buf, 0, n) + " for session: " + request.getSession(true).getId());
+ String msg=new String(buf);
+ String sender=msg.substring(0,msg.indexOf(':'));
+ String message=msg.substring(msg.indexOf(':')+1);
+ messageSender.send(sender, message);
+ } else if (n < 0) {
+ Log.error("Read error:"+event.getEventType()+"," +request.getRequestURI()+","+n);
+ return;
+ }
+ } while (is.available() > 0);
+ }
+
+ public class MessageSender implements Runnable {
+
+ protected boolean running = true;
+
+ protected ArrayList messages = new ArrayList();
+
+ public MessageSender() {
+ }
+
+ public void stop() {
+ running = false;
+ }
+
+ /**
+ * Add message for sending.
+ */
+ public void send(String user, String message) {
+ Log.info("FART:adding"+message +" from "+user);
+ synchronized (messages) {
+ messages.add("[" + user + "]: " + message);
+ messages.notify();
+ }
+ }
+
+ public void run() {
+
+ while (running) {
+
+ if (messages.size() == 0) {
+ try {
+ synchronized (messages) {
+ messages.wait();
+ }
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ }
+
+ synchronized (connections) {
+ String[] pendingMessages = null;
+ synchronized (messages) {
+ pendingMessages = (String[]) messages.toArray(new String[0]);
+ messages.clear();
+ }
+ // Send any pending message on all the open connections
+ Log.info("FART currently need to send on "+connections.size()+" connections with "+pendingMessages.length);
+ for (int i = 0; i < connections.size(); i++) {
+ try {
+ PrintWriter writer = ((HttpServletResponse) connections.get(i)).getWriter();
+ for (int j = 0; j < pendingMessages.length; j++) {
+ writer.println(pendingMessages[j] + "<br>");
+ }
+ writer.flush();
+ } catch (IOException e) {
+ Log.error("IOExeption sending message", e);
+ }
+ }
+ }
+
+ }
+
+ }
+
+ }
+
+}
Modified: maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml 2007-10-08 12:51:24 UTC (rev 489)
+++ maven/trunk/ogoglio-server/src/main/webapp/WEB-INF/web.xml 2007-10-10 23:31:38 UTC (rev 490)
@@ -30,6 +30,12 @@
<load-on-startup>1</load-on-startup>
</servlet>
+ <servlet>
+ <servlet-name>CometServlet</servlet-name>
+ <servlet-class>com.ogoglio.site.CometServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
<servlet-mapping>
<servlet-name>AccountServlet</servlet-name>
<url-pattern>/account/*</url-pattern>
@@ -55,6 +61,11 @@
<url-pattern>/media/*</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>CometServlet</servlet-name>
+ <url-pattern>/comet/*</url-pattern>
+ </servlet-mapping>
+
<error-page>
<error-code>404</error-code>
<location>/notFound.html</location>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-08 12:51:26
|
Revision: 489
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=489&view=rev
Author: trevorolio
Date: 2007-10-08 05:51:24 -0700 (Mon, 08 Oct 2007)
Log Message:
-----------
Fixed the sim side Page so that it retains new content types upon update.
Added a new web api call to update a page from an input stream.
(all of this is handy for my hawt new iSight -> page demo hack)
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java
maven/trunk/ogoglio-server/src/main/resources/populate/space-2
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/thingPopup.html
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-10-08 12:51:18 UTC (rev 488)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-10-08 12:51:24 UTC (rev 489)
@@ -322,9 +322,31 @@
log("removed page " + event.getLongProperty(SpaceEvent.PAGE_ID));
} else if (SpaceEvent.UPDATE_PAGE_EVENT.equals(event.getName())) {
+ long thingID = event.getLongProperty(SpaceEvent.THING_ID).longValue();
+ long pageID = event.getLongProperty(SpaceEvent.PAGE_ID).longValue();
+ Thing thing = space.getThing(thingID);
+ if(thing == null){
+ return;
+ }
+ Page page = thing.getPage(pageID);
+ if(page == null){
+ return;
+ }
+ page.setContentType(event.getStringProperty(SpaceEvent.CONTENT_TYPE));
listener.generatedSpaceEvent(event, SpaceSimulator.this);
} else if (SpaceEvent.UPDATE_PAGE_CONTENT_EVENT.equals(event.getName())) {
+ long thingID = event.getLongProperty(SpaceEvent.THING_ID).longValue();
+ long pageID = event.getLongProperty(SpaceEvent.PAGE_ID).longValue();
+ Thing thing = space.getThing(thingID);
+ if(thing == null){
+ return;
+ }
+ Page page = thing.getPage(pageID);
+ if(page == null){
+ return;
+ }
+ page.setContentType(event.getStringProperty(SpaceEvent.CONTENT_TYPE));
listener.generatedSpaceEvent(event, SpaceSimulator.this);
} else if (SpaceEvent.TEXT_SAY_EVENT.equals(event.getName())) {
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-10-08 12:51:18 UTC (rev 488)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/site/SimServlet.java 2007-10-08 12:51:24 UTC (rev 489)
@@ -553,11 +553,11 @@
String pageContentType = null;
if (request.getContentType() != null && request.getContentType().startsWith("multipart/form-data")) {
DecoratedInputStream fileInput = getFirstFile(request, Sim.MAX_PAGE_SIZE);
- pageContentType = fileInput.getMimeType();
if (fileInput == null) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return;
}
+ pageContentType = fileInput.getMimeType();
getMediaService().write(MediaService.getPageContentName(spaceID, thingID, pageID), fileInput, Sim.MAX_PAGE_SIZE);
} else if (request.getContentType() != null && request.getContentType().startsWith("application/x-www-form-urlencoded")) {
Enumeration enumeration = request.getParameterNames();
@@ -575,6 +575,7 @@
}
}
} else {
+ pageContentType = request.getContentType();
getMediaService().write(MediaService.getPageContentName(spaceID, thingID, pageID), request.getInputStream(), Sim.MAX_PAGE_SIZE);
}
simulator.pageContentsChanged(thingID, pageID, pageContentType);
Modified: maven/trunk/ogoglio-server/src/main/resources/populate/space-2
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/populate/space-2 2007-10-08 12:51:18 UTC (rev 488)
+++ maven/trunk/ogoglio-server/src/main/resources/populate/space-2 2007-10-08 12:51:24 UTC (rev 489)
@@ -1 +1 @@
-<space ownerusername="library" sealevel="0.0" simid="1" displayname="Testville" maxguests="0" displaysea="false" spaceid="1" published="true"><thing templateid="57" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Light Pole" scaley="1.0" templateowner="library" scalex="1.0" possessionid="1" thingid="1" z="6.0" y="1.0" x="0.0" ownerusername="library"/><thing templateid="70" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Sign25 Miles Per Hour" scaley="1.0" templateowner="library" scalex="1.0" possessionid="2" thingid="2" z="-19.0" y="0.0" x="2.0" ownerusername="library"/><thing templateid="50" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Pipe Fence" scaley="1.0" templateowner="library" scalex="1.0" possessionid="3" thingid="3" z="0.0" y="0.0" x="2.0" ownerusername="library"/><thing templateid="64" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Pipe Cage" scaley="1.0" templateowner="library" scalex="1.0" possessionid="4" thingid="4" z="-13.0" y="0.0" x="-3.0" ownerusername="library"/><thing templateid="82" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Switchbox" scaley="1.0" templateowner="library" scalex="1.0" possessionid="5" thingid="5" z="-25.0" y="0.0" x="4.0" ownerusername="library"/><thing templateid="58" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Mailbox" scaley="1.0" templateowner="library" scalex="1.0" possessionid="6" thingid="6" z="-12.0" y="0.0" x="8.0" ownerusername="library"/><thing templateid="71" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Sign Bump" scaley="1.0" templateowner="library" scalex="1.0" possessionid="7" thingid="7" z="-17.0" y="0.0" x="0.0" ownerusername="library"/><thing templateid="75" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Sprinkler" scaley="1.0" templateowner="library" scalex="1.0" possessionid="8" thingid="8" z="-5.0" y="0.0" x="5.0" ownerusername="library"/><thing templateid="49" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Fence" scaley="1.0" templateowner="library" scalex="1.0" possessionid="9" thingid="9" z="-6.0" y="0.0" x="-5.0" ownerusername="library"/><thing templateid="63" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Parking Barrier" scaley="1.0" templateowner="library" scalex="1.0" possessionid="10" thingid="10" z="-17.0" y="0.0" x="3.0" ownerusername="library"/><thing templateid="72" rz="0.0" ry="-0.1081951345301089" rx="0.0" rw="0.9941296760805463" scalez="1.0000000000000016" displayname="Sign Bus Stop" scaley="1.0000000000000016" templateowner="library" scalex="1.0000000000000016" possessionid="11" thingid="11" z="-35.0" y="0.0" x="12.0" ownerusername="library"/><thing templateid="74" rz="0.0" ry="-0.6816387600233345" rx="0.0" rw="0.7316888688738207" scalez="1.0" displayname="Spigot" scaley="1.0" templateowner="library" scalex="1.0" possessionid="12" thingid="12" z="-5.0" y="1.0" x="-3.0" ownerusername="library"/><thing templateid="80" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Double Streetlight" scaley="1.0" templateowner="library" scalex="1.0" possessionid="13" thingid="13" z="0.0" y="0.0" x="-9.0" ownerusername="library"/><thing templateid="51" rz="0.0" ry="0.6816387600233345" rx="0.0" rw="0.7316888688738207" scalez="1.0" displayname="Floodlight" scaley="1.0" templateowner="library" scalex="1.0" possessionid="14" thingid="14" z="-8.0" y="3.0" x="-4.0" ownerusername="library"/><thing templateid="73" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Sign Crossing" scaley="1.0" templateowner="library" scalex="1.0" possessionid="15" thingid="15" z="-20.0" y="0.0" x="-2.0" ownerusername="library"/><thing templateid="62" rz="-0.2422096054295765" ry="-0.4519453132273099" rx="0.6039063177273147" rw="0.6102270891221998" scalez="0.9999999999999997" displayname="Palette" scaley="0.9999999999999997" templateowner="library" scalex="0.9999999999999997" possessionid="16" thingid="16" z="-40.0" y="1.0" x="3.0" ownerusername="library"/><thing templateid="48" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Crosswalk Button" scaley="1.0" templateowner="library" scalex="1.0" possessionid="17" thingid="17" z="2.0" y="2.0" x="2.0" ownerusername="library"/><thing templateid="43" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Bike Rack" scaley="1.0" templateowner="library" scalex="1.0" possessionid="18" thingid="18" z="-37.0" y="0.0" x="11.0" ownerusername="library"/><thing templateid="56" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Lawn Light" scaley="1.0" templateowner="library" scalex="1.0" possessionid="19" thingid="19" z="0.0" y="0.0" x="-2.0" ownerusername="library"/><thing templateid="81" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Old Fashioned Streetlight" scaley="1.0" templateowner="library" scalex="1.0" possessionid="20" thingid="20" z="-11.0" y="0.0" x="11.0" ownerusername="library"/><thing templateid="65" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Flower Pot" scaley="1.0" templateowner="library" scalex="1.0" possessionid="21" thingid="21" z="-16.0" y="1.0" x="-3.0" ownerusername="library"/><thing templateid="86" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Wire Conduit" scaley="1.0" templateowner="library" scalex="1.0" possessionid="22" thingid="22" z="0.0" y="0.0" x="-17.0" ownerusername="library"/><thing templateid="46" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Cafe Table" scaley="1.0" templateowner="library" scalex="1.0" possessionid="23" thingid="23" z="0.0" y="0.0" x="6.0" ownerusername="library"/><thing templateid="60" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Short Mailbox" scaley="1.0" templateowner="library" scalex="1.0" possessionid="24" thingid="24" z="-6.0" y="3.0" x="-2.0" ownerusername="library"/><thing templateid="76" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Stop Sign" scaley="1.0" templateowner="library" scalex="1.0" possessionid="25" thingid="25" z="-35.0" y="0.0" x="0.0" ownerusername="library"/><thing templateid="67" rz="0.0" ry="-0.9974949866040559" rx="0.0" rw="0.07073720166769953" scalez="1.0" displayname="Rail Endcap" scaley="1.0" templateowner="library" scalex="1.0" possessionid="26" thingid="26" z="-5.0" y="0.0" x="0.0" ownerusername="library"/><thing templateid="53" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Hydrant" scaley="1.0" templateowner="library" scalex="1.0" possessionid="27" thingid="27" z="-11.0" y="0.0" x="3.0" ownerusername="library"/><thing templateid="45" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Broom" scaley="1.0" templateowner="library" scalex="1.0" possessionid="28" thingid="28" z="-13.0" y="1.0" x="-1.0" ownerusername="library"/><thing templateid="79" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Streetlight" scaley="1.0" templateowner="library" scalex="1.0" possessionid="29" thingid="29" z="0.0" y="0.0" x="-4.0" ownerusername="library"/><thing templateid="54" rz="0.0" ry="-0.4794255386042033" rx="0.0" rw="0.8775825618903726" scalez="1.0" displayname="Lamp" scaley="1.0" templateowner="library" scalex="1.0" possessionid="30" thingid="30" z="-5.0" y="4.0" x="2.0" ownerusername="library"/><thing templateid="68" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Sandwich Board" scaley="1.0" templateowner="library" scalex="1.0" possessionid="31" thingid="31" z="-20.0" y="0.0" x="1.0" ownerusername="library"/><thing templateid="83" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Pylon" scaley="1.0" templateowner="library" scalex="1.0" possessionid="32" thingid="32" z="-6.0" y="0.0" x="4.0" ownerusername="library"/><thing templateid="59" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Private Mailbox" scaley="1.0" templateowner="library" scalex="1.0" possessionid="33" thingid="33" z="-12.0" y="0.0" x="9.0" ownerusername="library"/><thing templateid="84" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Trash Can1" scaley="1.0" templateowner="library" scalex="1.0" possessionid="34" thingid="34" z="0.0" y="0.0" x="-3.0" ownerusername="library"/><thing templateid="44" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Balloons" scaley="1.0" templateowner="library" scalex="1.0" possessionid="35" thingid="35" z="-9.0" y="3.0" x="7.0" ownerusername="library"/><thing templateid="55" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Gas Lamp" scaley="1.0" templateowner="library" scalex="1.0" possessionid="36" thingid="36" z="0.0" y="3.0" x="3.0" ownerusername="library"/><thing templateid="69" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Sidewalk Barrier" scaley="1.0" templateowner="library" scalex="1.0" possessionid="37" thingid="37" z="-2.0" y="0.0" x="1.0" ownerusername="library"/><thing templateid="78" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Street Sign" scaley="1.0" templateowner="library" scalex="1.0" possessionid="38" thingid="38" z="-22.0" y="0.0" x="-3.0" ownerusername="library"/><thing templateid="61" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Gas Meter" scaley="1.0" templateowner="library" scalex="1.0" possessionid="39" thingid="39" z="-5.0" y="0.0" x="-4.0" ownerusername="library"/><thing templateid="85" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Trash Can2" scaley="1.0" templateowner="library" scalex="1.0" possessionid="40" thingid="40" z="-12.0" y="0.0" x="4.0" ownerusername="library"/><thing templateid="66" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Rail" scaley="1.0" templateowner="library" scalex="1.0" possessionid="41" thingid="41" z="-5.0" y="0.0" x="-1.0" ownerusername="library"/><thing templateid="77" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Street Bench" scaley="1.0" templateowner="library" scalex="1.0" possessionid="42" thingid="42" z="-15.0" y="0.0" x="7.0" ownerusername="library"/><thing templateid="52" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="Garden Border" scaley="1.0" templateowner="library" scalex="1.0" possessionid="43" thingid="43" z="-1.0" y="0.0" x="4.0" ownerusername="library"/><thing templateid="47" rz="-5.378544397142389E-17" ry="-1.373367859738978E-17" rx="0.24740395925452296" rw="0.9689124217106448" scalez="1.0" displayname="Cinder Block" scaley="1.0" templateowner="library" scalex="1.0" possessionid="44" thingid="44" z="-5.0" y="0.0" x="-2.0" ownerusername="library"/></space>
\ No newline at end of file
+<space ownerusername="admin" sealevel="0.0" simid="1" displayname="Whitespace" maxguests="0" displaysea="false" spaceid="2" published="true"><thing templateid="28" rz="0.0" ry="0.0" rx="0.0" rw="1.0" scalez="1.0" displayname="White Board" scaley="1.0" templateowner="admin" scalex="1.0" possessionid="1" thingid="1" z="-10.0" y="1.0" x="0.0" ownerusername="admin"/></space>
\ No newline at end of file
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/thingPopup.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/thingPopup.html 2007-10-08 12:51:18 UTC (rev 488)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/thingPopup.html 2007-10-08 12:51:24 UTC (rev 489)
@@ -230,8 +230,8 @@
<input type='submit' onclick='move(0, 0, 1); return false;' value='South'/>
<form onsubmit='moveToZ(this.zPosInput.value); return false;'><input type='text' size='3' id='zPosInput' /></form>
<br/>
+ <input type='submit' onclick='move(-1, 0, 0); return false;' value='West'/>
<input type='submit' onclick='move(1, 0, 0); return false;' value='East'/>
- <input type='submit' onclick='move(-1, 0, 0); return false;' value='West'/>
<form onsubmit='moveToX(this.xPosInput.value); return false;'><input type='text' size='3' id='xPosInput' /></form>
<br/>
<input type='submit' onclick='resetPosition(); return false;' value='Reset'/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-08 12:51:15
|
Revision: 488
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=488&view=rev
Author: trevorolio
Date: 2007-10-08 05:51:18 -0700 (Mon, 08 Oct 2007)
Log Message:
-----------
Fixed the sim side Page so that it retains new content types upon update.
Added a new web api call to update a page from an input stream.
(all of this is handy for my hawt new iSight -> page demo hack)
Modified Paths:
--------------
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/viewer/j3d/J3DPageRenderable.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java 2007-10-07 18:46:30 UTC (rev 487)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java 2007-10-08 12:51:18 UTC (rev 488)
@@ -406,6 +406,7 @@
if (!page.getContentType().equals(event.getStringProperty(SpaceEvent.CONTENT_TYPE))) {
page.setContentType(event.getStringProperty(SpaceEvent.CONTENT_TYPE));
}
+ System.out.println("Page content type: " + page.getContentType());
page.reloadContent();
} else if (SpaceEvent.ADD_DOOR_EVENT.equals(event.getName())) {
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-10-07 18:46:30 UTC (rev 487)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java 2007-10-08 12:51:18 UTC (rev 488)
@@ -13,6 +13,7 @@
limitations under the License. */
package com.ogoglio.client;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
@@ -430,6 +431,10 @@
wire.performPOST(descriptor.getPageContentsURI(spaceID, thingID, pageID), contents, "application/octet-stream", authenticator.getAuthCookie());
}
+ public void setPageContents(long spaceID, long thingID, long pageID, InputStream inputStream, String mimeType) throws IOException {
+ wire.performPOST(descriptor.getPageContentsURI(spaceID, thingID, pageID), inputStream, mimeType, authenticator.getAuthCookie());
+ }
+
public InputStream getPageContents(long spaceID, long thingID, long pageID) throws IOException {
return wire.performGET(descriptor.getPageContentsURI(spaceID, thingID, pageID), authenticator.getAuthCookie(), false);
}
@@ -543,4 +548,5 @@
public BodyConfigurationDocument getDefaultBodyConfiguration(String username) throws IOException {
return new BodyConfigurationDocument(wire.fetchAuthenticatedXML(descriptor.getDefaultBodyConfiguration(username), authenticator.getAuthCookie()));
}
+
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DPageRenderable.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DPageRenderable.java 2007-10-07 18:46:30 UTC (rev 487)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DPageRenderable.java 2007-10-08 12:51:18 UTC (rev 488)
@@ -42,17 +42,14 @@
private BrowserScreen screen = null;
- // private J3DThingRenderable thingRenderable = null;
-
- public J3DPageRenderable(J3DThingRenderable NOT_USED, Page page) {
- //this.thingRenderable = thingRenderable;
+ public J3DPageRenderable(Page page) {
this.page = page;
setCapability(BranchGroup.ALLOW_DETACH);
pageGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
pageGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
addChild(pageGroup);
pageGroup.setTransform(page.getPosition());
- screen = new BrowserScreen(page.getContentType(), (float) page.getWidth(), (float) page.getHeight());
+ screen = new BrowserScreen();
pageGroup.addChild(screen);
reloadContent();
}
@@ -73,32 +70,18 @@
ImageRenderer imageRenderer = null;
- float width = -1;
-
- float height = -1;
-
float textureWidth = 512;
float textureHeight = -1;
- BrowserScreen(String contentType, float width, float height) {
- this.width = width;
- this.height = height;
-
- textureHeight = textureWidth * (height / (float) width);
- if (isTextType()) {
- textRenderer = new HtmlRenderer((int) textureWidth, (int) textureHeight);
- textRenderer.updateRender();
- } else if(isImageType()){
- imageRenderer = new ImageRenderer((int) textureWidth, (int) textureHeight);
- imageRenderer.updateRender();
- } else {
- throw new IllegalStateException("Unknown page type: " + page.getContentType());
- }
+ BrowserScreen() {
initShape();
+ updateContent();
}
private void initShape() {
+ float width = (float) page.getWidth();
+ float height = (float) page.getHeight();
PickTool.setCapabilities(this, PickTool.INTERSECT_COORD);
setCapability(Shape3D.ALLOW_APPEARANCE_READ);
@@ -106,7 +89,7 @@
setCapability(Shape3D.ALLOW_GEOMETRY_READ);
setCapability(Shape3D.ALLOW_BOUNDS_READ);
setCapability(Shape3D.ALLOW_COLLIDABLE_READ);
-
+
QuadArray polygon = new QuadArray(4, QuadArray.COORDINATES | GeometryArray.TEXTURE_COORDINATE_2);
polygon.setCapability(QuadArray.ALLOW_COORDINATE_READ);
polygon.setCapability(QuadArray.ALLOW_COUNT_READ);
@@ -124,13 +107,14 @@
Appearance appearance = new Appearance();
appearance.setCapability(Appearance.ALLOW_TEXTURE_WRITE);
- updateAppearance(appearance);
setGeometry(polygon);
setAppearance(appearance);
}
public void clicked(double x, double y) {
+ float width = (float) page.getWidth();
+ float height = (float) page.getHeight();
int textureX = -1 * ((int) (x * (textureWidth / width)) - (int) (textureWidth / 2));
int textureY = -1 * ((int) (y * (textureHeight / height)) - (int) (textureHeight / 2));
if (textRenderer != null) {
@@ -156,6 +140,7 @@
}
public void updateContent() {
+ textureHeight = textureWidth * ((float) page.getHeight() / (float) page.getWidth());
try {
if (isTextType() && textRenderer == null) {
if (imageRenderer != null) {
@@ -170,7 +155,6 @@
}
imageRenderer = new ImageRenderer((int) textureWidth, (int) textureHeight);
}
-
InputStream contentStream = page.getContent();
if (contentStream == null) {
throw new IOException("Null content stream");
@@ -198,7 +182,7 @@
public PageRenderable getPageRenderable() {
return J3DPageRenderable.this;
}
-
+
public double getHeight() {
return 0;
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java 2007-10-07 18:46:30 UTC (rev 487)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java 2007-10-08 12:51:18 UTC (rev 488)
@@ -262,7 +262,7 @@
Log.error("Tried to add a page to an unknown thing: " + page.getThing().getThingID());
return;
}
- J3DPageRenderable pageRenderable = new J3DPageRenderable(thingRenderable/*not used!*/, page);
+ J3DPageRenderable pageRenderable = new J3DPageRenderable(page);
thingRenderable.addPageRenderable(pageRenderable);
}
@@ -666,7 +666,7 @@
Page[] pages = thing.getPages();
for (int i = 0; i < pages.length; i++) {
- J3DPageRenderable pageRenderable = new J3DPageRenderable(renderable/*not used!*/, pages[i]);
+ J3DPageRenderable pageRenderable = new J3DPageRenderable(pages[i]);
renderable.addPageRenderable(pageRenderable);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-07 18:46:26
|
Revision: 487
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=487&view=rev
Author: trevorolio
Date: 2007-10-07 11:46:30 -0700 (Sun, 07 Oct 2007)
Log Message:
-----------
Added a bunch of face morphs to the Mike avatar.
Added a handy createMorph.sh script to make this process less painful.
Tweaked the body editor to show more morph controls.
Modified Paths:
--------------
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/chinWidth.ogmorph
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/fat.ogmorph
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/fat.blend
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/fat.obj
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/mike.blend
maven/trunk/ogoglio-bodies/ogoglio-body-tools/src/main/java/com/ogoglio/util/body/BodyMorphTool.java
Added Paths:
-----------
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/cheekWidth.ogmorph
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/eyeWidth.ogmorph
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/foreheadWidth.ogmorph
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/headHeight.ogmorph
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/mouthHeight.ogmorph
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/mouthWidth.ogmorph
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/noseHeight.ogmorph
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/noseWidth.ogmorph
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/cheekWidth.blend
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/cheekWidth.obj
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/eyeWidth.blend
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/eyeWidth.obj
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/foreheadWidth.blend
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/foreheadWidth.obj
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/headHeight.blend
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/headHeight.obj
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/mouthHeight.blend
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/mouthHeight.obj
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/mouthWidth.blend
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/mouthWidth.obj
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/noseHeight.blend
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/noseHeight.obj
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/noseWidth.blend
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/noseWidth.obj
maven/trunk/ogoglio-bodies/ogoglio-body-tools/src/main/resources/scripts/
maven/trunk/ogoglio-bodies/ogoglio-body-tools/src/main/resources/scripts/createMorph.sh
Removed Paths:
-------------
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/headWidth.ogmorph
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/headWidth.blend
maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/headWidth.obj
Added: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/cheekWidth.ogmorph
===================================================================
--- maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/cheekWidth.ogmorph (rev 0)
+++ maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/cheekWidth.ogmorph 2007-10-07 18:46:30 UTC (rev 487)
@@ -0,0 +1,9 @@
+# MorphDeltaMap
+name: Cheek Width
+parent: Head Height
+74 0.007194,0.000000,0.000000 0.011765,0.000000,0.000000
+93 0.005366,0.000000,0.000000
+517 -0.007193,0.000000,0.000000
+519 -0.011766,0.000000,0.000000
+537 -0.005366,0.000000,0.000000
+
Modified: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/chinWidth.ogmorph
===================================================================
--- maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/chinWidth.ogmorph 2007-10-07 18:45:19 UTC (rev 486)
+++ maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/chinWidth.ogmorph 2007-10-07 18:46:30 UTC (rev 487)
@@ -1,7 +1,6 @@
# MorphDeltaMap
name: Chin Width
-parent: Fat
-
+parent: Head Height
19 0.009885,0.000000,0.000000
21 0.006815,0.000000,0.000000
23 0.004966,0.000000,0.000000
Added: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/eyeWidth.ogmorph
===================================================================
--- maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/eyeWidth.ogmorph (rev 0)
+++ maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/eyeWidth.ogmorph 2007-10-07 18:46:30 UTC (rev 487)
@@ -0,0 +1,13 @@
+# MorphDeltaMap
+name: Eye Width
+parent: Head Height
+42 0.002701,0.000000,0.000000
+59 0.002374,0.000000,0.000000
+61 0.006853,0.000000,0.000000 0.010361,0.000000,0.000000 0.012759,0.000000,0.000000 0.007160,0.000000,0.000000 0.012262,0.000000,0.000000 0.007835,0.000000,0.000000 0.010080,0.000000,0.000000 0.012323,0.000000,0.000000 0.006867,0.000000,0.000000 0.006619,0.000000,0.000000 0.004728,0.000000,0.000000 0.003413,0.000000,0.000000
+85 0.004909,0.000000,0.000000 0.002641,0.000000,0.000000
+466 0.007326,0.000000,0.000000 0.009488,0.000000,0.000000
+495 -0.002701,0.000000,0.000000
+504 -0.002373,0.000000,0.000000 -0.006853,0.000000,0.000000 -0.007160,0.000000,0.000000 -0.012760,0.000000,0.000000 -0.010361,0.000000,0.000000 -0.007835,0.000000,0.000000 -0.012262,0.000000,0.000000 -0.012322,0.000000,0.000000 -0.010080,0.000000,0.000000 -0.006619,0.000000,0.000000 -0.006867,0.000000,0.000000 -0.004727,0.000000,0.000000 -0.003413,0.000000,0.000000
+529 -0.004910,0.000000,0.000000 -0.002641,0.000000,0.000000
+893 -0.009488,0.000000,0.000000 -0.007326,0.000000,0.000000
+
Modified: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/fat.ogmorph
===================================================================
--- maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/fat.ogmorph 2007-10-07 18:45:19 UTC (rev 486)
+++ maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/fat.ogmorph 2007-10-07 18:46:30 UTC (rev 487)
@@ -1,11 +1,11 @@
# MorphDeltaMap
name: Fat
-345 0.000000,0.000000,0.101537 0.000000,0.000000,0.101537 0.000000,0.000000,0.101537
+345 0.000000,0.000000,0.063381 0.000000,0.000000,0.069668 -0.020843,0.000000,0.092053
353 0.000000,0.000000,0.101536 0.000000,0.000000,0.101537 0.000000,0.000000,0.101537
361 0.000000,0.000000,0.101537 0.000000,0.000000,0.101537 0.000000,0.000000,0.101537
369 0.000000,0.000000,0.068832
-782 0.000000,0.000000,0.101537 0.000000,0.000000,0.101537
+782 0.000000,0.000000,0.069668 0.020844,0.000000,0.092053
788 0.000000,0.000000,0.101537 0.000000,0.000000,0.101537
794 0.000000,0.000000,0.101537 0.000000,0.000000,0.101537
Added: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/foreheadWidth.ogmorph
===================================================================
--- maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/foreheadWidth.ogmorph (rev 0)
+++ maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/foreheadWidth.ogmorph 2007-10-07 18:46:30 UTC (rev 487)
@@ -0,0 +1,20 @@
+# MorphDeltaMap
+name: Forehead Width
+parent: Head Height
+39 0.001553,0.000000,0.000000
+43 0.003134,0.000000,0.000000
+46 0.002294,0.000000,0.000000 0.003134,0.000000,0.000000
+49 0.004042,0.000000,0.000000
+77 0.006175,0.000000,0.000000 0.003353,0.000000,0.000000
+90 0.005109,0.000000,0.000000 0.007657,0.000000,0.000000
+101 0.006167,0.000000,0.000000 0.006103,0.000000,0.000000 0.007314,0.000000,0.000000
+108 0.008527,0.000000,0.000000 0.008604,0.000000,0.000000 0.009173,0.000000,0.000000
+128 0.009156,0.000000,0.000000
+494 -0.001553,0.000000,0.000000
+496 -0.003133,0.000000,0.000000 -0.002294,0.000000,0.000000 -0.003133,0.000000,0.000000 -0.004041,0.000000,0.000000
+521 -0.006175,0.000000,0.000000 -0.003352,0.000000,0.000000
+534 -0.005110,0.000000,0.000000 -0.007656,0.000000,0.000000
+545 -0.006167,0.000000,0.000000 -0.006104,0.000000,0.000000 -0.007313,0.000000,0.000000
+552 -0.008528,0.000000,0.000000 -0.008603,0.000000,0.000000 -0.009174,0.000000,0.000000
+572 -0.009156,0.000000,0.000000
+
Added: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/headHeight.ogmorph
===================================================================
--- maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/headHeight.ogmorph (rev 0)
+++ maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/headHeight.ogmorph 2007-10-07 18:46:30 UTC (rev 487)
@@ -0,0 +1,25 @@
+# MorphDeltaMap
+name: Head Height
+parent: Fat
+15 0.000000,-0.033945,0.000000 0.000000,-0.035408,0.000000
+19 0.000000,-0.033819,0.000000 0.000000,-0.035944,0.000000 0.000000,-0.030623,0.000000 0.000000,-0.032005,0.000000 0.000000,-0.024365,0.000000 0.000000,-0.024457,0.000000 0.000000,-0.018000,0.000000 0.000000,-0.018291,0.000000 0.000000,-0.016133,0.000000 0.000000,-0.016129,0.000000 0.000000,-0.014459,0.000000 0.000000,-0.014555,0.000000 0.000000,-0.008100,0.000000 0.000000,-0.009374,0.000000 0.000000,-0.005883,0.000000 0.000000,-0.007798,0.000000 0.000000,-0.003095,0.000000 0.000000,-0.004399,0.000000 0.000000,0.002621,0.000000 0.000000,0.002943,0.000000 0.000000,0.022159,0.000000 0.000000,0.022159,0.000000 0.000000,0.011991,0.000000 0.000000,0.010626,0.000000 0.000000,0.041951,0.000000 0.000000,0.043041,0.000000 0.000000,0.032927,0.000000 0.000000,0.032266,0.000000 0.000000,0.041568,0.000000 0.000000,0.042482,0.000000 0.000000,0.020814,0.000000 0.000000,0.021257,0.000000 0.000000,0.001603,0.000000 0.000000,0.001584,0.000000 0.000000,-0.023679,0.000000 0.000000,-0.023679,0.000000 0.000000,-0.012569,0.000000 0.000000,-0.013040,0.000000
+59 0.000000,0.006943,0.000000 0.000000,0.006782,0.000000 0.000000,0.010233,0.000000 0.000000,0.009690,0.000000 0.000000,0.013871,0.000000 0.000000,0.014429,0.000000 0.000000,0.007193,0.000000 0.000000,0.006452,0.000000 0.000000,0.005691,0.000000 0.000000,0.001680,0.000000 0.000000,0.005782,0.000000
+71 0.000000,0.006352,0.000000 0.000000,0.001945,0.000000 0.000000,-0.003618,0.000000 0.000000,-0.003775,0.000000 0.000000,-0.003590,0.000000 0.000000,0.006815,0.000000 0.000000,0.017799,0.000000 0.000000,0.021273,0.000000 0.000000,-0.014766,0.000000 0.000000,-0.011102,0.000000 0.000000,-0.015949,0.000000 0.000000,-0.016969,0.000000 0.000000,-0.017144,0.000000 0.000000,-0.023089,0.000000 0.000000,0.008130,0.000000 0.000000,0.010482,0.000000 0.000000,-0.011631,0.000000 0.000000,-0.017432,0.000000 0.000000,-0.026737,0.000000 0.000000,0.029976,0.000000 0.000000,0.022481,0.000000 0.000000,0.009327,0.000000 0.000000,-0.002920,0.000000 0.000000,-0.011350,0.000000 0.000000,-0.018521,0.000000 0.000000,-0.028885,0.000000 0.000000,-0.029355,0.000000
+100 0.000000,-0.023892,0.000000 0.000000,0.037886,0.000000 0.000000,0.037249,0.000000 0.000000,0.017957,0.000000 0.000000,0.001130,0.000000 0.000000,-0.012719,0.000000 0.000000,-0.023200,0.000000
+108 0.000000,0.025259,0.000000 0.000000,0.025540,0.000000 0.000000,0.015023,0.000000 0.000000,0.001478,0.000000 0.000000,-0.011481,0.000000 0.000000,-0.010265,0.000000 0.000000,-0.001372,0.000000
+116 0.000000,0.006409,0.000000 0.000000,-0.001224,0.000000 0.000000,-0.008937,0.000000 0.000000,-0.007934,0.000000
+122 0.000000,-0.010108,0.000000 0.000000,0.006286,0.000000 0.000000,0.007744,0.000000 0.000000,0.009334,0.000000 0.000000,0.008471,0.000000 0.000000,0.011041,0.000000 0.000000,0.015673,0.000000
+465 0.000000,-0.016143,0.000000 0.000000,0.007671,0.000000 0.000000,0.007628,0.000000
+482 0.000000,-0.033945,0.000000
+484 0.000000,-0.033819,0.000000 0.000000,-0.030623,0.000000 0.000000,-0.024365,0.000000 0.000000,-0.018000,0.000000 0.000000,-0.016133,0.000000 0.000000,-0.014459,0.000000 0.000000,-0.008100,0.000000 0.000000,-0.005882,0.000000 0.000000,-0.003095,0.000000 0.000000,0.002620,0.000000 0.000000,0.022159,0.000000 0.000000,0.010626,0.000000 0.000000,0.041951,0.000000 0.000000,0.032266,0.000000 0.000000,0.041568,0.000000 0.000000,0.020814,0.000000
+501 0.000000,-0.023668,0.000000 0.000000,-0.013040,0.000000
+504 0.000000,0.006943,0.000000 0.000000,0.010233,0.000000 0.000000,0.014429,0.000000 0.000000,0.013871,0.000000 0.000000,0.009690,0.000000 0.000000,0.006452,0.000000 0.000000,0.007193,0.000000 0.000000,0.001680,0.000000 0.000000,0.005691,0.000000
+514 0.000000,0.005782,0.000000 0.000000,0.006352,0.000000 0.000000,0.001945,0.000000 0.000000,-0.003775,0.000000 0.000000,-0.003618,0.000000 0.000000,-0.003590,0.000000 0.000000,0.006815,0.000000 0.000000,0.017799,0.000000 0.000000,0.021273,0.000000 0.000000,-0.011102,0.000000 0.000000,-0.014766,0.000000 0.000000,-0.016969,0.000000 0.000000,-0.015949,0.000000 0.000000,-0.023089,0.000000 0.000000,-0.017144,0.000000 0.000000,0.008130,0.000000 0.000000,0.010482,0.000000 0.000000,-0.011631,0.000000 0.000000,-0.017432,0.000000 0.000000,-0.026737,0.000000 0.000000,0.029976,0.000000 0.000000,0.022481,0.000000 0.000000,0.009327,0.000000 0.000000,-0.002920,0.000000 0.000000,-0.011350,0.000000 0.000000,-0.018521,0.000000 0.000000,-0.028873,0.000000 0.000000,-0.029355,0.000000 0.000000,-0.023892,0.000000
+545 0.000000,0.037886,0.000000 0.000000,0.037249,0.000000 0.000000,0.017956,0.000000
+549 0.000000,-0.023200,0.000000 0.000000,-0.012719,0.000000
+552 0.000000,0.025259,0.000000 0.000000,0.025540,0.000000 0.000000,0.015023,0.000000
+556 0.000000,-0.011481,0.000000 0.000000,-0.010265,0.000000 0.000000,-0.001372,0.000000 0.000000,0.006409,0.000000
+561 0.000000,-0.001224,0.000000 0.000000,-0.007934,0.000000 0.000000,-0.008937,0.000000 0.000000,-0.010108,0.000000
+567 0.000000,0.007744,0.000000 0.000000,0.006286,0.000000 0.000000,0.009334,0.000000 0.000000,0.011042,0.000000 0.000000,0.008472,0.000000 0.000000,0.015673,0.000000
+892 0.000000,-0.016143,0.000000 0.000000,0.007628,0.000000 0.000000,0.007671,0.000000
+
Deleted: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/headWidth.ogmorph
===================================================================
--- maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/headWidth.ogmorph 2007-10-07 18:45:19 UTC (rev 486)
+++ maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/headWidth.ogmorph 2007-10-07 18:46:30 UTC (rev 487)
@@ -1,34 +0,0 @@
-# MorphDeltaMap
-name: Head Width
-parent: Fat
-
-15 -0.006293,0.000000,0.000000
-19 -0.006191,0.000000,0.000000
-21 -0.004267,0.000000,0.000000
-23 -0.003108,0.000000,0.000000
-25 -0.002406,0.000000,0.000000
-27 -0.001766,0.000000,0.000000
-29 -0.002342,0.000000,0.000000
-31 -0.003998,0.000000,0.000000
-33 -0.002881,0.000000,0.000000
-35 -0.002653,0.000000,0.000000
-37 -0.001338,0.000000,0.000000
-39 -0.002891,0.000000,0.000000
-42 -0.002048,0.000000,0.000000 -0.005839,0.000000,0.000000
-46 -0.004273,0.000000,0.000000 -0.005839,0.000000,0.000000
-49 -0.007533,0.000000,0.000000
-51 -0.007398,0.000000,0.000000
-53 -0.005977,0.000000,0.000000
-56 -0.007295,0.000000,0.000000
-59 -0.001800,0.000000,0.000000
-61 -0.005205,0.000000,0.000000 -0.007871,0.000000,0.000000 -0.009695,0.000000,0.000000 -0.005438,0.000000,0.000000 -0.009316,0.000000,0.000000 -0.011106,0.000000,0.000000 -0.007658,0.000000,0.000000 -0.009362,0.000000,0.000000 -0.005216,0.000000,0.000000 -0.005027,0.000000,0.000000 -0.003589,0.000000,0.000000 -0.002589,0.000000,0.000000 -0.004332,0.000000,0.000000 -0.006312,0.000000,0.000000 -0.010328,0.000000,0.000000 -0.013449,0.000000,0.000000 -0.011512,0.000000,0.000000 -0.006248,0.000000,0.000000 -0.004320,0.000000,0.000000 -0.007440,0.000000,0.000000 -0.006382,0.000000,0.000000 -0.009040,0.000000,0.000000 -0.004018,0.000000,0.000000 -0.007046,0.000000,0.000000 -0.003727,0.000000,0.000000 -0.002003,0.000000,0.000000 -0.010480,0.000000,0.000000 -0.010982,0.000000,0.000000 -0.008967,0.000000,0.000000 -0.009523,0.000000,0.000000 -0.014273,0.000000,0.000000 -0.015464,0.000000,0.000000 -0.013112,0.000000,0.000000 -0.012620,0.000000,0.000000 -0.012323,0.000000,0.000000 -0.010281,0.000000,0.000000 -0.010471,0.000000,0.000000
-100 -0.011806,0.000000,0.000000 -0.011495,0.000000,0.000000 -0.011377,0.000000,0.000000 -0.013634,0.000000,0.000000 -0.012398,0.000000,0.000000 -0.011412,0.000000,0.000000 -0.011289,0.000000,0.000000
-108 -0.015898,0.000000,0.000000 -0.016040,0.000000,0.000000 -0.017103,0.000000,0.000000 -0.015166,0.000000,0.000000 -0.013428,0.000000,0.000000 -0.013835,0.000000,0.000000 -0.014671,0.000000,0.000000 -0.017819,0.000000,0.000000 -0.017919,0.000000,0.000000 -0.014974,0.000000,0.000000 -0.013517,0.000000,0.000000 -0.016373,0.000000,0.000000 -0.014951,0.000000,0.000000 -0.018078,0.000000,0.000000 -0.015832,0.000000,0.000000 -0.016559,0.000000,0.000000 -0.018339,0.000000,0.000000 -0.017057,0.000000,0.000000 -0.016861,0.000000,0.000000 -0.018339,0.000000,0.000000 -0.017070,0.000000,0.000000
-465 -0.003698,0.000000,0.000000 -0.005564,0.000000,0.000000 -0.007208,0.000000,0.000000
-482 0.006303,0.000000,0.000000
-484 0.006200,0.000000,0.000000 0.004277,0.000000,0.000000 0.003117,0.000000,0.000000 0.002415,0.000000,0.000000 0.001774,0.000000,0.000000 0.002352,0.000000,0.000000 0.004008,0.000000,0.000000 0.002890,0.000000,0.000000 0.002662,0.000000,0.000000 0.001348,0.000000,0.000000 0.002900,0.000000,0.000000 0.002058,0.000000,0.000000 0.005848,0.000000,0.000000 0.004283,0.000000,0.000000 0.005848,0.000000,0.000000 0.007542,0.000000,0.000000 0.007401,0.000000,0.000000 0.005985,0.000000,0.000000 0.007304,0.000000,0.000000
-504 0.001809,0.000000,0.000000 0.005214,0.000000,0.000000 0.005447,0.000000,0.000000 0.009703,0.000000,0.000000 0.007881,0.000000,0.000000 0.011115,0.000000,0.000000 0.009326,0.000000,0.000000 0.009372,0.000000,0.000000 0.007667,0.000000,0.000000 0.005036,0.000000,0.000000 0.005225,0.000000,0.000000 0.003599,0.000000,0.000000 0.002599,0.000000,0.000000 0.006322,0.000000,0.000000 0.004341,0.000000,0.000000 0.010336,0.000000,0.000000 0.013459,0.000000,0.000000 0.011520,0.000000,0.000000 0.006258,0.000000,0.000000 0.007449,0.000000,0.000000 0.004329,0.000000,0.000000 0.009050,0.000000,0.000000 0.006391,0.000000,0.000000 0.007055,0.000000,0.000000 0.004028,0.000000,0.000000 0.003736,0.000000,0.000000 0.002012,0.000000,0.000000 0.010490,0.000000,0.000000 0.010319,0.000000,0.000000 0.008976,0.000000,0.000000 0.009532,0.000000,0.000000 0.014283,0.000000,0.000000 0.015473,0.000000,0.000000 0.013122,0.000000,0.000000 0.012629,0.000000,0.000000 0.012333,0.000000,0.000000 0.010291,0.000000,0.000000 0.010481,0.000000,0.000000 0.011815,0.000000,0.000000
-545 0.011504,0.000000,0.000000 0.011386,0.000000,0.000000 0.013644,0.000000,0.000000 0.012375,0.000000,0.000000 0.011298,0.000000,0.000000 0.011421,0.000000,0.000000
-552 0.015907,0.000000,0.000000 0.016050,0.000000,0.000000 0.017111,0.000000,0.000000 0.014959,0.000000,0.000000 0.013436,0.000000,0.000000 0.013845,0.000000,0.000000 0.014680,0.000000,0.000000 0.017929,0.000000,0.000000 0.017827,0.000000,0.000000 0.014983,0.000000,0.000000 0.016383,0.000000,0.000000 0.013525,0.000000,0.000000 0.015841,0.000000,0.000000 0.018087,0.000000,0.000000 0.014961,0.000000,0.000000 0.018348,0.000000,0.000000 0.016567,0.000000,0.000000 0.017067,0.000000,0.000000 0.018348,0.000000,0.000000 0.016871,0.000000,0.000000 0.017078,0.000000,0.000000
-892 0.003707,0.000000,0.000000 0.007217,0.000000,0.000000 0.005574,0.000000,0.000000
-
Added: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/mouthHeight.ogmorph
===================================================================
--- maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/mouthHeight.ogmorph (rev 0)
+++ maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/mouthHeight.ogmorph 2007-10-07 18:46:30 UTC (rev 487)
@@ -0,0 +1,12 @@
+# MorphDeltaMap
+name: Mouth Height
+parent: Head Height
+25 0.000000,-0.007527,0.000000 0.000000,-0.008697,0.000000
+29 0.000000,0.006705,0.000000 0.000000,0.006320,0.000000
+79 0.000000,0.005470,0.000000
+83 0.000000,-0.004088,0.000000
+487 0.000000,-0.007527,0.000000
+489 0.000000,0.006705,0.000000
+524 0.000000,0.005470,0.000000
+528 0.000000,-0.004088,0.000000
+
Added: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/mouthWidth.ogmorph
===================================================================
--- maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/mouthWidth.ogmorph (rev 0)
+++ maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/mouthWidth.ogmorph 2007-10-07 18:46:30 UTC (rev 487)
@@ -0,0 +1,16 @@
+# MorphDeltaMap
+name: Mouth Width
+parent: Head Height
+25 0.003855,0.000000,0.000000
+27 0.002830,0.000000,0.000000
+29 0.003753,0.000000,0.000000
+79 0.006915,0.000000,0.000000
+81 0.006693,0.000000,0.000000
+83 0.006433,0.000000,0.000000
+465 0.005920,0.000000,0.000000
+487 -0.003855,0.000000,0.000000 -0.002830,0.000000,0.000000 -0.003753,0.000000,0.000000
+524 -0.006916,0.000000,0.000000
+526 -0.006692,0.000000,0.000000
+528 -0.006432,0.000000,0.000000
+892 -0.005921,0.000000,0.000000
+
Added: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/noseHeight.ogmorph
===================================================================
--- maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/noseHeight.ogmorph (rev 0)
+++ maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/noseHeight.ogmorph 2007-10-07 18:46:30 UTC (rev 487)
@@ -0,0 +1,8 @@
+# MorphDeltaMap
+name: Nose Height
+parent: Head Height
+35 0.000000,0.007060,0.000000 0.000000,0.007060,0.000000 0.000000,0.007060,0.000000 0.000000,0.007060,0.000000
+41 0.000000,0.007060,0.000000
+60 0.000000,0.007060,0.000000
+492 0.000000,0.007060,0.000000 0.000000,0.007060,0.000000
+
Added: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/noseWidth.ogmorph
===================================================================
--- maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/noseWidth.ogmorph (rev 0)
+++ maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/geometry/noseWidth.ogmorph 2007-10-07 18:46:30 UTC (rev 487)
@@ -0,0 +1,10 @@
+# MorphDeltaMap
+name: Nose Width
+parent: Head Height
+31 0.003971,0.000000,0.000000
+33 0.008131,0.000000,0.000000
+35 0.007487,0.000000,0.000000
+73 0.004302,0.000000,0.000000
+490 -0.003970,0.000000,0.000000 -0.008132,0.000000,0.000000 -0.007488,0.000000,0.000000
+518 -0.004301,0.000000,0.000000
+
Added: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/cheekWidth.blend
===================================================================
(Binary files differ)
Property changes on: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/cheekWidth.blend
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/cheekWidth.obj
===================================================================
--- maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/cheekWidth.obj (rev 0)
+++ maven/trunk/ogoglio-bodies/ogoglio-body-mike/src/main/resources/sourceArt/cheekWidth.obj 2007-10-07 18:46:30 UTC (rev 487)
@@ -0,0 +1,2682 @@
+# Blender3D v243 OBJ File: cheekWidth.blend
+# www.blender3d.org
+o Mike
+v 0.311142 0.406033 -0.108595
+v 0.303021 0.345360 -0.125835
+v 0.227706 0.341257 -0.128513
+v 0.229273 0.409040 -0.107120
+v 0.294899 0.278192 -0.102832
+v 0.241228 0.253397 -0.120454
+v 0.226139 0.256499 -0.012092
+v 0.294899 0.270102 -0.036757
+v 0.303021 0.323897 0.025088
+v 0.227706 0.318876 0.024398
+v 0.311142 0.395855 0.014442
+v 0.229273 0.394438 0.000494
+v 0.314506 0.428960 -0.051745
+v 0.229922 0.422291 -0.054673
+v 0.032408 0.438193 0.019218
+v 0.000028 0.433348 0.028486
+v 0.000028 0.377973 0.023821
+v 0.049007 0.387226 0.014744
+v 0.031882 0.438606 0.041908
+v 0.000028 0.431574 0.061884
+v 0.021992 0.449185 0.072133
+v 0.000028 0.444615 0.081399
+v 0.016030 0.469902 0.076850
+v 0.000028 0.469598 0.081529
+v 0.012422 0.490974 0.083452
+v 0.000028 0.490011 0.087355
+v 0.009128 0.497154 0.079358
+v 0.000028 0.497166 0.081634
+v 0.012094 0.502695 0.087565
+v 0.000028 0.502377 0.089515
+v 0.020607 0.523745 0.080789
+v 0.000028 0.519527 0.090166
+v 0.014865 0.531088 0.096715
+v 0.000028 0.524749 0.102985
+v 0.013691 0.540315 0.093596
+v 0.000028 0.535999 0.105575
+v 0.006934 0.559235 0.089070
+v 0.000028 0.560304 0.094733
+v 0.014916 0.623913 0.087199
+v 0.000028 0.623913 0.087199
+v 0.000028 0.590254 0.090531
+v 0.010582 0.585735 0.084708
+v 0.030071 0.689433 0.033411
+v 0.000028 0.693038 0.037553
+v 0.000028 0.659557 0.075624
+v 0.022023 0.657368 0.073036
+v 0.030071 0.688165 -0.058547
+v 0.000028 0.691187 -0.060564
+v 0.038780 0.619464 -0.126007
+v 0.000028 0.620930 -0.128730
+v 0.038089 0.555866 -0.119522
+v 0.000028 0.555803 -0.122571
+v 0.030779 0.472175 -0.081673
+v 0.000028 0.472172 -0.082136
+v 0.000028 0.508952 -0.096572
+v 0.037557 0.507394 -0.092203
+v 0.032240 0.437063 -0.080951
+v 0.000028 0.433697 -0.084518
+v 0.009305 0.573542 0.082195
+v 0.000028 0.573009 0.087655
+v 0.026811 0.584435 0.071542
+v 0.040521 0.582635 0.067057
+v 0.049895 0.596475 0.070593
+v 0.028011 0.598325 0.081865
+v 0.047951 0.574371 0.059396
+v 0.057153 0.571919 0.048250
+v 0.039423 0.569399 0.067127
+v 0.048187 0.556122 0.062690
+v 0.026867 0.569700 0.072905
+v 0.025897 0.553701 0.072508
+v 0.018504 0.571587 0.076368
+v 0.013366 0.556996 0.078749
+v 0.022323 0.538583 0.079018
+v 0.039701 0.538061 0.069355
+v 0.064914 0.538678 0.045440
+v 0.069197 0.573117 0.032754
+v 0.059235 0.609482 0.058061
+v 0.032174 0.620979 0.079437
+v 0.022262 0.501677 0.080554
+v 0.038303 0.513808 0.066809
+v 0.032862 0.497765 0.070830
+v 0.046530 0.494389 0.061846
+v 0.020710 0.493805 0.077478
+v 0.036277 0.474128 0.069749
+v 0.019214 0.577472 0.076421
+v 0.010349 0.585259 0.084608
+v 0.053937 0.512055 0.044935
+v 0.056515 0.492857 0.041268
+v 0.046152 0.462052 0.048870
+v 0.049014 0.649793 0.053833
+v 0.073436 0.624977 0.026105
+v 0.079557 0.581437 0.011099
+v 0.072833 0.540893 0.013789
+v 0.064933 0.512990 0.011857
+v 0.063412 0.489249 0.013024
+v 0.052911 0.454943 0.012510
+v 0.053886 0.453386 0.001558
+v 0.077742 0.410787 -0.022260
+v 0.083865 0.431962 -0.044335
+v 0.060751 0.471467 -0.025079
+v 0.059151 0.675975 0.025682
+v 0.058545 0.673868 -0.054165
+v 0.070151 0.610003 -0.105443
+v 0.063792 0.554302 -0.100252
+v 0.058724 0.508456 -0.075485
+v 0.058092 0.473761 -0.057461
+v 0.066169 0.433346 -0.059552
+v 0.081789 0.634172 -0.004684
+v 0.082519 0.635104 -0.051578
+v 0.087981 0.600291 -0.078550
+v 0.078026 0.555455 -0.070254
+v 0.069087 0.512555 -0.043755
+v 0.071182 0.516580 -0.012704
+v 0.075481 0.546017 -0.017103
+v 0.091662 0.553537 -0.029029
+v 0.092180 0.571775 -0.025134
+v 0.077038 0.546506 -0.004031
+v 0.069544 0.520973 -0.005878
+v 0.084231 0.524297 -0.014313
+v 0.076922 0.552023 -0.031426
+v 0.092997 0.553324 -0.037942
+v 0.081448 0.517100 -0.018164
+v 0.085183 0.571371 -0.036702
+v 0.094337 0.576197 -0.039252
+v 0.087750 0.581460 -0.022004
+v 0.086741 0.578605 -0.014305
+v 0.094337 0.587110 -0.022076
+v 0.087812 0.602441 -0.015110
+v 0.000028 0.306033 0.078103
+v 0.098413 0.315753 0.058105
+v 0.000028 0.390553 -0.124096
+v 0.066103 0.392548 -0.118642
+v 0.127275 0.405948 -0.001655
+v 0.133119 0.432021 -0.049028
+v 0.105463 0.420778 -0.094615
+v 0.176177 0.321700 0.039256
+v 0.182500 0.403268 -0.006660
+v 0.183263 0.429829 -0.056155
+v 0.167158 0.411076 -0.096562
+v 0.156244 0.357656 -0.125999
+v 0.071801 0.287852 -0.142860
+v 0.000028 0.288407 -0.148833
+v 0.161383 0.280583 -0.135349
+v 0.000028 0.234817 0.101598
+v 0.088484 0.240522 0.093669
+v 0.183165 0.247821 0.074628
+v 0.219529 0.164758 0.009079
+v 0.220210 0.161960 -0.104152
+v 0.075033 0.180716 -0.154695
+v 0.000028 0.181746 -0.161272
+v 0.162609 0.175029 -0.143446
+v 0.000028 0.122600 0.129090
+v 0.081107 0.138150 0.122447
+v 0.169559 0.175308 0.080912
+v 0.392215 0.398575 -0.103312
+v 0.389599 0.341860 -0.118799
+v 0.363127 0.295690 -0.098197
+v 0.363926 0.288459 -0.038797
+v 0.371429 0.322571 -0.003214
+v 0.393038 0.393851 0.012893
+v 0.393035 0.421282 -0.052218
+v 0.480329 0.382575 -0.108943
+v 0.477818 0.339690 -0.116291
+v 0.476964 0.281307 -0.096437
+v 0.477731 0.274366 -0.039413
+v 0.479842 0.321220 0.003687
+v 0.481119 0.375678 -0.002511
+v 0.481116 0.403009 -0.052303
+v 0.534529 0.383467 -0.103144
+v 0.531846 0.339802 -0.113081
+v 0.530933 0.277408 -0.092400
+v 0.531753 0.279534 -0.038301
+v 0.531875 0.319938 -0.008492
+v 0.535374 0.377030 -0.007050
+v 0.535371 0.407429 -0.052026
+v 0.614205 0.370882 -0.094631
+v 0.611815 0.330580 -0.103040
+v 0.611002 0.272891 -0.089630
+v 0.611732 0.275147 -0.040212
+v 0.613742 0.312186 -0.013477
+v 0.614958 0.366006 -0.012141
+v 0.614955 0.393044 -0.052460
+v 0.697684 0.349483 -0.085306
+v 0.696158 0.323875 -0.094952
+v 0.695639 0.289056 -0.082154
+v 0.696105 0.284930 -0.045352
+v 0.697388 0.306451 -0.017489
+v 0.698164 0.345371 -0.021510
+v 0.698162 0.361660 -0.053638
+v 0.754698 0.333399 -0.077816
+v 0.753286 0.320252 -0.096420
+v 0.752805 0.296102 -0.081030
+v 0.753237 0.292513 -0.048656
+v 0.754424 0.311242 -0.024676
+v 0.755142 0.332518 -0.031850
+v 0.755141 0.337772 -0.056064
+v 0.807592 0.316963 -0.102882
+v 0.806886 0.309287 -0.104776
+v 0.806406 0.294584 -0.088101
+v 0.806837 0.303095 -0.044997
+v 0.790644 0.296553 -0.014002
+v 0.790965 0.316036 -0.012315
+v 0.791362 0.326429 -0.019325
+v 0.809505 0.337968 -0.055003
+v 0.808922 0.330058 -0.094521
+v 0.856666 0.324398 -0.107946
+v 0.856203 0.309974 -0.111118
+v 0.855723 0.301462 -0.090840
+v 0.839287 0.310210 -0.066552
+v 0.840293 0.307497 -0.051713
+v 0.818320 0.322653 -0.003366
+v 0.817355 0.311672 0.007191
+v 0.857701 0.307526 0.022552
+v 0.858060 0.320750 0.012845
+v 0.825749 0.327720 -0.017101
+v 0.822955 0.332172 -0.031065
+v 0.842806 0.337434 -0.069897
+v 0.857983 0.334552 -0.084306
+v 0.857616 0.332506 -0.094534
+v 0.878465 0.326286 -0.111195
+v 0.878262 0.310207 -0.113301
+v 0.877985 0.302192 -0.094581
+v 0.878107 0.307071 -0.081601
+v 0.855289 0.302989 -0.078731
+v 0.857342 0.294860 -0.010075
+v 0.856331 0.302742 -0.020943
+v 0.883379 0.306162 -0.026117
+v 0.879604 0.304083 -0.010124
+v 0.858060 0.328932 -0.015010
+v 0.859335 0.310650 -0.011660
+v 0.879896 0.317261 -0.006545
+v 0.884695 0.328932 -0.015010
+v 0.880023 0.335110 -0.081512
+v 0.885720 0.337257 -0.070783
+v 0.878872 0.316581 -0.087636
+v 0.883185 0.309870 -0.068091
+v 0.884684 0.317452 -0.063753
+v 0.883892 0.311136 -0.054673
+v 0.883766 0.316540 -0.032873
+v 0.882798 0.309195 -0.040030
+v 0.879877 0.329057 -0.101777
+v 0.885809 0.338866 -0.056774
+v 0.884694 0.340475 -0.042764
+v 0.884694 0.335037 -0.025919
+v 0.821182 0.289975 -0.011262
+v 0.857342 0.296060 0.017453
+v 0.817044 0.301665 0.001516
+v 0.911570 0.302867 -0.001241
+v 0.912187 0.313236 0.003461
+v 0.921627 0.301808 0.011660
+v 0.911065 0.291154 0.005491
+v 0.911065 0.291427 0.018073
+v 0.906535 0.317860 -0.113865
+v 0.906365 0.303624 -0.112733
+v 0.908014 0.322962 -0.102199
+v 0.906953 0.311825 -0.092512
+v 0.906088 0.299519 -0.099606
+v 0.941775 0.303009 -0.101606
+v 0.948146 0.291392 -0.105249
+v 0.939086 0.299501 -0.112069
+v 0.965350 0.305935 -0.071314
+v 0.972148 0.298701 -0.074351
+v 0.965218 0.305535 -0.078756
+v 0.841634 0.340336 -0.055388
+v 0.841149 0.335478 -0.037826
+v 0.855977 0.332205 -0.026418
+v 0.966390 0.309162 -0.055292
+v 0.974673 0.299676 -0.047939
+v 0.971513 0.296787 -0.057628
+v 0.964451 0.302563 -0.012991
+v 0.972537 0.294499 -0.017808
+v 0.964126 0.301372 -0.023422
+v 0.823797 0.295120 -0.027878
+v 0.845438 0.304521 -0.030178
+v 0.859012 0.318845 -0.005538
+v 0.894490 0.305101 0.030385
+v 0.895051 0.318576 0.021116
+v 0.885814 0.293930 0.022748
+v 0.885814 0.289052 0.007662
+v 0.886320 0.302423 -0.002559
+v 0.912689 0.306951 -0.066372
+v 0.913581 0.317452 -0.063753
+v 0.912581 0.306612 -0.081599
+v 0.913442 0.316905 -0.084002
+v 0.914497 0.329638 -0.081483
+v 0.914617 0.329435 -0.070742
+v 0.912890 0.309725 -0.039758
+v 0.913712 0.324143 -0.036580
+v 0.912790 0.308982 -0.052521
+v 0.913653 0.318456 -0.059502
+v 0.914706 0.332728 -0.056741
+v 0.914794 0.333791 -0.042728
+v 0.914101 0.307026 -0.010625
+v 0.914373 0.317271 -0.007286
+v 0.913522 0.303222 -0.023223
+v 0.914049 0.316792 -0.026910
+v 0.914768 0.327140 -0.024733
+v 0.914769 0.327838 -0.012102
+v 0.886936 0.318403 0.003433
+v 0.912187 0.310895 0.015093
+v 0.911626 0.301338 0.023150
+v 0.929923 0.302823 -0.092941
+v 0.932783 0.313122 -0.102193
+v 0.926876 0.290615 -0.099559
+v 0.927876 0.294607 -0.112685
+v 0.930554 0.308568 -0.113339
+v 0.943794 0.299756 -0.068410
+v 0.946499 0.308737 -0.063707
+v 0.943642 0.300252 -0.081565
+v 0.946286 0.308221 -0.083956
+v 0.949541 0.315907 -0.080187
+v 0.949614 0.316457 -0.070672
+v 0.948709 0.304082 -0.039728
+v 0.952027 0.315692 -0.036535
+v 0.948492 0.302545 -0.052486
+v 0.950999 0.310100 -0.059457
+v 0.954520 0.318716 -0.056666
+v 0.954779 0.319748 -0.042654
+v 0.942940 0.298888 -0.010096
+v 0.945144 0.308805 -0.006500
+v 0.941910 0.297813 -0.023194
+v 0.944731 0.308346 -0.027607
+v 0.950815 0.313296 -0.025232
+v 0.950934 0.314901 -0.011651
+v 0.947637 0.294064 -0.093913
+v 0.942769 0.283864 -0.099862
+v 0.944379 0.287197 -0.111653
+v 0.965252 0.291031 -0.069455
+v 0.968652 0.297354 -0.065851
+v 0.965150 0.291297 -0.079823
+v 0.968424 0.296990 -0.081691
+v 0.970543 0.293645 -0.040931
+v 0.973292 0.301255 -0.038216
+v 0.970114 0.292405 -0.051736
+v 0.966767 0.309976 -0.043425
+v 0.964109 0.287824 -0.011341
+v 0.967547 0.295527 -0.008501
+v 0.963276 0.287433 -0.022121
+v 0.967088 0.295062 -0.025569
+v 0.211918 0.060508 0.009634
+v 0.212598 0.057791 -0.088298
+v 0.075033 0.068439 -0.157155
+v 0.000028 0.071188 -0.160683
+v 0.162609 0.066391 -0.134785
+v 0.000028 0.018325 0.125006
+v 0.081107 0.033861 0.115662
+v 0.160689 0.047771 0.063222
+v 0.193886 -0.059312 0.010272
+v 0.194515 -0.061973 -0.077289
+v 0.073739 -0.054174 -0.145085
+v 0.000028 -0.050157 -0.148620
+v 0.154668 -0.059717 -0.122697
+v 0.000028 -0.085337 0.102384
+v 0.079352 -0.078306 0.096437
+v 0.152894 -0.064361 0.063819
+v 0.206643 -0.182710 0.006394
+v 0.207307 -0.185366 -0.080232
+v 0.073087 -0.183652 -0.163583
+v 0.000028 -0.181627 -0.176575
+v 0.158533 -0.187001 -0.140772
+v 0.000028 -0.183768 0.089989
+v 0.079013 -0.186118 0.087508
+v 0.156660 -0.188272 0.060982
+v 0.217632 -0.316931 0.008457
+v 0.218306 -0.319549 -0.070898
+v 0.078152 -0.336320 -0.156648
+v 0.009250 -0.309291 -0.164916
+v 0.164005 -0.323822 -0.126342
+v -0.001653 -0.264408 0.086143
+v 0.084163 -0.327601 0.074255
+v 0.162105 -0.325183 0.058479
+v 0.230176 -0.430637 0.005062
+v 0.230914 -0.433306 -0.066731
+v 0.006620 -0.377167 -0.122505
+v 0.083923 -0.441582 -0.135759
+v 0.030954 -0.438307 -0.119357
+v 0.165040 -0.437718 -0.116889
+v -0.002821 -0.332311 0.033739
+v 0.017958 -0.429087 0.007909
+v 0.090503 -0.441802 0.064600
+v 0.162960 -0.439271 0.050326
+v 0.222837 -0.553256 0.008807
+v 0.232208 -0.553787 -0.054626
+v 0.113148 -0.554776 -0.114688
+v 0.048644 -0.553257 -0.101597
+v 0.182910 -0.554391 -0.102225
+v 0.030896 -0.553254 0.020694
+v 0.101988 -0.553988 0.053602
+v 0.164625 -0.553797 0.048133
+v 0.004458 -0.430298 -0.042374
+v 0.015405 -0.553254 -0.044763
+v 0.002147 -0.380715 -0.043301
+v 0.206606 -0.670152 0.018721
+v 0.214418 -0.670689 -0.045876
+v 0.115159 -0.671683 -0.107040
+v 0.062475 -0.670163 -0.093709
+v 0.173319 -0.671297 -0.094348
+v 0.046989 -0.670148 0.030825
+v 0.105855 -0.670879 0.064337
+v 0.158075 -0.670688 0.058767
+v 0.034073 -0.670154 -0.035833
+v 0.198387 -0.790216 0.018314
+v 0.205576 -0.790744 -0.044596
+v 0.114234 -0.791730 -0.104164
+v 0.065752 -0.790211 -0.091181
+v 0.167755 -0.791346 -0.091803
+v 0.052777 -0.790214 0.030102
+v 0.105672 -0.790949 0.062739
+v 0.153727 -0.790758 0.057315
+v 0.041452 -0.790211 -0.034815
+v 0.183272 -0.909319 0.010603
+v 0.189607 -0.909826 -0.048240
+v 0.109122 -0.910791 -0.103956
+v 0.066403 -0.909277 -0.091813
+v 0.156281 -0.910411 -0.092394
+v 0.059015 -0.909321 0.021629
+v 0.101578 -0.910068 0.052156
+v 0.143921 -0.909875 0.047083
+v 0.044992 -0.909296 -0.039091
+v 0.183272 -1.019136 0.007524
+v 0.189607 -1.019634 -0.049842
+v 0.109122 -1.020592 -0.104159
+v 0.066403 -1.019080 -0.092321
+v 0.156281 -1.020214 -0.092888
+v 0.059015 -1.019139 0.018274
+v 0.101578 -1.019890 0.048035
+v 0.143921 -1.019696 0.043088
+v 0.044992 -1.019106 -0.040923
+v 0.173240 -1.123543 0.008080
+v 0.187740 -1.124102 -0.060565
+v 0.109122 -1.125059 -0.114883
+v 0.066403 -1.123548 -0.103045
+v 0.156281 -1.124681 -0.103611
+v 0.063244 -1.123546 0.018830
+v 0.102600 -1.124298 0.048591
+v 0.142476 -1.124104 0.043644
+v 0.048930 -1.123573 -0.051647
+v 0.176846 -1.187160 0.027773
+v 0.187644 -1.214756 -0.059215
+v 0.109122 -1.213050 -0.114414
+v 0.066403 -1.211538 -0.102576
+v 0.156281 -1.215113 -0.103130
+v 0.101578 -1.161543 0.182298
+v 0.065679 -1.176706 0.152622
+v 0.065679 -1.209567 0.152797
+v 0.101578 -1.215162 0.182584
+v 0.143921 -1.161349 0.177352
+v 0.143921 -1.214968 0.177638
+v 0.172564 -1.176703 0.141872
+v 0.172564 -1.217875 0.142092
+v 0.048930 -1.214235 -0.051164
+v 0.061397 -1.187217 0.028251
+v 0.060495 -1.139723 0.075530
+v 0.101578 -1.129409 0.075410
+v 0.060495 -1.215808 0.088571
+v 0.096161 -1.203909 0.025452
+v 0.101578 -1.223975 0.088549
+v 0.143921 -1.129189 0.075425
+v 0.142476 -1.203690 0.025231
+v 0.143921 -1.223755 0.088564
+v 0.177748 -1.139663 0.075534
+v 0.177748 -1.215747 0.088575
+v 0.152486 -1.224410 -0.061332
+v 0.106474 -1.224701 -0.060935
+v 0.019063 0.497120 0.072960
+v 0.028659 0.575952 0.074675
+v 0.037109 0.575812 0.070753
+v -0.311086 0.406033 -0.108594
+v -0.229217 0.409040 -0.107120
+v -0.227650 0.341256 -0.128513
+v -0.302964 0.345360 -0.125835
+v -0.241171 0.253397 -0.120454
+v -0.294843 0.278192 -0.102832
+v -0.226082 0.256499 -0.012092
+v -0.294843 0.270102 -0.036757
+v -0.227650 0.318876 0.024398
+v -0.302964 0.323897 0.025088
+v -0.229217 0.394438 0.000494
+v -0.311086 0.395855 0.014442
+v -0.229866 0.422291 -0.054673
+v -0.314450 0.428960 -0.051745
+v -0.032352 0.438193 0.019218
+v -0.048950 0.387226 0.014744
+v -0.031826 0.438606 0.041908
+v -0.021936 0.449185 0.072133
+v -0.015974 0.469902 0.076850
+v -0.012366 0.490974 0.083452
+v -0.009071 0.497154 0.079358
+v -0.012038 0.502695 0.087565
+v -0.020551 0.523745 0.080789
+v -0.014808 0.531088 0.096715
+v -0.013634 0.540315 0.093596
+v -0.006878 0.559235 0.089070
+v -0.014860 0.623913 0.087199
+v -0.010526 0.585735 0.084708
+v -0.030015 0.689433 0.033411
+v -0.021967 0.657368 0.073036
+v -0.030015 0.688165 -0.058547
+v -0.038724 0.619464 -0.126007
+v -0.037996 0.553636 -0.118622
+v -0.030722 0.472213 -0.074561
+v -0.037500 0.507394 -0.092203
+v -0.032184 0.437063 -0.080951
+v -0.009249 0.573542 0.082195
+v -0.026755 0.584435 0.071542
+v -0.027954 0.598325 0.081865
+v -0.049838 0.596475 0.070593
+v -0.040465 0.582635 0.067057
+v -0.057096 0.571919 0.048250
+v -0.047895 0.574371 0.059396
+v -0.048131 0.556122 0.062690
+v -0.039367 0.569399 0.067127
+v -0.025841 0.553701 0.072508
+v -0.026810 0.569700 0.072905
+v -0.018448 0.571587 0.076368
+v -0.013310 0.556996 0.078749
+v -0.039644 0.538061 0.069355
+v -0.022267 0.538583 0.079018
+v -0.064858 0.538678 0.045440
+v -0.069141 0.573117 0.032754
+v -0.059178 0.609482 0.058061
+v -0.032118 0.620979 0.079437
+v -0.038246 0.513808 0.066809
+v -0.022205 0.501677 0.080554
+v -0.046474 0.494389 0.061846
+v -0.032806 0.497765 0.070830
+v -0.036220 0.474128 0.069749
+v -0.020654 0.493805 0.077478
+v -0.019157 0.577472 0.076421
+v -0.010293 0.585259 0.084608
+v -0.053881 0.512055 0.044935
+v -0.053000 0.492857 0.041268
+v -0.046095 0.462052 0.048870
+v -0.048957 0.649793 0.053833
+v -0.073380 0.624977 0.026105
+v -0.079500 0.581437 0.011099
+v -0.072777 0.540893 0.013789
+v -0.064877 0.512990 0.011857
+v -0.063356 0.489249 0.013024
+v -0.052855 0.454981 0.019622
+v -0.053830 0.453386 0.001558
+v -0.060694 0.471467 -0.025079
+v -0.083809 0.431962 -0.044335
+v -0.077685 0.410787 -0.022260
+v -0.059095 0.675975 0.025682
+v -0.058488 0.673868 -0.054165
+v -0.070095 0.610003 -0.105443
+v -0.063575 0.553309 -0.099924
+v -0.058036 0.473761 -0.057461
+v -0.058667 0.508456 -0.075485
+v -0.066112 0.433346 -0.059552
+v -0.081732 0.634172 -0.004684
+v -0.082463 0.635104 -0.051578
+v -0.087924 0.600291 -0.078550
+v -0.076853 0.551430 -0.068695
+v -0.069030 0.512555 -0.043755
+v -0.071126 0.516580 -0.012704
+v -0.075424 0.546017 -0.017103
+v -0.092124 0.571775 -0.025134
+v -0.091605 0.553537 -0.029029
+v -0.076981 0.546506 -0.004031
+v -0.084175 0.524297 -0.014313
+v -0.069487 0.520973 -0.005878
+v -0.081392 0.517100 -0.018164
+v -0.092941 0.553324 -0.037942
+v -0.076866 0.552023 -0.031426
+v -0.094281 0.576197 -0.039252
+v -0.085126 0.571371 -0.036702
+v -0.087694 0.581460 -0.022004
+v -0.094281 0.587110 -0.022076
+v -0.086685 0.578605 -0.014305
+v -0.087755 0.602441 -0.015110
+v -0.098357 0.315753 0.058105
+v -0.066047 0.392548 -0.118642
+v -0.133063 0.432021 -0.049028
+v -0.127218 0.405948 -0.001655
+v -0.105407 0.420778 -0.094615
+v -0.182443 0.403268 -0.006660
+v -0.176121 0.321700 0.039256
+v -0.167102 0.411076 -0.096562
+v -0.183206 0.429829 -0.056155
+v -0.156187 0.357656 -0.125999
+v -0.071745 0.287852 -0.142860
+v -0.161326 0.280583 -0.135349
+v -0.088427 0.240522 0.093669
+v -0.183108 0.247821 0.074628
+v -0.220153 0.161960 -0.104152
+v -0.219473 0.164758 0.009079
+v -0.074976 0.180716 -0.154695
+v -0.162552 0.175029 -0.143446
+v -0.081050 0.138150 0.122447
+v -0.169503 0.175388 0.095807
+v -0.389543 0.341860 -0.118799
+v -0.392158 0.398575 -0.103312
+v -0.363071 0.295690 -0.098196
+v -0.363870 0.288459 -0.038797
+v -0.371373 0.322571 -0.003214
+v -0.392981 0.393851 0.012893
+v -0.392978 0.421282 -0.052218
+v -0.477762 0.339690 -0.116291
+v -0.480272 0.382575 -0.108943
+v -0.476907 0.281307 -0.096437
+v -0.477675 0.274366 -0.039413
+v -0.479785 0.321220 0.003687
+v -0.481063 0.375678 -0.002511
+v -0.481060 0.403009 -0.052303
+v -0.531790 0.339802 -0.113081
+v -0.534473 0.383467 -0.103144
+v -0.530877 0.277408 -0.092400
+v -0.531697 0.279534 -0.038301
+v -0.531819 0.319938 -0.008492
+v -0.535318 0.377030 -0.007050
+v -0.535315 0.407429 -0.052026
+v -0.611758 0.330580 -0.103040
+v -0.614149 0.370882 -0.094631
+v -0.610945 0.272891 -0.089630
+v -0.611676 0.275147 -0.040212
+v -0.613685 0.312186 -0.013477
+v -0.614901 0.366006 -0.012141
+v -0.614899 0.393044 -0.052460
+v -0.696101 0.323875 -0.094952
+v -0.697627 0.349483 -0.085306
+v -0.695582 0.289056 -0.082154
+v -0.696048 0.284930 -0.045352
+v -0.697331 0.306451 -0.017489
+v -0.698108 0.345371 -0.021510
+v -0.698106 0.361660 -0.053638
+v -0.753229 0.320252 -0.096420
+v -0.754641 0.333399 -0.077816
+v -0.752749 0.296102 -0.081030
+v -0.753180 0.292513 -0.048656
+v -0.754367 0.311242 -0.024676
+v -0.755086 0.332518 -0.031850
+v -0.755084 0.337772 -0.056064
+v -0.806830 0.309287 -0.104776
+v -0.807536 0.316963 -0.102882
+v -0.806349 0.294584 -0.088101
+v -0.806781 0.303095 -0.044997
+v -0.790587 0.296553 -0.014002
+v -0.791306 0.326429 -0.019325
+v -0.790909 0.316036 -0.012315
+v -0.809449 0.337968 -0.055003
+v -0.808866 0.330058 -0.094521
+v -0.856147 0.309974 -0.111118
+v -0.856609 0.324398 -0.107946
+v -0.855666 0.301462 -0.090840
+v -0.840237 0.307497 -0.051713
+v -0.839231 0.310210 -0.066552
+v -0.818264 0.322653 -0.003366
+v -0.858004 0.320750 0.012845
+v -0.857645 0.307526 0.022552
+v -0.817298 0.311672 0.007191
+v -0.822899 0.332171 -0.031065
+v -0.825692 0.327720 -0.017101
+v -0.857559 0.332506 -0.094534
+v -0.857926 0.334552 -0.084306
+v -0.842749 0.337434 -0.069897
+v -0.878409 0.326286 -0.111195
+v -0.878205 0.310207 -0.113301
+v -0.855233 0.302989 -0.078731
+v -0.878051 0.307071 -0.081601
+v -0.877928 0.302192 -0.094581
+v -0.857285 0.294860 -0.010075
+v -0.879547 0.304083 -0.010124
+v -0.883323 0.306162 -0.026117
+v -0.856275 0.302742 -0.020943
+v -0.858004 0.328932 -0.015010
+v -0.884639 0.328932 -0.015010
+v -0.879840 0.317261 -0.006545
+v -0.859278 0.310650 -0.011660
+v -0.879967 0.335110 -0.081512
+v -0.885664 0.337257 -0.070783
+v -0.878816 0.316581 -0.087636
+v -0.883129 0.309870 -0.068091
+v -0.883836 0.311136 -0.054673
+v -0.884627 0.317452 -0.063753
+v -0.883710 0.316540 -0.032873
+v -0.882741 0.309194 -0.040030
+v -0.879821 0.329057 -0.101777
+v -0.885752 0.338866 -0.056774
+v -0.884637 0.340475 -0.042764
+v -0.884638 0.335037 -0.025919
+v -0.821125 0.289975 -0.011262
+v -0.816987 0.301665 0.001516
+v -0.857285 0.296060 0.017453
+v -0.911514 0.302867 -0.001241
+v -0.921571 0.301808 0.011660
+v -0.912130 0.313236 0.003461
+v -0.911008 0.291154 0.005491
+v -0.911008 0.291427 0.018073
+v -0.906309 0.303624 -0.112733
+v -0.906479 0.317860 -0.113865
+v -0.907957 0.322962 -0.102199
+v -0.906896 0.311825 -0.092512
+v -0.906031 0.299519 -0.099606
+v -0.941719 0.303009 -0.101606
+v -0.939030 0.299501 -0.112069
+v -0.948090 0.291392 -0.105249
+v -0.965294 0.305935 -0.071314
+v -0.965162 0.305535 -0.078756
+v -0.972091 0.298701 -0.074351
+v -0.841578 0.340336 -0.055388
+v -0.855921 0.332205 -0.026418
+v -0.841092 0.335478 -0.037826
+v -0.966333 0.309162 -0.055292
+v -0.971457 0.296787 -0.057628
+v -0.974617 0.299676 -0.047939
+v -0.964395 0.302563 -0.012991
+v -0.964069 0.301372 -0.023422
+v -0.972481 0.294499 -0.017808
+v -0.823741 0.295120 -0.027878
+v -0.845382 0.304521 -0.030178
+v -0.858955 0.318845 -0.005538
+v -0.894994 0.318576 0.021116
+v -0.894433 0.305101 0.030385
+v -0.885758 0.293930 0.022748
+v -0.885758 0.289052 0.007662
+v -0.886263 0.302423 -0.002559
+v -0.913524 0.317452 -0.063753
+v -0.912633 0.306951 -0.066372
+v -0.912525 0.306612 -0.081599
+v -0.913386 0.316905 -0.084002
+v -0.914441 0.329638 -0.081483
+v -0.914561 0.329435 -0.070742
+v -0.913656 0.324143 -0.036580
+v -0.912834 0.309725 -0.039758
+v -0.912733 0.308982 -0.052521
+v -0.913596 0.318456 -0.059502
+v -0.914649 0.332728 -0.056741
+v -0.914738 0.333791 -0.042728
+v -0.914316 0.317271 -0.007286
+v -0.914044 0.307026 -0.010625
+v -0.913465 0.303222 -0.023223
+v -0.913992 0.316792 -0.026910
+v -0.914711 0.327140 -0.024733
+v -0.914712 0.327838 -0.012102
+v -0.886880 0.318403 0.003433
+v -0.912130 0.310895 0.015093
+v -0.911569 0.301338 0.023150
+v -0.932726 0.313122 -0.102193
+v -0.929867 0.302823 -0.092941
+v -0.926820 0.290615 -0.099559
+v -0.927820 0.294607 -0.112685
+v -0.930497 0.308568 -0.113339
+v -0.946442 0.308737 -0.063707
+v -0.943737 0.299756 -0.068410
+v -0.943586 0.300252 -0.081565
+v -0.946229 0.308221 -0.083956
+v -0.949484 0.315907 -0.080187
+v -0.949557 0.316457 -0.070672
+v -0.951971 0.315692 -0.036535
+v -0.948652 0.304082 -0.039728
+v -0.948436 0.302545 -0.052486
+v -0.950943 0.310100 -0.059457
+v -0.954463 0.318716 -0.056666
+v -0.954722 0.319748 -0.042654
+v -0.945088 0.308805 -0.006500
+v -0.942883 0.298888 -0.010096
+v -0.941854 0.297813 -0.023194
+v -0.944675 0.308346 -0.027607
+v -0.950759 0.313296 -0.025232
+v -0.950878 0.314901 -0.011651
+v -0.947581 0.294064 -0.093913
+v -0.942713 0.283864 -0.099862
+v -0.944323 0.287197 -0.111653
+v -0.968595 0.297354 -0.065851
+v -0.965195 0.291030 -0.069455
+v -0.965094 0.291297 -0.079823
+v -0.968368 0.296990 -0.081691
+v -0.973236 0.301254 -0.038216
+v -0.970486 0.293645 -0.040931
+v -0.970058 0.292405 -0.051736
+v -0.966710 0.309976 -0.043425
+v -0.967491 0.295527 -0.008501
+v -0.964053 0.287824 -0.011341
+v -0.963219 0.287433 -0.022121
+v -0.967031 0.295062 -0.025569
+v -0.212542 0.057791 -0.088298
+v -0.211862 0.060508 0.009634
+v -0.074976 0.068439 -0.157155
+v -0.162552 0.066391 -0.134785
+v -0.081050 0.033861 0.115662
+v -0.160633 0.047774 0.063700
+v -0.194459 -0.061973 -0.077289
+v -0.193830 -0.059312 0.010272
+v -0.073683 -0.054174 -0.145085
+v -0.154612 -0.059717 -0.122697
+v -0.079296 -0.078306 0.096437
+v -0.152838 -0.064359 0.064297
+v -0.207251 -0.185366 -0.080232
+v -0.206587 -0.182710 0.006394
+v -0.073030 -0.183652 -0.163583
+v -0.158477 -0.187001 -0.140772
+v -0.078957 -0.186118 0.087508
+v -0.156604 -0.188284 0.058716
+v -0.218249 -0.319549 -0.070898
+v -0.217576 -0.316931 0.008457
+v -0.078096 -0.336320 -0.156648
+v -0.163948 -0.323822 -0.126342
+v -0.084106 -0.327601 0.074255
+v -0.162049 -0.325183 0.058479
+v -0.230857 -0.433306 -0.066731
+v -0.230120 -0.430637 0.005062
+v -0.083867 -0.441582 -0.135759
+v -0.164983 -0.437718 -0.116889
+v -0.162904 -0.439271 0.050326
+v -0.090446 -0.441802 0.064600
+v -0.232151 -0.553788 -0.054626
+v -0.222780 -0.553256 0.008807
+v -0.030897 -0.438307 -0.119357
+v -0.048588 -0.553257 -0.101597
+v -0.113091 -0.554776 -0.114688
+v -0.182853 -0.554391 -0.102225
+v -0.101931 -0.553988 0.053602
+v -0.030840 -0.553254 0.020694
+v -0.017902 -0.429087 0.007909
+v -0.164568 -0.553797 0.048133
+v -0.004402 -0.430298 -0.042374
+v -0.015348 -0.553254 -0.044763
+v -0.214362 -0.670689 -0.045876
+v -0.206550 -0.670152 0.018721
+v -0.062418 -0.670163 -0.093709
+v -0.115103 -0.671683 -0.107040
+v -0.173263 -0.671297 -0.094348
+v -0.105799 -0.670879 0.064337
+v -0.046932 -0.670148 0.030825
+v -0.158019 -0.670688 0.058767
+v -0.034017 -0.670154 -0.035833
+v -0.205520 -0.790744 -0.044596
+v -0.198330 -0.790216 0.018314
+v -0.065695 -0.790211 -0.091181
+v -0.114178 -0.791730 -0.104164
+v -0.167699 -0.791346 -0.091803
+v -0.105616 -0.790949 0.062739
+v -0.052721 -0.790214 0.030102
+v -0.153670 -0.790758 0.057315
+v -0.041396 -0.790211 -0.034815
+v -0.189550 -0.909826 -0.048240
+v -0.183215 -0.909319 0.010603
+v -0.066346 -0.909277 -0.091813
+v -0.109066 -0.910791 -0.103956
+v -0.156225 -0.910411 -0.092394
+v -0.101522 -0.910068 0.052156
+v -0.058959 -0.909321 0.021629
+v -0.143864 -0.909875 0.047083
+v -0.044935 -0.909296 -0.039091
+v -0.189550 -1.019634 -0.049842
+v -0.183215 -1.019136 0.007524
+v -0.066346 -1.019080 -0.092321
+v -0.109066 -1.020592 -0.104159
+v -0.156225 -1.020214 -0.092888
+v -0.101522 -1.019890 0.048035
+v -0.058959 -1.019139 0.018274
+v -0.143864 -1.019696 0.043088
+v -0.044935 -1.019106 -0.040923
+v -0.187683 -1.124102 -0.060565
+v -0.173184 -1.123543 0.008080
+v -0.066346 -1.123548 -0.103045
+v -0.109066 -1.125059 -0.114883
+v -0.156225 -1.124681 -0.103611
+v -0.102543 -1.124298 0.048591
+v -0.063187 -1.123546 0.018830
+v -0.142420 -1.124104 0.043644
+v -0.048874 -1.123573 -0.051647
+v -0.187587 -1.214756 -0.059215
+v -0.176789 -1.187160 0.027773
+v -0.066346 -1.211538 -0.102576
+v -0.109066 -1.213050 -0.114414
+v -0.156225 -1.215113 -0.103130
+v -0.101522 -1.161543 0.182298
+v -0.101522 -1.215162 0.182584
+v -0.065622 -1.209567 0.152797
+v -0.065622 -1.176706 0.152622
+v -0.143864 -1.161349 0.177352
+v -0.143864 -1.214969 0.177638
+v -0.172507 -1.176703 0.141872
+v -0.172507 -1.217876 0.142092
+v -0.048874 -1.214235 -0.051164
+v -0.061340 -1.187217 0.028251
+v -0.101522 -1.129409 0.075410
+v -0.060438 -1.139723 0.075530
+v -0.060438 -1.215808 0.088571
+v -0.101522 -1.223975 0.088549
+v -0.096105 -1.203909 0.025452
+v -0.143864 -1.129189 0.075425
+v -0.143864 -1.223755 0.088564
+v -0.142420 -1.203690 0.025231
+v -0.177691 -1.139663 0.075534
+v -0.177691 -1.215747 0.088575
+v -0.152430 -1.224410 -0.061332
+v -0.106418 -1.224701 -0.060935
+v -0.019006 0.497120 0.072960
+v -0.037052 0.575812 0.070753
+v -0.028603 0.575952 0.074675
+usemtl mike.jpg
+f 114 115 116
+f 125 126 127
+f 114 119 115
+f 191 197 198
+f 235 223 222
+f 236 237 238
+f 239 227 240
+f 241 233 235
+f 237 234 242
+f 243 244 239
+f 248 249 250
+f 251 250 252
+f 215 203 211
+f 258 259 260
+f 261 262 263
+f 202 194 201
+f 267 268 269
+f 270 271 272
+f 201 245 247
+f 229 215 275
+f 275 230 229
+f 250 249 300
+f 301 250 300
+f 252 250 301
+f 248 250 251
+f 337 271 270
+f 271 336 338
+f 272 271 339
+f 337 336 271
+f 339 271 338
+f 333 268 335
+f 268 332 334
+f 269 268 334
+f 335 268 267
+f 333 332 268
+f 329 262 261
+f 328 330 262
+f 263 262 331
+f 329 328 262
+f 331 262 330
+f 259 325 326
+f 327 259 326
+f 260 259 327
+f 258 325 259
+f 439 463 442
+f 465 83 81
+f 79 465 81
+f 62 467 65
+f 65 467 67
+f 61 85 466
+f 558 559 560
+f 569 570 571
+f 558 560 562
+f 628 635 636
+f 673 662 661
+f 674 675 676
+f 677 678 665
+f 679 673 671
+f 676 680 672
+f 681 677 682
+f 686 687 688
+f 689 690 687
+f 654 649 640
+f 696 697 698
+f 699 700 701
+f 641 639 632
+f 705 706 707
+f 708 709 710
+f 639 684 683
+f 667 713 654
+f 713 667 670
+f 687 738 688
+f 739 738 687
+f 690 739 687
+f 686 689 687
+f 774 708 710
+f 710 776 775
+f 709 777 710
+f 774 710 775
+f 777 776 710
+f 770 773 707
+f 707 772 771
+f 706 772 707
+f 773 705 707
+f 770 707 771
+f 766 699 701
+f 767 701 768
+f 700 769 701
+f 766 701 767
+f 769 768 701
+f 698 764 763
+f 765 764 698
+f 697 765 698
+f 696 698 763
+f 367 374 798
+f 800 378 369
+f 865 869 890
+f 892 526 528
+f 524 526 892
+f 508 510 893
+f 510 512 893
+f 505 894 529
+f 370 369 378
+f 367 366 374
+f 42 41 60
+f 86 42 60
+f 59 86 60
+f 61 64 42
+f 61 42 86
+f 61 86 85
+f 273 274 226
+f 245 273 226
+f 245 226 225
+f 266 265 216
+f 266 216 215
+f 229 266 215
+f 60 41 495
+f 60 495 530
+f 60 530 504
+f 495 506 505
+f 530 495 505
+f 529 530 505
+f 666 712 711
+f 666 711 683
+f 663 666 683
+f 653 704 703
+f 654 653 703
+f 654 703 667
+f 798 374 804
+f 374 810 804
+f 374 392 818
+f 374 818 810
+f 392 378 816
+f 392 816 818
+f 800 807 816
+f 800 816 378
+f 566 555 556
+f 566 556 557
+f 120 111 123
+f 111 110 123
+f 555 548 550
+f 555 550 556
+f 548 500 502
+f 548 502 550
+f 502 500 55
+f 500 52 55
+f 56 55 51
+f 55 52 51
+f 51 104 56
+f 104 105 56
+f 104 111 105
+f 111 112 105
+f 529 894 515
+f 894 514 515
+f 893 512 514
+f 893 514 894
+f 508 893 505
+f 893 894 505
+f 489 524 488
+f 524 892 488
+f 488 892 528
+f 488 528 487
+f 889 877 876
+f 889 876 888
+f 886 875 877
+f 886 877 889
+f 888 876 885
+f 876 874 885
+f 883 871 875
+f 883 875 886
+f 885 874 880
+f 874 870 880
+f 882 872 883
+f 872 871 883
+f 881 873 882
+f 873 872 882
+f 880 870 873
+f 880 873 881
+f 891 878 884
+f 878 879 884
+f 868 867 891
+f 867 878 891
+f 887 890 891
+f 887 891 884
+f 866 865 887
+f 865 890 887
+f 890 869 891
+f 869 868 891
+f 866 889 888
+f 866 888 857
+f 887 886 889
+f 887 889 866
+f 857 888 863
+f 888 885 863
+f 884 883 887
+f 883 886 887
+f 863 885 861
+f 885 880 861
+f 879 882 884
+f 882 883 884
+f 862 881 879
+f 881 882 879
+f 861 880 881
+f 861 881 862
+f 862 879 864
+f 879 878 864
+f 864 878 867
+f 864 867 858
+f 876 877 875
+f 876 875 874
+f 874 875 870
+f 875 871 870
+f 870 871 873
+f 871 872 873
+f 860 869 865
+f 860 865 856
+f 859 868 860
+f 868 869 860
+f 858 867 859
+f 867 868 859
+f 856 865 866
+f 856 866 857
+f 853 862 855
+f 862 864 855
+f 855 864 849
+f 864 858 849
+f 848 857 854
+f 857 863 854
+f 854 863 852
+f 863 861 852
+f 852 861 862
+f 852 862 853
+f 851 860 856
+f 851 856 847
+f 850 859 860
+f 850 860 851
+f 849 858 850
+f 858 859 850
+f 847 856 857
+f 847 857 848
+f 844 853 846
+f 853 855 846
+f 846 855 840
+f 855 849 840
+f 839 848 854
+f 839 854 845
+f 845 854 843
+f 854 852 843
+f 843 852 844
+f 852 853 844
+f 842 851 847
+f 842 847 838
+f 841 850 851
+f 841 851 842
+f 840 849 841
+f 849 850 841
+f 838 847 848
+f 838 848 839
+f 835 844 837
+f 844 846 837
+f 837 846 831
+f 846 840 831
+f 830 839 836
+f 839 845 836
+f 836 845 834
+f 845 843 834
+f 834 843 835
+f 843 844 835
+f 833 842 838
+f 833 838 829
+f 832 841 842
+f 832 842 833
+f 831 840 832
+f 840 841 832
+f 829 838 839
+f 829 839 830
+f 826 835 837
+f 826 837 828
+f 828 837 822
+f 837 831 822
+f 821 830 827
+f 830 836 827
+f 827 836 825
+f 836 834 825
+f 825 834 835
+f 825 835 826
+f 824 833 829
+f 824 829 820
+f 823 832 833
+f 823 833 824
+f 822 831 823
+f 831 832 823
+f 820 829 821
+f 829 830 821
+f 815 826 828
+f 815 828 819
+f 819 828 811
+f 828 822 811
+f 809 821 817
+f 821 827 817
+f 817 827 814
+f 827 825 814
+f 814 825 826
+f 814 826 815
+f 813 824 820
+f 813 820 808
+f 812 823 824
+f 812 824 813
+f 811 822 812
+f 822 823 812
+f 808 820 809
+f 820 821 809
+f 810 818 819
+f 810 819 811
+f 818 816 819
+f 816 815 819
+f 803 809 806
+f 809 817 806
+f 806 817 814
+f 806 814 807
+f 807 814 815
+f 807 815 816
+f 805 813 802
+f 813 808 802
+f 804 812 805
+f 812 813 805
+f 810 811 804
+f 811 812 804
+f 802 808 803
+f 808 809 803
+f 797 803 801
+f 803 806 801
+f 801 806 807
+f 801 807 800
+f 799 805 796
+f 805 802 796
+f 798 804 805
+f 798 805 799
+f 796 802 803
+f 796 803 797
+f 791 797 795
+f 797 801 795
+f 795 801 800
+f 795 800 794
+f 794 800 369
+f 794 369 361
+f 793 799 790
+f 799 796 790
+f 792 798 793
+f 798 799 793
+f 359 367 792
+f 367 798 792
+f 790 796 791
+f 796 797 791
+f 785 791 789
+f 791 795 789
+f 789 795 788
+f 795 794 788
+f 788 794 353
+f 794 361 353
+f 787 793 790
+f 787 790 784
+f 786 792 787
+f 792 793 787
+f 351 359 786
+f 359 792 786
+f 784 790 791
+f 784 791 785
+f 779 785 783
+f 785 789 783
+f 783 789 782
+f 789 788 782
+f 782 788 345
+f 788 353 345
+f 781 787 778
+f 787 784 778
+f 780 786 781
+f 786 787 781
+f 343 351 780
+f 351 786 780
+f 778 784 779
+f 784 785 779
+f 588 779 783
+f 588 783 592
+f 592 783 591
+f 783 782 591
+f 591 782 152
+f 782 345 152
+f 590 781 587
+f 781 778 587
+f 589 780 590
+f 780 781 590
+f 150 343 589
+f 343 780 589
+f 587 778 588
+f 778 779 588
+f 762 708 757
+f 708 774 757
+f 761 709 708
+f 761 708 762
+f 760 777 709
+f 760 709 761
+f 759 776 777
+f 759 777 760
+f 758 775 776
+f 758 776 759
+f 757 774 758
+f 774 775 758
+f 756 773 751
+f 773 770 751
+f 755 705 773
+f 755 773 756
+f 754 706 705
+f 754 705 755
+f 753 772 706
+f 753 706 754
+f 752 771 753
+f 771 772 753
+f 751 770 752
+f 770 771 752
+f 750 699 745
+f 699 766 745
+f 749 700 699
+f 749 699 750
+f 748 769 700
+f 748 700 749
+f 747 768 769
+f 747 769 748
+f 746 767 768
+f 746 768 747
+f 745 766 746
+f 766 767 746
+f 744 697 696
+f 744 696 740
+f 743 765 697
+f 743 697 744
+f 742 764 765
+f 742 765 743
+f 741 763 742
+f 763 764 742
+f 740 696 741
+f 696 763 741
+f 736 762 757
+f 736 757 731
+f 735 761 762
+f 735 762 736
+f 734 760 735
+f 760 761 735
+f 733 759 760
+f 733 760 734
+f 732 758 759
+f 732 759 733
+f 731 757 732
+f 757 758 732
+f 730 756 725
+f 756 751 725
+f 729 755 756
+f 729 756 730
+f 728 754 755
+f 728 755 729
+f 727 753 754
+f 727 754 728
+f 726 752 727
+f 752 753 727
+f 725 751 726
+f 751 752 726
+f 724 750 719
+f 750 745 719
+f 723 749 724
+f 749 750 724
+f 722 748 749
+f 722 749 723
+f 721 747 748
+f 721 748 722
+f 720 746 721
+f 746 747 721
+f 719 745 720
+f 745 746 720
+f 692 744 693
+f 744 740 693
+f 691 743 744
+f 691 744 692
+f 695 742 743
+f 695 743 691
+f 694 741 695
+f 741 742 695
+f 693 740 694
+f 740 741 694
+f 717 689 718
+f 689 686 718
+f 716 690 717
+f 690 689 717
+f 715 739 690
+f 715 690 716
+f 714 738 739
+f 714 739 715
+f 737 688 714
+f 688 738 714
+f 718 686 688
+f 718 688 737
+f 737 713 718
+f 713 670 718
+f 737 714 650
+f 737 650 713
+f 654 713 649
+f 713 650 649
+f 668 736 731
+f 668 731 669
+f 682 735 668
+f 735 736 668
+f 677 734 735
+f 677 735 682
+f 665 733 734
+f 665 734 677
+f 664 732 665
+f 732 733 665
+f 669 731 732
+f 669 732 664
+f 681 730 725
+f 681 725 677
+f 680 729 730
+f 680 730 681
+f 676 728 729
+f 676 729 680
+f 675 727 728
+f 675 728 676
+f 678 726 727
+f 678 727 675
+f 677 725 726
+f 677 726 678
+f 672 724 676
+f 724 719 676
+f 671 723 672
+f 723 724 672
+f 673 722 671
+f 722 723 671
+f 661 721 673
+f 721 722 673
+f 674 720 721
+f 674 721 661
+f 676 719 720
+f 676 720 674
+f 663 717 718
+f 663 718 670
+f ...
[truncated message content] |
|
From: <tre...@us...> - 2007-10-07 18:45:14
|
Revision: 486
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=486&view=rev
Author: trevorolio
Date: 2007-10-07 11:45:19 -0700 (Sun, 07 Oct 2007)
Log Message:
-----------
Added a bunch of face morphs to the Mike avatar.
Added a handy createMorph.sh script to make this process less painful.
Tweaked the body editor to show more morph controls.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/MorphDeltaMap.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/MorphDeltaMap.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/MorphDeltaMap.java 2007-10-07 18:45:16 UTC (rev 485)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/MorphDeltaMap.java 2007-10-07 18:45:19 UTC (rev 486)
@@ -89,9 +89,9 @@
public String toString() {
StringBuffer result = new StringBuffer();
result.append("# MorphDeltaMap\n");
- result.append("name: " + name + "\n\n");
+ result.append("name: " + name + "\n");
if (parentName != null) {
- result.append("parent: " + parentName + "\n\n");
+ result.append("parent: " + parentName + "\n");
}
Range[] ranges = getRanges();
for (int i = 0; i < ranges.length; i++) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-07 18:45:14
|
Revision: 485
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=485&view=rev
Author: trevorolio
Date: 2007-10-07 11:45:16 -0700 (Sun, 07 Oct 2007)
Log Message:
-----------
Added a bunch of face morphs to the Mike avatar.
Added a handy createMorph.sh script to make this process less painful.
Tweaked the body editor to show more morph controls.
Modified Paths:
--------------
maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
Modified: maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
===================================================================
--- maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-07 00:23:19 UTC (rev 484)
+++ maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-07 18:45:16 UTC (rev 485)
@@ -216,14 +216,14 @@
}
private class MorphListPanel extends Panel implements ActionListener {
- Dimension dimension = new Dimension(150, 300);
+ Dimension dimension = new Dimension(150, 565);
Button saveButton = new Button("Save");
public MorphListPanel() {
setPreferredSize(dimension);
setMinimumSize(dimension);
- setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
+ setLayout(new FlowLayout(FlowLayout.CENTER, 0, 1));
setBackground(Color.WHITE);
}
@@ -263,7 +263,7 @@
float buttonStep = 0.1f;
- Dimension dimension = new Dimension(150, 65);
+ Dimension dimension = new Dimension(150, 50);
MorphDeltaMap morphDeltaMap = null;
@@ -338,7 +338,7 @@
}
private class BodyPickerPanel extends Panel implements ActionListener {
- Dimension dimension = new Dimension(150, 75);
+ Dimension dimension = new Dimension(150, 35);
JComboBox bodyComboBox = null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ian...@us...> - 2007-10-07 00:23:16
|
Revision: 484
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=484&view=rev
Author: iansmith
Date: 2007-10-06 17:23:19 -0700 (Sat, 06 Oct 2007)
Log Message:
-----------
After feeling guilty about the build situations, I've added at least a bandage.
There is a new mojo connected to ogoglio-server's build process that verifies that your server.xml is complete with respect to the context.xml in the server's war. It will print out various helpful messages if it sees your configuration is wrong. This means that the context.xml in a war is *the law* and that we will refuse to build (much less run) on a development machine that is incorrectly configured in terms of server.xml in the tomcat dir.
You need to add <tomcat.home> to your settings.xml--but I have improved the error messages so at least it will tell you if you don't have it.
Updated the wiki.
Modified Paths:
--------------
maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/AbstractResourceServlet.java
maven/trunk/ogoglio-server/pom.xml
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java
Added Paths:
-----------
maven/trunk/dev-plugins/src/main/java/com/ogoglio/plugin/VerifyEnvironmentMojo.java
Added: maven/trunk/dev-plugins/src/main/java/com/ogoglio/plugin/VerifyEnvironmentMojo.java
===================================================================
--- maven/trunk/dev-plugins/src/main/java/com/ogoglio/plugin/VerifyEnvironmentMojo.java (rev 0)
+++ maven/trunk/dev-plugins/src/main/java/com/ogoglio/plugin/VerifyEnvironmentMojo.java 2007-10-07 00:23:19 UTC (rev 484)
@@ -0,0 +1,167 @@
+package com.ogoglio.plugin;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import nanoxml.XMLElement;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * @goal verifyEnvironment
+ */
+public class VerifyEnvironmentMojo extends AbstractMojo {
+ private static final String RESOURCE_MSG = "Typically, <Resource> configurations look like this:\n" + "<Resource name=\"UserDatabase\" auth=\"Container\"" + "\ttype=\"org.apache.catalina.UserDatabase\"\n" + "\tdescription=\"User database that can be updated and saved (for the manager appl.)\"\n" + "\tfactory=\"org.apache.catalina.users.MemoryUserDatabaseFactory\"\n"
+ + "\tpathname=\"conf/tomcat-users.xml\" />\n" + "<Resource name=\"ogoglioDB\" scope=\"Shareable\"\n" + "\ttype=\"javax.sql.DataSource\" auth='Container'\n" + "\tfactory=\"org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory\"\n" + "\turl=\"jdbc:mysql://127.0.0.1/og\"\n" + "\tdriverClassName=\"com.mysql.jdbc.Driver\"\n" + "\tusername=\"oguser\n" + "\tpassword=\"sssh\"\n"
+ + "\tdialect=\"org.hibernate.dialect.MySQLDialect\"\n" + "\tshow_sql=\"false\"\n" + "\tmaxIdle=\"5\"\n" + "\tmaxActive=\"50\"/>";
+
+
+ private static final String[] MAJOR_RESOURCES = {
+ "ogoglioDB",
+ "UserDatabase"
+ };
+ /**
+ * @parameter
+ */
+ protected File contextFile;
+
+ /**
+ * @parameter
+ */
+ protected File tomcatDir;
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+
+ verifyNotNull(tomcatDir, "tomcat.home");
+
+ fileOkForReading(contextFile);
+ if ((!tomcatDir.isDirectory()) || (!tomcatDir.canRead())) {
+ throw new MojoExecutionException("Can't read tomcat directory:" + tomcatDir);
+ }
+ File serverFile = new File(new File(tomcatDir, "conf"), "server.xml");
+ fileOkForReading(serverFile);
+
+ getLog().info("Verifying project context variables against server.xml config in tomcat.");
+
+ try {
+ XMLElement serverRoot = new XMLElement();
+ serverRoot.parseFromReader(new FileReader(serverFile));
+
+ XMLElement contextRoot = new XMLElement();
+ contextRoot.parseFromReader(new FileReader(contextFile));
+
+ checkContextAgainstServer(contextRoot, serverRoot);
+ } catch (IOException e) {
+ throw new MojoExecutionException("Can't read in the server or context files!", e);
+ }
+ }
+
+ private void checkContextAgainstServer(XMLElement contextRoot, XMLElement serverRoot) throws MojoExecutionException, MojoFailureException {
+ Map<String, String> resourceLinkMap;
+
+ resourceLinkMap = computeExpectedLinks(contextRoot);
+ List<String> badLinks = findMissingLinks(serverRoot, resourceLinkMap);
+ if (badLinks.size() != 0) {
+ getLog().error("Bad tomcat config file server.xml. You seem to be missing:");
+ Iterator<String> it = badLinks.iterator();
+ while (it.hasNext()) {
+ String missingGlobal = it.next();
+ getLog().error("<Environment name=\"" + missingGlobal + "\" value=\"someValue\" type=\"java.lang.String\"/>");
+ }
+ throw new MojoFailureException("Failed to verify that server.xml and context.xml are in sync!");
+ }
+ }
+
+ private List<String> findMissingLinks(XMLElement serverRoot, Map<String, String> resourceLinkMap) throws MojoExecutionException, MojoFailureException {
+ ArrayList<String> result = new ArrayList<String>();
+ List<String> areDefined=new ArrayList<String>();
+
+ XMLElement global = getChildElementSafe(serverRoot, "GlobalNamingResources");
+ XMLElement[] resource = global.getChildren("Resource");
+ if (resource.length != MAJOR_RESOURCES.length ) {
+ throw new MojoFailureException("You don't have the resource tags for the user database and the mysql database!" + RESOURCE_MSG);
+ } else {
+ for (int i=0; i<resource.length;++i) {
+ areDefined.add(resource[i].getStringAttribute("name"));
+ }
+ for (int i=0; i<MAJOR_RESOURCES.length;++i){
+ if (!areDefined.contains(MAJOR_RESOURCES[i])) {
+ throw new MojoFailureException("You are missing resource "+MAJOR_RESOURCES[i]+"."+RESOURCE_MSG);
+ }
+ }
+ }
+
+ XMLElement[] env = global.getChildren("Environment");
+ for (int i=0; i<env.length;++i) {
+ areDefined.add(env[i].getStringAttribute("name",""));
+ }
+
+ Iterator<String> it = resourceLinkMap.keySet().iterator();
+ while (it.hasNext()) {
+ String target = it.next();
+ if (!areDefined.contains(target)) {
+ result.add(target);
+ }
+ }
+ return result;
+
+ }
+
+ private Map<String,String> computeExpectedLinks(XMLElement contextRoot) throws MojoExecutionException {
+ Map<String,String> result=new HashMap<String,String>();
+
+ XMLElement[] link=contextRoot.getChildren("ResourceLink");
+ if (link.length==0) {
+ throw new MojoExecutionException("Can't find any resource links inside context element! Normally, they look like this: <ResourceLink name=\"ogoglio/mediaURL\" global=\"mediaURL\" type=\"java.lang.String\"/>");
+ }
+
+ for (int i=0; i<link.length;++i) {
+ if (link[i].getAttribute("name")==null) {
+ throw new MojoExecutionException("Badly formed resource link inside context element:"+link[i].toString()+". Normally, they look like this: <ResourceLink name=\"ogoglio/mediaURL\" global=\"mediaURL\" type=\"java.lang.String\"/>");
+ }
+ if (link[i].getAttribute("global")==null) {
+ throw new MojoExecutionException("Badly formed resource link inside context element:"+link[i].toString()+". Normally, they look like this: <ResourceLink name=\"ogoglio/mediaURL\" global=\"mediaURL\" type=\"java.lang.String\"/>");
+ }
+ if (link[i].getAttribute("type")==null) {
+ throw new MojoExecutionException("Badly formed resource link inside context element:"+link[i].toString()+". Normally, they look like this: <ResourceLink name=\"ogoglio/mediaURL\" global=\"mediaURL\" type=\"java.lang.String\"/>");
+ }
+ String name=(String)link[i].getAttribute("name");
+ String global=(String)link[i].getAttribute("global");
+ String type=(String)link[i].getAttribute("type");
+ if ((!("java.lang.String".equals(type))) && (!("javax.sql.DataSource".equals(type)))) {
+ throw new MojoExecutionException("We don't understand that resource link inside context element:"+link[i].toString()+". Normally, they look like this: <ResourceLink name=\"ogoglio/mediaURL\" global=\"mediaURL\" type=\"java.lang.String\"/>");
+ }
+ result.put(global, name);
+ }
+ return result;
+ }
+
+ private XMLElement getChildElementSafe(XMLElement contextRoot, String childName) throws MojoExecutionException {
+ XMLElement context = contextRoot.getChild(childName);
+ if (context == null) {
+ throw new MojoExecutionException("No \""+childName+"\" element found!");
+ }
+ return context;
+ }
+
+ private void fileOkForReading(File f) throws MojoExecutionException {
+ if ((!f.exists()) || (!f.canRead())) {
+ throw new MojoExecutionException("Can't read context file:" + contextFile);
+ }
+ }
+
+ public void verifyNotNull(File f, String var) throws MojoExecutionException {
+ if (f == null) {
+ throw new MojoExecutionException("You probably need to set your " + var + " in your settings.xml");
+ }
+ }
+}
Modified: maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/AbstractResourceServlet.java
===================================================================
--- maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/AbstractResourceServlet.java 2007-10-06 03:11:44 UTC (rev 483)
+++ maven/trunk/ogoglio-appdev/src/main/java/com/ogoglio/appdev/servlet/AbstractResourceServlet.java 2007-10-07 00:23:19 UTC (rev 484)
@@ -137,6 +137,13 @@
String[] pathElements = getPathElements((String) baseResource.getPathElement(), requestURI);
+ if (pathElements==null) {
+ Log.error("Can't understand path elements in "+getClass().getCanonicalName()+"! "+requestURI);
+ Log.error(" baseResource for errant service() is "+baseResource.getClass().getCanonicalName());
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return;
+ }
+
SiteResource requestedResource = getSiteResource(pathElements, baseResource);
if (requestedResource == null) {
Modified: maven/trunk/ogoglio-server/pom.xml
===================================================================
--- maven/trunk/ogoglio-server/pom.xml 2007-10-06 03:11:44 UTC (rev 483)
+++ maven/trunk/ogoglio-server/pom.xml 2007-10-07 00:23:19 UTC (rev 484)
@@ -204,6 +204,8 @@
</populateDir>
<reverseFile>/tmp/reverse.xml</reverseFile>
<goalPrefix>og</goalPrefix>
+ <contextFile>${basedir}/src/main/webapp/META-INF/context.xml</contextFile>
+ <tomcatDir>${tomcat.home}</tomcatDir>
</configuration>
@@ -223,6 +225,13 @@
</targetDirectory>
</configuration>
</execution>
+ <execution>
+ <phase>process-resources</phase>
+ <id>verifyXMLProperties</id>
+ <goals>
+ <goal>verifyEnvironment</goal>
+ </goals>
+ </execution>
</executions>
</plugin>
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java 2007-10-06 03:11:44 UTC (rev 483)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java 2007-10-07 00:23:19 UTC (rev 484)
@@ -90,7 +90,7 @@
return new BaseSpaceResource();
} else {
Log.info("Turning off space servlet, this host doesn't want it.");
- return new Four04SiteResource("account");
+ return new Four04SiteResource("space");
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-06 03:11:40
|
Revision: 483
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=483&view=rev
Author: trevorolio
Date: 2007-10-05 20:11:44 -0700 (Fri, 05 Oct 2007)
Log Message:
-----------
Added a spin behavior to the body editor so we can see all glorious sides of Mike and Alien Andrea.
Tweaked a sim debug message which was bothering me.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java 2007-10-06 03:11:42 UTC (rev 482)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java 2007-10-06 03:11:44 UTC (rev 483)
@@ -282,7 +282,7 @@
simulator = new SpaceSimulator(spaceDoc, spaceSimulatorListener);
spaceSimulators.put(new Long(record.getSpaceID()), simulator);
simulator.startSim();
- Log.info("Starting space sim " + record.getSpaceID() + ": " + record.getDisplayName() + "( on sim " + record.getSimID() + ")");
+ Log.info("Starting space " + record.getSpaceID() + " on sim " + record.getSimID() + ": " + record.getDisplayName());
return simulator;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-06 03:11:40
|
Revision: 482
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=482&view=rev
Author: trevorolio
Date: 2007-10-05 20:11:42 -0700 (Fri, 05 Oct 2007)
Log Message:
-----------
Added a spin behavior to the body editor so we can see all glorious sides of Mike and Alien Andrea.
Tweaked a sim debug message which was bothering me.
Modified Paths:
--------------
maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
Modified: maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
===================================================================
--- maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-05 02:59:47 UTC (rev 481)
+++ maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-06 03:11:42 UTC (rev 482)
@@ -72,6 +72,7 @@
import com.ogoglio.xml.AccountDocument;
import com.ogoglio.xml.BodyConfigurationDocument;
import com.ogoglio.xml.BodyDataDocument;
+import com.sun.j3d.utils.behaviors.mouse.MouseRotate;
public class BodyEditorApplet extends Applet {
@@ -197,6 +198,11 @@
Transform3D userTransform = new Transform3D();
userTransform.rotY(1);
userGroup.setTransform(userTransform);
+ MouseRotate behavior = new MouseRotate();
+ behavior.setFactor(0.05, 0);
+ behavior.setTransformGroup(userGroup);
+ userGroup.addChild(behavior);
+ behavior.setSchedulingBounds(bounds);
canvas.getView().setTransparencySortingPolicy(View.TRANSPARENCY_SORT_GEOMETRY);
canvas.getView().setSceneAntialiasingEnable(true);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-05 02:59:42
|
Revision: 481
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=481&view=rev
Author: trevorolio
Date: 2007-10-04 19:59:47 -0700 (Thu, 04 Oct 2007)
Log Message:
-----------
Added a chooser for the body editor. You'll need to add this to your maven settings.xml:
<ogoglio.bodyDataDisplayNames>Mike,Andrea</ogoglio.bodyDataDisplayNames>
<ogoglio.bodyDataFileNames>ogoglio-body-mike.jar,ogoglio-body-andrea.jar</ogoglio.bodyDataFileNames>
Modified Paths:
--------------
maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
Modified: maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
===================================================================
--- maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-05 02:59:44 UTC (rev 480)
+++ maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-05 02:59:47 UTC (rev 481)
@@ -31,6 +31,7 @@
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.Vector;
import java.util.zip.ZipInputStream;
import javax.media.j3d.AmbientLight;
@@ -43,6 +44,7 @@
import javax.media.j3d.TransformGroup;
import javax.media.j3d.View;
import javax.swing.BoxLayout;
+import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;
@@ -92,7 +94,9 @@
private boolean completedInitialLoad = false;
private J3DDataManager dataManager = null;
-
+
+ private BodyDataDocument[] bodyDataDocuments = null;
+
public BodyEditorApplet() {
setBackground(Color.WHITE);
setLayout(new BorderLayout());
@@ -206,7 +210,7 @@
}
private class MorphListPanel extends Panel implements ActionListener {
- Dimension dimension = new Dimension(150, 400);
+ Dimension dimension = new Dimension(150, 300);
Button saveButton = new Button("Save");
@@ -222,7 +226,7 @@
validate();
MorphDeltaMap[] deltaMaps = bodyPanel.bodyData.getMorphDeltaMaps();
if (deltaMaps.length == 0) {
- add(new Label("No Available Morphs"));
+ add(saveButton);
validate();
return;
}
@@ -327,9 +331,59 @@
}
+ private class BodyPickerPanel extends Panel implements ActionListener {
+ Dimension dimension = new Dimension(150, 75);
+
+ JComboBox bodyComboBox = null;
+
+ public BodyPickerPanel() {
+ setPreferredSize(dimension);
+ setMinimumSize(dimension);
+ setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
+ setBackground(Color.WHITE);
+
+ Vector names = new Vector();
+ int selectedIndex = -1;
+ for (int i = 0; i < bodyDataDocuments.length; i++) {
+ names.add(bodyDataDocuments[i].getDisplayName());
+ if(user.getBodyConfiguration().getBodyDataID() == bodyDataDocuments[i].getBodyDataID()){
+ selectedIndex = i;
+ }
+ }
+ bodyComboBox = new JComboBox(names.toArray());
+ bodyComboBox.setSelectedIndex(selectedIndex);
+ bodyComboBox.setBackground(Color.WHITE);
+ bodyComboBox.addActionListener(this);
+ add(bodyComboBox);
+ }
+
+ public void actionPerformed(ActionEvent event) {
+ if(event.getSource() == bodyComboBox){
+ String bodyName = (String)bodyComboBox.getSelectedItem();
+ if(bodyName == null){
+ return;
+ }
+ for (int i = 0; i < bodyDataDocuments.length; i++) {
+ if(bodyName.equals(bodyDataDocuments[i].getDisplayName())){
+ if(bodyDataDocuments[i].getBodyDataID() == user.getBodyConfiguration().getBodyDataID()){
+ return;
+ }
+ user.getBodyConfiguration().setBodyDataID(bodyDataDocuments[i].getBodyDataID());
+ bodyPanel.bodyData = dataManager.getBodyData(bodyDataDocuments[i].getBodyDataID());
+ bodyPanel.renderable.initBody(bodyPanel.bodyData);
+ westPanel.morphList.initList();
+ eastPanel.animationList.initAnimationList();
+ }
+ }
+ }
+ }
+ }
+
private class WestPanel extends Panel {
Dimension dimension = new Dimension(150, 400);
+ BodyPickerPanel bodyPickerPanel = new BodyPickerPanel();
+
MorphListPanel morphList = new MorphListPanel();
public WestPanel() {
@@ -337,6 +391,7 @@
setMinimumSize(dimension);
setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
setBackground(Color.WHITE);
+ add(bodyPickerPanel);
add(morphList);
}
}
@@ -364,8 +419,8 @@
}
public void actionPerformed(ActionEvent e) {
- if(e.getSource() instanceof Button){
- Button button = (Button)e.getSource();
+ if (e.getSource() instanceof Button) {
+ Button button = (Button) e.getSource();
bodyPanel.renderable.playAnimation(button.getLabel(), false);
}
}
@@ -410,6 +465,8 @@
user = new SpacelessUser(accountDoc.getUsername(), webClient.getDefaultBodyConfiguration(accountDoc.getUsername()));
+ bodyDataDocuments = webClient.getBodyDataDocuments();
+
add(bodyPanel, BorderLayout.CENTER);
westPanel = new WestPanel();
add(westPanel, BorderLayout.WEST);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-05 02:59:39
|
Revision: 480
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=480&view=rev
Author: trevorolio
Date: 2007-10-04 19:59:44 -0700 (Thu, 04 Oct 2007)
Log Message:
-----------
Added a chooser for the body editor. You'll need to add this to your maven settings.xml:
<ogoglio.bodyDataDisplayNames>Mike,Andrea</ogoglio.bodyDataDisplayNames>
<ogoglio.bodyDataFileNames>ogoglio-body-mike.jar,ogoglio-body-andrea.jar</ogoglio.bodyDataFileNames>
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java 2007-10-05 02:59:40 UTC (rev 479)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java 2007-10-05 02:59:44 UTC (rev 480)
@@ -230,6 +230,15 @@
dirty = true;
configRec.setDisplayName(proposedDoc.getDisplayName());
}
+ if(configRec.getBodyDataID() != proposedDoc.getBodyDataID()){
+ Query bodyDataQuery = session.getNamedQuery(BODY_DATA_BY_ID);
+ bodyDataQuery.setLong("bodyDataID", proposedDoc.getBodyDataID());
+ if(bodyDataQuery.uniqueResult() == null){
+ return null;
+ }
+ dirty = true;
+ configRec.setBodyDataID(proposedDoc.getBodyDataID());
+ }
if(dirty){
session.update(configRec);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-05 02:59:37
|
Revision: 479
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=479&view=rev
Author: trevorolio
Date: 2007-10-04 19:59:40 -0700 (Thu, 04 Oct 2007)
Log Message:
-----------
Added a chooser for the body editor. You'll need to add this to your maven settings.xml:
<ogoglio.bodyDataDisplayNames>Mike,Andrea</ogoglio.bodyDataDisplayNames>
<ogoglio.bodyDataFileNames>ogoglio-body-mike.jar,ogoglio-body-andrea.jar</ogoglio.bodyDataFileNames>
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyConfiguration.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java
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-10-04 21:24:13 UTC (rev 478)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java 2007-10-05 02:59:40 UTC (rev 479)
@@ -471,6 +471,17 @@
return new BodyDataDocument(result);
}
+ public BodyDataDocument[] getBodyDataDocuments() throws IOException {
+
+ XMLElement result = wire.fetchAuthenticatedXML(descriptor.getBodiesURI(), authenticator.getAuthCookie());
+ Vector docs = new Vector();
+ Vector children = result.getChildren();
+ for (int i = 0; i < children.size(); i++) {
+ docs.add(new BodyDataDocument((XMLElement)children.get(i)));
+ }
+ return (BodyDataDocument[])docs.toArray(new BodyDataDocument[0]);
+ }
+
public BodyDataDocument getBodyDataDocument(long bodyDataID) throws IOException {
return new BodyDataDocument(wire.fetchAuthenticatedXML(descriptor.getBodyDataDocumentURI(bodyDataID), authenticator.getAuthCookie()));
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyConfiguration.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyConfiguration.java 2007-10-04 21:24:13 UTC (rev 478)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyConfiguration.java 2007-10-05 02:59:40 UTC (rev 479)
@@ -9,24 +9,24 @@
public class BodyConfiguration {
private User user = null;
-
+
private long bodyConfigurationID = -1;
-
+
private String displayName = null;
-
+
private long bodyDataID = -1;
-
+
private HashMap settings = new HashMap();
-
- public BodyConfiguration(BodyConfigurationDocument configDoc){
+
+ public BodyConfiguration(BodyConfigurationDocument configDoc) {
this(configDoc.getBodyConfigurationID(), configDoc.getDisplayName(), configDoc.getBodyDataID());
BodySettingDocument[] settingDocs = configDoc.getBodySettingDocuments();
for (int i = 0; i < settingDocs.length; i++) {
addSetting(settingDocs[i].getSettingName(), settingDocs[i].getSetting());
}
}
-
- public BodyConfiguration(long bodyConfigurationID, String displayName, long bodyDataID){
+
+ public BodyConfiguration(long bodyConfigurationID, String displayName, long bodyDataID) {
ArgumentUtils.assertNotNegative(bodyConfigurationID);
this.bodyConfigurationID = bodyConfigurationID;
ArgumentUtils.assertNotEmpty(displayName);
@@ -35,34 +35,34 @@
this.bodyDataID = bodyDataID;
}
- public void setUser(User user){
+ public void setUser(User user) {
ArgumentUtils.assertNotNull(user);
this.user = user;
}
-
- public void addSetting(String settingName, float setting){
+
+ public void addSetting(String settingName, float setting) {
ArgumentUtils.assertNotEmpty(settingName);
- if(setting < 0){
+ if (setting < 0) {
setting = 0;
}
- if(setting > 1){
+ if (setting > 1) {
setting = 1;
}
settings.put(settingName, new Float(setting));
}
-
- public void removeSetting(String settingName){
+
+ public void removeSetting(String settingName) {
settings.remove(settingName);
}
-
- public float getSetting(String settingName){
- Float setting = (Float)settings.get(settingName);
- if(setting == null){
+
+ public float getSetting(String settingName) {
+ Float setting = (Float) settings.get(settingName);
+ if (setting == null) {
return 0;
}
return setting.floatValue();
}
-
+
public User getUser() {
return user;
}
@@ -79,8 +79,11 @@
return bodyDataID;
}
+ public void setBodyDataID(long bodyDataID) {
+ this.bodyDataID = bodyDataID;
+ }
+
public String[] getSettingNames() {
- return (String[])settings.keySet().toArray(new String[0]);
+ return (String[]) settings.keySet().toArray(new String[0]);
}
-
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java 2007-10-04 21:24:13 UTC (rev 478)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java 2007-10-05 02:59:40 UTC (rev 479)
@@ -86,12 +86,12 @@
setCapabilities(bodyGroup);
transformGroup.addChild(bodyGroup);
- initBody();
+ initBody(bodyData);
}
- private void initBody() {
+ public void initBody(J3DBodyData bodyData) {
bodyGroup.removeAllChildren();
-
+ this.bodyData = bodyData;
skin = new SkinLoader(bodyData, user.getBodyConfiguration()).generateSkin();
userHeight = skin.getHeight();
skinMap = bodyData.getSkinMap();
@@ -267,7 +267,4 @@
animator.animate(loop);
}
- public void setHeight(float newHeight) {
- initBody();
- }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-04 21:24:17
|
Revision: 478
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=478&view=rev
Author: trevorolio
Date: 2007-10-04 14:24:13 -0700 (Thu, 04 Oct 2007)
Log Message:
-----------
At last, in the body editor applet you can change the morph settings and see them reflected in real time. Hit save, and the next time you visit a space the morph settings will be respected.
Modified Paths:
--------------
maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
Modified: maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
===================================================================
--- maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-04 21:24:10 UTC (rev 477)
+++ maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-04 21:24:13 UTC (rev 478)
@@ -15,6 +15,7 @@
import java.applet.Applet;
import java.awt.BorderLayout;
+import java.awt.Button;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
@@ -22,7 +23,10 @@
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
+import java.awt.Label;
import java.awt.Panel;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
@@ -38,6 +42,7 @@
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.media.j3d.View;
+import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;
@@ -54,11 +59,14 @@
import com.ogoglio.client.model.User;
import com.ogoglio.client.model.Space.Context;
import com.ogoglio.util.UIConstants;
+import com.ogoglio.viewer.j3d.J3DBodyData;
import com.ogoglio.viewer.j3d.J3DCamera;
import com.ogoglio.viewer.j3d.J3DCanvas;
import com.ogoglio.viewer.j3d.J3DDataManager;
import com.ogoglio.viewer.j3d.J3DUniverse;
import com.ogoglio.viewer.j3d.J3DUserRenderable;
+import com.ogoglio.viewer.j3d.body.MorphDeltaMap;
+import com.ogoglio.viewer.j3d.bvh.Bvh;
import com.ogoglio.xml.AccountDocument;
import com.ogoglio.xml.BodyConfigurationDocument;
import com.ogoglio.xml.BodyDataDocument;
@@ -124,6 +132,8 @@
J3DUserRenderable renderable = null;
+ private J3DBodyData bodyData = null;
+
public BodyPanel() {
setPreferredSize(dimension);
setMinimumSize(dimension);
@@ -141,8 +151,11 @@
public boolean addUserRenderable() {
try {
- renderable = new J3DUserRenderable(user, dataManager.getBodyData(user.getBodyConfiguration().getBodyDataID()));
+ bodyData = dataManager.getBodyData(user.getBodyConfiguration().getBodyDataID());
+ renderable = new J3DUserRenderable(user, bodyData);
userGroup.addChild(renderable);
+ westPanel.morphList.initList();
+ eastPanel.animationList.initAnimationList();
return true;
} catch (Exception e) {
e.printStackTrace();
@@ -177,6 +190,9 @@
userGroup.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE);
userGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
userGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
+ Transform3D userTransform = new Transform3D();
+ userTransform.rotY(1);
+ userGroup.setTransform(userTransform);
canvas.getView().setTransparencySortingPolicy(View.TRANSPARENCY_SORT_GEOMETRY);
canvas.getView().setSceneAntialiasingEnable(true);
@@ -189,54 +205,183 @@
}
}
- private class WestPanel extends Panel {
- Dimension dimension = new Dimension(150, 300);
+ private class MorphListPanel extends Panel implements ActionListener {
+ Dimension dimension = new Dimension(150, 400);
- public WestPanel() {
+ Button saveButton = new Button("Save");
+
+ public MorphListPanel() {
setPreferredSize(dimension);
setMinimumSize(dimension);
setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
setBackground(Color.WHITE);
+ }
+ void initList() {
+ removeAll();
+ validate();
+ MorphDeltaMap[] deltaMaps = bodyPanel.bodyData.getMorphDeltaMaps();
+ if (deltaMaps.length == 0) {
+ add(new Label("No Available Morphs"));
+ validate();
+ return;
+ }
+ for (int i = deltaMaps.length - 1; i >= 0; i--) {
+ add(new MorphPanel(deltaMaps[i]));
+ validate();
+ }
+
+ saveButton.setBackground(Color.WHITE);
+ saveButton.addActionListener(this);
+ add(saveButton);
+ validate();
}
+
+ public void actionPerformed(ActionEvent event) {
+ if (event.getSource() == saveButton) {
+ try {
+ webClient.updateBodyConfiguration(new BodyConfigurationDocument(user.getBodyConfiguration()));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
- private class TexturePanel extends Panel {
- Dimension dimension = new Dimension(80, 35);
+ private class MorphPanel extends Panel implements ActionListener {
- public TexturePanel() {
+ float buttonStep = 0.1f;
+
+ Dimension dimension = new Dimension(150, 65);
+
+ MorphDeltaMap morphDeltaMap = null;
+
+ Label nameLabel = null;
+
+ Label valueLabel = null;
+
+ Button moreButton = new Button("+");
+
+ Button lessButton = new Button("-");
+
+ public MorphPanel(MorphDeltaMap morphDeltaMap) {
setPreferredSize(dimension);
setMinimumSize(dimension);
+ setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+ setBackground(Color.WHITE);
- setBackground(Color.GRAY);
+ this.morphDeltaMap = morphDeltaMap;
+ nameLabel = new Label(morphDeltaMap.getName() + ":");
+ nameLabel.setBackground(Color.WHITE);
+ add(nameLabel);
+
+ Panel buttonPanel = new Panel();
+ buttonPanel.setBackground(Color.WHITE);
+
+ moreButton.setBackground(Color.WHITE);
+ moreButton.addActionListener(this);
+ buttonPanel.add(moreButton);
+
+ valueLabel = new Label(formatValue(getMorphSetting()));
+ valueLabel.setBackground(Color.WHITE);
+ buttonPanel.add(valueLabel);
+
+ lessButton.setBackground(Color.WHITE);
+ lessButton.addActionListener(this);
+ buttonPanel.add(lessButton);
+
+ add(buttonPanel);
}
+
+ float getMorphSetting() {
+ return user.getBodyConfiguration().getSetting(morphDeltaMap.getName());
+ }
+
+ public void actionPerformed(ActionEvent event) {
+ float setting = -1;
+ if (event.getSource() == moreButton) {
+ setting = getMorphSetting();
+ if (setting >= 1) {
+ return;
+ }
+ setting += buttonStep;
+ } else if (event.getSource() == lessButton) {
+ setting = getMorphSetting();
+ if (setting <= 0) {
+ return;
+ }
+ setting -= buttonStep;
+ }
+ if (setting != -1) {
+ user.getBodyConfiguration().addSetting(morphDeltaMap.getName(), setting);
+ valueLabel.setText(formatValue(getMorphSetting()));
+ bodyPanel.renderable.updateMorphs();
+ }
+ }
+
+ String formatValue(float value) {
+ Object[] args = { new Float(value) };
+ return String.format("%1.1f", args);
+ }
+
}
+ private class WestPanel extends Panel {
+ Dimension dimension = new Dimension(150, 400);
- private class WidthPanel extends Panel {
- Dimension dimension = new Dimension(150, 25);
+ MorphListPanel morphList = new MorphListPanel();
- public WidthPanel() {
+ public WestPanel() {
setPreferredSize(dimension);
setMinimumSize(dimension);
+ setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
+ setBackground(Color.WHITE);
+ add(morphList);
+ }
+ }
- setBackground(Color.GRAY);
+ private class AnimationList extends Panel implements ActionListener {
+ Dimension dimension = new Dimension(150, 400);
+
+ public AnimationList() {
+ setPreferredSize(dimension);
+ setMinimumSize(dimension);
+ setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
+ setBackground(Color.WHITE);
}
+
+ void initAnimationList() {
+ removeAll();
+ validate();
+ Bvh[] animations = bodyPanel.bodyData.getAnimations();
+ for (int i = 0; i < animations.length; i++) {
+ Button button = new Button(animations[i].getName());
+ button.addActionListener(this);
+ add(button);
+ validate();
+ }
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if(e.getSource() instanceof Button){
+ Button button = (Button)e.getSource();
+ bodyPanel.renderable.playAnimation(button.getLabel(), false);
+ }
+ }
}
private class EastPanel extends Panel {
- Dimension dimension = new Dimension(150, 300);
+ Dimension dimension = new Dimension(150, 400);
- TexturePanel texturePanel = new TexturePanel();
+ AnimationList animationList = new AnimationList();
- WidthPanel widthPanel = new WidthPanel();
-
public EastPanel() {
setPreferredSize(dimension);
setMinimumSize(dimension);
setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
setBackground(Color.WHITE);
+ add(animationList);
}
}
@@ -312,7 +457,7 @@
return null;
}
}
-
+
private class BodyProvider implements BodyDataProvider {
public ZipInputStream getBodyData(long bodyDataID) {
try {
@@ -328,7 +473,7 @@
}
}
-
+
//TODO make the error panel less ugly
private class ErrorPanel extends Panel {
public ErrorPanel(String errorMessage) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-04 21:24:17
|
Revision: 477
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=477&view=rev
Author: trevorolio
Date: 2007-10-04 14:24:10 -0700 (Thu, 04 Oct 2007)
Log Message:
-----------
At last, in the body editor applet you can change the morph settings and see them reflected in real time. Hit save, and the next time you visit a space the morph settings will be respected.
Modified Paths:
--------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyConfiguration.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skin.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyConfiguration.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyConfiguration.java 2007-10-04 06:30:49 UTC (rev 476)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyConfiguration.java 2007-10-04 21:24:10 UTC (rev 477)
@@ -78,5 +78,9 @@
public long getBodyDataID() {
return bodyDataID;
}
+
+ public String[] getSettingNames() {
+ return (String[])settings.keySet().toArray(new String[0]);
+ }
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java 2007-10-04 06:30:49 UTC (rev 476)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java 2007-10-04 21:24:10 UTC (rev 477)
@@ -41,6 +41,7 @@
this.position = position;
ArgumentUtils.assertNotNull(bodyConfiguration);
this.bodyConfiguration = bodyConfiguration;
+ bodyConfiguration.setUser(this);
}
public void startMotion(SplinePath path) {
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java 2007-10-04 06:30:49 UTC (rev 476)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java 2007-10-04 21:24:10 UTC (rev 477)
@@ -221,6 +221,10 @@
stopAnimation();
}
+ public void updateMorphs(){
+ skin.updateMorphs();
+ }
+
public void repaintSkinTexture() {
skin.updateTexture();
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skin.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skin.java 2007-10-04 06:30:49 UTC (rev 476)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skin.java 2007-10-04 21:24:10 UTC (rev 477)
@@ -15,8 +15,8 @@
package com.ogoglio.viewer.j3d.body;
import java.awt.Graphics;
-import java.awt.Image;
import java.awt.image.BufferedImage;
+import java.util.HashMap;
import java.util.Vector;
import javax.media.j3d.Appearance;
@@ -36,8 +36,9 @@
import javax.vecmath.Point3d;
import javax.vecmath.Point3f;
import javax.vecmath.Vector3d;
+import javax.vecmath.Vector3f;
-import com.ogoglio.util.BodyConstants;
+import com.ogoglio.client.model.BodyConfiguration;
import com.ogoglio.viewer.j3d.body.Skeleton.Bone;
import com.ogoglio.viewer.j3d.smap.SkinMap;
import com.ogoglio.viewer.j3d.smap.SkinMap.Group;
@@ -51,15 +52,23 @@
private Texture texture = null;
- private SkinUpdater skinUpdater = null;
+ private SkinAnimationUpdater skinAnimationUpdater = null;
- public Skin(BufferedImage baseImage) {
+ private SkinMorphUpdater skinMorphUpdater = null;
+
+ private MorphDeltaMap[] morphDeltaMaps;
+
+ private BodyConfiguration bodyConfiguration = null;
+
+ public Skin(BufferedImage baseImage, MorphDeltaMap[] morphDeltaMaps, BodyConfiguration bodyConfiguration) {
setCapability(Skin.ALLOW_APPEARANCE_WRITE);
setCapability(Skin.ALLOW_PICKABLE_READ);
setCapability(Skin.ALLOW_GEOMETRY_READ);
setCapability(Skin.ALLOW_BOUNDS_READ);
this.baseImage = baseImage;
-
+ this.morphDeltaMaps = morphDeltaMaps;
+ this.bodyConfiguration = bodyConfiguration;
+
//I don't really care for any of these formats
// LUMINANCE is nice for a film noir effect
texture = new TextureLoader(baseImage, "RGB5", TextureLoader.BY_REFERENCE, null).getTexture();
@@ -92,17 +101,19 @@
}
public void updateData(ImageComponent2D imageComp, int arg1, int arg2, int arg3, int arg4) {
- if(baseImage == null){
+ if (baseImage == null) {
return;
}
Graphics g = imageComp.getImage().getGraphics();
g.drawImage(baseImage, 0, 0, null);
+
+ //TODO this is where we'd draw on the decals
}
}
public void updateTexture() {
- if(baseImage == null){
+ if (baseImage == null) {
return;
}
ImageComponent2D imageComp = (ImageComponent2D) texture.getImage(0);
@@ -112,17 +123,62 @@
public void setGeometry(Geometry geo) {
super.setGeometry(geo);
PickTool.setCapabilities(this, PickTool.INTERSECT_FULL);
+
+ skinMorphUpdater = new SkinMorphUpdater();
+ skinMorphUpdater.morph();
}
+ public void updateMorphs() {
+ skinMorphUpdater.morph();
+ }
+
+ private class SkinMorphUpdater implements GeometryUpdater {
+
+ HashMap lastMorphValues = new HashMap();
+
+ float[] vertices = null;
+
+ SkinMorphUpdater() {
+ IndexedTriangleArray triArray = (IndexedTriangleArray) getGeometry();
+ vertices = triArray.getCoordRefFloat();
+ }
+
+ public void morph(){
+ ((GeometryArray) getGeometry()).updateData(this);
+ }
+
+ public void updateData(Geometry ignored) {
+ for (int i = 0; i < morphDeltaMaps.length; i++) {
+ float setting = bodyConfiguration.getSetting(morphDeltaMaps[i].getName());
+ if (lastMorphValues.get(morphDeltaMaps[i].getName()) != null) {
+ setting -= ((Float)lastMorphValues.remove(morphDeltaMaps[i].getName())).floatValue();
+ }
+ lastMorphValues.put(morphDeltaMaps[i].getName(), new Float(bodyConfiguration.getSetting(morphDeltaMaps[i].getName())));
+
+ MorphDeltaMap.Range[] ranges = morphDeltaMaps[i].getRanges();
+ for (int r = 0; r < ranges.length; r++) {
+ Vector3f[] deltas = ranges[r].getDeltas();
+ for (int d = 0; d < deltas.length; d++) {
+ int index = (ranges[r].getLower() - 1 + d) * 3;
+ vertices[index] = vertices[index] + (deltas[d].x * setting);
+ vertices[index + 1] = vertices[index + 1] + (deltas[d].y * setting);
+ vertices[index + 2] = vertices[index + 2] + (deltas[d].z * setting);
+ }
+ }
+ }
+ }
+
+ }
+
public void setSkeleton(Skeleton skeleton, SkinMap skinMap) {
- skinUpdater = new SkinUpdater(skeleton, skinMap);
+ skinAnimationUpdater = new SkinAnimationUpdater(skeleton, skinMap);
}
public void pose() {
- skinUpdater.transform();
+ skinAnimationUpdater.transform();
}
- private class SkinUpdater implements GeometryUpdater {
+ private class SkinAnimationUpdater implements GeometryUpdater {
Skeleton skeleton = null;
@@ -150,7 +206,7 @@
float[] coords = null;
- SkinUpdater(Skeleton skeleton, SkinMap skinMap) {
+ SkinAnimationUpdater(Skeleton skeleton, SkinMap skinMap) {
this.skeleton = skeleton;
bones = getBoneArray(skeleton);
groups = new SkinMap.Group[bones.length];
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java 2007-10-04 06:30:49 UTC (rev 476)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java 2007-10-04 21:24:10 UTC (rev 477)
@@ -43,22 +43,6 @@
public Skin generateSkin() {
float[] vertices = geometry.getCoordRefFloat();
- for (int i = 0; i < morphDeltaMaps.length; i++) {
- float setting = bodyConfiguration.getSetting(morphDeltaMaps[i].getName());
- if(setting <= 0.0001){
- continue;
- }
- MorphDeltaMap.Range[] ranges = morphDeltaMaps[i].getRanges();
- for (int r = 0; r < ranges.length; r++) {
- Vector3f[] deltas = ranges[r].getDeltas();
- for (int d = 0; d < deltas.length; d++) {
- int index = (ranges[r].getLower() - 1 + d) * 3;
- vertices[index] = vertices[index] + (deltas[d].x * setting);
- vertices[index + 1] = vertices[index + 1] + (deltas[d].y * setting);
- vertices[index + 2] = vertices[index + 2] + (deltas[d].z * setting);
- }
- }
- }
float maxY = Float.MIN_VALUE;
float minY = Float.MAX_VALUE;
@@ -79,7 +63,7 @@
}
}
- Skin skin = new Skin(baseImage);
+ Skin skin = new Skin(baseImage, morphDeltaMaps, bodyConfiguration);
skin.setGeometry(geometry);
return skin;
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java 2007-10-04 06:30:49 UTC (rev 476)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java 2007-10-04 21:24:10 UTC (rev 477)
@@ -15,6 +15,7 @@
import nanoxml.XMLElement;
+import com.ogoglio.client.model.BodyConfiguration;
import com.ogoglio.util.ArgumentUtils;
public class BodyConfigurationDocument {
@@ -49,6 +50,14 @@
this.data = data;
}
+ public BodyConfigurationDocument(BodyConfiguration bodyConfiguration) {
+ this(bodyConfiguration.getBodyConfigurationID(), bodyConfiguration.getUser().getUsername(), bodyConfiguration.getDisplayName(), bodyConfiguration.getBodyDataID());
+ String[] settingNames = bodyConfiguration.getSettingNames();
+ for (int i = 0; i < settingNames.length; i++) {
+ addBodySetting(settingNames[i], bodyConfiguration.getSetting(settingNames[i]));
+ }
+ }
+
public long getBodyConfigurationID(){
return data.getLongAttribute(BODY_CONFIGURATION_ID);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-04 06:30:45
|
Revision: 476
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=476&view=rev
Author: trevorolio
Date: 2007-10-03 23:30:49 -0700 (Wed, 03 Oct 2007)
Log Message:
-----------
Though there's no UI to set them, body rendering now respects body configuration for morphs.
Modified Paths:
--------------
maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
Modified: maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
===================================================================
--- maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-04 06:30:45 UTC (rev 475)
+++ maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-04 06:30:49 UTC (rev 476)
@@ -39,10 +39,6 @@
import javax.media.j3d.TransformGroup;
import javax.media.j3d.View;
import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JSlider;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
import javax.vecmath.Color3f;
import javax.vecmath.Point3d;
import javax.vecmath.Vector3f;
@@ -51,6 +47,7 @@
import com.ogoglio.client.WebAPIClient;
import com.ogoglio.client.WebAPIClientWire;
import com.ogoglio.client.WebAPIDescriptor;
+import com.ogoglio.client.model.BodyConfiguration;
import com.ogoglio.client.model.BodyDataProvider;
import com.ogoglio.client.model.Space;
import com.ogoglio.client.model.TemplateDataProvider;
@@ -62,8 +59,9 @@
import com.ogoglio.viewer.j3d.J3DDataManager;
import com.ogoglio.viewer.j3d.J3DUniverse;
import com.ogoglio.viewer.j3d.J3DUserRenderable;
-import com.ogoglio.viewer.j3d.body.SkinLoader;
import com.ogoglio.xml.AccountDocument;
+import com.ogoglio.xml.BodyConfigurationDocument;
+import com.ogoglio.xml.BodyDataDocument;
public class BodyEditorApplet extends Applet {
@@ -94,8 +92,8 @@
}
private class SpacelessUser extends User {
- public SpacelessUser(String username) {
- super(new Space(new SpacelessContext(), 1, "Space", "nobody", false, 0), username, new Transform3D());
+ public SpacelessUser(String username, BodyConfigurationDocument bodyConfigDoc) {
+ super(new Space(new SpacelessContext(), 1, "Space", "nobody", false, 0), username, new Transform3D(), new BodyConfiguration(bodyConfigDoc));
}
}
@@ -143,8 +141,7 @@
public boolean addUserRenderable() {
try {
- System.err.println("Trevor needs to fix the body editor");
- renderable = new J3DUserRenderable(user, dataManager.getBodyData("mike"));
+ renderable = new J3DUserRenderable(user, dataManager.getBodyData(user.getBodyConfiguration().getBodyDataID()));
userGroup.addChild(renderable);
return true;
} catch (Exception e) {
@@ -266,7 +263,7 @@
dataManager = new J3DDataManager(true, new TemplateProvider(), new BodyProvider());
- user = new SpacelessUser(accountDoc.getUsername());
+ user = new SpacelessUser(accountDoc.getUsername(), webClient.getDefaultBodyConfiguration(accountDoc.getUsername()));
add(bodyPanel, BorderLayout.CENTER);
westPanel = new WestPanel();
@@ -317,9 +314,10 @@
}
private class BodyProvider implements BodyDataProvider {
- public ZipInputStream getBodyData(String bodyName) {
+ public ZipInputStream getBodyData(long bodyDataID) {
try {
- return webClient.getBodyData(bodyName);
+ BodyDataDocument bodyDataDoc = webClient.getBodyDataDocument(bodyDataID);
+ return webClient.getBodyData(bodyDataDoc.getFileName());
} catch (IOException e) {
removeAll();
validate();
@@ -328,6 +326,7 @@
return null;
}
}
+
}
//TODO make the error panel less ugly
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-04 06:30:42
|
Revision: 475
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=475&view=rev
Author: trevorolio
Date: 2007-10-03 23:30:45 -0700 (Wed, 03 Oct 2007)
Log Message:
-----------
Though there's no UI to set them, body rendering now respects body configuration for morphs.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/AccountsForTesting.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountRecord.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/ServiceInitializationPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-1.xml
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/account.html
maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html
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
maven/trunk/ogoglio-server/src/test/resources/bootstrap.properties
maven/trunk/ogoglio-server/src/test/resources/test-config.properties
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-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/migrate/AccountsForTesting.java 2007-10-04 06:30:45 UTC (rev 475)
@@ -23,7 +23,7 @@
public boolean populate(SessionFactory sessionFactory, int from, int to) throws PersistException {
if ((from != 0) || (to != 1)) {
- Log.error("Migration called in the wrong place! Expected 0->1 but was:" + from + "->" + to + "!");
+ Log.error("Migration called in the wrong place! Expected 0->1 but was:" + from + " -> " + to + "!");
Log.error("Migration called in the wrong place! Check the ordering of migration array!");
return false;
}
@@ -40,8 +40,11 @@
String users = zap.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "allBootstrapUsers");
String pws = zap.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "allBootstrapUsersPW");
String cookies = zap.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "allBootstrapUsersCookies");
+
+ String bodyDisplayNames = zap.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "bodyDataDisplayNames");
+ String bodyFileNames = zap.getKeyFromSet(PropStorage.BOOTSTRAP_PROPS, "bodyDataFileNames");
- if ((uriString == null) || (users == null) || (pws == null) || cookies == null) {
+ if ((uriString == null) || (users == null) || (pws == null) || cookies == null || bodyDisplayNames == null || bodyFileNames == null) {
Log.error("Badly formed test input for migration (AccountsForTesting)");
return false;
}
@@ -49,12 +52,16 @@
String[] userList = users.split(Pattern.quote(","));
String[] pwList = pws.split(Pattern.quote(","));
String[] cookiesList = cookies.split(Pattern.quote(","));
- if (userList.length != pwList.length || userList.length != cookiesList.length) {
- Log.error("Whoa! Settings.xml gave us a bootstrap user, pw or cookie list of different lengths!");
+ String[] bodyDisplayNameArray = bodyDisplayNames.split(Pattern.quote(","));
+ String[] bodyFileNameArray = bodyFileNames.split(Pattern.quote(","));
+ if (userList.length != pwList.length || userList.length != cookiesList.length || bodyDisplayNameArray.length < 1 || bodyDisplayNameArray.length != bodyFileNameArray.length) {
+ Log.error("Whoa! Settings.xml gave us a bootstrap user, pw, body, or cookie list of different lengths!");
return false;
}
URI uri = new URI(uriString);
+ ServiceInitializationPersistTasks.initializeBodyDataRecords(sessionFactory, bodyDisplayNameArray, bodyFileNameArray);
+
for (int i = 0; i < userList.length; ++i) {
ServiceInitializationPersistTasks.initializeBootstrapAccount(sessionFactory, uri.getHost(), userList[i], pwList[i], cookiesList[i]);
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java 2007-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java 2007-10-04 06:30:45 UTC (rev 475)
@@ -138,7 +138,15 @@
Log.error("Whoa! Bad email value!" + email);
}
- record = new AccountRecord(username, accountlevel, email);
+ Query bodyDataQuery = hibernateSession.getNamedQuery(BodyPersistTasks.BODY_DATA);
+ BodyDataRecord[] bodyDataRecords = (BodyDataRecord[])bodyDataQuery.list().toArray(new BodyDataRecord[0]);
+ if(bodyDataRecords.length == 0){
+ throw new IllegalStateException("No body data records!");
+ }
+ BodyConfigurationRecord bodyConfRecord = new BodyConfigurationRecord(username, "Body", bodyDataRecords[0].getBodyDataID());
+ hibernateSession.save(bodyConfRecord);
+
+ record = new AccountRecord(username, accountlevel, email, bodyConfRecord.getBodyConfigurationID());
hibernateSession.save(record);
return record;
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountRecord.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountRecord.java 2007-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountRecord.java 2007-10-04 06:30:45 UTC (rev 475)
@@ -43,10 +43,12 @@
private long frozenUntil = AccountDocument.NO_TIME_VALUE;
+ private long defaultBodyConfigurationID = -1;
+
public AccountRecord() {
}
- public AccountRecord(String username, String accountlevel, String email) {
+ public AccountRecord(String username, String accountlevel, String email, long defaultBodyConfigurationID) {
this.username = cleanUsername(username);
if (this.username == null) {
throw new IllegalArgumentException("Bad username (only letters and numbers): " + username);
@@ -61,6 +63,8 @@
throw new IllegalArgumentException("Bad email: " + email);
}
+ this.defaultBodyConfigurationID = defaultBodyConfigurationID;
+
this.creationDate = System.currentTimeMillis();
}
@@ -155,6 +159,14 @@
public String getAccountlevel() {
return accountlevel;
}
+
+ public void setDefaultBodyConfigurationID(long defaultBodyConfigurationID){
+ this.defaultBodyConfigurationID = defaultBodyConfigurationID;
+ }
+
+ public long getDefaultBodyConfigurationID(){
+ return defaultBodyConfigurationID;
+ }
public void setAccountlevel(String level) {
if (verifyAccountLevel(level) == null) {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java 2007-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java 2007-10-04 06:30:45 UTC (rev 475)
@@ -8,8 +8,12 @@
import com.ogoglio.appdev.persist.HibernateTask;
import com.ogoglio.appdev.persist.PersistException;
+import com.ogoglio.site.AuthServlet;
+import com.ogoglio.util.WebConstants;
+import com.ogoglio.xml.AccountDocument;
import com.ogoglio.xml.BodyConfigurationDocument;
import com.ogoglio.xml.BodySettingDocument;
+import com.ogoglio.xml.server.DocumentFactory;
public class BodyPersistTasks {
@@ -21,7 +25,7 @@
public static final String BODY_CONFIGURATION_BY_USERNAME_AND_BODY_DATA_ID = "com.ogoglio.persist.bodyConfigurationByUsernameAndBodyDataID";
- public static final String BODY_CONFIGURATION_BY_USERNAME = "com.ogoglio.persist.bodyConfigurationByUsername";
+ public static final String BODY_CONFIGURATIONS_BY_USERNAME = "com.ogoglio.persist.bodyConfigurationsByUsername";
public static final String BODY_CONFIGURATION_BY_ID = "com.ogoglio.persist.bodyConfigurationByID";
@@ -80,7 +84,7 @@
public static BodyConfigurationRecord[] findBodyConfigurationsByUsername(final String username, SessionFactory sessionFactory) throws PersistException {
HibernateTask task = new HibernateTask() {
public Object run(Session session) throws PersistException {
- Query query = session.getNamedQuery(BODY_CONFIGURATION_BY_USERNAME);
+ Query query = session.getNamedQuery(BODY_CONFIGURATIONS_BY_USERNAME);
query.setString("username", username);
return query.list().toArray(new BodyConfigurationRecord[0]);
}
@@ -178,6 +182,39 @@
return (BodyDataRecord[]) task.execute();
}
+ public static BodyConfigurationDocument getDefaultBodyConfigurationDocument(final String username, SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ if(username.startsWith(WebConstants.GUEST_COOKIE_PREFIX)){ //fake up a configuration for our guests
+ Query bodyDataQuery = session.getNamedQuery(BODY_DATA);
+ BodyDataRecord[] bodyDataRecs = (BodyDataRecord[])bodyDataQuery.list().toArray(new BodyDataRecord[0]);
+ BodyConfigurationDocument doc = new BodyConfigurationDocument(0, username, "Guest Body", bodyDataRecs[0].getBodyDataID());
+ return doc;
+ }
+
+ Query accountQuery = session.getNamedQuery(AccountPersistTasks.ACCOUNT_BY_USERNAME);
+ accountQuery.setString("username", username);
+ AccountRecord accountRecord = (AccountRecord)accountQuery.uniqueResult();
+ if(accountRecord == null){
+ throw new PersistException("Queried for the body config of an unknown account");
+ }
+
+ Query bodyConfigQuery = session.getNamedQuery(BODY_CONFIGURATION_BY_ID);
+ bodyConfigQuery.setLong("bodyConfigurationID", accountRecord.getDefaultBodyConfigurationID());
+ BodyConfigurationRecord rec = (BodyConfigurationRecord)bodyConfigQuery.uniqueResult();
+
+ Query bodySettingQuery = session.getNamedQuery(BODY_SETTINGS_BY_CONFIGURATION_ID);
+ bodySettingQuery.setLong("bodyConfigurationID", rec.getBodyConfigurationID());
+ BodySettingRecord[] settingRecords = (BodySettingRecord[])bodySettingQuery.list().toArray(new BodySettingRecord[0]);
+
+ return DocumentFactory.documentFromRecord(rec, settingRecords);
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return (BodyConfigurationDocument) task.execute();
+
+ }
+
public static BodyConfigurationDocument updateBodyConfiguration(final BodyConfigurationDocument proposedDoc, SessionFactory sessionFactory) throws PersistException {
HibernateTask task = new HibernateTask() {
public Object run(Session session) throws PersistException {
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-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/ServiceInitializationPersistTasks.java 2007-10-04 06:30:45 UTC (rev 475)
@@ -41,4 +41,13 @@
public static void initializeServiceState(SessionFactory sessionFactory) throws PersistException, IOException{
ServiceStateTasks.getOrCreateServiceState(sessionFactory);
}
+
+ public static void initializeBodyDataRecords(SessionFactory sessionFactory, String[] bodyDisplayNameArray, String[] bodyFileNameArray) throws PersistException {
+ if(bodyDisplayNameArray.length != bodyFileNameArray.length){
+ throw new IllegalArgumentException("The body file name array doesn't match the display name array");
+ }
+ for (int i = 0; i < bodyFileNameArray.length; i++) {
+ BodyPersistTasks.findOrCreateBodyDataRecord(bodyDisplayNameArray[i], bodyFileNameArray[i], sessionFactory);
+ }
+ }
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java 2007-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/Sim.java 2007-10-04 06:30:45 UTC (rev 475)
@@ -26,6 +26,7 @@
import com.ogoglio.appdev.persist.PersistException;
import com.ogoglio.media.MediaService;
import com.ogoglio.message.PayloadFactory;
+import com.ogoglio.persist.BodyPersistTasks;
import com.ogoglio.persist.SimRecord;
import com.ogoglio.persist.SpacePersistTasks;
import com.ogoglio.persist.SpaceRecord;
@@ -35,6 +36,7 @@
import com.ogoglio.util.Log;
import com.ogoglio.util.StreamUtils;
import com.ogoglio.util.TwoWayMap;
+import com.ogoglio.xml.BodyConfigurationDocument;
import com.ogoglio.xml.SpaceDocument;
import com.ogoglio.xml.SpaceEvent;
import com.ogoglio.xml.TemplateDocument;
@@ -81,8 +83,8 @@
snapshotTimer.schedule(new SnapshotTask(), 300000, SNAPSHOT_FREQUENCY);
snapshotTimer.schedule(new ReaperTask(), 30000, VACANCY_TIME_TILL_SHUTDOWN);
-
- spaceSimulatorListener=new SpaceSimulatorListener();
+
+ spaceSimulatorListener = new SpaceSimulatorListener();
}
private class ReaperTask extends TimerTask {
@@ -162,6 +164,14 @@
}
}
+ public BodyConfigurationDocument getDefaultBodyConfigurationDocument(String username) {
+ try {
+ return BodyPersistTasks.getDefaultBodyConfigurationDocument(username, sessionFactory);
+ } catch (PersistException e) {
+ throw new IllegalStateException("Could not load a body configuration for " + username + ": " + e);
+ }
+ }
+
public void requestSave(SpaceSimulator simulator) {
try {
if (!simulator.getDeleted()) {
@@ -272,7 +282,7 @@
simulator = new SpaceSimulator(spaceDoc, spaceSimulatorListener);
spaceSimulators.put(new Long(record.getSpaceID()), simulator);
simulator.startSim();
- Log.info("Starting space sim " + record.getSpaceID() + ": " + record.getDisplayName() + "( on sim "+ record.getSimID()+")");
+ Log.info("Starting space sim " + record.getSpaceID() + ": " + record.getDisplayName() + "( on sim " + record.getSimID() + ")");
return simulator;
}
}
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-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-10-04 06:30:45 UTC (rev 475)
@@ -28,6 +28,7 @@
import javax.vecmath.Vector3d;
import com.ogoglio.client.UserInputListener;
+import com.ogoglio.client.model.BodyConfiguration;
import com.ogoglio.client.model.BodyDataProvider;
import com.ogoglio.client.model.Door;
import com.ogoglio.client.model.Page;
@@ -45,6 +46,7 @@
import com.ogoglio.util.Log;
import com.ogoglio.util.BlockingQueue.QueueClosedException;
import com.ogoglio.viewer.j3d.J3DRenderer;
+import com.ogoglio.xml.BodyConfigurationDocument;
import com.ogoglio.xml.DoorDocument;
import com.ogoglio.xml.PageDocument;
import com.ogoglio.xml.SettingDocument;
@@ -129,6 +131,8 @@
public void generatedSpaceEventForUser(String username, SpaceEvent event, SpaceSimulator spaceSimulator);
public TemplateDocument getTemplateDocument(long templateID);
+
+ public BodyConfigurationDocument getDefaultBodyConfigurationDocument(String username);
public String getTemplateScript(long templateID);
@@ -792,12 +796,14 @@
count = new Integer(1);
Transform3D position = new Transform3D();
position.setTranslation(new Vector3d(0, 0, 0));
- User user = new User(space, username, position);
+ BodyConfigurationDocument bodyConfigDoc = listener.getDefaultBodyConfigurationDocument(username);
+ User user = new User(space, username, position, new BodyConfiguration(bodyConfigDoc));
space.addUser(user);
SpaceEvent spaceEvent = new SpaceEvent(SpaceEvent.ADD_USER_EVENT);
spaceEvent.setProperty(SpaceEvent.USERNAME, username);
spaceEvent.setPointAndOrientationData(user.getPosition());
+ spaceEvent.setBodyConfigurationDocument(bodyConfigDoc);
handleSpaceEvent(spaceEvent);
} else {
count = new Integer(count.intValue() + 1);
@@ -972,8 +978,16 @@
}
}
+ private class SimBodyConfiguration extends BodyConfiguration {
+
+ public SimBodyConfiguration() {
+ super(1, "Sim Body", 1);
+ }
+
+ }
+
private class InSimBodyDataProvider implements BodyDataProvider {
- public ZipInputStream getBodyData(String bodyName) {
+ public ZipInputStream getBodyData(long bodyDataID) {
return new ZipInputStream(getClass().getClassLoader().getResourceAsStream("ogoglio-body-sim.jar"));
}
}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2007-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2007-10-04 06:30:45 UTC (rev 475)
@@ -208,7 +208,7 @@
return;
}
long bodyConfigID = Long.parseLong(pathElements[pathElements.length - 1]);
-
+
BodyConfigurationRecord record = BodyPersistTasks.findBodyConfigurationByID(bodyConfigID, getSessionFactory());
if (record == null || !username.equals(record.getOwnerUsername())) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
@@ -217,7 +217,7 @@
BodyConfigurationDocument proposedDoc = new BodyConfigurationDocument(parseXML(request.getInputStream()));
BodyConfigurationDocument bodyConfigDoc = BodyPersistTasks.updateBodyConfiguration(proposedDoc, getSessionFactory());
- if(bodyConfigDoc == null){
+ if (bodyConfigDoc == null) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return;
}
@@ -225,9 +225,31 @@
}
}
+ private class DefaultBodyResource extends AuthenticatedSiteResource {
+ public DefaultBodyResource() {
+ super("default", true, getSessionFactory());
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, IOException {
+ String username = pathElements[pathElements.length - 3];
+ if (!requestOkForBody(request, username, authedAccount)) {
+ response.setStatus(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
+ BodyConfigurationRecord record = BodyPersistTasks.findBodyConfigurationByID(authedAccount.getDefaultBodyConfigurationID(), getSessionFactory());
+ if(record == null){
+ throw new IllegalStateException("Account has a bogus body configuration record.. " + authedAccount.getDefaultBodyConfigurationID());
+ }
+
+ BodySettingRecord[] settingRecords = BodyPersistTasks.findBodySettingsByConfigurationID(record.getBodyConfigurationID(), getSessionFactory());
+ sendStringResponse(DocumentFactory.documentFromRecord(record, settingRecords).toString(), "text/xml", response);
+ }
+ }
+
private class BodiesResource extends AuthenticatedSiteResource {
public BodiesResource() {
super("body", false, getSessionFactory());
+ addSubResource(new DefaultBodyResource());
addSubResource(new BodyResource());
}
@@ -242,7 +264,6 @@
for (int i = 0; i < configRecs.length; i++) {
list.addChild(DocumentFactory.documentFromRecord(configRecs[i], BodyPersistTasks.findBodySettingsByConfigurationID(configRecs[i].getBodyConfigurationID(), getSessionFactory())).toElement());
}
- System.out.println("Sending " + list.toString());
sendStringResponse(list.toString(), "text/xml", response);
}
Modified: maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-1.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-1.xml 2007-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-1.xml 2007-10-04 06:30:45 UTC (rev 475)
@@ -90,6 +90,7 @@
<property name="creationDate" update="false" />
<property name="cookie" />
<property name="frozenUntil" />
+ <property name="defaultBodyConfigurationID" />
</class>
<class name="com.ogoglio.persist.TemplateRecord"
@@ -159,7 +160,7 @@
</class>
<query name="com.ogoglio.persist.bodyData">
- <![CDATA[ from com.ogoglio.persist.BodyDataRecord ]]>
+ <![CDATA[ from com.ogoglio.persist.BodyDataRecord order by bodyDataID asc ]]>
</query>
<query name="com.ogoglio.persist.bodyDataByID">
<![CDATA[ from com.ogoglio.persist.BodyDataRecord as record where record.bodyDataID = :bodyDataID ]]>
@@ -170,7 +171,7 @@
<query name="com.ogoglio.persist.bodyConfigurationByUsernameAndBodyDataID">
<![CDATA[ from com.ogoglio.persist.BodyConfigurationRecord as record where record.ownerUsername = :username and record.bodyDataID = :bodyDataID ]]>
</query>
- <query name="com.ogoglio.persist.bodyConfigurationByUsername">
+ <query name="com.ogoglio.persist.bodyConfigurationsByUsername">
<![CDATA[ from com.ogoglio.persist.BodyConfigurationRecord as record where record.ownerUsername = :username ]]>
</query>
<query name="com.ogoglio.persist.bodyConfigurationByID">
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/account.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/account.html 2007-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/account.html 2007-10-04 06:30:45 UTC (rev 475)
@@ -52,7 +52,6 @@
var spaceMembershipTable = null;
var profileTable = null;
var profileGoButton = null;
-var bodyLink = null;
function handleAuth(){
if(requestedUsername == null){
@@ -135,7 +134,6 @@
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();
}
@@ -203,7 +201,6 @@
spaceMembershipTable = document.getElementById("spaceMembershipTable");
profileGoButton = document.getElementById("profileGoButton");
profileTable = document.getElementById("profileTable");
- bodyLink = document.getElementById("bodyLink");
addAuthListeners(handleAuth, handleAuth);
}
@@ -248,7 +245,7 @@
<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="bodyLink"><a href='body.html'>Edit your body »</a></p>
<p class="navLink" id="inventoryLink"></p>
</div><!-- end content -->
Modified: maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html 2007-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/main/resources/siteTemplates/body.html 2007-10-04 06:30:45 UTC (rev 475)
@@ -30,7 +30,6 @@
</style>
<script type="text/javascript">
-var bodyID = locationParameters['bodyID'];
var loginCookie = getLoginCookie();
var titleElement = null;
@@ -46,26 +45,10 @@
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();
}
@@ -114,7 +97,7 @@
</div> <!-- end header menu -->
<div id="main">
- <h2 id="title">Loading...</h2>
+ <h2 id="title">Body Editor:</h2>
<div id="appletDiv"> </div>
</div> <!-- end main -->
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-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/test/java/com/ogoglio/persist/test/PersistTest.java 2007-10-04 06:30:45 UTC (rev 475)
@@ -16,13 +16,9 @@
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
import com.ogoglio.appdev.migrate.MigrationSupport;
import com.ogoglio.appdev.migrate.test.DBZapTest;
-import com.ogoglio.appdev.persist.HibernateTask;
import com.ogoglio.appdev.persist.PersistException;
import com.ogoglio.media.MediaService;
import com.ogoglio.migrate.OgoglioServerMigration;
@@ -42,6 +38,7 @@
import com.ogoglio.persist.TemplateRecord;
import com.ogoglio.util.Log;
import com.ogoglio.util.PropStorage;
+import com.ogoglio.xml.BodyConfigurationDocument;
public class PersistTest extends DBZapTest {
@@ -100,6 +97,9 @@
public void testRecords() {
try {
+ BodyDataRecord bodyDataRec = BodyPersistTasks.findOrCreateBodyDataRecord("Mike", "ogoglio-body-mike.jar", sessionFactory);
+ assertNotNull(bodyDataRec);
+
String ONE_TWO = "1234";
AccountRecord accRec1 = AccountPersistTasks.findAccountByUsername(username1, sessionFactory);
if (accRec1 == null) {
@@ -130,11 +130,14 @@
assertEquals("ogoglio-body-moon.jar", bodyDataRecord.getFileName());
bodyDataRecord = BodyPersistTasks.findBodyDataRecord("ogoglio-body-moon.jar", sessionFactory);
assertNotNull(bodyDataRecord);
+ assertTrue(bodyDataRecord.getBodyDataID() >= 0);
assertEquals("Moon Body", bodyDataRecord.getDisplayName());
assertEquals("ogoglio-body-moon.jar", bodyDataRecord.getFileName());
BodyConfigurationRecord configurationRecord = BodyPersistTasks.createBodyConfiguration(username1, "Brand New Test Body", bodyDataRecord.getBodyDataID(), sessionFactory);
assertNotNull(configurationRecord);
+ configurationRecord = BodyPersistTasks.findBodyConfigurationByID(configurationRecord.getBodyConfigurationID(), sessionFactory);
+ assertNotNull(configurationRecord);
assertEquals(bodyDataRecord.getBodyDataID(), configurationRecord.getBodyDataID());
BodySettingRecord settingRecord = BodyPersistTasks.createOrUpdateBodySetting(configurationRecord.getBodyDataID(), "height", 0.5f, sessionFactory);
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-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/test/java/com/ogoglio/sim/script/test/ScriptTest.java 2007-10-04 06:30:45 UTC (rev 475)
@@ -10,6 +10,7 @@
import com.ogoglio.sim.SpaceSimulator;
import com.ogoglio.util.UIConstants;
+import com.ogoglio.xml.BodyConfigurationDocument;
import com.ogoglio.xml.SpaceDocument;
import com.ogoglio.xml.SpaceEvent;
import com.ogoglio.xml.TemplateDocument;
@@ -126,6 +127,10 @@
public void generatedSpaceEventForUser(String username, SpaceEvent event, SpaceSimulator spaceSimulator) {
}
+ public BodyConfigurationDocument getDefaultBodyConfigurationDocument(String username) {
+ return new BodyConfigurationDocument(1, username, "Script Test Body", 1);
+ }
+
}
}
Modified: maven/trunk/ogoglio-server/src/test/resources/bootstrap.properties
===================================================================
--- maven/trunk/ogoglio-server/src/test/resources/bootstrap.properties 2007-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/test/resources/bootstrap.properties 2007-10-04 06:30:45 UTC (rev 475)
@@ -4,3 +4,5 @@
bootstrapUser=${ogoglio.bootstrapUser}
bootstrapUserPW=${ogoglio.bootstrapUserPW}
allBootstrapUsersCookies=${ogoglio.allBootstrapUsersCookies}
+bodyDataDisplayNames=${ogoglio.bodyDataDisplayNames}
+bodyDataFileNames=${ogoglio.bodyDataFileNames}
Modified: maven/trunk/ogoglio-server/src/test/resources/test-config.properties
===================================================================
--- maven/trunk/ogoglio-server/src/test/resources/test-config.properties 2007-10-04 06:30:38 UTC (rev 474)
+++ maven/trunk/ogoglio-server/src/test/resources/test-config.properties 2007-10-04 06:30:45 UTC (rev 475)
@@ -22,6 +22,8 @@
ogoglio.allBootstrapUsersPW=${ogoglio.allBootstrapUsersPW}
ogoglio.bootstrapUser=${ogoglio.bootstrapUser}
ogoglio.bootstrapUserPW=${ogoglio.bootstrapUserPW}
+ogoglio.bodyDataDisplayNames=${ogoglio.bodyDataDisplayNames}
+ogoglio.bodyDataFileNames=${ogoglio.bodyDataFileNames}
#can destroy the db?
ogoglio.okToZapDB=${ogoglio.okToZapDB}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-04 06:30:35
|
Revision: 474
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=474&view=rev
Author: trevorolio
Date: 2007-10-03 23:30:38 -0700 (Wed, 03 Oct 2007)
Log Message:
-----------
Though there's no UI to set them, body rendering now respects body configuration for morphs.
Modified Paths:
--------------
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/client/model/BodyDataProvider.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DDataCache.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DDataManager.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/SpaceEvent.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/UserDocument.java
maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java
Added Paths:
-----------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyConfiguration.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java 2007-10-03 16:22:31 UTC (rev 473)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -23,6 +23,7 @@
import javax.media.j3d.Transform3D;
import javax.vecmath.Point3d;
+import com.ogoglio.client.model.BodyConfiguration;
import com.ogoglio.client.model.BodyDataProvider;
import com.ogoglio.client.model.Door;
import com.ogoglio.client.model.Page;
@@ -40,7 +41,10 @@
import com.ogoglio.message.TCPChannel;
import com.ogoglio.util.ArgumentUtils;
import com.ogoglio.util.Log;
+import com.ogoglio.util.WebConstants;
import com.ogoglio.xml.AccountDocument;
+import com.ogoglio.xml.BodyConfigurationDocument;
+import com.ogoglio.xml.BodyDataDocument;
import com.ogoglio.xml.DoorDocument;
import com.ogoglio.xml.PageDocument;
import com.ogoglio.xml.ShapeDocument;
@@ -125,7 +129,17 @@
//can't use spaceDoc list of users because it doesn't include the user that just authed (me!)
UserDocument[] userDocs = webClient.getUserDocuments(spaceID);
for (int i = 0; i < userDocs.length; i++) {
- space.addUser(new User(space, userDocs[i].getUsername(), userDocs[i].getTransform()));
+ BodyConfigurationDocument bodyConfDoc = null;
+ if (userDocs[i].getUsername().startsWith(WebConstants.GUEST_COOKIE_PREFIX)) {
+ System.out.println("Need to handle guest bodies correctly");
+ bodyConfDoc = new BodyConfigurationDocument(0, userDocs[i].getUsername(), "Body", 1);
+ } else {
+ bodyConfDoc = webClient.getBodyConfiguration(userDocs[i].getUsername(), userDocs[i].getBodyConfigurationID());
+ }
+ BodyConfiguration bodyConfig = new BodyConfiguration(bodyConfDoc.getBodyConfigurationID(), bodyConfDoc.getDisplayName(), bodyConfDoc.getBodyDataID());
+ User user = new User(space, userDocs[i].getUsername(), userDocs[i].getTransform(), bodyConfig);
+ bodyConfig.setUser(user);
+ space.addUser(user);
}
ThingDocument[] thingDocs = spaceDoc.getThingDocuments();
@@ -289,7 +303,9 @@
if (message.getPayload() instanceof PayloadFactory.SpaceEventPayload) {
SpaceEvent event = ((PayloadFactory.SpaceEventPayload) message.getPayload()).getSpaceEvent();
if (SpaceEvent.ADD_USER_EVENT.equals(event.getName())) {
- User user = new User(space, event.getStringProperty(SpaceEvent.USERNAME), event.getTransform());
+ BodyConfigurationDocument bodyConfigDoc = event.getBodyConfigurationDocument();
+ BodyConfiguration bodyConfig = new BodyConfiguration(bodyConfigDoc);
+ User user = new User(space, event.getStringProperty(SpaceEvent.USERNAME), event.getTransform(), bodyConfig);
space.addUser(user);
} else if (SpaceEvent.REMOVE_USER_EVENT.equals(event.getName())) {
User user = space.getUser(event.getStringProperty(SpaceEvent.USERNAME));
@@ -701,11 +717,12 @@
private class NetworkBodyDataProvider implements BodyDataProvider {
- public ZipInputStream getBodyData(String bodyName) {
+ public ZipInputStream getBodyData(long bodyDataID) {
try {
- return webClient.getBodyData(bodyName);
+ BodyDataDocument dataDoc = webClient.getBodyDataDocument(bodyDataID);
+ return webClient.getBodyData(dataDoc.getFileName());
} catch (IOException e) {
- Log.warn("Requested an unknown body: " + bodyName);
+ Log.warn("Requested an unknown body: " + bodyDataID);
return null;
}
}
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-10-03 16:22:31 UTC (rev 473)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -479,8 +479,8 @@
wire.sendDelete(descriptor.getBodyDataDocumentURI(bodyDataID), authenticator.getAuthCookie());
}
- public ZipInputStream getBodyData(String bodyName) throws IOException {
- InputStream stream = wire.fetchAuthenticatedStream(descriptor.getBodyDataURI(bodyName), authenticator.getAuthCookie());
+ public ZipInputStream getBodyData(String fileName) throws IOException {
+ InputStream stream = wire.fetchAuthenticatedStream(descriptor.getBodyDataURI(fileName), authenticator.getAuthCookie());
if (stream == null) {
return null;
}
@@ -528,4 +528,8 @@
public WebAPIClientWire getWire() {
return wire;
}
+
+ public BodyConfigurationDocument getDefaultBodyConfiguration(String username) throws IOException {
+ return new BodyConfigurationDocument(wire.fetchAuthenticatedXML(descriptor.getDefaultBodyConfiguration(username), authenticator.getAuthCookie()));
+ }
}
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-10-03 16:22:31 UTC (rev 473)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIDescriptor.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -123,8 +123,8 @@
return WebAPIUtil.appendToURI(getBodiesURI(), bodyDataID + "/");
}
- public URI getBodyDataURI(String bodyName) {
- return WebAPIUtil.appendToURI(serviceURI, "ogoglio-body-" + bodyName + ".jar");
+ public URI getBodyDataURI(String fileName) {
+ return WebAPIUtil.appendToURI(serviceURI, fileName);
}
public URI getBodyConfigurationsURI(String username) {
@@ -135,6 +135,10 @@
return WebAPIUtil.appendToURI(getBodyConfigurationsURI(username), bodyConfigurationID + "/");
}
+ public URI getDefaultBodyConfiguration(String username) {
+ return WebAPIUtil.appendToURI(getBodyConfigurationsURI(username), "default/");
+ }
+
public URI getPagesURI(long spaceID, long thingID) {
return WebAPIUtil.appendToURI(getThingURI(spaceID, thingID), "page/");
}
Added: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyConfiguration.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyConfiguration.java (rev 0)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyConfiguration.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -0,0 +1,82 @@
+package com.ogoglio.client.model;
+
+import java.util.HashMap;
+
+import com.ogoglio.util.ArgumentUtils;
+import com.ogoglio.xml.BodyConfigurationDocument;
+import com.ogoglio.xml.BodySettingDocument;
+
+public class BodyConfiguration {
+
+ private User user = null;
+
+ private long bodyConfigurationID = -1;
+
+ private String displayName = null;
+
+ private long bodyDataID = -1;
+
+ private HashMap settings = new HashMap();
+
+ public BodyConfiguration(BodyConfigurationDocument configDoc){
+ this(configDoc.getBodyConfigurationID(), configDoc.getDisplayName(), configDoc.getBodyDataID());
+ BodySettingDocument[] settingDocs = configDoc.getBodySettingDocuments();
+ for (int i = 0; i < settingDocs.length; i++) {
+ addSetting(settingDocs[i].getSettingName(), settingDocs[i].getSetting());
+ }
+ }
+
+ public BodyConfiguration(long bodyConfigurationID, String displayName, long bodyDataID){
+ ArgumentUtils.assertNotNegative(bodyConfigurationID);
+ this.bodyConfigurationID = bodyConfigurationID;
+ ArgumentUtils.assertNotEmpty(displayName);
+ this.displayName = displayName;
+ ArgumentUtils.assertNotNegative(bodyDataID);
+ this.bodyDataID = bodyDataID;
+ }
+
+ public void setUser(User user){
+ ArgumentUtils.assertNotNull(user);
+ this.user = user;
+ }
+
+ public void addSetting(String settingName, float setting){
+ ArgumentUtils.assertNotEmpty(settingName);
+ if(setting < 0){
+ setting = 0;
+ }
+ if(setting > 1){
+ setting = 1;
+ }
+ settings.put(settingName, new Float(setting));
+ }
+
+ public void removeSetting(String settingName){
+ settings.remove(settingName);
+ }
+
+ public float getSetting(String settingName){
+ Float setting = (Float)settings.get(settingName);
+ if(setting == null){
+ return 0;
+ }
+ return setting.floatValue();
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+ public long getBodyConfigurationID() {
+ return bodyConfigurationID;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public long getBodyDataID() {
+ return bodyDataID;
+ }
+
+}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyDataProvider.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyDataProvider.java 2007-10-03 16:22:31 UTC (rev 473)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/BodyDataProvider.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -4,6 +4,6 @@
public interface BodyDataProvider {
- public ZipInputStream getBodyData(String bodyName);
+ public ZipInputStream getBodyData(long bodyDataID);
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java 2007-10-03 16:22:31 UTC (rev 473)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -14,8 +14,6 @@
package com.ogoglio.client.model;
-import java.io.IOException;
-
import javax.media.j3d.Transform3D;
import com.ogoglio.util.ArgumentUtils;
@@ -32,13 +30,17 @@
private SplinePath path = null;
- public User(Space space, String username, Transform3D position) {
+ private BodyConfiguration bodyConfiguration = null;
+
+ public User(Space space, String username, Transform3D position, BodyConfiguration bodyConfiguration) {
ArgumentUtils.assertNotNull(space);
this.space = space;
ArgumentUtils.assertNotNull(username);
this.username = username;
ArgumentUtils.assertNotNull(position);
this.position = position;
+ ArgumentUtils.assertNotNull(bodyConfiguration);
+ this.bodyConfiguration = bodyConfiguration;
}
public void startMotion(SplinePath path) {
@@ -58,6 +60,10 @@
space.notifyUserAnimationStarted(this, animationName);
}
+ public BodyConfiguration getBodyConfiguration(){
+ return bodyConfiguration;
+ }
+
public String toString() {
return "User: " + username;
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DDataCache.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DDataCache.java 2007-10-03 16:22:31 UTC (rev 473)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DDataCache.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -17,7 +17,7 @@
public class J3DDataCache {
- private HashMap bodyDataMap = new HashMap(); //maps body names to J3DBodyData objects
+ private HashMap bodyDataMap = new HashMap(); //maps body IDs to J3DBodyData objects
private HashMap templateDataMap = new HashMap(); //maps template guid to J3DTemplateData objects
@@ -25,12 +25,12 @@
return (J3DTemplateData) templateDataMap.get(createTemplateGUID(templateID, lod));
}
- public void putBodyData(String bodyName, J3DBodyData data){
- bodyDataMap.put(bodyName, data);
+ public void putBodyData(long bodyDataID, J3DBodyData data){
+ bodyDataMap.put(new Long(bodyDataID), data);
}
- public J3DBodyData getBodyData(String bodyName){
- return (J3DBodyData)bodyDataMap.get(bodyName);
+ public J3DBodyData getBodyData(long bodyDataID){
+ return (J3DBodyData)bodyDataMap.get(new Long(bodyDataID));
}
public void putTemplateData(long templateID, int lod, J3DTemplateData entry) {
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DDataManager.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DDataManager.java 2007-10-03 16:22:31 UTC (rev 473)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DDataManager.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -89,13 +89,13 @@
this.bodyDataProvider = bodyDataProvider;
}
- public J3DBodyData getBodyData(String bodyName) {
- J3DBodyData data = dataCache.getBodyData(bodyName);
+ public J3DBodyData getBodyData(long bodyDataID) {
+ J3DBodyData data = dataCache.getBodyData(bodyDataID);
if (data != null) {
return data;
}
- ZipInputStream bodyDataInput = bodyDataProvider.getBodyData(bodyName);
+ ZipInputStream bodyDataInput = bodyDataProvider.getBodyData(bodyDataID);
if (bodyDataInput == null) {
throw new IllegalStateException("Trevor didn't implement an error body for an unknown body name");
}
@@ -104,8 +104,8 @@
if (bodyData == null) {
throw new IllegalStateException("Trevor didn't implement an error body for an illegible body");
}
- System.out.println("Morph count: " + bodyData.getMorphDeltaMaps().length);
- dataCache.putBodyData(bodyName, bodyData);
+
+ dataCache.putBodyData(bodyDataID, bodyData);
return bodyData;
}
@@ -510,11 +510,9 @@
Log.error("Error parsing obj: " + e);
}
if (!gotObj) {
- System.err.println("didn't get obj for template " + templateID);
try {
ObjParser parser = new ObjParser(UIConstants.getResource("templates/loading.obj"));
objs[0] = parser.parse();
- System.err.println("Set error obj");
} catch (Exception e) {
e.printStackTrace();
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java 2007-10-03 16:22:31 UTC (rev 473)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DRenderer.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -38,6 +38,7 @@
import com.ogoglio.client.SpaceClient;
import com.ogoglio.client.UserInputListener;
+import com.ogoglio.client.model.BodyConfiguration;
import com.ogoglio.client.model.BodyDataProvider;
import com.ogoglio.client.model.Door;
import com.ogoglio.client.model.Page;
@@ -615,14 +616,15 @@
}
private UserRenderable createUserRenderable(User user) throws IOException, RenderableParseException {
- J3DBodyData bodyData = dataManager.getBodyData("mike");
+ BodyConfiguration bodyConfig = user.getBodyConfiguration();
+ J3DBodyData bodyData = dataManager.getBodyData(bodyConfig.getBodyDataID());
+ if(rendererStopped){ //this happens sometimes when someone logs in and then a space is cleaned up (usually during testing)
+ return null;
+ }
if(bodyData == null){
throw new IllegalStateException("Cannot load body data");
}
- if(rendererStopped){ //this happens sometimes when someone logs in and then a space is cleaned up (usually during testing)
- return null;
- }
- System.out.println("Trevor needs to allow bodyData other than mike");
+
boolean isLocalUser = !offScreen && username != null && user.getUsername().equals(username);
final J3DUserRenderable renderable = new J3DUserRenderable(user, bodyData);
renderable.setID(USER_ID_PREFIX + user.getUsername());
@@ -750,10 +752,8 @@
public double getLandHeight(double x, double z, double pickHeight) {
pickStart.set(x, pickHeight, z);
if (picker.pickRayClosest(pickStart, DOWN_VEC, intersectionPoint) == null) {
- //System.out.println("no land height: 0!");
return 0;
}
- //System.out.println("intersected with land: "+intersectionPoint.y);
return intersectionPoint.y;
}
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java 2007-10-03 16:22:31 UTC (rev 473)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -92,7 +92,7 @@
private void initBody() {
bodyGroup.removeAllChildren();
- skin = new SkinLoader(bodyData).generateSkin();
+ skin = new SkinLoader(bodyData, user.getBodyConfiguration()).generateSkin();
userHeight = skin.getHeight();
skinMap = bodyData.getSkinMap();
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java 2007-10-03 16:22:31 UTC (rev 473)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -19,6 +19,7 @@
import javax.media.j3d.GeometryArray;
import javax.vecmath.Vector3f;
+import com.ogoglio.client.model.BodyConfiguration;
import com.ogoglio.viewer.j3d.J3DBodyData;
public class SkinLoader {
@@ -29,25 +30,32 @@
private BufferedImage baseImage;
+ private BodyConfiguration bodyConfiguration = null;
+
private MorphDeltaMap[] morphDeltaMaps = null;
- public SkinLoader(J3DBodyData bodyData) {
+ public SkinLoader(J3DBodyData bodyData, BodyConfiguration bodyConfiguration) {
this.geometry = bodyData.cloneBodyGeometry();
this.morphDeltaMaps = bodyData.getMorphDeltaMaps();
this.baseImage = bodyData.getBaseTexture();
+ this.bodyConfiguration = bodyConfiguration;
}
public Skin generateSkin() {
float[] vertices = geometry.getCoordRefFloat();
for (int i = 0; i < morphDeltaMaps.length; i++) {
+ float setting = bodyConfiguration.getSetting(morphDeltaMaps[i].getName());
+ if(setting <= 0.0001){
+ continue;
+ }
MorphDeltaMap.Range[] ranges = morphDeltaMaps[i].getRanges();
for (int r = 0; r < ranges.length; r++) {
Vector3f[] deltas = ranges[r].getDeltas();
for (int d = 0; d < deltas.length; d++) {
int index = (ranges[r].getLower() - 1 + d) * 3;
- vertices[index] = vertices[index] + deltas[d].x;
- vertices[index + 1] = vertices[index + 1] + deltas[d].y;
- vertices[index + 2] = vertices[index + 2] + deltas[d].z;
+ vertices[index] = vertices[index] + (deltas[d].x * setting);
+ vertices[index + 1] = vertices[index + 1] + (deltas[d].y * setting);
+ vertices[index + 2] = vertices[index + 2] + (deltas[d].z * setting);
}
}
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java 2007-10-03 16:22:31 UTC (rev 473)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -33,7 +33,7 @@
public BodyConfigurationDocument(long bodyConfigurationID, String ownerUsername, String displayName, long bodyDataID) {
data = new XMLElement(NAME);
- data.setAttribute(BODY_CONFIGURATION_ID, bodyDataID);
+ data.setAttribute(BODY_CONFIGURATION_ID, bodyConfigurationID);
ArgumentUtils.assertNotEmpty(ownerUsername);
data.setAttribute(OWNER_USERNAME, ownerUsername);
ArgumentUtils.assertNotNull(displayName);
@@ -62,7 +62,7 @@
}
public long getBodyDataID(){
- return data.getLongAttribute(BODY_CONFIGURATION_ID);
+ return data.getLongAttribute(BODY_DATA_ID);
}
public void addBodySetting(String settingName, float setting) {
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-10-03 16:22:31 UTC (rev 473)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/SpaceEvent.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -25,6 +25,7 @@
import nanoxml.XMLElement;
+import com.ogoglio.client.model.BodyConfiguration;
import com.ogoglio.client.model.SplinePath;
import com.ogoglio.util.ContextMenuItemInfo;
import com.ogoglio.viewer.j3d.J3DSplinePath;
@@ -81,7 +82,7 @@
public static final String USERNAME = "userID";
- public static final String BODY_ID = "bodyID";
+ public static final String BODY_CONFIGURATION_ID = "bodyConfigurationID";
public static final String THING_ID = "thingID";
@@ -227,6 +228,8 @@
private SplinePath splinePath = null;
+ private BodyConfigurationDocument bodyConfigDoc = null;
+
private String html = null;
private Vector contextMenu = new Vector();
@@ -264,6 +267,11 @@
splinePath = new SplinePathDocument(splinePathElement).getSplinePath();
}
+ XMLElement bodyConfigElement = element.getChild(BodyConfigurationDocument.NAME);
+ if (bodyConfigElement != null) {
+ bodyConfigDoc = new BodyConfigurationDocument(bodyConfigElement);
+ }
+
XMLElement htmlElement = element.getChild(HtmlElement.NAME);
if (htmlElement != null) {
HtmlElement ele = new HtmlElement(htmlElement);
@@ -354,7 +362,7 @@
String[] keys = getKeys();
for (int i = 0; i < keys.length; i++) {
Object value = properties.get(keys[i]);
- if(value == null){
+ if (value == null) {
continue;
}
XMLElement property = new XMLElement(PROPERTY);
@@ -384,12 +392,17 @@
element.addChild(new SplinePathDocument((J3DSplinePath) splinePath).toElement());
}
+ if (bodyConfigDoc != null) {
+ element.addChild(bodyConfigDoc.toElement());
+ }
+
if (html != null) {
element.addChild(new HtmlElement(html).toElement());
}
- if (contextMenu!=null) {
- for (int i=0; i<contextMenu.size();++i) {
- ContextMenuItemInfo info=(ContextMenuItemInfo)contextMenu.get(i);
+
+ if (contextMenu != null) {
+ for (int i = 0; i < contextMenu.size(); ++i) {
+ ContextMenuItemInfo info = (ContextMenuItemInfo) contextMenu.get(i);
XMLElement item = new XMLElement();
item.setName(CONTEXT_MENU_DATA_ITEM);
item.setAttribute(CONTEXT_MENU_DATA_ITEM_TEXT, info.getUserVisibleString());
@@ -437,6 +450,10 @@
return splinePath;
}
+ public BodyConfigurationDocument getBodyConfigurationDocument(){
+ return bodyConfigDoc;
+ }
+
public void setSplinePath(SplinePath path) {
this.splinePath = path;
}
@@ -480,4 +497,8 @@
public String toString() {
return toElement().toString();
}
+
+ public void setBodyConfigurationDocument(BodyConfigurationDocument bodyConfigurationDocument) {
+ bodyConfigDoc = bodyConfigurationDocument;
+ }
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/UserDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/UserDocument.java 2007-10-03 16:22:31 UTC (rev 473)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/UserDocument.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -26,14 +26,19 @@
public static final String USERNAME = "username";
+ public static final String BODY_CONFIGURATION_ID = "bodyconfigurationid";
+
public UserDocument(User user) {
- this(user.getUsername(), user.getPosition(), user.getSplinePath());
+ this(user.getUsername(), user.getPosition(), user.getSplinePath(), user.getBodyConfiguration().getBodyConfigurationID());
}
- public UserDocument(String username, Transform3D transform, SplinePath splinePath) {
+ public UserDocument(String username, Transform3D transform, SplinePath splinePath, long bodyConfigurationID) {
super(NAME, transform, splinePath);
ArgumentUtils.assertNotNull(username);
getData().setAttribute(USERNAME, username);
+ if (bodyConfigurationID >= 0) {
+ getData().setAttribute(BODY_CONFIGURATION_ID, bodyConfigurationID);
+ }
}
public UserDocument(XMLElement data) {
@@ -47,4 +52,8 @@
public String getUsername() {
return getData().getStringAttribute(USERNAME);
}
+
+ public long getBodyConfigurationID() {
+ return getData().getLongAttribute(BODY_CONFIGURATION_ID);
+ }
}
Modified: maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java
===================================================================
--- maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java 2007-10-03 16:22:31 UTC (rev 473)
+++ maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java 2007-10-04 06:30:38 UTC (rev 474)
@@ -189,12 +189,14 @@
assertEquals(0, shapeMove1.getSplinePath().getSplineKeyFrames()[1].getKnot(), keyFrames[1].getKnot());
assertEquals(shapeMove1.getShapeName(), "a_shape");
- UserDocument userDoc = new UserDocument(username, new Transform3D(), null);
+ UserDocument userDoc = new UserDocument(username, new Transform3D(), null, 23);
assertEquals(username, userDoc.getUsername());
-
+ assertEquals(23, userDoc.getBodyConfigurationID());
+
userDoc = new UserDocument(XMLElement.parseElementFromString(userDoc.toString()));
assertEquals(username, userDoc.getUsername());
-
+ assertEquals(23, userDoc.getBodyConfigurationID());
+
DoorDocument door1 = new DoorDocument(1, displayName, 2, "susan", uri1, new Transform3D());
assertEquals(1, door1.getDoorID());
assertEquals(2, door1.getTemplateID());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-02 03:10:28
|
Revision: 470
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=470&view=rev
Author: trevorolio
Date: 2007-10-01 20:10:32 -0700 (Mon, 01 Oct 2007)
Log Message:
-----------
Fixed a typo in the global resource names: okMigrateDB != okToMigrateDB and oktoZapDB != okToZapDB
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml
Modified: maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml 2007-10-02 03:10:29 UTC (rev 469)
+++ maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml 2007-10-02 03:10:32 UTC (rev 470)
@@ -10,8 +10,8 @@
<ResourceLink name="ogoglio/baseURL" global="baseURL" type="java.lang.String"/>
<ResourceLink name="ogoglio/baseSimURL" global="baseSimURL" type="java.lang.String"/>
- <ResourceLink name="ogoglio/oktoZapDB" global="oktoZapDB" type="java.lang.String"/>
- <ResourceLink name="ogoglio/okMigrateDB" global="oktoMigrateDB" type="java.lang.String"/>
+ <ResourceLink name="ogoglio/okToZapDB" global="okToZapDB" type="java.lang.String"/>
+ <ResourceLink name="ogoglio/okToMigrateDB" global="okToMigrateDB" type="java.lang.String"/>
<ResourceLink name="ogoglio/simsAllowRemoteAccess" global="simsAllowRemoteAccess" type="java.lang.String"/>
<ResourceLink name="ogoglio/mediaDirectory" global="mediaDirectory" type="java.lang.String"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-02 03:10:25
|
Revision: 469
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=469&view=rev
Author: trevorolio
Date: 2007-10-01 20:10:29 -0700 (Mon, 01 Oct 2007)
Log Message:
-----------
Fixed a typo in the global resource names: okMigrateDB != okToMigrateDB and oktoZapDB != okToZapDB
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-10-02 02:28:44 UTC (rev 468)
+++ maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java 2007-10-02 03:10:29 UTC (rev 469)
@@ -21,7 +21,6 @@
import java.net.Socket;
import java.net.URI;
import java.net.URISyntaxException;
-import java.net.URLConnection;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-02 02:28:40
|
Revision: 468
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=468&view=rev
Author: trevorolio
Date: 2007-10-01 19:28:44 -0700 (Mon, 01 Oct 2007)
Log Message:
-----------
THIS CHECKIN REQUIRES A DB DROP
Introducing a new world of user configurable body settings. Ditched the old BodyRecord and created three new record types:
BodyDataRecords: hold information about the wadges of data which make up a body's base (e.g. mesh, morphs, textures...)
BodyConfigurationRecords: a user level representation of a body configuration, with a display name and a set of...
BodySettingRecords: morph interpolation values for a given body configuration (e.g. height, 0.9 or chin width, 0.2)
Halfway through documentifying and RESTifying these records. I can smell the day when this is autogenerated from annotated classes.
Modified Paths:
--------------
maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
Modified: maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java
===================================================================
--- maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-02 02:28:41 UTC (rev 467)
+++ maven/trunk/ogoglio-body-editor-applet/src/main/java/com/ogoglio/bodyeditor/BodyEditorApplet.java 2007-10-02 02:28:44 UTC (rev 468)
@@ -51,7 +51,6 @@
import com.ogoglio.client.WebAPIClient;
import com.ogoglio.client.WebAPIClientWire;
import com.ogoglio.client.WebAPIDescriptor;
-import com.ogoglio.client.model.Body;
import com.ogoglio.client.model.BodyDataProvider;
import com.ogoglio.client.model.Space;
import com.ogoglio.client.model.TemplateDataProvider;
@@ -63,8 +62,8 @@
import com.ogoglio.viewer.j3d.J3DDataManager;
import com.ogoglio.viewer.j3d.J3DUniverse;
import com.ogoglio.viewer.j3d.J3DUserRenderable;
+import com.ogoglio.viewer.j3d.body.SkinLoader;
import com.ogoglio.xml.AccountDocument;
-import com.ogoglio.xml.BodyDocument;
public class BodyEditorApplet extends Applet {
@@ -74,8 +73,6 @@
private AccountDocument accountDoc = null;
- private BodyDocument bodyDoc = null;
-
private WestPanel westPanel = null;
private BodyPanel bodyPanel = new BodyPanel();
@@ -98,16 +95,12 @@
private class SpacelessUser extends User {
public SpacelessUser(String username) {
- super(new Space(new SpacelessContext(), 1, "Space", "nobody", false, 0), username, new Transform3D(), 1);
+ super(new Space(new SpacelessContext(), 1, "Space", "nobody", false, 0), username, new Transform3D());
}
}
private class SpacelessContext implements Context {
- public BodyDocument getBodyDocument(String username, long bodyID) throws IOException {
- return new BodyDocument(bodyID, username, "Body", 1, 1, 1, 1, 1, false, 2, 1);
- }
-
public InputStream getPageContentStream(long thingID, long pageID) {
return null;
}
@@ -202,23 +195,16 @@
private class WestPanel extends Panel {
Dimension dimension = new Dimension(150, 300);
- HeightPanel heightPanel = new HeightPanel();
-
public WestPanel() {
setPreferredSize(dimension);
setMinimumSize(dimension);
setLayout(new FlowLayout(FlowLayout.CENTER, 0, 5));
setBackground(Color.WHITE);
- add(heightPanel);
}
}
- private BodyDocument bodyToDoc(Body body) {
- return new BodyDocument(body.getBodyID(), user.getUsername(), "Body", body.getHair(), body.getEyes(), body.getNose(), body.getMouth(), body.getFace(), body.isMale(), body.getHeight(), body.getGirth());
- }
-
private class TexturePanel extends Panel {
Dimension dimension = new Dimension(80, 35);
@@ -230,53 +216,7 @@
}
}
- private class HeightPanel extends Panel implements ChangeListener {
- Dimension dimension = new Dimension(150, 150);
- JSlider slider = new JSlider(JSlider.VERTICAL, 150, 210, 200);
-
- public HeightPanel() {
-
- setPreferredSize(dimension);
- setMinimumSize(dimension);
- setLayout(new BorderLayout());
- setBackground(Color.WHITE);
-
- JLabel heightLabel = new JLabel("height:");
- heightLabel.setBackground(Color.WHITE);
- JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
- panel.setBackground(Color.WHITE);
- panel.add(heightLabel);
- add(panel, BorderLayout.NORTH);
-
- int value = (int) (user.getBody().getHeight() * 100);
- slider.setValue(value);
- slider.addChangeListener(this);
- slider.setMajorTickSpacing(20);
- slider.setPaintTicks(true);
- slider.setPaintLabels(true);
- slider.setBackground(Color.WHITE);
- add(slider, BorderLayout.CENTER);
- }
-
- public void stateChanged(ChangeEvent event) {
- if (slider.getModel().getValueIsAdjusting()) {
- return;
- }
- float newHeight = slider.getValue() / 100f;
- if (user.getBody().getHeight() != newHeight) {
- user.getBody().setHeight(newHeight);
- bodyPanel.renderable.setHeight(newHeight);
- try {
- bodyDoc.setHeight(newHeight);
- webClient.updateBody(bodyDoc);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
-
private class WidthPanel extends Panel {
Dimension dimension = new Dimension(150, 25);
@@ -323,7 +263,6 @@
WebAPIAuthenticator authenticator = new WebAPIAuthenticator(wire, descriptor, authCookie);
webClient = new WebAPIClient(descriptor, authenticator, wire);
accountDoc = authenticator.getAccountDocument(true);
- bodyDoc = webClient.getBodyDocument(accountDoc.getUsername(), accountDoc.getDefaultBodyID());
dataManager = new J3DDataManager(true, new TemplateProvider(), new BodyProvider());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-02 02:28:37
|
Revision: 467
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=467&view=rev
Author: trevorolio
Date: 2007-10-01 19:28:41 -0700 (Mon, 01 Oct 2007)
Log Message:
-----------
THIS CHECKIN REQUIRES A DB DROP
Introducing a new world of user configurable body settings. Ditched the old BodyRecord and created three new record types:
BodyDataRecords: hold information about the wadges of data which make up a body's base (e.g. mesh, morphs, textures...)
BodyConfigurationRecords: a user level representation of a body configuration, with a display name and a set of...
BodySettingRecords: morph interpolation values for a given body configuration (e.g. height, 0.9 or chin width, 0.2)
Halfway through documentifying and RESTifying these records. I can smell the day when this is autogenerated from annotated classes.
Modified Paths:
--------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountRecord.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SimMessageHandler.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/xml/server/DocumentFactory.java
maven/trunk/ogoglio-server/src/main/resources/hibernate/migration-1.xml
maven/trunk/ogoglio-server/src/test/java/com/ogoglio/persist/test/PersistTest.java
Added Paths:
-----------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyConfigurationRecord.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyDataRecord.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodySettingRecord.java
Removed Paths:
-------------
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyRecord.java
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java 2007-10-02 02:28:36 UTC (rev 466)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java 2007-10-02 02:28:41 UTC (rev 467)
@@ -61,16 +61,6 @@
}
}
- if (document.getDefaultBodyID() != -1) {
- Query bodyQuery = hibernateSession.getNamedQuery(BodyPersistTasks.BODY_BY_ID);
- bodyQuery.setLong("bodyID", document.getDefaultBodyID());
- BodyRecord bodyRec = (BodyRecord) bodyQuery.uniqueResult();
- if (bodyRec != null && bodyRec.getOwnerUsername().equals(record.getUsername())) {
- dirty = true;
- record.setDefaultBodyID(document.getDefaultBodyID());
- }
- }
-
if (document.getFrozenUntil() != null) {
if (record.getFrozenUntil() != document.getFrozenUntil().getTime()) {
dirty = true;
@@ -150,11 +140,7 @@
record = new AccountRecord(username, accountlevel, email);
hibernateSession.save(record);
- BodyRecord bodyRec = new BodyRecord("Body", record.getUsername());
- hibernateSession.save(bodyRec);
- record.setDefaultBodyID(bodyRec.getBodyID());
- hibernateSession.update(record);
return record;
}
};
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountRecord.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountRecord.java 2007-10-02 02:28:36 UTC (rev 466)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountRecord.java 2007-10-02 02:28:41 UTC (rev 467)
@@ -43,8 +43,6 @@
private long frozenUntil = AccountDocument.NO_TIME_VALUE;
- private long defaultBodyId = 1;
-
public AccountRecord() {
}
@@ -234,14 +232,14 @@
setPasswordHash(null);
return true;
}
- if(cleanPassword(password) == null){
+ if (cleanPassword(password) == null) {
return false;
}
setPasswordHash(encode(password));
return true;
}
-
- public boolean isValidPassword(String password){
+
+ public boolean isValidPassword(String password) {
if (password == null || passwordHash == null || password.trim().length() == 0 || cleanPassword(password) == null) {
return false;
}
@@ -249,7 +247,7 @@
}
//TODO make this salt with some service-specific string
- private String encode(String plaintext){
+ private String encode(String plaintext) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(plaintext.getBytes("UTF-8"));
@@ -274,14 +272,6 @@
this.username = username;
}
- public long getDefaultBodyID() {
- return defaultBodyId;
- }
-
- public void setDefaultBodyID(long defaultBodyID) {
- this.defaultBodyId = defaultBodyID;
- }
-
public void setNotFrozen() {
this.frozenUntil = AccountDocument.NO_TIME_VALUE;
}
Added: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyConfigurationRecord.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyConfigurationRecord.java (rev 0)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyConfigurationRecord.java 2007-10-02 02:28:41 UTC (rev 467)
@@ -0,0 +1,58 @@
+package com.ogoglio.persist;
+
+import com.ogoglio.util.ArgumentUtils;
+
+public class BodyConfigurationRecord {
+
+ private long bodyConfigurationID = -1;
+
+ private String ownerUsername = null;
+
+ private String displayName = null;
+
+ private long bodyDataID = -1;
+
+ public BodyConfigurationRecord(){
+ }
+
+ public BodyConfigurationRecord(String ownerUsername, String displayName, long bodyDataID){
+ ArgumentUtils.assertNotEmpty(ownerUsername);
+ this.ownerUsername = ownerUsername;
+ ArgumentUtils.assertNotEmpty(displayName);
+ this.displayName = displayName;
+ ArgumentUtils.assertNotNegative(bodyDataID);
+ this.bodyDataID = bodyDataID;
+ }
+
+ public long getBodyConfigurationID() {
+ return bodyConfigurationID;
+ }
+
+ public void setBodyConfigurationID(long bodyConfigurationID) {
+ this.bodyConfigurationID = bodyConfigurationID;
+ }
+
+ public String getOwnerUsername() {
+ return ownerUsername;
+ }
+
+ public void setOwnerUsername(String ownerUsername) {
+ this.ownerUsername = ownerUsername;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public long getBodyDataID() {
+ return bodyDataID;
+ }
+
+ public void setBodyDataID(long bodyDataID) {
+ this.bodyDataID = bodyDataID;
+ }
+}
Added: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyDataRecord.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyDataRecord.java (rev 0)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyDataRecord.java 2007-10-02 02:28:41 UTC (rev 467)
@@ -0,0 +1,47 @@
+package com.ogoglio.persist;
+
+import com.ogoglio.util.ArgumentUtils;
+
+public class BodyDataRecord {
+
+ private long bodyDataID = -1;
+
+ private String displayName = null;
+
+ private String fileName = null;
+
+ public BodyDataRecord() {
+ }
+
+ public BodyDataRecord(String displayName, String fileName) {
+ ArgumentUtils.assertNotEmpty(displayName);
+ this.displayName = displayName;
+ ArgumentUtils.assertNotEmpty(fileName);
+ this.fileName = fileName;
+ }
+
+ public long getBodyDataID() {
+ return bodyDataID;
+ }
+
+ public void setBodyDataID(long bodyDataID) {
+ this.bodyDataID = bodyDataID;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+}
Deleted: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java 2007-10-02 02:28:36 UTC (rev 466)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java 2007-10-02 02:28:41 UTC (rev 467)
@@ -1,165 +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.persist;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-
-import com.ogoglio.appdev.persist.HibernateTask;
-import com.ogoglio.appdev.persist.PersistException;
-import com.ogoglio.xml.BodyDocument;
-
-public class BodyPersistTasks {
-
- public static final String BODY_BY_ID = "com.ogoglio.persist.bodyByID";
-
- public static final String BODIES_BY_USERNAME = "com.ogoglio.persist.bodiesByUsername";
-
- public static BodyRecord[] findBodyByUsername(final String username, SessionFactory sessionFactory) throws PersistException {
- HibernateTask task = new HibernateTask() {
- public Object run(Session session) throws PersistException {
- Query query = session.getNamedQuery(BODIES_BY_USERNAME);
- query.setString("username", username);
- return query.list().toArray(new BodyRecord[0]);
- }
- };
- task.setSessionFactory(sessionFactory);
- return (BodyRecord[]) task.execute();
- }
-
- public static BodyDocument update(final BodyRecord record, final BodyDocument bodyDoc, SessionFactory sessionFactory) throws PersistException {
- HibernateTask task = new HibernateTask() {
- public Object run(Session session) throws PersistException {
- boolean dirty = false;
- if (bodyDoc.getDisplayName() != null && !bodyDoc.getDisplayName().equals(record.getDisplayName())) {
- dirty = true;
- record.setDisplayName(bodyDoc.getDisplayName());
- }
- if (bodyDoc.getHairIndex() != record.getHairIndex()) {
- dirty = true;
- record.setHairIndex(bodyDoc.getHairIndex());
- }
- if (bodyDoc.getEyesIndex() != record.getEyesIndex()) {
- dirty = true;
- record.setEyesIndex(bodyDoc.getEyesIndex());
- }
- if (bodyDoc.getNoseIndex() != record.getNoseIndex()) {
- dirty = true;
- record.setNoseIndex(bodyDoc.getNoseIndex());
- }
- if (bodyDoc.getMouthIndex() != record.getMouthIndex()) {
- dirty = true;
- record.setMouthIndex(bodyDoc.getMouthIndex());
- }
- if (bodyDoc.getFaceIndex() != record.getFaceIndex()) {
- dirty = true;
- record.setFaceIndex(bodyDoc.getFaceIndex());
- }
- if (bodyDoc.isMale() != record.isMale()) {
- dirty = true;
- record.setMale(bodyDoc.isMale());
- }
- if(bodyDoc.getHeight() != record.getHeight()){
- dirty = true;
- record.setHeight(bodyDoc.getHeight());
- }
- if(bodyDoc.getGirth() != record.getGirth()){
- dirty = true;
- record.setGirth(bodyDoc.getGirth());
- }
- if (dirty) {
- session.update(record);
- }
- return new BodyDocument(record.getBodyID(), record.getOwnerUsername(), record.getDisplayName(), record.getHairIndex(), record.getEyesIndex(), record.getNoseIndex(), record.getMouthIndex(), record.getFaceIndex(), record.isMale(), record.getHeight(), record.getGirth());
- }
- };
- task.setSessionFactory(sessionFactory);
- return (BodyDocument) task.execute();
- }
-
- public static BodyRecord[] findAllBodies(SessionFactory sessionFactory) throws PersistException {
- HibernateTask task = new HibernateTask() {
- public Object run(Session hibernateSession) {
- Query query = hibernateSession.getNamedQuery("com.ogoglio.persist.bodies");
- return query.list().toArray(new BodyRecord[0]);
- }
- };
- task.setSessionFactory(sessionFactory);
- return (BodyRecord[]) task.execute();
- }
-
-
- public static void update(final BodyRecord record, SessionFactory sessionFactory) throws PersistException {
- HibernateTask task = new HibernateTask() {
- public Object run(Session session) throws PersistException {
- session.update(record);
- return record;
- }
- };
- task.setSessionFactory(sessionFactory);
- task.execute();
- }
-
- //body records are also created in AccountPersistTasks.createAccount
- public static BodyRecord createBody(final String displayName, final String ownerUsername, SessionFactory sessionFactory) throws PersistException {
- HibernateTask task = new HibernateTask() {
- public Object run(Session session) throws PersistException {
- Query accountQuery = session.getNamedQuery(AccountPersistTasks.ACCOUNT_BY_USERNAME);
- accountQuery.setString("username", ownerUsername);
- AccountRecord accountRecord = (AccountRecord) accountQuery.uniqueResult();
- if (accountRecord == null) {
- return null;
- }
- BodyRecord record = new BodyRecord(displayName, ownerUsername);
- session.save(record);
- return record;
- }
- };
- task.setSessionFactory(sessionFactory);
- return (BodyRecord) task.execute();
- }
-
- public static boolean delete(final BodyRecord record, SessionFactory sessionFactory) throws PersistException {
- HibernateTask task = new HibernateTask() {
- public Object run(Session session) throws PersistException {
- Query accountQuery = session.getNamedQuery(AccountPersistTasks.ACCOUNT_BY_USERNAME);
- accountQuery.setString("username", record.getOwnerUsername());
- AccountRecord accountRecord = (AccountRecord) accountQuery.uniqueResult();
- if (accountRecord == null) {
- return null;
- }
- if (accountRecord.getDefaultBodyID() == record.getBodyID()) {
- return Boolean.FALSE;
- }
- session.delete(record);
- return Boolean.TRUE;
- }
- };
- task.setSessionFactory(sessionFactory);
- return task.execute() == Boolean.TRUE;
- }
-
- public static BodyRecord findBodyByID(final long bodyID, SessionFactory sessionFactory) throws PersistException {
- HibernateTask task = new HibernateTask() {
- public Object run(Session session) throws PersistException {
- Query query = session.getNamedQuery(BODY_BY_ID);
- query.setLong("bodyID", bodyID);
- return query.uniqueResult();
- }
- };
- task.setSessionFactory(sessionFactory);
- return (BodyRecord) task.execute();
- }
-}
Added: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java (rev 0)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyPersistTasks.java 2007-10-02 02:28:41 UTC (rev 467)
@@ -0,0 +1,185 @@
+package com.ogoglio.persist;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+
+import com.ogoglio.appdev.persist.HibernateTask;
+import com.ogoglio.appdev.persist.PersistException;
+
+public class BodyPersistTasks {
+
+ public static final String BODY_DATA = "com.ogoglio.persist.bodyData";
+
+ public static final String BODY_DATA_BY_ID = "com.ogoglio.persist.bodyDataByID";
+
+ public static final String BODY_DATA_BY_FILE_NAME = "com.ogoglio.persist.bodyDataByFileName";
+
+ public static final String BODY_CONFIGURATION_BY_USERNAME_AND_BODY_DATA_ID = "com.ogoglio.persist.bodyConfigurationByUsernameAndBodyDataID";
+
+ public static final String BODY_CONFIGURATION_BY_USERNAME = "com.ogoglio.persist.bodyConfigurationByUsername";
+
+ public static final String BODY_CONFIGURATION_BY_ID = "com.ogoglio.persist.bodyConfigurationByID";
+
+ public static final String BODY_SETTINGS_BY_CONFIGURATION_ID = "com.ogoglio.persist.bodySettingsByConfigurationID";
+
+ public static final String BODY_SETTING_BY_CONFIGURATION_ID_AND_SETTING_NAME = "com.ogoglio.persist.bodySettingByConfigurationIDAndSettingName";
+
+ public static BodySettingRecord createOrUpdateBodySetting(final long bodyConfigurationID, final String settingName, final float setting, SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ Query query = session.getNamedQuery(BODY_SETTING_BY_CONFIGURATION_ID_AND_SETTING_NAME);
+ query.setLong("bodyConfigurationID", bodyConfigurationID);
+ query.setString("settingName", settingName);
+
+ if (setting < 0 || setting > 1) {
+ return null;
+ }
+
+ BodySettingRecord record = (BodySettingRecord) query.uniqueResult();
+ if (record != null) {
+ if (Math.abs(setting - record.getSetting()) < 0.0001) {
+ return record;
+ }
+ record.setSetting(setting);
+ return record;
+ }
+
+ Query configQuery = session.getNamedQuery(BODY_CONFIGURATION_BY_ID);
+ configQuery.setLong("bodyConfigurationID", bodyConfigurationID);
+ BodyConfigurationRecord configRecord = (BodyConfigurationRecord) configQuery.uniqueResult();
+ if (configRecord == null) {
+ return null;
+ }
+
+ record = new BodySettingRecord(bodyConfigurationID, settingName, setting);
+ session.save(record);
+ return record;
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return (BodySettingRecord) task.execute();
+ }
+
+ public static BodyConfigurationRecord findOrCreateBodyConfiguration(final String username, final long bodyDataID, SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ Query query = session.getNamedQuery(BODY_CONFIGURATION_BY_USERNAME_AND_BODY_DATA_ID);
+ query.setString("username", username);
+ query.setLong("bodyDataID", bodyDataID);
+
+ BodyConfigurationRecord record = (BodyConfigurationRecord) query.uniqueResult();
+ if (record != null) {
+ return record;
+ }
+
+ record = new BodyConfigurationRecord(username, "New Body", bodyDataID);
+ session.save(record);
+ return record;
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return (BodyConfigurationRecord) task.execute();
+ }
+
+ public static BodyConfigurationRecord[] findBodyConfigurationByUsername(final String username, SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ Query query = session.getNamedQuery(BODY_CONFIGURATION_BY_USERNAME);
+ query.setString("username", username);
+ return query.list().toArray(new BodyConfigurationRecord[0]);
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return (BodyConfigurationRecord[]) task.execute();
+ }
+
+ public static BodyConfigurationRecord findBodyConfigurationByID(final long bodyConfigurationID, SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ Query query = session.getNamedQuery(BODY_CONFIGURATION_BY_ID);
+ query.setLong("bodyConfigurationID", bodyConfigurationID);
+ return query.uniqueResult();
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return (BodyConfigurationRecord) task.execute();
+ }
+
+ public static BodySettingRecord[] findBodySettingsByConfigurationID(final long bodyConfigurationID, SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ Query query = session.getNamedQuery(BODY_SETTINGS_BY_CONFIGURATION_ID);
+ query.setLong("bodyConfigurationID", bodyConfigurationID);
+ return query.list().toArray(new BodySettingRecord[0]);
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return (BodySettingRecord[]) task.execute();
+ }
+
+ public static BodyDataRecord findBodyDataRecord(final String fileName, SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ Query query = session.getNamedQuery(BODY_DATA_BY_FILE_NAME);
+ query.setString("fileName", fileName);
+ return query.uniqueResult();
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return (BodyDataRecord) task.execute();
+ }
+
+ public static BodyDataRecord findOrCreateBodyDataRecord(final String displayName, final String fileName, SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ Query query = session.getNamedQuery(BODY_DATA_BY_FILE_NAME);
+ query.setString("fileName", fileName);
+ BodyDataRecord record = (BodyDataRecord) query.uniqueResult();
+ if (record != null) {
+ return record;
+ }
+
+ record = new BodyDataRecord(displayName, fileName);
+ session.save(record);
+ return record;
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return (BodyDataRecord) task.execute();
+ }
+
+ public static BodyDataRecord findBodyDataByID(final long bodyDataID, SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ Query query = session.getNamedQuery(BODY_DATA_BY_ID);
+ query.setLong("bodyDataID", bodyDataID);
+ return query.uniqueResult();
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return (BodyDataRecord) task.execute();
+ }
+
+ public static boolean deleteBodyData(final BodyDataRecord bodyDataRecord, SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ session.delete(bodyDataRecord);
+ return Boolean.TRUE;
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return Boolean.TRUE.equals(task.execute());
+ }
+
+ public static BodyDataRecord[] findAllBodyDataRecords(SessionFactory sessionFactory) throws PersistException {
+ HibernateTask task = new HibernateTask() {
+ public Object run(Session session) throws PersistException {
+ Query query = session.getNamedQuery(BODY_DATA);
+ return query.list().toArray(new BodyDataRecord[0]);
+ }
+ };
+ task.setSessionFactory(sessionFactory);
+ return (BodyDataRecord[]) task.execute();
+ }
+}
Deleted: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyRecord.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyRecord.java 2007-10-02 02:28:36 UTC (rev 466)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodyRecord.java 2007-10-02 02:28:41 UTC (rev 467)
@@ -1,152 +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.persist;
-
-import com.ogoglio.util.ArgumentUtils;
-
-public class BodyRecord {
-
- private long bodyID = -1;
-
- private String displayName = null;
-
- private String ownerUsername = null;
-
- private int hairIndex = 0, eyesIndex = 0, noseIndex = 0, mouthIndex = 0, faceIndex = 0;
-
- private float girth = 1;
-
- private float height = 2;
-
- private boolean male = true;
-
- public BodyRecord() {
- }
-
- public BodyRecord(String displayName, String ownerUsername) {
- ArgumentUtils.assertNotNull(displayName);
- this.displayName = displayName;
-
- ArgumentUtils.assertNotNull(ownerUsername);
- this.ownerUsername = ownerUsername;
- }
-
- public float getGirth() {
- return girth;
- }
-
- public void setGirth(float girth) {
- this.girth = girth;
- }
-
- public float getHeight() {
- return height;
- }
-
- public void setHeight(float height) {
- this.height = height;
- }
-
- public boolean isMale() {
- return male;
- }
-
- public void setMale(boolean male) {
- this.male = male;
- }
-
- public int getEyesIndex() {
- return eyesIndex;
- }
-
- public void setEyesIndex(int eyesIndex) {
- ArgumentUtils.assertNotNegative(eyesIndex);
- this.eyesIndex = eyesIndex;
- }
-
- public int getFaceIndex() {
- return faceIndex;
- }
-
- public void setFaceIndex(int faceIndex) {
- ArgumentUtils.assertNotNegative(faceIndex);
- this.faceIndex = faceIndex;
- }
-
- public int getHairIndex() {
- return hairIndex;
- }
-
- public void setHairIndex(int hairIndex) {
- ArgumentUtils.assertNotNegative(hairIndex);
- this.hairIndex = hairIndex;
- }
-
- public boolean getMale() {
- return male;
- }
- public int getMouthIndex() {
- return mouthIndex;
- }
-
- public void setMouthIndex(int mouthIndex) {
- ArgumentUtils.assertNotNegative(mouthIndex);
- this.mouthIndex = mouthIndex;
- }
-
- public int getNoseIndex() {
- return noseIndex;
- }
-
- public void setNoseIndex(int noseIndex) {
- ArgumentUtils.assertNotNegative(noseIndex);
- this.noseIndex = noseIndex;
- }
-
- public long getBodyID() {
- return bodyID;
- }
-
- public void setBodyID(long bodyID) {
- this.bodyID = bodyID;
- }
-
- public String getDisplayName() {
- return displayName;
- }
-
- public void setDisplayName(String displayName) {
- this.displayName = displayName;
- }
-
- public String getOwnerUsername() {
- return ownerUsername;
- }
-
- public void setOwnerUsername(String ownerUsername) {
- this.ownerUsername = ownerUsername;
- }
-
- public boolean equals(Object obj) {
- if (obj == null || !(obj instanceof BodyRecord)) {
- return false;
- }
- return getBodyID() == ((BodyRecord) obj).getBodyID();
- }
-
- public int hashCode() {
- return ("BodyRecord-" + getBodyID()).hashCode();
- }
-
-}
Added: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodySettingRecord.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodySettingRecord.java (rev 0)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/BodySettingRecord.java 2007-10-02 02:28:41 UTC (rev 467)
@@ -0,0 +1,61 @@
+package com.ogoglio.persist;
+
+import com.ogoglio.util.ArgumentUtils;
+
+public class BodySettingRecord {
+
+ private long bodySettingID = -1;
+
+ private long bodyConfigurationID = -1;
+
+ private String settingName = null;
+
+ private float setting = -1;
+
+ public BodySettingRecord(){
+ }
+
+ public BodySettingRecord(long configurationID, String settingName, float setting){
+ ArgumentUtils.assertNotNegative(configurationID);
+ this.bodyConfigurationID = configurationID;
+ ArgumentUtils.assertNotEmpty(settingName);
+ this.settingName = settingName;
+ ArgumentUtils.assertNotNegative(setting);
+ if(setting > 1){
+ setting = 1;
+ }
+ this.setting = setting;
+ }
+
+ public long getBodySettingID() {
+ return bodySettingID;
+ }
+
+ public void setBodySettingID(long bodySettingID) {
+ this.bodySettingID = bodySettingID;
+ }
+
+ public long getBodyConfigurationID() {
+ return bodyConfigurationID;
+ }
+
+ public void setBodyConfigurationID(long bodyConfigurationID) {
+ this.bodyConfigurationID = bodyConfigurationID;
+ }
+
+ public String getSettingName() {
+ return settingName;
+ }
+
+ public void setSettingName(String settingName) {
+ this.settingName = settingName;
+ }
+
+ public float getSetting() {
+ return setting;
+ }
+
+ public void setSetting(float setting) {
+ this.setting = setting;
+ }
+}
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SimMessageHandler.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SimMessageHandler.java 2007-10-02 02:28:36 UTC (rev 466)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SimMessageHandler.java 2007-10-02 02:28:41 UTC (rev 467)
@@ -66,7 +66,7 @@
} else if (message.getPayload() instanceof PayloadFactory.AuthenticatedPayload) {
PayloadFactory.AuthenticatedPayload payload = (PayloadFactory.AuthenticatedPayload) message.getPayload();
- spaceSim.userAuthenticated(payload.getUsername(), payload.getBodyID());
+ spaceSim.userAuthenticated(payload.getUsername());
} else if (message.getPayload() instanceof PayloadFactory.LoggedOutPayload) {
PayloadFactory.LoggedOutPayload payload = (PayloadFactory.LoggedOutPayload) message.getPayload();
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-10-02 02:28:36 UTC (rev 466)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/sim/SpaceSimulator.java 2007-10-02 02:28:41 UTC (rev 467)
@@ -43,10 +43,8 @@
import com.ogoglio.util.ArgumentUtils;
import com.ogoglio.util.BlockingQueue;
import com.ogoglio.util.Log;
-import com.ogoglio.util.UIConstants;
import com.ogoglio.util.BlockingQueue.QueueClosedException;
import com.ogoglio.viewer.j3d.J3DRenderer;
-import com.ogoglio.xml.BodyDocument;
import com.ogoglio.xml.DoorDocument;
import com.ogoglio.xml.PageDocument;
import com.ogoglio.xml.SettingDocument;
@@ -158,10 +156,6 @@
public InputStream getPageContentStream(long thingID, long pageID) {
return null; //we don't need to render pages, do we?
}
-
- public BodyDocument getBodyDocument(String username, long bodyID) throws IOException {
- return new BodyDocument(bodyID, username, "Body", 0, 0, 0, 0, 0, false, 2, 1);
- }
}
public synchronized void cleanup() {
@@ -743,8 +737,8 @@
return results;
}
- public void userAuthenticated(String username, long bodyID) {
- userCounts.incrementUserCount(username, bodyID);
+ public void userAuthenticated(String username) {
+ userCounts.incrementUserCount(username);
Log.info(username + " logged into " + space.getSpaceID() + ": " + space.getDisplayName());
}
@@ -792,19 +786,18 @@
}
}
- synchronized int incrementUserCount(String username, long bodyID) {
+ synchronized int incrementUserCount(String username) {
Integer count = (Integer) map.get(username);
if (count == null) {
count = new Integer(1);
Transform3D position = new Transform3D();
position.setTranslation(new Vector3d(0, 0, 0));
- User user = new User(space, username, position, bodyID);
+ User user = new User(space, username, position);
space.addUser(user);
SpaceEvent spaceEvent = new SpaceEvent(SpaceEvent.ADD_USER_EVENT);
spaceEvent.setProperty(SpaceEvent.USERNAME, username);
spaceEvent.setPointAndOrientationData(user.getPosition());
- spaceEvent.setProperty(SpaceEvent.BODY_ID, new Long(bodyID));
handleSpaceEvent(spaceEvent);
} else {
count = new Integer(count.intValue() + 1);
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2007-10-02 02:28:36 UTC (rev 466)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/AccountServlet.java 2007-10-02 02:28:41 UTC (rev 467)
@@ -14,7 +14,6 @@
package com.ogoglio.site;
import java.io.IOException;
-import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Map;
@@ -28,7 +27,6 @@
import nanoxml.XMLElement;
import com.ogoglio.appdev.persist.PersistException;
-import com.ogoglio.appdev.servlet.DescendingSiteResource;
import com.ogoglio.appdev.servlet.Four04SiteResource;
import com.ogoglio.appdev.servlet.SiteResource;
import com.ogoglio.client.WebAPIClientWire;
@@ -37,11 +35,8 @@
import com.ogoglio.mail.MailFormatter;
import com.ogoglio.mail.MailSendException;
import com.ogoglio.mail.MailTemplateFactory;
-import com.ogoglio.media.MediaService;
import com.ogoglio.persist.AccountPersistTasks;
import com.ogoglio.persist.AccountRecord;
-import com.ogoglio.persist.BodyPersistTasks;
-import com.ogoglio.persist.BodyRecord;
import com.ogoglio.persist.PendingEmailValidationRecord;
import com.ogoglio.persist.PendingEmailValidationTasks;
import com.ogoglio.persist.PossessionPersistTasks;
@@ -55,11 +50,8 @@
import com.ogoglio.persist.SpaceRecord;
import com.ogoglio.persist.TemplatePersistTasks;
import com.ogoglio.persist.TemplateRecord;
-import com.ogoglio.sim.Sim;
import com.ogoglio.util.Log;
-import com.ogoglio.util.StreamUtils;
import com.ogoglio.xml.AccountDocument;
-import com.ogoglio.xml.BodyDocument;
import com.ogoglio.xml.PossessionDocument;
import com.ogoglio.xml.ServiceStateDocument;
import com.ogoglio.xml.TemplateDocument;
@@ -82,9 +74,9 @@
AccountDocument result = null;
if (authed) {
- result = new AccountDocument(account.getUsername(), account.getAccountlevel(), account.getFirstName(), account.getLastName(), account.getHomepage(), null, account.getEmail(), account.getCreationDate(), null, account.getFrozenUntil(), account.getDefaultBodyID());
+ result = new AccountDocument(account.getUsername(), account.getAccountlevel(), account.getFirstName(), account.getLastName(), account.getHomepage(), null, account.getEmail(), account.getCreationDate(), null, account.getFrozenUntil());
} else {
- result = new AccountDocument(account.getUsername(), null, null, null, null, null, null, account.getCreationDate(), null, account.getFrozenUntil(), account.getDefaultBodyID());
+ result = new AccountDocument(account.getUsername(), null, null, null, null, null, null, account.getCreationDate(), null, account.getFrozenUntil());
}
return result;
}
@@ -213,7 +205,6 @@
private class AccountResource extends AuthenticatedSiteResource {
public AccountResource() {
super(SiteResource.WILDCARD_ELEMENT, true, getSessionFactory());
- addSubResource(new BodiesResource());
addSubResource(new SpacesResource());
addSubResource(new TemplatesResource());
addSubResource(new MembershipResource());
@@ -650,238 +641,5 @@
}
}
- private class BodyGeometryResource extends DescendingSiteResource {
- public BodyGeometryResource() {
- super("geometry");
- }
- public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
- String usernameParam = pathElements[1];
- try {
- AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
- if (authedAccount == null) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
-
- AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
- if (requestedAccount == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- if (!requestedAccount.getUsername().equals(authedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
-
- long bodyID = Long.parseLong(pathElements[3]);
- BodyRecord record = BodyPersistTasks.findBodyByID(bodyID, getSessionFactory());
- if (record == null || !record.getOwnerUsername().equals(requestedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- if (pathElements.length == 5) {
- response.setStatus(HttpServletResponse.SC_OK);
- return;
- } else if ("data".equals(pathElements[pathElements.length - 1])) {
- getMediaService().write(MediaService.getBodyGeometryName(bodyID), request.getInputStream(), Sim.MAX_GEOMETRY_SIZE);
- } else {
- getMediaService().write(MediaService.getBodyResourceName(bodyID, pathElements[pathElements.length - 1]), request.getInputStream(), Sim.MAX_GEOMETRY_RESOURCE_SIZE);
- }
- response.setStatus(HttpServletResponse.SC_OK);
- return;
- } catch (PersistException e) {
- e.printStackTrace();
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- return;
- }
- }
-
- public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements) throws ServletException, IOException {
- String usernameParam = pathElements[1];
- try {
- AccountRecord authedAccount = AuthServlet.getAuthedAccountRecord(request, getSessionFactory());
- if (authedAccount == null) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
-
- AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
- if (requestedAccount == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- long bodyID = Long.parseLong(pathElements[3]);
- BodyRecord record = BodyPersistTasks.findBodyByID(bodyID, getSessionFactory());
- if (record == null || !record.getOwnerUsername().equals(requestedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- if (pathElements.length == 5) {
- sendStringResponse("This is where a geometry document would be.", "text/plain", response);
- return;
- }
-
- InputStream data = null;
- if ("data".equals(pathElements[pathElements.length - 1])) {
- data = getMediaService().getData(MediaService.getBodyGeometryName(bodyID));
- } else {
- data = getMediaService().getData(MediaService.getBodyResourceName(bodyID, pathElements[pathElements.length - 1]));
- }
- if (data == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
- response.setStatus(HttpServletResponse.SC_OK);
- StreamUtils.write(data, response.getOutputStream());
- } catch (PersistException e) {
- e.printStackTrace();
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- return;
- }
- }
- }
-
- private class BodyResource extends AuthenticatedSiteResource {
- public BodyResource() {
- super(SiteResource.LONG_ELEMENT, false, getSessionFactory());
- addSubResource(new BodyGeometryResource());
- }
-
- public void doDelete(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
- String usernameParam = pathElements[1];
- AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
- if (requestedAccount == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- if (authedAccount == null || !authedAccount.getUsername().equals(requestedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
-
- long bodyID = Long.parseLong(pathElements[pathElements.length - 1]);
- BodyRecord record = BodyPersistTasks.findBodyByID(bodyID, getSessionFactory());
- if (record == null || !record.getOwnerUsername().equals(requestedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- if (BodyPersistTasks.delete(record, getSessionFactory()) == true) {
- response.setStatus(HttpServletResponse.SC_OK);
- } else {
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- }
- }
-
- public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
- String usernameParam = pathElements[1];
- AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
- if (requestedAccount == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- if (authedAccount == null || !authedAccount.getUsername().equals(requestedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
-
- long bodyID = Long.parseLong(pathElements[pathElements.length - 1]);
- BodyRecord record = BodyPersistTasks.findBodyByID(bodyID, getSessionFactory());
- if (record == null || !record.getOwnerUsername().equals(requestedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- if (!requestedAccount.getUsername().equals(record.getOwnerUsername())) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- BodyDocument bodyDoc = new BodyDocument(parseXML(request.getInputStream()));
- bodyDoc = BodyPersistTasks.update(record, bodyDoc, getSessionFactory());
- if (bodyDoc != null) {
- sendStringResponse(bodyDoc.toString(), "text/xml", response);
- } else {
- response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- }
- }
-
- public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
- String usernameParam = pathElements[1];
- AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
- if (requestedAccount == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- long bodyID = Long.parseLong(pathElements[pathElements.length - 1]);
- BodyRecord record = BodyPersistTasks.findBodyByID(bodyID, getSessionFactory());
- if (record == null || !record.getOwnerUsername().equals(requestedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- BodyDocument doc = DocumentFactory.documentFromRecord(record);
- sendStringResponse(doc.toString(), "text/xml", response);
- }
- }
-
- private class BodiesResource extends AuthenticatedSiteResource {
-
- public BodiesResource() {
- super("body", true, getSessionFactory());
- addSubResource(new BodyResource());
- }
-
- public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
- String usernameParam = pathElements[pathElements.length - 2];
- AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
- if (requestedAccount == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- if (!authedAccount.getUsername().equals(requestedAccount.getUsername())) {
- response.setStatus(HttpServletResponse.SC_FORBIDDEN);
- return;
- }
-
- XMLElement bodyElement = parseXML(request.getInputStream());
- String displayName = bodyElement.getStringAttribute(BodyDocument.DISPLAY_NAME);
- BodyRecord bodyRecord = BodyPersistTasks.createBody(displayName, authedAccount.getUsername(), getSessionFactory());
- BodyDocument result = DocumentFactory.documentFromRecord(bodyRecord);
- response.setStatus(HttpServletResponse.SC_OK);
- response.setContentType("text/xml");
- response.getOutputStream().write(result.toString().getBytes());
- return;
- }
-
- public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
- String usernameParam = pathElements[pathElements.length - 2];
- AccountRecord requestedAccount = AccountPersistTasks.findAccountByUsername(usernameParam, getSessionFactory());
- if (requestedAccount == null) {
- response.setStatus(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
-
- XMLElement result = new XMLElement("list");
-
- BodyRecord[] bodyRecords = BodyPersistTasks.findBodyByUsername(requestedAccount.getUsername(), getSessionFactory());
- for (int i = 0; i < bodyRecords.length; i++) {
- result.addChild(DocumentFactory.documentFromRecord(bodyRecords[i]).toElement());
- }
-
- response.setStatus(HttpServletResponse.SC_OK);
- response.setContentType("text/xml");
- response.getOutputStream().write(result.toString().getBytes());
- return;
- }
- }
}
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-10-02 02:28:36 UTC (rev 466)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/MessageProxy.java 2007-10-02 02:28:41 UTC (rev 467)
@@ -124,7 +124,6 @@
}
String username = null;
- long bodyID = -1;
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."));
@@ -132,7 +131,6 @@
return;
}
username = payload.getLoginCookie();
- bodyID = -1;
} else {
AccountRecord accountRecord = AccountPersistTasks.findAccountByCookie(payload.getLoginCookie(), sessionFactory);
@@ -143,7 +141,6 @@
return;
}
username = accountRecord.getUsername();
- bodyID = accountRecord.getDefaultBodyID();
}
SpaceRecord spaceRecord = SpacePersistTasks.findSpaceBySpaceID(payload.getSpaceID(), sessionFactory);
@@ -193,7 +190,7 @@
Message message = new Message(channelServer.getLocator(), request.getOrigin(), payload.getSpaceID(), new PayloadFactory.AuthenticationSuccessPayload(username));
sourceChannel.sendMessage(message);
- Message simMessage = new Message(channelServer.getLocator(), request.getOrigin(), payload.getSpaceID(), new PayloadFactory.AuthenticatedPayload(username, bodyID));
+ Message simMessage = new Message(channelServer.getLocator(), request.getOrigin(), payload.getSpaceID(), new PayloadFactory.AuthenticatedPayload(username));
sendMessageToSpace(locatorAuth.simHost, locatorAuth.eventPort, locatorAuth.spaceID, simMessage);
return;
} else if (request.getPayload() instanceof PayloadFactory.LogoutPayload) {
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java 2007-10-02 02:28:36 UTC (rev 466)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/SpaceServlet.java 2007-10-02 02:28:41 UTC (rev 467)
@@ -33,6 +33,8 @@
import com.ogoglio.client.WebAPIUtil;
import com.ogoglio.media.MediaService;
import com.ogoglio.persist.AccountRecord;
+import com.ogoglio.persist.BodyDataRecord;
+import com.ogoglio.persist.BodyPersistTasks;
import com.ogoglio.persist.ServiceStateRecord;
import com.ogoglio.persist.ServiceStateTasks;
import com.ogoglio.persist.SimPersistTasks;
@@ -44,6 +46,7 @@
import com.ogoglio.sim.site.SimServlet;
import com.ogoglio.util.Log;
import com.ogoglio.xml.AccountDocument;
+import com.ogoglio.xml.BodyDataDocument;
import com.ogoglio.xml.ServiceDocument;
import com.ogoglio.xml.ServiceStateDocument;
import com.ogoglio.xml.SimDocument;
@@ -97,6 +100,7 @@
addSubResource(new SimResource());
addSubResource(new StateResource());
addSubResource(new SpaceResource());
+ addSubResource(new BodiesResource());
}
public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord authedAccount) throws PersistException, ServletException, IOException {
@@ -110,11 +114,11 @@
return;
}
String accountLevel = authedAccount.getAccountlevel();
- if(!AccountDocument.ACCOUNT_LEVEL_ADMIN.equals(accountLevel) && !AccountDocument.ACCOUNT_LEVEL_ADVANCED.equals(accountLevel) && !AccountDocument.ACCOUNT_LEVEL_PRO.equals(accountLevel)){
+ if (!AccountDocument.ACCOUNT_LEVEL_ADMIN.equals(accountLevel) && !AccountDocument.ACCOUNT_LEVEL_ADVANCED.equals(accountLevel) && !AccountDocument.ACCOUNT_LEVEL_PRO.equals(accountLevel)) {
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
return;
}
-
+
XMLElement spaceElement = parseXML(request.getInputStream());
if (!SpaceDocument.NAME.equals(spaceElement.getName())) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
@@ -135,6 +139,70 @@
}
}
+ private class BodiesResource extends AuthenticatedSiteResource {
+ public BodiesResource() {
+ super("body", false, getSessionFactory());
+ addSubResource(new BodyResource());
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord accountRecord) throws PersistException, IOException {
+ BodyDataRecord[] bodyDataRecords = BodyPersistTasks.findAllBodyDataRecords(getSessionFactory());
+ XMLElement listElement = new XMLElement("list");
+ for (int i = 0; i < bodyDataRecords.length; i++) {
+ listElement.addChild(DocumentFactory.documentFromRecord(bodyDataRecords[i]).toElement());
+ }
+ sendStringResponse(listElement.toString(), "text/xml", response);
+ }
+
+ public void doPost(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord accountRecord) throws PersistException, IOException {
+ if (accountRecord == null || !AccountDocument.ACCOUNT_LEVEL_ADMIN.equals(accountRecord.getAccountlevel())) {
+ response.setStatus(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
+
+ BodyDataDocument bodyDataDoc = new BodyDataDocument(parseXML(request.getInputStream()));
+ BodyDataRecord record = BodyPersistTasks.findOrCreateBodyDataRecord(bodyDataDoc.getDisplayName(), bodyDataDoc.getFileName(), getSessionFactory());
+ if (record == null) {
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ return;
+ }
+
+ sendStringResponse(DocumentFactory.documentFromRecord(record).toString(), "text/xml", response);
+ }
+ }
+
+ private class BodyResource extends AuthenticatedSiteResource {
+ public BodyResource() {
+ super(SiteResource.LONG_ELEMENT, false, getSessionFactory());
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord accountRecord) throws PersistException, IOException {
+ long bodyDataID = Long.parseLong(pathElements[pathElements.length - 1]);
+ BodyDataRecord bodyDataRecord = BodyPersistTasks.findBodyDataByID(bodyDataID, getSessionFactory());
+ if(bodyDataRecord == null){
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+ sendStringResponse(DocumentFactory.documentFromRecord(bodyDataRecord).toString(), "text/xml", response);
+ }
+
+ public void doDelete(HttpServletRequest request, HttpServletResponse response, String[] pathElements, AccountRecord accountRecord) throws PersistException, IOException {
+ long bodyDataID = Long.parseLong(pathElements[pathElements.length - 1]);
+ BodyDataRecord bodyDataRecord = BodyPersistTasks.findBodyDataByID(bodyDataID, getSessionFactory());
+ if(bodyDataRecord == null){
+ response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
+
+ if(accountRecord == null || !AccountDocument.ACCOUNT_LEVEL_ADMIN.equals(accountRecord.getAccountlevel())){
+ response.setStatus(HttpServletResponse.SC_FORBIDDEN);
+ return;
+ }
+ BodyPersistTasks.deleteBodyData(bodyDataRecord, getSessionFactory());
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
+ }
+
private class StateResource extends AuthenticatedSiteResource {
public StateResource() {
super("state", false, getSessionFactory());
@@ -272,14 +340,14 @@
}
private boolean canUseMethodOnSpace(String method, AccountRecord authedAccount, SpaceRecord spaceRecord) throws PersistException {
- if(("HEAD".equals(method) || "GET".equals(method))){
+ if (("HEAD".equals(method) || "GET".equals(method))) {
return SpacePersistTasks.canReadSpac...
[truncated message content] |
|
From: <tre...@us...> - 2007-10-02 02:28:31
|
Revision: 466
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=466&view=rev
Author: trevorolio
Date: 2007-10-01 19:28:36 -0700 (Mon, 01 Oct 2007)
Log Message:
-----------
THIS CHECKIN REQUIRES A DB DROP
Introducing a new world of user configurable body settings. Ditched the old BodyRecord and created three new record types:
BodyDataRecords: hold information about the wadges of data which make up a body's base (e.g. mesh, morphs, textures...)
BodyConfigurationRecords: a user level representation of a body configuration, with a display name and a set of...
BodySettingRecords: morph interpolation values for a given body configuration (e.g. height, 0.9 or chin width, 0.2)
Halfway through documentifying and RESTifying these records. I can smell the day when this is autogenerated from annotated classes.
Modified Paths:
--------------
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/WebAPITest.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-10-02 02:28:33 UTC (rev 465)
+++ maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java 2007-10-02 02:28:36 UTC (rev 466)
@@ -55,7 +55,7 @@
import com.ogoglio.util.WebConstants;
import com.ogoglio.xml.AccountDocument;
import com.ogoglio.xml.AuthDocument;
-import com.ogoglio.xml.BodyDocument;
+import com.ogoglio.xml.BodyDataDocument;
import com.ogoglio.xml.DoorDocument;
import com.ogoglio.xml.PageDocument;
import com.ogoglio.xml.PossessionDocument;
@@ -226,6 +226,15 @@
assertNull(ac2.getFrozenUntil());
assertEquals(AccountDocument.ACCOUNT_LEVEL_BASIC, accountDoc.getAccountLevel());
+
+ BodyDataDocument bodyDataDoc = adminWebClient.createBodyData("Super Puppy", "ogoglio-body-superpuppy.jar");
+ assertNotNull(bodyDataDoc);
+ assertFalse(bodyDataDoc.getBodyDataID() == -1);
+ bodyDataDoc = adminWebClient.getBodyDataDocument(bodyDataDoc.getBodyDataID());
+ assertNotNull(bodyDataDoc);
+ assertEquals("Super Puppy", bodyDataDoc.getDisplayName());
+ adminWebClient.deleteBodyData(bodyDataDoc.getBodyDataID());
+
}
public void testWebAPIClient() throws IOException {
@@ -255,8 +264,6 @@
checkSettings(spaceDocument.getSpaceID(), advancedClient);
- checkBody(advancedClient, advancedAuth);
-
TemplateDocument newTemplateDoc = checkTemplateScriptAPI(advancedClient);
ThingDocument[] thingDocs = checkTemplateGeomMaterialsAndPossessions(advancedClient, newTemplateDoc, spaceDocument);
@@ -514,32 +521,6 @@
}
- private void checkBody(WebAPIClient webClient1, WebAPIAuthenticator authenticator) throws IOException {
- AccountDocument ownerDoc = authenticator.getAccountDocument(true);
- assertNotNull(ownerDoc);
- assertEquals(USERNAME1, ownerDoc.getUsername());
- long defaultBody = ownerDoc.getDefaultBodyID();
- BodyDocument bodyDoc = webClient1.createBody("Testing Body");
- assertFalse(bodyDoc.getBodyID() == -1);
- assertEquals(ownerDoc.getUsername(), bodyDoc.getOwnerUsername());
- assertEquals(0, bodyDoc.getHairIndex());
- assertEquals(0, bodyDoc.getEyesIndex());
- assertEquals(0, bodyDoc.getNoseIndex());
- assertEquals(0, bodyDoc.getMouthIndex());
- assertEquals(0, bodyDoc.getFaceIndex());
- ownerDoc = webClient1.setDefaultBody(bodyDoc.getBodyID());
- assertEquals(bodyDoc.getBodyID(), ownerDoc.getDefaultBodyID());
- assertEquals(ownerDoc.getUsername(), bodyDoc.getOwnerUsername());
- bodyDoc.setEyesIndex(3);
- bodyDoc = webClient1.updateBody(bodyDoc);
- assertEquals(3, bodyDoc.getEyesIndex());
- assertFalse(webClient1.deleteBody(bodyDoc.getBodyID()));
- webClient1.setDefaultBody(defaultBody);
- assertTrue(webClient1.deleteBody(bodyDoc.getBodyID()));
- ownerDoc = webClient1.setDefaultBody(bodyDoc.getBodyID());
- assertEquals(defaultBody, ownerDoc.getDefaultBodyID());
- }
-
private SpaceDocument checkSpaceSeaLevel(WebAPIClient webClient1, SpaceDocument spaceDocument) throws IOException {
assertFalse(spaceDocument.getDisplaySea());
Modified: maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/WebAPITest.java
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/WebAPITest.java 2007-10-02 02:28:33 UTC (rev 465)
+++ maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/WebAPITest.java 2007-10-02 02:28:36 UTC (rev 466)
@@ -47,7 +47,7 @@
notAuthedAuthDoc = new AuthDocument("Ian", false);
authedAuthDoc = new AuthDocument("Ian", true);
- accountDoc = new AccountDocument(authedAuthDoc.getUsername(), AccountDocument.ACCOUNT_LEVEL_ADVANCED, null, null, null, null, null, AccountDocument.NO_TIME_VALUE, null, AccountDocument.NO_TIME_VALUE, -1);
+ accountDoc = new AccountDocument(authedAuthDoc.getUsername(), AccountDocument.ACCOUNT_LEVEL_ADVANCED, null, null, null, null, null, AccountDocument.NO_TIME_VALUE, null, AccountDocument.NO_TIME_VALUE);
} catch (URISyntaxException e) {
fail("Bad URIL: " + e);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tre...@us...> - 2007-10-02 02:28:30
|
Revision: 465
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=465&view=rev
Author: trevorolio
Date: 2007-10-01 19:28:33 -0700 (Mon, 01 Oct 2007)
Log Message:
-----------
THIS CHECKIN REQUIRES A DB DROP
Introducing a new world of user configurable body settings. Ditched the old BodyRecord and created three new record types:
BodyDataRecords: hold information about the wadges of data which make up a body's base (e.g. mesh, morphs, textures...)
BodyConfigurationRecords: a user level representation of a body configuration, with a display name and a set of...
BodySettingRecords: morph interpolation values for a given body configuration (e.g. height, 0.9 or chin width, 0.2)
Halfway through documentifying and RESTifying these records. I can smell the day when this is autogenerated from annotated classes.
Modified Paths:
--------------
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/client/model/Space.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/PayloadFactory.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/ArgumentUtils.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skin.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/AccountDocument.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/UserDocument.java
maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java
Added Paths:
-----------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDataDocument.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodySettingDocument.java
Removed Paths:
-------------
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Body.java
maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDocument.java
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/SpaceClient.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -40,9 +40,7 @@
import com.ogoglio.message.TCPChannel;
import com.ogoglio.util.ArgumentUtils;
import com.ogoglio.util.Log;
-import com.ogoglio.util.UIConstants;
import com.ogoglio.xml.AccountDocument;
-import com.ogoglio.xml.BodyDocument;
import com.ogoglio.xml.DoorDocument;
import com.ogoglio.xml.PageDocument;
import com.ogoglio.xml.ShapeDocument;
@@ -127,7 +125,7 @@
//can't use spaceDoc list of users because it doesn't include the user that just authed (me!)
UserDocument[] userDocs = webClient.getUserDocuments(spaceID);
for (int i = 0; i < userDocs.length; i++) {
- space.addUser(new User(space, userDocs[i].getUsername(), userDocs[i].getTransform(), userDocs[i].getBodyID()));
+ space.addUser(new User(space, userDocs[i].getUsername(), userDocs[i].getTransform()));
}
ThingDocument[] thingDocs = spaceDoc.getThingDocuments();
@@ -291,7 +289,7 @@
if (message.getPayload() instanceof PayloadFactory.SpaceEventPayload) {
SpaceEvent event = ((PayloadFactory.SpaceEventPayload) message.getPayload()).getSpaceEvent();
if (SpaceEvent.ADD_USER_EVENT.equals(event.getName())) {
- User user = new User(space, event.getStringProperty(SpaceEvent.USERNAME), event.getTransform(), event.getLongProperty(SpaceEvent.BODY_ID).longValue());
+ User user = new User(space, event.getStringProperty(SpaceEvent.USERNAME), event.getTransform());
space.addUser(user);
} else if (SpaceEvent.REMOVE_USER_EVENT.equals(event.getName())) {
User user = space.getUser(event.getStringProperty(SpaceEvent.USERNAME));
@@ -693,10 +691,6 @@
}
}
- public BodyDocument getBodyDocument(String username, long bodyID) throws IOException {
- return webClient.getBodyDocument(username, bodyID);
- }
-
public WebAPIClient getWebClient() {
return webClient;
}
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-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIClient.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -29,7 +29,7 @@
import com.ogoglio.util.StreamUtils;
import com.ogoglio.xml.AccountDocument;
import com.ogoglio.xml.AuthDocument;
-import com.ogoglio.xml.BodyDocument;
+import com.ogoglio.xml.BodyDataDocument;
import com.ogoglio.xml.DoorDocument;
import com.ogoglio.xml.PageDocument;
import com.ogoglio.xml.PossessionDocument;
@@ -59,7 +59,7 @@
}
public AccountDocument createAccount(String username, String accountLevel, String firstName, String lastName, String homepage, String email, String password) throws IOException {
- AccountDocument newAccountDoc = new AccountDocument(username, accountLevel, firstName, lastName, homepage, password, email, AccountDocument.NO_TIME_VALUE, null, AccountDocument.NO_TIME_VALUE, -1);
+ AccountDocument newAccountDoc = new AccountDocument(username, accountLevel, firstName, lastName, homepage, password, email, AccountDocument.NO_TIME_VALUE, null, AccountDocument.NO_TIME_VALUE);
try {
XMLElement result = wire.sendAuthenticatedXML(descriptor.getAccountURI(), newAccountDoc.toString(), "POST", authenticator.getAuthCookie());
return new AccountDocument(result);
@@ -464,50 +464,20 @@
return wire.sendDelete(descriptor.getSettingURI(spaceID, key), authenticator.getAuthCookie());
}
- public BodyDocument getBodyDocument(String username, long bodyID) throws IOException {
- return new BodyDocument(wire.fetchAuthenticatedXML(descriptor.getBodyURI(username, bodyID), authenticator.getAuthCookie()));
+ public BodyDataDocument createBodyData(String displayName, String fileName) throws IOException {
+ BodyDataDocument doc = new BodyDataDocument(-1, displayName, fileName);
+ XMLElement result = wire.sendAuthenticatedXML(descriptor.getBodiesURI(), doc.toString(), "POST", authenticator.getAuthCookie());
+ return new BodyDataDocument(result);
}
- public BodyDocument[] getBodyDocuments(String username) throws IOException {
- Vector results = new Vector();
-
- XMLElement list = wire.fetchAuthenticatedXML(descriptor.getBodiesURI(username), authenticator.getAuthCookie());
- XMLElement[] children = (XMLElement[]) list.getChildren().toArray(new XMLElement[0]);
- for (int i = 0; i < children.length; i++) {
- results.add(new BodyDocument(children[i]));
- }
-
- return (BodyDocument[]) results.toArray(new BodyDocument[0]);
+ public BodyDataDocument getBodyDataDocument(long bodyDataID) throws IOException {
+ return new BodyDataDocument(wire.fetchAuthenticatedXML(descriptor.getBodyDataDocumentURI(bodyDataID), authenticator.getAuthCookie()));
}
- public BodyDocument createBody(String bodyName) throws IOException {
- BodyDocument bodyDoc = new BodyDocument(-1, authenticator.getUsername(), bodyName, 0, 0, 0, 0, 0, false, 2, 1);
- XMLElement element = wire.postAuthenticatedXML(descriptor.getBodiesURI(authenticator.getUsername()), bodyDoc.toString(), authenticator.getAuthCookie());
- if (element == null) {
- return null;
- }
- return new BodyDocument(element);
+ public void deleteBodyData(long bodyDataID) throws IOException {
+ wire.sendDelete(descriptor.getBodyDataDocumentURI(bodyDataID), authenticator.getAuthCookie());
}
- public BodyDocument updateBody(BodyDocument bodyDoc) throws IOException {
- XMLElement xml = wire.postAuthenticatedXML(descriptor.getBodyURI(bodyDoc.getOwnerUsername(), bodyDoc.getBodyID()), bodyDoc.toString(), authenticator.getAuthCookie());
- return new BodyDocument(xml);
- }
-
- public AccountDocument setDefaultBody(long bodyID) throws IOException {
- AccountDocument newDoc = new AccountDocument(authenticator.getUsername());
- newDoc.setDefaultBodyID(bodyID);
- XMLElement element = wire.postAuthenticatedXML(descriptor.getAccountURI(newDoc.getUsername()), newDoc.toString(), authenticator.getAuthCookie());
- if (element == null) {
- return null;
- }
- return new AccountDocument(element);
- }
-
- public boolean deleteBody(long bodyID) throws IOException {
- return wire.sendDelete(descriptor.getBodyURI(authenticator.getUsername(), bodyID), authenticator.getAuthCookie());
- }
-
public ZipInputStream getBodyData(String bodyName) throws IOException {
InputStream stream = wire.fetchAuthenticatedStream(descriptor.getBodyDataURI(bodyName), authenticator.getAuthCookie());
if(stream == null){
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-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/WebAPIDescriptor.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -115,12 +115,12 @@
return WebAPIUtil.appendToURI(getSpaceURI(spaceID), "user/");
}
- public URI getBodiesURI(String username) {
- return WebAPIUtil.appendToURI(getAccountURI(username), "body/");
+ public URI getBodiesURI() {
+ return WebAPIUtil.appendToURI(getSpacesURI(), "body/");
}
- public URI getBodyURI(String username, long bodyID) {
- return WebAPIUtil.appendToURI(getBodiesURI(username), bodyID + "/");
+ public URI getBodyDataDocumentURI(long bodyDataID) {
+ return WebAPIUtil.appendToURI(getBodiesURI(), bodyDataID + "/");
}
public URI getBodyDataURI(String bodyName) {
Deleted: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Body.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Body.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Body.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -1,86 +0,0 @@
-package com.ogoglio.client.model;
-
-public class Body {
-
- private long bodyID = -1;
-
- private int hair = -1;
-
- private int eyes = -1;
-
- private int nose = -1;
-
- private int mouth = -1;
-
- private int face = -1;
-
- private boolean male = false;
-
- private float height = 2;
-
- private float girth = 1;
-
- public Body(long bodyID, int hair, int eyes, int nose, int mouth, int face, boolean isMale, float height, float girth) {
- this.bodyID = bodyID;
- this.hair = hair;
- this.eyes = eyes;
- this.nose = nose;
- this.mouth = mouth;
- this.face = face;
- this.male = isMale;
- this.height = height;
- this.girth = girth;
- }
-
- public long getBodyID() {
- return bodyID;
- }
-
- public int getEyes() {
- return eyes;
- }
-
- public int getFace() {
- return face;
- }
-
- public int getHair() {
- return hair;
- }
-
- public int getMouth() {
- return mouth;
- }
-
- public int getNose() {
- return nose;
- }
-
- public void set(int hairIndex, int eyesIndex, int noseIndex, int mouthIndex, int faceIndex) {
- this.hair = hairIndex;
- this.eyes = eyesIndex;
- this.nose = noseIndex;
- this.mouth = mouthIndex;
- this.face = faceIndex;
- }
-
- public boolean isMale() {
- return male;
- }
-
- public float getHeight() {
- return height;
- }
-
- public void setHeight(float height) {
- this.height = height;
- }
-
- public float getGirth() {
- return girth;
- }
-
- public void setMale(boolean male) {
- this.male = male;
- }
-}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Space.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Space.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/Space.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -26,8 +26,6 @@
import javax.vecmath.Vector3d;
import com.ogoglio.util.ArgumentUtils;
-import com.ogoglio.util.Log;
-import com.ogoglio.xml.BodyDocument;
public class Space {
@@ -212,8 +210,6 @@
public InputStream getPageContentStream(long thingID, long pageID);
- public BodyDocument getBodyDocument(String username, long bodyID) throws IOException;
-
}
public long getSpaceID() {
@@ -501,12 +497,4 @@
public InputStream getPageContentStream(long thingID, long pageID) throws IOException {
return spaceContext.getPageContentStream(thingID, pageID);
}
-
- public Body getBody(String username, long bodyID) throws IOException {
- if (bodyID < 0) {
- return new Body(-1, 0, 0, 0, 0, 0, false, 2, 0);
- }
- BodyDocument bodyDoc = spaceContext.getBodyDocument(username, bodyID);
- return new Body(bodyDoc.getBodyID(), bodyDoc.getHairIndex(), bodyDoc.getEyesIndex(), bodyDoc.getNoseIndex(), bodyDoc.getMouthIndex(), bodyDoc.getFaceIndex(), bodyDoc.isMale(), bodyDoc.getHeight(), bodyDoc.getGirth());
- }
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/client/model/User.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -28,25 +28,17 @@
private Transform3D position = null;
- private Body body = null;
-
private long pathStarted = -1;
private SplinePath path = null;
- public User(Space space, String username, Transform3D position, long bodyID) {
+ public User(Space space, String username, Transform3D position) {
ArgumentUtils.assertNotNull(space);
this.space = space;
ArgumentUtils.assertNotNull(username);
this.username = username;
ArgumentUtils.assertNotNull(position);
this.position = position;
- try {
- body = space.getBody(username, bodyID);
- } catch (IOException e) {
- e.printStackTrace();
- body = new Body(-1, 0, 0, 0, 0, 0, false, 2, 1);
- }
}
public void startMotion(SplinePath path) {
@@ -74,10 +66,6 @@
return position;
}
- public Body getBody() {
- return body;
- }
-
public Space getSpace() {
return space;
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/PayloadFactory.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/PayloadFactory.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/message/PayloadFactory.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -238,10 +238,8 @@
public static final String USERNAME = "username";
- public static final String BODY_ID = "bodyID";
-
- public AuthenticatedPayload(String username, long bodyID) {
- super(create(username, bodyID));
+ public AuthenticatedPayload(String username) {
+ super(create(username));
}
public AuthenticatedPayload(XMLElement data) {
@@ -252,16 +250,11 @@
return getData().getStringAttribute(USERNAME);
}
- public static XMLElement create(String username, long bodyID) {
+ public static XMLElement create(String username) {
XMLElement data = new XMLElement(NAME);
data.setAttribute(USERNAME, username);
- data.setAttribute(BODY_ID, bodyID);
return data;
}
-
- public long getBodyID() {
- return getData().getLongAttribute(BODY_ID);
- }
}
// This is sent to the space simulator when a client logs out
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/ArgumentUtils.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/ArgumentUtils.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/util/ArgumentUtils.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -37,8 +37,8 @@
}
}
- public static void assertNotNegative(float skinRed) {
- if (skinRed < 0) {
+ public static void assertNotNegative(float value) {
+ if (value < 0) {
throw new IllegalArgumentException("Argument was less than zero");
}
}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/J3DUserRenderable.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -19,14 +19,12 @@
import javax.media.j3d.Billboard;
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.BranchGroup;
-import javax.media.j3d.GeometryArray;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;
import javax.vecmath.Color3f;
import javax.vecmath.Vector3d;
import javax.vecmath.Vector3f;
-import com.ogoglio.client.model.Body;
import com.ogoglio.client.model.User;
import com.ogoglio.util.ArgumentUtils;
import com.ogoglio.util.BodyConstants;
@@ -37,7 +35,6 @@
import com.ogoglio.viewer.j3d.body.SkinLoader;
import com.ogoglio.viewer.j3d.bvh.Bvh;
import com.ogoglio.viewer.j3d.smap.SkinMap;
-import com.ogoglio.viewer.j3d.smap.SkinMapParser;
import com.ogoglio.viewer.render.Camera;
import com.ogoglio.viewer.render.UserRenderable;
import com.sun.j3d.utils.geometry.Text2D;
@@ -95,7 +92,7 @@
private void initBody() {
bodyGroup.removeAllChildren();
- skin = new SkinLoader(bodyData, user.getBody()).generateSkin();
+ skin = new SkinLoader(bodyData).generateSkin();
userHeight = skin.getHeight();
skinMap = bodyData.getSkinMap();
@@ -225,8 +222,7 @@
}
public void repaintSkinTexture() {
- Body body = user.getBody();
- skin.updateTexture(body.getHair(), body.getEyes(), body.getNose(), body.getMouth(), body.getFace(), body.isMale());
+ skin.updateTexture();
}
public synchronized void stopAnimation() {
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skin.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skin.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/Skin.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -53,7 +53,7 @@
private SkinUpdater skinUpdater = null;
- public Skin(int hair, int eyes, int nose, int mouth, int face, boolean isMale, BufferedImage baseImage) {
+ public Skin(BufferedImage baseImage) {
setCapability(Skin.ALLOW_APPEARANCE_WRITE);
setCapability(Skin.ALLOW_PICKABLE_READ);
setCapability(Skin.ALLOW_GEOMETRY_READ);
@@ -68,7 +68,7 @@
texture.getImage(0).setCapability(ImageComponent.ALLOW_IMAGE_READ);
texture.getImage(0).setCapability(ImageComponent.ALLOW_IMAGE_WRITE);
- updateTexture(hair, eyes, nose, mouth, face, isMale);
+ updateTexture();
Appearance appearance = new Appearance();
TextureAttributes textureAtts = new TextureAttributes();
@@ -88,17 +88,7 @@
private class TextureUpdater implements ImageComponent2D.Updater {
- int hair, eyes, nose, mouth, face;
-
- boolean isMale = false;
-
- public TextureUpdater(int hair, int eyes, int nose, int mouth, int face, boolean isMale) {
- this.hair = hair;
- this.eyes = eyes;
- this.nose = nose;
- this.mouth = mouth;
- this.face = face;
- this.isMale = isMale;
+ public TextureUpdater() {
}
public void updateData(ImageComponent2D imageComp, int arg1, int arg2, int arg3, int arg4) {
@@ -107,32 +97,16 @@
}
Graphics g = imageComp.getImage().getGraphics();
g.drawImage(baseImage, 0, 0, null);
-
- /*
- Image[] baseTextures = isMale ? BodyConstants.MALE_BASE_SKIN_TEXTURES : BodyConstants.FEMALE_BASE_SKIN_TEXTURES;
- if (face >= 0 && face < baseTextures.length) {
- g.drawImage(baseTextures[face], 0, 0, null);
- }
- if (eyes >= 0 && eyes < BodyConstants.EYES.length) {
- g.drawImage(BodyConstants.EYES[eyes], 111, 90, 75, 37, null);
- }
- if (nose >= 0 && nose < BodyConstants.NOSES.length) {
- g.drawImage(BodyConstants.NOSES[nose], 135, 105, 25, 50, null);
- }
- if (mouth >= 0 && mouth < BodyConstants.MOUTHES.length) {
- g.drawImage(BodyConstants.MOUTHES[mouth], 121, 151, 50, 25, null);
- }
- */
}
}
- public void updateTexture(int hair, int eyes, int nose, int mouth, int face, boolean isMale) {
+ public void updateTexture() {
if(baseImage == null){
return;
}
ImageComponent2D imageComp = (ImageComponent2D) texture.getImage(0);
- imageComp.updateData(new TextureUpdater(hair, eyes, nose, mouth, face, isMale), 0, 0, baseImage.getWidth(), baseImage.getHeight());
+ imageComp.updateData(new TextureUpdater(), 0, 0, baseImage.getWidth(), baseImage.getHeight());
}
public void setGeometry(Geometry geo) {
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/viewer/j3d/body/SkinLoader.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -19,24 +19,22 @@
import javax.media.j3d.GeometryArray;
import javax.vecmath.Vector3f;
-import com.ogoglio.client.model.Body;
import com.ogoglio.viewer.j3d.J3DBodyData;
public class SkinLoader {
+
+ public static final float AVATAR_SIZE = 2; //this will eventually be changable
private GeometryArray geometry = null;
- private Body body = null;
-
private BufferedImage baseImage;
private MorphDeltaMap[] morphDeltaMaps = null;
- public SkinLoader(J3DBodyData bodyData, Body body) {
+ public SkinLoader(J3DBodyData bodyData) {
this.geometry = bodyData.cloneBodyGeometry();
this.morphDeltaMaps = bodyData.getMorphDeltaMaps();
this.baseImage = bodyData.getBaseTexture();
- this.body = body;
}
public Skin generateSkin() {
@@ -64,7 +62,7 @@
maxY = vertices[i];
}
}
- float heightScale = body.getHeight() / Math.abs(maxY - minY);
+ float heightScale = AVATAR_SIZE / Math.abs(maxY - minY);
if (Math.abs(heightScale) > 0.1) {
for (int i = 0; i < vertices.length - 2; i += 3) {
vertices[i] = vertices[i] * heightScale;
@@ -73,7 +71,7 @@
}
}
- Skin skin = new Skin(body.getHair(), body.getEyes(), body.getNose(), body.getMouth(), body.getFace(), body.isMale(), baseImage);
+ Skin skin = new Skin(baseImage);
skin.setGeometry(geometry);
return skin;
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/AccountDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/AccountDocument.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/AccountDocument.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -53,11 +53,9 @@
public static final String FROZEN_UNTIL = "frozenuntil";
- private static final String DEFAULT_BODY_ID = "defaultbodyid";
-
XMLElement data = null;
- public AccountDocument(String username, String accountLevel, String firstName, String lastName, String homepage, String password, String email, long creationDate, String cookie, long frozenUntil, long defaultBodyID) {
+ public AccountDocument(String username, String accountLevel, String firstName, String lastName, String homepage, String password, String email, long creationDate, String cookie, long frozenUntil) {
data = new XMLElement(NAME);
if (username == null) {
@@ -86,8 +84,6 @@
data.setAttribute(CREATION_DATE, creationDate);
if (frozenUntil!=AccountDocument.NO_TIME_VALUE)
data.setAttribute(FROZEN_UNTIL, frozenUntil);
- if(defaultBodyID > -1)
- data.setAttribute(DEFAULT_BODY_ID, defaultBodyID);
}
public AccountDocument(XMLElement data) {
@@ -101,7 +97,7 @@
}
public AccountDocument(String username) { //used when updating the document, with absent items indicating no change
- this(username, null, null, null, null, null, null, AccountDocument.NO_TIME_VALUE, null, AccountDocument.NO_TIME_VALUE, 1);
+ this(username, null, null, null, null, null, null, AccountDocument.NO_TIME_VALUE, null, AccountDocument.NO_TIME_VALUE);
}
public XMLElement toElement() {
@@ -172,18 +168,6 @@
}
}
- public long getDefaultBodyID() {
- return data.getLongAttribute(DEFAULT_BODY_ID, -1);
- }
-
- public void setDefaultBodyID(long bodyID) {
- if(bodyID != -1) {
- data.setAttribute(DEFAULT_BODY_ID, bodyID);
- } else {
- data.removeAttribute(DEFAULT_BODY_ID);
- }
- }
-
public int hashCode() {
return getUsername().hashCode();
}
Added: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java (rev 0)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyConfigurationDocument.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -0,0 +1,88 @@
+/* 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.xml;
+
+import nanoxml.XMLElement;
+
+import com.ogoglio.util.ArgumentUtils;
+
+public class BodyConfigurationDocument {
+
+ public static final String NAME = "bodyconfiguration";
+
+ private static final String BODY_CONFIGURATION_ID = "bodyconfigurationid";
+
+ private static final String OWNER_USERNAME = "ownerusername";
+
+ public static final String DISPLAY_NAME = "displayname";
+
+ public static final String BODY_DATA_ID = "bodydataid";
+
+ private XMLElement data = null;
+
+ public BodyConfigurationDocument(long bodyConfigurationID, String ownerUsername, String displayName, long bodyDataID) {
+ data = new XMLElement(NAME);
+ data.setAttribute(BODY_CONFIGURATION_ID, bodyDataID);
+ ArgumentUtils.assertNotEmpty(ownerUsername);
+ data.setAttribute(OWNER_USERNAME, ownerUsername);
+ ArgumentUtils.assertNotNull(displayName);
+ data.setAttribute(DISPLAY_NAME, displayName);
+ ArgumentUtils.assertNotNegative(bodyDataID);
+ data.setAttribute(BODY_DATA_ID, bodyDataID);
+ }
+
+ public BodyConfigurationDocument(XMLElement data) {
+ if (!NAME.equals(data.getName())) {
+ throw new IllegalArgumentException("data is not named " + NAME + ": " + data);
+ }
+ this.data = data;
+ }
+
+ public long getBodyConfigurationID(){
+ return data.getLongAttribute(BODY_CONFIGURATION_ID);
+ }
+
+ public String getDisplayName(){
+ return data.getStringAttribute(DISPLAY_NAME);
+ }
+
+ public String getOwnerUsername(){
+ return data.getStringAttribute(OWNER_USERNAME);
+ }
+
+ public long getBodyDataID(){
+ return data.getLongAttribute(BODY_CONFIGURATION_ID);
+ }
+
+ public void addBodySetting(long bodySettingID, String settingName, long setting) {
+ data.addChild(new BodySettingDocument(bodySettingID, getBodyConfigurationID(), settingName, setting).toElement());
+ }
+
+ public BodySettingDocument[] getBodySettingDocuments() {
+ XMLElement[] elements = data.getChildren(BodySettingDocument.NAME);
+ BodySettingDocument[] results = new BodySettingDocument[elements.length];
+ for (int i = 0; i < results.length; i++) {
+ results[i] = new BodySettingDocument(elements[i]);
+ }
+ return results;
+ }
+
+ public XMLElement toElement(){
+ return data;
+ }
+
+ public String toString(){
+ return data.toString();
+ }
+}
Added: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDataDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDataDocument.java (rev 0)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDataDocument.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -0,0 +1,67 @@
+/* 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.xml;
+
+import nanoxml.XMLElement;
+
+import com.ogoglio.util.ArgumentUtils;
+
+public class BodyDataDocument {
+
+ public static final String NAME = "bodydata";
+
+ private static final String BODY_DATA_ID = "bodydataid";
+
+ private static final String DISPLAY_NAME = "displayname";
+
+ private static final String FILE_NAME = "filename";
+
+ private XMLElement data = null;
+
+ public BodyDataDocument(long bodyDataID, String displayName, String fileName) {
+ data = new XMLElement(NAME);
+ data.setAttribute(BODY_DATA_ID, bodyDataID);
+ ArgumentUtils.assertNotNull(displayName);
+ data.setAttribute(DISPLAY_NAME, displayName);
+ ArgumentUtils.assertNotNull(fileName);
+ data.setAttribute(FILE_NAME, fileName);
+ }
+
+ public BodyDataDocument(XMLElement data) {
+ if (!NAME.equals(data.getName())) {
+ throw new IllegalArgumentException("data is not named " + NAME + ": " + data);
+ }
+ this.data = data;
+ }
+
+ public String getDisplayName() {
+ return data.getStringAttribute(DISPLAY_NAME);
+ }
+
+ public String getFileName() {
+ return data.getStringAttribute(FILE_NAME);
+ }
+
+ public long getBodyDataID() {
+ return data.getLongAttribute(BODY_DATA_ID);
+ }
+
+ public XMLElement toElement() {
+ return data;
+ }
+
+ public String toString() {
+ return data.toString();
+ }
+}
Deleted: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDocument.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodyDocument.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -1,178 +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.xml;
-
-import nanoxml.XMLElement;
-
-import com.ogoglio.util.ArgumentUtils;
-
-public class BodyDocument {
-
- public static final String NAME = "body";
-
- public static final String BODY_ID = "bodyid";
-
- public static final String OWNER_USERNAME = "ownerusername";
-
- public static final String DISPLAY_NAME = "displayname";
-
- public static final String HAIR_INDEX = "hair";
-
- public static final String EYES_INDEX = "eyes";
-
- public static final String NOSE_INDEX = "nose";
-
- public static final String MOUTH_INDEX = "mouth";
-
- public static final String FACE_INDEX = "face";
-
- public static final String IS_MALE = "ismale";
-
- public static final String HEIGHT = "height";
-
- public static final String GIRTH = "girth";
-
- XMLElement data = null;
-
- public BodyDocument(long bodyID, String ownerUsername, String displayName, int hair, int eyes, int nose, int mouth, int face, boolean isMale, float height, float girth) {
- data = new XMLElement(NAME);
-
- data.setAttribute(BODY_ID, bodyID);
- ArgumentUtils.assertNotNull(ownerUsername);
- data.setAttribute(OWNER_USERNAME, ownerUsername);
- ArgumentUtils.assertNotNull(displayName);
- data.setAttribute(DISPLAY_NAME, displayName);
- ArgumentUtils.assertNotNegative(hair);
- data.setAttribute(HAIR_INDEX, hair);
- ArgumentUtils.assertNotNegative(eyes);
- data.setAttribute(EYES_INDEX, eyes);
- ArgumentUtils.assertNotNegative(nose);
- data.setAttribute(NOSE_INDEX, nose);
- ArgumentUtils.assertNotNegative(mouth);
- data.setAttribute(MOUTH_INDEX, mouth);
- ArgumentUtils.assertNotNegative(face);
- data.setAttribute(FACE_INDEX, face);
- data.setAttribute(IS_MALE, isMale);
- data.setAttribute(HEIGHT, height);
- data.setAttribute(GIRTH, girth);
- }
-
- public BodyDocument(XMLElement data) {
- ArgumentUtils.assertNotNull(data);
- if (!NAME.equals(data.getName())) {
- throw new IllegalArgumentException("data is not named " + NAME + ": " + data);
- }
- ArgumentUtils.assertNotNegative(data.getLongAttribute(BODY_ID, -1));
- ArgumentUtils.assertNotNull(data.getStringAttribute(OWNER_USERNAME));
- ArgumentUtils.assertNotNull(data.getStringAttribute(DISPLAY_NAME));
- this.data = data;
- }
-
- public XMLElement toElement() {
- return data;
- }
-
- public String toString() {
- return data.toString();
- }
-
- public long getBodyID() {
- return data.getLongAttribute(BODY_ID);
- }
-
- public String getOwnerUsername() {
- return data.getStringAttribute(OWNER_USERNAME);
- }
-
- public String getDisplayName() {
- return data.getStringAttribute(DISPLAY_NAME);
- }
-
- public int getHairIndex() {
- return data.getIntAttribute(HAIR_INDEX);
- }
-
- public void setHairIndex(int index) {
- ArgumentUtils.assertNotNegative(index);
- data.setAttribute(HAIR_INDEX, index);
- }
-
- public int getEyesIndex() {
- return data.getIntAttribute(EYES_INDEX);
- }
-
- public void setEyesIndex(int index) {
- ArgumentUtils.assertNotNegative(index);
- data.setAttribute(EYES_INDEX, index);
- }
-
- public int getNoseIndex() {
- return data.getIntAttribute(NOSE_INDEX);
- }
-
- public void setNoseIndex(int index) {
- ArgumentUtils.assertNotNegative(index);
- data.setAttribute(NOSE_INDEX, index);
- }
-
- public int getMouthIndex() {
- return data.getIntAttribute(MOUTH_INDEX);
- }
-
- public void setMouthIndex(int index) {
- ArgumentUtils.assertNotNegative(index);
- data.setAttribute(MOUTH_INDEX, index);
- }
-
- public int getFaceIndex() {
- return data.getIntAttribute(FACE_INDEX);
- }
-
- public void setFaceIndex(int index) {
- ArgumentUtils.assertNotNegative(index);
- data.setAttribute(FACE_INDEX, index);
- }
-
- public boolean isMale() {
- return data.getBooleanAttribute(IS_MALE);
- }
-
- public float getHeight() {
- return data.getFloatAttribute(HEIGHT);
- }
-
- public void setHeight(float newHeight) {
- data.setAttribute(HEIGHT, newHeight);
- }
-
- public float getGirth() {
- return data.getFloatAttribute(GIRTH);
- }
-
- public void setGirth(float girth) {
- data.setAttribute(GIRTH, girth);
- }
-
- public boolean equals(Object obj) {
- if (obj == null || !(obj instanceof BodyDocument)) {
- return false;
- }
- return ((BodyDocument) obj).getBodyID() == getBodyID();
- }
-
- public int hashCode() {
- return ("BodyDocument-" + getBodyID()).hashCode();
- }
-
-}
\ No newline at end of file
Added: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodySettingDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodySettingDocument.java (rev 0)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/BodySettingDocument.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -0,0 +1,63 @@
+package com.ogoglio.xml;
+
+import nanoxml.XMLElement;
+
+import com.ogoglio.util.ArgumentUtils;
+
+public class BodySettingDocument {
+
+ public static final String NAME = "bodysetting";
+
+ private static final String BODY_SETTING_ID = "bodysettingid";
+
+ private static final String BODY_CONFIGURATION_ID = "bodyconfigurationid";
+
+ private static final String SETTING_NAME = "settingname";
+
+ private static final String SETTING = "setting";
+
+ private XMLElement data = null;
+
+ public BodySettingDocument(long bodySettingID, long bodyConfigurationID, String settingName, long setting) {
+ data = new XMLElement(NAME);
+ data.setAttribute(BODY_SETTING_ID, bodySettingID);
+ ArgumentUtils.assertNotNegative(bodyConfigurationID);
+ data.setAttribute(BODY_CONFIGURATION_ID, bodyConfigurationID);
+ ArgumentUtils.assertNotEmpty(settingName);
+ data.setAttribute(SETTING_NAME, settingName);
+ ArgumentUtils.assertNotNegative(setting);
+ data.setAttribute(SETTING, setting);
+ }
+
+ public BodySettingDocument(XMLElement data) {
+ if (!NAME.equals(data.getName())) {
+ throw new IllegalArgumentException("data is not named " + NAME + ": " + data);
+ }
+ this.data = data;
+ }
+
+ public long getBodySettingID() {
+ return data.getLongAttribute(BODY_SETTING_ID);
+ }
+
+ public long getBodyConfigurationID() {
+ return data.getLongAttribute(BODY_CONFIGURATION_ID);
+ }
+
+ public String getSettingName() {
+ return data.getStringAttribute(SETTING_NAME);
+ }
+
+ public float getSetting() {
+ return data.getFloatAttribute(SETTING);
+ }
+
+ public XMLElement toElement() {
+ return data;
+ }
+
+ public String toString() {
+ return data.toString();
+ }
+
+}
Modified: maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/UserDocument.java
===================================================================
--- maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/UserDocument.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/main/java/com/ogoglio/xml/UserDocument.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -26,17 +26,14 @@
public static final String USERNAME = "username";
- public static final String BODY_ID = "bodyid";
-
public UserDocument(User user) {
- this(user.getUsername(), user.getPosition(), user.getSplinePath(), user.getBody().getBodyID());
+ this(user.getUsername(), user.getPosition(), user.getSplinePath());
}
- public UserDocument(String username, Transform3D transform, SplinePath splinePath, long bodyID) {
+ public UserDocument(String username, Transform3D transform, SplinePath splinePath) {
super(NAME, transform, splinePath);
ArgumentUtils.assertNotNull(username);
getData().setAttribute(USERNAME, username);
- getData().setAttribute(BODY_ID, bodyID);
}
public UserDocument(XMLElement data) {
@@ -50,8 +47,4 @@
public String getUsername() {
return getData().getStringAttribute(USERNAME);
}
-
- public long getBodyID() {
- return getData().getLongAttribute(BODY_ID, -1);
- }
}
Modified: maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java
===================================================================
--- maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java 2007-10-02 02:28:24 UTC (rev 464)
+++ maven/trunk/ogoglio-common/src/test/java/com/ogoglio/xml/test/XMLTest.java 2007-10-02 02:28:33 UTC (rev 465)
@@ -17,7 +17,6 @@
import com.ogoglio.viewer.j3d.J3DSplinePath;
import com.ogoglio.xml.AccountDocument;
import com.ogoglio.xml.AuthDocument;
-import com.ogoglio.xml.BodyDocument;
import com.ogoglio.xml.DoorDocument;
import com.ogoglio.xml.PossessionDocument;
import com.ogoglio.xml.ShapeDocument;
@@ -87,7 +86,7 @@
}
public void testAccountDocument() {
- AccountDocument doc1 = new AccountDocument(username1, accountLevel1, firstName1, lastName1, company1, password1, email1, creationDate1, cookie1, frozenUntil1, 2);
+ AccountDocument doc1 = new AccountDocument(username1, accountLevel1, firstName1, lastName1, company1, password1, email1, creationDate1, cookie1, frozenUntil1);
XMLElement element = new XMLElement();
element.parseString(doc1.toString());
AccountDocument doc2 = new AccountDocument(element);
@@ -190,7 +189,7 @@
assertEquals(0, shapeMove1.getSplinePath().getSplineKeyFrames()[1].getKnot(), keyFrames[1].getKnot());
assertEquals(shapeMove1.getShapeName(), "a_shape");
- UserDocument userDoc = new UserDocument(username, new Transform3D(), null, 1);
+ UserDocument userDoc = new UserDocument(username, new Transform3D(), null);
assertEquals(username, userDoc.getUsername());
userDoc = new UserDocument(XMLElement.parseElementFromString(userDoc.toString()));
@@ -210,24 +209,6 @@
assertEquals(uri1, door1.getLink());
}
- public void testBodyDocument() {
- String displayName = "Hot Angry Ant";
- String ownerUsername = "trevor";
- long bodyID = 42;
- BodyDocument doc1 = new BodyDocument(bodyID, ownerUsername, displayName, 0, 1, 2, 3, 4, false, 2, 1);
- assertEquals(displayName, doc1.getDisplayName());
- assertEquals(ownerUsername, doc1.getOwnerUsername());
- assertEquals(bodyID, doc1.getBodyID());
-
- doc1 = new BodyDocument(XMLElement.parseElementFromString(doc1.toString()));
- assertEquals(displayName, doc1.getDisplayName());
- assertEquals(ownerUsername, doc1.getOwnerUsername());
- assertEquals(bodyID, doc1.getBodyID());
-
- BodyDocument doc2 = new BodyDocument(XMLElement.parseElementFromString(doc1.toString()));
- assertEquals(doc1, doc2);
- }
-
public void testSpaceDocuments() {
DateFormat fmt=DateFormat.getDateTimeInstance(DateFormat.FULL,
DateFormat.FULL, Locale.US);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|