Package org.apache.wookie.util

Examples of org.apache.wookie.util.WgtWatcher$WarInfo


    final String[] locales = configuration.getStringArray("widget.locales");
    final String contextPath = context.getContextPath();
    Thread thr = new Thread(){
       public void run() {
         int interval = 5000;
         WgtWatcher watcher = new WgtWatcher();
         watcher.setWatchDir(deploy);
         watcher.setListener(new WgtWatcher.FileChangeListener(){
           public void fileModified(File f) {
                 // get persistence manager for this thread
                        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
             try{
               persistenceManager.begin();
               File upload = WidgetFileUtils.dealWithDroppedFile(UPLOADFOLDER, f);
               W3CWidgetFactory fac = new W3CWidgetFactory();
               fac.setLocales(locales);
               fac.setLocalPath(contextPath+localWidgetFolderPath);
               fac.setOutputDirectory(WIDGETFOLDER);
               fac.setFeatures(Features.getFeatureNames());
               fac.setStartPageProcessor(new StartPageProcessor());
               W3CWidget model = fac.parse(upload);
               WidgetJavascriptSyntaxAnalyzer jsa = new WidgetJavascriptSyntaxAnalyzer(fac.getUnzippedWidgetDirectory());
               if(persistenceManager.findWidgetByGuid(model.getIdentifier()) == null) {
                 WidgetFactory.addNewWidget(model, null, upload, true)
                 String message = model.getLocalName("en") +"' - " + localizedMessages.getString("WidgetAdminServlet.19");
                 _logger.info(message);
                 FlashMessage.getInstance().message(message);
               } else {
                 String message = model.getLocalName("en") +"' - " + localizedMessages.getString("WidgetAdminServlet.20");
                 WidgetFactory.update(model, persistenceManager.findWidgetByGuid(model.getIdentifier()), true, upload);
                 _logger.info(message);
                 FlashMessage.getInstance().message(message);
               }
               persistenceManager.commit();
             } catch (IOException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.1") + " - " + e.getLocalizedMessage();
               FlashMessage.getInstance().error(error);
               _logger.error(error, e);
             } catch (BadWidgetZipFileException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.2") + " - " + e.getLocalizedMessage();
               FlashMessage.getInstance().error(error);
               _logger.error(error, e);
             } catch (BadManifestException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.3") + " - " + e.getLocalizedMessage();
               FlashMessage.getInstance().error(error);
               _logger.error(error, e);
             } catch (Exception e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+e.getLocalizedMessage();
               FlashMessage.getInstance().error(error);
               _logger.error(error, e);
            } finally {
                    // close thread persistence manager
                    PersistenceManagerFactory.closePersistenceManager();               
            }
           }
           public void fileRemoved(File f) {
             // Not implemented - the .wgt files are removed as part of the deployment process
           }
         });
           try {
              while (true) {
                watcher.check();
                Thread.sleep(interval);
              }
            } catch (InterruptedException iex) {
            }
       } 
View Full Code Here


    final String[] locales = configuration.getStringArray("widget.locales");
    final String contextPath = context.getContextPath();
    Thread thr = new Thread(){
       public void run() {
         int interval = 5000;
         WgtWatcher watcher = new WgtWatcher();
         watcher.setWatchDir(deploy);
         watcher.setListener(new WgtWatcher.FileChangeListener(){
           public void fileModified(File f) {
                 // get persistence manager for this thread
                        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
             try{
               persistenceManager.begin();
               File upload = WidgetFileUtils.dealWithDroppedFile(UPLOADFOLDER, f);
               W3CWidgetFactory fac = new W3CWidgetFactory();
               fac.setLocales(locales);
               fac.setLocalPath(contextPath+localWidgetFolderPath);
               fac.setOutputDirectory(WIDGETFOLDER);
               fac.setFeatures(Features.getFeatureNames());
               fac.setStartPageProcessor(new StartPageProcessor());
               W3CWidget model = fac.parse(upload);
               WidgetJavascriptSyntaxAnalyzer jsa = new WidgetJavascriptSyntaxAnalyzer(fac.getUnzippedWidgetDirectory());
               if(persistenceManager.findWidgetByGuid(model.getIdentifier()) == null) {
                 WidgetFactory.addNewWidget(model, null, upload, true)
                 String message = model.getLocalName("en") +"' - " + localizedMessages.getString("WidgetAdminServlet.19");
                 _logger.info(message);
                 FlashMessage.getInstance().message(message);
               } else {
                 String message = model.getLocalName("en") +"' - " + localizedMessages.getString("WidgetAdminServlet.20");
                 WidgetFactory.update(model, persistenceManager.findWidgetByGuid(model.getIdentifier()), true, upload);
                 _logger.info(message);
                 FlashMessage.getInstance().message(message);
               }
               persistenceManager.commit();
             } catch (IOException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.1") + " - " + e.getLocalizedMessage();
               FlashMessage.getInstance().error(error);
               _logger.error(error, e);
             } catch (BadWidgetZipFileException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.2") + " - " + e.getLocalizedMessage();
               FlashMessage.getInstance().error(error);
               _logger.error(error, e);
             } catch (BadManifestException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.3") + " - " + e.getLocalizedMessage();
               FlashMessage.getInstance().error(error);
               _logger.error(error, e);
             } catch (Exception e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+e.getLocalizedMessage();
               FlashMessage.getInstance().error(error);
               _logger.error(error, e);
            } finally {
                    // close thread persistence manager
                    PersistenceManagerFactory.closePersistenceManager();               
            }
           }
           public void fileRemoved(File f) {
             // Not implemented - the .wgt files are removed as part of the deployment process
           }
         });
           try {
              while (true) {
                watcher.check();
                Thread.sleep(interval);
              }
            } catch (InterruptedException iex) {
            }
       } 
View Full Code Here

    final String[] locales = configuration.getStringArray("widget.locales");
    final String contextPath = context.getContextPath();
    Thread thr = new Thread(){
       public void run() {
         int interval = 5000;
         WgtWatcher watcher = new WgtWatcher();
         watcher.setWatchDir(deploy);
         watcher.setListener(new WgtWatcher.FileChangeListener(){
           public void fileModified(File f) {
                 // get persistence manager for this thread
                        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
             try{
               persistenceManager.begin();
               File upload = WidgetFileUtils.dealWithDroppedFile(UPLOADFOLDER, f);
               W3CWidgetFactory fac = new W3CWidgetFactory();
               fac.setLocales(locales);
               fac.setLocalPath(contextPath+localWidgetFolderPath);
               fac.setOutputDirectory(WIDGETFOLDER);
               fac.setFeatures(Features.getFeatureNames());
               fac.setStartPageProcessor(new StartPageProcessor());
               W3CWidget model = fac.parse(upload);
               WidgetJavascriptSyntaxAnalyzer jsa = new WidgetJavascriptSyntaxAnalyzer(fac.getUnzippedWidgetDirectory());
               if(persistenceManager.findWidgetByGuid(model.getIdentifier()) == null) {
                 WidgetFactory.addNewWidget(model, upload, true)
                 String message = model.getLocalName("en") +"' - " + localizedMessages.getString("WidgetAdminServlet.19");
                 _logger.info(message);
               } else {
                 String message = model.getLocalName("en") +"' - " + localizedMessages.getString("WidgetAdminServlet.20");
                 WidgetFactory.update(model, persistenceManager.findWidgetByGuid(model.getIdentifier()), true, upload);
                 _logger.info(message);
               }
               persistenceManager.commit();
             } catch (IOException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.1") + " - " + e.getLocalizedMessage();
               _logger.error(error, e);
             } catch (BadWidgetZipFileException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.2") + " - " + e.getLocalizedMessage();
               _logger.error(error, e);
             } catch (BadManifestException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.3") + " - " + e.getLocalizedMessage();
               _logger.error(error, e);
             } catch (Exception e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+e.getLocalizedMessage();
               _logger.error(error, e);
            } finally {
                    // close thread persistence manager
                    PersistenceManagerFactory.closePersistenceManager();               
            }
           }
           public void fileRemoved(File f) {
             // Not implemented - the .wgt files are removed as part of the deployment process
           }
         });
           try {
              while (true) {
                watcher.check();
                Thread.sleep(interval);
              }
            } catch (InterruptedException iex) {
            }
       } 
View Full Code Here

    final String[] locales = configuration.getStringArray("widget.locales");
    final String contextPath = context.getContextPath();
    Thread thr = new Thread(){
       public void run() {
         int interval = 5000;
         WgtWatcher watcher = new WgtWatcher();
         watcher.setWatchDir(deploy);
         watcher.setListener(new WgtWatcher.FileChangeListener(){
           public void fileModified(File f) {
                 // get persistence manager for this thread
                        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
             try{
               persistenceManager.begin();
               File upload = WidgetFileUtils.dealWithDroppedFile(UPLOADFOLDER, f);
               W3CWidgetFactory fac = new W3CWidgetFactory();
               fac.setLocales(locales);
               fac.setLocalPath(contextPath+localWidgetFolderPath);
               fac.setOutputDirectory(WIDGETFOLDER);
               fac.setFeatures(Features.getFeatureNames());
               fac.setStartPageProcessor(new StartPageProcessor());
               W3CWidget model = fac.parse(upload);
               WidgetJavascriptSyntaxAnalyzer jsa = new WidgetJavascriptSyntaxAnalyzer(fac.getUnzippedWidgetDirectory());
               if(persistenceManager.findWidgetByGuid(model.getIdentifier()) == null) {
                 WidgetFactory.addNewWidget(model, upload, true)
                 String message = model.getLocalName("en") +"' - " + localizedMessages.getString("WidgetAdminServlet.19");
                 _logger.info(message);
               } else {
                 String message = model.getLocalName("en") +"' - " + localizedMessages.getString("WidgetAdminServlet.20");
                 WidgetFactory.update(model, persistenceManager.findWidgetByGuid(model.getIdentifier()), true, upload);
                 _logger.info(message);
               }
               persistenceManager.commit();
             } catch (IOException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.1") + " - " + e.getLocalizedMessage();
               _logger.error(error, e);
             } catch (BadWidgetZipFileException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.2") + " - " + e.getLocalizedMessage();
               _logger.error(error, e);
             } catch (BadManifestException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.3") + " - " + e.getLocalizedMessage();
               _logger.error(error, e);
             } catch (Exception e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+e.getLocalizedMessage();
               _logger.error(error, e);
            } finally {
                    // close thread persistence manager
                    PersistenceManagerFactory.closePersistenceManager();               
            }
           }
           public void fileRemoved(File f) {
             // Not implemented - the .wgt files are removed as part of the deployment process
           }
         });
           try {
              while (true) {
                watcher.check();
                Thread.sleep(interval);
              }
            } catch (InterruptedException iex) {
            }
       } 
View Full Code Here

    final String[] locales = configuration.getStringArray("widget.locales");
    final String contextPath = context.getContextPath();
    Thread thr = new Thread(){
       public void run() {
         int interval = 5000;
         WgtWatcher watcher = new WgtWatcher();
         watcher.setWatchDir(deploy);
         watcher.setListener(new WgtWatcher.FileChangeListener(){
           public void fileModified(File f) {
                 // get persistence manager for this thread
                        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
             try{
               persistenceManager.begin();
               File upload = WidgetFileUtils.dealWithDroppedFile(UPLOADFOLDER, f);
               W3CWidgetFactory fac = new W3CWidgetFactory();
               fac.setLocales(locales);
               fac.setLocalPath(contextPath+localWidgetFolderPath);
               fac.setOutputDirectory(WIDGETFOLDER);
               fac.setFeatures(persistenceManager.findServerFeatureNames());
               fac.setStartPageProcessor(new StartPageProcessor());
               W3CWidget model = fac.parse(upload);
               WidgetJavascriptSyntaxAnalyzer jsa = new WidgetJavascriptSyntaxAnalyzer(fac.getUnzippedWidgetDirectory());
               if(persistenceManager.findWidgetByGuid(model.getIdentifier()) == null) {
                 WidgetFactory.addNewWidget(model, true)
                 String message = model.getLocalName("en") +"' - " + localizedMessages.getString("WidgetAdminServlet.19");
                 _logger.info(message);
                 FlashMessage.getInstance().message(message);
               } else {
                 String message = model.getLocalName("en") +"' - " + localizedMessages.getString("WidgetAdminServlet.20");
                 _logger.info(message);
                 FlashMessage.getInstance().message(message);
               }
               persistenceManager.commit();
             } catch (IOException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.1");
               FlashMessage.getInstance().error(error);
               _logger.error(error);
             } catch (BadWidgetZipFileException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.2");
               FlashMessage.getInstance().error(error);
               _logger.error(error);
             } catch (BadManifestException e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.3");
               FlashMessage.getInstance().error(error);
               _logger.error(error);
             } catch (Exception e) {
                            persistenceManager.rollback();
               String error = f.getName()+":"+e.getLocalizedMessage();
               FlashMessage.getInstance().error(error);
               _logger.error(error);
            } finally {
                    // close thread persistence manager
                    PersistenceManagerFactory.closePersistenceManager();               
            }
           }
           public void fileRemoved(File f) {
             // Not implemented - the .wgt files are removed as part of the deployment process
           }
         });
           try {
              while (true) {
                watcher.check();
                Thread.sleep(interval);
              }
            } catch (InterruptedException iex) {
            }
       } 
View Full Code Here

        final String UPLOADFOLDER = context.getRealPath(configuration.getString("widget.useruploadfolder"));

        Thread thr = new Thread(){
            public void run() {
                int interval = 5000;
                WgtWatcher watcher = new WgtWatcher();
                watcher.setWatchDir(deploy);
                watcher.setListener(new WgtWatcher.FileChangeListener(){
                    public void fileModified(File f) {
                        // get persistence manager for this thread
                        IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
                        try{
                            persistenceManager.begin();
                            File upload = WidgetFileUtils.dealWithDroppedFile(UPLOADFOLDER, f);
                            W3CWidgetFactory fac = W3CWidgetFactoryUtils.createW3CWidgetFactory(context, configuration, localizedMessages);

                            W3CWidget model = fac.parse(upload);
                            WidgetJavascriptSyntaxAnalyzer jsa = new WidgetJavascriptSyntaxAnalyzer(fac.getUnzippedWidgetDirectory());
                            if(persistenceManager.findWidgetByGuid(model.getIdentifier()) == null) {
                                WidgetFactory.addNewWidget(model, upload, true);
                                String message = model.getLocalName("en") +"' - " + localizedMessages.getString("WidgetAdminServlet.19");
                                _logger.info(message);
                            } else {
                                String message = model.getLocalName("en") +"' - " + localizedMessages.getString("WidgetAdminServlet.20");
                                WidgetFactory.update(model, persistenceManager.findWidgetByGuid(model.getIdentifier()), true, upload);
                                _logger.info(message);
                            }
                            persistenceManager.commit();
                            NewWidgetBroadcaster.broadcast(configuration, model.getIdentifier());
                        } catch (IOException e) {
                            persistenceManager.rollback();
                            String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.1") + " - " + e.getLocalizedMessage();
                            _logger.error(error, e);
                        } catch (BadWidgetZipFileException e) {
                            persistenceManager.rollback();
                            String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.2") + " - " + e.getLocalizedMessage();
                            _logger.error(error, e);
                        } catch (BadManifestException e) {
                            persistenceManager.rollback();
                            String error = f.getName()+":"+localizedMessages.getString("WidgetHotDeploy.3") + " - " + e.getLocalizedMessage();
                            _logger.error(error, e);
                        } catch (Exception e) {
                            persistenceManager.rollback();
                            String error = f.getName()+":"+e.getLocalizedMessage();
                            _logger.error(error, e);
                        } finally {
                            // close thread persistence manager
                            PersistenceManagerFactory.closePersistenceManager();               
                        }
                    }
                    public void fileRemoved(File f) {
                        // Not implemented - the .wgt files are removed as part of the deployment process
                    }
                });
                try {
                    while (true) {
                        watcher.check();
                        Thread.sleep(interval);
                    }
                } catch (InterruptedException iex) {
                }
            } 
View Full Code Here

TOP

Related Classes of org.apache.wookie.util.WgtWatcher$WarInfo

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.