Package com.ibm.commons.runtime

Examples of com.ibm.commons.runtime.Application


      String v = properties.getProperty(propertyName);
      if(v!=null) {
        return v;
      }
    }
    Application app = getApplicationUnchecked();
    if(app!=null) {
      String v = app.getProperty(propertyName);
      if(v!=null) {
        return v;
      }
    }
    return defaultValue;
View Full Code Here


  public XspContext getContextUnchecked() {
    XspContext ctx = (XspContext)super.getContextUnchecked();
    if(ctx==null) {
      FacesContextEx facesContext = FacesContextEx.getCurrentInstance();
      if(facesContext!=null) {
        Application app = getApplicationUnchecked();
        // We initialize a temporary context
        ExternalContext extCtx = facesContext.getExternalContext();
        final XspContext newContext = ctx = (XspContext)initContext(app, extCtx.getRequest(), extCtx.getResponse());
        // we should clear the context when the JSF context is discarded
        facesContext.addRequestListener(new FacesContextListener() {
View Full Code Here

     * Gets an instance of DefaultMimeEmailFactory.
     * @return An instance of DefaultMimeEmailFactory.
     */
    public static MimeEmailFactory getInstance() {
      if(instance == null) {
            Application app = Application.getUnchecked();
            if (app != null) {
                List<Object> factories = app.findServices(EXTENSION_ID);
                for(Object o : factories) {
                    if(o instanceof MimeEmailFactory) {
                        instance = (MimeEmailFactory)o;
                    }
                }
View Full Code Here

   * Get an environment by its name.
   * @param name
   * @return the corresponding environment, or null if not found
   */
  public static SBTEnvironment get(String name) {
    Application app = Application.getUnchecked();
    if (app != null) {
      List<Object> factories = app.findServices(ENVIRONMENT_FACTORY);
      for(int i=0; i<factories.size(); i++) {
        SBTEnvironmentFactory factory = (SBTEnvironmentFactory)factories.get(i);
        SBTEnvironment env = factory.getEnvironment(name);
        if(env!=null) {
          return env;
View Full Code Here

    // /files/<<endpointName>>/<<serviceType>>/fileName?args
    String pathinfo = request.getPathInfo().substring(request.getPathInfo().indexOf("/files"));
    String[] pathTokens = pathinfo.split("/");   
    if (pathTokens.length > 4) {
      String serviceType = pathTokens[3];
      Application application = Application.get();
      // ProxyEndpointServiceProvider.PROXY_SERVICE_TYPE is the extension ID
      List<Object> proxyServiceProviders = application.findServices(ProxyEndpointServiceProvider.PROXY_SERVICE_TYPE);
      if(proxyServiceProviders != null && !proxyServiceProviders.isEmpty()){
        for(Object o : proxyServiceProviders){
          ProxyEndpointServiceProvider pvdr = (ProxyEndpointServiceProvider)o;
          proxyEndpointService = pvdr.createProxyEndpointService(serviceType);
          if(proxyEndpointService != null){
View Full Code Here

      if(StringUtil.isNotEmpty(cls)) {
        try {
          ClientService clientService = null;
          // order of precedence for the classloader to use
          Context ctx = Context.getUnchecked();
          Application app = Application.getUnchecked();
          ClassLoader cl = Thread.currentThread().getContextClassLoader();
          if (ctx!=null) {
            clientService = (ClientService)ctx.getClassLoader().loadClass(cls).newInstance();
          } else if(app!=null) {
            clientService = (ClientService)app.getClassLoader().loadClass(cls).newInstance();
          } else if(cl!=null) {
            clientService = (ClientService)cl.loadClass(cls).newInstance();
          } else {
            clientService = (ClientService)Class.forName(cls).newInstance();
          }
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;
    }

    ClassLoader loader = app.getClassLoader();
    Properties properties = new Properties();
    try {
      Enumeration<URL> resources = loader.getResources(fileName);
      while (resources.hasMoreElements()) {
        URL url = resources.nextElement();
View Full Code Here

    if(StringUtil.isNotEmpty(appName)) {
      return appName;
    }
   
    // Else, look at the application
    Application app = Application.getUnchecked();
    if(app!=null) {
      return app.getName();
    }
   
    // Else, we don't know...
    return null;
  }
View Full Code Here

    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "readProperties"); //$NON-NLS-1$
    }
   
    Properties properties = 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

  public Factory[] readFactoriesFromWebResource(String fileName) {
    if(StringUtil.isEmpty(fileName)) {
      return null;
    }
    // We read the resource
    Application app = Application.getUnchecked();
    if(app==null) {
      return null;
    }
    ClassLoader loader = app.getClassLoader();
    List<Factory> list = new ArrayList<Factory>();
    try {
      Enumeration<URL> resources = loader.getResources(fileName);
      while (resources.hasMoreElements()) {
        URL url = resources.nextElement();
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.