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
<route id="patronBorrowsAvailableTimer"> | |
<from uri="{{borrows.available.notification.timer}}"/> | |
<log message="start" loggingLevel="INFO"/> | |
<wireTap uri="{{cloud.watch.out}}" copy="false"> | |
<!-- this adds a cloud watch metric --> | |
<setHeader headerName="metricName"><constant>PatronBorrowsAvailableTimer</constant></setHeader> | |
<setHeader headerName="metricUnit"><constant>Count</constant></setHeader> | |
<setHeader headerName="metricValue"><constant>1</constant></setHeader> |
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
## Push Notifications (universal processor used for many types of push notification processing) ## | |
patron.device.list.processor=mock:patronDeviceListProcessor | |
# Fire at 10:15am on the 3rd Wednesday of every month | |
borrows.available.notification.timer=direct://borrows.available.notification.timer | |
borrows.available.trigger.out=mock:borrows.available | |
borrows.available.trigger.in=direct:borrows.available | |
borrows.available.processor=mock:borrowsAvailableProcessor |
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
public class PatronBorrowsAvailableTimerRouteTest extends AbstractRouteTest { | |
@Produce(uri = "{{borrows.available.notification.timer}}") | |
protected ProducerTemplate start; | |
@EndpointInject(uri = "{{cloud.watch.out}}") | |
protected MockEndpoint cloudWatchEndpoint; | |
@EndpointInject(uri = "{{borrows.available.trigger.out}}") |
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
@Component("pushNotificationListProcessor") | |
public class PushNotificationListProcessor { | |
private static final Logger log = LoggerFactory.getLogger(PushNotificationMessageProcessor.class); | |
private final PatronDeviceHelper patronDeviceHelper; | |
@Autowired | |
public PushNotificationListProcessor(final PatronDeviceHelper patronDeviceHelper) { | |
this.patronDeviceHelper = patronDeviceHelper; | |
} |
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
package com.alexandria.licenseproxy.stripes.ebook; | |
import com.alexandria.licenseproxy.helper.CircHelper; | |
import com.alexandria.licenseproxy.helper.EBookHelper; | |
import com.google.inject.Inject; | |
import net.sourceforge.stripes.action.*; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import javax.servlet.http.HttpServletResponse; |
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
<select id="getRemainingBorrowsForMonth" resultType="java.lang.Integer"> | |
select | |
( | |
select circsPerPatronMonth | |
from Account | |
where libraryId = (select libraryId from Patron where id=#{value}) | |
) | |
- | |
( | |
select count(*) |
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
package com.alex.integration.processor; | |
import com.alex.integration.bean.PatronDevice; | |
import com.alex.integration.bean.Platform; | |
import com.alex.integration.bean.PushNotificationMessage; | |
import com.amazonaws.AmazonClientException; | |
import com.amazonaws.AmazonServiceException; | |
import com.amazonaws.services.sns.AmazonSNS; | |
import com.amazonaws.services.sns.model.*; | |
import com.fasterxml.jackson.core.JsonProcessingException; |
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
@Mock | |
private PublishResult publishResult; | |
@Value("${GOOGLE_SERVER_API_KEY}") | |
private String googleServerApiKey; | |
@Value("${APPLE_CERT_FILE}") | |
private String appleCertificate; | |
@Value("${APPLE_PRIVATE_KEY_FILE}") |
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
private CreatePlatformApplicationResult createPlatformApplication(String applicationName, Platform platform, String principal, String credential) { | |
CreatePlatformApplicationRequest platformApplicationRequest = new CreatePlatformApplicationRequest(); | |
Map<String, String> attributes = new HashMap<String, String>(); | |
attributes.put("PlatformPrincipal", principal == null ? "" : principal); | |
attributes.put("PlatformCredential", credential); | |
platformApplicationRequest.setAttributes(attributes); | |
platformApplicationRequest.setName(applicationName); | |
platformApplicationRequest.setPlatform(platform.name()); | |
return snsClient.createPlatformApplication(platformApplicationRequest); | |
} |
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
// todo: figure out how to load this from PEM file | |
// (ANDROID) not applicable; this will be null; | |
// (iOS) the certificate in pem format with \n at the end of each line. | |
private String principal; | |
// todo: figure out how to load this from PEM file | |
// (ANDROID) the server api key from the google api console | |
// (iOS) the private key in pem format with \n at the end of each line. | |
private String credential; |
NewerOlder