You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by xi...@apache.org on 2010/06/30 17:00:10 UTC
svn commit: r959342 [6/13] - in /geronimo/samples/trunk: ./ samples/
samples/all-samples/all-samples-jetty/
samples/all-samples/all-samples-tomcat/ samples/daytrader/
samples/daytrader/assemblies/ samples/daytrader/assemblies/javaee/
samples/daytrader/...
Modified: geronimo/samples/trunk/samples/daytrader/plugins/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/daytrader/plugins/pom.xml?rev=959342&r1=959341&r2=959342&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/daytrader/plugins/pom.xml (original)
+++ geronimo/samples/trunk/samples/daytrader/plugins/pom.xml Wed Jun 30 15:00:02 2010
@@ -45,9 +45,9 @@
<module>daytrader-web-jdbc-tomcat</module>
<module>daytrader-web-jpa-jetty</module>
<module>daytrader-web-jpa-tomcat</module>
- <module>daytrader-jms</module>
+ <!--<module>daytrader-jms</module>
<module>daytrader-jetty</module>
- <module>daytrader-tomcat</module>
+ <module>daytrader-tomcat</module>-->
</modules>
</profile>
<!--
@@ -58,7 +58,7 @@
-Dmaven.repo.drivers=http://my.local.repo
-->
<profile>
- <id>all</id>
+ <id>all-subprojects</id>
<activation>
<property>
<name>all</name>
@@ -66,19 +66,19 @@
</activation>
<modules>
<module>daytrader-derby-datasource</module>
- <module>daytrader-db2-datasource</module>
- <module>daytrader-oracle-datasource</module>
- <module>daytrader-mysql-datasource</module>
- <module>daytrader-informix-datasource</module>
- <module>daytrader-sqlserver-datasource</module>
- <module>daytrader-postgre-datasource</module>
- <module>daytrader-web-jdbc-jetty</module>
+ <module>daytrader-web-jdbc-jetty</module>
<module>daytrader-web-jdbc-tomcat</module>
<module>daytrader-web-jpa-jetty</module>
<module>daytrader-web-jpa-tomcat</module>
<module>daytrader-jms</module>
<module>daytrader-jetty</module>
<module>daytrader-tomcat</module>
+ <module>daytrader-db2-datasource</module>
+ <module>daytrader-oracle-datasource</module>
+ <module>daytrader-mysql-datasource</module>
+ <module>daytrader-informix-datasource</module>
+ <module>daytrader-sqlserver-datasource</module>
+ <module>daytrader-postgre-datasource</module>
</modules>
<properties>
<maven.repo.drivers>http://not.a.real.repository</maven.repo.drivers>
@@ -100,47 +100,5 @@
</repositories>
</profile>
</profiles>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.geronimo.buildsupport</groupId>
- <artifactId>car-maven-plugin</artifactId>
- <version>${geronimoVersion}</version>
- <!-- Install as extention to allow 'car' packaging to be used. -->
- <extensions>true</extensions>
- <configuration>
- <archive>
- <!-- Do not include META-INF/maven to avoid long file problems on windows -->
- <addMavenDescriptor>false</addMavenDescriptor>
- </archive>
- <url>http://geronimo.apache.org/</url>
- <author>The Apache Geronimo development community</author>
- <osiApproved>true</osiApproved>
- <useMavenDependencies>
- <value>true</value>
- <includeVersion>true</includeVersion>
- <useTransitiveDependencies>true</useTransitiveDependencies>
- </useMavenDependencies>
- <deploymentConfigs>
- <deploymentConfig>${gbeanDeployer}</deploymentConfig>
- <deploymentConfig>${j2eeDeployer}</deploymentConfig>
- <deploymentConfig>${connectorDeployer}</deploymentConfig>
- </deploymentConfigs>
- <commonInstance>
- <plugin-artifact>
- <!--<geronimo-version>2.2</geronimo-version>
- <geronimo-version>2.2.1-SNAPSHOT</geronimo-version>-->
- <jvm-version>1.5</jvm-version>
- <jvm-version>1.6</jvm-version>
- <source-repository>~/.m2/repository/</source-repository>
- <source-repository>http://repository.apache.org/snapshots/</source-repository>
- <source-repository>http://repo1.maven.org/maven2/</source-repository>
- </plugin-artifact>
- </commonInstance>
- </configuration>
- </plugin>
-
- </plugins>
- </build>
+
</project>
Modified: geronimo/samples/trunk/samples/daytrader/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/daytrader/pom.xml?rev=959342&r1=959341&r2=959342&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/daytrader/pom.xml (original)
+++ geronimo/samples/trunk/samples/daytrader/pom.xml Wed Jun 30 15:00:02 2010
@@ -41,28 +41,11 @@
<properties>
<!-- This property is required by the car:package mojo, inherited from samples' root pom -->
<!--Crack: Use 2.2 to test if plugins is compilable and workable -->
- <geronimoVersion>2.2</geronimoVersion>
+ <!--<geronimoVersion>2.2</geronimoVersion>-->
<!-- set siteId to artifactId for any "top level" project rooting a website -->
<siteId>daytrader</siteId>
-
- <gbeanDeployerBootstrap>org.apache.geronimo.framework/geronimo-gbean-deployer-bootstrap/${geronimoVersion}/car</gbeanDeployerBootstrap>
- <gbeanDeployer>org.apache.geronimo.framework/geronimo-gbean-deployer/${geronimoVersion}/car</gbeanDeployer>
- <j2eeDeployer>org.apache.geronimo.configs/j2ee-deployer/${geronimoVersion}/car</j2eeDeployer>
- <clientDeployer>org.apache.geronimo.configs/client-deployer/${geronimoVersion}/car</clientDeployer>
- <connectorDeployer>org.apache.geronimo.configs/connector-deployer/${geronimoVersion}/car</connectorDeployer>
- <openejbDeployer>org.apache.geronimo.configs/openejb-deployer/${geronimoVersion}/car</openejbDeployer>
- <openejbcorbaDeployer>org.apache.geronimo.configs/openejb-corba-deployer/${geronimoVersion}/car</openejbcorbaDeployer>
- <axisDeployer>org.apache.geronimo.configs/axis-deployer/${geronimoVersion}/car</axisDeployer>
- <cxfDeployer>org.apache.geronimo.configs/cxf-deployer/${geronimoVersion}/car</cxfDeployer>
- <axis2Deployer>org.apache.geronimo.configs/axis2-deployer/${geronimoVersion}/car</axis2Deployer>
- <tomcatDeployer>org.apache.geronimo.configs/tomcat6-deployer/${geronimoVersion}/car</tomcatDeployer>
- <jetty7Deployer>org.apache.geronimo.configs/jetty7-deployer/${geronimoVersion}/car</jetty7Deployer>
- <jasperDeployer>org.apache.geronimo.configs/jasper-deployer/${geronimoVersion}/car</jasperDeployer>
- <jpaDeployer>org.apache.geronimo.configs/persistence-jpa10-deployer/${geronimoVersion}/car</jpaDeployer>
-
- <openjpaVersion>1.2.2</openjpaVersion>
- <geronimoJavaEE5Version>2.2</geronimoJavaEE5Version>
+ <openjpaVersion>2.0.0</openjpaVersion>
</properties>
<issueManagement>
@@ -149,15 +132,7 @@
<dependencyManagement>
- <dependencies>
- <!-- Import Geronimo Server used dependency versions -->
- <dependency>
- <groupId>org.apache.geronimo</groupId>
- <artifactId>geronimo</artifactId>
- <version>${geronimoJavaEE5Version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
+ <dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
@@ -263,7 +238,7 @@
<!-- Installable assemblies -->
<module>assemblies</module>
</modules>
- </profile>
+ </profile>
<profile>
<id>jboss-mysql</id>
Propchange: geronimo/samples/trunk/samples/javaee5/DataCDInfo/
('svn:mergeinfo' removed)
Modified: geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/pom.xml?rev=959342&r1=959341&r2=959342&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/pom.xml (original)
+++ geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/pom.xml Wed Jun 30 15:00:02 2010
@@ -1,82 +1,82 @@
-<?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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.geronimo.samples</groupId>
- <artifactId>DataCDInfo</artifactId>
- <version>3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>DataCDInfo-JTA-ear</artifactId>
- <name>Geronimo Samples :: DataCDInfo JTA + Struts1 :: EAR</name>
- <packaging>ear</packaging>
-
- <description>Geronimo Samples - DataCD Information Management Tool</description>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.geronimo.samples</groupId>
- <artifactId>DataCDInfo-JTA-war</artifactId>
- <version>${version}</version>
- <type>war</type>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.samples</groupId>
- <artifactId>DataCDInfo-JTA-ejb</artifactId>
- <version>${version}</version>
- <type>ejb</type>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-ear-plugin</artifactId>
- <configuration>
- <displayName>Geronimo Sample EAR for DataCDInfo JTA+Struts1</displayName>
- <description>Geronimo Sample EAR for DataCDInfo JTA+Struts1</description>
- <version>5</version>
- <modules>
- <ejbModule>
- <groupId>org.apache.geronimo.samples</groupId>
- <artifactId>DataCDInfo-JTA-ejb</artifactId>
- <bundleFileName>DataCDInfo-JTA-ejb.jar</bundleFileName>
- </ejbModule>
-
- <webModule>
- <groupId>org.apache.geronimo.samples</groupId>
- <artifactId>DataCDInfo-JTA-war</artifactId>
- <contextRoot>/DataCDInfoJTAStruts1</contextRoot>
- <bundleFileName>DataCDInfo-JTA-war.war</bundleFileName>
- </webModule>
- </modules>
- <!--
- HACK: Include legal muck from maven-remote-resources-plugin
- -->
- <resourcesDir>${project.build.outputDirectory}</resourcesDir>
- </configuration>
- </plugin>
-
- </plugins>
- </build>
-</project>
+<?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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.geronimo.samples</groupId>
+ <artifactId>DataCDInfo</artifactId>
+ <version>3.0-M1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>DataCDInfo-JTA-ear</artifactId>
+ <name>Geronimo Samples :: DataCDInfo JTA + Struts1 :: EAR</name>
+ <packaging>ear</packaging>
+
+ <description>Geronimo Samples - DataCD Information Management Tool</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.geronimo.samples</groupId>
+ <artifactId>DataCDInfo-JTA-war</artifactId>
+ <version>${version}</version>
+ <type>war</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.samples</groupId>
+ <artifactId>DataCDInfo-JTA-ejb</artifactId>
+ <version>${version}</version>
+ <type>ejb</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-ear-plugin</artifactId>
+ <configuration>
+ <displayName>Geronimo Sample EAR for DataCDInfo JTA+Struts1</displayName>
+ <description>Geronimo Sample EAR for DataCDInfo JTA+Struts1</description>
+ <version>5</version>
+ <modules>
+ <ejbModule>
+ <groupId>org.apache.geronimo.samples</groupId>
+ <artifactId>DataCDInfo-JTA-ejb</artifactId>
+ <bundleFileName>DataCDInfo-JTA-ejb.jar</bundleFileName>
+ </ejbModule>
+
+ <webModule>
+ <groupId>org.apache.geronimo.samples</groupId>
+ <artifactId>DataCDInfo-JTA-war</artifactId>
+ <contextRoot>/DataCDInfoJTAStruts1</contextRoot>
+ <bundleFileName>DataCDInfo-JTA-war.war</bundleFileName>
+ </webModule>
+ </modules>
+ <!--
+ HACK: Include legal muck from maven-remote-resources-plugin
+ -->
+ <resourcesDir>${project.build.outputDirectory}</resourcesDir>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+</project>
Modified: geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/src/main/resources/META-INF/application.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/src/main/resources/META-INF/application.xml?rev=959342&r1=959341&r2=959342&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/src/main/resources/META-INF/application.xml (original)
+++ geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/src/main/resources/META-INF/application.xml Wed Jun 30 15:00:02 2010
@@ -1,30 +1,30 @@
-<?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.
--->
-<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" id="Application_ID" version="5">
- <display-name>
-${pom.name}</display-name>
- <module>
- <web>
- <web-uri>DataCDInfo-JTA-war.war</web-uri>
- <context-root>DataCDInfoJTAStruts1</context-root>
- </web>
- </module>
- <module>
- <ejb>DataCDInfo-JTA-ejb.jar</ejb>
- </module>
-</application>
+<?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.
+-->
+<application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" id="Application_ID" version="5">
+ <display-name>
+${pom.name}</display-name>
+ <module>
+ <web>
+ <web-uri>DataCDInfo-JTA-war.war</web-uri>
+ <context-root>DataCDInfoJTAStruts1</context-root>
+ </web>
+ </module>
+ <module>
+ <ejb>DataCDInfo-JTA-ejb.jar</ejb>
+ </module>
+</application>
Modified: geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/src/main/resources/META-INF/geronimo-application-mysql.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/src/main/resources/META-INF/geronimo-application-mysql.xml?rev=959342&r1=959341&r2=959342&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/src/main/resources/META-INF/geronimo-application-mysql.xml (original)
+++ geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/src/main/resources/META-INF/geronimo-application-mysql.xml Wed Jun 30 15:00:02 2010
@@ -1,134 +1,134 @@
-<?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.
--->
-<application application-name="DataCDInfo-JTA"
- xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0">
- <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
- <dep:moduleId>
- <dep:groupId>org.apache.geronimo.samples</dep:groupId>
- <dep:artifactId>DataCDInfoJTA</dep:artifactId>
- <dep:version>${version}</dep:version>
- <dep:type>car</dep:type>
- </dep:moduleId>
- <dep:dependencies>
- <dep:dependency>
- <dep:groupId>mysql</dep:groupId>
- <dep:artifactId>mysql-connector-java</dep:artifactId>
- <dep:version>5.1.7</dep:version>
- <dep:type>jar</dep:type>
- </dep:dependency>
- </dep:dependencies>
- </dep:environment>
-
- <module>
- <ejb>DataCDInfo-JTA-ejb.jar</ejb>
- <openejb-jar xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2">
- <persistence xmlns="http://java.sun.com/xml/ns/persistence"
- version="1.0">
- <persistence-unit name="DataCDInfoUnit">
- <properties>
- <property name="openjpa.jdbc.DBDictionary" value="mysql" />
- </properties>
- </persistence-unit>
- </persistence>
- </openejb-jar>
- </module>
-
- <ext-module>
- <connector>DataCDInfoDataSource</connector>
- <external-path xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
- <dep:groupId>org.tranql</dep:groupId>
- <dep:artifactId>tranql-connector-mysql-xa</dep:artifactId>
- <dep:type>rar</dep:type>
- </external-path>
- <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
- <resourceadapter>
- <outbound-resourceadapter>
- <connection-definition>
- <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
- <connectiondefinition-instance>
- <name>jdbc/DataCDInfoDS</name>
- <config-property-setting name="UserName">cdadmin</config-property-setting>
- <config-property-setting name="Password">passme</config-property-setting>
- <config-property-setting name="PortNumber">3306</config-property-setting>
- <config-property-setting name="ServerName">localhost</config-property-setting>
- <config-property-setting name="DatabaseName">cdinfodb</config-property-setting>
- <connectionmanager>
- <xa-transaction>
- <transaction-caching />
- </xa-transaction>
- <single-pool>
- <max-size>100</max-size>
- <min-size>0</min-size>
- <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
- <idle-timeout-minutes>30</idle-timeout-minutes>
- <match-one />
- </single-pool>
- </connectionmanager>
- </connectiondefinition-instance>
- <!-- This non-transaction data source is for sequence generation use. Without it,
- the geronimo will throw exception when persisting entities which require sequence
- generation. -->
- <connectiondefinition-instance>
- <name>jdbc/NoTxDataCDInfoDS</name>
- <config-property-setting name="UserName">cdadmin</config-property-setting>
- <config-property-setting name="Password">passme</config-property-setting>
- <config-property-setting name="PortNumber">3306</config-property-setting>
- <config-property-setting name="ServerName">localhost</config-property-setting>
- <config-property-setting name="DatabaseName">cdinfodb</config-property-setting>
- <connectionmanager>
- <no-transaction/>
- <single-pool>
- <max-size>10</max-size>
- <min-size>0</min-size>
- <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
- <idle-timeout-minutes>30</idle-timeout-minutes>
- <match-one/>
- </single-pool>
- </connectionmanager>
- </connectiondefinition-instance>
- </connection-definition>
- </outbound-resourceadapter>
- </resourceadapter>
- </connector>
- </ext-module>
-
-
-
- <security xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0">
- <sec:default-principal>
- <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="anonymous"/>
- </sec:default-principal>
- <sec:role-mappings>
- <sec:role role-name="admin">
- <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="admin"/>
- <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="system"/>
- </sec:role>
- <sec:role role-name="superadmin">
- <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="superadmin"/>
- <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="superman"/>
- </sec:role>
- </sec:role-mappings>
- </security>
-
- <gbean name="DBInitialization" class="org.apache.geronimo.connector.DatabaseInitializationGBean">
- <attribute name="path">DataCDInfo_tables_mysql.sql</attribute>
- <reference name="DataSource">
- <name>jdbc/NoTxDataCDInfoDS</name>
- </reference>
- </gbean>
-</application>
+<?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.
+-->
+<application application-name="DataCDInfo-JTA"
+ xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0">
+ <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
+ <dep:moduleId>
+ <dep:groupId>org.apache.geronimo.samples</dep:groupId>
+ <dep:artifactId>DataCDInfoJTA</dep:artifactId>
+ <dep:version>${version}</dep:version>
+ <dep:type>car</dep:type>
+ </dep:moduleId>
+ <dep:dependencies>
+ <dep:dependency>
+ <dep:groupId>mysql</dep:groupId>
+ <dep:artifactId>mysql-connector-java</dep:artifactId>
+ <dep:version>5.1.7</dep:version>
+ <dep:type>jar</dep:type>
+ </dep:dependency>
+ </dep:dependencies>
+ </dep:environment>
+
+ <module>
+ <ejb>DataCDInfo-JTA-ejb.jar</ejb>
+ <openejb-jar xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2">
+ <persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ version="1.0">
+ <persistence-unit name="DataCDInfoUnit">
+ <properties>
+ <property name="openjpa.jdbc.DBDictionary" value="mysql" />
+ </properties>
+ </persistence-unit>
+ </persistence>
+ </openejb-jar>
+ </module>
+
+ <ext-module>
+ <connector>DataCDInfoDataSource</connector>
+ <external-path xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
+ <dep:groupId>org.tranql</dep:groupId>
+ <dep:artifactId>tranql-connector-mysql-xa</dep:artifactId>
+ <dep:type>rar</dep:type>
+ </external-path>
+ <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
+ <resourceadapter>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
+ <connectiondefinition-instance>
+ <name>jdbc/DataCDInfoDS</name>
+ <config-property-setting name="UserName">cdadmin</config-property-setting>
+ <config-property-setting name="Password">passme</config-property-setting>
+ <config-property-setting name="PortNumber">3306</config-property-setting>
+ <config-property-setting name="ServerName">localhost</config-property-setting>
+ <config-property-setting name="DatabaseName">cdinfodb</config-property-setting>
+ <connectionmanager>
+ <xa-transaction>
+ <transaction-caching />
+ </xa-transaction>
+ <single-pool>
+ <max-size>100</max-size>
+ <min-size>0</min-size>
+ <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
+ <idle-timeout-minutes>30</idle-timeout-minutes>
+ <match-one />
+ </single-pool>
+ </connectionmanager>
+ </connectiondefinition-instance>
+ <!-- This non-transaction data source is for sequence generation use. Without it,
+ the geronimo will throw exception when persisting entities which require sequence
+ generation. -->
+ <connectiondefinition-instance>
+ <name>jdbc/NoTxDataCDInfoDS</name>
+ <config-property-setting name="UserName">cdadmin</config-property-setting>
+ <config-property-setting name="Password">passme</config-property-setting>
+ <config-property-setting name="PortNumber">3306</config-property-setting>
+ <config-property-setting name="ServerName">localhost</config-property-setting>
+ <config-property-setting name="DatabaseName">cdinfodb</config-property-setting>
+ <connectionmanager>
+ <no-transaction/>
+ <single-pool>
+ <max-size>10</max-size>
+ <min-size>0</min-size>
+ <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
+ <idle-timeout-minutes>30</idle-timeout-minutes>
+ <match-one/>
+ </single-pool>
+ </connectionmanager>
+ </connectiondefinition-instance>
+ </connection-definition>
+ </outbound-resourceadapter>
+ </resourceadapter>
+ </connector>
+ </ext-module>
+
+
+
+ <security xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0">
+ <sec:default-principal>
+ <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="anonymous"/>
+ </sec:default-principal>
+ <sec:role-mappings>
+ <sec:role role-name="admin">
+ <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="admin"/>
+ <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="system"/>
+ </sec:role>
+ <sec:role role-name="superadmin">
+ <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="superadmin"/>
+ <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="superman"/>
+ </sec:role>
+ </sec:role-mappings>
+ </security>
+
+ <gbean name="DBInitialization" class="org.apache.geronimo.connector.DatabaseInitializationGBean">
+ <attribute name="path">DataCDInfo_tables_mysql.sql</attribute>
+ <reference name="DataSource">
+ <name>jdbc/NoTxDataCDInfoDS</name>
+ </reference>
+ </gbean>
+</application>
Modified: geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/src/main/resources/META-INF/geronimo-application.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/src/main/resources/META-INF/geronimo-application.xml?rev=959342&r1=959341&r2=959342&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/src/main/resources/META-INF/geronimo-application.xml (original)
+++ geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ear/src/main/resources/META-INF/geronimo-application.xml Wed Jun 30 15:00:02 2010
@@ -1,131 +1,72 @@
-<?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.
--->
-<application application-name="DataCDInfo-JTA"
- xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0">
- <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
- <dep:moduleId>
- <dep:groupId>org.apache.geronimo.samples</dep:groupId>
- <dep:artifactId>DataCDInfoJTA</dep:artifactId>
- <dep:version>${version}</dep:version>
- <dep:type>car</dep:type>
- </dep:moduleId>
- <dep:dependencies>
- <dep:dependency>
- <dep:groupId>org.apache.geronimo.configs</dep:groupId>
- <dep:artifactId>system-database</dep:artifactId>
- <dep:type>car</dep:type>
- </dep:dependency>
- </dep:dependencies>
- </dep:environment>
-
- <module>
- <ejb>DataCDInfo-JTA-ejb.jar</ejb>
- <openejb-jar xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2">
- <persistence xmlns="http://java.sun.com/xml/ns/persistence"
- version="1.0">
- <persistence-unit name="DataCDInfoUnit">
- <properties>
- <property name="openjpa.jdbc.DBDictionary" value="derby" />
- </properties>
- </persistence-unit>
- </persistence>
- </openejb-jar>
- </module>
-
- <ext-module>
- <connector>DataCDInfoDataSource</connector>
- <external-path xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
- <dep:groupId>org.tranql</dep:groupId>
- <dep:artifactId>tranql-connector-derby-embed-xa</dep:artifactId>
- <dep:type>rar</dep:type>
- </external-path>
- <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
- <resourceadapter>
- <outbound-resourceadapter>
- <connection-definition>
- <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
- <connectiondefinition-instance>
- <name>jdbc/DataCDInfoDS</name>
- <config-property-setting name="UserName"></config-property-setting>
- <config-property-setting name="Password"></config-property-setting>
- <config-property-setting name="DatabaseName">cdinfodb</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>
- <min-size>0</min-size>
- <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
- <idle-timeout-minutes>30</idle-timeout-minutes>
- <match-one />
- </single-pool>
- </connectionmanager>
- </connectiondefinition-instance>
- <!-- This non-transaction data source is for sequence generation use. Without it,
- the geronimo will throw exception when persisting entities which require sequence
- generation. -->
- <connectiondefinition-instance>
- <name>jdbc/NoTxDataCDInfoDS</name>
- <config-property-setting name="UserName"></config-property-setting>
- <config-property-setting name="Password"></config-property-setting>
- <config-property-setting name="DatabaseName">cdinfodb</config-property-setting>
- <config-property-setting name="CreateDatabase">true</config-property-setting>
- <connectionmanager>
- <no-transaction/>
- <single-pool>
- <max-size>10</max-size>
- <min-size>0</min-size>
- <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
- <idle-timeout-minutes>30</idle-timeout-minutes>
- <match-one/>
- </single-pool>
- </connectionmanager>
- </connectiondefinition-instance>
- </connection-definition>
- </outbound-resourceadapter>
- </resourceadapter>
- </connector>
- </ext-module>
-
-
-
- <security xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0">
- <sec:default-principal>
- <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="anonymous"/>
- </sec:default-principal>
- <sec:role-mappings>
- <sec:role role-name="admin">
- <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="admin"/>
- <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="system"/>
- </sec:role>
- <sec:role role-name="superadmin">
- <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="superadmin"/>
- <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="superman"/>
- </sec:role>
- </sec:role-mappings>
- </security>
-
- <gbean name="DBInitialization" class="org.apache.geronimo.connector.DatabaseInitializationGBean">
- <attribute name="path">DataCDInfo_tables_derby.sql</attribute>
- <reference name="DataSource">
- <name>jdbc/NoTxDataCDInfoDS</name>
- </reference>
- </gbean>
-</application>
+<?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.
+-->
+<application application-name="DataCDInfo-JTA"
+ xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0">
+ <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
+ <dep:moduleId>
+ <dep:groupId>${project.groupId}</dep:groupId>
+ <dep:artifactId>${project.artifactId}</dep:artifactId>
+ <dep:version>${project.version}</dep:version>
+ <dep:type>car</dep:type>
+ </dep:moduleId>
+ <dep:dependencies>
+ <dep:dependency>
+ <dep:groupId>org.apache.geronimo.samples</dep:groupId>
+ <dep:artifactId>sample-datasource</dep:artifactId>
+ <dep:type>car</dep:type>
+ </dep:dependency>
+ </dep:dependencies>
+ </dep:environment>
+
+ <module>
+ <ejb>DataCDInfo-JTA-ejb.jar</ejb>
+ <openejb-jar xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2">
+ <persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ version="1.0">
+ <persistence-unit name="DataCDInfoUnit">
+ <properties>
+ <property name="openjpa.jdbc.DBDictionary" value="derby" />
+ </properties>
+ </persistence-unit>
+ </persistence>
+ </openejb-jar>
+ </module>
+
+ <security xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0">
+ <sec:default-principal>
+ <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="anonymous"/>
+ </sec:default-principal>
+ <sec:role-mappings>
+ <sec:role role-name="admin">
+ <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="admin"/>
+ <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="system"/>
+ </sec:role>
+ <sec:role role-name="superadmin">
+ <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="superadmin"/>
+ <sec:principal class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" name="superman"/>
+ </sec:role>
+ </sec:role-mappings>
+ </security>
+
+ <gbean name="DBInitialization" class="org.apache.geronimo.connector.wrapper.DatabaseInitializationGBean">
+ <attribute name="path">DataCDInfo_tables_derby.sql</attribute>
+ <reference name="DataSource">
+ <name>SampleNoTxDatasource</name>
+ </reference>
+ </gbean>
+</application>
Modified: geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/pom.xml?rev=959342&r1=959341&r2=959342&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/pom.xml (original)
+++ geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/pom.xml Wed Jun 30 15:00:02 2010
@@ -1,60 +1,60 @@
-<?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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.geronimo.samples</groupId>
- <artifactId>DataCDInfo</artifactId>
- <version>3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>DataCDInfo-JTA-ejb</artifactId>
- <name>Geronimo Samples :: DataCDInfo JTA + Struts1 :: EJB</name>
- <packaging>jar</packaging>
-
- <description>Geronimo Samples - DataCD Information Management Tool</description>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-annotation_1.0_spec</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-ejb_3.0_spec</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jpa_1.0_spec</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jta_1.1_spec</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
-</project>
+<?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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.geronimo.samples</groupId>
+ <artifactId>DataCDInfo</artifactId>
+ <version>3.0-M1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>DataCDInfo-JTA-ejb</artifactId>
+ <name>Geronimo Samples :: DataCDInfo JTA + Struts1 :: EJB</name>
+ <packaging>jar</packaging>
+
+ <description>Geronimo Samples - DataCD Information Management Tool</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jpa_2.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Modified: geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/beans/DataCDBean.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/beans/DataCDBean.java?rev=959342&r1=959341&r2=959342&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/beans/DataCDBean.java (original)
+++ geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/beans/DataCDBean.java Wed Jun 30 15:00:02 2010
@@ -1,131 +1,131 @@
-/**
- * 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.
- */
-package org.apache.geronimo.samples.datacdinfo.beans;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import javax.persistence.*;
-
-/**
- * Demo how to code JPA entity bean, including various JPA annotations:
- * NamedQueries, Id, JoinColumn
- *
- *
- */
-
-@Entity(name="DataCD")
-@Table(name="DATACD_TABLE")
-@NamedQueries( {
- @NamedQuery(name = "DataCD.findByOwnerId", query = "SELECT cd FROM DataCD cd WHERE cd.owner.username = :ownername"),
- @NamedQuery(name = "DataCD.findByOwnerIdandCDLabel", query = "SELECT cd FROM DataCD cd WHERE cd.owner.username = :ownername and cd.cdLabel = :cdlabel"),
- @NamedQuery(name = "DataCD.deleteByOwnerId", query = "DELETE FROM DataCD cd WHERE cd.owner.username = :ownername"),
- @NamedQuery(name = "DataCD.getAllCDs", query = "SELECT cd FROM DataCD cd")
-})
-public class DataCDBean implements Serializable{
- /**
- *
- */
- private static final long serialVersionUID = -7665259395127908808L;
- @Id
- @Column(name = "CDID")
- @GeneratedValue(strategy=GenerationType.AUTO)
- private Integer cdID;
-
- @JoinColumn(name = "OWNER_USERNAME")
- @ManyToOne(fetch=FetchType.EAGER, optional=false)
- private OwnerBean owner;
-
- @Column(name = "CDLABEL", nullable=false)
- private String cdLabel;
-
- @Column(name = "CDDESC")
- private String cdDescription;
-
- @Column(name = "CDARCHIVEDATE")
- private Date cdArchiveDate;
-
- @Column(name = "CDSIZE")
- private Integer cdSize;
-
- public DataCDBean(){
-
- }
-
- public DataCDBean(Integer cdID, String cdLabel,
- String cdDescription, Date cdArchiveDate, Integer cdSize) {
- super();
- this.cdID = cdID;
- this.cdLabel = cdLabel;
- this.cdDescription = cdDescription;
- this.cdArchiveDate = cdArchiveDate;
- this.cdSize = cdSize;
- }
-
- public String toString(){
- return "[cdID:" + this.getCdID()
- + " cdLabel:" + this.getCdLabel()
- + " cdDescription:" + this.getCdDescription()
- + " cdArchiveDate:" + this.getCdArchiveDate().toString()
- + " cdSize:" + this.getCdSize()
- + " Owner:" + this.getOwner().getUsername()
- + "]";
-
- }
- public Integer getCdID() {
- return cdID;
- }
- public void setCdID(Integer cdID) {
- this.cdID = cdID;
- }
- public OwnerBean getOwner() {
- return owner;
- }
- public void setOwner(OwnerBean owner) {
- this.owner = owner;
- }
- public String getCdLabel() {
- return cdLabel;
- }
- public void setCdLabel(String cdLabel) {
- this.cdLabel = cdLabel;
- }
- public String getCdDescription() {
- return cdDescription;
- }
- public void setCdDescription(String cdDescription) {
- this.cdDescription = cdDescription;
- }
- public Date getCdArchiveDate() {
- return cdArchiveDate;
- }
- public void setCdArchiveDate(Date cdArchiveDate) {
- this.cdArchiveDate = cdArchiveDate;
- }
- public Integer getCdSize() {
- return cdSize;
- }
- public void setCdSize(Integer cdSize) {
- this.cdSize = cdSize;
- }
-
-
-
-
-}
+/**
+ * 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.
+ */
+package org.apache.geronimo.samples.datacdinfo.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.*;
+
+/**
+ * Demo how to code JPA entity bean, including various JPA annotations:
+ * NamedQueries, Id, JoinColumn
+ *
+ *
+ */
+
+@Entity(name="DataCD")
+@Table(name="DATACD_TABLE")
+@NamedQueries( {
+ @NamedQuery(name = "DataCD.findByOwnerId", query = "SELECT cd FROM DataCD cd WHERE cd.owner.username = :ownername"),
+ @NamedQuery(name = "DataCD.findByOwnerIdandCDLabel", query = "SELECT cd FROM DataCD cd WHERE cd.owner.username = :ownername and cd.cdLabel = :cdlabel"),
+ @NamedQuery(name = "DataCD.deleteByOwnerId", query = "DELETE FROM DataCD cd WHERE cd.owner.username = :ownername"),
+ @NamedQuery(name = "DataCD.getAllCDs", query = "SELECT cd FROM DataCD cd")
+})
+public class DataCDBean implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7665259395127908808L;
+ @Id
+ @Column(name = "CDID")
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ private Integer cdID;
+
+ @JoinColumn(name = "OWNER_USERNAME")
+ @ManyToOne(fetch=FetchType.EAGER, optional=false)
+ private OwnerBean owner;
+
+ @Column(name = "CDLABEL", nullable=false)
+ private String cdLabel;
+
+ @Column(name = "CDDESC")
+ private String cdDescription;
+
+ @Column(name = "CDARCHIVEDATE")
+ private Date cdArchiveDate;
+
+ @Column(name = "CDSIZE")
+ private Integer cdSize;
+
+ public DataCDBean(){
+
+ }
+
+ public DataCDBean(Integer cdID, String cdLabel,
+ String cdDescription, Date cdArchiveDate, Integer cdSize) {
+ super();
+ this.cdID = cdID;
+ this.cdLabel = cdLabel;
+ this.cdDescription = cdDescription;
+ this.cdArchiveDate = cdArchiveDate;
+ this.cdSize = cdSize;
+ }
+
+ public String toString(){
+ return "[cdID:" + this.getCdID()
+ + " cdLabel:" + this.getCdLabel()
+ + " cdDescription:" + this.getCdDescription()
+ + " cdArchiveDate:" + this.getCdArchiveDate().toString()
+ + " cdSize:" + this.getCdSize()
+ + " Owner:" + this.getOwner().getUsername()
+ + "]";
+
+ }
+ public Integer getCdID() {
+ return cdID;
+ }
+ public void setCdID(Integer cdID) {
+ this.cdID = cdID;
+ }
+ public OwnerBean getOwner() {
+ return owner;
+ }
+ public void setOwner(OwnerBean owner) {
+ this.owner = owner;
+ }
+ public String getCdLabel() {
+ return cdLabel;
+ }
+ public void setCdLabel(String cdLabel) {
+ this.cdLabel = cdLabel;
+ }
+ public String getCdDescription() {
+ return cdDescription;
+ }
+ public void setCdDescription(String cdDescription) {
+ this.cdDescription = cdDescription;
+ }
+ public Date getCdArchiveDate() {
+ return cdArchiveDate;
+ }
+ public void setCdArchiveDate(Date cdArchiveDate) {
+ this.cdArchiveDate = cdArchiveDate;
+ }
+ public Integer getCdSize() {
+ return cdSize;
+ }
+ public void setCdSize(Integer cdSize) {
+ this.cdSize = cdSize;
+ }
+
+
+
+
+}
Modified: geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/beans/OwnerBean.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/beans/OwnerBean.java?rev=959342&r1=959341&r2=959342&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/beans/OwnerBean.java (original)
+++ geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/beans/OwnerBean.java Wed Jun 30 15:00:02 2010
@@ -1,90 +1,90 @@
-/**
- * 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.
- */
-package org.apache.geronimo.samples.datacdinfo.beans;
-
-import java.io.Serializable;
-import java.util.Collection;
-
-import javax.persistence.*;
-
-/**
- * Demo how to code JPA entity bean, including various JPA annotations.
- *
- *
- */
-
-@Entity(name="Owner")
-@Table(name = "OWNER_TABLE")
-public class OwnerBean implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -7231801785238251943L;
-
-
- @Id
- @Column(name = "USERNAME", length=20)
- private String username;
-
- @Column(name = "PASSWORD", nullable=false, length=20)
- private String password;
-
- @OneToMany(mappedBy= "owner",
- fetch=FetchType.LAZY,
- cascade=CascadeType.ALL)
- @OrderBy("cdArchiveDate DESC")
- private Collection<DataCDBean> DataCDs;
-
- public OwnerBean(){
-
- }
-
- public OwnerBean(String userName, String password) {
- super();
- this.username = userName;
- this.password = password;
- }
-
- public String toString(){
- return "username:" + getUsername()
- + "\n password:" + getPassword();
- }
-
- public String getUsername() {
- return username;
- }
- public void setUsername(String userName) {
- this.username = userName;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
-
- public void setDataCDs(Collection<DataCDBean> dataCDs) {
- this.DataCDs = dataCDs;
- }
-
- public Collection<DataCDBean> getDataCDs() {
- return DataCDs;
- }
-
-}
+/**
+ * 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.
+ */
+package org.apache.geronimo.samples.datacdinfo.beans;
+
+import java.io.Serializable;
+import java.util.Collection;
+
+import javax.persistence.*;
+
+/**
+ * Demo how to code JPA entity bean, including various JPA annotations.
+ *
+ *
+ */
+
+@Entity(name="Owner")
+@Table(name = "OWNER_TABLE")
+public class OwnerBean implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7231801785238251943L;
+
+
+ @Id
+ @Column(name = "USERNAME", length=20)
+ private String username;
+
+ @Column(name = "PASSWORD", nullable=false, length=20)
+ private String password;
+
+ @OneToMany(mappedBy= "owner",
+ fetch=FetchType.LAZY,
+ cascade=CascadeType.ALL)
+ @OrderBy("cdArchiveDate DESC")
+ private Collection<DataCDBean> DataCDs;
+
+ public OwnerBean(){
+
+ }
+
+ public OwnerBean(String userName, String password) {
+ super();
+ this.username = userName;
+ this.password = password;
+ }
+
+ public String toString(){
+ return "username:" + getUsername()
+ + "\n password:" + getPassword();
+ }
+
+ public String getUsername() {
+ return username;
+ }
+ public void setUsername(String userName) {
+ this.username = userName;
+ }
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public void setDataCDs(Collection<DataCDBean> dataCDs) {
+ this.DataCDs = dataCDs;
+ }
+
+ public Collection<DataCDBean> getDataCDs() {
+ return DataCDs;
+ }
+
+}
Modified: geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/core/DataCDInfoAdmin.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/core/DataCDInfoAdmin.java?rev=959342&r1=959341&r2=959342&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/core/DataCDInfoAdmin.java (original)
+++ geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/core/DataCDInfoAdmin.java Wed Jun 30 15:00:02 2010
@@ -1,89 +1,89 @@
-/**
- * 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.
- */
-package org.apache.geronimo.samples.datacdinfo.core;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.security.RolesAllowed;
-import javax.ejb.Stateful;
-
-import org.apache.geronimo.samples.datacdinfo.beans.DataCDBean;
-import org.apache.geronimo.samples.datacdinfo.beans.OwnerBean;
-
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.PersistenceContext;
-import javax.persistence.Query;
-
-/**
- * Session Bean implementation class DataCDInfoAdmin
- *
- * Demo how to use security annotations and container-managed extended-scoped persistence context,
- * and using JTA transaction.
- */
-//@Stateful(name="ejb/DataCDInfoAdmin")
-@Stateful
-public class DataCDInfoAdmin implements DataCDInfoAdminLocal {
-
- @PersistenceContext(unitName="DataCDInfoUnit", type = PersistenceContextType.EXTENDED)
- private EntityManager em;
-
- /**
- * Default constructor.
- */
- public DataCDInfoAdmin() {
- // do nothing
- }
-
- @RolesAllowed("superadmin")
- public String findpasswd(String username) {
- OwnerBean owner = em.find(OwnerBean.class, username);
- String passwd = owner.getPassword();
- return passwd;
- }
-
- @RolesAllowed("superadmin")
- public String[] listAllDataCDs() {
- ArrayList<String> allcdstring = new ArrayList<String>();
- Query query = em.createNamedQuery("DataCD.getAllCDs");
- List<DataCDBean> allcds = query.getResultList();
- for (DataCDBean cd : allcds){
- allcdstring.add(cd.toString());
- }
-
- String[] result = allcdstring.toArray(new String[0]);
- return result;
- }
-
- @RolesAllowed({"admin","superadmin"})
- public String[] listOwners() {
- ArrayList<String> allusers = new ArrayList<String>();
- List<Object> owners = new ArrayList<Object>();
- Query query = em.createNativeQuery("SELECT USERNAME FROM OWNER_TABLE");
- owners = query.getResultList();
- for (Object owner : owners ) {
- String ownername = owner.toString();
- allusers.add(ownername);
- }
- String[] result = allusers.toArray(new String[0]);
- return result;
- }
-
-}
+/**
+ * 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.
+ */
+package org.apache.geronimo.samples.datacdinfo.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.security.RolesAllowed;
+import javax.ejb.Stateful;
+
+import org.apache.geronimo.samples.datacdinfo.beans.DataCDBean;
+import org.apache.geronimo.samples.datacdinfo.beans.OwnerBean;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+/**
+ * Session Bean implementation class DataCDInfoAdmin
+ *
+ * Demo how to use security annotations and container-managed extended-scoped persistence context,
+ * and using JTA transaction.
+ */
+//@Stateful(name="ejb/DataCDInfoAdmin")
+@Stateful
+public class DataCDInfoAdmin implements DataCDInfoAdminLocal {
+
+ @PersistenceContext(unitName="DataCDInfoUnit", type = PersistenceContextType.EXTENDED)
+ private EntityManager em;
+
+ /**
+ * Default constructor.
+ */
+ public DataCDInfoAdmin() {
+ // do nothing
+ }
+
+ @RolesAllowed("superadmin")
+ public String findpasswd(String username) {
+ OwnerBean owner = em.find(OwnerBean.class, username);
+ String passwd = owner.getPassword();
+ return passwd;
+ }
+
+ @RolesAllowed("superadmin")
+ public String[] listAllDataCDs() {
+ ArrayList<String> allcdstring = new ArrayList<String>();
+ Query query = em.createNamedQuery("DataCD.getAllCDs");
+ List<DataCDBean> allcds = query.getResultList();
+ for (DataCDBean cd : allcds){
+ allcdstring.add(cd.toString());
+ }
+
+ String[] result = allcdstring.toArray(new String[0]);
+ return result;
+ }
+
+ @RolesAllowed({"admin","superadmin"})
+ public String[] listOwners() {
+ ArrayList<String> allusers = new ArrayList<String>();
+ List<Object> owners = new ArrayList<Object>();
+ Query query = em.createNativeQuery("SELECT USERNAME FROM OWNER_TABLE");
+ owners = query.getResultList();
+ for (Object owner : owners ) {
+ String ownername = owner.toString();
+ allusers.add(ownername);
+ }
+ String[] result = allusers.toArray(new String[0]);
+ return result;
+ }
+
+}
Modified: geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/core/DataCDInfoAdminLocal.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/core/DataCDInfoAdminLocal.java?rev=959342&r1=959341&r2=959342&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/core/DataCDInfoAdminLocal.java (original)
+++ geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/core/DataCDInfoAdminLocal.java Wed Jun 30 15:00:02 2010
@@ -1,29 +1,29 @@
-/**
- * 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.
- */
-package org.apache.geronimo.samples.datacdinfo.core;
-
-import javax.ejb.Local;
-
-@Local
-public interface DataCDInfoAdminLocal {
- public String[] listOwners();
- public String findpasswd(String username);
- public String[] listAllDataCDs();
-
-}
+/**
+ * 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.
+ */
+package org.apache.geronimo.samples.datacdinfo.core;
+
+import javax.ejb.Local;
+
+@Local
+public interface DataCDInfoAdminLocal {
+ public String[] listOwners();
+ public String findpasswd(String username);
+ public String[] listAllDataCDs();
+
+}
Modified: geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/core/DataCDInfoJTAImpl.java
URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/core/DataCDInfoJTAImpl.java?rev=959342&r1=959341&r2=959342&view=diff
==============================================================================
--- geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/core/DataCDInfoJTAImpl.java (original)
+++ geronimo/samples/trunk/samples/javaee5/DataCDInfo/DataCDInfo-JTA-ejb/src/main/java/org/apache/geronimo/samples/datacdinfo/core/DataCDInfoJTAImpl.java Wed Jun 30 15:00:02 2010
@@ -1,227 +1,227 @@
-/**
- * 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.
- */
-package org.apache.geronimo.samples.datacdinfo.core;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Iterator;
-
-import javax.ejb.Stateless;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-import javax.ejb.TransactionManagement;
-import javax.ejb.TransactionManagementType;
-import javax.ejb.Local;
-import javax.ejb.Remote;
-
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.Query;
-import javax.persistence.PersistenceContext;
-
-import org.apache.geronimo.samples.datacdinfo.beans.DataCDBean;
-import org.apache.geronimo.samples.datacdinfo.beans.OwnerBean;
-import org.apache.geronimo.samples.datacdinfo.exceptions.DuplicatedDataCDException;
-import org.apache.geronimo.samples.datacdinfo.exceptions.IncorrectPasswordException;
-import org.apache.geronimo.samples.datacdinfo.exceptions.InvalidOwnerException;
-import org.apache.geronimo.samples.datacdinfo.exceptions.InvalidPasswordException;
-
-/**
- *
- * Demo how to use container-managed transaction-scoped persistence context with JTA transaction.
- *
- */
-@Stateless(name="ejb/DataCDInfoJTAImpl")
-@Remote(DataCDInfoRemote.class)
-@Local(DataCDInfoLocal.class)
-@TransactionAttribute(TransactionAttributeType.REQUIRED)
-@TransactionManagement(TransactionManagementType.CONTAINER)
-public class DataCDInfoJTAImpl implements DataCDInfoLocal, DataCDInfoRemote {
-
- @PersistenceContext(unitName = "DataCDInfoUnit", type = PersistenceContextType.TRANSACTION)
- private EntityManager em;
-
- public DataCDInfoJTAImpl() {
- // do nothing
- }
-
- public OwnerBean login(String username, String passwd)
- throws InvalidOwnerException, IncorrectPasswordException {
- // check if the owner is registered
- OwnerBean owner = em.find(OwnerBean.class, username);
- if (owner == null) {
- String error = "No such user: " + username + "!";
- throw new InvalidOwnerException(error);
- }
-
- if (!passwd.equals(owner.getPassword())) {
- String error = "Incorrect password!";
- throw new IncorrectPasswordException(error);
- }
-
- // Load CDs to cache
- populateCDs(owner);
-
- return owner;
- }
-
- public void logout(String username) {
- // do nothing
-
- }
-
- public OwnerBean register(String username, String passwd)
- throws InvalidOwnerException, InvalidPasswordException {
-
- OwnerBean user = em.find(OwnerBean.class, username);
- if (user != null) {
- String error = "Can not register existing user:" + username;
- throw new InvalidOwnerException(error);
- }
-
- if (passwd.length() < 6) {
- String error = "Invalid password:" + passwd
- + ". Password must be at least 6 chars";
- throw new InvalidPasswordException(error);
- }
-
- OwnerBean newuser = new OwnerBean(username, passwd);
- try {
- em.persist(newuser);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return newuser;
- }
-
- public boolean unregister(String username) {
-
- // Delete owner as well as cascadely deleting CDs owned by the owner.
- OwnerBean deluser = em.find(OwnerBean.class, username.toLowerCase());
- populateCDs(deluser);
- try {
- em.remove(deluser);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return true;
- }
-
- public DataCDBean addCD(String ownername, String cdlabel, Integer cdsize,
- String cddesc, Date cdarchivedate)
- throws DuplicatedDataCDException, InvalidOwnerException {
-
- DataCDBean newcd = new DataCDBean();
-
- Query query = em.createNamedQuery("DataCD.findByOwnerIdandCDLabel");
- query.setParameter("ownername", ownername.toLowerCase());
- query.setParameter("cdlabel", cdlabel);
- Collection<DataCDBean> cd = query.getResultList();
-
- Iterator<DataCDBean> itr = cd.iterator();
-
- if (!itr.hasNext()) {
-
- newcd.setCdArchiveDate(cdarchivedate);
- newcd.setCdDescription(cddesc);
- newcd.setCdLabel(cdlabel);
- newcd.setCdSize(cdsize);
-
- OwnerBean theowner = em.find(OwnerBean.class, ownername
- .toLowerCase());
- newcd.setOwner(theowner);
-
- try {
- em.persist(newcd);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- } else {
- newcd = null;
- }
-
- return newcd;
- }
-
- public Collection<DataCDBean> listCDs(String ownername) {
-
- OwnerBean owner = em.find(OwnerBean.class, ownername);
- Query query = em.createNamedQuery("DataCD.findByOwnerId");
- query.setParameter("ownername", owner.getUsername());
- Collection<DataCDBean> cds = query.getResultList();
- if (cds == null) {
- cds = new ArrayList<DataCDBean>();
- }
- return cds;
- }
-
- public boolean removeCD(Integer cdid) {
- boolean success = false;
-
- DataCDBean datacd = em.find(DataCDBean.class, cdid);
- if (datacd != null) {
- try {
- em.remove(datacd);
- success = true;
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- return success;
- }
-
- public DataCDBean updateCD(Integer cdid, Integer cdsize, String cddesc,
- Date cdarchivedate) {
-
- DataCDBean datacd = em.find(DataCDBean.class, cdid);
- if (datacd != null) {
- datacd.setCdArchiveDate(cdarchivedate);
- datacd.setCdDescription(cddesc);
- datacd.setCdSize(cdsize);
- try {
- em.persist(datacd);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- return datacd;
- }
-
- public OwnerBean refreshCDInfo(String ownername) {
- OwnerBean owner = null;
- owner = em.find(OwnerBean.class, ownername);
- if (owner != null) {
- populateCDs(owner);
- }
- return owner;
- }
-
- private void populateCDs(OwnerBean owner) {
- Collection<DataCDBean> ownedcds = owner.getDataCDs();
- Iterator<DataCDBean> itr = ownedcds.iterator();
- while (itr.hasNext()) {
- ((DataCDBean) itr.next()).getCdLabel();
- }
- }
-
-}
+/**
+ * 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.
+ */
+package org.apache.geronimo.samples.datacdinfo.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+import javax.ejb.Local;
+import javax.ejb.Remote;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.Query;
+import javax.persistence.PersistenceContext;
+
+import org.apache.geronimo.samples.datacdinfo.beans.DataCDBean;
+import org.apache.geronimo.samples.datacdinfo.beans.OwnerBean;
+import org.apache.geronimo.samples.datacdinfo.exceptions.DuplicatedDataCDException;
+import org.apache.geronimo.samples.datacdinfo.exceptions.IncorrectPasswordException;
+import org.apache.geronimo.samples.datacdinfo.exceptions.InvalidOwnerException;
+import org.apache.geronimo.samples.datacdinfo.exceptions.InvalidPasswordException;
+
+/**
+ *
+ * Demo how to use container-managed transaction-scoped persistence context with JTA transaction.
+ *
+ */
+@Stateless(name="ejb/DataCDInfoJTAImpl")
+@Remote(DataCDInfoRemote.class)
+@Local(DataCDInfoLocal.class)
+@TransactionAttribute(TransactionAttributeType.REQUIRED)
+@TransactionManagement(TransactionManagementType.CONTAINER)
+public class DataCDInfoJTAImpl implements DataCDInfoLocal, DataCDInfoRemote {
+
+ @PersistenceContext(unitName = "DataCDInfoUnit", type = PersistenceContextType.TRANSACTION)
+ private EntityManager em;
+
+ public DataCDInfoJTAImpl() {
+ // do nothing
+ }
+
+ public OwnerBean login(String username, String passwd)
+ throws InvalidOwnerException, IncorrectPasswordException {
+ // check if the owner is registered
+ OwnerBean owner = em.find(OwnerBean.class, username);
+ if (owner == null) {
+ String error = "No such user: " + username + "!";
+ throw new InvalidOwnerException(error);
+ }
+
+ if (!passwd.equals(owner.getPassword())) {
+ String error = "Incorrect password!";
+ throw new IncorrectPasswordException(error);
+ }
+
+ // Load CDs to cache
+ populateCDs(owner);
+
+ return owner;
+ }
+
+ public void logout(String username) {
+ // do nothing
+
+ }
+
+ public OwnerBean register(String username, String passwd)
+ throws InvalidOwnerException, InvalidPasswordException {
+
+ OwnerBean user = em.find(OwnerBean.class, username);
+ if (user != null) {
+ String error = "Can not register existing user:" + username;
+ throw new InvalidOwnerException(error);
+ }
+
+ if (passwd.length() < 6) {
+ String error = "Invalid password:" + passwd
+ + ". Password must be at least 6 chars";
+ throw new InvalidPasswordException(error);
+ }
+
+ OwnerBean newuser = new OwnerBean(username, passwd);
+ try {
+ em.persist(newuser);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return newuser;
+ }
+
+ public boolean unregister(String username) {
+
+ // Delete owner as well as cascadely deleting CDs owned by the owner.
+ OwnerBean deluser = em.find(OwnerBean.class, username.toLowerCase());
+ populateCDs(deluser);
+ try {
+ em.remove(deluser);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return true;
+ }
+
+ public DataCDBean addCD(String ownername, String cdlabel, Integer cdsize,
+ String cddesc, Date cdarchivedate)
+ throws DuplicatedDataCDException, InvalidOwnerException {
+
+ DataCDBean newcd = new DataCDBean();
+
+ Query query = em.createNamedQuery("DataCD.findByOwnerIdandCDLabel");
+ query.setParameter("ownername", ownername.toLowerCase());
+ query.setParameter("cdlabel", cdlabel);
+ Collection<DataCDBean> cd = query.getResultList();
+
+ Iterator<DataCDBean> itr = cd.iterator();
+
+ if (!itr.hasNext()) {
+
+ newcd.setCdArchiveDate(cdarchivedate);
+ newcd.setCdDescription(cddesc);
+ newcd.setCdLabel(cdlabel);
+ newcd.setCdSize(cdsize);
+
+ OwnerBean theowner = em.find(OwnerBean.class, ownername
+ .toLowerCase());
+ newcd.setOwner(theowner);
+
+ try {
+ em.persist(newcd);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ } else {
+ newcd = null;
+ }
+
+ return newcd;
+ }
+
+ public Collection<DataCDBean> listCDs(String ownername) {
+
+ OwnerBean owner = em.find(OwnerBean.class, ownername);
+ Query query = em.createNamedQuery("DataCD.findByOwnerId");
+ query.setParameter("ownername", owner.getUsername());
+ Collection<DataCDBean> cds = query.getResultList();
+ if (cds == null) {
+ cds = new ArrayList<DataCDBean>();
+ }
+ return cds;
+ }
+
+ public boolean removeCD(Integer cdid) {
+ boolean success = false;
+
+ DataCDBean datacd = em.find(DataCDBean.class, cdid);
+ if (datacd != null) {
+ try {
+ em.remove(datacd);
+ success = true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ return success;
+ }
+
+ public DataCDBean updateCD(Integer cdid, Integer cdsize, String cddesc,
+ Date cdarchivedate) {
+
+ DataCDBean datacd = em.find(DataCDBean.class, cdid);
+ if (datacd != null) {
+ datacd.setCdArchiveDate(cdarchivedate);
+ datacd.setCdDescription(cddesc);
+ datacd.setCdSize(cdsize);
+ try {
+ em.persist(datacd);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return datacd;
+ }
+
+ public OwnerBean refreshCDInfo(String ownername) {
+ OwnerBean owner = null;
+ owner = em.find(OwnerBean.class, ownername);
+ if (owner != null) {
+ populateCDs(owner);
+ }
+ return owner;
+ }
+
+ private void populateCDs(OwnerBean owner) {
+ Collection<DataCDBean> ownedcds = owner.getDataCDs();
+ Iterator<DataCDBean> itr = ownedcds.iterator();
+ while (itr.hasNext()) {
+ ((DataCDBean) itr.next()).getCdLabel();
+ }
+ }
+
+}