Hi all,

I recently integrated the JTA and JPA pieces from Aries in Geronimo
and exposed connection factories in OSGi service registry. With these
changes we now have all the main pieces in place to deploy unmodified
Aries Blog sample & AriesTrader on Geronimo. Here's how to do it:

1) Make sure you have the latest trunk build. I used tomcat ee 6
assembly but things should also work with the jetty assembly.

2) Deploy the attached aries-datasource connector. It will create the
data sources & database tables for both samples. To deploy the
connector do:

./bin/deploy -u system -p manager deploy
~/.m2/repository/org/tranql/tranql-connector-derby-embed-xa/1.5/tranql-connector-derby-embed-xa-1.5.rar
aries-datasource.xml

3) Build "samples" module in Aries trunk.

To deploy the Blog sample do:

./bin/deploy -u system -p manager deploy <aries
trunk>/samples/blog/blog-jpa-eba/target/org.apache.aries.samples.blog.jpa.eba-0.1-incubating-SNAPSHOT.eba

or to deploy AriesTrader do:

./bin/deploy -u system -p manager deploy <aries
trunk>/samples/ariestrader-sample/assemblies/ariestrader-all-eba/target/org.apache.aries.samples.ariestrader.all-0.1-incubating-SNAPSHOT.eba

If all goes well the Blog sample should be available under
http://localhost:8080/blog and AriesTrader under
http://localhost:8080/ariestrader.

Btw, when running the deploy command you might see some "Address
already in use" exceptions. They can be ignored.

Let me know if you have any problems,

Jarek
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You 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.
-->

<!-- $Rev: 684945 $ $Date: 2008-08-11 17:33:13 -0400 (Mon, 11 Aug 2008) $ -->

<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2";>

 <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2";>
    <dep:moduleId>
      <dep:groupId>org.apache.geronimo.configs</dep:groupId>
      <dep:artifactId>aries-datasource</dep:artifactId>
      <dep:version>3.0-SNAPSHOT</dep:version>
      <dep:type>car</dep:type>
    </dep:moduleId>
 </dep:environment>

    <resourceadapter>
        <outbound-resourceadapter>
            <connection-definition>
                <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>

                <connectiondefinition-instance>
                    <name>jdbc/blogdb</name>
                    <jndi-name>jdbc/blogdb</jndi-name>
                    <config-property-setting name="UserName"></config-property-setting>
                    <config-property-setting name="Password"></config-property-setting>
                    <config-property-setting name="DatabaseName">blogDB</config-property-setting>
                    <config-property-setting name="CreateDatabase">true</config-property-setting>
                    <connectionmanager>
                        <xa-transaction>
                            <transaction-caching/>
                        </xa-transaction>
                        <single-pool>
                            <max-size>100</max-size>
                            <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
                            <select-one-assume-match/>
                        </single-pool>
                    </connectionmanager>
                </connectiondefinition-instance>
                <connectiondefinition-instance>
                    <name>jdbc/blogdbnojta</name>
                    <jndi-name>jdbc/blogdbnojta</jndi-name>
                    <config-property-setting name="UserName"></config-property-setting>
                    <config-property-setting name="Password"></config-property-setting>
                    <config-property-setting name="DatabaseName">blogDB</config-property-setting>
                    <config-property-setting name="CreateDatabase">true</config-property-setting>
                    <connectionmanager>
                        <no-transaction/>
                        <single-pool>
                            <max-size>100</max-size>
                            <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
                            <select-one-assume-match/>
                        </single-pool>
                    </connectionmanager>
                </connectiondefinition-instance>


                <connectiondefinition-instance>
                    <name>jdbc/TradeDataSource</name>
                    <jndi-name>jdbc/TradeDataSource</jndi-name>
                    <config-property-setting name="UserName"></config-property-setting>
                    <config-property-setting name="Password"></config-property-setting>
                    <config-property-setting name="DatabaseName">tradedb</config-property-setting>
                    <config-property-setting name="CreateDatabase">true</config-property-setting>
                    <connectionmanager>
                        <xa-transaction>
                            <transaction-caching/>
                        </xa-transaction>
                        <single-pool>
                            <max-size>100</max-size>
                            <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
                            <select-one-assume-match/>
                        </single-pool>
                    </connectionmanager>
                </connectiondefinition-instance>
                <connectiondefinition-instance>
                    <name>jdbc/NoTxTradeDataSource</name>
                    <jndi-name>jdbc/NoTxTradeDataSource</jndi-name>
                    <config-property-setting name="UserName"></config-property-setting>
                    <config-property-setting name="Password"></config-property-setting>
                    <config-property-setting name="DatabaseName">tradedb</config-property-setting>
                    <config-property-setting name="CreateDatabase">true</config-property-setting>
                    <connectionmanager>
                        <no-transaction/>
                        <single-pool>
                            <max-size>100</max-size>
                            <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
                            <select-one-assume-match/>
                        </single-pool>
                    </connectionmanager>
                </connectiondefinition-instance>


            </connection-definition>
        </outbound-resourceadapter>
    </resourceadapter>


    <gbean name="DBInitializationTrader" class="org.apache.geronimo.connector.wrapper.DatabaseInitializationGBean">
