forked from apache/dubbo
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Polish apache#3296 : Merge and enhancement dubbo-registry-nacos
- Loading branch information
1 parent
4ad9aeb
commit dc0bf44
Showing
20 changed files
with
1,446 additions
and
0 deletions.
There are no files selected for viewing
93 changes: 93 additions & 0 deletions
93
...ubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/support/DubboRegistration.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,93 @@ | ||
/* | ||
* 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.alibaba.dubbo.registry.support; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Dubbo Registration | ||
* | ||
* @since 2.6.6 | ||
*/ | ||
class DubboRegistration implements Registration { | ||
|
||
private String serviceName; | ||
|
||
private String ip; | ||
|
||
private int port; | ||
|
||
private Map<String, String> metadata; | ||
|
||
@Override | ||
public String getServiceName() { | ||
return serviceName; | ||
} | ||
|
||
public void setServiceName(String serviceName) { | ||
this.serviceName = serviceName; | ||
} | ||
|
||
@Override | ||
public String getIp() { | ||
return ip; | ||
} | ||
|
||
public void setIp(String ip) { | ||
this.ip = ip; | ||
} | ||
|
||
@Override | ||
public int getPort() { | ||
return port; | ||
} | ||
|
||
public void setPort(int port) { | ||
this.port = port; | ||
} | ||
|
||
@Override | ||
public Map<String, String> getMetadata() { | ||
return metadata; | ||
} | ||
|
||
public void setMetadata(Map<String, String> metadata) { | ||
this.metadata = metadata; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
DubboRegistration that = (DubboRegistration) o; | ||
|
||
if (port != that.port) return false; | ||
if (serviceName != null ? !serviceName.equals(that.serviceName) : that.serviceName != null) return false; | ||
if (ip != null ? !ip.equals(that.ip) : that.ip != null) return false; | ||
return metadata != null ? metadata.equals(that.metadata) : that.metadata == null; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = serviceName != null ? serviceName.hashCode() : 0; | ||
result = 31 * result + (ip != null ? ip.hashCode() : 0); | ||
result = 31 * result + port; | ||
result = 31 * result + (metadata != null ? metadata.hashCode() : 0); | ||
return result; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...try/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/support/Registration.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,53 @@ | ||
/* | ||
* 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.alibaba.dubbo.registry.support; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* The Registration | ||
* | ||
* @since 2.6.6 | ||
*/ | ||
public interface Registration { | ||
|
||
/** | ||
* @return The service name | ||
*/ | ||
String getServiceName(); | ||
|
||
/** | ||
* @return The IP address | ||
*/ | ||
String getIp(); | ||
|
||
/** | ||
* @return The service port | ||
*/ | ||
int getPort(); | ||
|
||
/** | ||
* @return The read-only metadata | ||
*/ | ||
Map<String, String> getMetadata(); | ||
|
||
@Override | ||
boolean equals(Object o); | ||
|
||
@Override | ||
int hashCode(); | ||
} |
Oops, something went wrong.