Example #1
0
  @Override
  public synchronized FilePrx createFile(String name, Ice.Current current) throws NameInUse {
    if (_destroyed) {
      throw new Ice.ObjectNotExistException(current.id, current.facet, current.operation);
    }

    if (name.length() == 0 || nodes.containsKey(name)) {
      throw new NameInUse(name);
    }

    Ice.Identity id =
        current.adapter.getCommunicator().stringToIdentity(java.util.UUID.randomUUID().toString());
    PersistentFile file = new FileI();
    file.nodeName = name;
    file.parent =
        PersistentDirectoryPrxHelper.uncheckedCast(current.adapter.createProxy(current.id));
    FilePrx proxy = FilePrxHelper.uncheckedCast(_evictor.add(file, id));

    NodeDesc nd = new NodeDesc();
    nd.name = name;
    nd.type = NodeType.FileType;
    nd.proxy = proxy;
    nodes.put(name, nd);

    return proxy;
  }