summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca')
-rw-r--r--tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java122
-rw-r--r--tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppModuleActivator.java57
-rw-r--r--tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java114
-rw-r--r--tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java336
-rw-r--r--tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTEI.java45
-rw-r--r--tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTag.java118
6 files changed, 0 insertions, 792 deletions
diff --git a/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java b/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java
deleted file mode 100644
index cb4369fc01..0000000000
--- a/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.webapp;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.tuscany.sca.host.http.ServletHost;
-
-/**
- * A Servlet filter that forwards service requests to the Servlets registered with
- * the Tuscany ServletHost.
- *
- * @version $Rev$ $Date$
- */
-public class TuscanyServletFilter implements Filter {
- private static final long serialVersionUID = 1L;
- //private static final Logger logger = Logger.getLogger(WebAppServletHost.class.getName());
-
- private static Map<ClassLoader, ServletHost> servletHosts =
- Collections.synchronizedMap(new WeakHashMap<ClassLoader, ServletHost>());
-
- // [REVIEW] Assume the filter class is per webapp
- private static WebAppServletHost servletHost;
-
- // Test if the servletHost == null to know if the filter is called (webapp)
- static ServletHost getServletHost() {
- return servletHosts.get(Thread.currentThread().getContextClassLoader());
- }
-
- public void init(final FilterConfig config) throws ServletException {
- // TODO: must be a better way to get this than using a static
- servletHost = new WebAppServletHost();
- servletHosts.put(Thread.currentThread().getContextClassLoader(), servletHost);
-
- // Initialize the Servlet host
- servletHost.init(new ServletConfig() {
- public String getInitParameter(String name) {
- return config.getInitParameter(name);
- }
-
- public Enumeration getInitParameterNames() {
- return config.getInitParameterNames();
- }
-
- public ServletContext getServletContext() {
- return config.getServletContext();
- }
-
- public String getServletName() {
- return config.getFilterName();
- }
- });
- }
-
- public void destroy() {
- if (servletHost != null) {
- servletHost.destroy();
- servletHost = null;
- servletHosts.remove(Thread.currentThread().getContextClassLoader());
- }
- }
-
- public void doFilter(ServletRequest request, ServletResponse response, javax.servlet.FilterChain chain)
- throws IOException, ServletException {
-
- // Get the Servlet path
- HttpServletRequest httpRequest = (HttpServletRequest)request;
- String path = httpRequest.getPathInfo();
- if (path == null) {
- path = httpRequest.getServletPath();
- }
- if (path == null) {
- path = "/";
- }
-
- // Get a request dispatcher for the Servlet mapped to that path
- RequestDispatcher dispatcher = servletHost.getRequestDispatcher(path);
- if (dispatcher != null) {
-
- // Let the dispatcher forward the request to the Servlet
- dispatcher.forward(request, response);
-
- } else {
-
- // Proceed down the filter chain
- chain.doFilter(request, response);
-
- }
- }
-
-}
diff --git a/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppModuleActivator.java b/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppModuleActivator.java
deleted file mode 100644
index 1b39b32d75..0000000000
--- a/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppModuleActivator.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.webapp;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-
-/**
- * Activates the webapp host by registering the webapp ServletHost impl
- *
- * @version $Rev$ $Date$
- */
-public class WebAppModuleActivator implements ModuleActivator {
-
- public void start(ExtensionPointRegistry extensionPointRegistry) {
-
- ServletHostExtensionPoint servletHosts =
- extensionPointRegistry.getExtensionPoint(ServletHostExtensionPoint.class);
-
- List<ServletHost> hosts = servletHosts.getServletHosts();
- ServletHost host = null;
- try {
- host = TuscanyServletFilter.getServletHost();
- } catch (NoClassDefFoundError e) {
- // ignore
- }
- if (host != null) {
- hosts.clear();
- hosts.add(host);
- }
- }
-
- public void stop(ExtensionPointRegistry registry) {
- }
-
-}
diff --git a/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java b/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java
deleted file mode 100644
index f14dfac58b..0000000000
--- a/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.webapp;
-
-import java.io.IOException;
-import java.util.StringTokenizer;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-
-/**
- * A Servlet request dispatcher that can be used to delegate requests to a
- * Servlet registered with the Webapp Servlet host.
- *
- * @version $Rev$ $Date$
- */
-class WebAppRequestDispatcher implements RequestDispatcher {
- private String servletPath;
- private Servlet servlet;
-
- public WebAppRequestDispatcher(String mapping, Servlet servlet) {
- if (mapping.endsWith("*")) {
- mapping = mapping.substring(0, mapping.length()-1);
- }
- if (mapping.endsWith("/")) {
- mapping = mapping.substring(0, mapping.length()-1);
- }
- this.servletPath = mapping;
- this.servlet = servlet;
- }
-
- /**
- * Returns a request wrapper which will return the correct Servlet path
- * and path info.
- *
- * @param request
- * @return
- */
- private HttpServletRequest createRequestWrapper(ServletRequest request) {
- HttpServletRequest requestWrapper = new HttpServletRequestWrapper((HttpServletRequest)request) {
-
- @Override
- public String getServletPath() {
- return servletPath;
- }
-
- @Override
- public String getPathInfo() {
- String path = super.getServletPath();
- if (path.length() == 0) {
- path = super.getPathInfo();
- }
-
- // TODO: another context path hack, revisit when context path is sorted out
- path = fiddlePath(path, servletPath);
-
- return path;
- }
- };
- return requestWrapper;
- }
-
- /**
- * Remove any path suffix thats part of the Servlet context path
- */
- protected String fiddlePath(String path, String servletPath) {
- StringTokenizer st = new StringTokenizer(path, "/");
- if (st.countTokens() == 1) {
- return path;
- }
- String root = "";
- while (st.hasMoreTokens()){
- String s = st.nextToken();
- if (servletPath.endsWith((root + "/" + s))) {
- root += "/" + s;
- } else {
- break;
- }
- }
- String fiddlePath = path.substring(root.length());
- return fiddlePath;
- }
-
- public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException {
- servlet.service(createRequestWrapper(request), response);
- }
-
- public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException {
- servlet.service(createRequestWrapper(request), response);
- }
-}
-
diff --git a/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java b/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
deleted file mode 100644
index 118403fd67..0000000000
--- a/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * 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.webapp;
-
-import java.io.File;
-import java.lang.reflect.Method;
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Logger;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletMappingException;
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-
-/**
- * ServletHost implementation for use in a webapp environment.
- *
- * FIXME: using a static singleton seems a big hack but how should it be shared?
- * Need some way for TuscanyServlet to pull it out.
- *
- * @version $Rev$ $Date$
- */
-public class WebAppServletHost implements ServletHost {
- private static final Logger logger = Logger.getLogger(WebAppServletHost.class.getName());
-
- public static final String SCA_NODE_ATTRIBUTE = Node.class.getName();
-
- private static final WebAppServletHost instance = new WebAppServletHost();
-
- private Map<String, Servlet> servlets;
- private Node node;
- private String contextPath = "/";
- private int defaultPortNumber = 8080;
- private String contributionRoot;
-
- private ServletContext servletContext;
-
- WebAppServletHost() {
- servlets = new HashMap<String, Servlet>();
- }
-
- public void setDefaultPort(int port) {
- defaultPortNumber = port;
- }
-
- public int getDefaultPort() {
- return defaultPortNumber;
- }
-
- public void addServletMapping(String suri, Servlet servlet) throws ServletMappingException {
- URI pathURI = URI.create(suri);
-
- // Make sure that the path starts with a /
- suri = pathURI.getPath();
- if (!suri.startsWith("/")) {
- suri = '/' + suri;
- }
-
- if (!suri.startsWith(contextPath)) {
- suri = contextPath + suri;
- }
-
- // In a webapp just use the given path and ignore the host and port
- // as they are fixed by the Web container
- servlets.put(suri, servlet);
-
- logger.info("Added Servlet mapping: " + suri);
- }
-
- public Servlet removeServletMapping(String suri) throws ServletMappingException {
- URI pathURI = URI.create(suri);
-
- // Make sure that the path starts with a /
- suri = pathURI.getPath();
- if (!suri.startsWith("/")) {
- suri = '/' + suri;
- }
-
- if (!suri.startsWith(contextPath)) {
- suri = contextPath + suri;
- }
-
- // In a webapp just use the given path and ignore the host and port
- // as they are fixed by the Web container
- return servlets.remove(suri);
- }
-
- public Servlet getServletMapping(String suri) throws ServletMappingException {
- if (!suri.startsWith("/")) {
- suri = '/' + suri;
- }
-
- if (!suri.startsWith(contextPath)) {
- suri = contextPath + suri;
- }
-
- // Get the Servlet mapped to the given path
- Servlet servlet = servlets.get(suri);
- return servlet;
- }
-
- public URL getURLMapping(String suri) throws ServletMappingException {
- URI uri = URI.create(suri);
-
- // Get the URI scheme and port
- String scheme = uri.getScheme();
- if (scheme == null) {
- scheme = "http";
- }
- int portNumber = uri.getPort();
- if (portNumber == -1) {
- portNumber = defaultPortNumber;
- }
-
- // Get the host
- String host;
- try {
- host = InetAddress.getLocalHost().getHostName();
- } catch (UnknownHostException e) {
- host = "localhost";
- }
-
- // Construct the URL
- String path = uri.getPath();
- if (!path.startsWith("/")) {
- path = '/' + path;
- }
-
- if (contextPath != null && !path.startsWith(contextPath)) {
- path = contextPath + path;
- }
-
- URL url;
- try {
- url = new URL(scheme, host, portNumber, path);
- } catch (MalformedURLException e) {
- throw new ServletMappingException(e);
- }
- return url;
- }
-
- public RequestDispatcher getRequestDispatcher(String suri) throws ServletMappingException {
-
- // Make sure that the path starts with a /
- if (!suri.startsWith("/")) {
- suri = '/' + suri;
- }
-
- suri = contextPath + suri;
-
- // Get the Servlet mapped to the given path
- Servlet servlet = servlets.get(suri);
- if (servlet != null) {
- return new WebAppRequestDispatcher(suri, servlet);
- }
-
- for (Map.Entry<String, Servlet> entry : servlets.entrySet()) {
- String servletPath = entry.getKey();
- if (servletPath.endsWith("*")) {
- servletPath = servletPath.substring(0, servletPath.length() - 1);
- if (suri.startsWith(servletPath)) {
- // entry key is contextPath/servletPath, WebAppRequestDispatcher only wants servletPath
- return new WebAppRequestDispatcher(entry.getKey().substring(contextPath.length()), entry.getValue());
- } else {
- if ((suri + "/").startsWith(servletPath)) {
- return new WebAppRequestDispatcher(entry.getKey().substring(contextPath.length()), entry.getValue());
- }
- }
- }
- }
-
- // No Servlet found
- return null;
- }
-
- public static WebAppServletHost getInstance() {
- return instance;
- }
-
- public void init(ServletConfig config) throws ServletException {
-
- servletContext = config.getServletContext();
- if (servletContext.getAttribute(SCA_NODE_ATTRIBUTE) == null) {
- initContextPath(config);
- contributionRoot = getContributionRoot(servletContext);
- NodeFactory factory = NodeFactory.newInstance();
- node = factory.createNode("WEB-INF/web.composite", new Contribution(contributionRoot, contributionRoot));
- node.start();
- servletContext.setAttribute(SCA_NODE_ATTRIBUTE, node);
- }
-
- // Initialize the registered Servlets
- for (Servlet servlet : servlets.values()) {
- servlet.init(config);
- }
-
- }
-
- protected String getContributionRoot(ServletContext servletContext) {
- String contributionRoot = null;
- try {
-
- InitialContext ic = new InitialContext();
- URL repoURL = (URL)ic.lookup("java:comp/env/url/contributions");
-
- contributionRoot = repoURL.toString();
-
- } catch (NamingException e) {
-
- // ignore exception and use default location
-
- try {
-
- String root = servletContext.getInitParameter("contributionRoot");
- if (root == null || root.length() < 1) {
- root = "/";
- }
- URL rootURL = servletContext.getResource(root);
- if (rootURL.getProtocol().equals("jndi")) {
- //this is Tomcat case, we should use getRealPath
- File warRootFile = new File(servletContext.getRealPath(root));
- contributionRoot = warRootFile.toURI().toString();
- } else {
- //this is Jetty case
- contributionRoot = rootURL.toString();
- }
-
- } catch (MalformedURLException mf) {
- //ignore, pass null
- }
- }
-
- return contributionRoot;
- }
-
- /**
- * Initializes the contextPath
- * The 2.5 Servlet API has a getter for this, for pre 2.5 Servlet
- * containers use an init parameter.
- */
- @SuppressWarnings("unchecked")
- public void initContextPath(ServletConfig config) {
-
- if (Collections.list(config.getInitParameterNames()).contains("contextPath")) {
- contextPath = config.getInitParameter("contextPath");
- } else {
- // The getContextPath() is introduced since Servlet 2.5
- ServletContext context = config.getServletContext();
- try {
- // Try to get the method anyway since some ServletContext impl has this method even before 2.5
- Method m = context.getClass().getMethod("getContextPath", new Class[] {});
- contextPath = (String)m.invoke(context, new Object[] {});
- } catch (Exception e) {
- logger.warning("Servlet level is: " + context.getMajorVersion() + "." + context.getMinorVersion());
- throw new IllegalStateException("'contextPath' init parameter must be set for pre-2.5 servlet container");
- }
- }
-
- logger.info("ContextPath: " + contextPath);
- }
-
- void destroy() {
-
- // Destroy the registered Servlets
- for (Servlet servlet : servlets.values()) {
- servlet.destroy();
- }
-
- // Close the SCA domain
- if (node != null) {
- node.stop();
- }
- }
-
- public String getContextPath() {
- return contextPath;
- }
-
- public void setContextPath(String path) {
- // if (!contextPath.equals(path)) {
- // throw new IllegalArgumentException("invalid context path for webapp, existing context path: " + contextPath + " new contextPath: " + path);
- // }
- }
-
- /**
- * TODO: How context paths work is still up in the air so for now
- * this hacks in a path that gets some samples working
- * can't use setContextPath as NodeImpl calls that later
- */
- public void setContextPath2(String path) {
- if (path != null && path.length() > 0) {
- this.contextPath = path;
- }
- }
-
- public String getContributionRoot() {
- return contributionRoot;
- }
-
- public void setAttribute(String name, Object value) {
- servletContext.setAttribute(name, value);
- }
-}
diff --git a/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTEI.java b/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTEI.java
deleted file mode 100644
index 6e1b187a48..0000000000
--- a/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTEI.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.webapp.jsp;
-
-import javax.servlet.jsp.tagext.TagData;
-import javax.servlet.jsp.tagext.TagExtraInfo;
-import javax.servlet.jsp.tagext.VariableInfo;
-
-/**
- * TagExtraInfo class for the SCA reference tags
- * <sca:reference name="service" type="test.MyService" scope="1" />
- *
- * @version $Rev$ $Date$
- */
-public class ReferenceTEI extends TagExtraInfo {
-
- @Override
- public VariableInfo[] getVariableInfo(TagData data) {
- VariableInfo info1
- = new VariableInfo(
- data.getAttributeString("name"),
- data.getAttributeString("type"),
- true,
- VariableInfo.AT_END);
- VariableInfo[] info = { info1 } ;
- return info;
- }
-}
diff --git a/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTag.java b/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTag.java
deleted file mode 100644
index 555ad16cd8..0000000000
--- a/tags/java/sca/2.0-M1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTag.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.webapp.jsp;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.PageContext;
-import javax.servlet.jsp.tagext.TagSupport;
-
-import org.apache.tuscany.sca.host.webapp.WebAppServletHost;
-import org.apache.tuscany.sca.node.Node;
-import org.oasisopen.sca.ComponentContext;
-
-/**
- * Tag to handle SCA references
- * <sca:reference name="service" type="test.MyService" scope="1" />
- *
- * @version $Rev$ $Date$
- */
-public class ReferenceTag extends TagSupport {
- private static final long serialVersionUID = 1L;
-
- protected String name;
- protected String type;
- protected Integer scope = PageContext.PAGE_SCOPE;
-
- @Override
- public int doStartTag() throws JspException {
- return SKIP_BODY;
- }
-
- @Override
- public int doEndTag() throws JspException {
-
- try {
- WebAppServletHost.getInstance().init(pageContext.getServletConfig());
- } catch (ServletException e) {
- throw new JspException("Exception initializing Tuscany webapp: " + e, e);
- }
-
- ServletContext servletContext = pageContext.getServletContext();
- ComponentContext componentContext = (ComponentContext)servletContext.getAttribute("org.oasisopen.sca.ComponentContext");
- Node scaDomain = null;
- if (componentContext == null) {
- scaDomain = (Node)servletContext.getAttribute(WebAppServletHost.SCA_NODE_ATTRIBUTE);
- if (scaDomain == null) {
- throw new JspException("SCADomain is null. Check Tuscany configuration in web.xml");
- }
- }
-
- Class<?> typeClass;
- try {
- typeClass = Class.forName(type, true, Thread.currentThread().getContextClassLoader());
- } catch (ClassNotFoundException e) {
- throw new JspException("Reference '" + name + "' type class not found: " + type);
- }
-
- Object o;
- try {
- if (componentContext != null) {
- o = componentContext.getService(typeClass, name);
- } else {
- o = scaDomain.getService(typeClass, name);
- }
- } catch (Exception e) {
- throw new JspException("Exception getting service for reference'" + name + "': " + e, e);
- }
- if (o == null) {
- throw new JspException("Reference '" + name + "' not found");
- }
-
- pageContext.setAttribute(name, o, scope);
-
- return EVAL_PAGE;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Integer getScope() {
- return scope;
- }
-
- public void setScope(Integer scope) {
- this.scope = scope;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-}