Skip to content

Commit

Permalink
DXA 1.6 RC
Browse files Browse the repository at this point in the history
  • Loading branch information
rpannekoek committed Oct 27, 2016
2 parents 57a267d + 7c9e5cb commit 8d321a6
Show file tree
Hide file tree
Showing 81 changed files with 1,784 additions and 332 deletions.
4 changes: 2 additions & 2 deletions dxa-bom-2013sp1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-bom-2013sp1</artifactId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0</version>
<packaging>pom</packaging>

<name>DXA - BOM for 2013SP1</name>
Expand Down Expand Up @@ -44,7 +44,7 @@
</developers>

<properties>
<dxa-bom.version>1.6.0-SNAPSHOT</dxa-bom.version>
<dxa-bom.version>1.6.0</dxa-bom.version>
<cd.version>7.1.0</cd.version>
<cwd.version>7.1.2</cwd.version>
<smarttarget.version>2014sp1</smarttarget.version>
Expand Down
4 changes: 2 additions & 2 deletions dxa-bom-modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.sdl.dxa.modules</groupId>
<artifactId>dxa-bom-modules</artifactId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0</version>
<packaging>pom</packaging>

<name>DXA Modules - Bill of Materials</name>
Expand Down Expand Up @@ -45,7 +45,7 @@
</developers>

<properties>
<dxa-modules.version>1.6.0-SNAPSHOT</dxa-modules.version>
<dxa-modules.version>1.6.0</dxa-modules.version>
<dxa-module-core.version>${dxa-modules.version}</dxa-module-core.version>
<dxa-module-cid.version>${dxa-modules.version}</dxa-module-cid.version>
<dxa-module-googleanalytics.version>${dxa-modules.version}</dxa-module-googleanalytics.version>
Expand Down
25 changes: 3 additions & 22 deletions dxa-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-bom</artifactId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0</version>
<packaging>pom</packaging>

<name>DXA - Bill of Materials</name>
Expand Down Expand Up @@ -48,17 +48,14 @@
<classifier.2013sp1>2013sp1</classifier.2013sp1>
<classifier.web8>web8</classifier.web8>

<dd4t.version>2.0.10-DXA</dd4t.version>
<cd-cil.version>8.2.0-1011</cd-cil.version>
<dd4t.version>2.0.13-DXA</dd4t.version>
<cd-cil.version>8.3.0-1013</cd-cil.version>

<!-- DXA versions -->
<dxa.version>${project.version}</dxa.version>

<!-- Caching -->
<cache-api.version>1.0.0</cache-api.version>
<ehcache.version>2.8.3</ehcache.version>
<!--2013SP1: <ehcache-version>2.8.2</ehcache-version>-->
<jcache.version>1.0.1</jcache.version>

<!-- Apache Commons -->
<commons-beanutils-version>1.8.3</commons-beanutils-version>
Expand Down Expand Up @@ -377,22 +374,6 @@
<version>${lombok.version}</version>
</dependency>

<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>${ehcache.version}</version>
</dependency>
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
<version>${cache-api.version}</version>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>jcache</artifactId>
<version>${jcache.version}</version>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
Expand Down
10 changes: 4 additions & 6 deletions dxa-builder/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'com.sdl.dxa'
version '1.6.0-SNAPSHOT'
version '1.6.0'

apply plugin: 'groovy'
apply plugin: 'maven-publish'
Expand All @@ -8,7 +8,7 @@ apply plugin: 'signing'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'

def isRelease = !version.endsWith("-SNAPSHOT")
def isRelease = !version.endsWith("-SNAPSHOT") && project.hasProperty('release')

