Client client = caps.createClient(_c.getName()); client.setUserAgentPattern(_c.getUserAgentPattern()); client.setManufacturer(_c.getManufacturer()); client.setModel(_c.getModel()); client.setEvalOrder(_c.getEvalOrder()); String myPrefMimeType = _c.getPreferredMimeTypeID(); client.setVersion(_c.getVersion()); try _line = _c.getMimeTypesString().toString(); List<String> list = getTokens(_line); if ((list != null) && (list.size() > 0)) _line = _c.getCapabilitiesString().toString(); List<String> list = getTokens(_line); if ((list != null) && (list.size() > 0))
JSClient jsC = new JSClient(c); if (_mt != null) jsC.getMimeTypes().add(_mt); JSMimeType _mt = (JSMimeType) refs.mimeMapInt.get(id); if (_mt != null) jsC.setPreferredMimeTypeID(_mt.getName()); else jsC.setPreferredMimeTypeID("???"); JSCapability _ct = (JSCapability) refs.capabilityMap.get(_c .getName()); if (_ct != null) jsC.getCapabilities().add(_ct);
/** * extract the current clients and save in the snapshot file * * @param list * @param caps * @return * @throws SerializerException */ private void exportClients(Refs refs, JSSnapshot snapshot, Map<String,Object> settings, Logger log) throws SerializerException { /** first the the mime types */ exportMimeTypes(refs, snapshot, settings, log); /** second get the capabilities */ this.exportCapabilites(refs, snapshot, settings, log); /** now get the clients */ Iterator _it = caps.getClients(); while (_it.hasNext()) { Client c = (Client) _it.next(); JSClient jsC = createJSClient(refs, c); if (jsC == null) throw new SerializerException( SerializerException.CREATE_SERIALIZED_OBJECT_FAILED .create(new String[] { "Client", "createClient returned NULL"})); refs.clientMap.put(jsC.getName(), jsC); snapshot.getClients().add(jsC); } return; }
private String putTokens(ArrayList _list) { if ((_list == null) || (_list.size() == 0)) return ""; boolean _start = true; Iterator _it = _list.iterator(); StringBuffer _sb = new StringBuffer(); while (_it.hasNext()) { if (!_start) _sb.append(','); else _start = false; _sb.append(append(_it.next())); } return _sb.toString(); }