Examples of PluginEntity


Examples of org.vosao.entity.PluginEntity

    if (tokens.length < 4) {
      return null;
    }
    String pluginName = tokens[3];
    String servlet = tokens[4];
    PluginEntity plugin = getDao().getPluginDao().getByName(pluginName);
    if (plugin == null || plugin.isDisabled()) {
      return null;
    }
    try {
      PluginEntryPoint entryPoint = getEntryPoint(plugin);
      return entryPoint == null ? null :
View Full Code Here

Examples of org.vosao.entity.PluginEntity

      PluginException, DocumentException {
    Map<String, WarItem> war = readWar(data);
    if (!war.containsKey(VOSAO_PLUGIN)) {
      throw new PluginException(VOSAO_PLUGIN + " not found");
    }
    PluginEntity plugin = readPluginConfig(war.get(VOSAO_PLUGIN));
    if (StringUtils.isEmpty(plugin.getEntryPointClass())) {
      throw new PluginException("Entry point class not defined.");
    }
    PluginEntity p = getDao().getPluginDao().getByName(plugin.getName());
    if (p != null) {
      plugin.setConfigData(p.getConfigData());
      uninstall(p);
    }
    getDao().getPluginDao().save(plugin);
    String pluginBase = "/plugins/" + plugin.getName();
    getBusiness().getFolderBusiness().createFolder(pluginBase);
View Full Code Here

Examples of org.vosao.entity.PluginEntity

    return map;
  }

  private PluginEntity readPluginConfig(WarItem zipItem)
      throws UnsupportedEncodingException, DocumentException {
    PluginEntity result = new PluginEntity();
    Element root = DocumentHelper.parseText(zipItem.data.toString("UTF-8"))
        .getRootElement();
    result.setName(root.elementText("name"))
    result.setTitle(root.elementText("title"));
    result.setVersion(root.elementText("version"));
    result.setDescription(root.elementText("description"));
    result.setWebsite(root.elementText("website"));
    if (root.element("entry-point-class") != null) {
      result.setEntryPointClass(StringUtils.strip(
          root.elementText("entry-point-class")));
    }
    if (root.element("plugin-config-url") != null) {
      result.setConfigURL(StringUtils.strip(
          root.elementText("plugin-config-url")));
    }
    StringBuffer header = new StringBuffer();
    if (root.element("header-javascript") != null) {
      for (Element e : (List<Element>)root.elements("header-javascript")) {
        header.append("<script type=\"text/javascript\" src=\"/file/plugins/")
          .append(result.getName()).append("/").append(e.getText())
          .append("\"></script>\n");
      }
    }
    if (root.element("header-css") != null) {
      for (Element e : (List<Element>)root.elements("header-css")) {
        header.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"/file/plugins/")
          .append(result.getName()).append("/").append(e.getText())
          .append("\"/>\n");
      }
    }
    result.setPageHeader(header.toString());
    if (root.element("config") != null) {
      result.setConfigStructure(root.element("config").asXML());
    }
    return result;
  }
View Full Code Here

Examples of org.vosao.entity.PluginEntity

import org.vosao.entity.PluginEntity;

public class PluginDaoTest extends AbstractDaoTest {

  private PluginEntity addPlugin(String name, String title) {
    return getDao().getPluginDao().save(new PluginEntity(name, title, "",
        ""));
  }
View Full Code Here

Examples of org.vosao.entity.PluginEntity

 
  public void testGetByName() {
    addPlugin("sitemap", "sitemap");
    addPlugin("black", "black");
    addPlugin("super", "ordinal");
    PluginEntity s = getDao().getPluginDao().getByName("black");
    assertNotNull(s);
    assertEquals("black", s.getName());
    s = getDao().getPluginDao().getByName(null);
    assertNull(s);
    s = getDao().getPluginDao().getByName("megahit");
    assertNull(s);
 
View Full Code Here

Examples of org.vosao.entity.PluginEntity

    for (Iterator<Element> i = PluginsElement.elementIterator();
        i.hasNext(); ) {
            Element element = i.next();
            if (element.getName().equals("plugin")) {
              String name = element.elementText("name");
              PluginEntity plugin = getDao().getPluginDao().getByName(name);
              if (plugin == null) {
                continue;
              }
              plugin.setName(name);
              plugin.setConfigData(element.elementText("configData"));
              getDaoTaskAdapter().pluginSave(plugin);
            }
    }   
  }
View Full Code Here

Examples of org.vosao.entity.PluginEntity

  @Override
  public void pluginSave(PluginEntity entity) throws DaoTaskException {
    if (isSkip()) {
      if (entity.getId() == null) {
        PluginEntity found = getDao().getPluginDao().getByName(
            entity.getName());
        if (found == null) {
          throw new DaoTaskException("Plugin not found while "
            + "skipping save operation. " + entity.getName());
        }
        entity.setId(found.getId());
      }
    }
    else {
      getDao().getPluginDao().saveNoAudit(entity);
    }
View Full Code Here

Examples of org.vosao.entity.PluginEntity

  }

  @Override
  public ServiceResponse remove(Long id) {
    try {
      PluginEntity plugin = getDao().getPluginDao().getById(id);
      if (plugin != null) {
        getBusiness().getPluginBusiness().uninstall(plugin);
        return ServiceResponse.createSuccessResponse(
            Messages.get("plugin.success_uninstall"));
      }
View Full Code Here

Examples of org.vosao.entity.PluginEntity

    }
  }

  @Override
  public List<PluginPropertyVO> getProperties(Long pluginId) {
    PluginEntity plugin = getDao().getPluginDao().getById(pluginId);
    if (plugin == null) {
      return Collections.EMPTY_LIST;
    }
    return getBusiness().getPluginBusiness().getProperties(plugin)
  }
View Full Code Here

Examples of org.vosao.entity.PluginEntity

    return getDao().getPluginDao().getByName(pluginName);
  }

  @Override
  public ServiceResponse savePluginConfig(Long pluginId, String xml) {
    PluginEntity plugin = getById(pluginId);
    if (plugin != null) {
      plugin.setConfigData(xml);
      getDao().getPluginDao().save(plugin);
      return ServiceResponse.createSuccessResponse(
          Messages.get("config.success_save"));
    }
    else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.