/* * Decompiled with CFR 0.152. */ package com.tridium.util; import javax.baja.file.FilePath; import javax.baja.naming.BOrd; import javax.baja.naming.OrdQuery; import javax.baja.sys.Sys; public class Href2Ord { BOrd rawBase; BOrd baseOrd; String fileScheme; public BOrd hrefToOrd(String string) { if (!this.isAlreadyOrd(string)) { string = new FilePath(this.fileScheme(), string).toString(); } return BOrd.make(this.baseOrd(), string).normalize(); } public boolean isAlreadyOrd(String string) { int n = string.indexOf(58); if (n == -1) { return false; } return Sys.getRegistry().isOrdScheme(string.substring(0, n)); } public BOrd baseOrd() { if (this.baseOrd == null) { FilePath filePath = this.filePath(); if (filePath != null && filePath.depth() > 0) { String string = filePath.nameAt(filePath.depth() - 1); String string2 = ""; int n = string.lastIndexOf(46); if (n > 0) { string2 = string.substring(n + 1); } if (string2.equals("html") || string2.equals("css") || string2.equals("bajadoc")) { this.baseOrd = BOrd.make(this.rawBase, filePath.getParent().toString()).normalize(); return this.baseOrd; } } if (this.baseOrd == null) { this.baseOrd = this.rawBase; } } return this.baseOrd; } public String fileScheme() { if (this.fileScheme == null) { this.fileScheme = "file"; FilePath filePath = this.filePath(); if (filePath != null) { this.fileScheme = filePath.getScheme(); } } return this.fileScheme; } public FilePath filePath() { OrdQuery[] ordQueryArray = this.rawBase.parse(); int n = ordQueryArray.length - 1; while (n >= 0) { if (ordQueryArray[n] instanceof FilePath) { return (FilePath)ordQueryArray[n]; } --n; } return null; } public Href2Ord(BOrd bOrd) { if (bOrd.toString().endsWith("spy:")) { bOrd = BOrd.make(bOrd.toString() + '/'); } this.rawBase = bOrd; } }