本文整理汇总了Java中ch.qos.logback.core.util.OptionHelper.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java OptionHelper.isEmpty方法的具体用法?Java OptionHelper.isEmpty怎么用?Java OptionHelper.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.qos.logback.core.util.OptionHelper
的用法示例。
在下文中一共展示了OptionHelper.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: begin
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
@Override
public void begin(InterpretationContext ec, String name, Attributes attributes) {
// See LBCLASSIC-225 (the system property is looked up first. Thus, it overrides
// the equivalent property in the config file. This reversal of scope priority is justified
// by the use case: the admin trying to chase rogue config file
String debugAttrib = System.getProperty(DEBUG_SYSTEM_PROPERTY_KEY);
if (debugAttrib == null) {
debugAttrib = attributes.getValue(INTERNAL_DEBUG_ATTR);
}
if (OptionHelper.isEmpty(debugAttrib) || debugAttrib.equals("false") || debugAttrib.equals("null")) {
addInfo(INTERNAL_DEBUG_ATTR + " attribute not set");
} else {
OnConsoleStatusListener.addNewInstanceToContext(context);
}
new ContextUtil(context).addHostNameAsProperty();
// the context is appender attachable, so it is pushed on top of the stack
ec.pushObject(getContext());
}
示例2: getInputURL
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
URL getInputURL(InterpretationContext ec, Attributes attributes) {
String fileAttribute = attributes.getValue(FILE_ATTR);
String urlAttribute = attributes.getValue(URL_ATTR);
String resourceAttribute = attributes.getValue(RESOURCE_ATTR);
if (!OptionHelper.isEmpty(fileAttribute)) {
this.attributeInUse = ec.subst(fileAttribute);
return filePathAsURL(attributeInUse);
}
if (!OptionHelper.isEmpty(urlAttribute)) {
this.attributeInUse = ec.subst(urlAttribute);
return attributeToURL(attributeInUse);
}
if (!OptionHelper.isEmpty(resourceAttribute)) {
this.attributeInUse = ec.subst(resourceAttribute);
return resourceAsURL(attributeInUse);
}
// given previous checkAttributes() check we cannot reach this line
throw new IllegalStateException("A URL stream should have been returned");
}
示例3: processScanAttrib
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
void processScanAttrib(InterpretationContext ic, Attributes attributes) {
String scanAttrib = ic.subst(attributes.getValue(SCAN_ATTR));
if (!OptionHelper.isEmpty(scanAttrib)
&& !"false".equalsIgnoreCase(scanAttrib)) {
ReconfigureOnChangeFilter rocf = new ReconfigureOnChangeFilter();
rocf.setContext(context);
String scanPeriodAttrib = ic.subst(attributes.getValue(SCAN_PERIOD_ATTR));
if (!OptionHelper.isEmpty(scanPeriodAttrib)) {
try {
Duration duration = Duration.valueOf(scanPeriodAttrib);
rocf.setRefreshPeriod(duration.getMilliseconds());
addInfo("Setting ReconfigureOnChangeFilter scanning period to "
+ duration);
} catch (NumberFormatException nfe) {
addError("Error while converting [" + scanAttrib + "] to long", nfe);
}
}
rocf.start();
LoggerContext lc = (LoggerContext) context;
addInfo("Adding ReconfigureOnChangeFilter as a turbo filter");
lc.addTurboFilter(rocf);
}
}
示例4: begin
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
public void begin(InterpretationContext ic, String name, Attributes attributes) {
String valueStr = attributes.getValue(VALUE_ATR);
if (OptionHelper.isEmpty(valueStr)) {
ic.addError("The literal action requires a value attribute");
return;
}
try {
Integer i = Integer.valueOf(valueStr);
ic.pushObject(i);
} catch (NumberFormatException nfe) {
ic.addError("The value [" + valueStr
+ "] could not be converted to an Integer", nfe);
throw nfe;
}
}
示例5: enabledProtocols
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
/**
* Gets the set of enabled protocols based on the configuration.
* @param supportedProtocols protocols supported by the SSL engine
* @param defaultProtocols default protocols enabled by the SSL engine
* @return enabled protocols
*/
private String[] enabledProtocols(String[] supportedProtocols,
String[] defaultProtocols) {
if (enabledProtocols == null) {
// we're assuming that the same engine is used for all configurables
// so once we determine the enabled set, we won't do it again
if (OptionHelper.isEmpty(getIncludedProtocols())
&& OptionHelper.isEmpty(getExcludedProtocols())) {
enabledProtocols = Arrays.copyOf(defaultProtocols,
defaultProtocols.length);
}
else {
enabledProtocols = includedStrings(supportedProtocols,
getIncludedProtocols(), getExcludedProtocols());
}
for (String protocol : enabledProtocols) {
addInfo("enabled protocol: " + protocol);
}
}
return enabledProtocols;
}
示例6: installIfAsked
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
static void installIfAsked(KonkerLoggerContext loggerContext) {
String slClass = OptionHelper.getSystemProperty("logback.statusListenerClass");
if(!OptionHelper.isEmpty(slClass)) {
addStatusListener(loggerContext, slClass);
}
}
示例7: begin
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
@Override
public void begin(InterpretationContext ic, String elementName, Attributes attributes)
throws ActionException {
String name = attributes.getValue(NAME_ATTRIBUTE);
String source = attributes.getValue(SOURCE_ATTRIBUTE);
Scope scope = ActionUtil.stringToScope(attributes.getValue(SCOPE_ATTRIBUTE));
String defaultValue = attributes.getValue(DEFAULT_VALUE_ATTRIBUTE);
if (OptionHelper.isEmpty(name) || OptionHelper.isEmpty(source)) {
addError(
"The \"name\" and \"source\" attributes of <springProperty> must be set");
}
ActionUtil.setProperty(ic, name, getValue(source, defaultValue), scope);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:SpringPropertyAction.java
示例8: setApplicationName
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
public static void setApplicationName(String name) throws AuditException {
if (clientApplication != null && clientApplication.getName().equals(name)) {
// don't configure again
return;
}
if (clientApplication != null && !clientApplication.getName().equals(name)) {
throw new IllegalStateException("Application name "
+ clientApplication.getName() + " once set cannot be renamed.");
}
if (OptionHelper.isEmpty(name)) {
throw new IllegalArgumentException(
"Application name cannot be null or empty");
} else {
// logger.info("Naming client application as [" + name + "]");
}
try {
InetAddress address = InetAddress.getLocalHost();
String fqdn = address.getCanonicalHostName();
// logger("Client application host is ["+fqdn+"].");
Application aplication = new Application(name, fqdn);
// all is nice and dandy
clientApplication = aplication;
} catch (UnknownHostException e) {
throw new IllegalStateException(
"Failed to determine the hostname for this host", e);
}
// defaultAuditor.close();
defaultAuditor = new Auditor();
defaultAuditor.setClientApplication(clientApplication);
defaultAuditor.setName(DEFAULT_AUDITOR_NAME);
autoConfig(defaultAuditor);
checkSanity(defaultAuditor);
AuditorFactory.defaultAuditor = defaultAuditor;
}
示例9: end
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
public void end(InterpretationContext ec, String name) {
// pop nameStr value from the special stack
String nameStr = (String) nameStrStack.pop();
if (OptionHelper.isEmpty(nameStr)) {
// nothing to do
} else {
Integer i = (Integer) ec.peekObject();
System.out.println(
"The computation named [" + nameStr + "] resulted in the value " + i);
}
}
示例10: getPropertyValue
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
/**
* Returns "true" if the file specified by {@link #setPath(String) path} property exists.
* Returns "false" otherwise.
*
* @return "true"|"false" depending on the existence of file
*/
public String getPropertyValue() {
if (OptionHelper.isEmpty(path)) {
addError("The \"path\" property must be set.");
return null;
}
File file = new File(path);
return booleanAsStr(file.exists());
}
示例11: installIfAsked
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
static void installIfAsked(LoggerContext loggerContext) {
String slClass = OptionHelper.getSystemProperty(
ContextInitializer.STATUS_LISTENER_CLASS);
if (!OptionHelper.isEmpty(slClass)) {
addStatusListener(loggerContext, slClass);
}
}
示例12: begin
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException {
inError = false;
String className = attributes.getValue(CLASS_ATTRIBUTE);
if (OptionHelper.isEmpty(className)) {
addError("Missing class name for statusListener. Near ["
+ name + "] line " + getLineNumber(ec));
inError = true;
return;
}
try {
statusListener = (StatusListener) OptionHelper.instantiateByClassName(
className, StatusListener.class, context);
ec.getContext().getStatusManager().add(statusListener);
if (statusListener instanceof ContextAware) {
((ContextAware) statusListener).setContext(context);
}
addInfo("Added status listener of type [" + className + "]");
ec.pushObject(statusListener);
} catch (Exception e) {
inError = true;
addError(
"Could not create an StatusListener of type [" + className + "].", e);
throw new ActionException(e);
}
}
示例13: start
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
@Override
public void start() {
key = getFirstOption();
if (OptionHelper.isEmpty(key)) {
addWarn("Missing key for the requested header. Defaulting to all keys.");
key = null;
}
super.start();
}
示例14: start
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
@Override
public void start() {
key = getFirstOption();
if (OptionHelper.isEmpty(key)) {
addWarn("Missing key for the request attribute");
} else {
super.start();
}
}
示例15: checkResourceAttributeSanity
import ch.qos.logback.core.util.OptionHelper; //导入方法依赖的package包/类
boolean checkResourceAttributeSanity(Attributes attributes) {
String file = attributes.getValue(FILE_ATTRIBUTE);
String name = attributes.getValue(NAME_ATTRIBUTE);
String value = attributes.getValue(VALUE_ATTRIBUTE);
String resource = attributes.getValue(RESOURCE_ATTRIBUTE);
return !(OptionHelper.isEmpty(resource))
&& (OptionHelper.isEmpty(name) && OptionHelper.isEmpty(value) && OptionHelper
.isEmpty(file));
}