Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for neo4j embedded #177

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ package gov.nist.csd.pm;
import gov.nist.csd.pm.epp.EPP;
import gov.nist.csd.pm.impl.memory.pap.MemoryPAP;
import gov.nist.csd.pm.pap.PAP;
import gov.nist.csd.pm.pap.exception.PMException;
import gov.nist.csd.pm.pap.graph.relationship.AccessRightSet;
import gov.nist.csd.pm.pap.prohibition.ContainerCondition;
import gov.nist.csd.pm.pap.prohibition.ProhibitionSubject;
import gov.nist.csd.pm.common.exception.PMException;
import gov.nist.csd.pm.common.graph.relationship.AccessRightSet;
import gov.nist.csd.pm.common.prohibition.ContainerCondition;
import gov.nist.csd.pm.common.prohibition.ProhibitionSubject;
import gov.nist.csd.pm.pap.query.model.context.UserContext;
import gov.nist.csd.pm.pap.query.model.context.TargetContext;
import gov.nist.csd.pm.pdp.PDP;
Expand Down
21 changes: 16 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>gov.nist.csd.pm</groupId>
<artifactId>policy-machine-core</artifactId>
<packaging>jar</packaging>
<version>3.0.0-alpha.1</version>
<version>3.0.0</version>

<build>
<extensions>
Expand All @@ -28,10 +28,10 @@
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
<clearOutputDirectory>false</clearOutputDirectory>
<!-- Protobuf Compiler -->
<protocArtifact>com.google.protobuf:protoc:3.24.3:exe:${os.detected.classifier}</protocArtifact>
<protocArtifact>com.google.protobuf:protoc:3.25.5:exe:${os.detected.classifier}</protocArtifact>
<!-- gRPC Compiler -->
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.57.0:exe:${os.detected.classifier}</pluginArtifact>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.61.1:exe:${os.detected.classifier}</pluginArtifact>
</configuration>
<executions>
<!-- Execution for Message Classes -->
Expand Down Expand Up @@ -190,6 +190,11 @@
<artifactId>commons-lang3</artifactId>
<version>3.13.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
Expand All @@ -204,19 +209,25 @@
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.57.0</version>
<version>1.61.1</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.57.0</version>
<version>1.61.1</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>annotations-api</artifactId>
<version>6.0.53</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>5.25.1</version>
</dependency>
</dependencies>

<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package gov.nist.csd.pm.pap.obligation;
package gov.nist.csd.pm.common.event;

import gov.nist.csd.pm.pap.op.Operation;
import gov.nist.csd.pm.common.op.Operation;

import java.util.List;
import java.util.Map;
import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
package gov.nist.csd.pm.epp;
package gov.nist.csd.pm.common.event;

import gov.nist.csd.pm.pap.exception.PMException;
import gov.nist.csd.pm.pap.obligation.EventContext;
import gov.nist.csd.pm.common.exception.PMException;

