Skip to content

Commit 94dd4a3

Browse files
authored
Merge pull request #938 from zfi/master
Release 0.95.338
2 parents bfd4c20 + c7a5545 commit 94dd4a3

File tree

42 files changed

+5703
-1628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+5703
-1628
lines changed

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
build.properties
22

33
#################
4-
## NetBeans
4+
## Blockly Files
55
#################
6+
# /src/main/**/logback.xml
67

8+
#################
9+
## NetBeans
10+
#################
711
nb-configuration.xml
812
nbactions.xml
913
target/
@@ -15,7 +19,7 @@ BlocklyProp.iml
1519
#################
1620

1721
.idea
18-
22+
*.iml
1923

2024
#################
2125
## Eclipse

pom.xml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,25 @@
238238
<artifactId>slf4j-api</artifactId>
239239
<version>1.7.21</version>
240240
</dependency>
241+
242+
<dependency>
243+
<groupId>ch.qos.logback</groupId>
244+
<artifactId>logback-classic</artifactId>
245+
<version>1.1.8</version>
246+
</dependency>
247+
<dependency>
248+
<groupId>ch.qos.logback</groupId>
249+
<artifactId>logback-core</artifactId>
250+
<version>1.1.8</version>
251+
</dependency>
252+
253+
<!--
241254
<dependency>
242255
<groupId>org.slf4j</groupId>
243256
<artifactId>slf4j-log4j12</artifactId>
244257
<version>1.7.21</version>
245258
</dependency>
259+
-->
246260
<!-- END Logging Dependencies -->
247261

248262
<!-- Dependencies for Guice -->
@@ -382,15 +396,15 @@
382396

383397
<!-- Raven / Sentry API -->
384398
<dependency>
385-
<groupId>net.kencochrane.raven</groupId>
399+
<groupId>com.getsentry.raven</groupId>
386400
<artifactId>raven</artifactId>
387-
<version>6.0.0</version>
401+
<version>7.8.1</version>
388402
</dependency>
389403

390404
<dependency>
391-
<groupId>net.kencochrane.raven</groupId>
392-
<artifactId>raven-log4j</artifactId>
393-
<version>6.0.0</version>
405+
<groupId>com.getsentry.raven</groupId>
406+
<artifactId>raven-logback</artifactId>
407+
<version>7.8.1</version>
394408
</dependency>
395409

396410
<!-- Lucene search engine -->
@@ -439,12 +453,19 @@
439453
<version>${metrics-version}</version>
440454
</dependency>
441455

456+
<dependency>
457+
<groupId>io.dropwizard.metrics</groupId>
458+
<artifactId>metrics-logback</artifactId>
459+
<version>3.1.2</version>
460+
</dependency>
461+
462+
<!--
442463
<dependency>
443464
<groupId>io.dropwizard.metrics</groupId>
444465
<artifactId>metrics-log4j</artifactId>
445466
<version>${metrics-version}</version>
446467
</dependency>
447-
468+
-->
448469
<dependency>
449470
<groupId>io.dropwizard.metrics</groupId>
450471
<artifactId>metrics-servlet</artifactId>
@@ -517,5 +538,4 @@
517538
</dependency>
518539
-->
519540
</dependencies>
520-
521541
</project>

src/main/config/default/log4j.xml

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/main/java/com/parallax/server/blocklyprop/config/DaoModule.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,26 @@
1515
import com.parallax.server.blocklyprop.db.dao.impl.SessionDaoImpl;
1616
import com.parallax.server.blocklyprop.db.dao.impl.UserDaoImpl;
1717

