Package org.jayasoft.woj.server.data

Examples of org.jayasoft.woj.server.data.ModuleDescriptorDao


            LOGGER.debug("computed size of "+md.getModuleInfoAsString()+": "+size);
            if (md instanceof ModuleDescriptorImpl) {
                LOGGER.debug("storing size of "+md.getModuleInfoAsString()+": "+size);
                ModuleDescriptorImpl mdimpl = (ModuleDescriptorImpl)md;
                mdimpl.setSize(size);
                ModuleDescriptorDao dao = WOJServer.getInstance().getDataService().getModuleDescriptorDao();
                dao.update(mdimpl);
            }
        }
        return size;
    }
View Full Code Here


    public UpdateMD5Command() {
        super(ServerCommands.UPDATE_MD5.NAME);
    }

    public Object securedInvoke(UAK uak, Map m) {
        final ModuleDescriptorDao dao = WOJServer.getInstance().getDataService().getModuleDescriptorDao();
        String wojBaseDir = ((FileContentService) WOJServer.getInstance().getContentService()).getBaseDir()+"/"+Visibility.PUBLIC.getName();
        File wojBaseDirFile = new File(wojBaseDir);
        File[] orgs = wojBaseDirFile.listFiles();
        for (int i = 0; i < orgs.length; i++) {
            File org = orgs[i];
            File[] modules = org.listFiles();
            for (int j = 0; j < modules.length; j++) {
                File module = modules[j];
                File[] revs = module.listFiles();
                for (int k = 0; k < revs.length; k++) {
                    File rev = revs[k];
                    ModuleDescriptor md = dao.getModuleDescriptor(org.getName(), module.getName(), rev.getName(), uak.getUserId(), uak.getGroups(),Visibility.PUBLIC);
                    if(md != null && !md.isNew()) {
                        File[] jars = new File(rev.getAbsolutePath()+"/"+Parameters.BINARIES_FOLDER).listFiles(new FileFilter() {
                            public boolean accept(File pathname) {
                                return pathname.getName().endsWith("zip") || pathname.getName().endsWith("jar") ;
                            }
                        });
                        if(jars != null && jars.length >0) {
                            String md5s[] = new String[jars.length];
                            for (int index = 0; index < jars.length; index++) {
                                File jar = jars[index];
                                md5s[index] = ChecksumUtil.MD5.computeAsString(jar.getAbsolutePath());
                            }
                            dao.addMd5s(md, md5s);
                            //just to avoid server overcharge
                            try {
                                Thread.sleep(100);
                            } catch (InterruptedException e) {}
                        }
View Full Code Here

     */
    public ModuleInfo getModuleInfo(String md5, UAK uak) {
      LOGGER.debug("Getting ModuleInfo for checksum: " + md5);
      ModuleInfo mi = null;
        if(md5 != null) {
            ModuleDescriptorDao dao= WOJServer.getInstance().getDataService().getModuleDescriptorDao();
            ModuleDescriptor result = dao.getModuleDescriptor(md5, null, uak);
            if (result != null) {
            LOGGER.debug("ModuleInfo: " + result.toString() + " was found for md5: " + md5);
            return new ModuleInfoImpl(result.getOrganisation(), result.getModule(), result.getRevision(), result.getVisibility(), result.hasSources(), result.hasJavadoc());
            } else {
              LOGGER.warn("No ModuleInfo was found in DB for checksum: " + md5);
View Full Code Here

        return getRevisions(org, moduleName, prefix, null);
    }
   
    public String[] getClassList(String org, String mod, String rev, UAK uak) {
            // TODO ask to content service
            ModuleDescriptorDao dao= WOJServer.getInstance().getDataService().getModuleDescriptorDao();
            ModuleDescriptor md = dao.getModuleDescriptor(org,mod,rev,uak.getUserId(), uak.getGroups());
            if (md == null) {
                LOGGER.info("unknown module "+org+" "+mod+" "+rev+": unable to list its classes");
                return new String[0];
            }
           
View Full Code Here

        }
        ModuleDescriptor md = null;
        Visibility v = null;
        if (Parameters.SERVLET_NAME.DISPATCH.equals(visibility)) {
            LOGGER.info("no visibility found in url");
            ModuleDescriptorDao dao = WOJServer.getInstance().getDataService().getModuleDescriptorDao();
            md = dao.getModuleDescriptor(org, mod, rev, uak.getUserId(), uak.getGroups());
            if (md == null) {
                throw new UnknwownContentException(visibility+"/"+org+"/"+mod+"/"+rev+"/"+path);
            }
            v = md.getVisibility();
        } else {
            v = Visibility.fromString(visibility);
        }
       
        if (v == Visibility.PRIVATE) {
            ServletHelper.ensureCurrentRequestEncrypted(uak, visibility+"/"+org+"/"+mod+"/"+rev+"/"+path);
        }
               
        Long accessorId = null;
        boolean hasSources = true;
        boolean hasJavadoc = true;
        if (md != null || !Visibility.PUBLIC.equals(v)) {
            if (md == null) {
                ModuleDescriptorDao dao= WOJServer.getInstance().getDataService().getModuleDescriptorDao();
                md = dao.getModuleDescriptor(org, mod, rev, uak.getUserId(), uak.getGroups(), v);
            }
           
            // look for accessor id
            if (md == null) {
                throw new UnknwownContentException(visibility+"/"+org+"/"+mod+"/"+rev+"/"+path);
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.server.data.ModuleDescriptorDao

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.