|
@@ -1,5 +1,24 @@
|
|
|
+/**
|
|
|
+ * Licensed to the Apache Software Foundation (ASF) under one
|
|
|
+ * or more contributor license agreements. See the NOTICE file
|
|
|
+ * distributed with this work for additional information
|
|
|
+ * regarding copyright ownership. The ASF licenses this file
|
|
|
+ * to you under the Apache License, Version 2.0 (the
|
|
|
+ * "License"); you may not use this file except in compliance
|
|
|
+ * with the License. You may obtain a copy of the License at
|
|
|
+ *
|
|
|
+ * http://www.apache.org/licenses/LICENSE-2.0
|
|
|
+ *
|
|
|
+ * Unless required by applicable law or agreed to in writing, software
|
|
|
+ * distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
+ * See the License for the specific language governing permissions and
|
|
|
+ * limitations under the License.
|
|
|
+ */
|
|
|
+
|
|
|
package org.apache.ambari.server.state;
|
|
|
|
|
|
+import java.util.Collections;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -12,6 +31,7 @@ public class ServiceImpl implements Service {
|
|
|
private DeployState state;
|
|
|
private Map<String, Config> configs;
|
|
|
private Map<String, ServiceComponent> components;
|
|
|
+ private StackVersion stackVersion;
|
|
|
|
|
|
private void init() {
|
|
|
// TODO
|
|
@@ -52,51 +72,55 @@ public class ServiceImpl implements Service {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public long getCurrentHostComponentMappingVersion() {
|
|
|
+ public synchronized long getCurrentHostComponentMappingVersion() {
|
|
|
// TODO Auto-generated method stub
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, ServiceComponent> getServiceComponents() {
|
|
|
- // TODO Auto-generated method stub
|
|
|
- return null;
|
|
|
+ public synchronized Map<String, ServiceComponent> getServiceComponents() {
|
|
|
+ return Collections.unmodifiableMap(components);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public State getState() {
|
|
|
- // TODO Auto-generated method stub
|
|
|
- return null;
|
|
|
+ public synchronized DeployState getState() {
|
|
|
+ return state;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void setState(State state) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
-
|
|
|
+ public synchronized void setState(DeployState state) {
|
|
|
+ this.state = state;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Config getConfig() {
|
|
|
- // TODO Auto-generated method stub
|
|
|
- return null;
|
|
|
+ public synchronized StackVersion getStackVersion() {
|
|
|
+ return stackVersion;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void setConfig(Config config) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
+ public synchronized void setStackVersion(StackVersion stackVersion) {
|
|
|
+ this.stackVersion = stackVersion;
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public synchronized Map<String, Config> getConfigs() {
|
|
|
+ return Collections.unmodifiableMap(configs);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public StackVersion getStackVersion() {
|
|
|
- // TODO Auto-generated method stub
|
|
|
- return null;
|
|
|
+ public synchronized void updateConfigs(Map<String, Config> configs) {
|
|
|
+ this.configs.putAll(configs);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void setStackVersion(StackVersion stackVersion) {
|
|
|
- // TODO Auto-generated method stub
|
|
|
+ public synchronized void setCurrentHostComponentMappingVersion(long version) {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public synchronized void addServiceComponents(
|
|
|
+ Map<String, ServiceComponent> components) {
|
|
|
+ this.components.putAll(components);
|
|
|
}
|
|
|
|
|
|
}
|