18+
1819
/**
1920
*
2021
* @author Michel
22+
*
23+
* AbstractModule:
24+
* A support class for Modules which reduces repetition and results in a more
25+
* readable configuration. Simply extend this class, implement configure(),
26+
* and call the inherited methods which mirror those found in Binder.
27+
* For example:
28+
*
29+
* public class MyModule extends AbstractModule {
30+
* protected void configure() {
31+
* bind(Service.class).to(ServiceImpl.class).in(Singleton.class);
32+
* bind(CreditCardPaymentService.class);
33+
* bind(PaymentService.class).to(CreditCardPaymentService.class);
34+
* bindConstant().annotatedWith(Names.named("port")).to(8080);
35+
* }
36+
* }
37+
*
2138
*/
2239
public class DaoModule extends AbstractModule {
2340

src/main/java/com/parallax/server/blocklyprop/config/PersistenceModule.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
import com.google.inject.Provides;
1111
import com.parallax.server.blocklyprop.db.utils.DataSourceSetup;
1212
import java.sql.SQLException;
13-
import java.util.logging.Level;
14-
import java.util.logging.Logger;
1513
import javax.sql.DataSource;
1614
import org.apache.commons.configuration.Configuration;
1715
import org.apache.commons.dbcp2.PoolingDataSource;
1816
import org.jooq.SQLDialect;
17+
import java.util.logging.Level;
18+
import java.util.logging.Logger;
19+
1920

2021
/**
2122
*
@@ -37,6 +38,7 @@ protected void configure() {
3738

3839
@Provides
3940
PoolingDataSource dataSource() throws ClassNotFoundException {
41+
4042
PoolingDataSource ds = DataSourceSetup.connect(configuration);
4143
try {
4244
ds.getConnection();

src/main/java/com/parallax/server/blocklyprop/config/SetupConfig.java

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
import org.apache.commons.configuration.Configuration;
2222
import org.apache.commons.configuration.ConfigurationException;
2323
import org.apache.commons.configuration.DefaultConfigurationBuilder;
24+
import org.slf4j.Logger;
25+
import org.slf4j.LoggerFactory;
26+
import ch.qos.logback.classic.LoggerContext;
27+
2428

2529
/**
2630
*
@@ -29,6 +33,7 @@
2933
public class SetupConfig extends GuiceServletContextListener {
3034

3135
private Configuration configuration;
36+
private final Logger LOG = LoggerFactory.getLogger(SetupConfig.class);
3237

3338
@Override
3439
protected Injector getInjector() {
@@ -60,15 +65,21 @@ protected void configure() {
6065
);
6166
}
6267

68+
/*
69+
* The application configuration is stored in the blocklyprop.properties
70+
* file in user home directory. The config.xml contains the actual file
71+
* name of the configuation file. If the file is not found, the app will
72+
* use a set of default values.
73+
*/
6374
private void readConfiguration() {
6475
try {
65-
System.out.println("Looking for blocklyprop.properties in: " + System.getProperty("user.home"));
76+
LOG.info("Looking for blocklyprop.properties in: {}", System.getProperty("user.home"));
6677
DefaultConfigurationBuilder configurationBuilder = new DefaultConfigurationBuilder(getClass().getResource("/config.xml"));
6778
configuration = configurationBuilder.getConfiguration();
6879
} catch (ConfigurationException ce) {
69-
ce.printStackTrace();
80+
LOG.error("{}", ce.getMessage());
7081
} catch (Throwable t) {
71-
t.printStackTrace();
82+
LOG.error(t.getMessage());
7283
}
7384
}
7485

@@ -81,12 +92,20 @@ public void contextDestroyed(ServletContextEvent servletContextEvent) {
8192
Driver driver = drivers.nextElement();
8293
try {
8394
DriverManager.deregisterDriver(driver);
84-
// LOG.log(Level.INFO, String.format("deregistering jdbc driver: %s", driver));
95+
LOG.info("deregistering jdbc driver: {}",driver);
8596
} catch (SQLException sqlE) {
86-
// LOG.log(Level.SEVERE, String.format("Error deregistering driver %s", driver), e);
97+
LOG.error("Error deregistering driver %s", driver);
98+
LOG.error("{}", sqlE.getSQLState());
8799
}
88100

89101
}
102+
103+
// Shut down the loggers. Assume SLF4J is bound to logback-classic
104+
// in the current environment
105+
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
106+
if (loggerContext != null) {
107+
loggerContext.stop();
108+
}
90109
}
91110

92111
}

src/main/java/com/parallax/server/blocklyprop/converter/ProjectConverter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ public JsonObject toJson(ProjectRecord project) {
107107
}
108108
}
109109

110-
System.out.println("project to json" + result.get("name").getAsString());
111110
return result;
112111
}
113112

src/main/java/com/parallax/server/blocklyprop/db/dao/ProjectDao.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,19 @@ List<ProjectRecord> getSharedProjects(
7373
Integer offset,
7474
Long idUser);
7575

76+
List<ProjectRecord> getSharedProjectsByUser(
77+
TableSort sort,
78+
TableOrder order,
79+
Integer limit,
80+
Integer offset,
81+
Long idUser);
82+
7683
int countUserProjects(Long idUser);
7784

7885
int countSharedProjects(Long idUser);
7986

87+
int countSharedProjectsByUser(Long idUser);
88+
8089
ProjectRecord cloneProject(Long idProject);
8190

8291
boolean deleteProject(Long idProject);

0 commit comments

Comments
 (0)