Beispiel #1
0
  public AdminApiImpl(Kernel raptureKernel) {
    super(raptureKernel);
    // Update templates from the command line (Environment and Defines)
    for (Map.Entry<String, String> entry : System.getenv().entrySet()) {
      if (entry.getKey().startsWith(TEMPLATE)) {
        String templateName = entry.getKey().substring(TEMPLATE.length() + 1);
        templates.put(templateName, entry.getValue());
      }
    }

    Enumeration<Object> e = System.getProperties().keys();
    while (e.hasMoreElements()) {
      String name = e.nextElement().toString();
      if (name.startsWith(TEMPLATE)) {
        String templateName = name.substring(TEMPLATE.length() + 1);
        templates.put(templateName, System.getProperty(name));
      }
    }
  }
Beispiel #2
0
 @Override
 public void cancelPasswordResetToken(CallingContext context, String username) {
   checkParameter("User", username);
   RaptureUser user = getUser(context, username);
   if (user == null) {
     throw RaptureExceptionFactory.create(
         HttpURLConnection.HTTP_BAD_REQUEST,
         Messages.getString("Admin.NoExistUser")); // $NON-NLS-1$
   }
   // expire token now
   user.setTokenExpirationTime(System.currentTimeMillis());
   RaptureUserStorage.add(
       user, context.getUser(), "Cancel password reset token for user " + username); // $NON-NLS-1$
 }
Beispiel #3
0
 @Override
 public Map<String, String> getSystemProperties(CallingContext context, List<String> keys) {
   Map<String, String> ret = new TreeMap<String, String>();
   if (keys.isEmpty()) {
     ret.putAll(System.getenv());
     Properties p = System.getProperties();
     for (Map.Entry<Object, Object> prop : p.entrySet()) {
       ret.put(prop.getKey().toString(), prop.getValue().toString());
     }
   } else {
     for (String k : keys) {
       String val = System.getenv(k);
       if (val != null) {
         ret.put(k, System.getenv(k));
       } else {
         String prop = System.getProperty(k);
         if (prop != null) {
           ret.put(k, prop);
         }
       }
     }
   }
   return ret;
 }