Ejemplo n.º 1
0
 /* (non-Javadoc)
  * @see org.eclipse.californium.core.server.resources.Resource#add(org.eclipse.californium.core.server.resources.Resource)
  */
 @Override
 public synchronized void add(Resource child) {
   if (child.getName() == null) throw new NullPointerException("Child must have a name");
   if (child.getParent() != null) child.getParent().delete(child);
   children.put(child.getName(), child);
   child.setParent(this);
   for (ResourceObserver obs : observers) obs.addedChild(child);
 }
Ejemplo n.º 2
0
 /* (non-Javadoc)
  * @see org.eclipse.californium.core.server.resources.Resource#delete(org.eclipse.californium.core.server.resources.Resource)
  */
 @Override
 public synchronized boolean delete(Resource child) {
   Resource deleted = delete(child.getName());
   if (deleted == child) {
     child.setParent(null);
     child.setPath(null);
     for (ResourceObserver obs : observers) obs.removedChild(child);
     return true;
   }
   return false;
 }
Ejemplo n.º 3
0
 /* (non-Javadoc)
  * @see org.eclipse.californium.core.server.resources.Resource#setParent(org.eclipse.californium.core.server.resources.Resource)
  */
 public void setParent(Resource parent) {
   this.parent = parent;
   if (parent != null) this.path = parent.getPath() + parent.getName() + "/";
   adjustChildrenPath();
 }