Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.openl.rules.repository.jcr;
  
  
  import javax.jcr.Node;
  
 
 public class JcrProductionDeployment extends JcrProductionEntity implements RProductionDeployment {
     private static final Object lock = new Object();
 
     private Node node;

    
Creates new deployment instance.

Note that OpenL project cannot be created inside other OpenL project. I.e. nesting is not allowed for OpenL projects.

Parameters:
parentNode parent node
nodeName name of node
Returns:
newly created deployment
Throws:
javax.jcr.RepositoryException if fails
 
     static JcrProductionDeployment createDeployment(Node parentNodeString nodeNamethrows RepositoryException {
         Node n = NodeUtil.createNode(parentNodenodeName.false);
 
         parentNode.save();
         n.save();
 
         return new JcrProductionDeployment(n);
     }
 
     public JcrProductionDeployment(Node nodethrows RepositoryException {
         super(node);
         NodeUtil.checkNodeType(node.);
 
         this. = node;
     }
 
     public RProject createProject(String projectNamethrows RRepositoryException {
         try {
             return JcrProductionProject.createProject(projectName);
         } catch (RepositoryException e) {
             throw new RRepositoryException("Failed to create project!"e);
         }
     }
 
     public RProject getProject(String namethrows RRepositoryException {
         try {
             return new JcrProductionProject(.getNode(name));
         } catch (RepositoryException e) {
             throw new RRepositoryException("Failed to get project " + namee);
         }
     }
 
     public Collection<RProjectgetProjects() throws RRepositoryException {
         Collection<RProjectresult = new ArrayList<RProject>();
         try {
             NodeIterator nodeIterator = node().getNodes();
             while (nodeIterator.hasNext()) {
                 Node node = nodeIterator.nextNode();
                 if (node.getPrimaryNodeType().getName().equals(.)) {
                     result.add(getProject(node.getName()));
                 }
             }
 
             return result;
         } catch (RepositoryException e) {
             throw new RRepositoryException("Failed to get projects!"e);
         }
     }
 
     public boolean hasProject(String namethrows RRepositoryException {
         try {
             return .hasNode(name);
         } catch (RepositoryException e) {
             throw new RRepositoryException("Failed to check if project exists!"e);
         }
     }
 
     private void repositoryNotify() throws RepositoryException {
         synchronized () {
             Node root = .getParent();
             root.setProperty(., (Stringnull);
             root.setProperty(."1");
             .getParent().save();
         }
     }
 
     public void save() throws RRepositoryException {
         try {
             .save();
             repositoryNotify();
        } catch (RepositoryException e) {
            throw new RRepositoryException("Failed to save deployment!"e);
        }
    }
New to GrepCode? Check out our FAQ X