artifactResource.getProperty(GovernanceConstants.ARTIFACT_ID_PROP_KEY);
if (GovernanceConstants.SERVICE_MEDIA_TYPE.equals(artifactResource.getMediaType())) {
// it is a service
byte[] contentBytes = (byte[]) artifactResource.getContent();
if (contentBytes == null) {
throw new GovernanceException("Unable to read payload of governance artifact " +
"at path: " + artifactPath);
}
OMElement contentElement = buildOMElement(contentBytes);
Service service = new Service(artifactId, contentElement);
service.associateRegistry(registry);
return service;
// }
/*else if (GovernanceConstants.PROCESS_MEDIA_TYPE.equals(
artifactResource.getMediaType())) {
// it is a process
byte[] contentBytes = (byte[]) artifactResource.getContent();
if (contentBytes == null) {
throw new GovernanceException("Unable to read payload of governance artifact " +
"at path: " + artifactPath);
}
OMElement contentElement = buildOMElement(contentBytes);
Process process = new Process(artifactId, contentElement);
process.associateRegistry(registry);
return process;
} else if (GovernanceConstants.SLA_MEDIA_TYPE.equals(artifactResource.getMediaType())) {
// it is a SLA
byte[] contentBytes = (byte[]) artifactResource.getContent();
if (contentBytes == null) {
throw new GovernanceException("Unable to read payload of governance artifact " +
"at path: " + artifactPath);
}
OMElement contentElement = buildOMElement(contentBytes);
SLA sla = new SLA(artifactId, contentElement);
sla.associateRegistry(registry);
return sla;*/
} else if (GovernanceConstants.WSDL_MEDIA_TYPE
.equals(artifactResource.getMediaType())) {
return new Wsdl(artifactId, registry);
} else if (GovernanceConstants.SCHEMA_MEDIA_TYPE
.equals(artifactResource.getMediaType())) {
return new Schema(artifactId, registry);
} else if (GovernanceConstants.POLICY_XML_MEDIA_TYPE
.equals(artifactResource.getMediaType())) {
return new Policy(artifactId, registry);
} else if (GovernanceConstants.ENDPOINT_MEDIA_TYPE
.equals(artifactResource.getMediaType())) {
return new Endpoint(artifactId, registry);
}
/*else if (GovernanceConstants.PEOPLE_MEDIA_TYPE.
equals(artifactResource.getMediaType())) {
// it is a peopleArtifact
byte[] contentBytes = (byte[]) artifactResource.getContent();
OMElement contentElement = null;
if (contentBytes != null) {
contentElement = buildOMElement(contentBytes);
}
String peopleGroup = CommonUtil.getPeopleGroup(contentElement);
PeopleArtifact peopleArtifact = null;
switch (PeopleGroup.valueOf(peopleGroup.toUpperCase())) {
case ORGANIZATION:
peopleArtifact = new Organization(artifactId, contentElement);
break;
case DEPARTMENT:
peopleArtifact = new Department(artifactId, contentElement);
break;
case PROJECT_GROUP:
peopleArtifact = new ProjectGroup(artifactId, contentElement);
break;
case PERSON:
peopleArtifact = new Person(artifactId, contentElement);
break;
default:
assert false;
}
peopleArtifact.associateRegistry(registry);
return peopleArtifact;
}*/
} catch (RegistryException e) {
String msg =
"Error in retrieving governance artifact by path. path: " + artifactPath + ".";
log.error(msg, e);
throw new GovernanceException(msg, e);
}
return null;
}