This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-samples.git
The following commit(s) were added to refs/heads/master by this push:
new 084c383 improve code structure (#135)
084c383 is described below
commit 084c3835dd587776b17897920fb55259ab7a3f18
Author: liubao68 <[email protected]>
AuthorDate: Thu Nov 23 17:14:03 2023 +0800
improve code structure (#135)
---
porter/api/common/endpoint/pom.xml | 38 ------------
.../samples/porter/file/api/LogEndpoint.java | 71 ----------------------
porter/api/common/pom.xml | 36 -----------
porter/api/common/service/pom.xml | 31 ----------
porter/api/file-service/endpoint/pom.xml | 38 ------------
porter/api/file-service/pom.xml | 36 -----------
porter/api/file-service/service/pom.xml | 31 ----------
porter/api/pom.xml | 37 -----------
porter/api/user-service/endpoint/pom.xml | 38 ------------
porter/api/user-service/pom.xml | 36 -----------
porter/api/user-service/service/pom.xml | 31 ----------
porter/file-service/pom.xml | 10 ---
.../samples/porter/file/api/FileService.java | 0
.../porter/file/api/InternalAccessService.java | 0
.../porter/file/endpoint}/FileEndpoint.java | 2 +-
.../file/endpoint}/InternalAccessEndpoint.java | 3 +-
porter/gateway-service/pom.xml | 10 ---
.../samples/porter/gateway/UserServiceClient.java | 39 ------------
.../porter/gateway/{ => ext}/ApiDispatcher.java | 2 +-
.../porter/gateway/{ => ext}/AuthHandler.java | 15 ++---
.../porter/gateway/{ => ext}/EdgeSSLCustom.java | 2 +-
.../gateway/{ => ext}/InternalAccessHandler.java | 2 +-
.../gateway/{ => ext}/StaticWebpageDispatcher.java | 2 +-
.../servicecomb/samples/porter/user/api/README.md | 3 +
.../samples/porter/user/api/SessionInfo.java | 0
.../samples/porter/user/api/UserService.java} | 11 ++--
...cecomb.transport.rest.vertx.VertxHttpDispatcher | 4 +-
porter/pom.xml | 1 -
porter/user-service/pom.xml | 16 ++---
.../samples/porter/user/api/SessionInfo.java | 0
.../samples/porter/user/api/UserService.java | 0
.../porter/user/endpoint}/UserEndpoint.java | 2 +-
32 files changed, 30 insertions(+), 517 deletions(-)
diff --git a/porter/api/common/endpoint/pom.xml
b/porter/api/common/endpoint/pom.xml
deleted file mode 100644
index 4f3e673..0000000
--- a/porter/api/common/endpoint/pom.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>common-api</artifactId>
- <version>3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>common-api-endpoint</artifactId>
- <packaging>jar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>common-api-service</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git
a/porter/api/common/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/LogEndpoint.java
b/porter/api/common/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/LogEndpoint.java
deleted file mode 100644
index 60e22be..0000000
---
a/porter/api/common/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/LogEndpoint.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.servicecomb.samples.porter.file.api;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.servicecomb.foundation.common.LegacyPropertyFactory;
-import org.apache.servicecomb.provider.rest.common.RestSchema;
-import org.apache.servicecomb.samples.porter.common.api.LogService;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-@RestSchema(schemaId = "log")
-@RequestMapping(path = "/v1/log")
-public class LogEndpoint implements LogService {
- // protect your file in real applications
- private static final File LOG_DIR =
- new
File(LegacyPropertyFactory.getStringProperty("servicecomb.samples.logdir",
"."));
-
- private static final String FILE_POST_FIX = ".log";
-
- @Override
- @GetMapping(path = "/getLogFileList")
- public List<String> getLogFileList() {
- File[] files = LOG_DIR.listFiles(new FileFilter() {
- @Override
- public boolean accept(File file) {
- return isLogFile(file);
- }
- });
-
- List<String> result = new ArrayList<>(files.length);
- for (int i = 0; i < files.length; i++) {
- result.add(files[i].getName());
- }
- return result;
- }
-
- @Override
- @GetMapping(path = "/getLogFileContent")
- public File getLogFileContent(@RequestParam(name = "fileName") String
fileName) {
- File file = new File(LOG_DIR, fileName);
- if (isLogFile(file)) {
- return file;
- }
- return null;
- }
-
- private boolean isLogFile(File file) {
- return file.isFile() && file.canRead() &&
file.getName().endsWith(FILE_POST_FIX);
- }
-}
diff --git a/porter/api/common/pom.xml b/porter/api/common/pom.xml
deleted file mode 100644
index 7d372bb..0000000
--- a/porter/api/common/pom.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>porter-api</artifactId>
- <version>3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>common-api</artifactId>
- <packaging>pom</packaging>
-
- <modules>
- <module>service</module>
- <module>endpoint</module>
- </modules>
-</project>
\ No newline at end of file
diff --git a/porter/api/common/service/pom.xml
b/porter/api/common/service/pom.xml
deleted file mode 100644
index 2af9fe1..0000000
--- a/porter/api/common/service/pom.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>common-api</artifactId>
- <version>3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>common-api-service</artifactId>
- <packaging>jar</packaging>
-
-</project>
diff --git a/porter/api/file-service/endpoint/pom.xml
b/porter/api/file-service/endpoint/pom.xml
deleted file mode 100644
index f1a9bf3..0000000
--- a/porter/api/file-service/endpoint/pom.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>file-service-api</artifactId>
- <version>3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>file-service-api-endpoint</artifactId>
- <packaging>jar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>file-service-api-service</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/porter/api/file-service/pom.xml b/porter/api/file-service/pom.xml
deleted file mode 100644
index 8d00ed1..0000000
--- a/porter/api/file-service/pom.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>porter-api</artifactId>
- <version>3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>file-service-api</artifactId>
- <packaging>pom</packaging>
-
- <modules>
- <module>service</module>
- <module>endpoint</module>
- </modules>
-</project>
\ No newline at end of file
diff --git a/porter/api/file-service/service/pom.xml
b/porter/api/file-service/service/pom.xml
deleted file mode 100644
index 5090e69..0000000
--- a/porter/api/file-service/service/pom.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>file-service-api</artifactId>
- <version>3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>file-service-api-service</artifactId>
- <packaging>jar</packaging>
-
-</project>
diff --git a/porter/api/pom.xml b/porter/api/pom.xml
deleted file mode 100644
index 87a1063..0000000
--- a/porter/api/pom.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>porter-application</artifactId>
- <version>3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>porter-api</artifactId>
- <packaging>pom</packaging>
-
- <modules>
- <module>common</module>
- <module>file-service</module>
- <module>user-service</module>
- </modules>
-</project>
\ No newline at end of file
diff --git a/porter/api/user-service/endpoint/pom.xml
b/porter/api/user-service/endpoint/pom.xml
deleted file mode 100644
index 90546d0..0000000
--- a/porter/api/user-service/endpoint/pom.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>user-service-api</artifactId>
- <version>3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>user-service-api-endpoint</artifactId>
- <packaging>jar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>user-service-api-service</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/porter/api/user-service/pom.xml b/porter/api/user-service/pom.xml
deleted file mode 100644
index 6d5251e..0000000
--- a/porter/api/user-service/pom.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>porter-api</artifactId>
- <version>3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>user-service-api</artifactId>
- <packaging>pom</packaging>
-
- <modules>
- <module>service</module>
- <module>endpoint</module>
- </modules>
-</project>
\ No newline at end of file
diff --git a/porter/api/user-service/service/pom.xml
b/porter/api/user-service/service/pom.xml
deleted file mode 100644
index 12877a6..0000000
--- a/porter/api/user-service/service/pom.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>user-service-api</artifactId>
- <version>3.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>user-service-api-service</artifactId>
- <packaging>jar</packaging>
-
-</project>
diff --git a/porter/file-service/pom.xml b/porter/file-service/pom.xml
index 3201813..8bda9d9 100644
--- a/porter/file-service/pom.xml
+++ b/porter/file-service/pom.xml
@@ -29,16 +29,6 @@
<packaging>jar</packaging>
<dependencies>
- <dependency>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>file-service-api-endpoint</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>common-api-endpoint</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
</dependencies>
<properties>
<main.class>org.apache.servicecomb.samples.porter.file.FileMain</main.class>
diff --git
a/porter/api/file-service/service/src/main/java/org/apache/servicecomb/samples/porter/file/api/FileService.java
b/porter/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/api/FileService.java
similarity index 100%
rename from
porter/api/file-service/service/src/main/java/org/apache/servicecomb/samples/porter/file/api/FileService.java
rename to
porter/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/api/FileService.java
diff --git
a/porter/api/file-service/service/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessService.java
b/porter/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessService.java
similarity index 100%
rename from
porter/api/file-service/service/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessService.java
rename to
porter/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessService.java
diff --git
a/porter/api/file-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/FileEndpoint.java
b/porter/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/endpoint/FileEndpoint.java
similarity index 97%
rename from
porter/api/file-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/FileEndpoint.java
rename to
porter/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/endpoint/FileEndpoint.java
index 8ff7dac..84d7b22 100644
---
a/porter/api/file-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/FileEndpoint.java
+++
b/porter/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/endpoint/FileEndpoint.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.servicecomb.samples.porter.file.api;
+package org.apache.servicecomb.samples.porter.file.endpoint;
import org.apache.servicecomb.provider.rest.common.RestSchema;
import org.apache.servicecomb.samples.porter.file.api.FileService;
diff --git
a/porter/api/file-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessEndpoint.java
b/porter/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/endpoint/InternalAccessEndpoint.java
similarity index 91%
rename from
porter/api/file-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessEndpoint.java
rename to
porter/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/endpoint/InternalAccessEndpoint.java
index 5840427..627c829 100644
---
a/porter/api/file-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/file/api/InternalAccessEndpoint.java
+++
b/porter/file-service/src/main/java/org/apache/servicecomb/samples/porter/file/endpoint/InternalAccessEndpoint.java
@@ -15,9 +15,10 @@
* limitations under the License.
*/
-package org.apache.servicecomb.samples.porter.file.api;
+package org.apache.servicecomb.samples.porter.file.endpoint;
import org.apache.servicecomb.provider.rest.common.RestSchema;
+import org.apache.servicecomb.samples.porter.file.api.InternalAccessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
diff --git a/porter/gateway-service/pom.xml b/porter/gateway-service/pom.xml
index a7e085a..a89d4b7 100644
--- a/porter/gateway-service/pom.xml
+++ b/porter/gateway-service/pom.xml
@@ -33,16 +33,6 @@
</properties>
<dependencies>
- <dependency>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>user-service-api-service</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>common-api-endpoint</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
<dependency>
<groupId>org.apache.servicecomb</groupId>
<artifactId>edge-core</artifactId>
diff --git
a/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/UserServiceClient.java
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/UserServiceClient.java
deleted file mode 100644
index 701a357..0000000
---
a/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/UserServiceClient.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.servicecomb.samples.porter.gateway;
-
-import java.util.concurrent.CompletableFuture;
-
-import org.apache.servicecomb.provider.pojo.RpcReference;
-import org.apache.servicecomb.samples.porter.user.api.SessionInfo;
-import org.springframework.stereotype.Component;
-
-interface GetSessionOperation {
- CompletableFuture<SessionInfo> getSession(String sessionId);
-}
-
-
-@Component("UserServiceClient")
-public class UserServiceClient {
- @RpcReference(microserviceName = "user-service", schemaId = "user")
- private GetSessionOperation getSessionOperation;
-
- public GetSessionOperation getGetSessionOperation() {
- return getSessionOperation;
- }
-}
diff --git
a/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ApiDispatcher.java
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/ApiDispatcher.java
similarity index 98%
rename from
porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ApiDispatcher.java
rename to
porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/ApiDispatcher.java
index 8ab55ab..a488d60 100644
---
a/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ApiDispatcher.java
+++
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/ApiDispatcher.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.servicecomb.samples.porter.gateway;
+package org.apache.servicecomb.samples.porter.gateway.ext;
import org.apache.servicecomb.common.rest.RestProducerInvocationFlow;
import org.apache.servicecomb.core.Invocation;
diff --git
a/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/AuthHandler.java
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/AuthHandler.java
similarity index 90%
rename from
porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/AuthHandler.java
rename to
porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/AuthHandler.java
index 439a379..71d7f47 100644
---
a/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/AuthHandler.java
+++
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/AuthHandler.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.servicecomb.samples.porter.gateway;
+package org.apache.servicecomb.samples.porter.gateway.ext;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
@@ -25,10 +25,11 @@ import org.apache.servicecomb.core.filter.AbstractFilter;
import org.apache.servicecomb.core.filter.EdgeFilter;
import org.apache.servicecomb.core.filter.FilterNode;
import org.apache.servicecomb.foundation.common.utils.JsonUtils;
+import org.apache.servicecomb.provider.pojo.RpcReference;
import org.apache.servicecomb.samples.porter.user.api.SessionInfo;
+import org.apache.servicecomb.samples.porter.user.api.UserService;
import org.apache.servicecomb.swagger.invocation.Response;
import org.apache.servicecomb.swagger.invocation.exception.InvocationException;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.google.common.cache.Cache;
@@ -36,18 +37,14 @@ import com.google.common.cache.CacheBuilder;
@Component
public class AuthHandler extends AbstractFilter implements EdgeFilter {
- private final UserServiceClient userServiceClient;
+ @RpcReference(microserviceName = "user-service", schemaId = "user")
+ private UserService userService;
// session expires in 10 minutes, cache for 1 seconds to get rid of
concurrent scenarios.
private Cache<String, String> sessionCache = CacheBuilder.newBuilder()
.expireAfterAccess(30, TimeUnit.SECONDS)
.build();
- @Autowired
- public AuthHandler(UserServiceClient userServiceClient) {
- this.userServiceClient = userServiceClient;
- }
-
@Override
public CompletableFuture<Response> onFilter(Invocation invocation,
FilterNode nextNode) {
if (invocation.getMicroserviceName().equals("user-service")
@@ -75,7 +72,7 @@ public class AuthHandler extends AbstractFilter implements
EdgeFilter {
}
// In edge, handler is executed in reactively. Must have no blocking
logic.
- CompletableFuture<SessionInfo> result =
userServiceClient.getGetSessionOperation().getSession(sessionId);
+ CompletableFuture<SessionInfo> result =
userService.getSession(sessionId);
return result.whenComplete((info, e) -> {
if (result.isCompletedExceptionally()) {
throw new InvocationException(403, "", "session is not valid.");
diff --git
a/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/EdgeSSLCustom.java
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/EdgeSSLCustom.java
similarity index 95%
rename from
porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/EdgeSSLCustom.java
rename to
porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/EdgeSSLCustom.java
index 159c10d..3f6c4e5 100644
---
a/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/EdgeSSLCustom.java
+++
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/EdgeSSLCustom.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.servicecomb.samples.porter.gateway;
+package org.apache.servicecomb.samples.porter.gateway.ext;
import java.io.File;
diff --git
a/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/InternalAccessHandler.java
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/InternalAccessHandler.java
similarity index 97%
rename from
porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/InternalAccessHandler.java
rename to
porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/InternalAccessHandler.java
index bed3aeb..2c87014 100644
---
a/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/InternalAccessHandler.java
+++
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/InternalAccessHandler.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.servicecomb.samples.porter.gateway;
+package org.apache.servicecomb.samples.porter.gateway.ext;
import java.util.concurrent.CompletableFuture;
diff --git
a/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/StaticWebpageDispatcher.java
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/StaticWebpageDispatcher.java
similarity index 96%
rename from
porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/StaticWebpageDispatcher.java
rename to
porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/StaticWebpageDispatcher.java
index 9b707b3..60bb69a 100644
---
a/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/StaticWebpageDispatcher.java
+++
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/gateway/ext/StaticWebpageDispatcher.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.servicecomb.samples.porter.gateway;
+package org.apache.servicecomb.samples.porter.gateway.ext;
import org.apache.servicecomb.foundation.common.LegacyPropertyFactory;
import org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher;
diff --git
a/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/user/api/README.md
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/user/api/README.md
new file mode 100644
index 0000000..8769113
--- /dev/null
+++
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/user/api/README.md
@@ -0,0 +1,3 @@
+API definitions from user-service.
+
+Only include apis used in gateway.
diff --git
a/porter/api/user-service/service/src/main/java/org/apache/servicecomb/samples/porter/user/api/SessionInfo.java
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/user/api/SessionInfo.java
similarity index 100%
copy from
porter/api/user-service/service/src/main/java/org/apache/servicecomb/samples/porter/user/api/SessionInfo.java
copy to
porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/user/api/SessionInfo.java
diff --git
a/porter/api/common/service/src/main/java/org/apache/servicecomb/samples/porter/common/api/LogService.java
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserService.java
similarity index 74%
rename from
porter/api/common/service/src/main/java/org/apache/servicecomb/samples/porter/common/api/LogService.java
rename to
porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserService.java
index 9991543..3bf8f1f 100644
---
a/porter/api/common/service/src/main/java/org/apache/servicecomb/samples/porter/common/api/LogService.java
+++
b/porter/gateway-service/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserService.java
@@ -15,12 +15,11 @@
* limitations under the License.
*/
-package org.apache.servicecomb.samples.porter.common.api;
+package org.apache.servicecomb.samples.porter.user.api;
-import java.io.File;
-import java.util.List;
+import java.util.concurrent.CompletableFuture;
-public interface LogService {
- List<String> getLogFileList();
- File getLogFileContent(String fileName);
+public interface UserService {
+ // We can define different signature than user-service. This method is
reactive.
+ CompletableFuture<SessionInfo> getSession(String sessionId);
}
diff --git
a/porter/gateway-service/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher
b/porter/gateway-service/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher
index 71009db..8ec7b1c 100644
---
a/porter/gateway-service/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher
+++
b/porter/gateway-service/src/main/resources/META-INF/services/org.apache.servicecomb.transport.rest.vertx.VertxHttpDispatcher
@@ -15,5 +15,5 @@
# limitations under the License.
#
-org.apache.servicecomb.samples.porter.gateway.ApiDispatcher
-org.apache.servicecomb.samples.porter.gateway.StaticWebpageDispatcher
\ No newline at end of file
+org.apache.servicecomb.samples.porter.gateway.ext.ApiDispatcher
+org.apache.servicecomb.samples.porter.gateway.ext.StaticWebpageDispatcher
\ No newline at end of file
diff --git a/porter/pom.xml b/porter/pom.xml
index b996c12..f67a964 100644
--- a/porter/pom.xml
+++ b/porter/pom.xml
@@ -94,7 +94,6 @@
</dependencies>
<modules>
- <module>api</module>
<module>file-service</module>
<module>user-service</module>
<module>gateway-service</module>
diff --git a/porter/user-service/pom.xml b/porter/user-service/pom.xml
index 68df4ef..0ebec90 100644
--- a/porter/user-service/pom.xml
+++ b/porter/user-service/pom.xml
@@ -34,19 +34,15 @@
</properties>
<dependencies>
- <dependency>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>user-service-api-endpoint</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.servicecomb.samples.porter</groupId>
- <artifactId>common-api-endpoint</artifactId>
- <version>${project.parent.version}</version>
- </dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>mysql</groupId>
diff --git
a/porter/api/user-service/service/src/main/java/org/apache/servicecomb/samples/porter/user/api/SessionInfo.java
b/porter/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/api/SessionInfo.java
similarity index 100%
rename from
porter/api/user-service/service/src/main/java/org/apache/servicecomb/samples/porter/user/api/SessionInfo.java
rename to
porter/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/api/SessionInfo.java
diff --git
a/porter/api/user-service/service/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserService.java
b/porter/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserService.java
similarity index 100%
rename from
porter/api/user-service/service/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserService.java
rename to
porter/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserService.java
diff --git
a/porter/api/user-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserEndpoint.java
b/porter/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/endpoint/UserEndpoint.java
similarity index 97%
rename from
porter/api/user-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserEndpoint.java
rename to
porter/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/endpoint/UserEndpoint.java
index 40df5bb..473c173 100644
---
a/porter/api/user-service/endpoint/src/main/java/org/apache/servicecomb/samples/porter/user/api/UserEndpoint.java
+++
b/porter/user-service/src/main/java/org/apache/servicecomb/samples/porter/user/endpoint/UserEndpoint.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.servicecomb.samples.porter.user.api;
+package org.apache.servicecomb.samples.porter.user.endpoint;
import org.apache.servicecomb.provider.rest.common.RestSchema;
import org.apache.servicecomb.samples.porter.user.api.SessionInfo;