Example #1
0
  /*
   * (non-Javadoc)
   *
   * @see
   * fr.univartois.ili.fsnet.commons.talk.ITalk#createAccount(java.lang.String
   * , java.lang.String, java.util.Map)
   */
  @Override
  public boolean createAccount(String userName, String password, Map<String, String> map) {
    {
      if (!connection.isConnected()) {
        try {
          connection.connect();
        } catch (XMPPException e3) {

          Logger.getAnonymousLogger().log(Level.SEVERE, "", e3);
        }
      }

      try {
        Map<String, String> finalMap = map;
        if (finalMap == null) {
          finalMap = new HashMap<String, String>();
        }
        accountManager.createAccount(userName, password, finalMap);

        connection.disconnect();
        // Thread.sleep(6000);
        connection.connect();
        connection.login(userName, password);

        return true;
      } catch (XMPPException e2) {
        Logger.getAnonymousLogger().log(Level.SEVERE, "", e2);
      }
      return false;
    }
  }
Example #2
0
  public void onClickCreat(View view) {

    CurrencyAd ad =
        new CurrencyAd(
            editTextName.getText().toString(),
            editTextCurrency.getText().toString(),
            editTextCountSits.getText().toString(),
            null,
            editTextPrice.getText().toString(),
            user.getEmail(),
            editTextAbout.getText().toString(),
            editTextCityEnd.getText().toString(),
            editTextCityStart.getText().toString(),
            editTextDateEnd.getText().toString(),
            editTextDateStart.getText().toString(),
            editTextTimeEnd.getText().toString(),
            editTextTimeStart.getText().toString());
    GsonBuilder builder1 = new GsonBuilder();
    Gson gson1 = builder1.create();
    String a = gson1.toJson(ad);
    try {
      sent = new CreatAdAsyncTask().execute(gson1.toJson(ad)).get(5, TimeUnit.SECONDS);
      startActivity(new Intent(this, MainActivity.class));
      Toast.makeText(this, "Ваша заявка создана!", Toast.LENGTH_LONG).show();

    } catch (InterruptedException e) {
      Logger.getAnonymousLogger().warning(e.getMessage());
    } catch (ExecutionException e) {
      Logger.getAnonymousLogger().warning(e.getMessage());
    } catch (TimeoutException e) {
      Toast.makeText(this, "Oooops!", Toast.LENGTH_SHORT).show();
    }
  }
Example #3
0
  /** Our listening loop. */
  @Override
  public void run() {
    Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
    while (true) {
      Logger.getAnonymousLogger().log(Level.INFO, "Updating real time data.");

      // Populate the real time MBTA data
      TFactory.removeAllTrips();
      TDataParser.populateFromRealTimeData(TDataParser.Line.BLUE);
      TDataParser.populateFromRealTimeData(TDataParser.Line.ORANGE);
      TDataParser.populateFromRealTimeData(TDataParser.Line.RED);
      // Notify our observers
      setChanged();
      notifyObservers();

      // Now wait for more data to become available
      try {
        Thread.sleep(nUpdateFrequency * 1000);
      } catch (InterruptedException ex) {
        Logger.getAnonymousLogger()
            .log(Level.WARNING, "Listener thread interupted: " + ex.getMessage());
        break;
      }

      Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
    }
  }
Example #4
0
  /** sends a group/type/value command to a KNX/IP router via the Calimero library. */
  private void sendKNX(String groupaddress, String type, String value) {

    if (netLinkIp != null) {
      try {
        if (type.equalsIgnoreCase("string")) {
          pc.write(new GroupAddress(groupaddress), value);
        } else if (type.equalsIgnoreCase("boolean")) {
          if (value.equalsIgnoreCase("1")) {
            pc.write(new GroupAddress(groupaddress), true);
          } else if (value.equalsIgnoreCase("0")) {
            pc.write(new GroupAddress(groupaddress), false);
          }
        } else if (type.equalsIgnoreCase("int")) {
          Integer i = new Integer(value);
          pc.write(new GroupAddress(groupaddress), i, ProcessCommunicator.UNSCALED);
        } else if (type.equalsIgnoreCase("float")) {
          Float f = new Float(value);
          pc.write(new GroupAddress(groupaddress), f);
        }

        Logger.getAnonymousLogger()
            .info("sent value: " + value + " type: " + type + " to " + groupaddress);

      } catch (Exception e) {
        Logger.getAnonymousLogger().severe(e.toString());
      }
    } else {
      Logger.getAnonymousLogger().severe("KNX connection not open");
    }
  }
