summaryrefslogtreecommitdiffstats
path: root/verigraph/src/it/polito/neo4j/manager/Neo4jDBInteraction.java
blob: d9e006eac5546317571cb134717435eee4974613 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*******************************************************************************
 * Copyright (c) 2017 Politecnico di Torino and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Apache License, Version 2.0
 * which accompanies this distribution, and is available at
 * http://www.apache.org/licenses/LICENSE-2.0
 *******************************************************************************/
package it.polito.neo4j.manager;

import java.util.Set;

import org.neo4j.graphdb.Label;
import org.neo4j.graphdb.RelationshipType;

import it.polito.neo4j.jaxb.Graph;
import it.polito.neo4j.jaxb.Graphs;
import it.polito.neo4j.jaxb.Neighbour;
import it.polito.neo4j.jaxb.Paths;
import it.polito.neo4j.exceptions.DuplicateNodeException;
import it.polito.neo4j.exceptions.MyInvalidIdException;
import it.polito.neo4j.exceptions.MyInvalidObjectException;
import it.polito.neo4j.exceptions.MyNotFoundException;

public interface Neo4jDBInteraction {
    public enum NodeType implements Label
    {
        Nffg, Node, Firewall, EndHost, EndPoint, Antispam, Cache, DPI, Mailclient, Mailserver, NAT, VPNAccess, VPNExit, Webclient, Webserver, Configuration, Fieldmodifier;
    }
    public enum RelationType implements RelationshipType
    {
        PathRelationship, OwnerRelationship, ConfigurationRelantionship, ElementRelationship;
    }

    public void createGraphs(Graphs graphs) throws MyNotFoundException, MyInvalidIdException;
    public Graph createGraph(Graph graph) throws MyNotFoundException, MyInvalidIdException;
    public it.polito.neo4j.jaxb.Node createNode(it.polito.neo4j.jaxb.Node node, long graphId) throws MyNotFoundException, DuplicateNodeException, MyInvalidIdException;
    public Neighbour createNeighbour(Neighbour neighbour, long graphId, long nodeId) throws MyNotFoundException;

    public Graphs getGraphs();
    public Graph getGraph(long id) throws MyNotFoundException;
    public Set<it.polito.neo4j.jaxb.Node> getNodes(long graphId) throws MyNotFoundException;
    public it.polito.neo4j.jaxb.Node getNode(long graphId, long nodeId) throws MyNotFoundException;
    public Set<Neighbour> getNeighbours(long graphId, long nodeId) throws MyNotFoundException;
    public Neighbour getNeighbour(long graphId, long nodeId, long neighbourId) throws MyNotFoundException;

    public void deleteGraph(long id) throws MyNotFoundException;
    public void deleteNode(long graphId, long nodeId) throws MyNotFoundException;
    public void deleteNeighbour(long graphId, long nodeId, long neighbourId) throws MyNotFoundException;

    public it.polito.neo4j.jaxb.Node updateNode(it.polito.neo4j.jaxb.Node node, long graphId, long nodeId) throws MyNotFoundException, MyInvalidObjectException, MyInvalidIdException;
    public Graph updateGraph(Graph graph, long graphId) throws MyNotFoundException, MyInvalidObjectException, DuplicateNodeException, MyInvalidIdException;
    public it.polito.neo4j.jaxb.Node updateNeighbour(Neighbour neighbour, long graphId, long nodeId, long neighbourId) throws MyNotFoundException, MyInvalidObjectException;

    public Paths findAllPathsBetweenTwoNodes(long graphId, String srcName, String dstName, String direction) throws MyNotFoundException;
}