/** * Build graph. * * @param properties the properties */ protected void buildGraph(Map<String, String> properties) { graphFactory = new PropertiesGraphFactory(properties); }
/** * Get previous from vertex param. * * @param vertex the vertex * @return previous vertex */ protected static Vertex<String> getPrevious(Vertex<String> vertex) { return getParent(vertex); }
/** * Build KernelDeployment instance. * * @return KernelDeployment instance */ public KernelDeployment build() { return graphFactory.build(); } }
protected KernelDeployment parse(VFSDeploymentUnit unit, VirtualFile file, KernelDeployment root) throws Exception { Properties properties = new Properties(); InputStream is = openStreamAndValidate(file); try { properties.load(is); DeploymentBuilder deploymentBuilder = new DeploymentBuilder(properties); return deploymentBuilder.build(); } finally { try { is.close(); } catch (IOException ignored) { } } } }
@SuppressWarnings("unchecked") public void visit() { Vertex<String> parent = getParent(this); Set<Vertex<String>> children = getChildren(this); if (log.isTraceEnabled()) log.trace("Structure visit, parent: " + parent + ", children: " + children); visit((T)parent, children); }
if (current == null) current = vertexFactory.createVertex(level, name); graph.addVertex(current); Vertex<String> valueVertex = vertexFactory.valueVertex(value); graph.addVertex(valueVertex); graph.addEdge(current, valueVertex, -1); buildVertices(current, p, key, value, level + 1);
public DeploymentBuilder(Properties properties) { buildGraph(toMap(properties)); }
public PropertiesGraphFactory(Properties properties) { if (properties == null) throw new IllegalArgumentException("Null properties."); buildGraph(toMap(properties)); }
/** * Build graph from properties. * * @param properties the properties */ protected void buildGraph(Map<String, String> properties) { graph = new Graph<String>(); root = vertexFactory.rootVertex(); graph.setRootVertex(root); for(String key : properties.keySet()) { String value = properties.get(key); buildVertices(root, 0, key, value, 0); } }
public DeploymentBuilder(Map<String, String> properties) { buildGraph(properties); }
public PropertiesGraphFactory(Map<String, String> properties) { if (properties == null) throw new IllegalArgumentException("Null properties."); buildGraph(properties); }
/** * Get the last token. * * @return last token string */ protected String getLastToken() { if (lastToken == null) { String fullName = getName(); int p = fullName.lastIndexOf('.') + 1; lastToken = fullName.substring(p); } return lastToken; }
/** * Get the next vertex. * * @param vertex the vertex * @return next vertex */ protected static Vertex<String> getNext(Vertex<String> vertex) { Set<Vertex<String>> children = getChildren(vertex); if (children.isEmpty()) return null; if (children.size() > 1) throw new IllegalArgumentException("Multiple children: " + vertex); return children.iterator().next(); }
protected KernelDeployment parse(VFSDeploymentUnit unit, VirtualFile file, KernelDeployment root) throws Exception { Properties properties = new Properties(); InputStream is = file.openStream(); try { properties.load(is); DeploymentBuilder deploymentBuilder = new DeploymentBuilder(properties); return deploymentBuilder.build(); } finally { try { is.close(); } catch (IOException ignored) { } } } }