Skip to content

Commit

Permalink
geoserver#132: Replace CXF framework with spring-web -- WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
etj committed Jan 23, 2020
1 parent b2a9d95 commit 9495e00
Show file tree
Hide file tree
Showing 57 changed files with 1,360 additions and 1,858 deletions.
9 changes: 8 additions & 1 deletion src/core/model-external/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,14 @@
</replaceregexp>

<replaceregexp byline="true" replace="">
<regexp pattern="(@Id|@GeneratedValue|@Enumerated|@Column|@Type|@Temporal|@OneToOne|@ManyToOne|@ManyToMany|@ForeignKey|@UniqueConstraint|@AttributeOverride|@JoinTable).*"/>
<regexp pattern="(@Id|@GeneratedValue|@Enumerated|@Column|@Type|@Temporal|@OneToOne|@ManyToOne|@ManyToMany|@UniqueConstraint|@AttributeOverride|@JoinTable).*"/>
<fileset dir="${project.build.directory}/generated-sources/original">
<include name="**/*.java"/>
</fileset>
</replaceregexp>

<replaceregexp byline="true" replace="">
<regexp pattern=".*(@ForeignKey|@JoinColumn).*"/>
<fileset dir="${project.build.directory}/generated-sources/original">
<include name="**/*.java"/>
</fileset>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.ConstraintMode;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
Expand All @@ -34,7 +36,7 @@
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.ForeignKey;
//import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.Index;

/**
Expand Down Expand Up @@ -98,9 +100,11 @@ public class GSUser implements Identifiable, Serializable {

/** Groups to which the user is associated */
@ManyToMany(fetch= FetchType.LAZY)
@JoinTable( name = "gf_user_usergroups", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns=@JoinColumn(name = "group_id") )
@JoinTable( name = "gf_user_usergroups",
joinColumns = @JoinColumn(name = "user_id"),
inverseJoinColumns=@JoinColumn(name = "group_id"),
foreignKey = @ForeignKey(name="fk_uug_user") )
@Column(name = "u_id")
@ForeignKey(name="fk_uug_user", inverseName="fk_uug_group")
@Fetch(FetchMode.SUBSELECT) // without this, hibernate will duplicate results(!)
private Set<UserGroup> userGroups = new HashSet<UserGroup>();

Expand Down
122 changes: 14 additions & 108 deletions src/core/webtest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@
<artifactId>geofence-services-impl</artifactId>
</dependency>

<dependency>
<groupId>org.geoserver.geofence</groupId>
<artifactId>geofence-rest-api</artifactId>
</dependency>
<dependency>
<groupId>org.geoserver.geofence</groupId>
<artifactId>geofence-rest-impl</artifactId>
</dependency>

<!-- =============================================================== -->
<!-- =============================================================== -->

Expand Down Expand Up @@ -103,90 +112,37 @@


<!-- =============================================================== -->
<!-- HTTP UTILS -->
<!-- WS -->
<!-- =============================================================== -->
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
</dependency>

<!-- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>

<!-- <dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs</artifactId>
<version>1.0</version>
</dependency>-->
<dependency>
<!-- <dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
</dependency>
<!-- =============================================================== -->
<!-- CXF -->
<!-- =============================================================== -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-http</artifactId>
</dependency>-->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<!-- <version>2.2.7</version>-->
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-bindings-soap</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-databinding-aegis</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
</dependency>

<!-- =============================================================== -->
<!-- =============================================================== -->
<!-- CLIENT -->
<!-- =============================================================== -->
<!-- =============================================================== -->

<!-- SPRING -->
<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.6</version>
</dependency>
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
Expand All @@ -207,10 +163,6 @@
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
</dependency>-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
Expand All @@ -228,34 +180,6 @@
<artifactId>spring-webmvc</artifactId>
</dependency>

<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.web</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>-->

<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
</dependency>-->

<!-- SCOPE TEST -->
<!-- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
</exclusions>
</dependency>-->

<!-- =============================================================== -->
<!-- JUnit -->
<!-- =============================================================== -->
Expand Down Expand Up @@ -302,27 +226,9 @@
</configuration>
</plugin>

<!-- <groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.26</version>
<configuration>
<webAppSourceDirectory>${basedir}/war</webAppSourceDirectory>
<webAppConfig>
<contextPath>/geofence</contextPath>
</webAppConfig>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>9191</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<reload>manual</reload>
</configuration>
</plugin>
-->
</plugins>
</plugins>

