/**
  * Check existed software registration node
  *
  * @return
  */
 private boolean hasSoftwareRegistration() {
   SessionProvider sessionProvider = null;
   try {
     if (hasSoftwareRegisteredNode) {
       return hasSoftwareRegisteredNode;
     } else {
       try {
         sessionProvider = SessionProvider.createSystemProvider();
         Node publicApplicationNode =
             nodeHierarchyCreator.getPublicApplicationNode(sessionProvider);
         if (publicApplicationNode.hasNode(SW_NODE_NAME)) {
           hasSoftwareRegisteredNode = true;
         } else {
           hasSoftwareRegisteredNode = false;
         }
       } catch (Exception e) {
         LOG.error("Software Registration: cannot get node", e);
         hasSoftwareRegisteredNode = false;
       } finally {
         sessionProvider.close();
       }
       return hasSoftwareRegisteredNode;
     }
   } catch (Exception e) {
     LOG.error("Software Registration: cannot check node", e);
   }
   return hasSoftwareRegisteredNode;
 }
Пример #2
0
  public String getHomePageLogoURI() {
    SessionProvider sProvider = SessionProvider.createSystemProvider();
    Node rootNode = null;
    Node publicApplicationNode = null;
    String pathImageNode = null;
    Node ImageNode = null;
    Session session = null;
    try {
      publicApplicationNode = nodeCreator.getPublicApplicationNode(sProvider);
      session = publicApplicationNode.getSession();
      rootNode = session.getRootNode();
      Node logosNode = rootNode.getNode(path);
      if (logosNode.hasNode(logo_name)) {
        ImageNode = logosNode.getNode(logo_name);
        pathImageNode = ImageNode.getPath() + "?" + System.currentTimeMillis();
      }
    } catch (Exception e) {
      LOG.error("Can not get path of Logo : default LOGO will be used" + e.getMessage(), e);
      return null;
    } finally {
      if (session != null) session.logout();

      if (sProvider != null) sProvider.close();
    }

    return pathImageNode;
  }
 /** Create software registration node */
 private void createSoftwareRegistrationNode() {
   SessionProvider sessionProvider = SessionProvider.createSystemProvider();
   try {
     Node publicApplicationNode = nodeHierarchyCreator.getPublicApplicationNode(sessionProvider);
     if (!publicApplicationNode.hasNode(SW_NODE_NAME)) {
       publicApplicationNode = publicApplicationNode.addNode(SW_NODE_NAME, "nt:folder");
       publicApplicationNode.addMixin("mix:referenceable");
       publicApplicationNode.getSession().save();
     }
   } catch (Exception e) {
     LOG.error("Software Registration: cannot create node", e);
   } finally {
     if (sessionProvider != null) {
       sessionProvider.close();
     }
   }
 }