本文整理了Java中net.ymate.platform.core.YMP
类的一些代码示例,展示了YMP
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YMP
类的具体详情如下:
包路径:net.ymate.platform.core.YMP
类名称:YMP
[英]YMP框架核心管理器
[中]YMP框架核心管理器
代码示例来源:origin: suninformation/ymate-platform-v2
/**
* @return 返回默认Redis模块管理器实例对象
*/
public static IRedis get() {
if (__instance == null) {
synchronized (VERSION) {
if (__instance == null) {
__instance = YMP.get().getModule(Redis.class);
}
}
}
return __instance;
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void registerHandler(Class<? extends Annotation> annoClass, IBeanHandler handler) {
if (!__beanHandlerMap.containsKey(annoClass)) {
__beanHandlerMap.put(annoClass, handler);
//
if (__owner.getConfig().isDevelopMode() && _LOG.isInfoEnabled()) {
_LOG.info("Handler class [" + annoClass.getSimpleName() + ":" + handler.getClass().getName() + "] registered.");
}
} else if (__owner.getConfig().isDevelopMode() && _LOG.isWarnEnabled()) {
_LOG.warn("Handler class [" + annoClass.getSimpleName() + ":" + handler.getClass().getName() + "] duplicate registration is not allowed");
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
public EventHandler(YMP owner) {
__owner = owner;
__owner.registerExcludedClass(IEvent.class);
}
代码示例来源:origin: suninformation/ymate-platform-v2
public static void main(String[] args) throws Exception {
YMP.get().init();
try {
new EntityGenerator(YMP.get()).createEntityClassFiles((args != null && args.length > 0) && BlurObject.bind(args[0]).toBooleanValue());
} finally {
YMP.get().destroy();
}
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void init(YMP owner) throws Exception {
if (!__inited) {
//
_LOG.info("Initializing ymate-platform-serv-" + VERSION);
//
__owner = owner;
__moduleCfg = new DefaultServModuleCfg(owner);
//
__owner.registerExcludedClass(IServer.class);
__owner.registerExcludedClass(IServerCfg.class);
__owner.registerExcludedClass(IClient.class);
__owner.registerExcludedClass(IClientCfg.class);
__owner.registerExcludedClass(ICodec.class);
__owner.registerExcludedClass(IListener.class);
//
__owner.registerHandler(Server.class, new ServerHandler(this));
__owner.registerHandler(Client.class, new ClientHandler(this));
//
__inited = true;
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
/**
* @param owner YMP框架管理器实例
* @return 返回指定YMP框架管理器容器内的缓存模块实例
*/
public static ICaches get(YMP owner) {
return owner.getModule(Caches.class);
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void onShutdown(IPluginContext context, IPlugin plugin) {
if (__pluginFactory != null) {
if (__pluginFactory.getOwner().getConfig().isDevelopMode() && _LOG.isInfoEnabled()) {
_LOG.info("--> " + context.getPluginMeta().toString() + " shutdown.");
}
__owner.getEvents().fireEvent(new PluginEvent(plugin, PluginEvent.EVENT.PLUGIN_SHUTDOWN));
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public Object handle(Class<?> targetClass) throws Exception {
if (!targetClass.isInterface() && ClassUtils.isInterfaceOf(targetClass, IEventRegister.class)) {
((IEventRegister) targetClass.newInstance()).register(__owner.getEvents());
}
return null;
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
private void __doFireEvent(WebEvent.EVENT event, Object eventSource) {
if (__isInited) {
YMP.get().getEvents().fireEvent(new WebEvent(WebMVC.get(), event).addParamExtend(WebEvent.EVENT_SOURCE, eventSource));
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
private boolean __tryCheckAndInitLogImpl() {
if (YMP.get() == null || !YMP.get().isInited() || Logs.get() == null || !Logs.get().isInited()) {
return false;
} else if (!__inited && YMP.get() != null && YMP.get().isInited() && Logs.get() != null && Logs.get().isInited()) {
try {
__logger = Logs.get().getLogger(__loggerName).depth(5);
__inited = true;
} catch (Exception e) {
__tryGetLogSafely().warn("", RuntimeUtils.unwrapThrow(e));
}
}
return __inited;
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public boolean registerController(Class<?> targetClass) throws Exception {
boolean _isValid = false;
for (Method _method : targetClass.getDeclaredMethods()) {
if (_method.isAnnotationPresent(RequestMapping.class)) {
RequestMeta _meta = new RequestMeta(this, targetClass, _method);
__moduleCfg.getRequestMappingParser().registerRequestMeta(_meta);
//
if (__owner.getConfig().isDevelopMode() && _LOG.isInfoEnabled()) {
_LOG.info("--> " + _meta.getAllowMethods() + ": " + _meta.getMapping() + " : " + _meta.getTargetClass().getName() + "." + _meta.getMethod().getName());
}
//
_isValid = true;
}
}
//
if (_isValid) {
Controller _annotation = targetClass.getAnnotation(Controller.class);
__owner.registerBean(BeanMeta.create(targetClass, _annotation == null || _annotation.singleton()));
}
return _isValid;
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void contextDestroyed(ServletContextEvent sce) {
__doFireEvent(WebEvent.EVENT.SERVLET_CONTEXT_DESTROYED, sce);
try {
YMP.get().destroy();
} catch (Exception ex) {
throw new RuntimeException(RuntimeUtils.unwrapThrow(ex));
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void init(YMP owner) throws Exception {
if (!__inited) {
//
_LOG.info("Initializing ymate-platform-persistence-jdbc-" + VERSION);
//
__owner = owner;
__moduleCfg = new DefaultDatabaseModuleCfg(owner);
//
__owner.getEvents().registerEvent(DatabaseEvent.class);
__owner.registerHandler(Repository.class, new RepoHandler(this));
//
__dsCaches = new HashMap<String, IDataSourceAdapter>();
for (DataSourceCfgMeta _meta : __moduleCfg.getDataSourceCfgs().values()) {
IDataSourceAdapter _adapter = _meta.getAdapterClass().newInstance();
_adapter.initialize(this, _meta);
// 将数据源适配器添加到缓存
__dsCaches.put(_meta.getName(), _adapter);
}
//
__inited = true;
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
@SuppressWarnings("unchecked")
public Object handle(Class<?> targetClass) throws Exception {
if (!targetClass.isInterface()) {
// 首先判断当前预加载的模块是否存在于被排除列表中,若存在则忽略它
if (!__owner.getConfig().getExcludedModules().contains(targetClass.getName())) {
if (ClassUtils.isInterfaceOf(targetClass, IModule.class)) {
__owner.registerModule((Class<? extends IModule>) targetClass);
}
}
}
return null;
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
if (!__inited) {
_LOG.info(__loadBanner());
__beanFactory.registerHandler(Packages.class, new PackagesHandler(this));
__registerPackages();
__moduleFactory.initIoC();
if (!isModuleExcluded(IConfig.MODULE_NAME_CONFIGURATION) && !isModuleExcluded(IConfig.MODULE_CLASS_NAME_CONFIGURATION)) {
getModule(IConfig.MODULE_CLASS_NAME_CONFIGURATION);
IModule _module = getModule(_moduleClass);
if (!_module.isInited()) {
try {
代码示例来源:origin: suninformation/ymate-platform-v2
public EntityGenerator(YMP owner) {
this();
__owner = JDBC.get(owner == null ? YMP.get() : owner);
//
__config = new ConfigInfo(__owner.getOwner());
}
代码示例来源:origin: suninformation/ymate-platform-v2
public void registerHandler(Class<? extends Annotation> annoClass) {
registerHandler(annoClass, IBeanHandler.DEFAULT_HANDLER);
}
代码示例来源:origin: suninformation/ymate-platform-v2
private IInterceptor __doGetInterceptorInstance(YMP owner, Class<? extends IInterceptor> interceptClass) throws IllegalAccessException, InstantiationException {
if (interceptClass.isAnnotationPresent(Interceptor.class)) {
IInterceptor _instance = owner.getBean(interceptClass);
if (_instance != null) {
return _instance;
}
}
return interceptClass.newInstance();
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public void registerValidator(Class<? extends Annotation> annotationClass, Class<? extends IValidator> validatorClass) {
try {
__owner.registerBean(BeanMeta.create(validatorClass, true));
__validators.put(annotationClass, validatorClass);
} catch (Exception e) {
_LOG.error("", RuntimeUtils.unwrapThrow(e));
}
}
代码示例来源:origin: suninformation/ymate-platform-v2
/**
* @param owner YMP框架管理器实例
* @return 返回指定YMP框架管理器容器内的MVC框架管理器实例
*/
public static IWebMvc get(YMP owner) {
return owner.getModule(WebMVC.class);
}
内容来源于网络,如有侵权,请联系作者删除!