From 1fb6a28a73ca17dbb8c4b3059db590e2f9620943 Mon Sep 17 00:00:00 2001 From: antelder Date: Wed, 3 Aug 2011 09:21:41 +0000 Subject: Correct tag name git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1153404 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/binding/ejb/util/NamingEndpoint.java | 124 --------------------- 1 file changed, 124 deletions(-) delete mode 100644 sca-java-1.x/tags/1.6.1-TUSCANY-3909/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/NamingEndpoint.java (limited to 'sca-java-1.x/tags/1.6.1-TUSCANY-3909/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/NamingEndpoint.java') diff --git a/sca-java-1.x/tags/1.6.1-TUSCANY-3909/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/NamingEndpoint.java b/sca-java-1.x/tags/1.6.1-TUSCANY-3909/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/NamingEndpoint.java deleted file mode 100644 index 346b7c5cf6..0000000000 --- a/sca-java-1.x/tags/1.6.1-TUSCANY-3909/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/NamingEndpoint.java +++ /dev/null @@ -1,124 +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.binding.ejb.util; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -public class NamingEndpoint { - private String jndiName; - private EJBLocator locator; - private boolean managed = true; - - public NamingEndpoint(String hostName, int port, String jndiName) { - this.jndiName = jndiName; - this.locator = new EJBLocator(hostName, port); - } - - public NamingEndpoint(String name) { - - /** - * by default it's a managed environment means SCA composite with ref - * binding is running on an AppServer. If running on J2SE, pass - * -Dmanaged=false for the VM - */ - final String managedEnv = AccessController.doPrivileged(new PrivilegedAction() { - public String run() { - return System.getProperty("managed"); - } - }); - - if (managedEnv != null) { - managed = Boolean.valueOf(managedEnv); - } - - if ((!managed) && name.startsWith("corbaname:iiop:")) { - /** - * if (name.startsWith("corbaname:iiop:")) { corbaname:iiop::/#name - * For example, - * "corbaname:iiop:localhost:2809/NameServiceServerRoot#ejb/MyEJBHome"; - */ - - String[] parts = split(name, '#'); - if (parts.length != 2) { - throw new IllegalArgumentException("Invalid corbaname: " + name); - } - - this.jndiName = name; // The logical JNDI name - this.locator = new EJBLocator(parts[0], managed); - - } else { - this.jndiName = name; - this.locator = new EJBLocator(managed); - } - - } - - private static String[] split(String str, char ch) { - int index = str.lastIndexOf(ch); - if (index == -1) { - return new String[] {str, ""}; - } else { - return new String[] {str.substring(0, index), str.substring(index + 1)}; - } - } - - /** - * @return Returns the jndiName. - */ - public String getJndiName() { - return jndiName; - } - - public EJBLocator getLocator() { - return locator; - } - - public String getCorbaname() { - return locator.getCorbaname(jndiName); - } - - /** - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (obj instanceof NamingEndpoint) { - NamingEndpoint endpoint = (NamingEndpoint)obj; - return jndiName.equals(endpoint.jndiName); - } - return false; - } - - /** - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - return jndiName.hashCode(); - } - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return jndiName; - } -} -- cgit v1.2.3