Package railo.runtime

Examples of railo.runtime.MappingImpl


        String primary = ctMapping.getAttribute("primary");

        boolean physicalFirst = archive == null || !primary.equalsIgnoreCase("archive");
        hasSet = true;
        mappings[i] = new MappingImpl(config, ConfigWebAdmin.createVirtual(ctMapping), physical, archive, inspTemp, physicalFirst, hidden, readonly, true, false, true,
            null, clMaxEl);
        // print.out(mappings[i].isPhysicalFirst());
      }

      config.setCustomTagMappings(mappings);
View Full Code Here


        String primary = cMapping.getAttribute("primary");

        boolean physicalFirst = archive == null || !primary.equalsIgnoreCase("archive");
        hasSet = true;
        mappings[i] = new MappingImpl(config, virtual, physical, archive, inspTemp, physicalFirst, hidden, readonly, true, false, true, null, clMaxEl);
      }

      config.setComponentMappings(mappings);

    }

    // Server Mapping
    if (hasCS) {
      Mapping[] originals = ((ConfigServerImpl) configServer).getComponentMappings();
      Mapping[] clones = new Mapping[originals.length];
      LinkedHashMap map = new LinkedHashMap();
      Mapping m;
      for (int i = 0; i < clones.length; i++) {
        m = ((MappingImpl) originals[i]).cloneReadOnly(config);
        map.put(toKey(m), m);
        // clones[i]=((MappingImpl)m[i]).cloneReadOnly(config);
      }

      if (mappings != null) {
        for (int i = 0; i < mappings.length; i++) {
          m = mappings[i];
          map.put(toKey(m), m);
        }
      }
      if (originals.length > 0) {
        clones = new Mapping[map.size()];
        Iterator it = map.entrySet().iterator();
        Map.Entry entry;
        int index = 0;
        while (it.hasNext()) {
          entry = (Entry) it.next();
          clones[index++] = (Mapping) entry.getValue();
          // print.out("c:"+clones[index-1]);
        }
        hasSet = true;
        // print.err("set:"+clones.length);

        config.setComponentMappings(clones);
      }
    }

    if (!hasSet) {
      MappingImpl m = new MappingImpl(config, "/default", "{railo-web}/components/", null, ConfigImpl.INSPECT_UNDEFINED, true, false, false, true, false, true, null);
      config.setComponentMappings(new Mapping[] { m.cloneReadOnly(config) });
    }

  }
View Full Code Here

    return arr;
  }

  private static void fill(Array arr, Mapping[] mappings) throws PageException {
    if(mappings==null) return;
    MappingImpl mapping;
    for(int i=0;i<mappings.length;i++)  {
      mapping=(MappingImpl) mappings[i];
      toArray(arr,mapping.getPageSourcePool());
    }   
  }
View Full Code Here

   
    PageSourcePool psp;
    Object[] keys;
    PageSourceImpl ps;
    Resource res;
    MappingImpl mapping;
    for(int i=0;i<mappings.length;i++){
      mapping=(MappingImpl)mappings[i];
      psp = mapping.getPageSourcePool();
      keys = psp.keys();
      for(int y=0;y<keys.length;y++)  {
        ps = (PageSourceImpl) psp.getPageSource(keys[y], false);
        if(ps.isLoad()) {
          elements++;
          res=mapping.getClassRootDirectory().getRealResource(ps.getJavaName()+".class");
          size+=res.length();
        }
      }
    }
    return new long[]{elements,size};
