diff --git a/resource-providers/src/main/java/io/opentelemetry/resourceproviders/JettyAppServer.java b/resource-providers/src/main/java/io/opentelemetry/resourceproviders/JettyAppServer.java index 581526358..3e69b2add 100644 --- a/resource-providers/src/main/java/io/opentelemetry/resourceproviders/JettyAppServer.java +++ b/resource-providers/src/main/java/io/opentelemetry/resourceproviders/JettyAppServer.java @@ -1,30 +1,18 @@ /* - * Copyright Splunk Inc. - * - * Licensed 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. + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 */ package io.opentelemetry.resourceproviders; -import com.google.common.annotations.VisibleForTesting; +import static java.util.logging.Level.FINE; -import javax.annotation.Nullable; +import com.google.common.annotations.VisibleForTesting; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.logging.Logger; - -import static java.util.logging.Level.FINE; +import javax.annotation.Nullable; class JettyAppServer implements AppServer { diff --git a/resource-providers/src/main/java/io/opentelemetry/resourceproviders/LibertyAppService.java b/resource-providers/src/main/java/io/opentelemetry/resourceproviders/LibertyAppService.java index c3d7c1be3..7bd93f326 100644 --- a/resource-providers/src/main/java/io/opentelemetry/resourceproviders/LibertyAppService.java +++ b/resource-providers/src/main/java/io/opentelemetry/resourceproviders/LibertyAppService.java @@ -1,32 +1,20 @@ /* - * Copyright Splunk Inc. - * - * Licensed 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. + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 */ package io.opentelemetry.resourceproviders; -import javax.annotation.Nullable; - import static java.util.logging.Level.FINE; import java.nio.file.Path; import java.nio.file.Paths; import java.util.logging.Logger; +import javax.annotation.Nullable; class LibertyAppService implements AppServer { - private final static String SERVICE_CLASS_NAME = "com.ibm.ws.kernel.boot.cmdline.EnvCheck"; + private static final String SERVICE_CLASS_NAME = "com.ibm.ws.kernel.boot.cmdline.EnvCheck"; private static final Logger logger = Logger.getLogger(LibertyAppService.class.getName()); private final ResourceLocator locator; diff --git a/resource-providers/src/main/java/io/opentelemetry/resourceproviders/TomcatAppServer.java b/resource-providers/src/main/java/io/opentelemetry/resourceproviders/TomcatAppServer.java index 1d1de2f27..f18010270 100644 --- a/resource-providers/src/main/java/io/opentelemetry/resourceproviders/TomcatAppServer.java +++ b/resource-providers/src/main/java/io/opentelemetry/resourceproviders/TomcatAppServer.java @@ -1,27 +1,16 @@ /* - * Copyright Splunk Inc. - * - * Licensed 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. + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 */ package io.opentelemetry.resourceproviders; -import javax.annotation.Nullable; import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import javax.annotation.Nullable; class TomcatAppServer implements AppServer { @@ -66,7 +55,7 @@ public Path getDeploymentDir() throws URISyntaxException { // if neither catalina.base nor catalina.home is set try to deduce the location of webapps based // on the loaded server class. Class serverClass = getServerClass(); - if(serverClass == null){ + if (serverClass == null) { return null; } URL jarUrl = locator.getClassLocation(serverClass); diff --git a/resource-providers/src/main/java/io/opentelemetry/resourceproviders/TomeeAppServer.java b/resource-providers/src/main/java/io/opentelemetry/resourceproviders/TomeeAppServer.java index a790b8481..7d9dbe185 100644 --- a/resource-providers/src/main/java/io/opentelemetry/resourceproviders/TomeeAppServer.java +++ b/resource-providers/src/main/java/io/opentelemetry/resourceproviders/TomeeAppServer.java @@ -1,27 +1,16 @@ /* - * Copyright Splunk Inc. - * - * Licensed 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. + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 */ package io.opentelemetry.resourceproviders; -import javax.annotation.Nullable; import java.net.URISyntaxException; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import javax.annotation.Nullable; class TomeeAppServer implements AppServer { @@ -36,7 +25,7 @@ class TomeeAppServer implements AppServer { @Override public Path getDeploymentDir() throws URISyntaxException { Path rootDir = getRootDir(); - if(rootDir == null){ + if (rootDir == null) { return null; } @@ -75,7 +64,7 @@ private Path getRootDir() throws URISyntaxException { // if neither catalina.base nor catalina.home is set try to deduce the location of based on the // loaded server class. Class serverClass = getServerClass(); - if(serverClass == null){ + if (serverClass == null) { return null; } URL jarUrl = locator.getClassLocation(serverClass); @@ -83,7 +72,7 @@ private Path getRootDir() throws URISyntaxException { // jar is in bin/. First call to getParent strips jar name and the second bin/. We'll end up // with a path to server root. Path parent = jarPath.getParent(); - if(parent == null){ + if (parent == null) { return null; } return parent.getParent(); diff --git a/resource-providers/src/main/java/io/opentelemetry/resourceproviders/WebSphereAppServer.java b/resource-providers/src/main/java/io/opentelemetry/resourceproviders/WebSphereAppServer.java index b1f9ca240..cee9bc9f5 100644 --- a/resource-providers/src/main/java/io/opentelemetry/resourceproviders/WebSphereAppServer.java +++ b/resource-providers/src/main/java/io/opentelemetry/resourceproviders/WebSphereAppServer.java @@ -1,23 +1,12 @@ /* - * Copyright Splunk Inc. - * - * Licensed 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. + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 */ package io.opentelemetry.resourceproviders; -import javax.annotation.Nullable; import java.nio.file.Path; +import javax.annotation.Nullable; class WebSphereAppServer implements AppServer { diff --git a/resource-providers/src/main/java/io/opentelemetry/resourceproviders/WebSphereServiceNameDetector.java b/resource-providers/src/main/java/io/opentelemetry/resourceproviders/WebSphereServiceNameDetector.java index 8e4ade64a..5b8a4c9af 100644 --- a/resource-providers/src/main/java/io/opentelemetry/resourceproviders/WebSphereServiceNameDetector.java +++ b/resource-providers/src/main/java/io/opentelemetry/resourceproviders/WebSphereServiceNameDetector.java @@ -1,22 +1,12 @@ /* - * Copyright Splunk Inc. - * - * Licensed 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. + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 */ package io.opentelemetry.resourceproviders; -import javax.annotation.Nullable; +import static java.util.logging.Level.FINE; + import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -26,13 +16,13 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; - -import static java.util.logging.Level.FINE; +import javax.annotation.Nullable; class WebSphereServiceNameDetector implements ServiceNameDetector { - private static final Pattern COMMANDLINE_PARSE_PATTERN = Pattern.compile( - "com\\.ibm\\.wsspi\\.bootstrap\\.WSPreLauncher (.*) com\\.ibm\\.ws\\.runtime\\.WsServer (.+) ([^ ]+) ([^ ]+) ([^ ]+)"); + private static final Pattern COMMANDLINE_PARSE_PATTERN = + Pattern.compile( + "com\\.ibm\\.wsspi\\.bootstrap\\.WSPreLauncher (.*) com\\.ibm\\.ws\\.runtime\\.WsServer (.+) ([^ ]+) ([^ ]+) ([^ ]+)"); private static final Logger logger = Logger.getLogger(WebSphereServiceNameDetector.class.getName()); private final WebSphereAppServer appServer; @@ -83,7 +73,7 @@ public String detect() throws Exception { // /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/DefaultCell01 // NOTE: installedApps directory location is configurable Path parent = configDirectory.getParent(); - if(parent == null){ + if (parent == null) { return null; } Path cellApplications = parent.resolve("installedApps").resolve(cell); diff --git a/resource-providers/src/main/java/io/opentelemetry/resourceproviders/WildflyAppServer.java b/resource-providers/src/main/java/io/opentelemetry/resourceproviders/WildflyAppServer.java index 6e593961a..9f985a9ad 100644 --- a/resource-providers/src/main/java/io/opentelemetry/resourceproviders/WildflyAppServer.java +++ b/resource-providers/src/main/java/io/opentelemetry/resourceproviders/WildflyAppServer.java @@ -1,23 +1,10 @@ /* - * Copyright Splunk Inc. - * - * Licensed 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. + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 */ package io.opentelemetry.resourceproviders; -import javax.annotation.Nullable; - import static java.util.logging.Level.FINE; import java.net.URISyntaxException; @@ -25,6 +12,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.logging.Logger; +import javax.annotation.Nullable; class WildflyAppServer implements AppServer { @@ -59,13 +47,13 @@ public Path getDeploymentDir() throws URISyntaxException { } Class serverClass = getServerClass(); - if(serverClass == null){ + if (serverClass == null) { return null; } URL jarUrl = locator.getClassLocation(serverClass); Path jarPath = Paths.get(jarUrl.toURI()); Path parent = jarPath.getParent(); - if(parent == null){ + if (parent == null) { return null; } return parent.resolve("standalone/deployments"); diff --git a/resource-providers/src/test/java/io/opentelemetry/resourceproviders/JettyServiceNameDetectorTest.java b/resource-providers/src/test/java/io/opentelemetry/resourceproviders/JettyServiceNameDetectorTest.java index 14647abd0..6e5923c4c 100644 --- a/resource-providers/src/test/java/io/opentelemetry/resourceproviders/JettyServiceNameDetectorTest.java +++ b/resource-providers/src/test/java/io/opentelemetry/resourceproviders/JettyServiceNameDetectorTest.java @@ -1,17 +1,6 @@ /* - * Copyright Splunk Inc. - * - * Licensed 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. + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 */ package io.opentelemetry.resourceproviders; @@ -23,7 +12,6 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; - import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir;