dblevins    2005/08/28 04:55:56

  Added:       examples/moviefun/src/webapp/META-INF
                        cmp.global-database.xml cmp.local-database.xml
                        cmp.or-mapping.xml ejb-jar.xml instantdb.properties
                        log4j.properties openejb-jar.xml openejb.xml
  Log:

  Collapsed ear example (aka. one openejb per webapp)
  
  Revision  Changes    Path
  1.1                  
openejb1/examples/moviefun/src/webapp/META-INF/cmp.global-database.xml
  
  Index: cmp.global-database.xml
  ===================================================================
  <!DOCTYPE databases PUBLIC "-//EXOLAB/Castor JDO Configuration DTD Version 
1.0//EN"
                             "http://castor.exolab.org/jdo-conf.dtd";>
  
  
  <!--
  ======================================================
  Global Transaction Database file for Container-Managed
  Persistence EntityBeans in the Default CMP Container
  ======================================================
  
  This configuration is used for global or container 
  managed transactions.  This will be used when the
  TransactionManager is managing the transaction, such
  as when the tx attribute is Supports (client has tx),
  RequiresNew, Required or Manditory.
  
  Specifies the configuration for obtaining database
  connections and the mapping.xml schema which describes
  how beans map to the database.
  
  [The Syntax of this file is defined by Castor JDO]
  
  -->
  <database name="Global_TX_Database" engine="instantdb">
  <!--    <jndi name="java:comp/env/jdbc/moviedb" />-->
      <jndi name="java:openejb/connector/Movie Database Connector" />
      <mapping href="META-INF/cmp.or-mapping.xml" />
  </database>
  
  
  
  
  
  1.1                  
openejb1/examples/moviefun/src/webapp/META-INF/cmp.local-database.xml
  
  Index: cmp.local-database.xml
  ===================================================================
  <!DOCTYPE databases PUBLIC "-//EXOLAB/Castor JDO Configuration DTD Version 
1.0//EN"
                             "http://castor.exolab.org/jdo-conf.dtd";>
  
  
  
  <!--
  ======================================================
  Local Transaction Database file for Container-Managed
  Persistence EntityBeans in the Default CMP Container
  ======================================================
  
  This configuration is used for local or unspecified 
  transaction contexts.  This will be used when the 
  TransactionManager is not managing the transaction, 
  such as when the tx attribute is Supports (no client 
  tx), NotSupported, or Never.
  
  Specifies the configuration for obtaining database 
  connections and the mapping.xml schema which describes
  how beans map to the database.
  
  [The Syntax of this file is defined by Castor JDO]
  
  -->
  <database name="Local_TX_Database" engine="instantdb" >
  
      <driver class-name="org.enhydra.instantdb.jdbc.idbDriver"
              url="jdbc:idb:META-INF/instantdb.properties">
        <param name="user" value="Admin" />
        <param name="password" value="pass" />
      </driver>
  
      <mapping href="META-INF/cmp.or-mapping.xml" />
  </database>
  
  
  
  
  1.1                  
openejb1/examples/moviefun/src/webapp/META-INF/cmp.or-mapping.xml
  
  Index: cmp.or-mapping.xml
  ===================================================================
  <!DOCTYPE databases PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" 
"http://castor.exolab.org/mapping.dtd";>
  
  <!--
  ======================================================
  Mapping for Container-Managed Persistence EntityBeans
  ======================================================
  
  The Syntax of this file is defined by Castor
  
  -->
  <mapping>
  
      <class name="org.acme.movie.MovieBean" identity="movieId" 
key-generator="MAX">
  
          <map-to table="movie"/>
  
          <field name="movieId" type="integer" direct="true">
              <sql name="movieId" type="integer"/>
          </field>
  
          <field name="title" type="string" direct="true">
              <sql name="title" type="char" dirty="check"/>
          </field>
          <field name="director" type="string" direct="true">
              <sql name="director" type="char" dirty="check"/>
          </field>
          <field name="genre" type="string" direct="true">
              <sql name="genre" type="char" dirty="check"/>
          </field>
          <field name="rating" type="integer" direct="true">
              <sql name="rating" type="integer" dirty="check"/>
          </field>
          <field name="releaseDate" type="date" direct="true">
              <sql name="release_date" type="date" dirty="check"/>
          </field>
      </class>
  
  </mapping>
  
  
  
  
  1.1                  