/**
* Interface for emitting events to be processed by an EPP.
*/
public interface EventEmitter {
public interface EventPublisher {

/**
* Add the given EventProcessor as a listener for policy events.
* @param processor The processor to add as a listener.
*/
void addEventListener(EventProcessor processor);
void addEventSubscriber(EventSubscriber processor);

/**
* Remove the given EventProcessor as a listener.
* @param processor The processor to remove.
*/
void removeEventListener(EventProcessor processor);
void removeEventSubscriber(EventSubscriber processor);

/**
* Emit the given event context to any EventProcessors listening.
* @param event The EventContext to emit.
* @throws PMException If there is an exception emitting the event.
*/
void emitEvent(EventContext event) throws PMException;
void publishEvent(EventContext event) throws PMException;

}
17 changes: 17 additions & 0 deletions src/main/java/gov/nist/csd/pm/common/event/EventSubscriber.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package gov.nist.csd.pm.common.event;

import gov.nist.csd.pm.common.exception.PMException;

/**
* Interface for processing EventContexts.
*/
public interface EventSubscriber {

/**
* Process the given EventContext.
* @param eventCtx The event context to process.
* @throws PMException If there is an error processing the EventContext.
*/
void processEvent(EventContext eventCtx) throws PMException;

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class AdminAccessRightExistsException extends PMException {
public AdminAccessRightExistsException(String ar) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class AdminPolicyVerificationException extends PMException {
public AdminPolicyVerificationException(PMException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class AssignmentCausesLoopException extends PMException {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class BootstrapExistingPolicyException extends PMException {
public BootstrapExistingPolicyException() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class CannotDeleteAdminPolicyConfigException extends PMException {
public CannotDeleteAdminPolicyConfigException() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

import gov.nist.csd.pm.pap.graph.node.NodeType;
import gov.nist.csd.pm.common.graph.node.NodeType;

public class DisconnectedNodeException extends PMException {
public DisconnectedNodeException(String ascendant, String descendant) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class InvalidProhibitionSubjectException extends PMException {
public InvalidProhibitionSubjectException(String type) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class NodeDoesNotExistException extends PMException {
public NodeDoesNotExistException(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class NodeHasAscendantsException extends PMException {
public NodeHasAscendantsException(String node) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class NodeNameExistsException extends PMException {
public NodeNameExistsException(String nodeName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class NodeReferencedInObligationException extends PMException {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class NodeReferencedInProhibitionException extends PMException {
public NodeReferencedInProhibitionException(String nodeToDelete, String prohibitionName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class NodesAlreadyAssignedException extends PMException {
public NodesAlreadyAssignedException(String ua, String target) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class ObligationDoesNotExistException extends PMException {
public ObligationDoesNotExistException(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class ObligationNameExistsException extends PMException {
public ObligationNameExistsException(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class ObligationRuleNameExistsException extends PMException {
public ObligationRuleNameExistsException(String obligationName, String ruleName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

import java.util.Collection;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class OperationDoesNotExistException extends PMException {
public OperationDoesNotExistException(String op) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class OperationExistsException extends PMException {
public OperationExistsException(String op) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

/**
* Wrapper for backend related exceptions independent of backend implementation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

/**
* Root exception to cover any possible error in the Policy Machine interfaces. This is to support multiple implementations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class PMLConstantAlreadyDefinedException extends PMException {
public PMLConstantAlreadyDefinedException(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class PMLConstantNotDefinedException extends PMException {
public PMLConstantNotDefinedException(String c) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class PMLFunctionAlreadyDefinedException extends PMException {
public PMLFunctionAlreadyDefinedException(String functionName) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class PMLFunctionNotDefinedException extends PMException {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class PMRuntimeException extends RuntimeException {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class PolicyEntityDoesNotExistException extends PMException {
public PolicyEntityDoesNotExistException(String msg) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class ProhibitionContainerDoesNotExistException extends PMException {
public ProhibitionContainerDoesNotExistException(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class ProhibitionDoesNotExistException extends PMException {
public ProhibitionDoesNotExistException(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class ProhibitionExistsException extends PMException {
public ProhibitionExistsException(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class ProhibitionSubjectDoesNotExistException extends PMException {
public ProhibitionSubjectDoesNotExistException(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class RepObjectNotSetException extends PMException {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class RoutineDoesNotExistException extends PMException {
public RoutineDoesNotExistException(String routine) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class RoutineExistsException extends PMException {
public RoutineExistsException(String routine) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class UnknownAccessRightException extends PMException {
public UnknownAccessRightException(String ar) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class UnknownOperandException extends PMException {
public UnknownOperandException(String operand) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class UnknownPatternException extends PMException {
public UnknownPatternException() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gov.nist.csd.pm.pap.exception;
package gov.nist.csd.pm.common.exception;

public class UnknownTypeException extends PMException {
public UnknownTypeException(String type) {
Expand Down
Loading
Loading