summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.5/modules/host-ejb/src
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-05-16 08:53:06 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-05-16 08:53:06 +0000
commitbee80d90df6104edff19cbb6a318fac3d64296aa (patch)
tree50032a7895eeeccb50520bcceb6dfb1fd06f2357 /branches/sca-java-1.5/modules/host-ejb/src
parent3d3b8834b93b98cc7d7534e693e937179067eb58 (diff)
Create 1.5 release branch from current 1.x trunk
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@775437 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.5/modules/host-ejb/src')
-rw-r--r--branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/DefaultEJBHostExtensionPoint.java45
-rw-r--r--branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBHost.java62
-rw-r--r--branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBHostExtensionPoint.java51
-rw-r--r--branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBRegistrationException.java44
-rw-r--r--branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBSessionBean.java45
-rw-r--r--branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/ExtensibleEJBHost.java69
-rw-r--r--branches/sca-java-1.5/modules/host-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.ejb.EJBHostExtensionPoint18
7 files changed, 334 insertions, 0 deletions
diff --git a/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/DefaultEJBHostExtensionPoint.java b/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/DefaultEJBHostExtensionPoint.java
new file mode 100644
index 0000000000..c0107cb316
--- /dev/null
+++ b/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/DefaultEJBHostExtensionPoint.java
@@ -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 org.apache.tuscany.sca.host.ejb;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Default implementation of an EJB host extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultEJBHostExtensionPoint implements EJBHostExtensionPoint {
+
+ private List<EJBHost> ejbHosts = new ArrayList<EJBHost>();
+
+ public void addEJBHost(EJBHost ejbHost) {
+ ejbHosts.add(ejbHost);
+ }
+
+ public void removeEJBHost(EJBHost ejbHost) {
+ ejbHosts.remove(ejbHost);
+ }
+
+ public List<EJBHost> getEJBHosts() {
+ return ejbHosts;
+ }
+}
diff --git a/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBHost.java b/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBHost.java
new file mode 100644
index 0000000000..842dd7a4f5
--- /dev/null
+++ b/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBHost.java
@@ -0,0 +1,62 @@
+/*
+ * 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.tuscany.sca.host.ejb;
+
+
+
+/**
+ * Interface implemented by host environments that allow EJBs
+ * to be registered.
+ * <p/>
+ * This interface allows a system service to register an EJB session
+ * bean to handle inbound requests.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EJBHost {
+
+ /**
+ * Add an EJB session bean.
+ *
+ * @param ejbName the EJB name
+ * @param sessionBean the EJB session bean descriptor
+ * @throws EJBRegistrationException
+ */
+ void addSessionBean(String ejbName, EJBSessionBean sessionBean) throws EJBRegistrationException;
+
+ /**
+ * Remove an EJB session bean.
+ *
+ * @param ejbName the EJB name
+ * @return the EJB session bean descriptor that was registered under that name
+ * @throws EJBRegistrationException
+ */
+ EJBSessionBean removeSessionBean(String ejbName) throws EJBRegistrationException;
+
+ /**
+ * Returns the EJB session bean descriptor registered under
+ * the given EJB name.
+ *
+ * @param ejbName the EJB name
+ * @return the EJB session bean descriptor
+ * @throws EJBRegistrationException
+ */
+ EJBSessionBean getSessionBean(String ejbName) throws EJBRegistrationException;
+
+}
diff --git a/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBHostExtensionPoint.java b/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBHostExtensionPoint.java
new file mode 100644
index 0000000000..75912dcc45
--- /dev/null
+++ b/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBHostExtensionPoint.java
@@ -0,0 +1,51 @@
+/*
+ * 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.tuscany.sca.host.ejb;
+
+import java.util.List;
+
+/**
+ * An extension point for EJB hosts.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EJBHostExtensionPoint {
+
+ /**
+ * Adds an EJB host extension.
+ *
+ * @param ejbHost
+ */
+ void addEJBHost(EJBHost ejbHost);
+
+ /**
+ * Removes an EJB host extension.
+ *
+ * @param ejbHost
+ */
+ void removeEJBHost(EJBHost ejbHost);
+
+ /**
+ * Returns a list of EJB host extensions.
+ *
+ * @return
+ */
+ List<EJBHost> getEJBHosts();
+
+}
diff --git a/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBRegistrationException.java b/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBRegistrationException.java
new file mode 100644
index 0000000000..a50e701766
--- /dev/null
+++ b/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBRegistrationException.java
@@ -0,0 +1,44 @@
+/*
+ * 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.tuscany.sca.host.ejb;
+
+/**
+ * Indicates an exception while registering an EJB.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EJBRegistrationException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ public EJBRegistrationException() {
+ super();
+ }
+
+ public EJBRegistrationException(String message) {
+ super(message);
+ }
+
+ public EJBRegistrationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public EJBRegistrationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBSessionBean.java b/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBSessionBean.java
new file mode 100644
index 0000000000..f9967bdd8a
--- /dev/null
+++ b/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/EJBSessionBean.java
@@ -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 org.apache.tuscany.sca.host.ejb;
+
+/**
+ * Represents an EJB session bean.
+ *
+ * @version $Rev: $ $Date: $
+ */
+public class EJBSessionBean {
+
+ private Class<?> implementationClass;
+ private Class<?> remoteInterface;
+
+ public EJBSessionBean(Class<?> implementationClass, Class<?> remoteInterface) {
+ this.implementationClass = implementationClass;
+ this.remoteInterface = remoteInterface;
+ }
+
+ public Class<?> getImplementationClass() {
+ return implementationClass;
+ }
+
+ public Class<?> getRemoteInterface() {
+ return remoteInterface;
+ }
+
+}
diff --git a/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/ExtensibleEJBHost.java b/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/ExtensibleEJBHost.java
new file mode 100644
index 0000000000..fab408c7c0
--- /dev/null
+++ b/branches/sca-java-1.5/modules/host-ejb/src/main/java/org/apache/tuscany/sca/host/ejb/ExtensibleEJBHost.java
@@ -0,0 +1,69 @@
+/*
+ * 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.tuscany.sca.host.ejb;
+
+
+/**
+ * Default implementation of an extensible EJB host.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleEJBHost implements EJBHost {
+
+ private EJBHostExtensionPoint ejbHosts;
+
+ public ExtensibleEJBHost(EJBHostExtensionPoint ejbHosts) {
+ this.ejbHosts = ejbHosts;
+ }
+
+ public void addSessionBean(String ejbName, EJBSessionBean ejbClass) throws EJBRegistrationException {
+ if (ejbHosts.getEJBHosts().isEmpty()) {
+ throw new EJBRegistrationException("No EJB host available");
+ }
+
+ // TODO implement selection of the correct EJB host based on the mapping
+ // For now just select the first one
+ getDefaultEJBHost().addSessionBean(ejbName, ejbClass);
+ }
+
+ public EJBSessionBean removeSessionBean(String ejbName) throws EJBRegistrationException {
+ if (ejbHosts.getEJBHosts().isEmpty()) {
+ throw new EJBRegistrationException("No EJB host available");
+ }
+
+ // TODO implement selection of the correct EJB host based on the mapping
+ // For now just select the first one
+ return getDefaultEJBHost().removeSessionBean(ejbName);
+ }
+
+ public EJBSessionBean getSessionBean(String ejbName) throws EJBRegistrationException {
+ if (ejbHosts.getEJBHosts().isEmpty()) {
+ throw new EJBRegistrationException("No EJB host available");
+ }
+
+ // TODO implement selection of the correct EJB host based on the mapping
+ // For now just select the first one
+ return getDefaultEJBHost().getSessionBean(ejbName);
+ }
+
+ private EJBHost getDefaultEJBHost() {
+ return ejbHosts.getEJBHosts().get(0);
+ }
+}
diff --git a/branches/sca-java-1.5/modules/host-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.ejb.EJBHostExtensionPoint b/branches/sca-java-1.5/modules/host-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.ejb.EJBHostExtensionPoint
new file mode 100644
index 0000000000..c42791f598
--- /dev/null
+++ b/branches/sca-java-1.5/modules/host-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.ejb.EJBHostExtensionPoint
@@ -0,0 +1,18 @@
+# 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.
+
+org.apache.tuscany.sca.host.ejb.DefaultEJBHostExtensionPoint