Skip to content

Commit

Permalink
Fix Wrong/Missing Log Levels in application.properties
Browse files Browse the repository at this point in the history
  • Loading branch information
angelozerr committed Nov 16, 2020
1 parent ec0bea2 commit d9813bb
Show file tree
Hide file tree
Showing 71 changed files with 1,252 additions and 1,087 deletions.
8 changes: 8 additions & 0 deletions microprofile.jdt/org.eclipse.lsp4mp.jdt.core/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@
<provider class="org.eclipse.lsp4mp.jdt.internal.core.providers.MicroProfileProjectLabelProvider" />
</extension>

<!-- Java Util Logging Config support -->

<extension point="org.eclipse.lsp4mp.jdt.core.propertiesProviders">
<!-- Hints provider for java.util.logging.Level -->
<provider class="org.eclipse.lsp4mp.jdt.internal.jul.properties.JULPropertyProvider" />
<provider class="org.eclipse.lsp4mp.jdt.internal.jul.properties.JBossLogManagerPropertyProvider" />
</extension>

<!-- Microprofile Config support -->

<extension point="org.eclipse.lsp4mp.jdt.core.propertiesProviders">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,4 @@ public ItemHint getHint(String... hint) {
return null;
}

/**
* Returns true if the given <code>value</code> is a valid enumeration for the
* given <code>metadata</code> and false otherwise.
*
* @param metadata the property.
* @param value the value to check.
* @return true if the given <code>value</code> is a valid enumeration for the
* given <code>metadata</code> and false otherwise.
*/
public boolean isValidEnum(ItemMetadata metadata, String value) {
ItemHint itemHint = getHint(metadata);
if (itemHint == null) {
return true;
}
return itemHint.getValue(value, metadata.getConverterKinds()) != null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class ItemHint extends ItemBase {

private List<ValueHint> values;

private List<ValueProvider> providers;

public List<ValueHint> getValues() {
return values;
}
Expand All @@ -34,106 +36,12 @@ public void setValues(List<ValueHint> values) {
this.values = values;
}

/**
* A hint for a value.
*/
public static class ValueHint {

private String value;

private String description;

private String sourceType;

/**
* Returns the value.
*
* @return the value.
*/
public String getValue() {
return value;
}

/**
* Returns the converted value by using the given converter.
*
* @param converterKind the converter
* @return the converted value by using the given converter.
*/
public String getValue(ConverterKind converterKind) {
return ConverterKind.convert(getValue(), converterKind);
}

/**
* Returns the preferred value according the given converters.
*
* @param converterKinds supported converters and null otherwise.
*
* @return the preferred value according the given converters.
*/
public String getPreferredValue(List<ConverterKind> converterKinds) {
ConverterKind preferredConverter = converterKinds != null && !converterKinds.isEmpty()
? converterKinds.get(0)
: null;
return getValue(preferredConverter);
}

public void setValue(String value) {
this.value = value;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public String getSourceType() {
return sourceType;
}

public void setSourceType(String sourceType) {
this.sourceType = sourceType;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((sourceType == null) ? 0 : sourceType.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
public void setProviders(List<ValueProvider> providers) {
this.providers = providers;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ValueHint other = (ValueHint) obj;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (sourceType == null) {
if (other.sourceType != null)
return false;
} else if (!sourceType.equals(other.sourceType))
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}
public List<ValueProvider> getProviders() {
return providers;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/*******************************************************************************
* Copyright (c) 2020 Red Hat Inc. and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*
* Contributors:
* Red Hat Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.lsp4mp.commons.metadata;

import java.util.List;

/**
* A hint for a value.
*
* @see https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-configuration-metadata.html#value-hint
*/
public class ValueHint {

private String value;

private String description;

private String sourceType;

/**
* Returns the value.
*
* @return the value.
*/
public String getValue() {
return value;
}

/**
* Returns the converted value by using the given converter.
*
* @param converterKind the converter
* @return the converted value by using the given converter.
*/
public String getValue(ConverterKind converterKind) {
return ConverterKind.convert(getValue(), converterKind);
}

/**
* Returns the preferred value according the given converters.
*
* @param converterKinds supported converters and null otherwise.
*
* @return the preferred value according the given converters.
*/
public String getPreferredValue(List<ConverterKind> converterKinds) {
ConverterKind preferredConverter = converterKinds != null && !converterKinds.isEmpty() ? converterKinds.get(0)
: null;
return getValue(preferredConverter);
}

public void setValue(String value) {
this.value = value;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public String getSourceType() {
return sourceType;
}

public void setSourceType(String sourceType) {
this.sourceType = sourceType;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((sourceType == null) ? 0 : sourceType.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ValueHint other = (ValueHint) obj;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (sourceType == null) {
if (other.sourceType != null)
return false;
} else if (!sourceType.equals(other.sourceType))
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*******************************************************************************
* Copyright (c) 2020 Red Hat Inc. and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*
* Contributors:
* Red Hat Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.lsp4mp.commons.metadata;

/**
* A provider for a value.
*
* @see https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-configuration-metadata.html#value-providers
*
*/
public class ValueProvider {

public static enum ValueProviderDefaultName {

HANDLE_AS("handle-as");

private final String name;

private ValueProviderDefaultName(String name) {
this.name = name;
}

public String getName() {
return name;
}
}

private String name;

private ValueProviderParameter parameters;

public String getName() {
return name;
}

public ValueProviderParameter getParameters() {
return parameters;
}

public void setName(String name) {
this.name = name;
}

public void setParameters(ValueProviderParameter parameters) {
this.parameters = parameters;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*******************************************************************************
* Copyright (c) 2020 Red Hat Inc. and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*
* Contributors:
* Red Hat Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.lsp4mp.commons.metadata;

/**
* A parameter value provider.
*
* @see https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-configuration-metadata.html#value-providers
*
*/
public class ValueProviderParameter {

private String target;

public String getTarget() {
return target;
}

public void setTarget(String target) {
this.target = target;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.eclipse.jdt.core.search.SearchPattern;
import org.eclipse.lsp4mp.commons.metadata.ItemHint;
import org.eclipse.lsp4mp.commons.metadata.ItemMetadata;
import org.eclipse.lsp4mp.commons.metadata.ItemHint.ValueHint;
import org.eclipse.lsp4mp.commons.metadata.ValueHint;

/**
* Abstract class for properties provider.
Expand Down
Loading

0 comments on commit d9813bb

Please sign in to comment.