View Full Code Here

     
      boolean addCFMLFiles = getBoolV("addCFMLFiles", true);
      boolean addNonCFMLFiles=getBoolV("addNonCFMLFiles", true);
     
      // compile
      MappingImpl mapping = (MappingImpl) doCompileMapping(mappingType,virtual, true);
       
      // class files
      if(mapping==null)throw new ApplicationException("there is no mapping for ["+virtual+"]");
      if(!mapping.hasPhysical())throw new ApplicationException("mapping ["+virtual+"] has no physical directory");
     
      Resource classRoot = mapping.getClassRootDirectory();
      Resource temp = SystemUtil.getTempDirectory().getRealResource("mani-"+IDGenerator.stringId());
    Resource mani = temp.getRealResource("META-INF/MANIFEST.MF");
   
      try {
        if(file.exists())file.delete();
        if(!file.exists())file.createFile(true);
         
        ResourceFilter filter;
       
       
        // include everything, no filter needed
        if(addCFMLFiles && addNonCFMLFiles)filter=null;
        // CFML Files but no other files
        else if(addCFMLFiles) {
          if(mappingType==MAPPING_CFC)filter=new ExtensionResourceFilter(new String[]{"class","cfc","MF"},true,true);
          else filter=new ExtensionResourceFilter(new String[]{"class","cfm","cfml","cfc","MF"},true,true);
        }
        // No CFML Files, but all other files
        else if(addNonCFMLFiles) {
          filter=new NotResourceFilter(new ExtensionResourceFilter(new String[]{"cfm","cfml","cfc"},false,true));
        }
        // no files at all
        else  {
          filter=new ExtensionResourceFilter(new String[]{"class","MF"},true,true);
        }
       
       
        // create manifest
        StringBuilder manifest=new StringBuilder();
       
        // id
        manifest.append("mapping-id: \"");
      manifest.append(MD5.getDigestAsString(mapping.getStrPhysical()));
        manifest.append("\"\n");
       
       
        manifest.append("mapping-type: \"");
        if(mappingType==MAPPING_CFC)manifest.append("cfc");
        else if(mappingType==MAPPING_CT)manifest.append("ct");
        else manifest.append("regular");
        manifest.append("\"\n");
       
        manifest.append("mapping-virtual-path: \"");
        manifest.append(mapping.getVirtual());
          manifest.append("\"\n");
       
        // Hidden
        manifest.append("mapping-hidden: ");
      manifest.append(mapping.isHidden());
        manifest.append("\n");
        // Physical First
        manifest.append("mapping-physical-first: ");
      manifest.append(mapping.isPhysicalFirst());
        manifest.append("\n");
        // Readonly
        manifest.append("mapping-readonly: ");
      manifest.append(mapping.isReadonly());
        manifest.append("\n");
        // Top Level
        manifest.append("mapping-top-level: ");
      manifest.append(mapping.isTopLevel());
        manifest.append("\n");
       
        // Trusted
        manifest.append("mapping-inspect: \"");
      manifest.append(ConfigWebUtil.inspectTemplate(mapping.getInspectTemplateRaw(), ""));
      manifest.append("\"\n");
       
       

       
        mani.createFile(true);
        IOUtil.write(mani, manifest.toString(), "UTF-8", false);
       
    // source files
        Resource[] sources;
      if(!addCFMLFiles && !addNonCFMLFiles) sources=new Resource[]{temp,classRoot};
      else sources=new Resource[]{temp,mapping.getPhysical(),classRoot};
     
      CompressUtil.compressZip(ResourceUtil.listResources(sources,filter), file, filter);
     
     
     
     
      if(getBoolV("append", false)) {
        if(mappingType==MAPPING_CFC) {
          admin.updateComponentMapping(
              mapping.getVirtual(),
                      mapping.getStrPhysical(),
                      strFile,
                      mapping.isPhysicalFirst()?"physical":"archive",
                      mapping.getInspectTemplateRaw());
           }
        else if(mappingType==MAPPING_CT) {
          admin.updateCustomTag(
              mapping.getVirtual(),
                      mapping.getStrPhysical(),
                      strFile,
                      mapping.isPhysicalFirst()?"physical":"archive",
                      mapping.getInspectTemplateRaw());
         
        }
       
        else
          admin.updateMapping(
            mapping.getVirtual(),
                    mapping.getStrPhysical(),
                    strFile,
                    mapping.isPhysicalFirst()?"physical":"archive",
                    mapping.getInspectTemplateRaw(),
                    mapping.isTopLevel()
            );
            store();
      }
     
     
View Full Code Here

   
    public Mapping getApplicationMapping(String virtual, String physical, String archive) {
      String key=virtual.toLowerCase()+physical.toLowerCase();
      Mapping m= applicationMappings.get(key);
      if(m==null){
        m=new MappingImpl(this,
          virtual,
          physical,
          archive,ConfigImpl.INSPECT_UNDEFINED,true,false,false,false,true,false,null
          );
        applicationMappings.put(key, m);
View Full Code Here

    if(mappings==null) return;
   
    DoubleStruct sct=new DoubleStruct();
     
    long size;
    MappingImpl mapping;
    for(int i=0;i<mappings.length;i++)  {
      mapping=(MappingImpl) mappings[i];
     
      // archive classloader
      size=SizeOf.size(mapping.getClassLoaderForArchive());
      sct.set("archiveClassLoader", Caster.toDouble(size));
     
      // physical classloader
      size=0;
      try {
        size=SizeOf.size(mapping.touchPCLCollection());
      } catch (Exception e) {}
      sct.set("physicalClassLoader", Caster.toDouble(size));
     
      // pagepool
      size=SizeOf.size(mapping.getPageSourcePool());
      sct.set(PAGE_POOL, Caster.toDouble(size));
     
      map.set(!isCustomTagMapping?
          mapping.getVirtual():mapping.getStrPhysical(),
          sct);
    }
  }
View Full Code Here

TOP

Related Classes of railo.runtime.MappingImpl

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.