当前位置: 首页>>代码示例>>Java>>正文


Java Env类代码示例

本文整理汇总了Java中act.sys.Env的典型用法代码示例。如果您正苦于以下问题:Java Env类的具体用法?Java Env怎么用?Java Env使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Env类属于act.sys包,在下文中一共展示了Env类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visit

import act.sys.Env; //导入依赖的package包/类
@Override
public void visit(String name, Object value) {
    if ("value".equals(name)) {
        String s = S.string(value);
        if (type == Env.RequireProfile.class || type == Env.Profile.class) {
            matched = Env.profileMatches(s);
        } else if (type == Env.RequireGroup.class || type == Env.Group.class) {
            matched = Env.groupMatches(s);
        }
    } else if ("except".equals(name)) {
        except = (Boolean) value;
    } else if ("except".equals(name)) {
        except = (Boolean) value;
    }
    super.visit(name, value);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:17,代码来源:EnvAnnotationVisitor.java

示例2: loadAgent

import act.sys.Env; //导入依赖的package包/类
/**
 * Load an agent providing the full file path with parameters.
 */
public static void loadAgent(String jarFilePath, String params) {
    try {

        String pid = Env.PID.get();

        VirtualMachine vm;
        if (AttachProvider.providers().isEmpty()) {
            vm = getVirtualMachineImplementationFromEmbeddedOnes(pid);
        } else {
            vm = VirtualMachine.attach(pid);
        }

        final PrintStream ps = System.out;
        try {
            System.setOut(new PrintStream(new FileOutputStream(".ebean_agent.log")));
            vm.loadAgent(jarFilePath, params);
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace("javaagent loaded: " + jarFilePath);
            }
        } finally {
            // ensure ebean2 EnhanceContext logout set to dump output
            Act.jobManager().on(AppEventId.CLASS_LOADER_INITIALIZED, new Runnable() {
                @Override
                public void run() {
                    System.setOut(ps);
                }
            });
        }
        vm.detach();

    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:actframework,项目名称:act-ebean,代码行数:38,代码来源:EbeanAgentLoader.java

示例3: init

import act.sys.Env; //导入依赖的package包/类
private synchronized void init() {
    if (null != jobClass) {
        return;
    }
    disabled = false;
    jobClass = $.classForName(classInfo.className(), cl);
    disabled = disabled || !Env.matches(jobClass);
    method = methodInfo.method();
    disabled = disabled || !Env.matches(method);
    if (disabled) {
        return;
    }
    isStatic = methodInfo.isStatic();
    if (!isStatic) {
        singleton = ReflectedInvokerHelper.tryGetSingleton(jobClass, app);
    }
    ParamValueLoaderManager paramValueLoaderManager = app.service(ParamValueLoaderManager.class);
    if (null != paramValueLoaderManager) {
        paramValueLoaderService = paramValueLoaderManager.get(JobContext.class);
    } else {
        // this job is scheduled to run before ParamValueLoaderManager initialized
    }

    if (!Modifier.isStatic(method.getModifiers())) {
        Class[] paramTypes = paramTypes();
        //constructorAccess = ConstructorAccess.get(controllerClass);
        methodAccess = MethodAccess.get(jobClass);
        methodIndex = methodAccess.getIndex(methodInfo.name(), paramTypes);
    } else {
        method.setAccessible(true);
    }
}
 
开发者ID:actframework,项目名称:actframework,代码行数:33,代码来源:ReflectedJobInvoker.java

示例4: visitAnnotation

import act.sys.Env; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
    AnnotationVisitor av = super.visitAnnotation(desc, visible);
    Type type = Type.getType(desc);
    String className = type.getClassName();
    try {
        Class<? extends Annotation> c = (Class<? extends Annotation>)Class.forName(className);
        if (JobClassMetaInfo.isActionAnnotation(c)) {
            markRequireScan();
            if (null == methodInfo) {
                JobMethodMetaInfo tmp = new JobMethodMetaInfo(classInfo, paramTypes);
                methodInfo = tmp;
                classInfo.addAction(tmp);
                this.aav = new ActionAnnotationVisitor(av, c, methodInfo);
            } else {
                this.aav.add(c);
            }
            return this.aav;
        } else if (Env.isEnvAnnotation(c)) {
            this.eav = new EnvAnnotationVisitor(av, c);
            return this.eav;
        }
    } catch (Exception e) {
        throw E.unexpected(e);
    }
    //markNotTargetClass();
    return av;
}
 
开发者ID:actframework,项目名称:actframework,代码行数:30,代码来源:JobByteCodeScanner.java

示例5: visitEnum

import act.sys.Env; //导入依赖的package包/类
@Override
public void visitEnum(String name, String desc, String value) {
    if ("value".equals(name) && desc.contains("Mode")) {
        Act.Mode mode = Act.Mode.valueOf(value);
        if (!Env.modeMatches(mode)) {
            matched = false;
        }
    }
    super.visitEnum(name, desc, value);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:11,代码来源:EnvAnnotationVisitor.java

示例6: initInfoBuffer

import act.sys.Env; //导入依赖的package包/类
private void initInfoBuffer(App app) {
    Map<String, Object> map = C.Map(
            "actVersion", Act.VERSION.getVersion(),
            "appVersion", Act.appVersion().getVersion(),
            "appName", app.name(),
            "pid", Env.PID.get(),
            "baseDir", app.base().getAbsoluteFile(),
            "mode", Act.mode().name(),
            "profile", Act.profile(),
            "group", Act.nodeGroup()
    );
    this.info = new Unit(map, Banner.cachedBanner());
}
 
开发者ID:actframework,项目名称:actframework,代码行数:14,代码来源:Info.java

示例7: checkStatus

import act.sys.Env; //导入依赖的package包/类
/**
 * This method will get called every x, where
 * `x` is configured through `every.check_status`
 * configuration
 */
@Every(value = "every.check_status", id = "CHECK_STATUS")
@Env.Group("job")
public void checkStatus() {
    JobLog.log("SomeService.checkStatus");
}
 
开发者ID:actframework,项目名称:act-demo-apps,代码行数:11,代码来源:SomeService.java

示例8: WebSocketConnectionHandler

import act.sys.Env; //导入依赖的package包/类
public WebSocketConnectionHandler(ActionMethodMetaInfo methodInfo, WebSocketConnectionManager manager) {
    this.connectionManager = $.notNull(manager);
    if (null == methodInfo) {
        this.isWsHandler = false;
        this.disabled = true;
        return;
    }
    App app = manager.app();
    this.cl = app.classLoader();
    this.handler = $.notNull(methodInfo);
    this.controller = handler.classInfo();

    this.paramLoaderService = app.service(ParamValueLoaderManager.class).get(WebSocketContext.class);
    this.jsonDTOClassManager = app.service(JsonDTOClassManager.class);

    this.handlerClass = $.classForName(controller.className(), cl);
    this.disabled = !Env.matches(handlerClass);

    paramTypes = paramTypes(cl);

    try {
        this.method = handlerClass.getMethod(methodInfo.name(), paramTypes);
        this.isWsHandler = null != this.method.getAnnotation(WsAction.class);
        this.disabled = this.disabled || !Env.matches(method);
    } catch (NoSuchMethodException e) {
        throw E.unexpected(e);
    }

    if (!isWsHandler || disabled) {
        return;
    }

    this.isStatic = methodInfo.isStatic();
    if (!this.isStatic) {
        //constructorAccess = ConstructorAccess.get(controllerClass);
        methodAccess = MethodAccess.get(handlerClass);
        methodIndex = methodAccess.getIndex(methodInfo.name(), paramTypes);
        host = Act.getInstance(handlerClass);
    } else {
        method.setAccessible(true);
    }

    paramCount = handler.paramCount();
    paramSpecs = jsonDTOClassManager.beanSpecs(handlerClass, method);
    fieldsAndParamsCount = paramSpecs.size();
    if (fieldsAndParamsCount == 1) {
        singleJsonFieldName = paramSpecs.get(0).name();
    }
    // todo: do we want to allow inject Annotation type into web socket
    // handler method param list?
    ParamValueLoader[] loaders = paramLoaderService.methodParamLoaders(host, method, null);
    if (loaders.length > 0) {
        int realParamCnt = 0;
        for (ParamValueLoader loader : loaders) {
            if (loader instanceof ProvidedValueLoader) {
                continue;
            }
            realParamCnt++;
        }
        isSingleParam = 1 == realParamCnt;
    }
}
 
开发者ID:actframework,项目名称:actframework,代码行数:63,代码来源:WebSocketConnectionHandler.java

示例9: matches

import act.sys.Env; //导入依赖的package包/类
@Override
boolean matches(EnvAnnotationVisitor visitor) {
    return Env.profileMatches(visitor.value, visitor.except);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:5,代码来源:EnvMatcher.java

示例10: pid

import act.sys.Env; //导入依赖的package包/类
@Command(name = "act.pid", help = "Print current process ID")
public String pid() {
    return Env.PID.get();
}
 
开发者ID:actframework,项目名称:actframework,代码行数:5,代码来源:SysUtilAdmin.java

示例11: initPidBuffer

import act.sys.Env; //导入依赖的package包/类
private void initPidBuffer() {
    this.pid = new Unit("pid", Env.PID.get());
}
 
开发者ID:actframework,项目名称:actframework,代码行数:4,代码来源:Info.java

示例12: banner

import act.sys.Env; //导入依赖的package包/类
public static String banner(AppDescriptor appDescriptor) {
    String bannerText = null;

    String udfBanner = udfBanner();
    if (null != udfBanner) {
        bannerText = S.concat(udfBanner, "\n");
    }
    if (null == bannerText) {
        bannerText = asciiArt(appDescriptor.getAppName());
    }
    int bannerTextWidth = width(bannerText);

    String favicon = favicon();
    int faviconWidth = width(favicon);
    int maxWidth = Math.max(faviconWidth, bannerTextWidth);

    S.Buffer sb = S.buffer();
    String actVersion = Act.VERSION.getVersion();
    if ("ACTFRAMEWORK".equals(appDescriptor.getAppName())) {
        sb.append(bannerText);
        if (S.notBlank(favicon)) {
            sb.append("\n");
            addFavicon(sb, favicon, maxWidth, faviconWidth);
        }
        int n = actVersion.length();
        int padLeft = (maxWidth - n + 1) / 2;
        sb.append(S.times(" ", padLeft)).append(actVersion).append("\n");
    } else {
        sb.append(bannerText);
        if (S.notBlank(favicon)) {
            sb.append("\n");
            addFavicon(sb, favicon, maxWidth, faviconWidth);
            sb.append("\n");
            sb.append(poweredBy(maxWidth, actVersion, true));
        } else {
            sb.append(poweredBy(maxWidth, actVersion, false));
        }
        sb.append("\n\n version: ").append(appDescriptor.getVersion().getVersion());
    }
    File aFile = new File("");
    String group = Act.nodeGroup();
    sb.append("\nscan pkg: ").append(System.getProperty(AppConfigKey.SCAN_PACKAGE.key()));
    sb.append("\nbase dir: ").append(aFile.getAbsolutePath());
    sb.append("\n     pid: ").append(Env.PID.get());
    sb.append("\n profile: ").append(ConfLoader.confSetName());
    sb.append("\n    mode: ").append(Act.mode());
    if (S.notBlank(group)) {
        sb.append("\n   group: ").append(group);
    }
    sb.append("\n");
    sb.append("\n     zen: ").append(Zen.wordsOfTheDay());
    sb.append("\n");

    return sb.toString();
}
 
开发者ID:actframework,项目名称:actframework,代码行数:56,代码来源:Banner.java

示例13: isModuleAllowed

import act.sys.Env; //导入依赖的package包/类
private static boolean isModuleAllowed(Class<?> moduleClass) {
    return Env.matches(moduleClass);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:4,代码来源:GenieInjector.java


注:本文中的act.sys.Env类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。