Package org.jayasoft.woj.common.model.content

Examples of org.jayasoft.woj.common.model.content.ModuleDescriptor


    result = (ModuleDescriptor[]) l.toArray(result);
        return result;
  }

  public ModuleDescriptor[] getAllModuleWithSameOrgModRev(String modId) {
    ModuleDescriptor mdesc =  (ModuleDescriptor) get(modId, getModuleDescriptorRowMapper());
    ModuleDescriptor[] result = new ModuleDescriptor[0];
    if (mdesc != null) {
      List l = getObjects("get.from.org.mod.rev",
          new Object[] {mdesc.getOrganisation(),
                  mdesc.getModule(),
                  mdesc.getRevision()}, getModuleDescriptorRowMapper());
      result = new ModuleDescriptor[l.size()];
      result = (ModuleDescriptor[]) l.toArray(result);
    }
        return result;
  }
View Full Code Here


  public String getModulesExportScript(long since, Visibility visibility) {
    ModuleDescriptor[] mdescs = getModulesSinceVisibility(since, visibility);
    StringBuffer buf = new StringBuffer();
    List l = new ArrayList();
    for (int i = 0; i < mdescs.length; i++) {
      ModuleDescriptor mdesc = mdescs[i];
      l.clear();
      fillParameters(mdesc, l, false);
      l.add(null); // No ref for computer Id ...
      Object[] args = l.toArray(new Object[l.size()]);
      buf.append(SQLUtil.setValues(_handler.getRequest("insert"), args) + ";\n");
      String registerSQL = _handler.getRequest("register.module");
      registerSQL = registerSQL.substring(0, registerSQL.lastIndexOf("?")) + mdesc.getId() + registerSQL.substring(registerSQL.lastIndexOf("?")+1);
      buf.append(registerSQL + ";\n");
      for (Iterator iter = mdesc.getMD5s().iterator(); iter.hasNext();) {
        String md5 = (String) iter.next();
        args = new Object[] {md5, new Long(mdesc.getId())};
        buf.append(SQLUtil.setValues(_handler.getRequest("insert.md5"), args) + ";\n");
      }
      for (Iterator iter = mdesc.getSHA1s().iterator(); iter.hasNext();) {
        String sha1 = (String) iter.next();
        args = new Object[] {sha1, new Long(mdesc.getId())};
        buf.append(SQLUtil.setValues(_handler.getRequest("insert.sha1"), args) + ";\n");
      }
    }
    return buf.toString();
  }
View Full Code Here

    public ModuleDescriptor getModule(String mdId) {
        return (ModuleDescriptor)get(mdId, JDBCModuleDescriptor.getRowMapper());
    }

    protected Object[] getDeleteParameters(Object o) {
        ModuleDescriptor moduleDesc = (ModuleDescriptor) o;
        List parameters = new ArrayList();
        // ID
        parameters.add(new Long(moduleDesc.getId()));
        return parameters.toArray();
    }
View Full Code Here

    protected Object[] getInsertParameters(Object o) {
      throw new IllegalStateException("This method is not callable for JDBCModuleDescriptorDao");
    }
   
    protected Object[] getInsertParameters(UAK uak, Object o) {
        ModuleDescriptor moduleDesc = (ModuleDescriptor) o;
        List parameters = new ArrayList();
        fillParameters(moduleDesc, parameters, true);
        parameters.add((uak == null)?null:uak.getComputerId());

        return parameters.toArray();
View Full Code Here

        parameters.add(new Long(moduleDesc.getLastAccessTime()));
        parameters.add(moduleDesc.getLastAccessBy());
  }

  protected Object[] getUpdateParameters(Object o) {
        ModuleDescriptor moduleDesc = (ModuleDescriptor) o;
        List parameters = new ArrayList();
        // TimeStamp
        Long timeStamp = new Long(System.currentTimeMillis());
        parameters.add(timeStamp);
        // Org Module Rev
        parameters.add(moduleDesc.getOrganisation());
        parameters.add(moduleDesc.getModule());
        parameters.add(moduleDesc.getRevision());
        // Visibility / Obsolete replicated
        parameters.add(new Integer(moduleDesc.getVisibility().getId()));
        parameters.add(Boolean.valueOf(moduleDesc.isDeleted()));
        parameters.add(Boolean.valueOf(moduleDesc.isObsolete()));
        parameters.add(Boolean.valueOf(moduleDesc.isReplicated()));
        // Has sources / javadoc / Home URL
        parameters.add(Boolean.valueOf(moduleDesc.hasSources()));
        parameters.add(Boolean.valueOf(moduleDesc.hasJavadoc()));
        parameters.add(moduleDesc.getHomeURL());
        // Submitter/Accessor/ServerList
        parameters.add(moduleDesc.getAccessorId());
        parameters.add(new Long(moduleDesc.getSize()));
        parameters.add(new Long(moduleDesc.getLastAccessTime()));
        parameters.add(moduleDesc.getLastAccessBy());
        // MdId
        parameters.add(new Long(moduleDesc.getId()));

        return parameters.toArray();
  }
