/** Listener to handle button actions */ public void actionPerformed(ActionEvent e) { // Check if the user changed the service filter option if (e.getSource() == service_box) { service_list.setEnabled(service_box.isSelected()); service_list.clearSelection(); remove_service_button.setEnabled(false); add_service_field.setEnabled(service_box.isSelected()); add_service_field.setText(""); add_service_button.setEnabled(false); } // Check if the user pressed the add service button if ((e.getSource() == add_service_button) || (e.getSource() == add_service_field)) { String text = add_service_field.getText(); if ((text != null) && (text.length() > 0)) { service_data.addElement(text); service_list.setListData(service_data); } add_service_field.setText(""); add_service_field.requestFocus(); } // Check if the user pressed the remove service button if (e.getSource() == remove_service_button) { Object[] sels = service_list.getSelectedValues(); for (int i = 0; i < sels.length; i++) { service_data.removeElement(sels[i]); } service_list.setListData(service_data); service_list.clearSelection(); } }
public void fireEvent(NCCPConnection.ConnectionEvent e) { ConnectionListener l; int max = listeners.size(); for (int i = 0; i < max; ++i) { ExpCoordinator.print( new String( "NCCPConnection.fireEvent (" + toString() + ") event: " + e.getType() + " max:" + max + " i:" + i), 2); l = (ConnectionListener) (listeners.elementAt(i)); switch (e.getType()) { case ConnectionEvent.CONNECTION_FAILED: l.connectionFailed(e); break; case ConnectionEvent.CONNECTION_CLOSED: l.connectionClosed(e); break; case ConnectionEvent.CONNECTION_OPENED: ExpCoordinator.printer.print( new String("Opened control connection (" + toString() + ")")); l.connectionOpened(e); } } }
/** Constructor */ public SOAPMonitorFilter() { // By default, exclude NotificationService and // EventViewerService messages filter_exclude_list = new Vector(); filter_exclude_list.addElement("NotificationService"); filter_exclude_list.addElement("EventViewerService"); }
/** Get row count (part of table model interface) */ public int getRowCount() { int count = data.size(); if (filter_data != null) { count = filter_data.size(); } return count; }
public void addConnectionListener(NCCPConnection.ConnectionListener l) { if (!listeners.contains(l)) { ExpCoordinator.printer.print( new String("NCCPConnection.addConnectionListener to " + toString()), 6); listeners.add(l); } }
/** * Creates a new, empty SessionDescription. The session is set as follows: * * <p>v=0 * * <p>o=this.createOrigin ("user", InetAddress.getLocalHost().toString()); * * <p>s=- * * <p>t=0 0 * * @throws SdpException SdpException, - if there is a problem constructing the SessionDescription. * @return a new, empty SessionDescription. */ public SessionDescription createSessionDescription() throws SdpException { SessionDescriptionImpl sessionDescriptionImpl = new SessionDescriptionImpl(); ProtoVersionField ProtoVersionField = new ProtoVersionField(); ProtoVersionField.setVersion(0); sessionDescriptionImpl.setVersion(ProtoVersionField); OriginField originImpl = null; try { originImpl = (OriginField) this.createOrigin("user", InetAddress.getLocalHost().getHostAddress()); } catch (UnknownHostException e) { e.printStackTrace(); } sessionDescriptionImpl.setOrigin(originImpl); SessionNameField sessionNameImpl = new SessionNameField(); sessionNameImpl.setValue("-"); sessionDescriptionImpl.setSessionName(sessionNameImpl); TimeDescriptionImpl timeDescriptionImpl = new TimeDescriptionImpl(); TimeField timeImpl = new TimeField(); timeImpl.setZero(); timeDescriptionImpl.setTime(timeImpl); Vector times = new Vector(); times.addElement(timeDescriptionImpl); sessionDescriptionImpl.setTimeDescriptions(times); sessionDescriptionsList.addElement(sessionDescriptionImpl); return sessionDescriptionImpl; }
public void removeUser(String strChannel) { Vector vtData = tblUser.getFilteredData(); for (int iIndex = 0; iIndex < vtData.size(); iIndex++) { Vector vtRow = (Vector) vtData.elementAt(iIndex); if (vtRow.elementAt(0).equals(strChannel)) tblUser.deleteRow(iIndex); } }
public void changeDictionary(String strLanguage) { // Change dictionary MonitorDictionary.setCurrentLanguage(strLanguage); DefaultDictionary.setCurrentLanguage(strLanguage); ErrorDictionary.setCurrentLanguage(strLanguage); // Update UI updateLanguage(); WindowManager.updateLanguage(); int iIndex = mvtLanguage.indexOf(strLanguage); if (iIndex >= 0) { JRadioButtonMenuItem mnu = (JRadioButtonMenuItem) mvtLanguageItem.elementAt(iIndex); mnu.setSelected(true); } // Store config Hashtable prt = null; try { prt = Global.loadHashtable(Global.FILE_CONFIG); } catch (Exception e) { prt = new Hashtable(); } prt.put("Language", strLanguage); try { Global.storeHashtable(prt, Global.FILE_CONFIG); } catch (Exception e) { } }
public void doCall(String method, Object value) throws Exception { Call call = new Call(); call.setTargetObjectURI("http://soapinterop.org/"); call.setMethodName(method); call.setEncodingStyleURI(encodingStyleURI); Vector params = new Vector(); params.addElement(new Parameter("in", value.getClass(), value, null)); call.setParams(params); // make the call: note that the action URI is empty because the // XML-SOAP rpc router does not need this. This may change in the // future. Response resp = call.invoke(url, ""); // Check the response. if (resp.generatedFault()) { Fault fault = resp.getFault(); System.out.println("Ouch, the call failed: "); System.out.println(" Fault Code = " + fault.getFaultCode()); System.out.println(" Fault String = " + fault.getFaultString()); } else { Parameter result = resp.getReturnValue(); System.out.println("Call succeeded: "); System.out.println("Result = " + result.getValue()); } }
public void removeConnectionListener(NCCPConnection.ConnectionListener l) { if (listeners.contains(l)) { // ExpCoordinator.printer.print(new String("NCCPConnection.removeConnectionListener to " + // toString()), 2); listeners.remove(l); } }
public static void main(String[] args) throws SdpParseException, SdpException { String sdpFields = "v=0\r\n" + "o=4855 13760799956958020 13760799956958020 IN IP4 166.35.224.216\r\n" + "s=nortelnetworks\r\n" + "p=+1 972 684 1000\r\n" + "c=IN IP4 166.35.224.216\r\n" + "t=0 0\r\n" + "m=audio 50006 RTP/AVP 0 8 4 18\r\n" + "a=rtpmap:0 PCMU/8000\r\n" + "a=rtpmap:8 PCMA/8000\r\n" + "a=rtpmap:4 G723/8000\r\n" + "a=rtpmap:18 G729A/8000\r\n" + "a=ptime:30\r\n"; SdpFactory sdpFactory = new SdpFactory(); SessionDescription sessionDescription = sdpFactory.createSessionDescription(sdpFields); System.out.println("sessionDescription = " + sessionDescription); Vector mediaDescriptions = sessionDescription.getMediaDescriptions(true); for (int i = 0; i < mediaDescriptions.size(); i++) { MediaDescription m = (MediaDescription) mediaDescriptions.elementAt(i); System.out.println("m = " + m.toString()); Media media = m.getMedia(); Vector formats = media.getMediaFormats(false); System.out.println("formats = " + formats); } }
/** Utility method to stuff an entire enumeration into a vector */ public static Vector Enum2Vector(Enumeration e) { Vector v = new Vector(); while (e.hasMoreElements()) { v.add(e.nextElement()); } return v; }
public void setConnected(boolean b, boolean process_pending) { if (b && state != ConnectionEvent.CONNECTION_OPENED) { if (host.length() > 0) ExpCoordinator.print( "NCCPConnection open connection to ipaddress " + host + " port " + port); state = ConnectionEvent.CONNECTION_OPENED; // connected = true; fireEvent(new ConnectionEvent(this, state)); ExpCoordinator.printer.print("NCCPConnection.setConnected " + b + " event fired", 8); if (process_pending) { int max = pendingMessages.size(); ExpCoordinator.printer.print(new String(" pendingMessages " + max + " elements"), 8); for (int i = 0; i < max; ++i) { sendMessage((NCCP.Message) pendingMessages.elementAt(i)); } pendingMessages.removeAllElements(); } } else { if (!b && (state != ConnectionEvent.CONNECTION_CLOSED || state != ConnectionEvent.CONNECTION_FAILED)) { if (host.length() > 0) ExpCoordinator.print( new String( "NCCPConnection.setConnected -- Closed control socket for " + host + "." + port)); state = ConnectionEvent.CONNECTION_CLOSED; fireEvent(new ConnectionEvent(this, state)); } } }
/** List file names */ public Enumeration nlst(String s) throws IOException { InetAddress inetAddress = InetAddress.getLocalHost(); byte ab[] = inetAddress.getAddress(); serverSocket_ = new ServerSocket(0, 1); StringBuffer sb = new StringBuffer(32); sb.append("PORT "); for (int i = 0; i < ab.length; i++) { sb.append(String.valueOf(ab[i] & 255)); sb.append(","); } sb.append(String.valueOf(serverSocket_.getLocalPort() >>> 8 & 255)); sb.append(","); sb.append(String.valueOf(serverSocket_.getLocalPort() & 255)); if (issueCommand(sb.toString()) != FTP_SUCCESS) { serverSocket_.close(); throw new IOException(getResponseString()); } else if (issueCommand("NLST " + ((s == null) ? "" : s)) != FTP_SUCCESS) { serverSocket_.close(); throw new IOException(getResponseString()); } dataSocket_ = serverSocket_.accept(); serverSocket_.close(); serverSocket_ = null; Vector v = readServerResponse_(dataSocket_.getInputStream()); dataSocket_.close(); dataSocket_ = null; return (v == null) ? null : v.elements(); }
protected void layoutFooter(Page page) { ServletUtil.doLayoutFooter( page, (footnotes == null ? null : footnotes.iterator()), getLockssApp().getVersionInfo()); if (footnotes != null) { footnotes.removeAllElements(); } }
public void addJavaLibraries() { final Vector<String> packages = JavaEnvUtils.getJrePackages(); final Enumeration<String> e = packages.elements(); while (e.hasMoreElements()) { final String packageName = e.nextElement(); this.addSystemPackageRoot(packageName); } }
protected Vector /* of Object */ queryAssertionLines1(String query) throws IOException { write(query); Vector v = readlines(); Vector r = new Vector(); for (Enumeration e = v.elements(); e.hasMoreElements(); ) { r.addElement(TT.stringToObject((String) e.nextElement())); } return r; }
/** Get the data for a row */ public SOAPMonitorData getData(int row) { SOAPMonitorData soap = null; if (filter_data == null) { soap = (SOAPMonitorData) data.elementAt(row); } else { soap = (SOAPMonitorData) filter_data.elementAt(row); } return soap; }
public void sendGlobalServerMsg(String msg) { int i; connection you; for (i = 0; i < connections.size(); i++) { you = (connection) connections.elementAt(i); you.sendServerMsg(msg); } }
// ------------------------------------------------------------ // test whether "s1" and "s2" share substring, each substring // is deliminated by "delim" // ------------------------------------------------------------ public static boolean shareString(String s1, String s2, String delim) { Vector v1 = str2vec(s1, delim); Vector v2 = str2vec(s2, delim); for (int i = 0; i < v1.size(); i++) { String s = (String) v1.elementAt(i); if (v2.contains(s)) return true; } return false; }
private static Vector str2vec(String str, String delim) { Vector v = new Vector(5); StringTokenizer st = new StringTokenizer(str, delim); while (st.hasMoreTokens()) { String s = st.nextToken(); v.addElement(s); } return v; }
public PDBChain findChain(String id) { for (int i = 0; i < chains.size(); i++) { // System.out.println("ID = " + id + " " +((PDBChain)chains.elementAt(i)).id); if (((PDBChain) chains.elementAt(i)).id.equals(id)) { return (PDBChain) chains.elementAt(i); } } return null; }
/** Find the row in the table for a given message id */ public int findRow(SOAPMonitorData soap) { int row = -1; if (filter_data != null) { row = filter_data.indexOf(soap); } else { row = data.indexOf(soap); } return row; }
/** Load all of the named resource. */ private void loadAllResources(Vector v, String name) { boolean anyLoaded = false; try { URL[] urls; ClassLoader cld = null; // First try the "application's" class loader. cld = SecuritySupport.getContextClassLoader(); if (cld == null) cld = this.getClass().getClassLoader(); if (cld != null) urls = SecuritySupport.getResources(cld, name); else urls = SecuritySupport.getSystemResources(name); if (urls != null) { if (LogSupport.isLoggable()) LogSupport.log("MimetypesFileTypeMap: getResources"); for (int i = 0; i < urls.length; i++) { URL url = urls[i]; InputStream clis = null; if (LogSupport.isLoggable()) LogSupport.log("MimetypesFileTypeMap: URL " + url); try { clis = SecuritySupport.openStream(url); if (clis != null) { v.addElement(new MimeTypeFile(clis)); anyLoaded = true; if (LogSupport.isLoggable()) LogSupport.log( "MimetypesFileTypeMap: " + "successfully loaded " + "mime types from URL: " + url); } else { if (LogSupport.isLoggable()) LogSupport.log( "MimetypesFileTypeMap: " + "not loading " + "mime types from URL: " + url); } } catch (IOException ioex) { if (LogSupport.isLoggable()) LogSupport.log("MimetypesFileTypeMap: can't load " + url, ioex); } catch (SecurityException sex) { if (LogSupport.isLoggable()) LogSupport.log("MimetypesFileTypeMap: can't load " + url, sex); } finally { try { if (clis != null) clis.close(); } catch (IOException cex) { } } } } } catch (Exception ex) { if (LogSupport.isLoggable()) LogSupport.log("MimetypesFileTypeMap: can't load " + name, ex); } // if failed to load anything, fall back to old technique, just in case if (!anyLoaded) { LogSupport.log("MimetypesFileTypeMap: !anyLoaded"); MimeTypeFile mf = loadResource("/" + name); if (mf != null) v.addElement(mf); } }
/** * This method takes care of some special generic Maui events. It should be called before the Maui * application handles the event. * * @param mauiApp Reference to the MauiApplication associated with the events * @param eventVector The same event vector that is passed to the Maui app. * @param paramHash Hashtable of HTTP parameters * @param response The HTTPResponse object which will be sent back to the client */ private void processEvent( MauiApplication mauiApp, Vector eventVector, Hashtable paramHash, HTTPRequest request, HTTPResponse response) { boolean passEventToMauiApp = true; try { if (eventVector != null && !eventVector.isEmpty()) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Component events // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - String componentID = (String) eventVector.lastElement(); // If there are parentheses... if (componentID.startsWith("(") && componentID.endsWith(")")) { // ... strip them off! componentID = componentID.substring(1, componentID.length() - 1); } // // Strip off prefix - some wml browsers don't like variables that begin with a digit // if (componentID.startsWith("IDz")) { componentID = componentID.substring(3); } { System.err.println("componentID: " + componentID); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Pass events to Maui application // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Check for a content-type override String contentType = null; { if ((contentType = request.getQueryValue("contentType")) != null) { response.setContentType(contentType); } else { response.setContentType("x-wap.wml"); } } response.setContent(mauiApp.render().getBytes()); } else { response.setContentType("text/vnd.wap.wml"); response.setContent(mauiApp.render().getBytes()); } } catch (Exception e) { response.setContentType(getBaseContentType()); response.setContent((generateExceptionMessage(e)).getBytes()); e.printStackTrace(System.err); } }
public void addMenuItem(String text, String loc) { locations.put(text, loc); if (filenames.contains("Test Text")) { filenames.remove("Test Text"); filenames.addElement(text); } else { filenames.addElement(text); } createPopupMenu(); }
public Session findSessionTo(String to) { int n = clients.size(); Log.fine(Name + ": looking for client to " + to); for (int i = 0; i < n; i++) { Session ias = clients.elementAt(i); Log.fine(Name + ": client " + i + " id is " + ias.sid); if (ias.sid.startsWith(to)) return ias; } return null; }
public Session findSession(String id) { int n = clients.size(); Log.fine(Name + ": looking for client with id " + id); for (int i = 0; i < n; i++) { Session ias = clients.elementAt(i); Log.fine(Name + ": client " + i + " id is " + ias.sid); if (ias.sid.equals(id)) return ias; } return null; }
public boolean existLogin(String login) { boolean res = false; for (int i = 0; i < mClients.size(); i++) { ClientInfo clientInfo = (ClientInfo) mClients.get(i); if (login.equals(clientInfo.login)) { res = true; } } return res; }
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ public boolean yaEsta(String nombre) { boolean siOno = false; for (int a = 0; a < vectorJugadores.size(); a++) { if (nombre.equals(vectorJugadores.get(a))) { siOno = true; break; } } return siOno; }