What is the correct way to add objects to the StateRepository?
Up to Table of ContentsThis FAQ applies to: 5.1, 5.2
You should use the getOrCreateObject method on the StateRepository to add new objects, rather than using the constructors (e.g. new RemoteJobServiceImpl(EPR)) directly. This avoids hard-coding the implementation class in your code, and allows use of the newer dynamic proxies.
If you know the type of the object represented by the EPR then pass that as the first argument, like this:
StateRepository repository = new MemoryStateRepository();
RemoteJobService service = repository.getOrCreateObject(RemoteJobService.class, EPR);
Otherwise, it will try to get the type from the EPR's metadata (which will fail with "EPR type is null!" if the type isn't there).
If you still get warnings about using deprecated classes, it may be that you have an old copy of implementationfactory.properties in your CLASSPATH, from a previous version of GRIA. Update it to match the one in the latest version of the client (gria-client-cli-5.xx.jar).