Example #5
0
  public static synchronized void init() {
    if (loggingInitialized) {
      return;
    }

    // Turn off INFO message of Reflections library (dirty, but the only way!)
    Reflections.log = null;

    // Load logging.properties
    try {
      // Use file if exists, else use file embedded in JAR
      File logConfig = new File("logging.properties");
      InputStream logConfigInputStream;

      if (logConfig.exists() && logConfig.canRead()) {
        logConfigInputStream = new FileInputStream(new File("logging.properties"));
      } else {
        logConfigInputStream = Config.class.getResourceAsStream("/logging.properties");
      }

      if (logConfigInputStream != null) {
        LogManager.getLogManager().readConfiguration(logConfigInputStream);
      }

      loggingInitialized = true;
    } catch (Exception e) {
      Logger.getAnonymousLogger()
          .severe("Could not load logging.properties file from file system or JAR.");
      Logger.getAnonymousLogger().severe(e.getMessage());

      e.printStackTrace();
    }
  }
Example #6
0
  /**
   * The getSameAs method calls the online sameas service for retrieving the bundle of equivalent
   * URIs.
   *
   * @param uri the String representation of the entity URI
   * @param pattern The String representation of the regex pattern to satisfy.
   * @return the first URI that satisfies the conditions.
   */
  private static String getSameAs(String uri, String pattern) {
    String service_base = "http://sameas.org/text?uri=";
    String result = null;
    try {
      URL service_url = new URL(service_base + URLEncoder.encode(uri, "UTF-8"));
      URLConnection conn = service_url.openConnection();
      BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
      String line;
      while ((line = rd.readLine()) != null) {
        if (line.matches("<" + pattern + ">")) {
          result = line.substring(1, line.length() - 1);
          Logger.getAnonymousLogger().log(Level.INFO, "result: " + result);
        }
      }
      rd.close();

    } catch (MalformedURLException e) {
      Logger.getAnonymousLogger().log(Level.SEVERE, "uri: " + uri);
    } catch (UnsupportedEncodingException e) {
      Logger.getAnonymousLogger().log(Level.SEVERE, e.toString());
    } catch (IOException e) {
      Logger.getAnonymousLogger().log(Level.SEVERE, e.toString());
    }
    return result;
  }
