kazu2012 / persevere-framework

Automatically exported from code.google.com/p/persevere-framework
0 stars 0 forks source link

Classes not defined properly after database clean #194

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This one's been troubling me for a while, but I worried that it was just me...

So, let's say I erase the database, clear generated.js

  C:\persevere_thrash>persvr --eraseDB
  Delete data at C:\persevere_thrash\WEB-INF\data? (y|n) y
  Deleting data at C:\persevere_thrash\WEB-INF\data...
  A new database will be initialized when you restart.
  C:\persevere_thrash>del WEB-INF\config\generated.js

Then I run Persever...

  C:\persevere_thrash>persvr
  2009-06-03 INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
  2009-06-03 08:45:40.407::INFO:  jetty-6.1.14
  Jun 3, 2009 8:45:41 AM org.persvr.remote.PersevereFilter init
  INFO: Persevere v1.0 beta 2 Started
  2009-06-03 INFO:  Started SelectChannelConnector@0.0.0.0:8080
  Type "help" at the console for more information

Then I check out the definition of a class

  js>s( Ancestor )
  ({"id":"Class/Ancestor"
  })

Not right!  Shutdown, restart...

  js>shutdown
  Jun 3, 2009 8:46:01 AM org.persvr.remote.PersevereFilter$1 run
  INFO: Persevere shutting down

  C:\persevere_thrash>persvr
  2009-06-03 INFO:  Logging to STDERR via   org.mortbay.log.StdErrLog
  2009-06-03 08:46:03.775::INFO:  jetty-6.1.14
  Jun 3, 2009 8:46:04 AM org.persvr.remote.PersevereFilter init
  INFO: Persevere v1.0 beta 2 Started
  2009-06-03 INFO:  Started   SelectChannelConnector@0.0.0.0:8080
  Type "help" at the console for more information

Try again...

  js>s( Ancestor )
  ({"id":"Class/Ancestor",
  "prototype":{
          "initialize":
  function () {
      this.name = "T" + new Date();
  }
  ...

Much better!

BTW...

Ancestor is defined as follows:

Class(    {
  "id":"Ancestor",
  "prototype":{
    initialize:function(  ) {
      this.name = "T" + new Date();
    },
    access:function( ) {
      console.log( "Ancestor : " + this.id + " : " + this.accesses + "
accesses " + this.prop );
      return this.accesses;
    },
    output:function( ) {
      console.log( "Ancestor : " + this.id + " : " + this.accesses + "
accesses " );
    }
  },
  "properties":{
    "name":{ index:false, type:"string" },
  },
} );

Original issue reported on code.google.com by davidthi...@gmail.com on 3 Jun 2009 at 3:54

GoogleCodeExporter commented 8 years ago
So this means, if I'm getting it right, that no class definitions are working 
right
the first time after a DB erase...

Original comment by davidthi...@gmail.com on 3 Jun 2009 at 3:55

GoogleCodeExporter commented 8 years ago
So as I look fourther, this is mainly about the removal of generated.js, not the
erasing of the database...

When I do a new of the object when it's in that state, things go OK...  i.e. a 
= new
Ancestor(), but, if I do a new of a child class - i.e. one that extends 
Ancestor...
things go badly - i.e. the ancestor parts of child don't get initialized.

Kill generated.js

  C:\persevere_thrash>del WEB-INF\config\generated.js

Run Persevere

  C:\persevere_thrash>persvr
  2009-06-03 09:14:17.425::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
  ...
  Type "help" at the console for more information

Create a descendant of Ancestor

  js>c = new Child()
  Jun 3, 2009 9:14:22 AM org.persvr.datasource.JavaScriptDB writeObject
  WARNING: id index will be brought up to date...
  Jun 3, 2009 9:14:22 AM org.persvr.datasource.JavaScriptDB writeObject
  WARNING: id index will be brought up to date...
  Jun 3, 2009 9:14:22 AM org.persvr.datasource.JavaScriptDB$8 run
  WARNING: finished bringing id index up to date
  Jun 3, 2009 9:14:22 AM org.persvr.datasource.JavaScriptDB$8 run
  WARNING: finished bringing id index up to date
  [object Object]

Created, but no Ancestor part (i.e. the name)

  js>s( c )
  ({"id":"Child/6",
  "accesses":0,
  "prop":0
  })

Cuz Ancestor's not really there...

  js>s( Ancestor )
  ({"id":"Class/Ancestor"
  })

Restart
  js>shutdown
  C:\persevere_thrash>persvr
  2009-06-03 09:14:47.605::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
  ...
  Type "help" at the console for more information

New Child

  js>c = new Child()
  Jun 3, 2009 9:14:53 AM org.persvr.datasource.JavaScriptDB writeObject
  WARNING: id index will be brought up to date...
  Jun 3, 2009 9:14:53 AM org.persvr.datasource.JavaScriptDB writeObject
  WARNING: id index will be brought up to date...
  Jun 3, 2009 9:14:53 AM org.persvr.datasource.JavaScriptDB$8 run
  WARNING: finished bringing id index up to date
  Jun 3, 2009 9:14:53 AM org.persvr.datasource.JavaScriptDB$8 run 
  WARNING: finished bringing id index up to date
  [object Object]

All good this time!

  js>s( c )
  ({"id":"Child/7",
  "name":"TWed Jun 03 2009 09:14:53 GMT-0700 (PDT)",
  "accesses":0,
  "prop":0
  })

Note: Child does the requires...

Original comment by davidthi...@gmail.com on 3 Jun 2009 at 4:18

GoogleCodeExporter commented 8 years ago

Original comment by kris...@gmail.com on 6 Jun 2009 at 2:39