Package de.fraunhofer.iese.mydata
Class MyDataEnvironmentManager
java.lang.Object
de.fraunhofer.iese.mydata.MyDataEnvironmentManager
MyDataEnvironmentManager
handles the IMyDataEnvironment
,
whether it is local or cloud.
Simple usage example (local-mode, manual init/config):
MyDataEnvironmentManager.constructDefaultEnvironment().initializeLocal(new SolutionId("urn:solution:mysolution"), "Europe/Berlin", 4, true, null);
IMyDataEnvironment myDataEnvironment = MyDataEnvironmentManager.getDefaultEnvironment();
myDataEnvironment.registerLocalPxp("mailpxp", new MailPxp(...));
PolicyId policyId = myDataEnvironment.getPmp().addPolicy(new Policy(...));
myDataEnvironment.getPmp().deployPolicy(policyId);
Event event = new EventBuilder("mysolution", "read").withParameter("text", "Hello World", String.class).getEvent();
try{
myDataEnvironment.getPep().enforce(event); // use of a provided default PEP
System.out.println(event.getValueForName("text")); // access to the enforced event/data
} catch (InhibitException e){ // handling of InhibitException
System.out.println("Inhibited");
} catch (EvaluationUndecidableException e) { // handling of EvaluationUndecidableException
System.out.println("EvaluationUndecidable");
} catch (IOException e){ // handling of IOException
System.out.println("IOException");
}
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The id of the defaultIMyDataEnvironment
instance to which a reference is kept by the static context ofMyDataEnvironmentManager
. -
Method Summary
Modifier and TypeMethodDescriptionMethod to create the defaultIMyDataEnvironment
instancestatic void
Disable overwriting of existing MyDataEnvironments for testing purposestatic void
Enable overwriting of existing MyDataEnvironments for testing purposestatic IMyDataEnvironment
Static access to the defaultIMyDataEnvironment
static Optional<IMyDataEnvironment>
getEnvironment
(String environmentId) Access to aIMyDataEnvironment
instance via environmentId
-
Field Details
-
DEFAULT_ENVIRONMENT_ID
The id of the defaultIMyDataEnvironment
instance to which a reference is kept by the static context ofMyDataEnvironmentManager
.- See Also:
-
-
Method Details
-
enableOverwritingOfExistingMyDataEnvironments
public static void enableOverwritingOfExistingMyDataEnvironments()Enable overwriting of existing MyDataEnvironments for testing purpose -
disableOverwritingOfExistingMyDataEnvironments
public static void disableOverwritingOfExistingMyDataEnvironments()Disable overwriting of existing MyDataEnvironments for testing purpose -
getDefaultEnvironment
Static access to the defaultIMyDataEnvironment
- Returns:
- the default
IMyDataEnvironment
- Throws:
IllegalStateException
- when the defaultIMyDataEnvironment
has not been initialized yet.
-
getEnvironment
Access to aIMyDataEnvironment
instance via environmentId- Parameters:
environmentId
- the id of theIMyDataEnvironment
instance to access- Returns:
- an Optional that contains the
IMyDataEnvironment
if available
-
constructDefaultEnvironment
Method to create the defaultIMyDataEnvironment
instanceMyDataEnvironment myDataEnvironment = MyDataEnvironmentManager.constructDefaultEnvironment().initializeLocal(...);
Multiple Environments are not supported at the moment, so there is only the "Default Environment"
- Returns:
- a
IMyDataEnvironmentInitializer
that can be initialized
-