Package org.emrys.webosgi.core.internal

Examples of org.emrys.webosgi.core.internal.FwkRuntime


  private void collectHostAddresses() throws Exception {
    // Try to get framework config for the host name and port.
    // Fetch the host addresses(IPs) of the framework server, and the set
    // the recommended one as first.
    FwkRuntime fwkRuntime = FwkRuntime.getInstance();
    List<String> hostAddrs = new ArrayList<String>();
    // This default host addr should be a String type, but we do a type
    // check.
    Object defaultHostAddr = fwkRuntime
        .getFrameworkAttribute(IFwkEnvConstants.ATTR_WEB_APP_HOST);
    if (defaultHostAddr instanceof String
        && !"localhost".equals(defaultHostAddr)
        && !"127.0.0.1".equals(defaultHostAddr)) {
      // Set the default host address to the first recommened one.
      hostAddrs.add((String) defaultHostAddr);
    }

    // Recursive for all Internet Protocol address(IP).
    String hostName = InetAddress.getLocalHost().getHostName();
    InetAddress[] addressese = InetAddress.getAllByName(hostName);
    for (InetAddress ad : addressese) {
      String addr = ad.getHostAddress();
      if (!hostAddrs.contains(addr))
        hostAddrs.add(addr);
    }

    fwkRuntime.setFrameworkAttribute(ATTR_WEB_APP_HOSTS, hostAddrs);
  }
View Full Code Here


    synchronized (this) {
      // Only call once.
      if (!isWebServiceStarted() && !triedToStartFailed) {
        // Enter app starting block.
        FwkRuntime fwkRuntime = FwkRuntime.getInstance();
        fwkRuntime.enterAppSvcStart(this);
        try {
          triedToStartFailed = true;
          checkDoubleNsPrefix();
          startWebService(context);
          webServiceStartDone = true;
          WebComActivator.this.log(new Status(Status.INFO,
              WebComActivator.this.getBundleSymbleName(),
              "Web Service in bundle ID:"
                  + WebComActivator.this
                      .getBundleSymbleName() + " ["
                  + WebComActivator.this.getServiceNSPrefix()
                  + "] published OK."));

        } catch (Throwable t) {
          // t.printStackTrace();
          WebComActivator.this.log(new Status(Status.INFO,
              WebComActivator.this.getBundleSymbleName(),
              "Web Service in bundle ID:"
                  + WebComActivator.this
                      .getBundleSymbleName() + " ["
                  + WebComActivator.this.getServiceNSPrefix()
                  + "] published Failed.", t));
        } finally {
          // Quit app starting block.
          fwkRuntime.quitAppSvcStart(this);
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.emrys.webosgi.core.internal.FwkRuntime

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.