-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:caelum/brutal
- Loading branch information
Showing
17 changed files
with
267 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package br.com.caelum.brutal.infra.rss; | ||
|
||
import java.util.Locale; | ||
|
||
import org.joda.time.format.DateTimeFormatter; | ||
import org.joda.time.format.DateTimeFormatterBuilder; | ||
|
||
public enum RSSType { | ||
ONDE_TRABALHAR { | ||
@Override | ||
public DateTimeFormatter getDateFormat() { | ||
return new DateTimeFormatterBuilder() | ||
.appendDayOfWeekShortText().appendLiteral(", ") | ||
.appendDayOfMonth(2).appendLiteral(" ") | ||
.appendMonthOfYearShortText().appendLiteral(" ") | ||
.appendYear(4,4).appendLiteral(" ") | ||
.appendHourOfDay(2).appendLiteral(":") | ||
.appendMinuteOfHour(2).appendLiteral(":") | ||
.appendSecondOfMinute(2).appendLiteral(" ") | ||
.appendTimeZoneOffset("0", false, 2, 2) | ||
.toFormatter().withLocale(Locale.US); | ||
} | ||
}, | ||
INFO_Q { | ||
@Override | ||
public DateTimeFormatter getDateFormat() { | ||
return new DateTimeFormatterBuilder() | ||
.appendDayOfWeekShortText().appendLiteral(", ") | ||
.appendDayOfMonth(2).appendLiteral(" ") | ||
.appendMonthOfYearShortText().appendLiteral(" ") | ||
.appendYear(4,4).appendLiteral(" ") | ||
.appendHourOfDay(2).appendLiteral(":") | ||
.appendMinuteOfHour(2).appendLiteral(":") | ||
.appendSecondOfMinute(2).appendLiteral(" ") | ||
.appendTimeZoneId() | ||
.toFormatter().withLocale(Locale.US); | ||
} | ||
}; | ||
|
||
public abstract DateTimeFormatter getDateFormat(); | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/br/com/caelum/brutal/infra/rss/converter/InfoQRSSJob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package br.com.caelum.brutal.infra.rss.converter; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.apache.log4j.Logger; | ||
|
||
import br.com.caelum.brutal.infra.rss.RSSType; | ||
import br.com.caelum.brutal.infra.rss.read.FeedsMap; | ||
import br.com.caelum.vraptor.Controller; | ||
import br.com.caelum.vraptor.Path; | ||
import br.com.caelum.vraptor.Result; | ||
import br.com.caelum.vraptor.quartzjob.CronTask; | ||
|
||
@Controller | ||
public class InfoQRSSJob implements CronTask{ | ||
private static final String INFOQ_BASE_KEY = "infoq"; | ||
private static final Logger LOG = Logger.getLogger(InfoQRSSJob.class); | ||
@Inject private Result result; | ||
@Inject private FeedsMap feedsMap; | ||
|
||
|
||
@Override | ||
@Path("/jdnakfh3nfis39103f1") | ||
public void execute() { | ||
LOG.debug("executing " + getClass().getSimpleName()); | ||
feedsMap.putOrUpdate(INFOQ_BASE_KEY, RSSType.INFO_Q); | ||
LOG.debug(feedsMap.get(INFOQ_BASE_KEY)); | ||
result.nothing(); | ||
} | ||
|
||
@Override | ||
public String frequency() { | ||
return "0 0/15 * * * ?";//fire every hour | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 5 additions & 7 deletions
12
src/main/java/br/com/caelum/brutal/infra/rss/read/FeedConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.