-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[app_discovery] support subscribe app and interface publisher
- Loading branch information
1 parent
58a06ac
commit 55d87c2
Showing
60 changed files
with
2,416 additions
and
398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 0 additions & 55 deletions
55
core/src/main/java/com/alipay/sofa/registry/core/model/AppRevisionKey.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
core/src/main/java/com/alipay/sofa/registry/core/model/AssembleType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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 com.alipay.sofa.registry.core.model; | ||
|
||
/** | ||
* | ||
* @author xiaojian.xj | ||
* @version $Id: AssembleType.java, v 0.1 2020年10月27日 01:51 xiaojian.xj Exp $ | ||
*/ | ||
public enum AssembleType { | ||
|
||
/** sub app: only sub data where dataId = app */ | ||
sub_app, | ||
|
||
/** sub interface: only sub data where dataId = interface */ | ||
sub_interface, | ||
|
||
/** sub app and interface: sub data from app and interface */ | ||
sub_app_and_interface, ; | ||
|
||
public static boolean contains(String name) { | ||
for (AssembleType subDataType : values()) { | ||
if (subDataType.name().equals(name)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 135 additions & 0 deletions
135
...n/model/src/main/java/com/alipay/sofa/registry/common/model/AppRegisterServerDataBox.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/* | ||
* 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 com.alipay.sofa.registry.common.model; | ||
|
||
import com.alipay.sofa.registry.common.model.store.WordCache; | ||
import com.google.common.collect.ArrayListMultimap; | ||
|
||
import java.io.Serializable; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* | ||
* @author xiaojian.xj | ||
* @version $Id: AppRegisterServerDataBox.java, v 0.1 2020年11月12日 11:14 xiaojian.xj Exp $ | ||
*/ | ||
public class AppRegisterServerDataBox implements Serializable { | ||
private static final long serialVersionUID = -3615677271684611262L; | ||
|
||
/** revision */ | ||
private String revision; | ||
|
||
/** ip:port */ | ||
private String url; | ||
|
||
/** baseParams */ | ||
private HashMap<String/*key*/, List<String>/*values*/> baseParams; | ||
|
||
/** */ | ||
private Map<String/*service*/, Map<String/*key*/, List<String>/*value*/>> serviceParams; | ||
|
||
public String extract(String serviceName) { | ||
serviceParams.get(serviceName); | ||
|
||
StringBuilder builder = new StringBuilder(); | ||
builder.append("?"); | ||
baseParams.entrySet().stream().forEach(entry -> { | ||
entry.getValue().forEach(value -> builder.append(entry.getKey()).append("=").append(value).append("&")); | ||
}); | ||
|
||
serviceParams.get(serviceName).entrySet().forEach(entry -> { | ||
entry.getValue().forEach(value -> builder.append(entry.getKey()).append("=").append(value).append("&")); | ||
}); | ||
|
||
|
||
return builder.deleteCharAt(builder.toString().length() - 1).toString(); | ||
} | ||
|
||
/** | ||
* Getter method for property <tt>revision</tt>. | ||
* | ||
* @return property value of revision | ||
*/ | ||
public String getRevision() { | ||
return revision; | ||
} | ||
|
||
/** | ||
* Setter method for property <tt>revision</tt>. | ||
* | ||
* @param revision value to be assigned to property revision | ||
*/ | ||
public void setRevision(String revision) { | ||
this.revision = WordCache.getInstance().getWordCache(revision); | ||
} | ||
|
||
/** | ||
* Getter method for property <tt>url</tt>. | ||
* | ||
* @return property value of url | ||
*/ | ||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
/** | ||
* Setter method for property <tt>url</tt>. | ||
* | ||
* @param url value to be assigned to property url | ||
*/ | ||
public void setUrl(String url) { | ||
this.url = url; | ||
} | ||
|
||
/** | ||
* Getter method for property <tt>baseParams</tt>. | ||
* | ||
* @return property value of baseParams | ||
*/ | ||
public HashMap<String, List<String>> getBaseParams() { | ||
return baseParams; | ||
} | ||
|
||
/** | ||
* Setter method for property <tt>baseParams</tt>. | ||
* | ||
* @param baseParams value to be assigned to property baseParams | ||
*/ | ||
public void setBaseParams(HashMap<String, List<String>> baseParams) { | ||
this.baseParams = baseParams; | ||
} | ||
|
||
/** | ||
* Getter method for property <tt>serviceParams</tt>. | ||
* | ||
* @return property value of serviceParams | ||
*/ | ||
public Map<String, Map<String, List<String>>> getServiceParams() { | ||
return serviceParams; | ||
} | ||
|
||
/** | ||
* Setter method for property <tt>serviceParams</tt>. | ||
* | ||
* @param serviceParams value to be assigned to property serviceParams | ||
*/ | ||
public void setServiceParams(Map<String, Map<String, List<String>>> serviceParams) { | ||
this.serviceParams = serviceParams; | ||
} | ||
} |
Oops, something went wrong.