}
@Override
protected void onSubmit() {
final Store openXRIStore = ((OpenXRIAdminApplication) this.getApplication()).getOpenXRIStore();
final Resolver resolver = ((OpenXRIAdminApplication) this.getApplication()).getResolver();
try {
SubSegment rootSubSegment = openXRIStore.createRootSubSegment(this.namespace, new XRD());
CanonicalID canonicalID;
Authority authority;
try {
authority = openXRIStore.getSubSegmentAuthority(rootSubSegment);
XRDS xrds = resolver.resolveAuthority(new XRI(this.namespace), new ResolverFlags(), new ResolverState());
XRD xrd = (xrds != null) ? xrds.getFinalXRD() : null;
canonicalID = (xrd != null) ? xrd.getCanonicalID() : null;
} catch (Exception ex) {
log.warn("Cannot find corresponding i-number");
canonicalID = null;
authority = null;
}
if (canonicalID != null && authority != null && ! canonicalID.getValue().equals(this.namespace)) {
XRD xrd = authority.getXrd();
xrd.setCanonicalID(new CanonicalID(canonicalID.getValue()));
((StoreEditable) openXRIStore).setXrd(authority, xrd);
openXRIStore.registerSubsegment(null, canonicalID.getValue(), authority);
}
} catch (StoreException ex) {
CreateRootNamespace.log.error(ex);
CreateRootNamespace.this.error(CreateRootNamespace.this._storefail + ex.getLocalizedMessage());