AMBARI-14714. Fix compile errors (benyoka)
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
index 7c4c9ab..806e9d3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
@@ -35,6 +35,17 @@
private String adminState; // GET - predicate
private String maintenanceState; // UPDATE
+
+ // TODO: BP3.0
+ @Deprecated
+ public ServiceComponentHostRequest(String clusterName,
+ String serviceName,
+ String componentName,
+ String hostname,
+ String desiredState) {
+ throw new UnsupportedOperationException("Not supported with 3.0 Blueprints.");
+ }
+
public ServiceComponentHostRequest(String clusterName,
String serviceGroupName,
String serviceDisplayName,
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
index 1556b70..11aaf0b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
@@ -29,6 +29,21 @@
private String componentCategory;
private String recoveryEnabled; // CREATE/UPDATE
+ // TODO: BP3.0
+ @Deprecated
+ public ServiceComponentRequest(String clusterName,
+ String componentName, String desiredState) {
+ throw new UnsupportedOperationException("Not supported with 3.0 Blueprints.");
+ }
+
+ // TODO: BP3.0
+ @Deprecated
+ public ServiceComponentRequest(String clusterName, String componentName,
+ String desiredState, String recoveryEnabled) {
+ throw new UnsupportedOperationException("Not supported with 3.0 Blueprints.");
+ }
+
+
public ServiceComponentRequest(String clusterName, String serviceGroupName, String serviceDisplayName,
String componentName, String desiredState) {
this(clusterName, serviceGroupName, serviceDisplayName, componentName, desiredState, null, null);
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
index b084582..8efcfba 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
@@ -38,6 +38,21 @@
*/
private RepositoryVersionEntity resolvedRepository;
+ // TODO: BP3.0
+ @Deprecated
+ public ServiceRequest(String clusterName, String serviceName,
+ Long desiredRepositoryVersionId, String desiredState) {
+ throw new UnsupportedOperationException("Not supported with 3.0 Blueprints.");
+ }
+
+ // TODO: BP3.0
+ @Deprecated
+ public ServiceRequest(String clusterName, String serviceName,
+ Long desiredRepositoryVersionId, String desiredState, String credentialStoreEnabled) {
+ throw new UnsupportedOperationException("Not supported with 3.0 Blueprints.");
+ }
+
+
public ServiceRequest(String clusterName, String serviceGroupName, String serviceName,
Long desiredRepositoryVersionId, String desiredState) {
this(clusterName, serviceGroupName, serviceName, serviceName, desiredRepositoryVersionId, desiredState, null);
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/mpack/MpackManager.java b/ambari-server/src/main/java/org/apache/ambari/server/mpack/MpackManager.java
index 12070fa..a450d39 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/mpack/MpackManager.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/mpack/MpackManager.java
@@ -17,9 +17,21 @@
*/
package org.apache.ambari.server.mpack;
-import com.google.gson.Gson;
-import com.google.inject.assistedinject.Assisted;
-import com.google.inject.assistedinject.AssistedInject;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.apache.ambari.server.controller.MpackRequest;
import org.apache.ambari.server.controller.MpackResponse;
import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
@@ -37,15 +49,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.*;
-import java.net.URL;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+import com.google.gson.Gson;
+import com.google.inject.assistedinject.Assisted;
+import com.google.inject.assistedinject.AssistedInject;
/**
* Manages all mpack related behavior including parsing of stacks and providing access to
@@ -78,7 +84,7 @@
* Parses mpackdirectories during boostrap/ambari-server restart
* Reads from /var/lib/ambari-server/mpacks-v2/
*
- * @throws IOException
+ * @throws java.io.IOException
*/
private void parseMpackDirectories() {
@@ -118,7 +124,7 @@
*
* @param mpackRequest
* @return MpackResponse
- * @throws IOException
+ * @throws java.io.IOException
* @throws IllegalArgumentException
* @throws ResourceAlreadyExistsException
*/
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
index 0c1059b..fd83be4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
@@ -72,6 +72,14 @@
Service addService(ServiceGroup serviceGroup, String serviceName, String serviceDisplayName,
RepositoryVersionEntity repositoryVersion) throws AmbariException;
+ // TODO: BP3.0
+ @Deprecated
+ Service addService(String serviceName);
+
+ // TODO: BP3.0
+ @Deprecated
+ Service addService(String serviceName, RepositoryVersionEntity repositoryVersion);
+
/**
* Add service group to the cluster
*
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceFactory.java
index 883fa2d..e798e58 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceFactory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceFactory.java
@@ -45,6 +45,10 @@
@Assisted("serviceDisplayName") String serviceDisplayName,
RepositoryVersionEntity desiredRepositoryVersion);
+ // TODO BP3.0
+ @Deprecated
+ Service createNew(Cluster cluster, String serviceName, RepositoryVersionEntity desiredRepositoryVersion);
+
/**
* Creates an in-memory representation of a service from an existing database
* object.
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index 6b32d4c..a085348 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -882,6 +882,20 @@
return service;
}
+ // TODO BP3.0
+ @Deprecated
+ @Override
+ public Service addService(String serviceName) {
+ throw (new UnsupportedOperationException("Not supported with 3.0 Blueprints"));
+ }
+
+ // TODO BP3.0
+ @Deprecated
+ @Override
+ public Service addService(String serviceName, RepositoryVersionEntity repositoryVersion) {
+ throw (new UnsupportedOperationException("Not supported with 3.0 Blueprints"));
+ }
+
@Override
public void addServiceGroup(ServiceGroup serviceGroup) {
if (LOG.isDebugEnabled()) {
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
index 7063c93..38e78dc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Blueprint.java
@@ -18,13 +18,13 @@
package org.apache.ambari.server.topology;
-import org.apache.ambari.server.controller.internal.Stack;
-import org.apache.ambari.server.orm.entities.BlueprintEntity;
-
import java.util.Collection;
import java.util.List;
import java.util.Map;
+import org.apache.ambari.server.controller.internal.Stack;
+import org.apache.ambari.server.orm.entities.BlueprintEntity;
+
/**
* Blueprint representation.
*/
@@ -124,6 +124,8 @@
*
* @return associated stack
*/
+ @Deprecated
+ // TODO remove for BP3.0
Stack getStack();
/**
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
index 9623871..9504e8e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImpl.java
@@ -19,17 +19,28 @@
package org.apache.ambari.server.topology;
-import com.google.gson.Gson;
-import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.StackAccessException;
-import org.apache.ambari.server.controller.AmbariServer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import org.apache.ambari.server.controller.internal.Stack;
-import org.apache.ambari.server.orm.entities.*;
+import org.apache.ambari.server.orm.entities.BlueprintConfigEntity;
+import org.apache.ambari.server.orm.entities.BlueprintConfiguration;
+import org.apache.ambari.server.orm.entities.BlueprintEntity;
+import org.apache.ambari.server.orm.entities.BlueprintSettingEntity;
+import org.apache.ambari.server.orm.entities.HostGroupComponentEntity;
+import org.apache.ambari.server.orm.entities.HostGroupConfigEntity;
+import org.apache.ambari.server.orm.entities.HostGroupEntity;
+import org.apache.ambari.server.orm.entities.StackEntity;
import org.apache.ambari.server.stack.NoSuchStackException;
import org.apache.ambari.server.state.ConfigHelper;
import org.apache.commons.lang.StringUtils;
-import java.util.*;
+import com.google.gson.Gson;
/**
* Blueprint implementation.
@@ -60,7 +71,8 @@
// create config first because it is set as a parent on all host-group configs
processConfiguration(entity.getConfigurations());
parseBlueprintHostGroups(entity);
- configuration.setParentConfiguration(stack.getConfiguration(getServices()));
+ // TODO BP3.0
+ // configuration.setParentConfiguration(stack.getConfiguration(getServices()));
validator = new BlueprintValidatorImpl(this);
processSetting(entity.getSettings());
processRepoSettings();
@@ -274,8 +286,10 @@
}
@Override
+ @Deprecated
+ // TODO BP3.0
public Stack getStack() {
- return stack;
+ throw new UnsupportedOperationException("Not supported with 3.0 Blueprints.");
}
/**
@@ -353,20 +367,22 @@
}
private void parseStack(StackEntity stackEntity) throws NoSuchStackException {
- try {
+// try {
//todo: don't pass in controller
- stack = new Stack(stackEntity.getStackName(), stackEntity.getStackVersion(), AmbariServer.getController());
- } catch (StackAccessException e) {
- throw new NoSuchStackException(stackEntity.getStackName(), stackEntity.getStackVersion());
- } catch (AmbariException e) {
- //todo:
- throw new RuntimeException("An error occurred parsing the stack information.", e);
- }
+ // TODO BP3.0
+ // stack = new Stack(stackEntity.getStackName(), stackEntity.getStackVersion(), AmbariServer.getController());
+// } catch (StackAccessException e) {
+// throw new NoSuchStackException(stackEntity.getStackName(), stackEntity.getStackVersion());
+// } catch (AmbariException e) {
+// //todo:
+// throw new RuntimeException("An error occurred parsing the stack information.", e);
+// }
}
private Map<String, HostGroup> parseBlueprintHostGroups(BlueprintEntity entity) {
for (HostGroupEntity hostGroupEntity : entity.getHostGroups()) {
- HostGroupImpl hostGroup = new HostGroupImpl(hostGroupEntity, getName(), stack);
+ // TODO BP3.0
+ HostGroupImpl hostGroup = new HostGroupImpl(hostGroupEntity, getName(), null /* TODO */);
// set the bp configuration as the host group config parent
hostGroup.getConfiguration().setParentConfiguration(configuration);
hostGroups.put(hostGroupEntity.getName(), hostGroup);
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/Component.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/Component.java
index 4cdf2de..4e43e46 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/Component.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Component.java
@@ -31,6 +31,18 @@
private final Configuration configuration;
+ // TODO: remove for BP3.0
+ @Deprecated
+ public Component(String name) {
+ throw new UnsupportedOperationException("Not supported with 3.0 Blueprints.");
+ }
+
+ // TODO: remove for BP3.0
+ @Deprecated
+ public Component(String name, ProvisionAction provisionAction) {
+ throw new UnsupportedOperationException("Not supported with 3.0 Blueprints.");
+ }
+
public Component(String name, Service service) {
this(name, service, null, null);
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroup.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroup.java
index 0590e1f..de7fad4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroup.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroup.java
@@ -18,12 +18,12 @@
package org.apache.ambari.server.topology;
-import org.apache.ambari.server.controller.internal.ProvisionAction;
-import org.apache.ambari.server.controller.internal.Stack;
-
import java.util.Collection;
import java.util.regex.Pattern;
+import org.apache.ambari.server.controller.internal.ProvisionAction;
+import org.apache.ambari.server.controller.internal.Stack;
+
/**
* Host Group representation.
*/
@@ -99,6 +99,10 @@
*/
boolean addComponent(String component, Service service);
+ // TODO: remove BP3.0
+ @Deprecated
+ boolean addComponent(String component);
+
/**
* Add a component to the host group, with the specified name
* and provision action.
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupImpl.java
index 2234475..b5d3952 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupImpl.java
@@ -159,6 +159,12 @@
return this.addComponent(component, service);
}
+ @Override
+ // TODO BP3.0
+ public boolean addComponent(String component) {
+ throw new UnsupportedOperationException("Not supported with 3.0 blueprints.");
+ }
+
/**
* Add a component with the specified provision action to the
* host group.
@@ -180,14 +186,14 @@
if (stack.isMasterComponent(component)) {
containsMasterComponent = true;
}
+ // TODO review for BP3.0
if (added) {
- String service = stack.getServiceForComponent(component);
if (service != null) {
// an example of a component without a service in the stack is AMBARI_SERVER
- Set<String> serviceComponents = componentsForService.get(service);
+ Set<String> serviceComponents = componentsForService.get(service.getName());
if (serviceComponents == null) {
serviceComponents = new HashSet<>();
- componentsForService.put(service, serviceComponents);
+ componentsForService.put(service.getName(), serviceComponents);
}
serviceComponents.add(component);
}
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
index 66c0dc3..bb8656f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
@@ -18,10 +18,10 @@
package org.apache.ambari.server.topology;
+import java.util.Set;
import org.apache.ambari.server.controller.internal.Stack;
-import java.util.Set;
public class Service {