Android Open Source - spotthestation Notification M D B






From Project

Back to project page spotthestation.

License

The source code is released under:

Apache License

If you think the Android project spotthestation listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

///*
// * To change this template, choose Tools | Templates
// * and open the template in the editor.
// *///from  w w w.  ja va2  s  .  c  om
//package MDB;
//
//import Entities.NASARegistrationTable;
//import com.google.android.gcm.server.Sender;
//import java.io.IOException;
//import java.util.List;
//import java.util.logging.Level;
//import java.util.logging.Logger;
//import javax.ejb.ActivationConfigProperty;
//import javax.ejb.MessageDriven;
//import javax.jms.JMSException;
//import javax.jms.Message;
//import javax.jms.MessageListener;
//import javax.jms.TextMessage;
//import javax.persistence.EntityManager;
//import javax.persistence.PersistenceContext;
//import javax.persistence.Query;
//import com.google.android.gcm.server.*;
//
///**
// *
// * @author xxc9071
// */
//@MessageDriven(mappedName = "jms/NotifyQueue", activationConfig =
//{
//    @ActivationConfigProperty(propertyName = "acknowledgeMode",
//    propertyValue = "Auto-acknowledge"),
//    @ActivationConfigProperty(propertyName = "destinationType",
//    propertyValue = "javax.jms.Queue")
//})
//public class NotificationMDB implements MessageListener
//{
//
//    @PersistenceContext
//    private EntityManager em;
//
//    @Override
//    public void onMessage(Message message)
//    {
//        try
//        {
//            String issZone = ((TextMessage) message).getText();
//            String jpqlCommand = "SELECT n.regID FROM NASARegistrationTable n WHERE n.zone = '" + issZone + "'";
//            Query query = em.createQuery(jpqlCommand);
//            List<String> regIdList = null;
//            regIdList = query.getResultList();
//
//            System.out.println("regIdList: " + regIdList);
//
//            Sender sender = new Sender("AIzaSyBTPchqyEvcodcuK9YDXlRuDZ4GhwW8ONo");
//            for (String regID : regIdList)
//            {
//
//                com.google.android.gcm.server.Message notifyMessage = new com.google.android.gcm.server.Message.Builder().build();
//                Result result = sender.send(notifyMessage, regID, 5);
//
//
//                // if not null the mobile client has multiple registration IDs and must be
//                // set to one canoncial registration ID
//                if (result.getCanonicalRegistrationId() != null)
//                {
//                    NASARegistrationTable nrt = em.find(NASARegistrationTable.class, regID);
//                    em.remove(nrt);
//
//                    // Methods in MDB are already transactional
//                    nrt = new NASARegistrationTable(result.getCanonicalRegistrationId());
//                    nrt.setZone(Integer.parseInt(issZone));
//                    em.persist(nrt);
//
//                }
//            }
//
//        }
//        catch (IOException ex)
//        {
//            Logger.getLogger(NotificationMDB.class.getName()).log(Level.SEVERE, null, ex);
//        }
//        catch (JMSException ex)
//        {
//            Logger.getLogger(NotificationMDB.class.getName()).log(Level.SEVERE, null, ex);
//        }
//
//
//
//
//    }
//}





Java Source Code List

Entities.NASAImageCommentTable.java
Entities.NASAImageCommentTable_.java
Entities.NASAImageTable.java
Entities.NASAImageTable_.java
Entities.NASARegistrationTable.java
Entities.NASARegistrationTable_.java
.ISSPollingApp.java
.NotificationMDB.java
Servlets.ImageDownloadServlet.java
Servlets.ImageUploadServlet.java
Servlets.MarkerDownloadServlet.java
Servlets.RegistrationServlet.java
Threads.HttpPollingThread.java
Utilities.ZoneCalculator.java
Utilities.ZoneCalculator.java
WebServices.NotificationService.java
nasa.android.spotthestation.CameraActivity.java
nasa.android.spotthestation.CameraPlusActivity.java
nasa.android.spotthestation.GCMIntentService.java
nasa.android.spotthestation.HelpActivity.java
nasa.android.spotthestation.ImageViewActivity.java
nasa.android.spotthestation.MapActivity.java
nasa.android.spotthestation.MyCompassView.java
nasa.android.spotthestation.TwitterActivity.java
nasa.android.spotthestation.TwitterWebviewActivity.java
nasa.android.spotthestation.UploadToNasaServerActivity.java
org.netbeans.rest.application.config.ApplicationConfig.java