Package anvil.server

Examples of anvil.server.Address


      String[] imports = (String[])getstatic(scriptclass, "_imports");
      int n = imports.length;
      for(int i=0; i<n; ) {
        String pathinfo = imports[i++];
        String descriptor = imports[i++];
        Address imported = getAddress().resolve(pathinfo);
        _dependencies.put(imported, new Dependency(imported, descriptor, _location));
      }
     
      Field field;
     
View Full Code Here


  {
    ArrayList list = new ArrayList();
    Iterator iter = _cache.values().iterator();
    while(iter.hasNext()) {
      ModuleEnvelope env = (ModuleEnvelope)iter.next();
      Address addr = env.getAddress();
      if (addr.getHostname().equals(hostname)) {
        if (addr.getPathinfo().startsWith(pathinfo)) {
          list.add(env);
        }
      }
    }
    return list;
View Full Code Here

  }


  private void purge(ModuleEnvelope envelope)
  {
    Address a = envelope.getAddress();
    _cache.purge(a);
    _forged.remove(a);
  }
View Full Code Here

    boolean doparse = false;
    Module script = envelope.getModule();
    boolean failed = false;
    Iterator iter = script.getDependencies();
   
    Address source = envelope.getAddress();
    String sourcepath = source.getPathinfo();
    Zone zone = source.getZone();
    boolean hasPolicy = zone.getDomain().hasPolicy();
   
    while(iter.hasNext()) {
      Dependency dep = (Dependency)iter.next();
      try {
     
        Address target = dep.getAddress();
        if (hasPolicy) {
          String targetpath = target.getPathinfo();
          if (!ImportPermission.onSameDir(sourcepath, targetpath)) {
            if (!zone.checkPermission(new ImportPermission(targetpath))) {
              error(dep.getLocation(), "Access denied: "+targetpath);
            }
          }
        }
       
        ModuleEnvelope imported = forge(target);
        if (imported != null) {
          boolean source_compiled = envelope.isCompiled();
          boolean target_compiled = imported.isCompiled();
          if (source_compiled) {
            if (target_compiled) {
              // check signatures
              if (!imported.getDescriptor().equals(dep.getDescriptor())) {
                doparse = true;
              }
            } else {
              doparse = true;
            }
          } else {
            // source already parsed
          }
        } else {
          boolean report_error = true;
          Address addr = dep.getAddress();
          if (_notimported == null) {
            _notimported = new HashSet();
            _notimported.add(addr);
          } else {
            if (_notimported.contains(addr)) {
View Full Code Here

  public boolean compile()
  {
    Code code;
   
    String classname = _envelope.getClassname();
    Address address = _envelope.getAddress();
    String pathinfo = address.getPathinfo();
    String classsig = _envelope.getDescriptor();
    TYPE_MODULE = classsig;
   
    ClassRoom clazz = new ClassRoom();
    pushClass(clazz);
View Full Code Here

      logprefs.setLevel(severity);
      server.configure(logprefs);
      server.start();

      Zone zone = server.resolveZone(filename);
      Address address = zone.resolve(filename);
      Module script = server.getCache().load(address).getModule();
      Product product = new Product(address, System.out, script);
      Array arguments = new Array();
      while(index < length) {
        arguments.append(new AnyString(args[index++]));
View Full Code Here

  /// @synopsis void purge()
  /// @throws AccessDenied if security policy denies this operation
  public Any m_purge(Context context)
  {
    context.checkAccess(CAN_WRITE);
    Address addr = _envelope.getAddress();
    addr.getServer().getCache().purge(addr);
    return this;
  }
View Full Code Here

    } else if (!pathinfo.startsWith("/")) {
      pathinfo = "/" + pathinfo;
    }
    try {
      Zone zone = _server.resolveZone(pathinfo);
      Address address = zone.resolve(pathinfo);
      ModuleEnvelope envelope = _server.getCache().load(address);
      System.out.println("generated: "+envelope.getClassname());
    } catch (ForgingException e) {
      errors(System.err, e);
    } catch (Exception e) {
View Full Code Here


  public void addTaglib(ErrorListener listener, Location location, String source, String namespace, String tagns)
  {
    ModuleStatement script = getModuleStatement();
    Address importing = null;
    try {
      importing = script.getAddress().resolve(source);
    } catch (ZoneInactiveException e) {
      listener.error(location, "Target's zone is inactive: '" + source + "'");
    }
    URL url = importing.getURL();
    TagLibrary lib = anvil.script.statements.taglib.Parser.parse(listener, url, location, namespace, tagns);
    if (lib != null) {
      _taglibs.addLibrary(lib);
    }
  }
View Full Code Here

  /// Imports resource pointed at given path 'as is'.
  /// @synopsis Resource rawImport(string pathinfo)
  /// @throws ImportError If import failed
  public static final Any rawImport(Context context, String pathinfo)
  {
    Address address = context.address();
    Address importing = null;
    try {
      importing = address.resolve(pathinfo);
    } catch (anvil.server.ZoneInactiveException e) {
      throw context.ImportError(e.getMessage(), null);
    }
    context.checkImport(importing.getPathinfo());
    try {
      Resource resource = importing.openResource();
      return new AnyResource(resource);
    } catch (anvil.server.ContainerException t) {
      throw context.ImportError(t.getMessage(), null);
    }
  }
View Full Code Here

TOP

Related Classes of anvil.server.Address

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.