public ChangeVO updateRow( int windowNo, int AD_Tab_ID, int queryResultID, int relRowNo, Map<String, String> context, boolean force) { if (context == null || context.size() == 0) return new ChangeVO(true, Msg.translate(m_context, "NoContext")); ArrayList<String[]> data = m_results.get(queryResultID); if (data == null || data.size() == 0) return new ChangeVO(true, Msg.translate(m_context, "CachedDataNotFound")); UITab tab = getTab(AD_Tab_ID); if (tab == null) { log.config("Not found AD_Tab_ID=" + AD_Tab_ID); return new ChangeVO(true, Msg.translate(m_context, "@NotFound@ @AD_Tab_ID@=" + AD_Tab_ID)); } CContext ctx = new CContext(m_context.entrySet()); ctx.addWindow(windowNo, context); ChangeVO retValue; if (force) retValue = tab.saveRow(ctx, windowNo, false, null); else retValue = tab.saveRow(ctx, windowNo, false, data.get(relRowNo)); if (retValue.hasError()) return retValue; // Update Results String[] dataRow = retValue.rowData.clone(); data.set(relRowNo, dataRow); postProcessChangeVO(retValue, windowNo, context, dataRow, tab); retValue.trxInfo = GridTab.getTrxInfo(tab.getTableName(), ctx, windowNo, tab.getTabNo()); if (retValue.isRefreshAll()) {} return retValue; }
private boolean eightByteSizeReady() { // The payload size is encoded as 64-bit unsigned integer. // The most significant byte comes first. final long msgSize = ByteBuffer.wrap(tmpbuf).getLong(); // Message size must not exceed the maximum allowed size. if (maxmsgsize >= 0) { if (msgSize > maxmsgsize) { decodingError(); return false; } } // Message size must fit within range of size_t data type. if (msgSize > Integer.MAX_VALUE) { decodingError(); return false; } // inProgress is initialised at this point so in theory we should // close it before calling init_size, however, it's a 0-byte // message and thus we can treat it as uninitialised. inProgress = new Msg((int) msgSize); inProgress.setFlags(msgFlags); nextStep(inProgress.data(), inProgress.size(), MESSAGE_READY); return true; }
public void sendBookingConfirmation(HttpServletRequest request, Booking booking) throws MailException, IOException { Mail mail = new Mail(); mail.setSubject(msg.get("BookingSuccessfulMailSubject")); mail.setBody( msg.get( "BookingSuccessfulMailBody", new Object[] { booking.getPlayer().toString(), FormatUtils.DATE_MEDIUM.print(booking.getBookingDate()), FormatUtils.TIME_HUMAN_READABLE.print(booking.getBookingTime()), booking.getName(), msg.get(booking.getPaymentMethod().toString()), booking.getAmount(), booking.getCurrency(), CANCELLATION_POLICY_DEADLINE, RequestUtil.getBaseURL(request) + "/bookings/booking/" + booking.getUUID() + "/cancel", RequestUtil.getBaseURL(request) + "/invoices/booking/" + booking.getUUID(), RequestUtil.getBaseURL(request) })); mail.addRecipient(booking.getPlayer()); mailUtils.send(mail, request); }
/** main loop. */ public static void loop() { int cmd; Msg.loop(); // for exact msg timing first entry Triac.loop(); // should be also exact, but 1ms jitter is ok // TODO measure jitter with osci if (Msg.available) { cmd = Msg.readCmd(); if (!handleMsg(cmd)) { handleRest(cmd); if (state == BBSys.MS_SERVICE) { doService(); // never return! } } lastMsgCnt = 0; } else { chkMsgTimeout(); } if (blinkCnt == 100) { KflTimer.wd(); blinkCnt = 0; } ++blinkCnt; int used = KflTimer.usedTime(); if (maxTime < used) maxTime = used; JopSys.benchLoop(); }
@Override public View getView(int position, View convertView, ViewGroup parent) { Msg msg = getItem(position); View view; ViewHolder viewHolder; if (convertView == null) { view = LayoutInflater.from(getContext()).inflate(resoureId, null); viewHolder = new ViewHolder(); viewHolder.leftLayout = (LinearLayout) view.findViewById(R.id.left_layout); viewHolder.rightLayout = (LinearLayout) view.findViewById(R.id.right_layout); viewHolder.leftMsg = (TextView) view.findViewById(R.id.left_msg); viewHolder.rightMsg = (TextView) view.findViewById(R.id.right_msg); view.setTag(viewHolder); } else { view = convertView; viewHolder = (ViewHolder) view.getTag(); } if (msg.getType() == Msg.TYPE_RECEIVED) { viewHolder.leftLayout.setVisibility(View.VISIBLE); viewHolder.rightLayout.setVisibility(View.GONE); viewHolder.leftMsg.setText(msg.getContent()); } else if (msg.getType() == Msg.TYPE_SENT) { viewHolder.rightLayout.setVisibility(View.VISIBLE); viewHolder.leftLayout.setVisibility(View.GONE); viewHolder.rightMsg.setText(msg.getContent()); } return view; }
/* * OI hook to call individual product configurations. */ public ResultReport unConfigure(final PropertySheet propSheet, final boolean validateFlag) { try { if (productRef.getProductName().equals("Domain")) { LOGGER.log(Level.INFO, Msg.get("UNCONFIGURING_GLASSFISH", null)); unconfigureGlassfish(); } if (productRef.getProductName().equals("UpdateTool")) { LOGGER.log(Level.INFO, Msg.get("UNCONFIGURING_UPDATETOOL", null)); unconfigureUpdatetool(); org.glassfish.installer.util.FileUtils.deleteDirectory( new File(productRef.getInstallLocation() + File.separator + "updatetool")); org.glassfish.installer.util.FileUtils.deleteDirectory( new File(productRef.getInstallLocation() + File.separator + "pkg")); } /* Delete the newly created folder, on windows. No incremental uninstallation, so delete everything.*/ String folderName = (String) TemplateProcessor.getInstance().getFromDataModel("PRODUCT_NAME"); if (OSUtils.isWindows()) { WindowsShortcutManager wsShortMgr = new WindowsShortcutManager(); wsShortMgr.deleteFolder(folderName); } } catch (Exception e) { LOGGER.log(Level.FINEST, e.getMessage()); } return new ResultReport( ResultReport.ResultStatus.SUCCESS, "http://www.oracle.com/pls/topic/lookup?ctx=821-2427&id=sjsaseeig", "http://www.oracle.com/pls/topic/lookup?ctx=821-2427&id=sjsaseeig", null, productError); }
@Override public void run() { while (true) { Msg m = Msg.receive(dis); if (m != null) { if (m.type.equals(MsgType.TTUIT)) { m.process(chm, s); if (((Ttuit) m).t != null) { ((Ttuit) m).addToQueue(bq); } } else if (m.type.equals(MsgType.TRETUIT)) { m.process(chm, s); if (((Tretuit) m).rt != null) { ((Tretuit) m).addToQueue(bq); } } else { m.process(chm, s); } synchronized (chm) { System.out.print(chm.toString()); } } else { /*try { dis.close(); } catch (IOException e) { e.printStackTrace(); } */ } } }
private void updateConfigFile() throws EnhancedException { // for SDK cobundles with JDK - see if cobundled JDK exists and use that // checks for jdk7 directory since we only have JDK 7 cobundles if (org.glassfish.installer.util.FileUtils.isFileExist( productRef.getInstallLocation() + File.separator + "jdk7")) { jdkHome = productRef.getInstallLocation() + File.separator + "jdk7"; // on Unix, set executable permissions to jdk7/bin/* and jdk7/jre/bin/* if (!OSUtils.isWindows()) { org.glassfish.installer.util.FileUtils.setAllFilesExecutable( productRef.getInstallLocation() + File.separator + "jdk7" + File.separator + "bin"); org.glassfish.installer.util.FileUtils.setAllFilesExecutable( productRef.getInstallLocation() + File.separator + "jdk7" + File.separator + "jre" + File.separator + "bin"); } } else { // For all installation modes, fetch JAVA_HOME from panel; // on MacOS and AIX use java.home property since panel is skipped try { if (OSUtils.isMac() || OSUtils.isAix()) { jdkHome = System.getProperty("java.home"); } else { jdkHome = ConfigHelper.getStringValue("JDKSelection.directory.SELECTED_JDK"); } } catch (Exception e) { jdkHome = new File(System.getProperty("java.home")).getParent(); if (OSUtils.isMac() || OSUtils.isAix()) { jdkHome = System.getProperty("java.home"); } } } LOGGER.log(Level.INFO, Msg.get("UPDATE_CONFIG_HEADER", null)); LOGGER.log(Level.INFO, Msg.get("JDK_HOME", new String[] {jdkHome})); // write jdkHome value to asenv.bat on Windows, asenv.conf on non-Windows platform... try { FileIOUtils configFile = new FileIOUtils(); configFile.openFile(productRef.getConfigFilePath()); /* Add AS_JAVA to end of buffer and file. */ if (OSUtils.isWindows()) { configFile.appendLine("set AS_JAVA=" + jdkHome); } else { configFile.appendLine("AS_JAVA=" + jdkHome); } configFile.saveFile(); configFile.closeFile(); } catch (Exception ex) { LOGGER.log(Level.FINEST, ex.getMessage()); } }
// Ask pipe to terminate. The termination will happen asynchronously // and user will be notified about actual deallocation by 'terminated' // event. If delay is true, the pending messages will be processed // before actual shutdown. public void terminate(boolean delay_) { // Overload the value specified at pipe creation. delay = delay_; // If terminate was already called, we can ignore the duplicit invocation. if (state == State.TERMINATED || state == State.DOUBLE_TERMINATED) return; // If the pipe is in the final phase of async termination, it's going to // closed anyway. No need to do anything special here. else if (state == State.TERMINATING) return; // The simple sync termination case. Ask the peer to terminate and wait // for the ack. else if (state == State.ACTIVE) { send_pipe_term(peer); state = State.TERMINATED; } // There are still pending messages available, but the user calls // 'terminate'. We can act as if all the pending messages were read. else if (state == State.PENDING && !delay) { outpipe = null; send_pipe_term_ack(peer); state = State.TERMINATING; } // If there are pending messages still availabe, do nothing. else if (state == State.PENDING) { } // We've already got delimiter, but not term command yet. We can ignore // the delimiter and ack synchronously terminate as if we were in // active state. else if (state == State.DELIMITED) { send_pipe_term(peer); state = State.TERMINATED; } // There are no other states. else assert (false); // Stop outbound flow of messages. out_active = false; if (outpipe != null) { // Drop any unfinished outbound messages. rollback(); // Write the delimiter into the pipe. Note that watermarks are not // checked; thus the delimiter can be written even when the pipe is full. Msg msg = new Msg(); msg.initDelimiter(); outpipe.write(msg, false); flush(); } }
// Remove unfinished parts of the outbound message from the pipe. public void rollback() { // Remove incomplete message from the outbound pipe. Msg msg; if (outpipe != null) { while ((msg = outpipe.unwrite()) != null) { assert ((msg.flags() & Msg.MORE) > 0); // msg.close (); } } }
@Test public void testTimeo() throws Exception { Ctx ctx = ZMQ.zmqInit(1); assertThat(ctx, notNullValue()); SocketBase sb = ZMQ.zmq_socket(ctx, ZMQ.ZMQ_PULL); assertThat(sb, notNullValue()); boolean rc = ZMQ.zmq_bind(sb, "inproc://timeout_test"); assertThat(rc, is(true)); // Check whether non-blocking recv returns immediately. Msg msg = ZMQ.zmq_recv(sb, ZMQ.ZMQ_DONTWAIT); assertThat(msg, nullValue()); // Check whether recv timeout is honoured. int timeout = 500; ZMQ.zmq_setsockopt(sb, ZMQ.ZMQ_RCVTIMEO, timeout); long watch = ZMQ.zmq_stopwatch_start(); msg = ZMQ.zmq_recv(sb, 0); assertThat(msg, nullValue()); long elapsed = ZMQ.zmq_stopwatch_stop(watch); assertThat(elapsed > 440000 && elapsed < 550000, is(true)); // Check whether connection during the wait doesn't distort the timeout. timeout = 2000; ZMQ.zmq_setsockopt(sb, ZMQ.ZMQ_RCVTIMEO, timeout); Thread thread = new Thread(new Worker(ctx)); thread.start(); watch = ZMQ.zmq_stopwatch_start(); msg = ZMQ.zmq_recv(sb, 0); assertThat(msg, nullValue()); elapsed = ZMQ.zmq_stopwatch_stop(watch); assertThat(elapsed > 1900000 && elapsed < 2100000, is(true)); thread.join(); // Check that timeouts don't break normal message transfer. SocketBase sc = ZMQ.zmq_socket(ctx, ZMQ.ZMQ_PUSH); assertThat(sc, notNullValue()); ZMQ.zmq_setsockopt(sb, ZMQ.ZMQ_RCVTIMEO, timeout); ZMQ.zmq_setsockopt(sb, ZMQ.ZMQ_SNDTIMEO, timeout); rc = ZMQ.zmq_connect(sc, "inproc://timeout_test"); assertThat(rc, is(true)); Msg smsg = new Msg("12345678ABCDEFGH12345678abcdefgh".getBytes(ZMQ.CHARSET)); int r = ZMQ.zmq_send(sc, smsg, 0); assertThat(r, is(32)); msg = ZMQ.zmq_recv(sb, 0); assertThat(msg.size(), is(32)); ZMQ.zmq_close(sc); ZMQ.zmq_close(sb); ZMQ.zmq_term(ctx); }
/** * Get Measure Display Text * * @return Measure Display Text */ public String getXAxisText() { MMeasure measure = getMeasure(); if (measure != null && X_PA_Measure.MEASUREDATATYPE_StatusQtyAmount.equals(measure.getMeasureDataType())) { if (X_PA_Measure.MEASURETYPE_Request.equals(measure.getMeasureType())) return Msg.getElement(getCtx(), "R_Status_ID"); if (X_PA_Measure.MEASURETYPE_Project.equals(measure.getMeasureType())) return Msg.getElement(getCtx(), "C_Phase_ID"); } String value = getMeasureDisplay(); String display = MRefList.getListName(getCtx(), X_Ref_PA_Goal_Scope.AD_Reference_ID, value); return display == null ? value : display; } // getMeasureDisplayText
/* Creates shortcuts for windows. The ones created from OI will be removed due to manged names. These shortcuts are in addition to the ones created by default. Since the descriptor for defining the short cut entry is not OS specific, we still need to carry on the xml entries to create items on Gnome. */ private void createServerShortCuts() throws EnhancedException { String folderName = (String) TemplateProcessor.getInstance().getFromDataModel("PRODUCT_NAME"); LOGGER.log(Level.INFO, Msg.get("CREATE_SHORTCUT_HEADER", new String[] {folderName})); WindowsShortcutManager wsShortMgr = new WindowsShortcutManager(); wsShortMgr.createFolder(folderName); String modifiedInstallDir = productRef.getInstallLocation().replace("\\", "\\\\"); LOGGER.log(Level.FINEST, modifiedInstallDir); // Create short cut for uninstall.exe. wsShortMgr.createShortCut( folderName, Msg.get("UNINSTALL", null), modifiedInstallDir + "\\\\uninstall.exe", Msg.get("UNINSTALL", null), "-j \" & chr(34) & \"" + jdkHome.replace("\\", "\\\\") + "\" & chr(34)", modifiedInstallDir + "\\\\glassfish\\\\icons\\\\uninstall.ico", modifiedInstallDir, "2"); // Create short cut for Quick Start guide. wsShortMgr.createShortCut( folderName, Msg.get("QSGUIDE", null), modifiedInstallDir + "\\\\glassfish\\\\docs\\\\quickstart.html"); // Look for correct page deployed in the installdir before linking it. // this code is only w2k specific. String aboutFilesLocation = "\\glassfish\\docs\\"; String aboutFiles[] = {"about_sdk.html", "about_sdk_web.html", "about.html"}; // The default String aboutFile = "about.html"; // Traverse through the list to find out which file exist first for (int i = 0; i < aboutFiles.length; i++) { File f = new File(modifiedInstallDir + aboutFilesLocation + aboutFiles[i]); if (f.exists()) { // then break aboutFile = aboutFiles[i]; break; } f = null; } LOGGER.log(Level.FINEST, aboutFile); // Create short cut for About Page. wsShortMgr.createShortCut( folderName, Msg.get("ABOUT_GLASSFISH_SERVER", null), modifiedInstallDir + aboutFilesLocation.replace("\\", "\\\\") + aboutFile.replace("\\", "\\\\")); }
/** * Get individual Change HTML * * @param sb string to append to * @param columnName column name */ private void getChangeHTML(StringBuffer sb, String columnName) { if (get_Value(columnName) != null) { if (sb.length() > 0) sb.append("<br>"); sb.append(Msg.getElement(getCtx(), columnName)) .append(": ") .append(get_DisplayValue(columnName, true)); } else { String nc = getNullColumns(); if (nc != null && nc.indexOf(columnName) != -1) { if (sb.length() > 0) sb.append("<br>"); sb.append("(").append(Msg.getElement(getCtx(), columnName)).append(")"); } } } // getChangeHTML
/* Undo updatetool configuration and post-installation setups.*/ public void unconfigureUpdatetool() throws Exception { /* Try to shutdown the notifer. Don't do this on Mac, the notifier command does not work on Mac, refer to Issue #7348. */ if (!OSUtils.isMac() && !OSUtils.isAix()) { try { String shutdownCommand; if (OSUtils.isWindows()) { shutdownCommand = productRef.getInstallLocation() + "\\updatetool\\bin\\updatetool.exe"; } else { shutdownCommand = productRef.getInstallLocation() + "/updatetool/bin/updatetool"; } String[] shutdownCommandArray = {shutdownCommand, "--notifier", "--shutdown"}; LOGGER.log(Level.INFO, Msg.get("SHUTDOWN_NOTIFIER", null)); ExecuteCommand shutdownExecuteCommand = new ExecuteCommand(shutdownCommandArray); shutdownExecuteCommand.setOutputType(ExecuteCommand.ERRORS | ExecuteCommand.NORMAL); shutdownExecuteCommand.setCollectOutput(true); LOGGER.log( Level.FINEST, shutdownExecuteCommand.expandCommand(shutdownExecuteCommand.getCommand())); shutdownExecuteCommand.execute(); } catch (Exception e) { LOGGER.log(Level.FINEST, e.getMessage()); // Its okay to ignore this for now. } } /* End, conditional code for Mac and Aix. */ /* Now unregister notifer. */ try { String configCommand; if (OSUtils.isWindows()) { configCommand = productRef.getInstallLocation() + "\\updatetool\\bin\\updatetoolconfig.bat"; } else { configCommand = productRef.getInstallLocation() + "/updatetool/bin/updatetoolconfig"; } String[] configCommandArray = {configCommand, "--unregister"}; LOGGER.log(Level.INFO, Msg.get("UNREGISTER_NOTIFIER", null)); ExecuteCommand configExecuteCommand = new ExecuteCommand(configCommandArray); configExecuteCommand.setOutputType(ExecuteCommand.ERRORS | ExecuteCommand.NORMAL); configExecuteCommand.setCollectOutput(true); LOGGER.log( Level.FINEST, configExecuteCommand.expandCommand(configExecuteCommand.getCommand())); configExecuteCommand.execute(); } catch (Exception e) { LOGGER.log(Level.FINEST, e.getMessage()); // Its okay to ignore this for now. } }
private void setupUnixDomainScripts() { LOGGER.log(Level.INFO, Msg.get("SETUP_STARTSTOP_SCRIPTS", null)); try { FileIOUtils startFile = new FileIOUtils(); startFile.openFile(productRef.getInstallLocation() + "/glassfish/lib/asadmin-start-domain"); startFile.appendLine(GlassFishUtils.unixCopyRightNoticeText); startFile.appendLine( "\"" + productRef.getInstallLocation() + "/glassfish/bin/asadmin\" start-domain domain1"); startFile.saveFile(); startFile.closeFile(); FileIOUtils stopFile = new FileIOUtils(); stopFile.openFile(productRef.getInstallLocation() + "/glassfish/lib/asadmin-stop-domain"); stopFile.appendLine(GlassFishUtils.unixCopyRightNoticeText); stopFile.appendLine( "\"" + productRef.getInstallLocation() + "/glassfish/bin/asadmin\" stop-domain domain1"); stopFile.saveFile(); stopFile.closeFile(); org.glassfish.installer.util.FileUtils.setExecutable( new File(productRef.getInstallLocation() + "/glassfish/lib/asadmin-start-domain") .getAbsolutePath()); org.glassfish.installer.util.FileUtils.setExecutable( new File(productRef.getInstallLocation() + "/glassfish/lib/asadmin-stop-domain") .getAbsolutePath()); } catch (Exception ex) { LOGGER.log(Level.FINEST, ex.getMessage()); } }
/* Configure product glassfish */ public void configureGlassfish() throws EnhancedException { // set executable permissions on most used scripts String installDir = productRef.getInstallLocation(); if (!OSUtils.isWindows()) { LOGGER.log(Level.INFO, Msg.get("SETTING_EXECUTE_PERMISSIONS_FOR_GLASSFISH", null)); org.glassfish.installer.util.FileUtils.setAllFilesExecutable(installDir + "/glassfish/bin"); org.glassfish.installer.util.FileUtils.setAllFilesExecutable(installDir + "/bin"); if (org.glassfish.installer.util.FileUtils.isFileExist(installDir + "/mq/bin")) { org.glassfish.installer.util.FileUtils.setAllFilesExecutable(installDir + "/mq/bin"); } } // Update asenv updateConfigFile(); // Unpack all of *pack*ed files. unpackJars(); // create domain startup/shutdown wrapper scripts if (OSUtils.isWindows()) { setupWindowsDomainScripts(); createServerShortCuts(); } else { setupUnixDomainScripts(); } }
/* Unpack compressed jars. */ private void unpackJars() { // unpack jar files in all directories under glassfish/modules LOGGER.log(Level.INFO, Msg.get("UNPACK_HEADER", null)); String dirList[] = { productRef.getInstallLocation() + File.separator + "glassfish" + File.separator + "modules", productRef.getInstallLocation() + File.separator + "glassfish" + File.separator + "modules" + File.separator + "endorsed", productRef.getInstallLocation() + File.separator + "glassfish" + File.separator + "modules" + File.separator + "autostart" }; // if the jar extraction fails, then there is something really wrong. for (int i = 0; i < dirList.length; i++) { LOGGER.log(Level.FINEST, dirList[i]); Unpack modulesUnpack = new Unpack(new File(dirList[i]), new File(dirList[i])); if (!modulesUnpack.unpackJars()) { configSuccessful = false; } } }
protected void nextStep(Msg msg, int state, boolean beginning) { if (msg == null) { nextStep(null, 0, state, beginning); } else { nextStep(msg.buf(), state, beginning); } }
/* Create wrappers for asadmin start/stop on Windows. * This also should include copyright, that is currently taken from OSUtils. */ private void setupWindowsDomainScripts() { LOGGER.log(Level.INFO, Msg.get("SETUP_STARTSTOP_SCRIPTS", null)); try { FileIOUtils startFile = new FileIOUtils(); startFile.openFile( productRef.getInstallLocation() + "\\glassfish\\lib\\asadmin-start-domain.bat"); startFile.appendLine(GlassFishUtils.windowsCopyRightNoticeText); startFile.appendLine("setlocal"); startFile.appendLine( "call \"" + productRef.getInstallLocation() + "\\glassfish\\bin\\asadmin\" start-domain domain1\n"); startFile.appendLine("pause"); startFile.appendLine("endlocal"); startFile.saveFile(); startFile.closeFile(); FileIOUtils stopFile = new FileIOUtils(); stopFile.openFile( productRef.getInstallLocation() + "\\glassfish\\lib\\asadmin-stop-domain.bat"); stopFile.appendLine(GlassFishUtils.windowsCopyRightNoticeText); stopFile.appendLine("setlocal"); stopFile.appendLine( "call \"" + productRef.getInstallLocation() + "\\glassfish\\bin\\asadmin\" stop-domain domain1\n"); stopFile.appendLine("pause"); stopFile.appendLine("endlocal"); stopFile.saveFile(); stopFile.closeFile(); } catch (Exception ex) { LOGGER.log(Level.FINEST, ex.getMessage()); // OK to ignore this for now. } }
/*create updatetool wrapper script used by shortcut items */ private void setupUpdateToolScripts() { LOGGER.log(Level.INFO, Msg.get("SETUP_UPDATETOOL_SCRIPT", null)); org.glassfish.installer.util.FileUtils.createDirectory( productRef.getInstallLocation() + File.separator + "updatetool" + File.separator + "lib"); try { if (OSUtils.isWindows()) { FileIOUtils updateToolScript = new FileIOUtils(); updateToolScript.openFile( productRef.getInstallLocation() + "\\updatetool\\lib\\updatetool-start.bat"); updateToolScript.appendLine(GlassFishUtils.windowsCopyRightNoticeText); updateToolScript.appendLine("setlocal"); updateToolScript.appendLine( "cd \"" + productRef.getInstallLocation() + "\\updatetool\\bin\""); updateToolScript.appendLine("call updatetool.exe"); updateToolScript.appendLine("endlocal"); updateToolScript.saveFile(); updateToolScript.closeFile(); } else { FileIOUtils updateToolScript = new FileIOUtils(); updateToolScript.openFile( productRef.getInstallLocation() + "/updatetool/lib/updatetool-start"); updateToolScript.appendLine(GlassFishUtils.unixCopyRightNoticeText); updateToolScript.appendLine( "cd \"" + productRef.getInstallLocation() + "/updatetool/bin\""); updateToolScript.appendLine("./updatetool"); updateToolScript.saveFile(); updateToolScript.closeFile(); org.glassfish.installer.util.FileUtils.setExecutable( productRef.getInstallLocation() + "/updatetool/lib/updatetool-start"); } } catch (Exception ex) { LOGGER.log(Level.FINEST, ex.getMessage()); } }
/** * Execute Task and wait * * @return execution info */ public String execute() { String cmd = Msg.parseTranslation(Env.getCtx(), getOS_Command()).trim(); if (cmd == null || cmd.equals("")) return "Cannot execute '" + getOS_Command() + "'"; // if (isServerProcess()) return executeRemote(cmd); return executeLocal(cmd); } // execute
private static void doTemp() { int data = (46000 - JopSys.rd(BBSys.IO_ADC)) - 17000 + 4; // 4 for rounding if (data < 0) data = 0; data >>>= 3; // only 12 Bit Msg.write(data); }
public void sendNewBookingNotification(HttpServletRequest request, Booking booking) throws MailException, IOException { List<Contact> contactsToNotifyOnBooking = contactDAO.findAllForBookings(); if (!contactsToNotifyOnBooking.isEmpty()) { Mail mail = new Mail(); mail.setSubject( msg.get( "BookingSuccessfulMailSubjectAdmin", new Object[] { FormatUtils.DATE_HUMAN_READABLE.print(booking.getBookingDate()), FormatUtils.TIME_HUMAN_READABLE.print(booking.getBookingTime()), booking.getPlayer().toString() })); mail.setBody(msg.get("BookingSuccessfulMailBodyAdmin", getDetailBody(request, booking))); mail.setRecipients(contactsToNotifyOnBooking); mailUtils.send(mail, request); } }
/* Creates shortcuts for windows. The ones created from OI will be removed due to mangled names. These shortcuts are in addition to the ones created by default. Since the descriptor for defining the short cut entry is not OS specific, we still need to carry on the xml entries to create items on Gnome. */ private void createUpdatetoolShortCuts() { String folderName = (String) TemplateProcessor.getInstance().getFromDataModel("PRODUCT_NAME"); LOGGER.log(Level.INFO, Msg.get("CREATE_SHORTCUT_HEADER", new String[] {folderName})); WindowsShortcutManager wsShortMgr = new WindowsShortcutManager(); wsShortMgr.createFolder(folderName); String modifiedInstallDir = productRef.getInstallLocation().replace("\\", "\\\\"); LOGGER.log(Level.FINEST, modifiedInstallDir); // Create short cut for starting update tool. wsShortMgr.createShortCut( folderName, Msg.get("START_UPDATE_TOOL", null), modifiedInstallDir + "\\\\bin\\\\updatetool.exe", Msg.get("START_UPDATE_TOOL", null), "\"", modifiedInstallDir + "\\\\updatetool\\\\vendor-packages\\\\updatetool\\\\images\\\\application-update-tool.ico", modifiedInstallDir + "\\\\bin", "2"); }
// Writes a message to the underlying pipe. Returns false if the // message cannot be written because high watermark was reached. public boolean write(Msg msg_) { if (!check_write()) return false; boolean more = msg_.hasMore(); outpipe.write(msg_, more); if (!more) msgs_written++; return true; }
// Reads a message to the underlying pipe. public Msg read() { if (!in_active || (state != State.ACTIVE && state != State.PENDING)) return null; Msg msg_ = inpipe.read(); if (msg_ == null) { in_active = false; return null; } // If delimiter was read, start termination process of the pipe. if (msg_.isDelimiter()) { delimit(); return null; } if (!msg_.hasMore()) msgs_read++; if (lwm > 0 && msgs_read % lwm == 0) send_activate_write(peer, msgs_read); return msg_; }
private Object[] getDetailBody(HttpServletRequest request, Booking booking) { return new Object[] { booking.getPlayer().toString(), FormatUtils.DATE_HUMAN_READABLE.print(booking.getBookingDate()), FormatUtils.TIME_HUMAN_READABLE.print(booking.getBookingTime()), booking.getName(), msg.get(booking.getPaymentMethod().toString()), booking.getAmount(), booking.getCurrency(), RequestUtil.getBaseURL(request) + "/invoices/booking/" + booking.getUUID(), RequestUtil.getBaseURL(request) + "/admin/reports/booking/" + booking.getId() }; }
/* * OI hook to call individual product configurations. */ public ResultReport configure(final PropertySheet propSheet, final boolean validateFlag) throws EnhancedException { configSuccessful = true; /* Storing a reference of Property Sheet to a local Hash, so that other * parts of this class can access the configuration data anytime needed. */ setConfigData(propSheet.getAllProps()); try { if (productRef.getProductName().equals("Domain")) { LOGGER.log(Level.INFO, Msg.get("CONFIGURING_GLASSFISH", null)); configureGlassfish(); } } catch (Exception e) { // Don't do anything as major error detection is handled throughout // this class where appropriate and fatal. LOGGER.log(Level.FINEST, e.getMessage()); } try { if (productRef.getProductName().equals("UpdateTool")) { LOGGER.log(Level.INFO, Msg.get("CONFIGURING_UPDATETOOL", null)); configureUpdatetool(); } } catch (Exception e) { LOGGER.log(Level.FINEST, e.getMessage()); configSuccessful = false; } ResultReport.ResultStatus status = configSuccessful ? ResultReport.ResultStatus.SUCCESS : ResultReport.ResultStatus.FAIL; return new ResultReport( status, "http://www.oracle.com/pls/topic/lookup?ctx=821-2427&id=sjsaseeig ", "http://www.oracle.com/pls/topic/lookup?ctx=821-2427&id=sjsaseeig", null, productError); }
@Override public void send(DataOutputStream dos) { super.send(dos); int size; try { size = login.getBytes("UTF-8").length; // envio el tamaño del login para saber cuanto leer dos.write(Packer.pack(size)); dos.write(login.getBytes("UTF-8")); dos.flush(); } catch (IOException e) { e.printStackTrace(); } }