code
stringlengths
73
34.1k
label
stringclasses
1 value
public String getReferenceText() { if (DataTable_Type.featOkTst && ((DataTable_Type)jcasType).casFeat_referenceText == null) jcasType.jcas.throwFeatMissing("referenceText", "ch.epfl.bbp.uima.types.DataTable"); return jcasType.ll_cas.ll_getStringValue(addr, ((DataTable_Type)jcasType).casFeatCode_referenceT...
java
public void setReferenceText(String v) { if (DataTable_Type.featOkTst && ((DataTable_Type)jcasType).casFeat_referenceText == null) jcasType.jcas.throwFeatMissing("referenceText", "ch.epfl.bbp.uima.types.DataTable"); jcasType.ll_cas.ll_setStringValue(addr, ((DataTable_Type)jcasType).casFeatCode_referenceTe...
java
public int getPageNumber() { if (DataTable_Type.featOkTst && ((DataTable_Type)jcasType).casFeat_pageNumber == null) jcasType.jcas.throwFeatMissing("pageNumber", "ch.epfl.bbp.uima.types.DataTable"); return jcasType.ll_cas.ll_getIntValue(addr, ((DataTable_Type)jcasType).casFeatCode_pageNumber);}
java
public void setPageNumber(int v) { if (DataTable_Type.featOkTst && ((DataTable_Type)jcasType).casFeat_pageNumber == null) jcasType.jcas.throwFeatMissing("pageNumber", "ch.epfl.bbp.uima.types.DataTable"); jcasType.ll_cas.ll_setIntValue(addr, ((DataTable_Type)jcasType).casFeatCode_pageNumber, v);}
java
public FSArray getWordForms() { if (Token_Type.featOkTst && ((Token_Type)jcasType).casFeat_wordForms == null) jcasType.jcas.throwFeatMissing("wordForms", "com.digitalpebble.rasp.Token"); return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode...
java
public void setWordForms(FSArray v) { if (Token_Type.featOkTst && ((Token_Type)jcasType).casFeat_wordForms == null) jcasType.jcas.throwFeatMissing("wordForms", "com.digitalpebble.rasp.Token"); jcasType.ll_cas.ll_setRefValue(addr, ((Token_Type)jcasType).casFeatCode_wordForms, jcasType.ll_cas.ll_getFSRef(v)...
java
public WordForm getWordForms(int i) { if (Token_Type.featOkTst && ((Token_Type)jcasType).casFeat_wordForms == null) jcasType.jcas.throwFeatMissing("wordForms", "com.digitalpebble.rasp.Token"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_wordForms)...
java
public void setWordForms(int i, WordForm v) { if (Token_Type.featOkTst && ((Token_Type)jcasType).casFeat_wordForms == null) jcasType.jcas.throwFeatMissing("wordForms", "com.digitalpebble.rasp.Token"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Token_Type)jcasType).casFeatCode_w...
java
public boolean trainOnAll() { List<Map<String, String>> trueLabels = loadLabels(_trueLabelsFile); List<String> corpus = loadTrainingCorpus(_trainingCorpusFile); List<List<Acronym>> trainingExtractedCandidates = new ArrayList<List<Acronym>>(); List<Map<String, String>> trueLabelsForTraining = new ArrayList<Map...
java
public boolean trainOnCandidates() { List<String> corpus = loadTrainingCorpus(_trainingCorpusFile); List<List<Acronym>> trainingExtractedCandidates = new ArrayList<List<Acronym>>(); for (Integer docID = 0; docID < corpus.size(); ++docID) { // Adds to training examples, all the extracted pairs from the //...
java
public String getBiolexicon_id() { if (POSVerb_Type.featOkTst && ((POSVerb_Type)jcasType).casFeat_biolexicon_id == null) jcasType.jcas.throwFeatMissing("biolexicon_id", "ch.epfl.bbp.uima.types.POSVerb"); return jcasType.ll_cas.ll_getStringValue(addr, ((POSVerb_Type)jcasType).casFeatCode_biolexicon_id);}
java
public void setBiolexicon_id(String v) { if (POSVerb_Type.featOkTst && ((POSVerb_Type)jcasType).casFeat_biolexicon_id == null) jcasType.jcas.throwFeatMissing("biolexicon_id", "ch.epfl.bbp.uima.types.POSVerb"); jcasType.ll_cas.ll_setStringValue(addr, ((POSVerb_Type)jcasType).casFeatCode_biolexicon_id, v);}
java
public void setBody(String body) { String xbody = body; String [] row = xbody.split("\n"); for(int i=0; i<row.length; i++){ this.m_xbody.add(row[i]); } }
java
public void setHeading(String heading) { String m_heading = heading; String [] preCol = m_heading.split("\n"); String [][] cells = new String[preCol.length][this.m_columnNumber]; for(int i=0; i<preCol.length; i++) cells[i] = preCol[i].split(";", this.m_col...
java
public void setValidTable(TableCandidate tc) { /** * TODO [improve]: Table/TableCandidate not match * */ this.setHeight(tc.getHeight()); this.setWidth(tc.getWidth()); this.setCaption(tc.getCaption()); this.setRowNumber(tc.getRows().size()); this.setColumnNumber(tc....
java
public String getLexical_condition() { if (RelationMention_Type.featOkTst && ((RelationMention_Type)jcasType).casFeat_lexical_condition == null) jcasType.jcas.throwFeatMissing("lexical_condition", "de.julielab.jules.types.ace.RelationMention"); return jcasType.ll_cas.ll_getStringValue(addr, ((RelationMent...
java
public void setLexical_condition(String v) { if (RelationMention_Type.featOkTst && ((RelationMention_Type)jcasType).casFeat_lexical_condition == null) jcasType.jcas.throwFeatMissing("lexical_condition", "de.julielab.jules.types.ace.RelationMention"); jcasType.ll_cas.ll_setStringValue(addr, ((RelationMenti...
java
public Relation getRelation_ref() { if (RelationMention_Type.featOkTst && ((RelationMention_Type)jcasType).casFeat_relation_ref == null) jcasType.jcas.throwFeatMissing("relation_ref", "de.julielab.jules.types.ace.RelationMention"); return (Relation)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRef...
java
public void setRelation_ref(Relation v) { if (RelationMention_Type.featOkTst && ((RelationMention_Type)jcasType).casFeat_relation_ref == null) jcasType.jcas.throwFeatMissing("relation_ref", "de.julielab.jules.types.ace.RelationMention"); jcasType.ll_cas.ll_setRefValue(addr, ((RelationMention_Type)jcasType...
java
private void loadMappings() { for (int i = 0; i < mappings.length; i++) { String[] pair = mappings[i].split(";"); if (pair.length < 2) { try { throw new AnnotatorConfigurationException(); } catch (AnnotatorConfigurationException e) { LOGGER.error("[OpenNLP Parser: ]" + e.getMessage()); ...
java
private void annotate(Parse parse, JCas cas, Constituent parent) throws SecurityException, IllegalArgumentException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { Constituent cons = null; Span span = parse.getSpan(); String l...
java
private void makeFunAnnotations(Constituent cons, String[] funCatLabels) { if (funCatLabels != null && funCatLabels.length > 1) { String labeltype; for (int i = 1; i < funCatLabels.length; i++) { labeltype = funTable.get(funCatLabels[i]); if (labeltype != null) { Class c = cons.getClass(); if...
java
private void initBracketMap() { escMap.put("(", "-LRB-"); escMap.put(")", "-RRB-"); escMap.put("{", "-LCB-"); escMap.put("}", "-RCB-"); escMap.put("[", "-LSB-"); escMap.put("]", "-RSB-"); }
java
private void initFunMap() { funTable.put("ADV", "formFuncDisc"); funTable.put("NOM", "formFuncDisc"); funTable.put("DTV", "gramRole"); funTable.put("LGS", "gramRole"); funTable.put("PRD", "gramRole"); funTable.put("PUT", "gramRole"); funTable.put("SBJ", "gramRole"); funTable.put("VOC", "gramRole"); ...
java
private String[] getLoadline(Pair<BrainRegion, BrainRegion> pair, int pmId) { BrainRegion br1 = pair.getKey(); BrainRegion br2 = pair.getValue(); return new String[] { pmId + "",// br1.getCoveredText().replaceAll("(\\r|\\n|\\t)", ""), br1.getBegi...
java
public void eval(int[] context, double[] outsums) { for (int oid = 0; oid < numOutcomes; oid++) { outsums[oid] = iprob; numfeats[oid] = 0; } int[] activeOutcomes; double[] activeParameters; for (int i = 0; i < context.length; i++) { Context predParams = params[context[i]]; a...
java
public boolean getHasBold() { if (DocumentBlock_Type.featOkTst && ((DocumentBlock_Type)jcasType).casFeat_hasBold == null) jcasType.jcas.throwFeatMissing("hasBold", "ch.epfl.bbp.uima.types.DocumentBlock"); return jcasType.ll_cas.ll_getBooleanValue(addr, ((DocumentBlock_Type)jcasType).casFeatCode_hasBold);}
java
public void setHasBold(boolean v) { if (DocumentBlock_Type.featOkTst && ((DocumentBlock_Type)jcasType).casFeat_hasBold == null) jcasType.jcas.throwFeatMissing("hasBold", "ch.epfl.bbp.uima.types.DocumentBlock"); jcasType.ll_cas.ll_setBooleanValue(addr, ((DocumentBlock_Type)jcasType).casFeatCode_hasBold, v)...
java
public boolean getHasManyFontsizes() { if (DocumentBlock_Type.featOkTst && ((DocumentBlock_Type)jcasType).casFeat_hasManyFontsizes == null) jcasType.jcas.throwFeatMissing("hasManyFontsizes", "ch.epfl.bbp.uima.types.DocumentBlock"); return jcasType.ll_cas.ll_getBooleanValue(addr, ((DocumentBlock_Type)jcasT...
java
public void setHasManyFontsizes(boolean v) { if (DocumentBlock_Type.featOkTst && ((DocumentBlock_Type)jcasType).casFeat_hasManyFontsizes == null) jcasType.jcas.throwFeatMissing("hasManyFontsizes", "ch.epfl.bbp.uima.types.DocumentBlock"); jcasType.ll_cas.ll_setBooleanValue(addr, ((DocumentBlock_Type)jcasTy...
java
public java.util.List<Object> getAppOrRefList() { if (appOrRefList == null) { appOrRefList = new ArrayList<Object>(); } return this.appOrRefList; }
java
private static String getHelp() { StringBuffer sb = new StringBuffer(); // SRE sb.append("\njSRE: Simple Relation Extraction V1.10\t 30.08.06\n"); sb.append("developed by Claudio Giuliano (giuliano@itc.it)\n\n"); // License sb.append("Copyright 2005 FBK-irst (http://www.fbk.eu)\n"); sb.append("\n"); ...
java
public void clear(String what) { if (what.equals("blockers")) blockers.clear(); else if (what.equals("datasets")) datasets.clear(); else if (what.equals("learners")) learners.clear(); else if (what.equals("all")) { clear("blockers"); clear("datasets"); clear("learners"); } else { System.out.println...
java
public void show(String what) { if (what.equals("blockers")) showList("blockers",blockerNames); else if (what.equals("datasets")) showList("datasets", datasetNames); else if (what.equals("learners")) showList("learners", learnerNames); else if (what.equals("all")) { show("blockers"); show("datasets"); ...
java
public void dataset(String dataFile) throws MatchData.InputFormatException { datasets.add( new MatchData(dataFile) ); datasetNames.add( dataFile ); expt = null; }
java
public void learner(String learnerClass) { learners.add( DistanceLearnerFactory.build( learnerClass )); learnerNames.add( learnerClass ); expt = null; }
java
public void blocker(String blockerClass) throws ClassNotFoundException,InstantiationException,IllegalAccessException { blockers.add( Class.forName(BLOCKER_PACKAGE+blockerClass).newInstance() ); blockerNames.add( blockerClass ); expt = null; }
java
public void blocker(String blockerClass, String param, String value) throws ClassNotFoundException,InstantiationException,IllegalAccessException, InvocationTargetException,NoSuchMethodException { Blocker blocker = (Blocker)Class.forName(BLOCKER_PACKAGE+blockerClass).newInstance(); // upperCase the first l...
java
public void compute() { if (!computable) { throw new RuntimeException("can't re-'compute' experiment results after a 'restore'"); } expt = new MatchExpt[blockers.size()][learners.size()][datasets.size()]; for (int i=0; i<blockers.size(); i++) { Blocker blocker = (Blocker)blockers.get(i); for (int j=0...
java
public void table(String what) throws NoSuchMethodException,IllegalAccessException,InvocationTargetException { PrintfFormat dfmt = new PrintfFormat("Dataset %2d:"); PrintfFormat fmt = new PrintfFormat(" %9.5f "); PrintfFormat nfmt = new PrintfFormat(" %11s"); if (expt==null) compute(); for (int i=0; i<block...
java
public void save(String file) throws IOException,FileNotFoundException { ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file)); oos.writeObject(blockerNames); oos.writeObject(datasetNames); oos.writeObject(learnerNames); oos.writeObject(expt); oos.close(); }
java
public void restore(String file) throws IOException,FileNotFoundException,ClassNotFoundException { ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file)); blockerNames = (List)ois.readObject(); datasetNames = (List)ois.readObject(); learnerNames = (List)ois.readObject(); expt = (MatchExpt[]...
java
public void runScript(String configFileName) { int lineNum = 0; try { BufferedReader in = new BufferedReader(new FileReader(configFileName)); String line; while ((line = in.readLine())!=null) { lineNum++; if (!line.startsWith("#")) { String command = null; List args = new ArrayLis...
java
private void execCommand(String command,List args) throws NoSuchMethodException,IllegalAccessException,InvocationTargetException { Class[] template = new Class[ args.size() ]; for (int i=0; i<args.size(); i++) { template[i] = String.class; } Method m = MatchExptScript.class.getMethod(command, template );...
java
public StringWrapper prepare(String s) { BagOfTokens bag = new BagOfTokens(s, tokenizer.tokenize(s)); // reweight by -log( freq/collectionSize ) double normalizer = 0.0; for (Iterator i=bag.tokenIterator(); i.hasNext(); ) { Token tok = (Token)i.next(); if (collectionSize>0) { Integer dfInteger = (Inte...
java
public static String format(String msg, Object... args) { if (args == null || args.length == 0) return msg; StringBuilder sb = new StringBuilder(); int argId = 0; for (int i = 0; i < msg.length(); i++) { final char c = msg.charAt(i); if (c == '{' &&...
java
public Token[] tokenize(String input) { Token[] initialTokens = innerTokenizer.tokenize(input); List tokens = new ArrayList(); for (int i=0; i<initialTokens.length; i++) { Token tok = initialTokens[i]; String str = "^"+tok.getValue()+"$"; if (keepOldToken...
java
public FSArray getCategories() { if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_categories == null) jcasType.jcas.throwFeatMissing("categories", "de.julielab.jules.types.wikipedia.Descriptor"); return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((Des...
java
public void setCategories(FSArray v) { if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_categories == null) jcasType.jcas.throwFeatMissing("categories", "de.julielab.jules.types.wikipedia.Descriptor"); jcasType.ll_cas.ll_setRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_categor...
java
public Title getCategories(int i) { if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_categories == null) jcasType.jcas.throwFeatMissing("categories", "de.julielab.jules.types.wikipedia.Descriptor"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)j...
java
public void setCategories(int i, Title v) { if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_categories == null) jcasType.jcas.throwFeatMissing("categories", "de.julielab.jules.types.wikipedia.Descriptor"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Descript...
java
public FSArray getOutgoingLinks() { if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_outgoingLinks == null) jcasType.jcas.throwFeatMissing("outgoingLinks", "de.julielab.jules.types.wikipedia.Descriptor"); return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(ad...
java
public void setOutgoingLinks(FSArray v) { if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_outgoingLinks == null) jcasType.jcas.throwFeatMissing("outgoingLinks", "de.julielab.jules.types.wikipedia.Descriptor"); jcasType.ll_cas.ll_setRefValue(addr, ((Descriptor_Type)jcasType).casFeatCod...
java
public Title getOutgoingLinks(int i) { if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_outgoingLinks == null) jcasType.jcas.throwFeatMissing("outgoingLinks", "de.julielab.jules.types.wikipedia.Descriptor"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Descript...
java
public void setOutgoingLinks(int i, Title v) { if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_outgoingLinks == null) jcasType.jcas.throwFeatMissing("outgoingLinks", "de.julielab.jules.types.wikipedia.Descriptor"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, (...
java
public StringArray getRedirects() { if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_redirects == null) jcasType.jcas.throwFeatMissing("redirects", "de.julielab.jules.types.wikipedia.Descriptor"); return (StringArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ...
java
public void setRedirects(StringArray v) { if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_redirects == null) jcasType.jcas.throwFeatMissing("redirects", "de.julielab.jules.types.wikipedia.Descriptor"); jcasType.ll_cas.ll_setRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_redire...
java
public String getRedirects(int i) { if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_redirects == null) jcasType.jcas.throwFeatMissing("redirects", "de.julielab.jules.types.wikipedia.Descriptor"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jca...
java
public void setRedirects(int i, String v) { if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_redirects == null) jcasType.jcas.throwFeatMissing("redirects", "de.julielab.jules.types.wikipedia.Descriptor"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor...
java
public java.util.List<Object> getRid() { if (rid == null) { rid = new ArrayList<Object>(); } return this.rid; }
java
public static Pipeline parse(File scriptFile, List<String> replacementVars) throws ParseException, IOException { checkArgument( scriptFile.exists(), "could not find pipeline script file at " + scriptFile.getAbsolutePath()); return parse...
java
public static Pipeline parse(List<String> scriptLines, String parentFilePath, List<String> replacementVars) throws ParseException, IOException { if (replacementVars == null) replacementVars = new ArrayList<String>(); // parse Pipeline pipeline = parseAndDispa...
java
private static void parsePython(IteratorWithPrevious<String> it, Pipeline pipeline) throws ParseException { String script = ""; while (it.hasNext()) { String current = it.next(); if (StringUtils.isBlank(current)) break; script += current +...
java
private static void parseJava(IteratorWithPrevious<String> it, Pipeline pipeline) throws ParseException { String script = ""; while (it.hasNext()) { String current = it.next(); if (isBlank(current)) break; script += current + "\n"; ...
java
private static void parseInclude(String line, Pipeline pipeline, String parentFilePath, List<String> cliArgs) throws ParseException { LOG.info("+-parsing include line '{}'", line); String includeName = line.replaceFirst("include: ", "").trim(); File includeFile = null; if (in...
java
private static void validateParams(List<Object> params, Class<?> classz) { // skip validation if not uimafit if (!JCasAnnotator_ImplBase.class.isAssignableFrom(classz) && !JCasCollectionReader_ImplBase.class.isAssignableFrom(// classz)) { LOG.warn( ...
java
protected static String debugText(String heading, Authentication auth, Collection<ConfigAttribute> config, Object resource, int decision) { StringBuilder sb = n...
java
public S3TaskClient get(String storeId) throws ContentStoreException { ContentStore contentStore = contentStoreManager.getContentStore(storeId); return new S3TaskClientImpl(contentStore); }
java
public static void addFileToZipOutputStream(File file, ZipOutputStream zipOs) throws IOException { String fileName = file.getName(); try (FileInputStream fos = new FileInputStream(file)) { ZipEntry zipEntry = new ZipEntry(fileName); zipEntry.setSize(file.length()); zi...
java
private void checkStorageState(StorageException e) { if (e.getCause() instanceof AmazonS3Exception) { String errorCode = ((AmazonS3Exception) e.getCause()).getErrorCode(); if (INVALID_OBJECT_STATE.equals(errorCode)) { String message = "The storage sta...
java
private URI generateAsynchronously(String account, String spaceId, String storeId, String format) throws Exception { StorageProviderType providerType = getStorageProviderType(storeId...
java
@Override public List<StorageAccount> getStorageAccounts() { List<StorageAccount> accts = new ArrayList<>(); Iterator<String> ids = getAccountManager().getStorageAccountIds(); while (ids.hasNext()) { accts.add(getAccountManager().getStorageAccount(ids.next())); } ...
java
@Override public StorageProvider getStorageProvider(String storageAccountId) throws StorageException { // If no store ID is provided, retrieves the primary store ID storageAccountId = checkStorageAccountId(storageAccountId); if (storageProviders.containsKey(storageAccountId)) { ...
java
@Override public void expireStorageProvider(String storageAccountId) { storageAccountId = checkStorageAccountId(storageAccountId); log.info("Expiring storage provider connection! Storage account id: {}", storageAccountId); storageProviders.remove(storageAccountId); }
java
public void initialize(DuraStoreInitConfig initConfig, String instanceHost, String instancePort, String accountId) throws StorageException { this.initConfig = initConfig; storageAccountManager.initialize(initConfig....
java
public int getAttempts() { String attempts = this.properties.get("attempts"); if (attempts == null) { attempts = "0"; } return Integer.parseInt(attempts); }
java
public String performTask(String taskParameters) { GetSignedCookiesUrlTaskParameters taskParams = GetSignedCookiesUrlTaskParameters.deserialize(taskParameters); String spaceId = taskParams.getSpaceId(); String ipAddress = taskParams.getIpAddress(); int minutesToExpire = task...
java
public void run() { try { while (!complete) { ContentItem contentItem = new Retrier(5, 4000, 2).execute(() -> { return source.getNextContentItem(); }); if (contentItem == null) { break; } ...
java
public void shutdown() { logger.info("Closing Retrieval Manager"); workerPool.shutdown(); try { workerPool.awaitTermination(30, TimeUnit.MINUTES); } catch (InterruptedException e) { // Exit wait on interruption } complete = true; }
java
public String serialize(T obj) { try { Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); StringWriter writer = new StringWriter(); marshaller.marshal(obj, writer); return writer.to...
java
public T deserialize(String xml) { if (xml == null || xml.equals("")) { throw new RuntimeException("XML cannot be null or empty"); } else { return deserialize(new StreamSource(new StringReader(xml))); } }
java
public T deserialize(InputStream stream) { if (stream == null) { throw new RuntimeException("Stream cannot be null"); } else { return deserialize(new StreamSource(stream)); } }
java
public Map<String, String> getSpaceProperties(String spaceId) { Map<String, String> spaceProps = new HashMap<String, String>(); Map<String, String> allProps = getAllSpaceProperties(spaceId); // ONLY include non-ACL properties. for (String name : allProps.keySet()) { if (!nam...
java
public void setNewSpaceProperties(String spaceId, Map<String, String> spaceProperties) { setNewSpaceProperties(spaceId, spaceProperties, getSpaceACLs(spaceId)); }
java
public void setNewSpaceProperties(String spaceId, Map<String, String> spaceProperties, Map<String, AclType> spaceACLs) { // Add ACLs to the properties list spaceProperties.putAll(packACLs(spaceACLs)); boolean success = ...
java
public void deleteSpaceSync(String spaceId) { log.debug("deleteSpaceSync(" + spaceId + ")"); throwIfSpaceNotExist(spaceId); Map<String, String> allProps = getAllSpaceProperties(spaceId); allProps.put("is-delete", "true"); doSetSpaceProperties(spaceId, allProps); SpaceDe...
java
@GET public Response getSupportedTasks(@QueryParam("storeID") String storeID) { String msg = "getting suppported tasks(" + storeID + ")"; try { TaskProvider taskProvider = taskProviderFactory.getTaskProvider(storeID); List<String> supportedTasks = taskProvide...
java
@Path("/{taskName}") @POST public Response performTask(@PathParam("taskName") String taskName, @QueryParam("storeID") String storeID) { String msg = "performing task(" + taskName + ", " + storeID + ")"; String taskParameters = null; try { task...
java
@Override public RetrievedContent getContent(String spaceID, String contentID, String storeID, String range) throws InvalidRequestException, ResourceException { try { Stor...
java
@Override public Map<String, String> getContentProperties(String spaceID, String contentID, String storeID) throws ResourceException { try { StorageProvider storage = s...
java
@Override public void updateContentProperties(String spaceID, String contentID, String contentMimeType, Map<String, String> userProperties, String storeID) ...
java
@Override public String addContent(String spaceID, String contentID, InputStream content, String contentMimeType, Map<String, String> userProperties, long contentSize, ...
java
public void initializeNotifiers(Collection<NotificationConfig> notificationConfigs) { for (NotificationConfig config : notificationConfigs) { for (Notifier notifier : notifiers) { if (notifier.getNotificationType().name().equalsIgnoreCase( config.getType())) {...
java
public void sendNotification(NotificationType type, String subject, String message, String... destinations) { for (Notifier notifier : notifiers) { if (notifier.getNotificationType().equals(type))...
java
public void sendAdminNotification(NotificationType type, String subject, String message) { for (Notifier notifier : notifiers) { if (notifier.getNotificationType().equals(type)) { notifier.notifyAdmins(s...
java
public String storeData(String cookieData) { try { String token = generateToken(); ensureSpaceExists(); s3StorageProvider.addHiddenContent(this.hiddenSpaceName, token, Constants.MEDIA_TYPE_APPLICATION_JSON, IOUtil.writeStrin...
java
public String retrieveData(String token) { try { RetrievedContent data = this.s3StorageProvider.getContent(this.hiddenSpaceName, token); return IOUtil.readStringFromStream(data.getContentStream()); } catch (NotFoundException ex) { return null; } catch (E...
java
protected Map<String, String> retrieveToFile(File localFile, RetrievalListener listener) throws IOException { try { contentStream = new Retrier(5, 4000, 3).execute(() -> { return source.getSourceContent(contentItem, listener); }); } catch (Exception ex) { ...
java
public void generateSchema(Class... classes) throws JAXBException, IOException { if (!baseDir.exists()) { baseDir.mkdirs(); } JAXBContext context = JAXBContext.newInstance(classes); context.generateSchema(this); }
java
@Override public Result createOutput(String namespaceUri, String defaultFileName) throws IOException { if (null == fileName) { fileName = defaultFileName; } return new StreamResult(new File(baseDir, fileName)); }
java