openejb1/examples/moviefun/src/webapp/META-INF/ejb-jar.xml
  
  Index: ejb-jar.xml
  ===================================================================
  <?xml version="1.0" encoding="US-ASCII"?>
  
  <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 
2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
  <ejb-jar>
    <enterprise-beans>
        <entity>
            <ejb-name>MovieEJB</ejb-name>
            <local-home>org.acme.movie.MovieHome</local-home>
            <local>org.acme.movie.MovieEntity</local>
            <ejb-class>org.acme.movie.MovieBean</ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>java.lang.Integer</prim-key-class>
            <reentrant>False</reentrant>
  <!--          <cmp-version>1.x</cmp-version>-->
            <cmp-field>
                <field-name>title</field-name>
            </cmp-field>
            <cmp-field>
                <field-name>releaseDate</field-name>
            </cmp-field>
            <cmp-field>
                <field-name>movieId</field-name>
            </cmp-field>
            <cmp-field>
                <field-name>director</field-name>
            </cmp-field>
            <cmp-field>
                <field-name>rating</field-name>
            </cmp-field>
            <cmp-field>
                <field-name>genre</field-name>
            </cmp-field>
            <primkey-field>movieId</primkey-field>
            <resource-ref>
                <res-ref-name>jdbc/moviedb</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
            </resource-ref>
        </entity>
        <session>
            <ejb-name>ContextEJB</ejb-name>
            <local-home>org.acme.movie.JndiContext$LocalHome</local-home>
            <local>org.acme.movie.JndiContext$Local</local>
            <ejb-class>org.acme.movie.JndiContextBean</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Bean</transaction-type>
            <resource-ref>
                <res-ref-name>jdbc/moviedb</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
            </resource-ref>
        </session>
    </enterprise-beans>
  </ejb-jar>
  
  
  1.1                  
openejb1/examples/moviefun/src/webapp/META-INF/instantdb.properties
  
  Index: instantdb.properties
  ===================================================================
  !---------------------------------------------------------------------
  !
  ! BASIC PROPERTIES
  !
  !---------------------------------------------------------------------
  
  !
  ! Path where index tables are held. Can be absolute or relative 
  ! to the properties file. Defaults to tablePath.
  !
  indexPath=./database/indexes
  !
  ! Path where system tables are held. Can be absolute or relative to 
  ! the properties file. Defaults to tablePath.
  !
  systemPath=./database/system
  !
  ! Path where database tables are held. Can be absolute or relative 
  ! to the properties file. Defaults to "current" directory.
  !
  tablePath=./database/tables
  !
  ! Path where results set tables are held. Can be absolute or relative 
  ! to the properties file. Defaults to tablePath.
  !
  tmpPath=./database/tmp
  !
  ! Non-zero means paths are relative to the properties file. 
  ! Default is absolute paths for files.
  !
  relativeToProperties=1
  !
  ! Alternative partitions can be defined so that tables can be placed
  ! in multiple locations. Each partition is numbered: 1, 2, 3,... Tables
  ! can be created on partitions using the syntax 
  !
  !   CREATE TABLE <name> ON PARTITION <number>...
  !
  ! The partition count has to be supplied.
  !
  !partitionCount=2
  !
  ! The locations of each partition must be supplied. These are always
  ! absolute path names.
  !
  !partition1=d:/petes
  !partition2=c:/temp
  
  
  !---------------------------------------------------------------------
  !
  ! TUNING PROPERTIES
  !
  !---------------------------------------------------------------------
  
  !
  ! The amount of each column to cache, expressed either as an absolute 
  ! number of rows or as a percentage figure. Defaults to 256 or 10 
respectively.
  !
  ! This value applies only when tables are first created. It has no effect
  ! when a table is being re-opened.
  !
  cacheAmount=512
  !
  ! CACHE_ROWS Must be one of CACHE_ROWS or CACHE_PERCENT. Determines whether 
  ! to cache columns in tables based on an absolute number of rows, or the 
  ! percentage number of rows in the table. 
  !
  ! This value applies only when tables are first created. It has no effect
  ! when a table is being re-opened.
  !
  cacheCondition=CACHE_ROWS
  !
  ! The amount of the system tables to be cached. Defaults to 100.
  !
  ! This value applies only when tables are first created. It has no effect
  ! when a table is being re-opened.
  !
  !systemCacheSize=10
  !
  ! Similar to cacheCondition, but applies only to the system tables.
  !
  ! This value applies only when tables are first created. It has no effect
  ! when a table is being re-opened.
  !
  !systemCacheCondition=CACHE_ROWS
  !
  ! The percentage cache hit improvement required in order to move the 
  ! cache to a new location in a column. 
  !
  ! (Currently not implemented).
  !
  cacheResetPercent=10
  !
  ! Non-zero means that database changes do not get written to the 
  ! database immediately. See tuning.html. 
  !
  fastUpdate=0
  !
  ! Percentage of free space in an index that must be present before 
  ! the index reorganises itself. High values means frequent index
  ! reorganisation. Low values means slow index inserts.
  !
  indexLoad=5
  !
  ! The number of cache misses to include in calculations of the next 
  ! base for the cache. 
  !
  ! (Currently not implemented).
  !
  missesInCacheStats=100
  !
  ! Non-zero means that results sets get instantiated on disk. By default
  ! InstantDB holds results sets emtirely in memory (apart from Binary
  ! columns). For large results sets this can be a problem. This property
  ! forces all results sets to be held on disk.
  !
  resultsOnDisk=0
  !
  ! Similar to cacheCondition but applies only to disk based
  ! results sets. Default is CACHE_ROWS.
  !
  resultsSetCache=CACHE_ROWS
  !
  ! Similar to cacheAmount but applies only to disk based
  ! results sets. Default is 100.
  !
  resultsSetCacheAmount=100
  !
  ! Number of rows to read into the disk read ahead buffer. 
  ! Recommended to be set somewhere around 128 to 256. 
  ! Default is 20.
  !
  rowCacheSize=128
  !
  ! The read ahead buffer is effective at speeding up full
  ! table scans. However for indexed lookups or multiple
  ! simultaneous scans it is better to read a single row at
  ! a time. Each table holds a small number of single row
  ! buffers to improve such operations. Default is 8.
  !
  !singleRowCount=4
  !
  ! Sometimes the look ahead buffer can be held by a single
  ! thread even though it is not retrieveing many values from it.
  ! If too many lookups retrieve data from the single row
  ! buffers then it is better to flush the look ahead buffer and
  ! make it available for re-use. Default is 128.
  !
  !flushAfterCacheMisses=64
  !
  ! Number of rows to read ahead for system tables. By default
  ! system tables cache everything, so it is wasteful to have large
  ! read ahead buffers since they will very rarely be used. This
  ! allows the size of the system read ahead buffers to be reduced
  ! if necessary. Defaults to rowCacheSize.
  !
  !systemRows=20
  !
  ! The control column in all tables normally has a large cache
  ! since this speeds up all operation on that table. This can be
  ! varied to either improve performance or to reduce space.
  ! default is 8192.
  !
  ! This value applies only when tables are first created. It has no effect
  ! when a table is being re-opened.
  !
  !controlColCacheSize=512
  !
  ! By default, InstantDB only does a cursory search for deleted rows during 
  ! UPDATE statements. Setting searchDeletes=1 causes more detailed searches 
  ! for deleted rows. This slows down UPDATE executions, but reults in more 
  ! compact tables.  Default is 0.
  !
  searchDeletes=0
  !
  ! The interval, in milliseconds, between checks for statement execution
  ! timeouts. Default is 5000.
  !
  !timerCheck=5000
  
  !---------------------------------------------------------------------
  !
  ! LOGGING AND DEBUGGING PROPERTIES
  !
  !---------------------------------------------------------------------
  
  !
  ! Non-zero means include SQL statements in the export file. 
  !
  exportSQL=0
  !
  ! Non-zero means trace output also directed to console. 
  ! Defaults to 0.
  !
  traceConsole=0
  !
  ! Relative or absolute path where exporting and tracing goes.
  !
  !traceFile=./logs/trace.log
  !
  ! Bitmap of various items that can be traced. See debug.html. 
  ! Defaults to 0.
  !
  traceLevel=0
  
  !---------------------------------------------------------------------
  !
  ! TRANSACTION AND RECOVERY PROPERTIES
  !
  !---------------------------------------------------------------------
  
  !
  ! 0 means do not perform recovery on startup.
  ! 1 means perform automatic recovery
  ! 2 (default) means prompt the user using standard in 
  !
  recoveryPolicy=1
  !
  ! Sets the level of transaction journalling. See trans.html.
  ! Defaults to 1.
  !
  ! 0 - No journalling takes place.
  ! 1 - Normal journalling (default).
  ! 2 - Full journalling.
  !
  transLevel=2
  !
  ! When doing an import, defines the number of rows imported 
  ! before the transaction is committed. Recommended value 8192.
  ! defaults to 100.
  !
  transImports=100
  
  !---------------------------------------------------------------------
  !
  ! DATE, TIME AND CURRENCY PROPERTIES
  !
  !---------------------------------------------------------------------
  
  !
  ! Number of digits after decimal point in currency outputs. Defaults to 2.
  !
  currencyDecimal=2
  !
  ! Currency symbol used in currency outputs. Defaults to $.
  !
  currencySymbol=$
  !
  ! Default format for date columns. Defaults to "yyyy-mm-dd".
  !
  dateFormat=yyyy-mm-dd
  !
  ! Default format for timestamp columns. Defaults to "yyyy-mm-dd hh:mm:ss.lll".
  !
  dateTimeFormat=yyyy-mm-dd hh:mm:ss.lll
  !
  ! If set, then all two digit dates less than its value are interpreted 
  ! as 21st century dates. 
  !
  !milleniumBoundary=50
  !
  ! Set to 1 causes the date string "now" to store a full timestamp. 
  ! Default is to store only the date for fields with now hour in the 
  ! format string.
  !
  nowMeansTime=0
  
  !---------------------------------------------------------------------
  !
  ! STRING HANDLING PROPERTIES
  !
  !---------------------------------------------------------------------
  
  !
  ! If set to 1 then String hashes use the JDK Object.hashCode() function.
  ! By default, uses InstantDB's String hashing.
  !
  altStringHashing=0
  !
  ! Set to 1 to cause LIKE clauses to always perform case insensitive 
  ! comparisons. 
  !
  likeIgnoreCase=0
  !
  ! Same as SET LITERAL STRICT_ON. Prevents string literals being interpreted
  ! as column names or numbers. Default is 0.
  !
  strictLiterals=0
  !
  ! Set this value to 1 (one) if you would like PreparedStatement.setString()
  ! to ignore "\" (backslash) characters when proceesing string constants.
  ! When set, InstantDB will not attempt to interpret \ as the start of an
  ! escape sequence. Default is 0.
  !
  !prepareIgnoresEscapes=1
  
  !---------------------------------------------------------------------
  !
  ! MISCELLANEOUS PROPERTIES
  !
  !---------------------------------------------------------------------
  
  !
  ! Allows selected InstantDB keywords to be un-reserved. 
  ! e.g. ignoreKeywords=url,quote would allow the keywords 
  ! url and quote to be used as table or column names. 
  !
  ! This faciliy is provided for compatatbility reasons only.
  ! It's use is not recommended AND IS NOT SUPPORTED.
  !
  !ignoreKeywords
  !
  ! Non-zero means database is opened in read only mode.
  !
  readOnly=0
  
  
  
  1.1                  
openejb1/examples/moviefun/src/webapp/META-INF/log4j.properties
  
  Index: log4j.properties
  ===================================================================
  #  Configuration file for logging in OpenEJB
  #  
  #  OpenEJB uses Apache Log4j to provide logging services
  #  to the container system.
  #
  #  This file configures log4j using the properties file
  #  format declared by the class PropertyConfigurator
  #
  #  For a complete reference on log4j property 
  #  configuration, visit:
  #  
  #  
http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/PropertyConfigurator.html
  #
  #  This file is designated as the log4j configuration file
  #  when the system property, log4j.configuration, is set
  #  as follows:
  #
  #  java -Dlog4j.configuration=file:conf/logging.conf
  #  
  #  Any other file could be set as the log4j configuration
  #  file using that file name instead.  For example, to 
  #  set the logging configuration using logging.xml, set
  #  the log4j.configuration system property as follows: 
  #
  #  java -Dlog4j.configuration=file:conf/logging.xml 
  #
  #  For more information on specifying log4j configuration
  #  files, visit:
  #  
  #  http://jakarta.apache.org/log4j/docs/manual.html
  #
  #
  
  log4j.category.OpenEJB           = warn, R
  log4j.category.OpenEJB.startup   = debug
  log4j.category.OpenEJB.CastorCMP = warn
  log4j.category.CastorCMP         = warn,  R
  log4j.category.org.exolab.castor = debug, R
  
  log4j.appender.R                          = 
