Example usage for org.springframework.core.io AbstractResource getFilename

List of usage examples for org.springframework.core.io AbstractResource getFilename

Introduction

In this page you can find the example usage for org.springframework.core.io AbstractResource getFilename.

Prototype

@Override
@Nullable
public String getFilename() 

Source Link

Document

This implementation always returns null , assuming that this resource type does not have a filename.

Usage

From source file:org.bytesoft.bytejta.supports.springcloud.property.TransactionPropertySource.java

public TransactionPropertySource(String name, EncodedResource source) {
    super(name, source);

    EncodedResource encoded = (EncodedResource) this.getSource();
    AbstractResource resource = (AbstractResource) encoded.getResource();
    String path = resource.getFilename();

    if (StringUtils.isBlank(path)) {
        return;// ww w  .j ava 2  s.  c  o  m
    }

    String[] values = path.split(":");
    if (values.length != 2) {
        return;
    }

    String protocol = values[0];
    String resName = values[1];
    if ("bytejta".equalsIgnoreCase(protocol) == false) {
        return;
    } else if ("loadbalancer.config".equalsIgnoreCase(resName) == false) {
        return;
    }

    this.enabled = true;

}