Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public class ServiceGroupResourceProvider extends AbstractControllerResourceProv
* creating a ServiceGroup based on a string ID
*/
@Deprecated
public static final String SERVICE_GROUP_STACK_PROPERTY_ID = RESPONSE_KEY
+ PropertyHelper.EXTERNAL_PATH_SEP + "stack";
public static final String SERVICE_GROUP_VERSION_PROPERTY_ID = RESPONSE_KEY
+ PropertyHelper.EXTERNAL_PATH_SEP + "version";


private static Set<String> pkPropertyIds =
Expand All @@ -111,15 +111,14 @@ public class ServiceGroupResourceProvider extends AbstractControllerResourceProv
PROPERTY_IDS.add(SERVICE_GROUP_CLUSTER_NAME_PROPERTY_ID);
PROPERTY_IDS.add(SERVICE_GROUP_SERVICE_GROUP_ID_PROPERTY_ID);
PROPERTY_IDS.add(SERVICE_GROUP_SERVICE_GROUP_NAME_PROPERTY_ID);
PROPERTY_IDS.add(SERVICE_GROUP_STACK_PROPERTY_ID);
PROPERTY_IDS.add(SERVICE_GROUP_VERSION_PROPERTY_ID);
PROPERTY_IDS.add(SERVICE_GROUP_MPACK_ID);
PROPERTY_IDS.add(SERVICE_GROUP_MPACK_NAME);
PROPERTY_IDS.add(SERVICE_GROUP_MPACK_VERSION);

// keys
KEY_PROPERTY_IDS.put(Resource.Type.Cluster, SERVICE_GROUP_CLUSTER_NAME_PROPERTY_ID);
KEY_PROPERTY_IDS.put(Resource.Type.ServiceGroup, SERVICE_GROUP_SERVICE_GROUP_NAME_PROPERTY_ID);
KEY_PROPERTY_IDS.put(Resource.Type.Stack, SERVICE_GROUP_STACK_PROPERTY_ID);
}

// ----- Constructors ----------------------------------------------------
Expand Down Expand Up @@ -159,14 +158,21 @@ public Set<ServiceGroupResponse> invoke() throws AmbariException, AuthorizationE
Iterator<ServiceGroupResponse> itr = createServiceGroups.iterator();
while (itr.hasNext()) {
ServiceGroupResponse response = itr.next();
StackId stackId = response.getStackId();
notifyCreate(Resource.Type.ServiceGroup, request);
Resource resource = new ResourceImpl(Resource.Type.ServiceGroup);
resource.setProperty(SERVICE_GROUP_CLUSTER_ID_PROPERTY_ID, response.getClusterId());
resource.setProperty(SERVICE_GROUP_CLUSTER_NAME_PROPERTY_ID, response.getClusterName());
resource.setProperty(SERVICE_GROUP_SERVICE_GROUP_ID_PROPERTY_ID, response.getServiceGroupId());
resource.setProperty(SERVICE_GROUP_SERVICE_GROUP_NAME_PROPERTY_ID, response.getServiceGroupName());
resource.setProperty(SERVICE_GROUP_STACK_PROPERTY_ID, response.getStackId());
resource.setProperty(SERVICE_GROUP_VERSION_PROPERTY_ID, stackId.toString());

// Set the specifics of mpack if the stack is linked to an mpack
if(response.getMpackId() != null) {
resource.setProperty(SERVICE_GROUP_MPACK_ID, response.getMpackId());
resource.setProperty(SERVICE_GROUP_MPACK_NAME, stackId.getStackName());
resource.setProperty(SERVICE_GROUP_MPACK_VERSION, stackId.getStackVersion());
}
associatedResources.add(resource);
}
return getRequestStatus(null, associatedResources);
Expand Down Expand Up @@ -207,14 +213,15 @@ public Set<ServiceGroupResponse> invoke() throws AmbariException {
response.getServiceGroupId(), requestedIds);
setResourceProperty(resource, SERVICE_GROUP_SERVICE_GROUP_NAME_PROPERTY_ID,
response.getServiceGroupName(), requestedIds);
setResourceProperty(resource, SERVICE_GROUP_STACK_PROPERTY_ID,
setResourceProperty(resource, SERVICE_GROUP_VERSION_PROPERTY_ID,
stackId.toString(), requestedIds);

// set the specifics of the mpack regardless of what keys were requested
resource.setProperty(SERVICE_GROUP_MPACK_ID, response.getMpackId());
resource.setProperty(SERVICE_GROUP_MPACK_NAME, stackId.getStackName());
resource.setProperty(SERVICE_GROUP_MPACK_VERSION, stackId.getStackVersion());

// Set the specifics of mpack if the stack is linked to an mpack
if(response.getMpackId() != null) {
resource.setProperty(SERVICE_GROUP_MPACK_ID, response.getMpackId());
resource.setProperty(SERVICE_GROUP_MPACK_NAME, stackId.getStackName());
resource.setProperty(SERVICE_GROUP_MPACK_VERSION, stackId.getStackVersion());
}
resources.add(resource);
}
return resources;
Expand Down Expand Up @@ -284,7 +291,7 @@ protected Set<String> getPKPropertyIds() {
private ServiceGroupRequest getRequest(Map<String, Object> properties) {
String clusterName = (String) properties.get(SERVICE_GROUP_CLUSTER_NAME_PROPERTY_ID);
String serviceGroupName = (String) properties.get(SERVICE_GROUP_SERVICE_GROUP_NAME_PROPERTY_ID);
String version = (String) properties.get(SERVICE_GROUP_STACK_PROPERTY_ID);
String version = (String) properties.get(SERVICE_GROUP_VERSION_PROPERTY_ID);
ServiceGroupRequest svcRequest = new ServiceGroupRequest(clusterName, serviceGroupName, version);
return svcRequest;
}
Expand Down