org.apache.log4j.RollingFileAppender
  log4j.appender.R.File                     = openejb.log
  log4j.appender.R.MaxFileSize              = 1000KB
  log4j.appender.R.MaxBackupIndex           = 3
  log4j.appender.R.layout                   = org.apache.log4j.PatternLayout
  log4j.appender.R.layout.ConversionPattern = %d [%t] %-5p - %m%n
  
  
  
  1.1                  
openejb1/examples/moviefun/src/webapp/META-INF/openejb-jar.xml
  
  Index: openejb-jar.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- The purpose of this file is essentially to map you ejb-jar.xml to the 
openejb.xml -->
  <openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1";>
        <ejb-deployment ejb-name="MovieEJB" deployment-id="MovieEJB" 
container-id="Movie CMP Container">
                <resource-link res-ref-name="jdbc/moviedb" res-id="Movie 
Database Connector"/>
          <query>
              <query-method>
                  <method-name>findByTitle</method-name>
                  
<method-params><method-param>java.lang.String</method-param></method-params>
              </query-method>
              <object-ql>SELECT movie FROM org.acme.movie.MovieBean movie WHERE 
movie.title = $1</object-ql>
          </query>
          <query>
              <query-method>
                  <method-name>findByDirector</method-name>
                  
<method-params><method-param>java.lang.String</method-param></method-params>
              </query-method>
              <object-ql>SELECT movie FROM org.acme.movie.MovieBean movie WHERE 
movie.director = $1</object-ql>
          </query>
          <query>
              <query-method>
                  <method-name>findByGenre</method-name>
                  
<method-params><method-param>java.lang.String</method-param></method-params>
              </query-method>
              <object-ql>SELECT movie FROM org.acme.movie.MovieBean movie WHERE 
movie.genre = $1</object-ql>
          </query>
          <query>
              <query-method>
                  <method-name>findAllMovies</method-name>
                  <method-params/>
              </query-method>
              <object-ql>SELECT movie FROM org.acme.movie.MovieBean 
movie</object-ql>
          </query>
      </ejb-deployment>
      <ejb-deployment ejb-name="ContextEJB" deployment-id="ContextEJB" 
container-id="Default Stateless Container">
          <resource-link res-ref-name="jdbc/moviedb" res-id="Movie Database 
Connector"/>
      </ejb-deployment>
  </openejb-jar>
  
  
  1.1                  
openejb1/examples/moviefun/src/webapp/META-INF/openejb.xml
  
  Index: openejb.xml
  ===================================================================
  <openejb>
  
  <Container id="Movie CMP Container" ctype="CMP_ENTITY">
      Global_TX_Database  META-INF/cmp.global-database.xml
      Local_TX_Database   META-INF/cmp.local-database.xml
  </Container>
  
  <Container id="Default Stateless Container" ctype="STATELESS"/>
  
  <Connector id="Movie Database Connector">
      JdbcDriver   org.enhydra.instantdb.jdbc.idbDriver
      JdbcUrl      jdbc:idb:META-INF/instantdb.properties
      UserName     Admin
      Password     pass
  </Connector>
  
  <Deployments dir="." />
  
  </openejb>
  
  
  

Reply via email to