james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject cvs commit: jakarta-james/src/conf sqlResources.xml james-assembly.xml james-config.xml
Date Tue, 11 Sep 2001 04:29:30 GMT
serge       01/09/10 21:29:30

  Modified:    src/conf james-assembly.xml james-config.xml
  Added:       src/conf sqlResources.xml
  Log:
  Adding code from userstore branch.
  
  Revision  Changes    Path
  1.2       +8 -1      jakarta-james/src/conf/james-assembly.xml
  
  Index: james-assembly.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/conf/james-assembly.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- james-assembly.xml	2001/05/15 17:02:57	1.1
  +++ james-assembly.xml	2001/09/11 04:29:30	1.2
  @@ -103,6 +103,8 @@
     <block class="org.apache.james.core.AvalonMailStore" name="mailstore" >
       <provide name="objectstorage"
                role="org.apache.avalon.cornerstone.services.store.Store"/> 
  +    <provide name="database-connections"
  +             role="org.apache.avalon.cornerstone.services.datasource.DataSourceSelector"
/>
     </block>
          
     <!-- The User Storage block -->
  @@ -110,6 +112,8 @@
       <!-- Configure file based user store here, defaults should be fine -->
       <provide name="objectstorage"
                role="org.apache.avalon.cornerstone.services.store.Store"/>
  +    <provide name="database-connections"
  +             role="org.apache.avalon.cornerstone.services.datasource.DataSourceSelector"
/>
     </block>
         
   
  @@ -135,7 +139,10 @@
     <!-- The Time Manager block -->
     <block class="org.apache.avalon.cornerstone.blocks.scheduler.DefaultTimeScheduler"

            name="scheduler"/>
  -
  +         
  +  <!-- The DataSourceSelector block -->
  +  <block class="org.apache.avalon.cornerstone.blocks.datasource.DefaultDataSourceSelector"

  +         name="database-connections"/>
   
   </assembly>
   
  
  
  
  1.10      +107 -72   jakarta-james/src/conf/james-config.xml
  
  Index: james-config.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/conf/james-config.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- james-config.xml	2001/08/11 10:31:17	1.9
  +++ james-config.xml	2001/09/11 04:29:30	1.10
  @@ -13,8 +13,8 @@
       CONFIRM? comment in the left
       margin.
   
  -    This is $Revision: 1.9 $
  -    Committed on $Date: 2001/08/11 10:31:17 $ by: $Author: charlesb $
  +    This is $Revision: 1.10 $
  +    Committed on $Date: 2001/09/11 04:29:30 $ by: $Author: serge $
   -->
   <config>
   
  @@ -66,20 +66,25 @@
   
   
   
  -      <!-- The inbox repository is the location for users inboxes -->
  +      <!-- The inbox repository is the location for users inboxes
         <inboxRepository>
           <repository destinationURL="file://var/mail/inboxes/"
                       type="MAIL">
           </repository>
  -      </inboxRepository>
  +      </inboxRepository> -->
   
  -      <!-- Alternative inbox repository definition for DB use. Note you must create