Example #7
0
  private Composant instanciate(CompDesc element)
      throws ClassNotFoundException, ArchitectureException, NoSuchMethodException,
          IllegalArgumentException, InvocationTargetException, NoSuchComponentException,
          NoSuchInterfaceException, WrongTypeException {
    Logger.getAnonymousLogger().log(Level.INFO, ">>> Instanciate : {0}", element.name());

    String name = element.name();
    Set<String> classes = annotdb.getAnnotationIndex().get(Component.class.getName());

    for (String clName : classes) {
      Class compC = loader.loadClass(clName);
      if (Composant.class.isAssignableFrom(compC)) {
        try {
          Composant compTest = (Composant) compC.newInstance();
          String value = compTest.getClass().getAnnotation(Component.class).value();
          if (name.equals(value)) {
            checkInterfaces(compTest, element); // DONE
            // On a trouvé la classe qui va bien ! il faut l'ajouter au système, et passer à la
            // suite.
            if (element instanceof ConfDesc) {
              if (compTest instanceof Configuration) {
                for (CompDesc cm : ((ConfDesc) element).children) {
                  Logger.getAnonymousLogger()
                      .log(
                          Level.INFO,
                          "Adding component {0} to configuration {1}...",
                          new Object[] {cm.name(), element.name()});
                  ((Configuration) compTest).addComposant(instanciate(cm));
                }
                addConnectors((Configuration) compTest, (ConfDesc) element); // DONE
                addBindings((Configuration) compTest, (ConfDesc) element); // DONE
              } else {
                throw new ArchitectureException(
                    "The "
                        + element.name()
                        + " node is configuration and refers to a simplecomposant.");
              }
            } else if (compTest instanceof Configuration) {
              throw new ArchitectureException(
                  "The "
                      + element.name()
                      + " node is simplecomposant and refers to a configuration.");
            }
            return compTest;
          }
        } catch (InstantiationException ex) {
          Logger.getLogger(SystemManager.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
          Logger.getLogger(SystemManager.class.getName()).log(Level.SEVERE, null, ex);
        }
      } else {
        throw new ArchitectureException(
            "Only Composant class should be annotated with Component annotation.");
      }
    }
    throw new ArchitectureException("No component found with name " + name);
  }
  public XMLEntity getXMLEntity() {
    XMLEntity xml = new XMLEntity();
    xml.putProperty("className", getClassName());
    xml.putProperty("labelingStrategy", "labelingStrategy");

    try {
      if (getHeightField() != null) {
        xml.putProperty("HeightField", getHeightField());
      }
    } catch (DataException e) {
      Logger.getAnonymousLogger()
          .log(Level.SEVERE, "Acessing TextHeight field.\n" + e.getMessage());
    }

    try {
      if (getColorField() != null) {
        xml.putProperty("ColorField", getColorField());
      }
    } catch (DataException e) {
      Logger.getAnonymousLogger()
          .log(Level.SEVERE, "Acessing ColorField field.\n" + e.getMessage());
    }

    try {
      if (getTextField() != null) {
        xml.putProperty("TextField", getTextField());
      }
    } catch (DataException e) {
      Logger.getAnonymousLogger().log(Level.SEVERE, "Acessing TextField field.\n" + e.getMessage());
    }

    try {
      if (getRotationField() != null) {
        xml.putProperty("RotationField", getRotationField());
      }
    } catch (DataException e) {
      Logger.getAnonymousLogger()
          .log(Level.SEVERE, "Acessing RotationField field.\n" + e.getMessage());
    }

    if (getFont() != null) {
      xml.putProperty("fontSize", getFont().getSize());
      xml.putProperty("fontName", getFont().getName());
      xml.putProperty("fontStyle", getFont().getStyle());
    }
    if (getColorFont() != null) {
      xml.putProperty("Color", StringUtilities.color2String(getColorFont()));
    }
    xml.putProperty("useFixedSize", useFixedSize);
    xml.putProperty("useFixedColor", useFixedColor);
    xml.putProperty("fixedColor", StringUtilities.color2String(fixedColor));
    xml.putProperty("fixedSize", fixedSize);
    xml.putProperty("Unit", unit);
    xml.putProperty("referenceSystem", referenceSystem);
    return xml;
  }
 @Test(dependsOnMethods = "testCreateAndStartServer")
 public void testConnectivity() throws Exception {
   HostAndPort vncsocket = HostAndPort.fromParts(server.getVnc().getIp(), 5900);
   Logger.getAnonymousLogger().info("awaiting vnc: " + vncsocket);
   assert socketTester.apply(vncsocket) : server;
   HostAndPort sshsocket = HostAndPort.fromParts(server.getNics().get(0).getDhcp(), 22);
   Logger.getAnonymousLogger().info("awaiting ssh: " + sshsocket);
   assert socketTester.apply(sshsocket) : server;
   doConnectViaSsh(server, getSshCredentials(server));
 }
Example #10
0
  /** Start our listening thread. */
  public static void start() {
    // Check to make sure there is not a currently running thread
    stop();

    Logger.getAnonymousLogger().log(Level.INFO, "Creating worker thread.");
    g_pWorkerThread = new Thread(g_pInst);

    Logger.getAnonymousLogger().log(Level.INFO, "Starting worker thread.");
    g_pWorkerThread.start();
  }
Example #11
0
  static {
    final InputStream inputStream = JEEPapp.class.getResourceAsStream("/logging.properties");
    try {
      LogManager.getLogManager().readConfiguration(inputStream);

    } catch (final IOException e) {
      Logger.getAnonymousLogger().severe("Could not load default logging.properties file");
      Logger.getAnonymousLogger().severe(e.getMessage());
    }
  }
Example #12
0
public class Bug2843625 {
  public static final Logger log = Logger.getAnonymousLogger();

  public static Logger log2 = Logger.getAnonymousLogger();

  public Logger log3 = Logger.getAnonymousLogger();

  public static final Logger Log = Logger.getAnonymousLogger();

  public static Logger Log2 = Logger.getAnonymousLogger();

  public Logger Log3 = Logger.getAnonymousLogger();

  public static final Logger LOG = Logger.getAnonymousLogger();

  public static Logger LOG2 = Logger.getAnonymousLogger();

  public Logger LOG3 = Logger.getAnonymousLogger();

  public enum ApplicationType {
    Data,
    data,
    DATA
  }
}
Example #13
0
  @Test
  public void testCalculateNextGeneration() {
    Logger.getAnonymousLogger().info("GameOfLife-Server initialized");
    Court court = new Court();
    court.initializeFields();

    Logger.getAnonymousLogger().info("vorher: \n" + court);
    court.calculateNextGeneration();
    Logger.getAnonymousLogger().info("nacher: \n" + court);

    Assert.assertTrue(court.isStillActive());
  }
 public void syncConstructs(EList<sigConstruct> model, Element e) {
   sigConstruct ll;
   for (sigConstruct contr : model) {
     if (contr instanceof includeConstruct) {
       includeConstruct inc = (includeConstruct) contr;
       String importName = NodeModelUtils.getNode(inc).getText().substring(9);
       if (importName.startsWith("t.")) {
         String proj = contr.eResource().getURI().segment(1);
         URI ol = contr.eResource().getURI();
         Logger.getAnonymousLogger().info(ol.toString());
         URI nu = URI.createURI("platform:/resource/" + proj + "/source/test.elf");
         Logger.getAnonymousLogger().info(nu.toString());
         Resource res = contr.eResource().getResourceSet().getResource(nu, true);
         TreeIterator<EObject> iter = res.getAllContents();
         while (iter.hasNext()) {
           EObject node = iter.next();
           if (node instanceof signatureDeclaration
               && ((signatureDeclaration) node).getSigName().equals(importName.substring(2))) {
             ((includeConstruct) contr).setNamespace((signatureDeclaration) node);
           }
         }
       }
       if (sigObjMap.containsKey(importName)) {
         ((includeConstruct) contr).setNamespace((signatureDeclaration) sigObjMap.get(importName));
       }
     }
     if (contr instanceof structConstruct) {
       structConstruct inc = (structConstruct) contr;
       String totalText = NodeModelUtils.getNode(inc).getText();
       String importName = totalText.substring(totalText.indexOf(':') + 1).trim();
       if (sigObjMap.containsKey(importName)) {
         ((structConstruct) contr).setNamespace((signatureDeclaration) sigObjMap.get(importName));
       }
     }
     /*	String namespace = ((includeConstruct) contr).getNamespace();
     	if (namespace.indexOf('.')==-1) { // local link
     		if (sigObjMap.containsKey(namespace)) {
     			((includeConstruct) contr).setHyper(((signatureDeclaration) sigObjMap.get(namespace)).getDefs());
     			continue;
     		}
     		if (viewObjMap.containsKey(namespace)) {
     			((includeConstruct) contr).setHyper(((viewDeclaration) viewObjMap.get(namespace)).getViewDefs());
     			continue;
     		}
     	}
     } */
   }
 }
Example #15
0
  /*
   * (non-Javadoc)
   *
   * @see
   * fr.univartois.ili.fsnet.commons.talk.ITalk#initConnexion(java.lang.String
   * , int, java.lang.String, java.lang.String, java.util.Map)
   */
  @Override
  public void initConnexion(
      String xmppServer, int port, String login, String pssword, Map<String, String> map)
      throws TalkException {
    config = new ConnectionConfiguration(xmppServer, port);

    connection = new XMPPConnection(config);
    try {
      if (!connection.isConnected()) {
        connection.connect();
      }

      accountManager = connection.getAccountManager();
      connection.login(login, pssword);

    } catch (XMPPException e) {
      if ((e.getLocalizedMessage().contains("authentication failed")
              || e.getLocalizedMessage().contains("SASL authentication"))
          && accountManager.supportsAccountCreation()) {
        createAccount(login, pssword, map);

      } else {
        Logger.getAnonymousLogger().log(Level.SEVERE, "", e);
      }
    }

    /* It is only at that moment where the Listener is correctly initialized */
    ChatStateManager.getInstance(connection);
  }
Example #16
0
  private void checkInterfaces(Composant comp, CompDesc element)
      throws InstantiationException, IllegalAccessException, ArchitectureException,
          NoSuchInterfaceException, ClassNotFoundException {

    Logger.getAnonymousLogger()
        .log(Level.INFO, "Checking interfaces for component {0}...", element.name());

    for (String pName : element.ports) {
      Field f = (Field) comp.getInterfaceForName(pName, Boolean.TRUE);
      if (f == null) {
        f = (Field) comp.getInterfaceForName(pName, Boolean.FALSE);
        if (f == null) {
          throw new NoSuchInterfaceException("Cannot find port " + pName);
        }
      }
    }

    for (String sName : element.services) {
      Method m = (Method) comp.getInterfaceForName(sName, Boolean.TRUE);
      if (m == null) {
        m = (Method) comp.getInterfaceForName(sName, Boolean.FALSE);
        if (m == null) {
          throw new NoSuchInterfaceException("Cannot find service " + element.name() + "." + sName);
        }
      }
    }
  }
  @Test(dependsOnMethods = "testSetDriveData")
  public void testCreateAndStartServer() throws Exception {
    Logger.getAnonymousLogger().info("preparing drive");
    prepareDrive();

    Server serverRequest = Servers.small(prefix, drive.getUuid(), vncPassword).build();

    Logger.getAnonymousLogger().info("starting server");
    server = client.createServer(serverRequest);
    client.startServer(server.getUuid());
    server = client.getServerInfo(server.getUuid());
    checkStartedServer();

    Server newInfo = client.getServerInfo(server.getUuid());
    checkServerMatchesGet(newInfo);
  }
 protected void doPost(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   HttpSession session = request.getSession();
   String state = (String) session.getAttribute("state");
   if (state == null) {
     state = new BigInteger(130, new SecureRandom()).toString(32);
     request.getSession().setAttribute("state", state);
   }
   File test = new File("test.txt");
   Logger.getAnonymousLogger().warning("Path to test file: " + test.getAbsolutePath());
   GoogleApiClientDAO googleApiClientDAO = new GoogleApiClientDAO();
   GoogleApiClient googleApiClient = googleApiClientDAO.get();
   String script =
       new Scanner(new File("WEB-INF/resources/helper.js"), "UTF-8")
           .useDelimiter("\\A")
           .next()
           .replaceAll("[{]{2}\\s*CLIENT_ID\\s*[}]{2}", googleApiClient.getId())
           .replaceAll("[{]{2}\\s*STATE\\s*[}]{2}", state)
           .replaceAll("[{]{2}\\s*APPLICATION_NAME\\s*[}]{2}", APPLICATION_NAME);
   response.setContentType("text/javascript");
   PrintWriter pw = response.getWriter();
   pw.write(script);
   pw.write("\n\n\n\n");
   pw.flush();
   pw.close();
 }
Example #19
0
 public void run() {
   Method entryPoint = system.getEntryPoint();
   if (entryPoint != null) {
     Logger.getAnonymousLogger().log(Level.INFO, "EntryPoint : {0}", entryPoint.getName());
     system.call(entryPoint.getName());
   }
 }
  public String[] getUsedFields() {
    if (this.usedFields == null) {
      List v = new ArrayList(4);
      try {
        if (!this.usesFixedSize()) {
          if (getHeightField() != null) {
            v.add(getHeightField());
          }
        }
        if (getRotationField() != null) {
          v.add(getRotationField());
        }
        if (getTextField() != null) {
          v.add(getTextField());
        }

        if (!this.usesFixedColor() && getColorField() != null) {
          v.add(getColorField());
        }
      } catch (DataException e) {
        Logger.getAnonymousLogger().log(Level.SEVERE, e.getMessage());
      }
      this.usedFields = (String[]) v.toArray(new String[v.size()]);
    }
    return this.usedFields;
  }
 @Provides
 @Singleton
 @ImageQuery
 protected Map<String, String> imageQuery(ValueOfConfigurationKeyOrNull config) {
   String amiQuery = Strings.emptyToNull(config.apply(PROPERTY_EC2_AMI_QUERY));
   String owners = config.apply(PROPERTY_EC2_AMI_OWNERS);
   if ("".equals(owners)) {
     amiQuery = null;
   } else if (owners != null) {
     StringBuilder query = new StringBuilder();
     if ("*".equals(owners)) query.append("state=available;image-type=machine");
     else query.append("owner-id=").append(owners).append(";state=available;image-type=machine");
     Logger.getAnonymousLogger()
         .warning(
             String.format(
                 "Property %s is deprecated, please use new syntax: %s=%s",
                 PROPERTY_EC2_AMI_OWNERS, PROPERTY_EC2_AMI_QUERY, query.toString()));
     amiQuery = query.toString();
   }
   Builder<String, String> builder = ImmutableMap.<String, String>builder();
   if (amiQuery != null) builder.put(PROPERTY_EC2_AMI_QUERY, amiQuery);
   String ccQuery = Strings.emptyToNull(config.apply(PROPERTY_EC2_CC_AMI_QUERY));
   if (ccQuery != null) builder.put(PROPERTY_EC2_CC_AMI_QUERY, ccQuery);
   return builder.build();
 }
  public static void parse() throws FileNotFoundException, IOException {
    Archive config = Archive.decode(Cache.fileSystem.getFile(0, 2));

    datBuffer = config.getEntry("loc.dat").getBuffer();
    idxBuffer = config.getEntry("loc.idx").getBuffer();

    // BufferedWriter writer = new BufferedWriter(new FileWriter("./object_ids.txt"));

    positions = new int[idxBuffer.getShort() & 0xFFFF];
    definitions = new RSObjectDefinition[positions.length];
    int off = 2;
    for (int i = 0; i < positions.length; i++) {
      positions[i] = off;
      off += idxBuffer.getShort() & 0xFFFF;
    }

    for (int i = 0; i < definitions.length; i++) {
      definitions[i] = valueOf(i);

      //			writer.write("name= "+obj.name+"_"+i+", actions= "+Arrays.toString(obj.actions));
      //			writer.newLine();
    }

    for (int i = 0; i < cache.length; i++) {
      cache[i] = new RSObjectDefinition();
    }
    //	writer.close();
    Logger.getAnonymousLogger().info("Cached " + positions.length + " Object Definitions.");
  }
Example #23
0
  private static void writeReport(Report report) {
    if (report == null) {
      return;
    }

    if (!SHOULD_WRITE_REPORT) {
      return;
    }

    report.timestamp = new Date().toString();
    report.javaVersion = System.getProperty("java.runtime.version");
    report.hardwareConfig = getHwConfigFromEnv();
    report.jvmArgs = getNonXenonJvmArgs();
    report.xenonArgs = getXenonTestArgs();
    report.id = getIdFromEnv();
    report.os = System.getProperty("os.name") + " " + System.getProperty("os.version");
    Path dest = getReportRootFolder();
    dest = dest.resolve(report.id);

    report.prepare();
    Logger logger = Logger.getAnonymousLogger();
    try {
      Files.createDirectories(dest);
      dest = dest.resolve(report.name + ".json").toAbsolutePath();
      String json = Utils.toJsonHtml(report);
      Files.write(dest, json.getBytes(Utils.CHARSET));

      logger.info(String.format("Report for test run %s written to %s", report.id, dest));
    } catch (IOException e) {
      logger.log(Level.WARNING, "Could not save test results to " + dest, e);
    }
  }
  @Test(dependsOnMethods = "testCreateSecurityGroup")
  protected void testAuthorizeIPRange() {
    securityGroup = api().authorizeIngressToIPRange(SECURITYGROUP, "0.0.0.0/0");

    assertTrue(ipRangesAuthorized.apply(securityGroup), securityGroup.toString());
    securityGroup = api().get(securityGroup.getName());
    Logger.getAnonymousLogger().info("ip range authorized: " + securityGroup);
  }
Example #25
0
 public static void send(WxSendMsg msg, OutputStream out) throws JDOMException, IOException {
   Document doc = WxMsgKit.parse(msg);
   if (null != doc) {
     new XMLOutputter().output(doc, out);
   } else {
     Logger.getAnonymousLogger().warning("发送消息时,解析出dom为空 msg :" + msg);
   }
 }
 public static void showDialog(final JFrame parent) {
   try {
     final TransactionNumberDialog dlg = new TransactionNumberDialog(parent);
     dlg.setVisible(true);
   } catch (Exception e) {
     Logger.getAnonymousLogger().log(Level.SEVERE, e.toString(), e);
   }
 }
Example #27
0
 /*
  * (non-Javadoc)
  *
  * @see
  * fr.univartois.ili.fsnet.commons.talk.ITalk#sendMessage(java.lang.String,
  * java.lang.String, org.jivesoftware.smack.Chat)
  */
 @Override
 public void sendMessage(String msg, String friendPseudo, Chat chat) throws TalkException {
   try {
     chat.sendMessage(msg);
   } catch (Exception e) {
     Logger.getAnonymousLogger().log(Level.SEVERE, "", e);
   }
 }
Example #28
0
 /**
  * Adds a jar file from the filesystems into the jar loader list.
  *
  * @param jarfile The full path to the jar file.
  */
 public void addJarFile(String jarfile) {
   try {
     URL url = new URL("file:" + jarfile);
     addURL(url);
   } catch (IOException ex) {
     Logger.getAnonymousLogger().log(Level.WARNING, "Error adding jar file", ex);
   }
 }
Example #29
0
/** @author Thomas Hallgren */
public class UsingProperties implements ResultSetProvider, PooledObject {
  private static Logger s_logger = Logger.getAnonymousLogger();
  private final Properties m_properties;
  private final ObjectPool m_pool;

  private Iterator m_propertyIterator;

  public UsingProperties(ObjectPool pool) throws IOException {
    m_pool = pool;
    m_properties = new Properties();

    s_logger.info("** UsingProperties()");
    InputStream propStream = this.getClass().getResourceAsStream("example.properties");
    if (propStream == null) {
      s_logger.info("example.properties was null");
    } else {
      m_properties.load(propStream);
      propStream.close();
      s_logger.info("example.properties has " + m_properties.size() + " entries");
    }
  }

  public void activate() {
    s_logger.info("** UsingProperties.activate()");
    m_propertyIterator = m_properties.entrySet().iterator();
  }

  public void remove() {
    s_logger.info("** UsingProperties.remove()");
    m_properties.clear();
  }

  public void passivate() {
    s_logger.info("** UsingProperties.passivate()");
    m_propertyIterator = null;
  }

  public boolean assignRowValues(ResultSet receiver, int currentRow) throws SQLException {
    if (!m_propertyIterator.hasNext()) {
      s_logger.fine("no more rows, returning false");
      return false;
    }
    Map.Entry propEntry = (Map.Entry) m_propertyIterator.next();
    receiver.updateString(1, (String) propEntry.getKey());
    receiver.updateString(2, (String) propEntry.getValue());
    // s_logger.fine("next row created, returning true");
    return true;
  }

  public void close() throws SQLException {
    m_pool.passivateInstance(this);
  }

  public static ResultSetProvider getProperties() throws SQLException {
    ObjectPool pool = SessionManager.current().getObjectPool(UsingProperties.class);
    return (ResultSetProvider) pool.activateInstance();
  }
}
  private void updateLoadBalancerElements() {
    LoadBalancers loadBalancers = domain.getLoadBalancers();
    List<LoadBalancer> loadBalancerList = loadBalancers.getLoadBalancer();

    for (LoadBalancer loadBalancer : loadBalancerList) {
      try {
        ConfigSupport.apply(new LoadBalancerConfigCode(), loadBalancer);
      } catch (TransactionFailure ex) {
        String msg =
            LbLogUtil.getStringManager()
                .getString("ErrorDuringUpgrade", loadBalancer.getName(), ex.getMessage());
        Logger.getAnonymousLogger().log(Level.SEVERE, msg);
        if (Logger.getAnonymousLogger().isLoggable(Level.FINE)) {
          Logger.getAnonymousLogger().log(Level.FINE, "Exception during upgrade operation", ex);
        }
      }
    }
  }