Skip to content

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
breedx-splk committed Nov 16, 2022
1 parent 1021abd commit f56f0ee
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 129 deletions.
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand All @@ -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;
}

Expand Down Expand Up @@ -75,15 +64,15 @@ 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);
Path jarPath = Paths.get(jarUrl.toURI());
// 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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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 javax.annotation.Nullable;

import static java.util.logging.Level.FINE;

import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.logging.Logger;
import javax.annotation.Nullable;

class WildflyAppServer implements AppServer {

Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand Down

0 comments on commit f56f0ee

Please sign in to comment.