task wrapper(type: Wrapper) {
gradleVersion = '2.9'
Expand Down Expand Up @@ -85,10 +85,8 @@ publishing {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
} else {
if (project.hasProperty('release')) {
name "sonatype-nexus-staging"
url "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}
name "sonatype-nexus-staging"
url "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}

if (project.hasProperty("publishUsername") && project.hasProperty("publishPassword")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MavenBuildTask extends DefaultTask {

CountDownLatch latch

def callback = { output ->
def callback = { Output output ->
if (output.code != 0) {
pool.shutdown()
outputPool.shutdown()
Expand All @@ -48,7 +48,8 @@ class MavenBuildTask extends DefaultTask {
println "Well, there is an error. Press <Enter> to finish."
System.in.read()
}
throw new RuntimeException("Error building ${output.command}")
println "Error building ${output.command}"
System.exit(output.code);
} else {
outputPool.submit {
println "= SUCCESS (in ${output.timeSeconds}s): ${output.command}"
Expand Down
7 changes: 6 additions & 1 deletion dxa-framework/dxa-common-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-framework</artifactId>
<version>1.6.0-SNAPSHOT</version>
<version>1.6.0</version>
</parent>

<artifactId>dxa-common-api</artifactId>
Expand Down Expand Up @@ -113,5 +113,10 @@
<artifactId>hamcrest-library</artifactId>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>

</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.ser.FilterProvider;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
import com.fasterxml.jackson.datatype.joda.JodaModule;
import com.sdl.webapp.common.api.contextengine.ContextEngine;
import com.sdl.webapp.common.api.serialization.json.DxaViewModelJsonChainFilter;
import com.sdl.webapp.common.util.ApplicationContextHolder;
import com.sdl.webapp.common.util.InitializationUtils;
import com.sdl.webapp.common.views.AtomView;
Expand All @@ -17,6 +20,8 @@
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.Ordered;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.ViewResolver;
Expand All @@ -27,6 +32,7 @@

import java.util.Locale;

import static com.sdl.webapp.common.api.serialization.json.DxaViewModelJsonChainFilter.FILTER_NAME;
import static com.sdl.webapp.common.util.InitializationUtils.loadDxaProperties;
import static com.sdl.webapp.common.util.InitializationUtils.traceBeanInitialization;

Expand Down Expand Up @@ -56,7 +62,10 @@ public class DxaSpringInitialization {
@Bean
public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
configurer.setProperties(InitializationUtils.loadDxaProperties());
MutablePropertySources propertySources = new MutablePropertySources();
propertySources.addLast(new PropertiesPropertySource("dxa.properties.merged", InitializationUtils.loadDxaProperties()));
configurer.setPropertySources(propertySources);
configurer.setNullValue("null");
traceBeanInitialization(configurer);
return configurer;
}
Expand All @@ -73,31 +82,38 @@ public ViewResolver fallbackViewResolver() {

@Bean
public ViewResolver dxaViewResolver() {
UrlBasedViewResolver viewResolver = new UrlBasedViewResolver() {
final UrlBasedViewResolver viewResolver = new UrlBasedViewResolver() {

@Override
public View resolveViewName(String viewName, Locale locale) throws Exception {
viewName = processDeviceFamily(viewName);

View overriddenView = super.resolveViewName(viewResolverOverride + "/" + viewName, locale);
if (null != overriddenView) {
log.debug("Found overridden view for {}, using it", viewName);
return overriddenView;
if (viewName.startsWith(FORWARD_URL_PREFIX) || viewName.startsWith(REDIRECT_URL_PREFIX)) {
return super.resolveViewName(viewName, locale);
}

return super.resolveViewName(viewName, locale);
View view = tryViewNames(locale, processDeviceFamily(viewName), viewResolverOverride + "/" + viewName);

return view != null ? view : super.resolveViewName(viewName, locale);
}

private View tryViewNames(Locale locale, String... viewNames) throws Exception {
for (String viewName : viewNames) {
View view = super.resolveViewName(viewName, locale);
if (null != view) {
log.debug("Found view name {}, using it", viewName);
return view;
}
}
return null;
}

private String processDeviceFamily(String viewName) {
ContextEngine contextEngine = ApplicationContextHolder.getContext().getBean(ContextEngine.class);
String deviceFamily = contextEngine.getDeviceFamily();
if (!"desktop".equals(deviceFamily)) {
viewName = viewName + "." + deviceFamily;
log.debug("ViewName is changed to {} and current device family is {}", viewName, deviceFamily);
}
return viewName;
log.debug("Current device family is {}", deviceFamily);
return "desktop".equals(deviceFamily) ? viewName : (viewName + "." + deviceFamily);
}
};

viewResolver.setViewClass(OptionalJstlView.class);
viewResolver.setOrder(1);
viewResolver.setPrefix(viewResolverPrefix);
Expand Down Expand Up @@ -140,11 +156,23 @@ public ObjectMapper objectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(SerializationFeature.INDENT_OUTPUT, true);
objectMapper.registerModule(new JodaModule());
objectMapper.setFilters(jsonFilterProvider());
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
traceBeanInitialization(objectMapper);
return objectMapper;
}

@Bean
public FilterProvider jsonFilterProvider() {
SimpleFilterProvider provider = new SimpleFilterProvider();
return provider.addFilter(FILTER_NAME, dxaViewModelJsonChainFilter());
}

@Bean
public DxaViewModelJsonChainFilter dxaViewModelJsonChainFilter() {
return new DxaViewModelJsonChainFilter();
}

private static class OptionalJstlView extends JstlView {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.sdl.webapp.common.util.InitializationUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.Ordered;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.filter.CharacterEncodingFilter;

Expand All @@ -21,7 +22,7 @@
* deployment descriptor.</p>
*/
@Slf4j
public class DxaWebInitialization implements WebApplicationInitializer {
public class DxaWebInitialization implements WebApplicationInitializer, Ordered {

private static void registerWebServiceServlet(ServletContext servletContext) {
ServletRegistration.Dynamic registration = registerServlet(servletContext,
Expand Down Expand Up @@ -59,4 +60,9 @@ public void onStartup(ServletContext servletContext) throws ServletException {
log.info("Default DXA web application initialization complete.");
}
}

@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.sdl.webapp.common.api.model;

import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.sdl.webapp.common.api.formatters.support.FeedItem;
import com.sdl.webapp.common.api.formatters.support.FeedItemsProvider;
import com.sdl.webapp.common.api.serialization.json.DxaViewModelJsonChainFilter;
import com.sdl.webapp.common.api.serialization.json.annotation.JsonXpmAware;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
Expand All @@ -23,6 +26,7 @@
@Data
@NoArgsConstructor
@Slf4j
@JsonFilter(DxaViewModelJsonChainFilter.FILTER_NAME)
public abstract class AbstractViewModel implements ViewModel {

@JsonProperty("ExtensionData")
Expand All @@ -32,6 +36,7 @@ public abstract class AbstractViewModel implements ViewModel {
@JsonIgnore
private String htmlClasses;

@JsonXpmAware
@JsonProperty("XpmMetadata")
private Map<String, Object> xpmMetadata = new HashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.sdl.webapp.common.api.model.AbstractViewModel;
import com.sdl.webapp.common.api.model.EntityModel;
import com.sdl.webapp.common.api.model.RichTextFragment;
import com.sdl.webapp.common.api.serialization.json.annotation.JsonXpmAware;
import com.sdl.webapp.common.exceptions.DxaException;
import com.sdl.webapp.common.markup.html.HtmlElement;
import com.sdl.webapp.common.util.ApplicationContextHolder;
Expand All @@ -35,6 +36,7 @@ public abstract class AbstractEntityModel extends AbstractViewModel implements E
private String id;

@JsonProperty("XpmPropertyMetadata")
@JsonXpmAware
private Map<String, String> xpmPropertyMetadata;

public AbstractEntityModel(AbstractEntityModel other) {
Expand Down
Loading

0 comments on commit 8d321a6

Please sign in to comment.