the inbox.properties file
  +      <!-- Alternative inbox repository definition for DB use.
  +           The format for the destinationURL is "db://<data-source>/<table>"
  +            - <data-source> is the datasource name set up in the
  +                    database-connections block, below
  +            - <table> is the name of the table to store user inboxes in
  +           The user name is used as <repositoryName> for this repository config.
  +      -->
         <inboxRepository>
  -        <repository destinationURL="db://../conf/inbox.properties"
  -                    type="SPOOL">
  +        <repository destinationURL="db://maildb/inbox/"
  +                    type="MAIL">
           </repository>
         </inboxRepository>
  -      -->
     </James>
   
     <!-- The James Spool Manager block  -->
  @@ -148,6 +153,10 @@
               <subjectprefix>JamesList</subjectprefix>
             </mailet>
   
  +          <mailet match="RecipientIs=test@glissando.lokitech.com" class="ToProcessor">
  +            <processor> schedule </processor>
  +          </mailet>
  +
             <!-- Sends remaining mails to the transport processor for either
             local or remote delivery -->
             <mailet match="All" class="ToProcessor">
  @@ -155,6 +164,13 @@
             </mailet>
           </processor>
   
  +        <processor name="schedule">
  +          <mailet match="All" class="ToRepository">
  +            <repositoryPath> db://maildb/PendingMail/pending </repositoryPath>
  +            <passThrough> true </passThrough>
  +          </mailet>
  +        </processor>
  +
           <!-- Processor CONFIGURATION SAMPLE: error is the processor mails with
           failure conditions enter -->
           <processor name="error">
  @@ -256,6 +272,7 @@
     <dnsserver>
           <servers>
             <server>127.0.0.1</server>
  +          <server>216.181.1.2</server>
             <!--<server> put extra dns server address here </server>-->
           </servers>
           <authoritative>false</authoritative>
  @@ -437,6 +454,9 @@
             <types>
               <type>MAIL</type>
             </types>
  +          <config>
  +            <sqlFile>dist/conf/sqlResources.xml</sqlFile>
  +          </config>
           </repository>
           <repository
               class="org.apache.james.mailrepository.JDBCSpoolRepository">
  @@ -446,109 +466,124 @@
             <types>
               <type>SPOOL</type>
             </types>
  +          <config>
  +            <sqlFile>dist/conf/sqlResources.xml</sqlFile>
  +            <filestore>file://var/dbspool</filestore>
  +          </config>
           </repository>
         </repositories>
   
         <!-- The spool repository is a singular location where incoming mails
         are temporarily stored before being processed.
  -     (ex. file://c:/james/spool/) -->
  +     (ex. file://c:/james/spool/)
         <spoolRepository>
           <repository destinationURL="file://var/mail/spool/"
                       type="SPOOL">
           </repository>
         </spoolRepository>
  +      -->
   
         <!-- Alternative spool repository definition for JDBC use
  +      -->
         <spoolRepository>
  -        <repository destinationURL="db://../conf/spool.properties"
  +        <repository destinationURL="db://maildb/message/spool"
                       type="SPOOL">
           </repository>
         </spoolRepository>
  -      -->
     </mailstore>
   
     <!-- The User Storage block -->
     <users-store>
  +    <!-- Configure User Repositories here.
  +         User repositories are required for the following purposes:
  +            - hold information about Users of the James mail server
  +            - hold lists of users for the listserv mailet
  +
  +         Currently, 2 different storage options are available:
  +            - file-based storage using Java serialisation
  +            - database-backed storage
  +         (Use of database or file-system is defined on a "per-repository" basis)
   
  -    <!-- Note: Two user repositories are required for default configuration:
  +         Note: Two user repositories are required for default configuration:
            LocalUsers - the users for whom you are providing POP3, IMAP or NNTP
                         AUTH service
            list-james - the users of the james@localhost mailiinglist
       -->
  -      <!-- File-based user repository  -->
  +
  +      <!-- File-based user repositories
  +           Use these configurations to store user info in the filesystem  -->
  +      <!--
         <repository name="LocalUsers"
                     class="org.apache.james.userrepository.UsersFileRepository">
           <destination URL="file://var/users/"/>
         </repository>
   
  -      <!-- Uncomment this to store users in an RDBMS
  -      <repository name="LocalUsers"
  -                  class="org.apache.james.userrepository.UsersTownRepository">
  -        <destination URL="town://users/">
  -        <conn>file:///var/maildatabase</conn>
  -        <table>Users</table>
  -      </repository>
  -      -->
  -      <!-- The following are examples of database connections which have been
  -           tested.
  -           These should provided a guide to setting up other databases as well.
  -           The driver.class and destination.URL properties are require,
  -           but destination.user and destination.password are optional. -->
  -      <!-- Mssql server with Inet Sprinta
  -            <destination>
  -                <driver class="com.inet.tds.TdsDriver"/>
  -                <datasource>
  -                    <dburl>jdbc:inetdae7:127.0.0.1?database=mail</dburl>
  -                    <user>user</user>
  -                    <password>password</password>
  -                </datasource>
  -            </destination>
  +      <repository name="list-james"
  +                  class="org.apache.james.userrepository.UsersFileRepository">
  +        <destination URL="file://var/lists/list-james/"/>
         </repository>
         -->
  +
  +      <!-- Database backed user repositories
  +           Use these configurations to store user info in a database.
  +           Note: the <data-source> element must refer to a connection configured
  +            in the <database-connections> configuration section. -->
   
  -      <!-- MySQL server via ODBC
  +      <!-- The LocalUsers repository, for storing James' User info. -->
         <repository name="LocalUsers"
  -                  class="org.apache.james.userrepository.UsersJDBCRepository">
  -            <destination>
  -                <driver class="sun.jdbc.odbc.JdbcOdbcDriver"/>
  -                <datasource>
  -                    <dburl>jdbc:odbc:mail-mysql</dburl>
  -                </datasource>
  -            </destination>
  +                  class="org.apache.james.userrepository.JamesUsersJdbcRepository"
  +                  destinationURL="db://maildb/users">
  +          <sqlFile>dist/conf/sqlResources.xml</sqlFile>
         </repository>
  -      -->
  -      <!-- MySQL server via mm mysql driver
  -      <repository name="LocalUsers"
  -                  class="org.apache.james.userrepository.UsersJDBCRepository">
  -            <destination>
  -                <driver class="org.gjt.mm.mysql.Driver"/>
  -                <datasource>
  -                    <dburl>jdbc:mysql://127.0.0.1/mail</dburl>
  -                    <user>user</user>
  -                    <password>password</password>
  -                </datasource>
  -            </destination>
  +      <!-- The list used by the default ListServ mailet -->
  +      <repository name="list-james"
  +                  class="org.apache.james.userrepository.ListUsersJdbcRepository"
  +                  destinationURL="db://maildb/lists/list-james">
  +          <sqlFile>dist/conf/sqlResources.xml</sqlFile>
         </repository>
  -      -->
  -      <!-- Oracle8i server via thin driver
  -      <repository name="LocalUsers"
  -                  class="org.apache.james.userrepository.UsersJDBCRepository">
  -            <destination>
  -                <driver class="oracle.jdbc.driver.OracleDriver"/>
  -                <datasource>
  -                    <dburl>jdbc:oracle:thin:@127.0.0.1:1521:mail</dburl>
  -                    <user>user</user>
  -                    <password>password</password>
  -                </datasource>
  -            </destination>
  +      <!-- An example mailinglist repository, with no "listName" parameter
  +           specified. Uses the default value from the sql definition file. -->
  +      <repository name="list-test"
  +                  class="org.apache.james.userrepository.ListUsersJdbcRepository"
  +                  destinationURL="db://maildb/lists">
  +          <sqlFile>dist/conf/sqlResources.xml</sqlFile>
         </repository>
  -      -->
  -
  -      <repository name="list-james"
  -                  class="org.apache.james.userrepository.UsersFileRepository">
  -        <destination URL="file://var/lists/list-james/"/>
  +      <!-- An example UserRepository for DefaultUser implementations. Testing purposes
  +           only. -->
  +      <repository name="default-users"
  +                  class="org.apache.james.userrepository.DefaultUsersJdbcRepository"
  +                  destinationURL="db://maildb/DefaultUsers">
  +          <sqlFile>dist/conf/sqlResources.xml</sqlFile>
         </repository>
     </users-store>
  +
  +  <!-- The database-connections block -->
  +  <database-connections>
  +    <!-- Confugure database connections here.
  +         These connections are referred to by name elsewhere in the config file -->
  +<!-- CHECKME! To allow James to use a database, configure the database connection here
-->
  +    <data-sources>
  +        <!-- Example, connecting to a MySQL database called "mail" on localhost
  +        -->
  +        <!--
  +        <data-source name="maildb"
  +                     type="org.apache.avalon.excalibur.datasource.JdbcDataSource">
  +            <driver>org.gjt.mm.mysql.Driver</driver>
  +            <dburl>jdbc:mysql://127.0.0.1/mail</dburl>
  +            <user>username</user>
  +            <password>password</password>
  +        </data-source>
  +        -->
  +
  +        <data-source name="maildb"
  +        			type="org.apache.avalon.excalibur.datasource.JdbcDataSource">
  +        	<driver>com.inet.tds.TdsDriver</driver>
  +        	<dburl>jdbc:inetdae7:127.0.0.1?database=James</dburl>
  +        	<user>sa_james</user>
  +        	<password>blahblah</password>
  +        </data-source>
  +    </data-sources>
  +  </database-connections>
   
     <!-- Configuration for Cornerstone Blocks only after here
          NOTHING BELOW THIS SHOULD NEED CHANGING,
  
  
  
  1.1                  jakarta-james/src/conf/sqlResources.xml
  
  Index: sqlResources.xml
  ===================================================================
  <!-- SQL Statements used by James for database access. -->
  <sqlResources>
  
  <!--
       This section provided configuration to determine the determine the
       database product which is being used for storage. Different database
       products may require different SQL syntax.
  
       The jdbc database connection is examined to see if it matches with the
       regular expressions specified in any of the defined matchers. The matchers
       are processed in the over provided here, with the first successful match
       defining the "db" value for this connection.
  
       This value is then used to choose between different definitions for various
       named sql statements, defined below. If no match is found,
       the default sql statements are used.
  -->
  <dbMatchers>
      <dbMatcher db="mssql" databaseProductName="microsoft sql server"/>
      <dbMatcher db="oracle" databaseProductName="oracle.*"/>
      <dbMatcher db="mysql" databaseProductName="my.*"/>
      <dbMatcher db="postgresql" databaseProductName="postgres.*"/>
  </dbMatchers>
  
  <!-- SQL statements to use for various components.
  
       Parameter definitions ${param} are replaced with parameter values
       from the configuration file.
  
       If a named statement has a definition defined for the current database product,
       then that statement is used. Otherwise the default statement is used.
  -->
  <!-- SQL statements for the JamesUsersJdbcRepository -->
  <sqlDefs name="org.apache.james.userrepository.JamesUsersJdbcRepository">
      <sql name="tableName">${table}</sql>
      <sql name="select">SELECT username, pwdHash, pwdAlgorithm, useForwarding,
                          forwardDestination, useAlias, alias
                   FROM ${table}
      </sql>
      <sql name="selectByLowercaseName">
                  SELECT username, pwdHash, pwdAlgorithm, useForwarding,
                          forwardDestination, useAlias, alias
                  FROM ${table}
                  WHERE lower(username) = ?
      </sql>
      <sql name="insert">INSERT INTO ${table}
                      (username, pwdHash, pwdAlgorithm, useForwarding, forwardDestination,
useAlias, alias)
                  VALUES (?,?,?,?,?,?,?)
      </sql>
      <sql name="update">UPDATE ${table} SET
                      pwdHash = ?, pwdAlgorithm = ?, useForwarding = ?, forwardDestination
= ?, useAlias = ?, alias = ?
                  WHERE username = ?
      </sql>
      <sql name="delete">DELETE FROM ${table} WHERE username = ?</sql>
      <sql name="createTable">CREATE TABLE ${table} (username VARCHAR(50) NOT NULL,
pwdHash VARCHAR(50), pwdAlgorithm VARCHAR(20), useForwarding SMALLINT, forwardDestination
VARCHAR(250), useAlias SMALLINT, alias VARCHAR(250), PRIMARY KEY(username))</sql>
      <!-- An example of a database-specific sql statement
      <sql name="createTable" db="mssql">CREATE TABLE ${table} (uniqueId UNIQUEIDENTIFIER,
username VARCHAR(50) NOT NULL, pwdHash VARCHAR(50), pwdAlgorithm VARCHAR(20), useForwarding
SMALLINT, forwardDestination VARCHAR(250), useAlias SMALLINT, alias VARCHAR(250), PRIMARY
KEY(username))</sql>
      -->
  </sqlDefs>
  
  <!-- SQL statements for the DefaultUsersJdbcRepository -->
  <sqlDefs name="org.apache.james.userrepository.DefaultUsersJdbcRepository">
      <sql name="tableName">${table}</sql>
      <sql name="select">SELECT username, pwdHash, pwdAlgorithm
                   FROM ${table}
      </sql>
      <sql name="insert">INSERT INTO ${table}
                      (username, pwdHash, pwdAlgorithm)
                  VALUES (?,?,?)
      </sql>
      <sql name="update">UPDATE ${table} SET
                      pwdHash = ?, pwdAlgorithm = ?
                  WHERE username = ?
      </sql>
      <sql name="delete">DELETE FROM ${table} WHERE username = ?</sql>
      <sql name="createTable">CREATE TABLE ${table} (username VARCHAR(50) NOT NULL,
pwdHash VARCHAR(50), pwdAlgorithm VARCHAR(20), PRIMARY KEY(username))</sql>
  </sqlDefs>
  
  <!-- SQL statements for the ListUsersJdbcRepository
          (allowing multiple lists in one table) -->
  <sqlDefs name="org.apache.james.userrepository.ListUsersJdbcRepository">
      <!-- An example of defining "default" parameters within the definition file.
           This is used if no key parameter is specified in config. -->
      <parameters key="unknownList"/>
  
      <sql name="tableName">${table}</sql>
      <sql name="select">SELECT listSubscriber
                   FROM ${table}
                   WHERE listName = '${key}'
      </sql>
      <sql name="insert">INSERT INTO ${table}
                      (listSubscriber, listName)
                  VALUES (?, '${key}')
      </sql>
      <sql name="update">UPDATE ${table} SET
                      listSubscriber = ?
                  WHERE listSubscriber = ? AND listName = '${key}'
      </sql>
      <sql name="delete">DELETE FROM ${table}
                  WHERE listSubscriber = ? AND listName = '${key}'
      </sql>
      <sql name="createTable">CREATE TABLE ${table} (listName VARCHAR(50) NOT NULL,
listSubscriber VARCHAR(50) NOT NULL)</sql>
  </sqlDefs>
  
  <!-- SQL statements for the JdbcMailRepository  -->
  <sqlDefs name="org.apache.james.mailrepository.JdbcMailRepository">
      <sql name="checkMessageExistsSQL">SELECT count(*) FROM ${table} WHERE message_name
= ? AND repository_name = ?</sql>
      <sql name="updateMessageSQL">UPDATE ${table} SET message_state = ?, error_message
= ?, sender = ?, recipients = ?, remote_host = ?, remote_addr = ?, last_updated = ? WHERE
message_name = ? AND repository_name = ?</sql>
      <sql name="updateMessageBodySQL">UPDATE ${table} SET message_body = ? WHERE message_name
= ? AND repository_name = ?</sql>
      <sql name="insertMessageSQL">INSERT INTO ${table} (message_name, repository_name,
message_state, error_message, sender, recipients, remote_host, remote_addr, last_updated,
message_body) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)</sql>
      <sql name="retrieveMessageSQL">SELECT message_state, error_message, sender, recipients,
remote_host, remote_addr, last_updated FROM ${table} WHERE message_name = ? AND repository_name
= ?</sql>
      <sql name="retrieveMessageBodySQL">SELECT message_body FROM ${table} WHERE message_name
= ? AND repository_name = ?</sql>
      <sql name="retrieveMessageBodySizeSQL" db="mssql">SELECT datalength(message_body)
FROM ${table} WHERE message_name = ? AND repository_name = ?</sql>
      <sql name="retrieveMessageBodySizeSQL" db="mysql">SELECT length(message_body)
FROM ${table} WHERE message_name = ? AND repository_name = ?</sql>
      <sql name="removeMessageSQL">DELETE FROM ${table} WHERE message_name = ? AND repository_name
= ?</sql>
      <sql name="listMessagesSQL">SELECT message_name, message_state, last_updated FROM
${table} WHERE repository_name = ? ORDER BY last_updated ASC</sql>
      <sql name="createTable" db="mysql">
          CREATE TABLE ${table} (
          	message_name varchar (200) NOT NULL PRIMARY KEY,
          	repository_name varchar (200) NOT NULL PRIMARY KEY,
          	message_state varchar (30) NOT NULL ,
          	error_message varchar (200) NULL ,
          	sender varchar (200) NULL ,
          	recipients text NOT NULL ,
          	remote_host varchar (100) NOT NULL ,
          	remote_addr varchar (20) NOT NULL ,
          	message_body longblob NOT NULL ,
          	last_updated datetime NOT NULL
          )
      </sql>
      <sql name="createTable" db="mssql">
          CREATE TABLE [dbo].[${table}] (
          	[message_name] [varchar] (200) NOT NULL PRIMARY KEY,
          	[repository_name] [varchar] (200) NOT NULL,
          	[message_state] [varchar] (30) NOT NULL ,
          	[error_message] [varchar] (1000) NULL ,
          	[sender] [varchar] (200) NULL ,
          	[recipients] [text] NOT NULL ,
          	[remote_host] [varchar] (100) NOT NULL ,
          	[remote_addr] [varchar] (20) NOT NULL ,
          	[message_body] [image] NOT NULL ,
          	[last_updated] [datetime] NOT NULL
          ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
      </sql>
  </sqlDefs>
  
  </sqlResources>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


Mime
View raw message