jmms.plugins.sfs.SfsPlugin Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jmms.plugins.sfs;
import jmms.core.model.MetaApi;
import jmms.core.model.MetaWeb;
import jmms.engine.Plugin;
import leap.lang.path.Paths;
import leap.orm.OrmContext;
import leap.web.api.dyna.DynaApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class SfsPlugin implements Plugin {
protected static final String WEB_SETTINGS_KEY = "service.ufs.endpoint";
@Override
public boolean isDefaultEnabled() {
return true;
}
@Bean
public SfsConfig config() {
return new SfsConfig();
}
@Bean
public SfsController controller() {
return new SfsController();
}
@Override
public void postCreateApi(MetaApi api, OrmContext oc, DynaApi dynaApi) {
MetaWeb web = api.getWeb();
if (null != web ) {
if(!web.containsDynaPropertyNested(WEB_SETTINGS_KEY)) {
web.setDynaProperty(WEB_SETTINGS_KEY, Paths.prefixWithoutSlash(api.prefixWithBasePath("/$sfs")));
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy