private static String getTypeFromMap(String uri) { int idx = uri.lastIndexOf("."); Text format = null; if (idx != -1) { String suff = uri.substring(idx + 1, uri.length()); if (suff.equalsIgnoreCase("xml")) return "xml"; format = (Text) TransformOutputFormat.mimetypeMap.get(new Text(suff)); } if (format == null) { return "binary"; } else { return format.toString(); } }
/** {@inheritDoc} */ @Override public void putAll(Map<? extends Writable, ? extends Writable> t) { for (Map.Entry<? extends Writable, ? extends Writable> e: t.entrySet()) { put(e.getKey(), e.getValue()); } }
public RDFReader(String version, LinkedMapWritable roleMap) { random = new Random(); randomValue = random.nextLong(); Calendar cal = Calendar.getInstance(); milliSecs = cal.getTimeInMillis(); compressed = false; this.version = version; this.roleMap = roleMap; roleMapExists = roleMap!=null && roleMap.size()>0 ; graphQry = new StringBuilder(); existingMapPerms = new HashMap<String,ContentPermission[]>(); newGraphs = new HashSet<String>(); }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public void readFields(DataInput in) throws IOException { super.readFields(in); // First clear the map. Otherwise we will just accumulate // entries every time this method is called. this.instance.clear(); // Read the number of entries in the map int entries = in.readInt(); // Then read each key/value pair for (int i = 0; i < entries; i++) { Writable key = (Writable) ReflectionUtils.newInstance(getClass( in.readByte()), getConf()); key.readFields(in); Writable value = (Writable) ReflectionUtils.newInstance(getClass( in.readByte()), getConf()); value.readFields(in); instance.put(key, value); } } }
LinkedMapWritable forestStatusMap = new LinkedMapWritable(); Text forest = null; List<ForestHost> replicas = new ArrayList<ForestHost>(); replicas.add(info); forestStatusMap.put(forest, new ForestInfo( hostName, dc, updatable, replicas)); forest = null; if (forestStatusMap.size() == 0) { throw new IOException("Target database has no forests attached: " + "check forests in database");
throw new IOException( "Server-side transform requires MarkLogic 7 or later"); mimetypeMap = new LinkedMapWritable(); while (result.hasNext()) { String suffs = result.next().asString(); mimetypeMap.put(suff, format);
LinkedHashSet<String> updatableForests = new LinkedHashSet<String>(); replicaMap = new LinkedHashMap<String, List<ForestHost> >(); for (Writable f : map.keySet()) { String fId = ((Text) f).toString(); ForestInfo fs = (ForestInfo) map.get(f); replicaMap.put(fId, fs.getReplicas()); if (fs.getUpdatable()) { long[] countAry = new long[updatableForests.size()]; for (int i = 0; i < countAry.length; i++) { countAry[i] = ((ForestInfo) map.get(new Text(uForests[i]))) .getFragmentCount(); long[] countAry = new long[updatableForests.size()]; for (int i = 0; i < countAry.length; i++) { countAry[i] = ((ForestInfo) map.get(new Text(uForests[i]))) .getFragmentCount(); long[] countAry = new long[updatableForests.size()]; for (int i = 0; i < countAry.length; i++) { countAry[i] = ((ForestInfo) map.get(new Text(uForests[i]))) .getFragmentCount();
/** {@inheritDoc} */ @Override public void write(DataOutput out) throws IOException { super.write(out); // Write out the number of entries in the map out.writeInt(instance.size()); // Then write out each key/value pair for (Map.Entry<Writable, Writable> e: instance.entrySet()) { out.writeByte(getId(e.getKey().getClass())); e.getKey().write(out); out.writeByte(getId(e.getValue().getClass())); e.getValue().write(out); } }
Text version = new Text(result.next().asString()); boolean hasFunc = Boolean.parseBoolean(result.next().asString()); LinkedMapWritable roleMap = new LinkedMapWritable(); if(hasFunc) { while (result.hasNext()) { roleMap.put(key, value);
if (restrictHosts) { rhUtil = new RestrictedHostsUtil(outputHosts); for (Writable forestId : forestStatusMap.keySet()) { String forestHost = ((ForestInfo)forestStatusMap.get(forestId)) .getHostName(); rhUtil.addForestHost(forestHost); for (Writable forestId : forestStatusMap.keySet()) { ForestInfo fs = (ForestInfo)forestStatusMap.get(forestId); List<ForestHost> forestHostList = fs.getReplicas(); for (int i = 0; i < forestHostList.size(); i++) {
throw new IOException("Invalid role map"); String roleName = roleMap.get(roleid).toString(); String cap = result.next().asString(); ContentCapability capability = PermissionUtil
throw new IOException("Invalid role,capability pair"); String roleName = roleMap.get(roleid).toString(); String cap = result.next().asString(); ContentCapability capability = PermissionUtil