View Full Code Here

        } else {
            sqlRequest = _handler.getRequest("get.from.md5.and.sha1");
            params = new Object[]{md5, sha1};
        }
        sqlRequest = MessageFormat.format(sqlRequest, new Object[]{accessorsParam});
        ModuleDescriptor mDesc = (ModuleDescriptor) getObjectFromQuery(sqlRequest, params, getModuleDescriptorRowMapper());
        if (LOGGER.isDebugEnabled()) {
          LOGGER.debug("ModuleDescriptor response for md5("+md5+") and sha1("+sha1+") for "+uak+" = " + mDesc);
        }
    return mDesc;
    }
View Full Code Here

        super(Commands.REGISTER_MODULE.NAME);
    }

    public Object securedInvoke(UAK uak, Map m) {
        Server server = (Server)ServiceProvider.getDefault().getEncodingService().decode((String)m.get(Commands.REGISTER_MODULE.P_SERVER));
        ModuleDescriptor md = (ModuleDescriptor)ServiceProvider.getDefault().getEncodingService().decode((String)m.get(Commands.REGISTER_MODULE.P_MODULE));
       
        WOJServer.getInstance().getModuleManagementService().registerModule(server, md);
      return null;
    }
View Full Code Here

  protected abstract void notifyModulePromoted(WOJServer instance, ModuleDescriptor md, Visibility newVisibility);

  public void removeModuleDescriptor(UAK uak, String mdId) {
        LOGGER.debug("Asking deletion of module: " + mdId);
    ModuleDescriptorDao dao = WOJServer.getInstance().getDataService().getModuleDescriptorDao();
    ModuleDescriptor md = dao.getModule(mdId);
    if (md != null) {
            if (!isVisibleFor(md, uak) && !uak.isAdmin()) {
                LOGGER.info("can't remove module: " + md.getModuleInfoAsString()+": not visible for "+uak);
                throw new UnauthorizedException(uak, "delete "+md.getModuleInfoAsString());
            }
            if (uak.getPublishVisibilityRight().getId() < md.getVisibility().getId()) {
                LOGGER.info("can't remove module: " + md.getModuleInfoAsString()+": no sufficient rights");
                throw new UnauthorizedException(uak, "delete "+md.getModuleInfoAsString());
            }
      dao.removeModuleDescriptor(md);
      WOJServer.getInstance().getContentService().refrechContentForModuleDescriptorDeletion(md);
      // Notification
      notifyModuleRemoved(md);
          LOGGER.info("Module: " + md.getModuleInfoAsString() + "has been deleted");
    } else {
      String msg = "Cannot remove an inexisting module : " + mdId;
      LOGGER.warn(msg);
      throw new IllegalArgumentException(msg);
    }
View Full Code Here

            }
        }
    }

    private List getServersUpToHandle(UAK uak, String visibility, String org, String mod, String rev, String path) {
        ModuleDescriptor md = getModuleDescriptor(uak, visibility, org, mod, rev);
        if (md == null) {
            throw new UnknwownContentException(visibility+"/"+org+"/"+mod+"/"+rev+"/"+path);
        }
        List servers = WOJServer.getInstance().getDataService().getServerDao().getServersHandling(md);
        if (servers == null) {
View Full Code Here

        boolean replicated = CommandUtil.getBooleanFromParamKey(m,Commands.GET_MODULE_DESCRIPTOR.P_REPLICATED).booleanValue();
        boolean hasSources = CommandUtil.getBooleanFromParamKey(m,Commands.GET_MODULE_DESCRIPTOR.P_HAS_SOURCES).booleanValue();
        boolean hasJavadoc = CommandUtil.getBooleanFromParamKey(m,Commands.GET_MODULE_DESCRIPTOR.P_HAS_JAVADOC).booleanValue();
        String home = CommandUtil.getStringFromParamKey(m,Commands.GET_MODULE_DESCRIPTOR.P_HOME_URL);
        boolean checkIntegrity = CommandUtil.getBooleanFromParamKey(m,Commands.GET_MODULE_DESCRIPTOR.P_CHECK_INTEGRITY).booleanValue();
        ModuleDescriptor moduleDesc =
          WOJServer.getInstance().getModuleManagementService().getModuleDescriptor(
              uak,
              org,
              module,
              rev,
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.common.model.content.ModuleDescriptor

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.