Package com.ibm.commons.runtime

Examples of com.ibm.commons.runtime.Application


  public Factory[] readFactoriesFromWebResource(String fileName) {
    if(StringUtil.isEmpty(fileName)) {
      return null;
    }
    // We read the resource
    Application app = Application.getUnchecked();
    if(app==null) {
      return null;
    }
    InputStream is = app.getResourceAsStream(fileName);
    return readFactories(is);
  }
View Full Code Here


     */
    public static String process(String input) {
        if(StringUtil.isNotEmpty(input)) {
            // default behaviour is to use context or if not available use application properties
            final Context context = Context.getUnchecked();
            final Application application = Application.getUnchecked();
            ParameterProvider provider = new ParameterProvider() {
                @Override
                public String getParameter(String name) {
                    if (context != null) {
                        return context.getProperty(name);
                    }
                    return (application == null) ? null : application.getProperty(name);
                }
            };
           
            return process(input, DELIM_START, DELIM_END, provider);
        }
View Full Code Here

     */
    public static ParameterProvider getDefaultProvider(){
        if(defaultProvider != null)
            return defaultProvider;
        final Context context = Context.getUnchecked();
        final Application application = Application.getUnchecked();
        defaultProvider = new ParameterProvider() {
            @Override
            public String getParameter(String name) {
                if (context != null) {
                    return context.getProperty(name);
                }
                return (application == null) ? null : application.getProperty(name);
            }
        };
        return defaultProvider;
    }
View Full Code Here

            return process(input, provider);
        }
        if(StringUtil.isNotEmpty(input)) {
            // default behaviour is to use context or if not available use application properties
            final Context context = Context.getUnchecked();
            final Application application = Application.getUnchecked();
            ParameterProvider defaultProvider = new ParameterProvider() {
                @Override
                public String getParameter(String name) {
                    if (provider != null) {
                        String value = provider.getParameter(name);
                        if (value != null) {
                            return value;
                        }
                    }
                    if (context != null) {
                        return context.getProperty(name);
                    }
                    return (application == null) ? null : application.getProperty(name);
                }
            };
           
            return process(input, DELIM_START, DELIM_END, defaultProvider);
        }
View Full Code Here

    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "readFactories"); //$NON-NLS-1$
    }
   
    Factory[] factories = null;
    Application application = Application.getUnchecked();
    if (application != null) {
      try {
        InitialContext initCtx = new InitialContext();
        Context envCtx = (Context) initCtx.lookup("java:comp/env"); //$NON-NLS-1$
        if (envCtx != null) {
View Full Code Here

    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "getProperty", name);
    }

    String value = null;
    Application application = Application.getUnchecked();
    if (application != null) {
      Object context = application.getApplicationContext();
      //prevent class not found exception if context is null because we're out of a container
      if (context != null) {
        if (context instanceof ServletContext) {
          ServletContext servletContext = (ServletContext) context;
          value = servletContext.getInitParameter(name);
View Full Code Here

  public Properties readProperiesFromWebResource(String fileName) {
    if(StringUtil.isEmpty(fileName)) {
      return null;
    }
    // We read the resource
    Application app = Application.getUnchecked();
    if(app==null) {
      return null;
    }
    try {
      Properties properties = new Properties();
      InputStream is = app.getResourceAsStream(fileName);
      if(is!=null) {
        try {
          properties.load(is);
          return properties;
        } finally {
View Full Code Here

    /**
     * Initialize with the default values
     */
    public void initDefaults() {
        // default parameters
        Application application = Application.get();
        String defaultToolkitUrl = getAppParameter(application, LibraryRequestParams.PARAM_TOOLKIT_URL, LibraryRequestParams.DEFAULT_TOOLKIT_URL);
        String defaultToolkitExtUrl = getAppParameter(application, LibraryRequestParams.PARAM_TOOLKIT_EXT_URL, LibraryRequestParams.DEFAULT_TOOLKIT_EXT_URL);
        String defaultJsLibraryUrl = getAppParameter(application, LibraryRequestParams.PARAM_JS_LIBRARY_URL, LibraryRequestParams.DEFAULT_JS_LIBRARY_URL);
        String defaultJavaScriptPath = getAppParameter(application, LibraryRequestParams.PARAM_JAVASCRIPT_PATH, LibraryRequestParams.DEFAULT_JAVASCRIPT_PATH);
        String defaultServiceUrl = getAppParameter(application, LibraryRequestParams.PARAM_SERVICE_URL, LibraryRequestParams.DEFAULT_SERVICE_URL);
View Full Code Here

    @Override
    public void init(ServletConfig config) throws ServletException {
        super.init(config);

        // default parameters
        Application application = Application.get();
        String defaultToolkitUrl = getAppParameter(application, LibraryRequestParams.PARAM_TOOLKIT_URL, LibraryRequestParams.DEFAULT_TOOLKIT_URL);
        String defaultToolkitExtUrl = getAppParameter(application, LibraryRequestParams.PARAM_TOOLKIT_EXT_URL, LibraryRequestParams.DEFAULT_TOOLKIT_EXT_URL);
        String defaultJsLibraryUrl = getAppParameter(application, LibraryRequestParams.PARAM_JS_LIBRARY_URL, LibraryRequestParams.DEFAULT_JS_LIBRARY_URL);
        String defaultJavaScriptPath = getAppParameter(application, LibraryRequestParams.PARAM_JAVASCRIPT_PATH, LibraryRequestParams.DEFAULT_JAVASCRIPT_PATH);
        String defaultServiceUrl = getAppParameter(application, LibraryRequestParams.PARAM_SERVICE_URL, LibraryRequestParams.DEFAULT_SERVICE_URL);
View Full Code Here

        }

        synchronized (createEnvironmentLock) {
            // create a default environment if needed
            if (defaultParams.getEnvironment() == null) {
                Application application = context.getApplication();
                String environmentName = getAppParameter(application, LibraryRequestParams.PARAM_ENVIRONMENT, LibraryRequestParams.DEFAULT_ENVIRONMENT);
                SBTEnvironment environment = (SBTEnvironment) context.getBean(environmentName);
                if (environment == null) {
                    ServletConfig config = getServletConfig();
                    String defaultEndpoints = getAppParameter(application, LibraryRequestParams.PARAM_ENDPOINTS, LibraryRequestParams.DEFAULT_ENDPOINTS);
View Full Code Here

TOP

Related Classes of com.ibm.commons.runtime.Application

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.