Skip to content

Commit

Permalink
Merge branch 'hotfix/UV_Core_v2.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
peterklimo committed Jun 16, 2015
2 parents 2c2603b + 8229c0b commit 25453df
Show file tree
Hide file tree
Showing 21 changed files with 88 additions and 53 deletions.
2 changes: 1 addition & 1 deletion backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>
<artifactId>backend</artifactId>
<packaging>jar</packaging>
Expand Down
72 changes: 39 additions & 33 deletions backend/src/main/java/cz/cuni/mff/xrg/odcs/backend/AppEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.h2.store.fs.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

Expand Down Expand Up @@ -207,42 +208,47 @@ private void run(String[] args) {
// initialise
initSpring();

// initialize locale settings from DB, so we need spring first
initLocale();

// the log back is not initialised here ..
// we add file appender
initLogbackAppender(context.getBean(AppConfig.class));

// the sql appender cooperate with spring, so we need spring first
initLogbackSqlAppender();

// Initialize DPUs by preloading all thier JAR bundles
// TODO use lazyloading instead of preload?
ModuleFacade modules = context.getBean(ModuleFacade.class);
modules.preLoadAllDPUs();

// try to get application-lock
// we construct lock key based on port
final StringBuilder lockKey = new StringBuilder();
lockKey.append("INTLIB_");
lockKey.append(context.getBean(AppConfig.class).getInteger(ConfigProperty.BACKEND_PORT));
if (!AppLock.setLock(lockKey.toString())) {
// another application is already running
LOG.info("Another instance of ODCleanStore is probably running.");
context.close();
return;
}
try {
// initialize locale settings from DB, so we need spring first
initLocale();

// the log back is not initialised here ..
// we add file appender
initLogbackAppender(context.getBean(AppConfig.class));

// the sql appender cooperate with spring, so we need spring first
initLogbackSqlAppender();

// Initialize DPUs by preloading all thier JAR bundles
// TODO use lazyloading instead of preload?
ModuleFacade modules = context.getBean(ModuleFacade.class);
modules.preLoadAllDPUs();

// try to get application-lock
// we construct lock key based on port
final StringBuilder lockKey = new StringBuilder();
lockKey.append("INTLIB_");
lockKey.append(context.getBean(AppConfig.class).getInteger(ConfigProperty.BACKEND_PORT));
if (!AppLock.setLock(lockKey.toString())) {
// another application is already running
LOG.info("Another instance of UnifiedViews is probably running.");
context.close();
return;
}

// print some information ..
LOG.info("Running ...");
// print some information ..
LOG.info("Running ...");

// infinite loop
while (true) {
try {
Thread.sleep(1000 * 60);
} catch (InterruptedException ex) {
// infinite loop
while (true) {
try {
Thread.sleep(1000 * 60);
} catch (InterruptedException ex) {
}
}
} catch (Exception e) {
context.close();
LOG.error("Failed to initialize UnifiedViews backend.", e);
}
}

Expand Down
6 changes: 5 additions & 1 deletion backend/src/main/resources/backend-context.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
<!-- Used for asynch calls even for scheduled functions. -->
<task:executor id="taskExecutor" pool-size="8"/>
<!-- Used for Scheduled tasks.-->
<task:scheduler id="taskScheduler" pool-size="8"/>
<bean id="taskScheduler" class="org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler">
<property name="poolSize" value="8" />
<property name="waitForTasksToCompleteOnShutdown" value="false" />
<property name="daemon" value="true" />
</bean>

<!-- Define aspects for managing DB reconnects. -->
<bean id="facadeAspect" class="cz.cuni.mff.xrg.odcs.backend.db.SQLDatabaseReconnectAspect"/>
Expand Down
2 changes: 1 addition & 1 deletion commons-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>
<artifactId>commons-app</artifactId>
<name>commons-app</name>
Expand Down
2 changes: 1 addition & 1 deletion dataunit-file-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>
<artifactId>dataunit-file-impl</artifactId>
<name>dataunit-file-impl</name>
Expand Down
2 changes: 1 addition & 1 deletion dataunit-file/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>
<artifactId>dataunit-file</artifactId>
<name>dataunit-file</name>
Expand Down
2 changes: 1 addition & 1 deletion dataunit-rdf-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>uv-core</artifactId>
<groupId>eu.unifiedviews</groupId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>
<artifactId>dataunit-rdf-impl</artifactId>
<name>dataunit-rdf-impl</name>
Expand Down
2 changes: 1 addition & 1 deletion dataunit-rdf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>
<artifactId>dataunit-rdf</artifactId>
<name>dataunit-rdf</name>
Expand Down
2 changes: 1 addition & 1 deletion dataunit-relational-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>uv-core</artifactId>
<groupId>eu.unifiedviews</groupId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>

<groupId>eu.unifiedviews</groupId>
Expand Down
2 changes: 1 addition & 1 deletion dataunit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>
<artifactId>dataunit</artifactId>
<description>Base project for new DataUnit's implementations.</description>
Expand Down
2 changes: 1 addition & 1 deletion frontend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>
<artifactId>frontend</artifactId>
<packaging>war</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,13 @@ public void setExecution(PipelineExecution execution, DPUInstanceRecord instance
}

private void setExecution(PipelineExecution execution, DPUInstanceRecord instance, boolean checkRedundancy) {
if (execution == null) {
return;
}

if (checkRedundancy) {
if (execution == null || (execution.equals(this.pipelineExec)
&& (instance == null || instance.equals(this.debugDpu)))) {
if (execution.equals(this.pipelineExec)
&& (instance == null || instance.equals(this.debugDpu))) {
//Already set
return;
}
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/main/webapp/WEB-INF/web_sso.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
<!-- To allow session-scoped beans -->
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<listener>
<listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class>
</listener>

<servlet>
<servlet-name>Vaadin Application Servlet</servlet-name>
Expand Down
2 changes: 1 addition & 1 deletion lib/lib-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>lib</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>
<artifactId>lib-core</artifactId>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>
<artifactId>lib</artifactId>
<packaging>pom</packaging>
Expand Down
2 changes: 1 addition & 1 deletion master/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>
<packaging>war</packaging>
<artifactId>master</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import cz.cuni.mff.xrg.odcs.commons.app.user.User;
import eu.unifiedviews.master.authentication.AuthenticationRequired;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -184,7 +185,12 @@ public PipelineExecutionDTO createPipelineExecution(@PathParam("pipelineid") Str
}

execution = pipelineFacade.createExecution(pipeline);
execution.setOwner(userFacade.getUser(1L));
// try to get user
User user = userFacade.getUserByExtId(newExecution.getUserExternalId());
if (user == null) {
throw new ApiException(Response.Status.NOT_FOUND, String.format("User '%s' could not be found! Execution could not be created.", newExecution.getUserExternalId()));
}
execution.setOwner(user);

execution.setDebugging(newExecution.isDebugging());
execution.setOrderNumber(1L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import cz.cuni.mff.xrg.odcs.commons.app.user.User;
import eu.unifiedviews.master.authentication.AuthenticationRequired;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -54,7 +55,12 @@ public PipelineDTO createPipeline(PipelineDTO pipelineDTO) {
if (pipeline == null) {
throw new ApiException(Response.Status.NOT_FOUND, String.format("Pipeline could not be created."));
}
pipeline.setUser(userFacade.getUser(1L));
// try to get user
User user = userFacade.getUserByExtId(pipelineDTO.getUserExternalId());
if (user == null) {
throw new ApiException(Response.Status.NOT_FOUND, String.format("User '%s' could not be found! Pipeline could not be created.", pipelineDTO.getUserExternalId()));
}
pipeline.setUser(user);
pipeline = PipelineDTOConverter.convertFromDTO(pipelineDTO, pipeline);
pipelineFacade.save(pipeline);
} catch (ApiException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import cz.cuni.mff.xrg.odcs.commons.app.user.User;
import eu.unifiedviews.master.authentication.AuthenticationRequired;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -246,7 +247,12 @@ public PipelineScheduleDTO createPipelineSchedule(@PathParam("pipelineid") Strin
if (schedule == null) {
throw new ApiException(Response.Status.INTERNAL_SERVER_ERROR, "ScheduleFacade returned null!");
}
schedule.setOwner(userFacade.getUser(1L));
// try to get user
User user = userFacade.getUserByExtId(scheduleToUpdate.getUserExternalId());
if (user == null) {
throw new ApiException(Response.Status.NOT_FOUND, String.format("User '%s' could not be found! Schedule could not be created.", scheduleToUpdate.getUserExternalId()));
}
schedule.setOwner(user);
schedule.setPipeline(pipeline);
List<Pipeline> afterPipelines = null;
if (scheduleToUpdate.getAfterPipelines() != null) {
Expand Down
2 changes: 1 addition & 1 deletion module-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>
<artifactId>module-test</artifactId>
<description>Contains classes for test support.</description>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>eu.unifiedviews</groupId>
<artifactId>uv-core</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
<packaging>pom</packaging>
<name>UnifiedViews-Core</name>
<description />
Expand Down

0 comments on commit 25453df

Please sign in to comment.