congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Resource.parent
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: geoserver/geoserver

@Override
public Resource parent() {
  return delegate.parent() == null
      ? null
      : new SerializableResourceWrapper(delegate.parent());
}
origin: geoserver/geoserver

public LockFile(Resource file) throws IOException {
  lockFileTarget = file;
  if (!Resources.exists(file)) {
    throw new IOException("Cannot lock a not existing file: " + file.path());
  }
  lockFile = file.parent().get(lockFileTarget.name() + ".lock");
  Runtime.getRuntime()
      .addShutdownHook(
          new Thread(
              new Runnable() { // remove on shutdown
                @Override
                public void run() {
                  lockFile.delete();
                }
              }));
}
origin: geoserver/geoserver

Resource target = resource.parent().get(newName + "." + extension);
  target = resource.parent().get(newName + i + "." + extension);
origin: geoserver/geoserver

/**
 * Parses the info.xml file into a DOM.
 *
 * <p>This method *must* be called before any other methods.
 *
 * @param file The info.xml file.
 * @throws IOException In event of a parser error.
 */
public void read(Resource file) throws IOException {
  parentDirectory = file.parent();
  Reader reader = XmlCharsetDetector.getCharsetAwareReader(file.in());
  try {
    featureType = ReaderUtils.parse(reader);
  } finally {
    reader.close();
  }
}
origin: geoserver/geoserver

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

@Override
public boolean renameTo(Resource dest) {
  if (dest.parent().path().contains(path())) {
    LOGGER.log(Level.FINE, "Cannot rename a resource to a descendant of itself");
    return false;
  }
  try {
    if (dest instanceof FileSystemResource) {
      rename(file, ((FileSystemResource) dest).file);
    } else if (dest instanceof Files.ResourceAdaptor) {
      rename(file, ((Files.ResourceAdaptor) dest).file);
    } else {
      return Resources.renameByCopy(this, dest);
    }
  } catch (IOException e) {
    LOGGER.log(
        Level.WARNING,
        "Failed to rename file resource " + path + " to " + dest.path(),
        e);
    return false;
  }
  return true;
}
origin: geoserver/geoserver

private void renameRes(Resource r, String newName) {
  rl.move(r.path(), r.parent().get(newName).path());
}
origin: geoserver/geoserver

Resource parent = resource.parent();
while (parent != null && !Resources.exists(parent)) {
  events.add(new ResourceNotification.Event(parent.path(), kind));
  parent = parent.parent();
origin: geoserver/geoserver

private void renameRes(Resource r, String newName) {
  try {
    rl.move(r.path(), r.parent().get(newName).path());
  } catch (Exception e) {
    throw new CatalogException(e);
  }
}
origin: geoserver/geoserver

@Override
public void commitMasterPasswordChange() throws IOException {
  Resource dir = getResource().parent();
  Resource newKSFile = dir.get(PREPARED_FILE_NAME);
  Resource oldKSFile = dir.get(DEFAULT_FILE_NAME);
origin: geoserver/geoserver

URI oldURI = new URI(old.path());
final URI relative = oldDirURI.relativize(oldURI);
final Resource target = newDir.get(relative.getPath()).parent();
copyResToDir(old, target);
origin: geoserver/geoserver

@Theory
public void theoryChildrenKnowTheirParents(String path) throws Exception {
  Resource res = getResource(path);
  assumeThat(res, is(directory()));
  Collection<Resource> children = res.list();
  assumeThat(children, not(empty())); // Make sure this resource has children
  for (Resource child : children) {
    Resource parent = child.parent();
    assertThat(parent, equalTo(res));
  }
}
origin: geoserver/geoserver

  LOGGER.log(
      Level.WARNING,
      "Failed to load data store '" + storeResource.parent().name() + "'",
      e);
  return;
try (AsynchResourceIterator<LayerContents> it =
    new AsynchResourceIterator<>(
        storeResource.parent(),
        Resources.DirectoryFilter.INSTANCE,
        FEATURE_LAYER_MAPPER)) {
origin: geoserver/geoserver

private void loadWmtsStore(
    StoreContents storeContents, CatalogImpl catalog, XStreamPersister xp) {
  final Resource storeResource = storeContents.resource;
  WMTSStoreInfo wmts = null;
  try {
    wmts = depersist(xp, storeContents.contents, WMTSStoreInfo.class);
    catalog.add(wmts);
    LOGGER.info("Loaded wmtsstore '" + wmts.getName() + "'");
  } catch (Exception e) {
    LOGGER.log(
        Level.WARNING, "Failed to load wmts store '" + storeResource.name() + "'", e);
    return;
  }
  // load wmts layers
  LayerLoader<WMTSLayerInfo> coverageLoader =
      new LayerLoader<>(WMTSLayerInfo.class, xp, catalog);
  try (AsynchResourceIterator<LayerContents> it =
      new AsynchResourceIterator<>(
          storeResource.parent(),
          Resources.DirectoryFilter.INSTANCE,
          WMTS_LAYER_MAPPER)) {
    while (it.hasNext()) {
      LayerContents lc = it.next();
      coverageLoader.accept(lc);
    }
  }
}
origin: geoserver/geoserver

try (AsynchResourceIterator<LayerContents> it =
    new AsynchResourceIterator<>(
        storeResource.parent(),
        Resources.DirectoryFilter.INSTANCE,
        COVERAGE_LAYER_MAPPER)) {
origin: geoserver/geoserver

@Theory
public void theoryParentsKnowTheirChildren(String path) throws Exception {
  Resource res = getResource(path);
  assumeThat(res, is(directory()));
  Resource parent = res.parent();
  assumeThat(path, parent, notNullValue()); // Make sure this resource has a parent
  Collection<Resource> result = parent.list();
  assertThat(path, result, hasItem(res)); // this assumed equals was written!
}
origin: geoserver/geoserver

@Theory
public void theoryParentIsDirectory(String path) throws Exception {
  Resource res = getResource(path);
  Resource parent = res.parent();
  assumeThat(path + " not root", parent, notNullValue());
  if (res.getType() != Type.UNDEFINED) {
    assertThat(path + " directory", parent, is(directory()));
  }
}
origin: geoserver/geoserver

private void loadWmsStore(
    StoreContents storeContents, CatalogImpl catalog, XStreamPersister xp) {
  final Resource storeResource = storeContents.resource;
  WMSStoreInfo wms = null;
  try {
    wms = depersist(xp, storeContents.contents, WMSStoreInfo.class);
    catalog.add(wms);
    LOGGER.info(
        "Loaded wmsstore '"
            + wms.getName()
            + "', "
            + (wms.isEnabled() ? "enabled" : "disabled"));
  } catch (Exception e) {
    LOGGER.log(Level.WARNING, "Failed to load wms store '" + storeResource.name() + "'", e);
    return;
  }
  // load wms layers
  LayerLoader<WMSLayerInfo> coverageLoader =
      new LayerLoader<>(WMSLayerInfo.class, xp, catalog);
  try (AsynchResourceIterator<LayerContents> it =
      new AsynchResourceIterator<>(
          storeResource.parent(),
          Resources.DirectoryFilter.INSTANCE,
          WMS_LAYER_MAPPER)) {
    while (it.hasNext()) {
      LayerContents lc = it.next();
      coverageLoader.accept(lc);
    }
  }
}
origin: geoserver/geoserver

private void renameStyle(StyleInfo s, String newName) throws IOException {
  // rename style definition file
  Resource style = dd.style(s);
  StyleHandler format = Styles.handler(s.getFormat());
  Resource target = uniqueResource(style, newName, format.getFileExtension());
  renameRes(style, target.name());
  s.setFilename(target.name());
  // rename generated sld if appropriate
  if (!SLDHandler.FORMAT.equals(format.getFormat())) {
    Resource sld = style.parent().get(FilenameUtils.getBaseName(style.name()) + ".sld");
    if (sld.getType() == Type.RESOURCE) {
      LOGGER.fine("Renaming style resource " + s.getName() + " to " + newName);
      Resource generated = uniqueResource(sld, newName, "sld");
      renameRes(sld, generated.name());
    }
  }
}
origin: geoserver/geoserver

f.renameTo(f.parent().get("catalog.xml.old"));
org.geoserver.platform.resourceResourceparent

Javadoc

Resource parent, or null for ResourceStore base diretory.

Popular methods of Resource

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

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • compareTo (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Option (scala)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now