Codota Logo
Resource.delete
Code IndexAdd Codota to your IDE (free)

How to use
delete
method
in
org.geoserver.platform.resource.Resource

Best Java code snippets using org.geoserver.platform.resource.Resource.delete (Showing top 20 results out of 315)

  • Common ways to obtain Resource
private void myMethod () {
Resource r =
  • Codota IconGeoServerResourceLoader geoServerResourceLoader;String path;geoServerResourceLoader.get(path)
  • Codota IconResourceStore resourceStore;String path;resourceStore.get(path)
  • Codota IconFile file;Files.asResource(file)
  • Smart code suggestions by Codota
}
origin: geoserver/geoserver

  @Override
  public void run() {
    lockFile.delete();
  }
}));
origin: geoserver/geoserver

@Override
public boolean delete() {
  return delegate.delete();
}
origin: geoserver/geoserver

/**
 * Renames a resource by reading it and writing to the new resource, then deleting the old one.
 * This is not atomic.
 *
 * @param source Resource to rename
 * @param destination New resource location
 * @return true if successful, false if either the write or delete failed.
 */
public static boolean renameByCopy(Resource source, Resource destination) {
  try {
    copy(source, destination);
    return source.delete();
  } catch (IOException e) {
    return false;
  }
}
origin: geoserver/geoserver

/** removes the user group service config from persistence */
public void removeConfig(String name) throws IOException {
  getRoot().get(name).delete();
}
origin: geoserver/geoserver

/** remove the lockfile */
public void writeUnLock() {
  if (Resources.exists(lockFile)) {
    if (lockFile.lastmodified() == lockFileLastModified) {
      lockFileLastModified = 0;
      lockFile.delete();
    } else {
      LOGGER.warning("Tried to unlock foreign lock: " + lockFile.path());
    }
  } else {
    LOGGER.warning("Tried to unlock not exisiting lock: " + lockFile.path());
  }
}
origin: geoserver/geoserver

Resource newKSFile = dir.get(PREPARED_FILE_NAME);
if (newKSFile.getType() != Type.UNDEFINED) {
  newKSFile.delete();
origin: geoserver/geoserver

public void handleServiceRemove(ServiceInfo service) {
  XStreamServiceLoader loader = findServiceLoader(service);
  try {
    Resource dir =
        service.getWorkspace() != null
            ? dir(service.getWorkspace())
            : resourceLoader.get(Paths.BASE);
    dir.get(loader.getFilename()).delete();
  } catch (Throwable t) {
    throw new RuntimeException(t);
  }
}
origin: geoserver/geoserver

if (oldKSFile.delete() == false) {
  LOGGER.severe("cannot delete " + oldKSFile.path());
  return;
origin: geoserver/geoserver

@Theory
public void theoryRecursiveDelete(String path) throws Exception {
  final Resource res = getResource(path);
  assumeThat(res, is(directory()));
  assumeThat(res, is(directory()));
  Collection<Resource> result = res.list();
  assumeThat(result.size(), greaterThan(0));
  assertTrue(res.delete());
}
origin: geoserver/geoserver

@Test
public void testReloadDefaultStyles() throws Exception {
  // clear up all "point" styles
  final Resource styles = getDataDirectory().getStyles();
  styles.list()
      .stream()
      .filter(r -> r.getType() == Resource.Type.RESOURCE && r.name().contains("point"))
      .forEach(r -> r.delete());
  // reload
  getGeoServer().reload();
  // check the default point style has been re-created
  final StyleInfo point = getCatalog().getStyleByName("point");
  assertNotNull(point);
}
origin: geoserver/geoserver

@Theory
public void theoryUndefinedNotDeleted(String path) throws Exception {
  Resource res = getResource(path);
  assumeThat(res, undefined());
  assertThat(res.delete(), is(false));
  assertThat(res, undefined());
}
origin: geoserver/geoserver

@Theory
public void theoryDeletedResourcesAreUndefined(String path) throws Exception {
  Resource res = getResource(path);
  assumeThat(res, resource());
  assertThat(res.delete(), is(true));
  assertThat(res, undefined());
}
origin: org.geoserver.community/gs-geogig

public boolean delete(final String id) {
  checkNotNull(id, "provided a null id");
  checkIdFormat(id);
  lock.writeLock().lock();
  try {
    infosById.remove(id);
    return resource(id).delete();
  } finally {
    lock.writeLock().unlock();
  }
}
origin: org.geoserver/gs-wfs

/** Removes all stored queries. */
public void removeAll() {
  for (Resource file : storedQueryDir().list()) {
    file.delete();
  }
}
origin: org.geoserver/gs-wfs

/**
 * Removes an existing stored query.
 *
 * @param query The stored query
 */
public void removeStoredQuery(StoredQuery query) {
  storedQueryDir().get(toFilename(query.getName())).delete();
}
origin: org.geoserver.community/gs-params-extractor

public static void saveOrUpdateEchoParameter(EchoParameter echoParameter) {
  Resource echoParameters = DATA_DIRECTORY.get(getEchoParametersPath());
  Resource tmpEchoParameters = DATA_DIRECTORY.get(getTmpEchoParametersPath());
  saveOrUpdateEchoParameter(echoParameter, echoParameters.in(), tmpEchoParameters.out());
  echoParameters.delete();
  tmpEchoParameters.renameTo(echoParameters);
}
origin: org.geoserver/gs-platform

@Theory
public void theoryRecursiveDelete(String path) throws Exception {
  final Resource res = getResource(path);
  assumeThat(res, is(directory()));
  assumeThat(res, is(directory()));
  Collection<Resource> result = res.list();
  assumeThat(result.size(), greaterThan(0));
  assertTrue(res.delete());
}
origin: org.geoserver.community/gs-params-extractor

public static void saveOrUpdateRule(Rule rule) {
  Resource rules = DATA_DIRECTORY.get(getRulesPath());
  Resource tmpRules = DATA_DIRECTORY.get(getTempRulesPath());
  saveOrUpdateRule(rule, rules.in(), tmpRules.out());
  rules.delete();
  tmpRules.renameTo(rules);
}
origin: org.geoserver/gs-platform

@Theory
public void theoryDeletedResourcesAreUndefined(String path) throws Exception {
  Resource res = getResource(path);
  assumeThat(res, resource());
  assertThat(res.delete(), is(true));
  assertThat(res, undefined());
}
origin: org.geoserver/gs-restconfig

@Test
public void testUpload() throws Exception {
  put(RestBaseController.ROOT_PATH + "/resource/mydir/mynewres", STR_MY_NEW_TEST);
  Resource newRes = getDataDirectory().get("/mydir/mynewres");
  try (InputStream is = newRes.in()) {
    Assert.assertEquals(STR_MY_NEW_TEST, IOUtils.toString(is));
  }
  newRes.delete();
}
org.geoserver.platform.resourceResourcedelete

Javadoc

Deletes a resource, if the resource is a directory contents will be recursively deleted.

Popular methods of Resource

  • out
  • getType
  • in
  • get
  • dir
  • file
  • path
  • name
  • list
  • lastmodified
  • parent
  • addListener
  • parent,
  • addListener,
  • renameTo,
  • getContents,
  • removeListener,
  • load,
  • lock,
  • save,
  • setContents

Popular in Java

  • Making http requests using okhttp
  • setScale (BigDecimal)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • getContentResolver (Context)
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • ArrayList (java.util)
    Resizable-array implementation of the List interface. Implements all optional list operations, and p
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now