EOL I guess, didnt open or edited anything in this clone yet
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/886f3488 Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/886f3488 Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/886f3488 Branch: refs/heads/master Commit: 886f348875229dab2d7b3d1b92068ede3e5eff5e Parents: 6b440f5 Author: Romain Manni-Bucau <[email protected]> Authored: Mon Nov 23 15:12:49 2015 +0100 Committer: Romain Manni-Bucau <[email protected]> Committed: Mon Nov 23 15:12:49 2015 +0100 ---------------------------------------------------------------------- .../server/cxf/ejb/EjbMessageContext.java | 124 +- .../server/cxf/CxfJaxWsProviderTest.java | 274 ++-- .../server/cxf/fault/AuthenticatorService.java | 60 +- .../cxf/fault/AuthenticatorServiceBean.java | 84 +- .../AuthenticatorServiceBeanNoHandler.java | 82 +- .../server/cxf/fault/DummyInterceptor.java | 96 +- .../cxf/fault/WrongPasswordException.java | 82 +- .../fault/WrongPasswordRuntimeException.java | 84 +- .../src/test/resources/META-INF/ejb-jar.xml | 36 +- .../apache/openejb/server/cxf/fault/handler.xml | 52 +- .../org/apache/openejb/daemon/NTService.java | 228 +-- .../apache/openejb/server/ejbd/EjbServer.java | 288 ++-- .../openejb/server/ejbd/RequestHandler.java | 90 +- .../server/discovery/MulticastPulseAgent.java | 1518 +++++++++--------- .../multipulse | 6 +- .../discovery/MulticastPulseAgentTest.java | 1026 ++++++------ .../openejb/server/rest/EJBRestServiceInfo.java | 66 +- .../server/rest/InternalApplication.java | 90 +- .../main/resources/META-INF/openejb-server.xml | 72 +- .../META-INF/org.apache.openejb.cli/stop.help | 28 +- src/main/style/checkstyle.xml | 330 ++-- 21 files changed, 2358 insertions(+), 2358 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java b/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java index 87b7606..c53c4cb 100644 --- a/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java +++ b/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbMessageContext.java @@ -1,62 +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.openejb.server.cxf.ejb; - -import javax.xml.ws.EndpointReference; -import javax.xml.ws.WebServiceException; -import javax.xml.ws.wsaddressing.W3CEndpointReference; -import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder; - -import org.apache.cxf.endpoint.Endpoint; -import org.apache.cxf.jaxws.context.WrappedMessageContext; -import org.apache.cxf.message.Message; -import org.apache.openejb.core.webservices.AddressingSupport; -import org.w3c.dom.Element; - -public class EjbMessageContext extends WrappedMessageContext implements AddressingSupport { - - public EjbMessageContext(Message m, Scope defScope) { - super(m, defScope); - } - - public EndpointReference getEndpointReference(Element... referenceParameters) { - org.apache.cxf.message.Message msg = getWrappedMessage(); - Endpoint ep = msg.getExchange().get(Endpoint.class); - - W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder(); - builder.address(ep.getEndpointInfo().getAddress()); - builder.serviceName(ep.getService().getName()); - builder.endpointName(ep.getEndpointInfo().getName()); - - if (referenceParameters != null) { - for (Element referenceParameter : referenceParameters) { - builder.referenceParameter(referenceParameter); - } - } - - return builder.build(); - } - - public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) { - if (W3CEndpointReference.class.isAssignableFrom(clazz)) { - return clazz.cast(getEndpointReference(referenceParameters)); - } else { - throw new WebServiceException("Endpoint reference type not supported: " + clazz); - } - } - -} +/** + * 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.openejb.server.cxf.ejb; + +import javax.xml.ws.EndpointReference; +import javax.xml.ws.WebServiceException; +import javax.xml.ws.wsaddressing.W3CEndpointReference; +import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder; + +import org.apache.cxf.endpoint.Endpoint; +import org.apache.cxf.jaxws.context.WrappedMessageContext; +import org.apache.cxf.message.Message; +import org.apache.openejb.core.webservices.AddressingSupport; +import org.w3c.dom.Element; + +public class EjbMessageContext extends WrappedMessageContext implements AddressingSupport { + + public EjbMessageContext(Message m, Scope defScope) { + super(m, defScope); + } + + public EndpointReference getEndpointReference(Element... referenceParameters) { + org.apache.cxf.message.Message msg = getWrappedMessage(); + Endpoint ep = msg.getExchange().get(Endpoint.class); + + W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder(); + builder.address(ep.getEndpointInfo().getAddress()); + builder.serviceName(ep.getService().getName()); + builder.endpointName(ep.getEndpointInfo().getName()); + + if (referenceParameters != null) { + for (Element referenceParameter : referenceParameters) { + builder.referenceParameter(referenceParameter); + } + } + + return builder.build(); + } + + public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) { + if (W3CEndpointReference.class.isAssignableFrom(clazz)) { + return clazz.cast(getEndpointReference(referenceParameters)); + } else { + throw new WebServiceException("Endpoint reference type not supported: " + clazz); + } + } + +} http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java index 6f3e89b..a8b512d 100644 --- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java +++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/CxfJaxWsProviderTest.java @@ -1,137 +1,137 @@ -/** - * 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.openejb.server.cxf; - -import junit.framework.TestCase; -import org.apache.openejb.config.DeploymentFilterable; -import org.apache.openejb.server.cxf.fault.AuthenticatorService; -import org.apache.openejb.server.cxf.fault.WrongPasswordException; -import org.apache.openejb.server.cxf.fault.WrongPasswordRuntimeException; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.util.Properties; - -/** - * @version $Rev$ - */ -public class CxfJaxWsProviderTest extends TestCase { - - //START SNIPPET: setup - private InitialContext initialContext; - - //Random port to avoid test conflicts - private static final int port = Integer.parseInt(System.getProperty("httpejbd.port", "" + org.apache.openejb.util.NetworkUtil.getNextAvailablePort())); - - protected void setUp() throws Exception { - Properties properties = new Properties(); - properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf.*"); - properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); - properties.setProperty("openejb.embedded.remotable", "true"); - - //Just for this test we change the default port from 4204 to avoid conflicts - properties.setProperty("httpejbd.port", "" + port); - - initialContext = new InitialContext(properties); - } - //END SNIPPET: setup - - public void test00_runCheckedException() { - try { - AuthenticatorService withHandler = Service.create( - new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBean?wsdl"), - new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanService")) - .getPort(AuthenticatorService.class); - assertNotNull(withHandler); - - AuthenticatorService noHandler = Service.create( - new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBeanNoHandler?wsdl"), - new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanNoHandlerService")) - .getPort(AuthenticatorService.class); - assertNotNull(noHandler); - - try { - withHandler.authenticate("John", "Doe"); - } catch (WrongPasswordException e) { - System.out.println("My lovely checked exception..."); - } catch (Throwable e) { - e.printStackTrace(); - fail("A throwable instead of a checked exception..."); - } - - try { - noHandler.authenticate("John", "Doe"); - } catch (WrongPasswordException e) { - System.out.println("My lovely checked exception..."); - } catch (Throwable e) { - e.printStackTrace(); - fail("A throwable instead of a checked exception..."); - } - - } catch (MalformedURLException e) { - e.printStackTrace(); - fail("?!? invalid URL ???"); - } - - } - - public void test01_runRuntimeException() { - try { - AuthenticatorService withHandler = Service.create( - new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBean?wsdl"), - new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanService")) - .getPort(AuthenticatorService.class); - assertNotNull(withHandler); - - AuthenticatorService noHandler = Service.create( - new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBeanNoHandler?wsdl"), - new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanNoHandlerService")) - .getPort(AuthenticatorService.class); - assertNotNull(noHandler); - - try { - withHandler.authenticateRuntime("John", "Doe"); - } catch (WrongPasswordRuntimeException e) { - e.printStackTrace(); - fail("My checked exception instead of a throwableS..."); - } catch (Throwable e) { - System.out.println("A throwable exception..."); - } - - - try { - noHandler.authenticateRuntime("John", "Doe"); - } catch (WrongPasswordRuntimeException e) { - e.printStackTrace(); - fail("My checked exception instead of a throwableS..."); - } catch (Throwable e) { - System.out.println("A throwable exception..."); - } - - } catch (MalformedURLException e) { - e.printStackTrace(); - fail("?!? invalid URL ???"); - } - - } - -} +/** + * 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.openejb.server.cxf; + +import junit.framework.TestCase; +import org.apache.openejb.config.DeploymentFilterable; +import org.apache.openejb.server.cxf.fault.AuthenticatorService; +import org.apache.openejb.server.cxf.fault.WrongPasswordException; +import org.apache.openejb.server.cxf.fault.WrongPasswordRuntimeException; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.util.Properties; + +/** + * @version $Rev$ + */ +public class CxfJaxWsProviderTest extends TestCase { + + //START SNIPPET: setup + private InitialContext initialContext; + + //Random port to avoid test conflicts + private static final int port = Integer.parseInt(System.getProperty("httpejbd.port", "" + org.apache.openejb.util.NetworkUtil.getNextAvailablePort())); + + protected void setUp() throws Exception { + Properties properties = new Properties(); + properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf.*"); + properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); + properties.setProperty("openejb.embedded.remotable", "true"); + + //Just for this test we change the default port from 4204 to avoid conflicts + properties.setProperty("httpejbd.port", "" + port); + + initialContext = new InitialContext(properties); + } + //END SNIPPET: setup + + public void test00_runCheckedException() { + try { + AuthenticatorService withHandler = Service.create( + new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBean?wsdl"), + new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanService")) + .getPort(AuthenticatorService.class); + assertNotNull(withHandler); + + AuthenticatorService noHandler = Service.create( + new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBeanNoHandler?wsdl"), + new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanNoHandlerService")) + .getPort(AuthenticatorService.class); + assertNotNull(noHandler); + + try { + withHandler.authenticate("John", "Doe"); + } catch (WrongPasswordException e) { + System.out.println("My lovely checked exception..."); + } catch (Throwable e) { + e.printStackTrace(); + fail("A throwable instead of a checked exception..."); + } + + try { + noHandler.authenticate("John", "Doe"); + } catch (WrongPasswordException e) { + System.out.println("My lovely checked exception..."); + } catch (Throwable e) { + e.printStackTrace(); + fail("A throwable instead of a checked exception..."); + } + + } catch (MalformedURLException e) { + e.printStackTrace(); + fail("?!? invalid URL ???"); + } + + } + + public void test01_runRuntimeException() { + try { + AuthenticatorService withHandler = Service.create( + new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBean?wsdl"), + new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanService")) + .getPort(AuthenticatorService.class); + assertNotNull(withHandler); + + AuthenticatorService noHandler = Service.create( + new URL("http://localhost:" + port + "/openejb-cxf/AuthenticatorServiceBeanNoHandler?wsdl"), + new QName("http://superbiz.org/wsdl", "AuthenticatorServiceBeanNoHandlerService")) + .getPort(AuthenticatorService.class); + assertNotNull(noHandler); + + try { + withHandler.authenticateRuntime("John", "Doe"); + } catch (WrongPasswordRuntimeException e) { + e.printStackTrace(); + fail("My checked exception instead of a throwableS..."); + } catch (Throwable e) { + System.out.println("A throwable exception..."); + } + + + try { + noHandler.authenticateRuntime("John", "Doe"); + } catch (WrongPasswordRuntimeException e) { + e.printStackTrace(); + fail("My checked exception instead of a throwableS..."); + } catch (Throwable e) { + System.out.println("A throwable exception..."); + } + + } catch (MalformedURLException e) { + e.printStackTrace(); + fail("?!? invalid URL ???"); + } + + } + +} http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorService.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorService.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorService.java index 6a29e16..1358cdd 100644 --- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorService.java +++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorService.java @@ -1,31 +1,31 @@ -/** - * 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.openejb.server.cxf.fault; - -import javax.jws.WebService; - -/** - * @version $Rev$ - */ -@WebService(targetNamespace = "http://superbiz.org/wsdl") -public interface AuthenticatorService { - - boolean authenticate(String name, String password) throws WrongPasswordException; - - boolean authenticateRuntime(String name, String password); - +/** + * 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.openejb.server.cxf.fault; + +import javax.jws.WebService; + +/** + * @version $Rev$ + */ +@WebService(targetNamespace = "http://superbiz.org/wsdl") +public interface AuthenticatorService { + + boolean authenticate(String name, String password) throws WrongPasswordException; + + boolean authenticateRuntime(String name, String password); + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java index d13fe81..434a10a 100644 --- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java +++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBean.java @@ -1,43 +1,43 @@ -/** - * 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.openejb.server.cxf.fault; - -import javax.ejb.Stateless; -import javax.jws.HandlerChain; -import javax.jws.WebService; - -/** - * @version $Rev$ - */ -@Stateless -@WebService(targetNamespace = "http://superbiz.org/wsdl") -@HandlerChain(file = "handler.xml") -public class AuthenticatorServiceBean implements AuthenticatorService { - - public boolean authenticate(String name, String password) throws WrongPasswordException { - System.out.println(String.format("AuthenticatorServiceBean.authenticate(%s, %s)", - name, password)); - throw new WrongPasswordException("Checked exception"); - } - - public boolean authenticateRuntime(String name, String password) { - System.out.println(String.format("AuthenticatorServiceBean.authenticateRuntime(%s, %s)", - name, password)); - throw new WrongPasswordRuntimeException("Runtime exception"); - } - +/** + * 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.openejb.server.cxf.fault; + +import javax.ejb.Stateless; +import javax.jws.HandlerChain; +import javax.jws.WebService; + +/** + * @version $Rev$ + */ +@Stateless +@WebService(targetNamespace = "http://superbiz.org/wsdl") +@HandlerChain(file = "handler.xml") +public class AuthenticatorServiceBean implements AuthenticatorService { + + public boolean authenticate(String name, String password) throws WrongPasswordException { + System.out.println(String.format("AuthenticatorServiceBean.authenticate(%s, %s)", + name, password)); + throw new WrongPasswordException("Checked exception"); + } + + public boolean authenticateRuntime(String name, String password) { + System.out.println(String.format("AuthenticatorServiceBean.authenticateRuntime(%s, %s)", + name, password)); + throw new WrongPasswordRuntimeException("Runtime exception"); + } + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java index 5d8b7d0..2167273 100644 --- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java +++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/AuthenticatorServiceBeanNoHandler.java @@ -1,42 +1,42 @@ -/** - * 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.openejb.server.cxf.fault; - -import javax.ejb.Stateless; -import javax.jws.WebService; - -/** - * @version $Rev$ - */ -@Stateless -@WebService(targetNamespace = "http://superbiz.org/wsdl") -// @HandlerChain(file="handler.xml") -public class AuthenticatorServiceBeanNoHandler implements AuthenticatorService { - - public boolean authenticate(String name, String password) throws WrongPasswordException { - System.out.println(String.format("AuthenticatorServiceBeanNoHandler.authenticate(%s, %s)", - name, password)); - throw new WrongPasswordException("Checked exception"); - } - - public boolean authenticateRuntime(String name, String password) { - System.out.println(String.format("AuthenticatorServiceBeanNoHandler.authenticateRuntime(%s, %s)", - name, password)); - throw new WrongPasswordRuntimeException("Runtime exception"); - } - +/** + * 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.openejb.server.cxf.fault; + +import javax.ejb.Stateless; +import javax.jws.WebService; + +/** + * @version $Rev$ + */ +@Stateless +@WebService(targetNamespace = "http://superbiz.org/wsdl") +// @HandlerChain(file="handler.xml") +public class AuthenticatorServiceBeanNoHandler implements AuthenticatorService { + + public boolean authenticate(String name, String password) throws WrongPasswordException { + System.out.println(String.format("AuthenticatorServiceBeanNoHandler.authenticate(%s, %s)", + name, password)); + throw new WrongPasswordException("Checked exception"); + } + + public boolean authenticateRuntime(String name, String password) { + System.out.println(String.format("AuthenticatorServiceBeanNoHandler.authenticateRuntime(%s, %s)", + name, password)); + throw new WrongPasswordRuntimeException("Runtime exception"); + } + } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java index fda6b12..b7ff929 100644 --- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java +++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/DummyInterceptor.java @@ -1,49 +1,49 @@ -/** - * 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.openejb.server.cxf.fault; - -import java.util.Collections; -import java.util.Set; - -import javax.xml.namespace.QName; -import javax.xml.ws.handler.MessageContext; -import javax.xml.ws.handler.soap.SOAPHandler; -import javax.xml.ws.handler.soap.SOAPMessageContext; - -/** - * @version $Rev$ - */ -public class DummyInterceptor implements SOAPHandler<SOAPMessageContext> { - public DummyInterceptor() { - super(); - } - - public Set<QName> getHeaders() { - return Collections.emptySet(); - } - - public void close(MessageContext mc) { - } - - public boolean handleFault(SOAPMessageContext mc) { - return true; - } - - public boolean handleMessage(SOAPMessageContext mc) { - return true; - } +/** + * 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.openejb.server.cxf.fault; + +import java.util.Collections; +import java.util.Set; + +import javax.xml.namespace.QName; +import javax.xml.ws.handler.MessageContext; +import javax.xml.ws.handler.soap.SOAPHandler; +import javax.xml.ws.handler.soap.SOAPMessageContext; + +/** + * @version $Rev$ + */ +public class DummyInterceptor implements SOAPHandler<SOAPMessageContext> { + public DummyInterceptor() { + super(); + } + + public Set<QName> getHeaders() { + return Collections.emptySet(); + } + + public void close(MessageContext mc) { + } + + public boolean handleFault(SOAPMessageContext mc) { + return true; + } + + public boolean handleMessage(SOAPMessageContext mc) { + return true; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java index 57129db..f0d90c8 100644 --- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java +++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordException.java @@ -1,42 +1,42 @@ -/** - * 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.openejb.server.cxf.fault; - -import javax.xml.ws.WebFault; - -/** - * @version $Rev$ - */ -@WebFault -public class WrongPasswordException extends Exception { - - public WrongPasswordException() { - super(); - } - - public WrongPasswordException(String message, Throwable cause) { - super(message, cause); - } - - public WrongPasswordException(String message) { - super(message); - } - - public WrongPasswordException(Throwable cause) { - super(cause); - } +/** + * 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.openejb.server.cxf.fault; + +import javax.xml.ws.WebFault; + +/** + * @version $Rev$ + */ +@WebFault +public class WrongPasswordException extends Exception { + + public WrongPasswordException() { + super(); + } + + public WrongPasswordException(String message, Throwable cause) { + super(message, cause); + } + + public WrongPasswordException(String message) { + super(message); + } + + public WrongPasswordException(Throwable cause) { + super(cause); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java index 3af1a1a..81c5c51 100644 --- a/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java +++ b/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/fault/WrongPasswordRuntimeException.java @@ -1,43 +1,43 @@ -/** - * 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.openejb.server.cxf.fault; - -import javax.ejb.ApplicationException; - -/** - * @version $Rev$ - */ -@ApplicationException -// @WebFault // Not possible: a web fault must by a checked exception -public class WrongPasswordRuntimeException extends RuntimeException { - - public WrongPasswordRuntimeException() { - super(); - } - - public WrongPasswordRuntimeException(String message, Throwable cause) { - super(message, cause); - } - - public WrongPasswordRuntimeException(String message) { - super(message); - } - - public WrongPasswordRuntimeException(Throwable cause) { - super(cause); - } +/** + * 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.openejb.server.cxf.fault; + +import javax.ejb.ApplicationException; + +/** + * @version $Rev$ + */ +@ApplicationException +// @WebFault // Not possible: a web fault must by a checked exception +public class WrongPasswordRuntimeException extends RuntimeException { + + public WrongPasswordRuntimeException() { + super(); + } + + public WrongPasswordRuntimeException(String message, Throwable cause) { + super(message, cause); + } + + public WrongPasswordRuntimeException(String message) { + super(message); + } + + public WrongPasswordRuntimeException(Throwable cause) { + super(cause); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/resources/META-INF/ejb-jar.xml ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/resources/META-INF/ejb-jar.xml b/server/openejb-cxf/src/test/resources/META-INF/ejb-jar.xml index 00a4cbe..676b4ba 100644 --- a/server/openejb-cxf/src/test/resources/META-INF/ejb-jar.xml +++ b/server/openejb-cxf/src/test/resources/META-INF/ejb-jar.xml @@ -1,19 +1,19 @@ -<!-- - 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. ---> +<!-- + 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/> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-cxf/src/test/resources/org/apache/openejb/server/cxf/fault/handler.xml ---------------------------------------------------------------------- diff --git a/server/openejb-cxf/src/test/resources/org/apache/openejb/server/cxf/fault/handler.xml b/server/openejb-cxf/src/test/resources/org/apache/openejb/server/cxf/fault/handler.xml index 337711f..8a3c7c4 100644 --- a/server/openejb-cxf/src/test/resources/org/apache/openejb/server/cxf/fault/handler.xml +++ b/server/openejb-cxf/src/test/resources/org/apache/openejb/server/cxf/fault/handler.xml @@ -1,27 +1,27 @@ -<?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. ---> -<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"> - <handler-chain> - <handler> - <handler-name>org.apache.openejb.server.cxf.fault.DummyInterceptor</handler-name> - <handler-class>org.apache.openejb.server.cxf.fault.DummyInterceptor</handler-class> - </handler> - </handler-chain> +<?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. +--> +<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"> + <handler-chain> + <handler> + <handler-name>org.apache.openejb.server.cxf.fault.DummyInterceptor</handler-name> + <handler-class>org.apache.openejb.server.cxf.fault.DummyInterceptor</handler-class> + </handler> + </handler-chain> </handler-chains> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-daemon/src/main/java/org/apache/openejb/daemon/NTService.java ---------------------------------------------------------------------- diff --git a/server/openejb-daemon/src/main/java/org/apache/openejb/daemon/NTService.java b/server/openejb-daemon/src/main/java/org/apache/openejb/daemon/NTService.java index 9f5ba73..5be681a 100644 --- a/server/openejb-daemon/src/main/java/org/apache/openejb/daemon/NTService.java +++ b/server/openejb-daemon/src/main/java/org/apache/openejb/daemon/NTService.java @@ -1,114 +1,114 @@ -/* - * 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.openejb.daemon; - -import org.apache.openejb.cli.Bootstrap; -import org.apache.openejb.loader.SystemInstance; -import org.apache.openejb.server.Server; -import org.apache.openejb.server.ServerRuntimeException; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.concurrent.atomic.AtomicBoolean; - -public class NTService { - - private static final NTService instance = new NTService(); - private final AtomicBoolean running = new AtomicBoolean(false); - - /** - * Called by Apache Daemon - * - * @param args Start arguments - */ - public static void start(final String[] args) { - try { - instance.startImpl(args); - } catch (Throwable e) { - e.printStackTrace(System.err); - } - } - - /** - * Called by Apache Daemon - * - * @param args Stop arguments - Not used - */ - public static void stop(final String[] args) { - try { - instance.stopImpl(); - } catch (Throwable e) { - e.printStackTrace(System.err); - } - } - - private NTService() { - } - - private void startImpl(String[] args) { - if (!running.getAndSet(true)) { - - if (null == args) { - args = new String[0]; - } - - if (null == System.getProperty("openejb.home")) { - System.setProperty("openejb.home", System.getProperty("user.dir")); - } - - final ArrayList<String> list = new ArrayList<String>(); - list.addAll(Arrays.asList(args)); - - if (!list.contains("start")) { - list.add("start"); - } - - try { - System.out.println("Starting NTService: " + list); - Bootstrap.main(list.toArray(new String[list.size()])); - - //The process has finished - running.set(false); - - } catch (Exception e) { - running.set(false); - throw new RuntimeException("Failed to Bootstrap OpenEJB", e); - } - - } - } - - private void stopImpl() { - if (running.getAndSet(false)) { - - final Server server = SystemInstance.get().getComponent(Server.class); - - if (null != server) { - try { - System.out.println("Stopping NTService"); - server.stop(); - } catch (Exception e) { - - //Failed to stop - running.set(true); - e.printStackTrace(System.err); - } - } - } - } - -} +/* + * 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.openejb.daemon; + +import org.apache.openejb.cli.Bootstrap; +import org.apache.openejb.loader.SystemInstance; +import org.apache.openejb.server.Server; +import org.apache.openejb.server.ServerRuntimeException; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.concurrent.atomic.AtomicBoolean; + +public class NTService { + + private static final NTService instance = new NTService(); + private final AtomicBoolean running = new AtomicBoolean(false); + + /** + * Called by Apache Daemon + * + * @param args Start arguments + */ + public static void start(final String[] args) { + try { + instance.startImpl(args); + } catch (Throwable e) { + e.printStackTrace(System.err); + } + } + + /** + * Called by Apache Daemon + * + * @param args Stop arguments - Not used + */ + public static void stop(final String[] args) { + try { + instance.stopImpl(); + } catch (Throwable e) { + e.printStackTrace(System.err); + } + } + + private NTService() { + } + + private void startImpl(String[] args) { + if (!running.getAndSet(true)) { + + if (null == args) { + args = new String[0]; + } + + if (null == System.getProperty("openejb.home")) { + System.setProperty("openejb.home", System.getProperty("user.dir")); + } + + final ArrayList<String> list = new ArrayList<String>(); + list.addAll(Arrays.asList(args)); + + if (!list.contains("start")) { + list.add("start"); + } + + try { + System.out.println("Starting NTService: " + list); + Bootstrap.main(list.toArray(new String[list.size()])); + + //The process has finished + running.set(false); + + } catch (Exception e) { + running.set(false); + throw new RuntimeException("Failed to Bootstrap OpenEJB", e); + } + + } + } + + private void stopImpl() { + if (running.getAndSet(false)) { + + final Server server = SystemInstance.get().getComponent(Server.class); + + if (null != server) { + try { + System.out.println("Stopping NTService"); + server.stop(); + } catch (Exception e) { + + //Failed to stop + running.set(true); + e.printStackTrace(System.err); + } + } + } + } + +} http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java ---------------------------------------------------------------------- diff --git a/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java b/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java index da49618..0af3626 100644 --- a/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java +++ b/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/EjbServer.java @@ -1,144 +1,144 @@ -/** - * 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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.openejb.server.ejbd; - -import org.apache.openejb.ProxyInfo; -import org.apache.openejb.core.ServerFederation; -import org.apache.openejb.server.ServiceException; - -import javax.ejb.EJBHome; -import javax.ejb.EJBMetaData; -import javax.ejb.EJBObject; -import javax.ejb.Handle; -import javax.ejb.HomeHandle; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; -import java.util.Properties; -import java.util.logging.Level; -import java.util.logging.Logger; - -public class EjbServer implements org.apache.openejb.server.ServerService, org.apache.openejb.spi.ApplicationServer { - - protected KeepAliveServer keepAlive; - protected EjbDaemon server; - - public EjbServer() { - - } - - @Override - public void init(final Properties props) throws Exception { - server = new EjbDaemon(); - if (props.getProperty("name") == null) { // to let server be component aware - props.setProperty("name", getName()); - } - server.init(props); - keepAlive = new KeepAliveServer(this, server.isGzip()); - } - - @Override - public void start() throws ServiceException { - if (null != keepAlive) { - keepAlive.start(); - } else { - logNotInitialized(); - } - } - - private void logNotInitialized() { - Logger.getLogger(EjbServer.class.getName()).log(Level.WARNING, "EjbServer was not initialized"); - } - - @Override - public void stop() throws ServiceException { - if (null != keepAlive) { - keepAlive.stop(); - } else { - logNotInitialized(); - } - } - - @Override - public String getName() { - return "ejbd"; - } - - @Override - public int getPort() { - return 0; - } - - @Override - public void service(final Socket socket) throws ServiceException, IOException { - if (null != keepAlive) { - keepAlive.service(socket); - } else { - logNotInitialized(); - } - } - - @Override - public void service(final InputStream inputStream, final OutputStream outputStream) throws ServiceException, IOException { - - ServerFederation.setApplicationServer(server); - final ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); - - try { - Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); - server.service(inputStream, outputStream); - } finally { - Thread.currentThread().setContextClassLoader(oldCl); - } - } - - @Override - public String getIP() { - return ""; - } - - @Override - public EJBMetaData getEJBMetaData(final ProxyInfo info) { - return server.getEJBMetaData(info); - } - - @Override - public Handle getHandle(final ProxyInfo info) { - return server.getHandle(info); - } - - @Override - public HomeHandle getHomeHandle(final ProxyInfo info) { - return server.getHomeHandle(info); - } - - @Override - public EJBObject getEJBObject(final ProxyInfo info) { - return server.getEJBObject(info); - } - - @Override - public Object getBusinessObject(final ProxyInfo info) { - return server.getBusinessObject(info); - } - - @Override - public EJBHome getEJBHome(final ProxyInfo info) { - return server.getEJBHome(info); - } -} +/** + * 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 + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * 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.openejb.server.ejbd; + +import org.apache.openejb.ProxyInfo; +import org.apache.openejb.core.ServerFederation; +import org.apache.openejb.server.ServiceException; + +import javax.ejb.EJBHome; +import javax.ejb.EJBMetaData; +import javax.ejb.EJBObject; +import javax.ejb.Handle; +import javax.ejb.HomeHandle; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.Socket; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class EjbServer implements org.apache.openejb.server.ServerService, org.apache.openejb.spi.ApplicationServer { + + protected KeepAliveServer keepAlive; + protected EjbDaemon server; + + public EjbServer() { + + } + + @Override + public void init(final Properties props) throws Exception { + server = new EjbDaemon(); + if (props.getProperty("name") == null) { // to let server be component aware + props.setProperty("name", getName()); + } + server.init(props); + keepAlive = new KeepAliveServer(this, server.isGzip()); + } + + @Override + public void start() throws ServiceException { + if (null != keepAlive) { + keepAlive.start(); + } else { + logNotInitialized(); + } + } + + private void logNotInitialized() { + Logger.getLogger(EjbServer.class.getName()).log(Level.WARNING, "EjbServer was not initialized"); + } + + @Override + public void stop() throws ServiceException { + if (null != keepAlive) { + keepAlive.stop(); + } else { + logNotInitialized(); + } + } + + @Override + public String getName() { + return "ejbd"; + } + + @Override + public int getPort() { + return 0; + } + + @Override + public void service(final Socket socket) throws ServiceException, IOException { + if (null != keepAlive) { + keepAlive.service(socket); + } else { + logNotInitialized(); + } + } + + @Override + public void service(final InputStream inputStream, final OutputStream outputStream) throws ServiceException, IOException { + + ServerFederation.setApplicationServer(server); + final ClassLoader oldCl = Thread.currentThread().getContextClassLoader(); + + try { + Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); + server.service(inputStream, outputStream); + } finally { + Thread.currentThread().setContextClassLoader(oldCl); + } + } + + @Override + public String getIP() { + return ""; + } + + @Override + public EJBMetaData getEJBMetaData(final ProxyInfo info) { + return server.getEJBMetaData(info); + } + + @Override + public Handle getHandle(final ProxyInfo info) { + return server.getHandle(info); + } + + @Override + public HomeHandle getHomeHandle(final ProxyInfo info) { + return server.getHomeHandle(info); + } + + @Override + public EJBObject getEJBObject(final ProxyInfo info) { + return server.getEJBObject(info); + } + + @Override + public Object getBusinessObject(final ProxyInfo info) { + return server.getBusinessObject(info); + } + + @Override + public EJBHome getEJBHome(final ProxyInfo info) { + return server.getEJBHome(info); + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/886f3488/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/RequestHandler.java ---------------------------------------------------------------------- diff --git a/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/RequestHandler.java b/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/RequestHandler.java index 93fcd3d..18f1c8d 100644 --- a/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/RequestHandler.java +++ b/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/RequestHandler.java @@ -1,45 +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.openejb.server.ejbd; - -import org.apache.openejb.client.ProtocolMetaData; -import org.apache.openejb.client.Response; -import org.apache.openejb.util.Logger; - -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -public abstract class RequestHandler { - - final EjbDaemon daemon; - - protected RequestHandler(final EjbDaemon daemon) { - this.daemon = daemon; - } - - public EjbDaemon getDaemon() { - return daemon; - } - - public abstract String getName(); - - public abstract Logger getLogger(); - - public abstract Response processRequest(final ObjectInputStream in, final ProtocolMetaData metaData) throws Exception; - - public abstract void processResponse(final Response response, final ObjectOutputStream out, final ProtocolMetaData metaData) throws Exception; -} +/** + * 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.openejb.server.ejbd; + +import org.apache.openejb.client.ProtocolMetaData; +import org.apache.openejb.client.Response; +import org.apache.openejb.util.Logger; + +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + +public abstract class RequestHandler { + + final EjbDaemon daemon; + + protected RequestHandler(final EjbDaemon daemon) { + this.daemon = daemon; + } + + public EjbDaemon getDaemon() { + return daemon; + } + + public abstract String getName(); + + public abstract Logger getLogger(); + + public abstract Response processRequest(final ObjectInputStream in, final ProtocolMetaData metaData) throws Exception; + + public abstract void processResponse(final Response response, final ObjectOutputStream out, final ProtocolMetaData metaData) throws Exception; +}
