Ejemplo n.º 1
0
  public static void main(String[] args) throws FileNotFoundException, IOException {
    RawData input = new RawData();
    DataStorage dataStorage = new DataStorage();
    UIoutput output = new UIoutput(); // Open in truncate mode

    output.displayThis("-->> SETUP started");
    output.displayThis("-->> OPENED RawData file");
    output.displayThis("-->> OPENED Backup file");
    output.displayThis("-->> OPENED Log file\n");

    while (input.input1Country()) // loop through the end of the file
    {
      dataStorage.insert(input.getCountryCode(), input.getRestOfData());
      // store to interior storage, which is an array
    }

    output.displayThis("-->> CLOSED Log file");
    output.displayThis("-->> CLOSED Backup file");
    output.displayThis("-->> CLOSED RawData file");
    output.displayThis(
        "-->> SETUP finished" + " - inserted " + input.getN() + " countries into DataStorage\n");

    output.finishUp();
    dataStorage.finishUp();
    input.finishUp();
    System.out.printf("done");
  }
  @Override
  protected void afterSecondBootWithOverride(PortalContainer container) throws Exception {
    //
    RequestLifeCycle.begin(container);

    DataStorage dataStorage = (DataStorage) container.getComponentInstanceOfType(DataStorage.class);
    PortalConfig portal = dataStorage.getPortalConfig("classic");
    Container layout = portal.getPortalLayout();
    assertEquals(1, layout.getChildren().size());
    Application<Portlet> layoutPortlet = (Application<Portlet>) layout.getChildren().get(0);
    assertEquals("site1/layout", dataStorage.getId(layoutPortlet.getState()));

    //
    Page home = dataStorage.getPage("portal::classic::home");
    assertNotNull(home);
    assertEquals("site 1", home.getTitle());

    Page page1 = dataStorage.getPage("portal::classic::page1");
    assertNotNull(page1);
    assertEquals("site 1", page1.getTitle());

    Page page2 = dataStorage.getPage("portal::classic::page2");
    assertNotNull(page2);
    assertEquals("site 2", page2.getTitle());

    Page dashboard1 = dataStorage.getPage("user::root::dashboard1");
    assertNotNull(dashboard1);
    assertEquals("site 2", dashboard1.getTitle());

    RequestLifeCycle.end();
  }
Ejemplo n.º 3
0
 public void scheduleDatabaseClean()
 {
     boolean flag = true;
     Object aobj[] = LOCK;
     aobj;
     JVM INSTR monitorenter ;
     Object obj;
     long l;
     l = mSystem.currentTimeMillis();
     obj = StringConversionHelpers.toLong(mDataStorage.getDeviceData("clean_database_store", "clean_database_time_ms_key"));
     if (obj != null) goto _L2; else goto _L1
Ejemplo n.º 4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    ref.setAndroidContext(this);
    ref = DataStorage.getRef();
    final Thread timerThread =
        new Thread() {
          public void run() {
            try {
              sleep(2000);
            } catch (InterruptedException e) {
              e.printStackTrace();
            } finally {
            }
          }
        };

    ref.addAuthStateListener(
        new Firebase.AuthStateListener() {
          public void onAuthStateChanged(AuthData authData) {
            if (authData != null) {

              DataStorage.setUID(authData.getUid());
              final Intent i = new Intent(getApplicationContext(), MainActivity.class);
              ref.child("users")
                  .child(DataStorage.getUID())
                  .addValueEventListener(
                      new ValueEventListener() {
                        @Override
                        public void onDataChange(DataSnapshot dataSnapshot) {
                          Map<String, Object> newUser =
                              (Map<String, Object>) dataSnapshot.getValue();
                          Log.d("E-Test", newUser.toString());
                          DataStorage.setEmail(newUser.get("email").toString());
                          DataStorage.setFullName(newUser.get("full_name").toString());
                        }

                        @Override
                        public void onCancelled(FirebaseError firebaseError) {}
                      });
              Timer t = new Timer();
              TimerTask tt =
                  new TimerTask() {
                    @Override
                    public void run() {
                      startActivity(i);
                    }
                  };
              t.schedule(tt, 2000);
            } else {
              final Intent i = new Intent(getApplicationContext(), Login.class);
              Timer t = new Timer();
              TimerTask tt =
                  new TimerTask() {
                    @Override
                    public void run() {
                      startActivity(i);
                    }
                  };
              t.schedule(tt, 2000);
            }
          }
        });

    timerThread.start();
  }