Package org.vosao.entity

Examples of org.vosao.entity.PluginResourceEntity


    String resourceName = item.path.replace("WEB-INF/classes/", "");
    if (ext.equals("class")) {
      resourceName = resourceName.replace('/', '.')
        .replace(".class", "");
    }
    PluginResourceEntity res = getDao().getPluginResourceDao()
        .getByUrl(plugin.getName(), resourceName);
    if (res == null) {
      res = new PluginResourceEntity(plugin.getName(),
          resourceName, fileData);
    }
    else {
      res.setContent(fileData);
    }
    getDao().getPluginResourceDao().save(res);
    getBusiness().getPluginResourceBusiness()
      .updateResourceCache(res);
    return res.getId().toString();
  }
View Full Code Here


      List<String> resourceList, List<String> fileList) {
    String resourceListStr = StrUtil.toCSV(resourceList);
    String fileListStr = StrUtil.toCSV(fileList);
    try {
      getDao().getPluginResourceDao().save(
          new PluginResourceEntity(plugin.getName(),
              plugin.getName() + RESOURCE_LIST,
              resourceListStr.getBytes("UTF-8")));
      getDao().getPluginResourceDao().save(
          new PluginResourceEntity(plugin.getName(),
              plugin.getName() + FILE_LIST,
              fileListStr.getBytes("UTF-8")));
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }
View Full Code Here

        "/plugins/" + plugin.getName());
    getDao().getPluginDao().remove(plugin.getId());
  }
 
  private void removePluginResources(PluginEntity plugin) {
    PluginResourceEntity listResource = getDao().getPluginResourceDao()
        .getByUrl(plugin.getName(), plugin.getName() + RESOURCE_LIST);
    if (listResource == null) {
      return;
    }
    List<Long> ids = new ArrayList<Long>();
    ids.add(listResource.getId());
    if (listResource.getContent() != null && listResource.getContent().length > 0) {
      try {
        String list = new String(listResource.getContent(), "UTF-8");
        String[] resources = list.split(",");
        for (String id : resources) {
          ids.add(Long.valueOf(id));
        }
      } catch (UnsupportedEncodingException e) {
View Full Code Here

    }
    getDao().getPluginResourceDao().remove(ids);
  }

  private void removePluginFileCache(PluginEntity plugin) {
    PluginResourceEntity listResource = getDao().getPluginResourceDao()
      .getByUrl(plugin.getName(), plugin.getName() + FILE_LIST);
    if (listResource == null) {
      return;
    }
    getDao().getPluginResourceDao().remove(listResource.getId());
    try {
      String list = new String(listResource.getContent(), "UTF-8");
      String[] resources = list.split(",");
      for (String path : resources) {
        getBusiness().getSystemService().getFileCache().remove(path);
      }
    } catch (UnsupportedEncodingException e) {
View Full Code Here

    }
    return getCache().get(pluginName, name);
  }

  private byte[] loadPluginResource(String name) {
    PluginResourceEntity resource = getDao().getPluginResourceDao()
        .getByUrl(pluginName, name);
    if (resource != null) {
      return resource.getContent();
    }
    return null;
  }
View Full Code Here

public class PluginResourceDaoTest extends AbstractDaoTest {

  private PluginResourceEntity addPluginResource(String plugin, String url) {
    byte[] c = new byte[1];
    return getDao().getPluginResourceDao().save(
        new PluginResourceEntity(plugin, url, c));
  }
View Full Code Here

 
  public void testGetByUrl() {
    addPluginResource("sitemap", "file1");
    addPluginResource("black", "file2");
    addPluginResource("super", "file1");
    PluginResourceEntity s = getDao().getPluginResourceDao().getByUrl(
        "sitemap", "file1");
    assertNotNull(s);
    assertEquals("file1", s.getUrl());
    s = getDao().getPluginResourceDao().getByUrl(null, null);
    assertNull(s);
    s = getDao().getPluginResourceDao().getByUrl("sitemap", null);
    assertNull(s);
    s = getDao().getPluginResourceDao().getByUrl("megahit", "test");
View Full Code Here

TOP

Related Classes of org.vosao.entity.PluginResourceEntity

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.