Skip to content

Commit

Permalink
WFLY-5029 EJB, Naming and Transactions over HTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Feb 24, 2017
1 parent 374d1b1 commit 4da20e9
Show file tree
Hide file tree
Showing 46 changed files with 1,896 additions and 30 deletions.
10 changes: 10 additions & 0 deletions ejb3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ vi:ts=4:sw=4:expandtab
<artifactId>wildfly-transactions</artifactId>
</dependency>

<dependency>
<groupId>org.wildfly.wildfly-http-client</groupId>
<artifactId>wildfly-http-ejb-client</artifactId>
</dependency>

<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
Expand Down Expand Up @@ -199,6 +204,11 @@ projects that depend on this project.-->
<artifactId>wildfly-discovery-client</artifactId>
</dependency>

<dependency>
<groupId>org.wildfly.security.elytron-web</groupId>
<artifactId>undertow-server</artifactId>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2016, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 2110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.jboss.as.ejb3.remote.http;

import io.undertow.server.handlers.PathHandler;
import org.jboss.as.ejb3.remote.AssociationService;
import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.StartContext;
import org.jboss.msc.service.StartException;
import org.jboss.msc.service.StopContext;
import org.jboss.msc.value.InjectedValue;
import org.wildfly.httpclient.ejb.EjbHttpService;
import org.wildfly.transaction.client.LocalTransactionContext;

