Package net.sourceforge.squirrel_sql.fw.util

Examples of net.sourceforge.squirrel_sql.fw.util.IMessageHandler


         if(false == session.getAlias().getSchemaProperties().getExpectsSomeCachedData())
         {
            return;
         }

         IMessageHandler msgHandler = session.getApplication().getMessageHandler();
         File schemaCacheFile = getSchemaCacheFile(session.getAlias());


         String params[] = {session.getAlias().getName(),  schemaCacheFile.getPath()};
         // i18n[SchemaInfoCacheSerializer.beginStore=Starting to write schema cache for Alias {0}. file: {1}]
         msgHandler.showMessage(s_stringMgr.getString("SchemaInfoCacheSerializer.beginStore", params));


         schemaInfoCache.prepareSerialization();

         FileOutputStream fos = new FileOutputStream(schemaCacheFile);
         ObjectOutputStream oOut = new ObjectOutputStream(fos);
         oOut.writeObject(schemaInfoCache);
         oOut.close();
         fos.close();

         // i18n[SchemaInfoCacheSerializer.endStore=Finished writing schema cache for Alias{0}. file: {1}]
         msgHandler.showMessage(s_stringMgr.getString("SchemaInfoCacheSerializer.endStore", params));

      }
      catch (Exception e)
      {
         s_log.error("Failed to write Schema cache file ", e);
View Full Code Here


* mocks should be relocated to individual plugin TestUtil helpers.
*/
public class FwTestUtil {

   public static IMessageHandler getEasyMockMessageHandler() {
      IMessageHandler result = createMock(IMessageHandler.class);
      result.showErrorMessage(isA(Throwable.class), null);
      result.showErrorMessage(isA(String.class));
      result.showMessage(isA(String.class));
      result.showMessage(isA(Throwable.class), null);
      result.showWarningMessage(isA(String.class));
      replay(result);
      return result;
   }
View Full Code Here

   private static ServerMain createProcessAndDoLookup(HibernateConfiguration cfg, HibernatePlugin plugin)
   {
      try
      {
         IMessageHandler mh = plugin.getApplication().getMessageHandler();

         ServerMain stub;
         if (cfg.isEndProcessOnDisconnect())
         {
            mh.showMessage("Launching Hibernate process ...");
            try
            {
               launchProcess(cfg);
            }
            catch (Throwable e)
            {
               s_log.error("Error launching process. Maybe port is in use. Tryin to connect and kill existing process:", e);
               try
               {
                  stub = attachToProcess(cfg, mh, true);
                  if (null != stub)
                  {
                     stub.exit();
                  }
               }
               catch (Throwable e1)
               {
                  // Nothing
               }

               launchProcess(cfg);
            }

            stub = attachToProcess(cfg, mh, false);
         }
         else
         {
            stub = attachToProcess(cfg, mh, false);
            if(null == stub)
            {
               mh.showMessage("Attaching to existing Hibernate process failed. Now will launch new process ...");
               launchProcess(cfg);
               stub = attachToProcess(cfg, mh, false);
            }
         }


         if (null == stub)
         {
            throw new IllegalStateException("Could not attach to Hibernate process");
         }

         mh.showMessage("Successfully attached to Hibernate process. Now creating Hibernate session.");
         return stub;
      }
      catch (IOException e)
      {
         throw new RuntimeException(e);
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.fw.util.IMessageHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.