Author: jsdelfino
Date: Thu Mar 27 11:58:09 2008
New Revision: 641941
URL: http://svn.apache.org/viewvc?rev=641941&view=rev
Log:
Changed sample EJB session bean to EJB 2.1, added CORBA TSS config to
openejb-jar.xml.
Added:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java
(with props)
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBRemote.java
(contents, props changed)
- copied, changed from r641905,
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJB.java
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBSessionBean.java
(contents, props changed)
- copied, changed from r641905,
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBImpl.java
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.xml
(with props)
Removed:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJB.java
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBImpl.java
incubator/tuscany/java/sca/tutorial/catalog-mediation/services/ejb/
Modified:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/client/Client.java
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.xml
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/VegetablesCatalogEJB.componentType
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/catalog-ejb.composite
incubator/tuscany/java/sca/tutorial/catalog-mediation/META-INF/sca-contribution.xml
incubator/tuscany/java/sca/tutorial/catalog-mediation/services/mediation/VegetablesCatalogMediationImpl.java
Modified:
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=641941&r1=641940&r2=641941&view=diff
==============================================================================
---
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/client/Client.java
(original)
+++
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/client/Client.java
Thu Mar 27 11:58:09 2008
@@ -1,11 +1,10 @@
package client;
-import java.util.Properties;
-
-import javax.naming.Context;
import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
-import services.ejb.CatalogEJB;
+import services.ejb.CatalogEJBHome;
+import services.ejb.CatalogEJBRemote;
import services.ejb.Vegetable;
/**
@@ -16,13 +15,11 @@
public class Client {
public static void main(String[] args) throws Exception {
- Properties properties = new Properties();
- properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
- properties.setProperty(Context.PROVIDER_URL, "ejbd://localhost:4201");
- InitialContext context = new InitialContext(/*properties*/);
+ InitialContext context = new InitialContext();
- CatalogEJB catalog = (CatalogEJB)context.lookup("corbaname:iiop:[EMAIL
PROTECTED]:1050#VegetablesCatalogEJBRemote");
- //CatalogEJB catalog =
(CatalogEJB)context.lookup("java:VegetablesCatalogEJBRemote");
+ Object o = context.lookup("corbaname:iiop:[EMAIL
PROTECTED]:1050#VegetablesCatalogEJB");
+ CatalogEJBHome home = (CatalogEJBHome) PortableRemoteObject.narrow(o,
CatalogEJBHome.class);
+ CatalogEJBRemote catalog = home.create();
Vegetable items[] = catalog.get();
for (Vegetable item: items) {
Added:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java?rev=641941&view=auto
==============================================================================
---
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java
(added)
+++
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java
Thu Mar 27 11:58:09 2008
@@ -0,0 +1,28 @@
+/*
+ * 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.ejb;
+
+import javax.ejb.EJBHome;
+
+public interface CatalogEJBHome extends EJBHome {
+
+ CatalogEJBRemote create() throws javax.ejb.CreateException,
java.rmi.RemoteException;
+
+}
Propchange:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBRemote.java
(from r641905,
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJB.java)
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBRemote.java?p2=incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBRemote.java&p1=incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJB.java&r1=641905&r2=641941&rev=641941&view=diff
==============================================================================
---
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJB.java
(original)
+++
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBRemote.java
Thu Mar 27 11:58:09 2008
@@ -19,9 +19,10 @@
package services.ejb;
-import javax.ejb.Remote;
+import java.rmi.RemoteException;
[EMAIL PROTECTED]
-public interface CatalogEJB {
- Vegetable[] get();
+import javax.ejb.EJBObject;
+
+public interface CatalogEJBRemote extends EJBObject {
+ Vegetable[] get() throws RemoteException;
}
Propchange:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBRemote.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBRemote.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Copied:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBSessionBean.java
(from r641905,
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBImpl.java)
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBSessionBean.java?p2=incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBSessionBean.java&p1=incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBImpl.java&r1=641905&r2=641941&rev=641941&view=diff
==============================================================================
---
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBImpl.java
(original)
+++
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBSessionBean.java
Thu Mar 27 11:58:09 2008
@@ -19,16 +19,20 @@
package services.ejb;
+import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.List;
-import javax.ejb.Stateless;
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
[EMAIL PROTECTED](name="VegetablesCatalogEJB")
-public class VegetablesCatalogEJBImpl implements CatalogEJB {
+public class VegetablesCatalogEJBSessionBean implements SessionBean {
+ private static final long serialVersionUID = -7421020241291271838L;
+
private List<Vegetable> catalog = new ArrayList<Vegetable>();
- public VegetablesCatalogEJBImpl() {
+ public VegetablesCatalogEJBSessionBean() {
catalog.add(new Vegetable("Broccoli", "$2.99"));
catalog.add(new Vegetable("Asparagus", "$3.55"));
catalog.add(new Vegetable("Cauliflower", "$1.55"));
@@ -38,5 +42,17 @@
Vegetable[] catalogArray = new Vegetable[catalog.size()];
catalog.toArray(catalogArray);
return catalogArray;
+ }
+
+ public void ejbActivate() throws EJBException, RemoteException {
+ }
+
+ public void ejbPassivate() throws EJBException, RemoteException {
+ }
+
+ public void ejbRemove() throws EJBException, RemoteException {
+ }
+
+ public void setSessionContext(SessionContext arg0) throws EJBException,
RemoteException {
}
}
Propchange:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBSessionBean.java
------------------------------------------------------------------------------
eol-style = native
Added:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.xml
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.xml?rev=641941&view=auto
==============================================================================
---
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.xml
(added)
+++
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.xml
Thu Mar 27 11:58:09 2008
@@ -0,0 +1,35 @@
+<?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.
+-->
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+ version="2.1">
+
+ <display-name>Apache Tuscany SCA Tutorial Catalog EJB</display-name>
+ <enterprise-beans>
+ <session id="VegetablesCatalogEJB">
+ <ejb-name>VegetablesCatalogEJB</ejb-name>
+ <home>services.ejb.CatalogEJBHome</home>
+ <remote>services.ejb.CatalogEJBRemote</remote>
+ <ejb-class>services.ejb.VegetablesCatalogEJBSessionBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+ </enterprise-beans>
+</ejb-jar>
Propchange:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified:
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=641941&r1=641940&r2=641941&view=diff
==============================================================================
---
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.xml
(original)
+++
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.xml
Thu Mar 27 11:58:09 2008
@@ -1,32 +1,75 @@
-<?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>
+<?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:dependencies>
+ <sys:dependency>
+
<sys:groupId>org.apache.geronimo.configs</sys:groupId>
+ <sys:artifactId>j2ee-corba-yoko</sys:artifactId>
+ <sys:version>2.1</sys:version>
+ <sys:type>car</sys:type>
+ </sys:dependency>
+ </sys:dependencies>
+ </sys:environment>
+
+ <enterprise-beans>
+ <session>
+ <ejb-name>VegetablesCatalogEJB</ejb-name>
+ <jndi-name>VegetablesCatalogEJB</jndi-name>
+ <tss-link>IdentityTokenNoSecurity</tss-link>
+ </session>
+ </enterprise-beans>
+
+ <gbean name="IdentityTokenNoSecurity"
+ class="org.apache.geronimo.corba.TSSBeanGBean">
+ <attribute name="POAName">IdentityTokenNoSecurity</attribute>
+ <reference name="Server">
+ <name>UnprotectedServer</name>
+ </reference>
+ <xml-attribute name="tssConfig">
+ <tss:tss
+
xmlns:tss="http://www.openejb.org/xml/ns/corba-tss-config-2.0"
+
xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1">
+ <tss:compoundSecMechTypeList>
+ <tss:compoundSecMech>
+ <tss:sasMech>
+ <tss:identityTokenTypes>
+
<tss:ITTAnonymous />
+
<tss:ITTPrincipalNameGSSUP
+
principal-class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal"
/>
+
<tss:ITTDistinguishedName />
+
<tss:ITTX509CertChain />
+
</tss:identityTokenTypes>
+ </tss:sasMech>
+ </tss:compoundSecMech>
+ </tss:compoundSecMechTypeList>
+ </tss:tss>
+ </xml-attribute>
+ </gbean>
+
+</openejb-jar>
Modified:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/VegetablesCatalogEJB.componentType
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/VegetablesCatalogEJB.componentType?rev=641941&r1=641940&r2=641941&view=diff
==============================================================================
---
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/VegetablesCatalogEJB.componentType
(original)
+++
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/VegetablesCatalogEJB.componentType
Thu Mar 27 11:58:09 2008
@@ -20,7 +20,7 @@
<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
<service name="CatalogEJB">
- <interface.java interface="services.ejb.CatalogEJB"/>
+ <interface.java interface="services.ejb.CatalogEJBRemote"/>
</service>
</componentType>
Modified:
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/catalog-ejb.composite
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/catalog-ejb.composite?rev=641941&r1=641940&r2=641941&view=diff
==============================================================================
---
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/catalog-ejb.composite
(original)
+++
incubator/tuscany/java/sca/tutorial/catalog-ejb/src/main/resources/catalog-ejb.composite
Thu Mar 27 11:58:09 2008
@@ -24,7 +24,7 @@
<component name="VegetablesCatalogEJB">
<implementation.ejb
ejb-link="tutorial-catalog-ejb.jar#VegetablesCatalogEJB"/>
<service name="CatalogEJB">
- <binding.ejb uri="java:VegetablesCatalogEJBRemote"/>
+ <binding.ejb uri="corbaname:iiop:[EMAIL
PROTECTED]:1050#VegetablesCatalogEJB"/>
</service>
</component>
Modified:
incubator/tuscany/java/sca/tutorial/catalog-mediation/META-INF/sca-contribution.xml
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-mediation/META-INF/sca-contribution.xml?rev=641941&r1=641940&r2=641941&view=diff
==============================================================================
---
incubator/tuscany/java/sca/tutorial/catalog-mediation/META-INF/sca-contribution.xml
(original)
+++
incubator/tuscany/java/sca/tutorial/catalog-mediation/META-INF/sca-contribution.xml
Thu Mar 27 11:58:09 2008
@@ -20,5 +20,6 @@
<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:c="http://catalog">
<import.java package="services"/>
+ <import.java package="services.ejb"/>
<deployable composite="c:catalog-mediation"/>
</contribution>
Modified:
incubator/tuscany/java/sca/tutorial/catalog-mediation/services/mediation/VegetablesCatalogMediationImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/tutorial/catalog-mediation/services/mediation/VegetablesCatalogMediationImpl.java?rev=641941&r1=641940&r2=641941&view=diff
==============================================================================
---
incubator/tuscany/java/sca/tutorial/catalog-mediation/services/mediation/VegetablesCatalogMediationImpl.java
(original)
+++
incubator/tuscany/java/sca/tutorial/catalog-mediation/services/mediation/VegetablesCatalogMediationImpl.java
Thu Mar 27 11:58:09 2008
@@ -19,20 +19,28 @@
package services.mediation;
+import java.rmi.RemoteException;
+
+import org.osoa.sca.ServiceRuntimeException;
import org.osoa.sca.annotations.Reference;
import services.Catalog;
import services.Item;
-import services.ejb.CatalogEJB;
+import services.ejb.CatalogEJBRemote;
import services.ejb.Vegetable;
public class VegetablesCatalogMediationImpl implements Catalog {
@Reference
- public CatalogEJB catalog;
+ public CatalogEJBRemote catalog;
public Item[] get() {
- Vegetable[] vegetables = catalog.get();
+ Vegetable[] vegetables;
+ try {
+ vegetables = catalog.get();
+ } catch (RemoteException e) {
+ throw new ServiceRuntimeException(e);
+ }
Item[] items = new Item[vegetables.length];
for (int i = 0; i < vegetables.length; i++) {
items[i] = new Item(vegetables[i].getName(),
vegetables[i].getPrice());
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]