Skip to content

Commit

Permalink
Merge pull request #938 from zfi/master
Browse files Browse the repository at this point in the history
Release 0.95.338
  • Loading branch information
zfi authored Mar 9, 2017
2 parents bfd4c20 + c7a5545 commit 94dd4a3
Show file tree
Hide file tree
Showing 42 changed files with 5,703 additions and 1,628 deletions.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
build.properties

#################
## NetBeans
## Blockly Files
#################
# /src/main/**/logback.xml

#################
## NetBeans
#################
nb-configuration.xml
nbactions.xml
target/
Expand All @@ -15,7 +19,7 @@ BlocklyProp.iml
#################

.idea

*.iml

#################
## Eclipse
Expand Down
34 changes: 27 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,25 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.8</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.1.8</version>
</dependency>

<!--
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
</dependency>
-->
<!-- END Logging Dependencies -->

<!-- Dependencies for Guice -->
Expand Down Expand Up @@ -382,15 +396,15 @@

<!-- Raven / Sentry API -->
<dependency>
<groupId>net.kencochrane.raven</groupId>
<groupId>com.getsentry.raven</groupId>
<artifactId>raven</artifactId>
<version>6.0.0</version>
<version>7.8.1</version>
</dependency>

<dependency>
<groupId>net.kencochrane.raven</groupId>
<artifactId>raven-log4j</artifactId>
<version>6.0.0</version>
<groupId>com.getsentry.raven</groupId>
<artifactId>raven-logback</artifactId>
<version>7.8.1</version>
</dependency>

<!-- Lucene search engine -->
Expand Down Expand Up @@ -439,12 +453,19 @@
<version>${metrics-version}</version>
</dependency>

<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-logback</artifactId>
<version>3.1.2</version>
</dependency>

<!--
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-log4j</artifactId>
<version>${metrics-version}</version>
</dependency>

-->
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-servlet</artifactId>
Expand Down Expand Up @@ -517,5 +538,4 @@
</dependency>
-->
</dependencies>

</project>
17 changes: 0 additions & 17 deletions src/main/config/default/log4j.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,26 @@
import com.parallax.server.blocklyprop.db.dao.impl.SessionDaoImpl;
import com.parallax.server.blocklyprop.db.dao.impl.UserDaoImpl;


/**
*
* @author Michel
*
* AbstractModule:
* A support class for Modules which reduces repetition and results in a more
* readable configuration. Simply extend this class, implement configure(),
* and call the inherited methods which mirror those found in Binder.
* For example:
*
* public class MyModule extends AbstractModule {
* protected void configure() {
* bind(Service.class).to(ServiceImpl.class).in(Singleton.class);
* bind(CreditCardPaymentService.class);
* bind(PaymentService.class).to(CreditCardPaymentService.class);
* bindConstant().annotatedWith(Names.named("port")).to(8080);
* }
* }
*
*/
public class DaoModule extends AbstractModule {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
import com.google.inject.Provides;
import com.parallax.server.blocklyprop.db.utils.DataSourceSetup;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.sql.DataSource;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.dbcp2.PoolingDataSource;
import org.jooq.SQLDialect;
import java.util.logging.Level;
import java.util.logging.Logger;


/**
*
Expand All @@ -37,6 +38,7 @@ protected void configure() {

@Provides
PoolingDataSource dataSource() throws ClassNotFoundException {

PoolingDataSource ds = DataSourceSetup.connect(configuration);
try {
ds.getConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.DefaultConfigurationBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.LoggerContext;


/**
*
Expand All @@ -29,6 +33,7 @@
public class SetupConfig extends GuiceServletContextListener {

private Configuration configuration;
private final Logger LOG = LoggerFactory.getLogger(SetupConfig.class);

@Override
protected Injector getInjector() {
Expand Down Expand Up @@ -60,15 +65,21 @@ protected void configure() {
);
}

/*
* The application configuration is stored in the blocklyprop.properties
* file in user home directory. The config.xml contains the actual file
* name of the configuation file. If the file is not found, the app will
* use a set of default values.
*/
private void readConfiguration() {
try {
System.out.println("Looking for blocklyprop.properties in: " + System.getProperty("user.home"));
LOG.info("Looking for blocklyprop.properties in: {}", System.getProperty("user.home"));
DefaultConfigurationBuilder configurationBuilder = new DefaultConfigurationBuilder(getClass().getResource("/config.xml"));
configuration = configurationBuilder.getConfiguration();
} catch (ConfigurationException ce) {
ce.printStackTrace();
LOG.error("{}", ce.getMessage());
} catch (Throwable t) {
t.printStackTrace();
LOG.error(t.getMessage());
}
}

Expand All @@ -81,12 +92,20 @@ public void contextDestroyed(ServletContextEvent servletContextEvent) {
Driver driver = drivers.nextElement();
try {
DriverManager.deregisterDriver(driver);
// LOG.log(Level.INFO, String.format("deregistering jdbc driver: %s", driver));
LOG.info("deregistering jdbc driver: {}",driver);
} catch (SQLException sqlE) {
// LOG.log(Level.SEVERE, String.format("Error deregistering driver %s", driver), e);
LOG.error("Error deregistering driver %s", driver);
LOG.error("{}", sqlE.getSQLState());
}

}

// Shut down the loggers. Assume SLF4J is bound to logback-classic
// in the current environment
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
if (loggerContext != null) {
loggerContext.stop();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ public JsonObject toJson(ProjectRecord project) {
}
}

System.out.println("project to json" + result.get("name").getAsString());
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,19 @@ List<ProjectRecord> getSharedProjects(
Integer offset,
Long idUser);

List<ProjectRecord> getSharedProjectsByUser(
TableSort sort,
TableOrder order,
Integer limit,
Integer offset,
Long idUser);

int countUserProjects(Long idUser);

int countSharedProjects(Long idUser);

int countSharedProjectsByUser(Long idUser);

ProjectRecord cloneProject(Long idProject);

boolean deleteProject(Long idProject);
Expand Down
Loading

0 comments on commit 94dd4a3

Please sign in to comment.