<finalName>geofence-web-test</finalName>
<finalName>geofence-web-test</finalName>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,30 @@
import org.geoserver.geofence.services.dto.RuleFilter;
import org.geoserver.geofence.services.dto.RuleFilter.SpecialFilterType;
import org.geoserver.geofence.services.exception.NotFoundServiceEx;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
*
* @author ETj (etj at geo-solutions.it)
*/
@Service
public class MainTest implements InitializingBean, ApplicationContextAware {

private final static Logger LOGGER = LogManager.getLogger(MainTest.class);

@Autowired
private XmlWebApplicationContext applicationContext;

@Autowired
private UserAdminService userAdminService;
@Autowired
private UserGroupAdminService userGroupAdminService;
@Autowired
private InstanceAdminService instanceAdminService;
@Autowired
private RuleAdminService ruleAdminService;
@Autowired
private RuleReaderService ruleReaderService;

protected final static String MULTIPOLYGONWKT = "MULTIPOLYGON(((48 62, 48 63, 49 63, 49 62, 48 62)))";
Expand Down Expand Up @@ -292,31 +301,30 @@ protected void removeAllInstances() throws NotFoundServiceEx {

//==========================================================================

public void setInstanceAdminService(InstanceAdminService instanceAdminService) {
this.instanceAdminService = instanceAdminService;
}

public void setUserGroupAdminService(UserGroupAdminService userGroupAdminService) {
this.userGroupAdminService = userGroupAdminService;
}

public void setRuleAdminService(RuleAdminService ruleAdminService) {
this.ruleAdminService = ruleAdminService;
}

public void setUserAdminService(UserAdminService userAdminService) {
this.userAdminService = userAdminService;
}

public void setRuleReaderService(RuleReaderService ruleReaderService) {
this.ruleReaderService = ruleReaderService;
}


// public void setInstanceAdminService(InstanceAdminService instanceAdminService) {
// this.instanceAdminService = instanceAdminService;
// }
//
// public void setUserGroupAdminService(UserGroupAdminService userGroupAdminService) {
// this.userGroupAdminService = userGroupAdminService;
// }
//
// public void setRuleAdminService(RuleAdminService ruleAdminService) {
// this.ruleAdminService = ruleAdminService;
// }
//
// public void setUserAdminService(UserAdminService userAdminService) {
// this.userAdminService = userAdminService;
// }
//
// public void setRuleReaderService(RuleReaderService ruleReaderService) {
// this.ruleReaderService = ruleReaderService;
// }
//
//
@Override
public void setApplicationContext(ApplicationContext ac) throws BeansException {
this.applicationContext = (XmlWebApplicationContext)ac;

}

}

This file was deleted.

30 changes: 9 additions & 21 deletions src/core/webtest/src/main/resources/applicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,35 @@
*/
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"

xmlns:cxf="http://cxf.apache.org/core"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:mvc="http://www.springframework.org/schema/mvc"

xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"

default-autowire="byName">

<context:annotation-config />
<context:component-scan base-package="org.geoserver.geofence.servicetest"/>
<!--<mvc:annotation-driven />-->

<!-- ================================================================ -->
<!-- === CLIENT ===================================================== -->
<!-- ================================================================ -->

<bean name="testService" class="org.geoserver.geofence.servicetest.MainTest" >
<!-- <bean name="testService" class="org.geoserver.geofence.servicetest.MainTest" >
<property name="userAdminService" ref="userAdminService" />
<property name="userGroupAdminService" ref="userGroupAdminService" />
<property name="instanceAdminService" ref="instanceAdminService" />
<property name="ruleAdminService" ref="ruleAdminService" />
</bean>
</bean>-->

<bean id="remoteRuleReaderProxy" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean" lazy-init="true">
<property name="serviceUrl" value="http://localhost:9191/geofence/remoting/RuleReader"/>
<property name="serviceInterface" value="org.geoserver.geofence.services.RuleReaderService"/>
</bean>

<!-- === CXF ======================================================== -->

<!-- Load CXF modules from cxf.jar -->
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>

<!-- ====================================================================-->
<!-- === REST Services ==================================================-->
<!-- ====================================================================-->

</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
# * application directory.
# */
#
geofenceEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=create-drop
geofenceEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=create
geofenceVendorAdapter.generateDdl=true
geofenceVendorAdapter.showSql=false

0 comments on commit 9495e00

Please sign in to comment.