Skip to content

Commit

Permalink
#338 add skeleton code to build the outcome about chnaged resources
Browse files Browse the repository at this point in the history
  • Loading branch information
kovax committed Feb 24, 2020
1 parent 858da4e commit 5ae7086
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
Expand Up @@ -48,6 +48,7 @@
import org.cristalise.kernel.persistency.outcome.Outcome;
import org.cristalise.kernel.process.resource.BuiltInResources;
import org.cristalise.kernel.process.resource.ResourceImportHandler;
import org.cristalise.kernel.process.resource.ResourceImportHandler.Status;
import org.cristalise.kernel.property.Property;
import org.cristalise.kernel.scripting.ScriptConsole;
import org.cristalise.kernel.utils.FileStringUtility;
Expand Down Expand Up @@ -174,8 +175,12 @@ private static void verifyBootDataItems(String bootList, String ns, boolean rese

try {
String location = "boot/"+filename+(itemType.equals("OD")?".xsd":".xml");
ResourceImportHandler typeImpHandler = Gateway.getResourceImportHandler(BuiltInResources.getValue(itemType));
typeImpHandler.importResource(ns, itemName, 0, itemPath, location, reset);
ResourceImportHandler importHandler = Gateway.getResourceImportHandler(BuiltInResources.getValue(itemType));
importHandler.importResource(ns, itemName, 0, itemPath, location, reset);

if (importHandler.getResourceStatus() != Status.UNCHANGED) {
//
}
}
catch (Exception e) {
log.error("Error importing bootstrap items. Unsafe to continue.", e);
Expand Down
Expand Up @@ -51,6 +51,7 @@
import org.cristalise.kernel.process.Bootstrap;
import org.cristalise.kernel.process.Gateway;
import org.cristalise.kernel.process.resource.BuiltInResources;
import org.cristalise.kernel.process.resource.ResourceImportHandler.Status;
import org.cristalise.kernel.property.Property;
import org.cristalise.kernel.scripting.ErrorInfo;
import org.cristalise.kernel.scripting.ScriptingEngineException;
Expand Down Expand Up @@ -208,7 +209,11 @@ private void importResources(AgentProxy systemAgent, boolean reset) {

try {
thisRes.setNamespace(ns);
addItemToContents( thisRes.create(systemAgent.getPath(), reset) );
addItemToContents(thisRes.create(systemAgent.getPath(), reset));

if (thisRes.getStatus() != Status.UNCHANGED) {
//
}
}
catch (Exception ex) {
log.error("Error importing module resources. Unsafe to continue.", ex);
Expand Down
Expand Up @@ -35,13 +35,15 @@
import org.cristalise.kernel.process.Gateway;
import org.cristalise.kernel.process.resource.BuiltInResources;
import org.cristalise.kernel.process.resource.ResourceImportHandler;
import org.cristalise.kernel.process.resource.ResourceImportHandler.Status;

@Getter @Setter @Slf4j
public class ModuleResource extends ModuleImport {

public int version;
public BuiltInResources type;
public String resourceLocation;
private Status status;

public ModuleResource() {
// if not given, version defaults to 0
Expand Down Expand Up @@ -91,7 +93,12 @@ public Path create(AgentPath agentPath, boolean reset)
{
try {
ResourceImportHandler importHandler = Gateway.getResourceImportHandler(type);
return domainPath = importHandler.importResource(ns, name, version, itemPath, getResourceLocation(), reset);


domainPath = importHandler.importResource(ns, name, version, itemPath, getResourceLocation(), reset);
status = importHandler.getResourceStatus();

return domainPath;
}
catch (Exception e) {
log.error("", e);
Expand Down
Expand Up @@ -281,6 +281,7 @@ private ItemProxy verifyPathAndModuleProperty(String ns, String itemName, ItemPa
}
return thisProxy;
}

/**
*
*/
Expand Down
Expand Up @@ -32,7 +32,7 @@


public interface ResourceImportHandler {
enum Status {NEW, CHANGED, UNCHANGED};
public enum Status {NEW, CHANGED, UNCHANGED};

/**
* Returns the DomainPath for a specific resource
Expand Down

0 comments on commit 5ae7086

Please sign in to comment.