/**
* @author Stuart Douglas
*/
public class EJB3RemoteHTTPService implements Service<EJB3RemoteHTTPService> {

public static final ServiceName SERVICE_NAME = ServiceName.JBOSS.append("ejb", "remote", "http-invoker");
private final InjectedValue<PathHandler> pathHandlerInjectedValue = new InjectedValue<>();
private final InjectedValue<AssociationService> associationServiceInjectedValue = new InjectedValue<>();
private final InjectedValue<LocalTransactionContext> localTransactionContextInjectedValue = new InjectedValue<>();

@Override
public void start(StartContext context) throws StartException {
EjbHttpService service = new EjbHttpService(associationServiceInjectedValue.getValue().getAssociation(), null, localTransactionContextInjectedValue.getValue());
pathHandlerInjectedValue.getValue().addPrefixPath("/ejb", service.createHttpHandler());
}

@Override
public void stop(StopContext context) {
pathHandlerInjectedValue.getValue().removePrefixPath("/ejb");
}

@Override
public EJB3RemoteHTTPService getValue() throws IllegalStateException, IllegalArgumentException {
return this;
}

public InjectedValue<PathHandler> getPathHandlerInjectedValue() {
return pathHandlerInjectedValue;
}

public InjectedValue<AssociationService> getAssociationServiceInjectedValue() {
return associationServiceInjectedValue;
}

public InjectedValue<LocalTransactionContext> getLocalTransactionContextInjectedValue() {
return localTransactionContextInjectedValue;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package org.jboss.as.ejb3.subsystem;

import io.undertow.server.handlers.PathHandler;
import org.jboss.as.connector.util.ConnectorServices;
import org.jboss.as.controller.AbstractBoottimeAddStepHandler;
import org.jboss.as.controller.AttributeDefinition;
Expand Down Expand Up @@ -106,6 +107,7 @@
import org.jboss.as.ejb3.remote.LocalTransportProvider;
import org.jboss.as.ejb3.remote.RegistryCollector;
import org.jboss.as.ejb3.remote.RegistryCollectorService;
import org.jboss.as.ejb3.remote.http.EJB3RemoteHTTPService;
import org.jboss.as.ejb3.suspend.EJBSuspendHandlerService;
import org.jboss.as.security.service.SimpleSecurityManagerService;
import org.jboss.as.server.AbstractDeploymentChainStep;
Expand Down Expand Up @@ -149,6 +151,7 @@
import static org.jboss.as.ejb3.subsystem.EJB3SubsystemModel.DEFAULT_STATEFUL_BEAN_ACCESS_TIMEOUT;
import static org.jboss.as.ejb3.subsystem.EJB3SubsystemRootResourceDefinition.DEFAULT_CLUSTERED_SFSB_CACHE;
import static org.jboss.as.ejb3.subsystem.EJB3SubsystemRootResourceDefinition.CLUSTERED_SINGLETON_CAPABILITY;
import static org.jboss.as.ejb3.subsystem.EJB3SubsystemRootResourceDefinition.EJB_CAPABILITY;
import static org.jboss.as.ejb3.subsystem.EJB3SubsystemRootResourceDefinition.EJB_CLIENT_CONFIGURATOR;

import java.net.URI;
Expand All @@ -162,6 +165,7 @@ class EJB3SubsystemAdd extends AbstractBoottimeAddStepHandler {

private final EJBDefaultSecurityDomainProcessor defaultSecurityDomainDeploymentProcessor;
private final MissingMethodPermissionsDenyAccessMergingProcessor missingMethodPermissionsDenyAccessMergingProcessor;
private static final String UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME = "org.wildfly.undertow.http-invoker";

private static final String REMOTING_ENDPOINT_CAPABILITY = "org.wildfly.remoting.endpoint";

Expand All @@ -176,6 +180,7 @@ protected void recordCapabilitiesAndRequirements(OperationContext context, Model
// TODO: delete these once optional requirements no longer require the existence of a capability
context.registerCapability(CLUSTERED_SINGLETON_CAPABILITY);
context.registerCapability(EJB_CLIENT_CONFIGURATOR);
context.registerCapability(EJB_CAPABILITY);
}

@Override
Expand Down Expand Up @@ -426,6 +431,18 @@ protected void execute(DeploymentProcessorTarget processorTarget) {
.install();

EnableStatisticsWriteHandler.INSTANCE.updateToRuntime(context, model);


if(context.hasOptionalCapability(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, EJB3SubsystemRootResourceDefinition.EJB_CAPABILITY.getName(), null)) {
EJB3RemoteHTTPService service = new EJB3RemoteHTTPService();


ServiceBuilder<EJB3RemoteHTTPService> builder = context.getServiceTarget().addService(EJB3RemoteHTTPService.SERVICE_NAME, service)
.addDependency(context.getCapabilityServiceName(UNDERTOW_HTTP_INVOKER_CAPABILITY_NAME, PathHandler.class), PathHandler.class, service.getPathHandlerInjectedValue())
.addDependency(TxnServices.JBOSS_TXN_LOCAL_TRANSACTION_CONTEXT, LocalTransactionContext.class, service.getLocalTransactionContextInjectedValue())
.addDependency(AssociationService.SERVICE_NAME, AssociationService.class, service.getAssociationServiceInjectedValue());
builder.install();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package org.jboss.as.ejb3.subsystem;

import static org.jboss.as.ejb3.subsystem.EJB3SubsystemRootResourceDefinition.CLUSTERED_SINGLETON_CAPABILITY;
import static org.jboss.as.ejb3.subsystem.EJB3SubsystemRootResourceDefinition.EJB_CAPABILITY;
import static org.jboss.as.ejb3.subsystem.EJB3SubsystemRootResourceDefinition.EJB_CLIENT_CONFIGURATOR;

import org.jboss.as.controller.AbstractRemoveStepHandler;
Expand All @@ -49,6 +50,7 @@ protected void recordCapabilitiesAndRequirements(OperationContext context, Model
// TODO: delete these once optional requirements no longer require the existence of a capability
context.deregisterCapability(CLUSTERED_SINGLETON_CAPABILITY.getName());
context.deregisterCapability(EJB_CLIENT_CONFIGURATOR.getName());
context.deregisterCapability(EJB_CAPABILITY.getName());

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ public class EJB3SubsystemRootResourceDefinition extends SimpleResourceDefinitio
public static final RuntimeCapability<Void> CLUSTERED_SINGLETON_CAPABILITY = RuntimeCapability.Builder.of(
"org.wildfly.ejb3.clustered.singleton", Void.class).build();

public static final RuntimeCapability<Void> EJB_CAPABILITY = RuntimeCapability.Builder.of(
"org.wildfly.ejb3", Void.class).build();

//We don't want to actually expose the service, we just want to use optional deps
public static final RuntimeCapability<Void> EJB_CLIENT_CONFIGURATOR = RuntimeCapability.Builder.of("org.wildfly.ejb3.remote.client-configurator", Void.class)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ channel-creation-options.type=The type of the channel creation option
channel-creation-options.add=Adds an EJB remote channel creation option
channel-creation-options.remove=Removes an EJB remote channel creation option

remote-http=The EJB3 remote HTTP service
remote-http.add=Adds the remote HTTP service, this allows EJBs to be invoked directly over HTTP
remote-http.remove=Removes the remote HTTP service
remote-http.thread-pool-name=The thread pool to execute the EJB requests in. If this is not defined they will be executed in the web worker pool.


async=The EJB3 Asynchronous Invocation Service
async.add=Adds the EJB3 Asynchronous Invocation Service
Expand Down Expand Up @@ -340,6 +345,7 @@ application-security-domain.remove=Remove the application referenced security do
application-security-domain.security-domain=The Elytron security domain to be used by deployments that reference the mapped security domain
application-security-domain.referencing-deployments=The deployments currently referencing this mapping
application-security-domain.enable-jacc=Enable authorization using JACC
application-security-domain.http-authentication-factory=The HTTP authentication factory to use for HTTP based invocations
identity=Identity definition for security identity propagation
identity.add=Add the identity resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<in-vm-remote-interface-invocation pass-by-value="false"/>
<default-distinct-name value="myname"/>
<default-security-domain value="domain"/>
<application-security-domains>
<application-security-domain name="test" security-domain="test"/>
</application-security-domains>
<default-missing-method-permissions-deny-access value="false" />
<disable-default-ejb-permissions value="true"/>
<statistics enabled="${ejb.enable-statistics:true}" />
Expand Down
19 changes: 19 additions & 0 deletions feature-pack/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,25 @@
<artifactId>codemodel</artifactId>
</dependency>

<dependency>
<groupId>org.wildfly.wildfly-http-client</groupId>
<artifactId>wildfly-http-ejb-client</artifactId>
</dependency>

<dependency>
<groupId>org.wildfly.wildfly-http-client</groupId>
<artifactId>wildfly-http-client-common</artifactId>
</dependency>

<dependency>
<groupId>org.wildfly.wildfly-http-client</groupId>
<artifactId>wildfly-http-naming-client</artifactId>
</dependency>

<dependency>
<groupId>org.wildfly.wildfly-http-client</groupId>
<artifactId>wildfly-http-transaction-client</artifactId>
</dependency>

<dependency>
<groupId>com.sun.xml.fastinfoset</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
</resources>

<dependencies>
<module name="org.wildfly.http-client.ejb" />
<module name="javax.annotation.api"/>
<module name="javax.api"/>
<module name="javax.ejb.api"/>
Expand Down Expand Up @@ -73,6 +74,7 @@
<module name="org.jboss.as.remoting"/>
<module name="org.jboss.as.security"/>
<module name="org.wildfly.security.elytron-private"/>
<module name="org.wildfly.security.elytron-web.undertow-server"/>
<module name="org.jboss.as.server"/>
<module name="org.jboss.as.threads"/>
<module name="org.jboss.as.transactions"/>
Expand Down Expand Up @@ -108,6 +110,8 @@

<module name="org.omg.api"/>
<module name="javax.xml.rpc.api"/>
<!-- Needed for EJB over HTTP support-->
<module name="io.undertow.core" />

<!-- TODO WFLY-5966 validate the need for these and remove if not needed.
Prior to WFLY-5922 they were exported by javax.ejb.api. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,7 @@
<module name="org.jboss.remoting"/>
<module name="org.jboss.modules"/>
<module name="org.jboss.narayana.compensations"/>
<module name="io.undertow.core"/>
<module name="org.wildfly.http-client.transaction" />
</dependencies>
</module>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2016, Red Hat, Inc., and individual contributors
~ as indicated by the @author tags. See the copyright.txt file in the
~ distribution for a full listing of individual contributors.
~
~ This is free software; you can redistribute it and/or modify it
~ under the terms of the GNU Lesser General Public License as
~ published by the Free Software Foundation; either version 2.1 of
~ the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this software; if not, write to the Free
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 2110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<module xmlns="urn:jboss:module:1.5" name="org.wildfly.http-client.ejb">

<resources>
<artifact name="${org.wildfly.wildfly-http-client:wildfly-http-ejb-client}"/>
</resources>

<dependencies>
<module name="javax.ejb.api"/>
<module name="javax.transaction.api"/>
<module name="org.wildfly.http-client.common"/>
<module name="org.wildfly.http-client.naming"/>
<module name="org.wildfly.client.config"/>
<module name="org.jboss.ejb-client" />
<module name="javax.transaction.api"/>
<module name="io.undertow.core" />
<module name="org.jboss.logging"/>
<module name="org.jboss.marshalling" />
<module name="org.jboss.marshalling.river" />
<module name="org.wildfly.security.elytron"/>
<module name="org.wildfly.http-client.transaction" />
<module name="org.wildfly.transaction.client" />
<module name="org.jboss.xnio"/>
</dependencies>
</module>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2016, Red Hat, Inc., and individual contributors
~ as indicated by the @author tags. See the copyright.txt file in the
~ distribution for a full listing of individual contributors.
~
~ This is free software; you can redistribute it and/or modify it
~ under the terms of the GNU Lesser General Public License as
~ published by the Free Software Foundation; either version 2.1 of
~ the License, or (at your option) any later version.
~
~ This software is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this software; if not, write to the Free
~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 2110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<module xmlns="urn:jboss:module:1.5" name="org.wildfly.http-client.transaction">

<resources>
<artifact name="${org.wildfly.wildfly-http-client:wildfly-http-transaction-client}"/>
</resources>

<dependencies>
<module name="javax.transaction.api"/>
<module name="org.wildfly.transaction.client"/>
<module name="org.wildfly.http-client.common"/>
<module name="org.wildfly.client.config"/>
<module name="org.wildfly.common"/>
<module name="javax.transaction.api"/>
<module name="io.undertow.core" />
<module name="org.jboss.logging"/>
<module name="org.jboss.marshalling" />
<module name="org.jboss.marshalling.river" />
<module name="org.wildfly.security.elytron"/>
</dependencies>
</module>
4 changes: 4 additions & 0 deletions naming/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-server</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.wildfly-http-client</groupId>
<artifactId>wildfly-http-naming-client</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-annotations</artifactId>
Expand Down
Loading

0 comments on commit 4da20e9

Please sign in to comment.