You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2007/12/04 13:40:10 UTC
svn commit: r600911 - in /incubator/tuscany/java/sca/tutorial/catalog-ejb:
./ src/ src/main/ src/main/java/ src/main/java/client/
src/main/java/services/ src/main/resources/ src/main/resources/META-INF/
Author: slaws
Date: Tue Dec 4 04:40:09 2007
New Revision: 600911
URL: http://svn.apache.org/viewvc?rev=600911&view=rev
Log:
Standalone EJB implementation of the VegetablesCatalog
Added:
incubator/tuscany/java/sca/tutorial/catalog-ejb/ (with props)
incubator/tuscany/java/sca/tutorial/catalog-ejb/pom.xml
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/client/
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/client/Client.java
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/Catalog.java
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/Item.java
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/VegetablesCatalogImpl.java
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.xml
Propchange: incubator/tuscany/java/sca/tutorial/catalog-ejb/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Dec 4 04:40:09 2007
@@ -0,0 +1,3 @@
+.classpath
+.project
+.settings
Added: incubator/tuscany/java/sca/tutorial/catalog-ejb/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-ejb/pom.xml?rev=600911&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/catalog-ejb/pom.xml (added)
+++ incubator/tuscany/java/sca/tutorial/catalog-ejb/pom.xml Tue Dec 4 04:40:09 2007
@@ -0,0 +1,57 @@
+<?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: 508080 $ $Date: 2007-02-15 14:06:57 -0500 (Thu, 15 Feb 2007) $ -->
+
+<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.tuscany.sca</groupId>
+ <artifactId>tuscany-tutorial</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tutorial-catalog-ejb</artifactId>
+ <name>Apache Tuscany SCA Tutorial Catalog EJB</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.0_spec</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${pom.basedir}/src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </build>
+
+</project>
+
Added: incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/client/Client.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/client/Client.java?rev=600911&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/client/Client.java (added)
+++ incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/client/Client.java Tue Dec 4 04:40:09 2007
@@ -0,0 +1,36 @@
+package client;
+
+import java.util.Hashtable;
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import services.Catalog;
+import services.Item;
+
+public class Client {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ try {
+ Properties properties = new Properties();
+ properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
+ //properties.setProperty(Context.PROVIDER_URL, "ejbd://localhost:4201");
+ properties.setProperty(Context.PROVIDER_URL, "ejbd://localhost:4201");
+ InitialContext context = new InitialContext(properties);
+ //Catalog catalog = (Catalog)context.lookup("EJBModule/org.apache.tuscany.sca/tutorial-catalog-ejb/1.1-incubating-SNAPSHOT/jar/SessionBeans/VegetablesCatalogImpl");
+ Catalog catalog = (Catalog)context.lookup("VegetablesCatalogImplRemote");
+ Item items[] = catalog.get();
+ System.out.println(items[0].getName());
+
+ } catch (Exception ex) {
+ System.err.println(ex.toString());
+ }
+
+ }
+
+}
Added: incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/Catalog.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/Catalog.java?rev=600911&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/Catalog.java (added)
+++ incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/Catalog.java Tue Dec 4 04:40:09 2007
@@ -0,0 +1,27 @@
+/*
+ * 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 services;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface Catalog {
+ Item[] get();
+}
Added: incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/Item.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/Item.java?rev=600911&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/Item.java (added)
+++ incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/Item.java Tue Dec 4 04:40:09 2007
@@ -0,0 +1,54 @@
+/*
+ * 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 services;
+
+import java.io.Serializable;
+
+public class Item implements Serializable {
+ private static final long serialVersionUID = -5847326138627338217L;
+
+ private String name;
+ private String price;
+
+ public Item() {
+ }
+
+ public Item(String name, String price) {
+ this.name = name;
+ this.price = price;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getPrice() {
+ return price;
+ }
+
+ public void setPrice(String price) {
+ this.price = price;
+ }
+
+}
Added: incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/VegetablesCatalogImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/VegetablesCatalogImpl.java?rev=600911&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/VegetablesCatalogImpl.java (added)
+++ incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/VegetablesCatalogImpl.java Tue Dec 4 04:40:09 2007
@@ -0,0 +1,45 @@
+/*
+ * 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 services;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ejb.Init;
+import javax.ejb.Stateless;
+
+@Stateless
+public class VegetablesCatalogImpl implements Catalog {
+ private List<Item> catalog = new ArrayList<Item>();
+
+ @Init
+ public void init() {
+ catalog.add(new Item("Broccoli", "$2.99"));
+ catalog.add(new Item("Asparagus", "$3.55"));
+ catalog.add(new Item("Cauliflower", "$1.55"));
+ }
+
+ public Item[] get() {
+ init();
+ Item[] catalogArray = new Item[catalog.size()];
+ catalog.toArray(catalogArray);
+ return catalogArray;
+ }
+}
Added: incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.xml?rev=600911&view=auto
==============================================================================
--- incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.xml (added)
+++ incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.xml Tue Dec 4 04:40:09 2007
@@ -0,0 +1,32 @@
+<?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.
+ -->
+<openejb-jar
+ xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1"
+ xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1"
+ xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0"
+ xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
+ xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
+ <sys:environment>
+ <sys:moduleId>
+ <sys:groupId>${pom.groupId}</sys:groupId>
+ <sys:artifactId>${pom.artifactId}</sys:artifactId>
+ <sys:version>${version}</sys:version>
+ <sys:type>jar</sys:type>
+ </sys:moduleId>
+ </sys:environment>
+</openejb-jar>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org