<attribute name="sql">
create table holdingejb
  (purchaseprice decimal(10, 2),
   holdingid integer not null,
   quantity double not null,
   purchasedate timestamp,
   account_accountid integer,
   quote_symbol varchar(250),
   optLock integer);

alter table holdingejb
  add constraint pk_holdingejb primary key (holdingid);

create table accountprofileejb
  (address varchar(250),
   passwd varchar(250),
   userid varchar(250) not null,
   email varchar(250),
   creditcard varchar(250),
   fullname varchar(250),
   optLock integer);

alter table accountprofileejb
  add constraint pk_accountprofile2 primary key (userid);

create table quoteejb
  (low decimal(10, 2),
   open1 decimal(10, 2),
   volume double not null,
   price decimal(10, 2),
   high decimal(10, 2),
   companyname varchar(250),
   symbol varchar(250) not null,
   change1 double not null,
   optLock integer);

alter table quoteejb
  add constraint pk_quoteejb primary key (symbol);

create table keygenejb
  (keyval integer not null,
   keyname varchar(250) not null);

alter table keygenejb
  add constraint pk_keygenejb primary key (keyname);

create table accountejb
  (creationdate timestamp,
   openbalance decimal(10, 2),
   logoutcount integer not null,
   balance decimal(10, 2),
   accountid integer not null,
   lastlogin timestamp,
   logincount integer not null,
   PROFILE_USERID VARCHAR(250),
   optLock integer);

alter table accountejb
  add constraint pk_accountejb primary key (accountid);

create table orderejb
  (orderfee decimal(10, 2),
   completiondate timestamp,
   ordertype varchar(250),
   orderstatus varchar(250),
   price decimal(10, 2),
   quantity double not null,
   opendate timestamp,
   orderid integer not null,
   account_accountid integer,
   quote_symbol varchar(250),
   holding_holdingid integer,
   optLock integer);

alter table orderejb
  add constraint pk_orderejb primary key (orderid);

create index profile_userid on accountejb(profile_userid);
create index account_accountid on holdingejb(account_accountid);
create index account_accountidt on orderejb(account_accountid);
create index holding_holdingid on orderejb(holding_holdingid);
create index orderstatus on orderejb(orderstatus);
create index ordertype on orderejb(ordertype);
</attribute>
        <reference name="DataSource">
            <name>jdbc/TradeDataSource</name>
        </reference>
    </gbean>

    <gbean name="DBInitializationBlog" class="org.apache.geronimo.connector.wrapper.DatabaseInitializationGBean">
<attribute name="sql">
CREATE TABLE AUTHOR (email VARCHAR(255) NOT NULL, bio VARCHAR(255), displayName VARCHAR(255), dob TIMESTAMP, name VARCHAR(255), PRIMARY KEY (email));
CREATE TABLE AUTHOR_BLOGENTRY (AUTHOR_EMAIL VARCHAR(255), POSTS_ID BIGINT);
CREATE TABLE BLOGENTRY (id BIGINT NOT NULL, blogText VARCHAR(10000), publishDate TIMESTAMP, title VARCHAR(255), updatedDate TIMESTAMP, AUTHOR_EMAIL VARCHAR(255), PRIMARY KEY (id));
CREATE TABLE COMMENT (id BIGINT NOT NULL, comment VARCHAR(255), creationDate TIMESTAMP, AUTHOR_EMAIL VARCHAR(255), BLOGENTRY_ID BIGINT);
CREATE TABLE OPENJPA_SEQUENCE_TABLE (ID SMALLINT NOT NULL, SEQUENCE_VALUE BIGINT, PRIMARY KEY (ID));
CREATE INDEX I_THR_TRY_AUTHOR_EMAIL ON AUTHOR_BLOGENTRY (AUTHOR_EMAIL);
CREATE INDEX I_THR_TRY_ELEMENT ON AUTHOR_BLOGENTRY (POSTS_ID);
CREATE INDEX I_BLGNTRY_AUTHOR ON BLOGENTRY (AUTHOR_EMAIL);
DELETE FROM AUTHOR;
DELETE FROM AUTHOR_BLOGENTRY;
DELETE FROM BLOGENTRY;
DELETE FROM COMMENT;
DELETE FROM OPENJPA_SEQUENCE_TABLE;
</attribute>
        <reference name="DataSource">
            <name>jdbc/blogdb</name>
        </reference>
    </gbean>

</connector>

Reply via email to