com.sun.enterprise.config.serverbeans.Server.getApplicationRef()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(158)

本文整理了Java中com.sun.enterprise.config.serverbeans.Server.getApplicationRef()方法的一些代码示例,展示了Server.getApplicationRef()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Server.getApplicationRef()方法的具体详情如下:
包路径:com.sun.enterprise.config.serverbeans.Server
类名称:Server
方法名:getApplicationRef

Server.getApplicationRef介绍

暂无

代码示例

代码示例来源:origin: org.glassfish.admin/config-api

public static ApplicationRef getApplicationRef(Server server,
    String appName) {
  for (ApplicationRef appRef : server.getApplicationRef()) {
    if (appRef.getRef().equals(appName)) {
      return appRef;
    }
  }
  return null;
}

代码示例来源:origin: org.glassfish.admin/config-api

public static List<ApplicationRef> getApplicationRefsInServer(Domain me, String sn) {
  Server server = getServerNamed(me, sn);
  if (server != null) {
    return server.getApplicationRef();
  } else {
    return Collections.EMPTY_LIST;
  }
}

代码示例来源:origin: org.glassfish.main.admin/config-api

public static List<ApplicationRef> getApplicationRefsInServer(Domain me, String sn) {
  Server server = getServerNamed(me, sn);
  if (server != null) {
    return server.getApplicationRef();
  } else {
    return Collections.EMPTY_LIST;
  }
}

代码示例来源:origin: org.glassfish.main.admin/config-api

public static ApplicationRef getApplicationRef(Server server,
    String appName) {
  for (ApplicationRef appRef : server.getApplicationRef()) {
    if (appRef.getRef().equals(appName)) {
      return appRef;
    }
  }
  return null;
}

代码示例来源:origin: fujitsu/launcher

public boolean isAppEnabled(Application app) {
  if (Boolean.valueOf(app.getEnabled())) {
    ApplicationRef appRef = server.getApplicationRef(app.getName());
    if (appRef != null && Boolean.valueOf(appRef.getEnabled())) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.glassfish.main.core/kernel

public boolean isAppEnabled(Application app) {
  if (Boolean.valueOf(app.getEnabled())) {
    ApplicationRef appRef = server.getApplicationRef(app.getName());
    if (appRef != null && Boolean.valueOf(appRef.getEnabled())) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.glassfish.main.common/amx-javaee

protected void registerApplications()
{
  final List<ApplicationRef> appRefs = mServer.getApplicationRef();
  for (final ApplicationRef ref : appRefs)
  {
    try
    {
      processApplicationRef(ref);
    }
    catch( final Exception e )
    {
      // log it: we want to continue with other apps, even if this one had a problem
      mLogger.log( Level.INFO, AMXEELoggerInfo.registeringApplicationException, 
          new Object[] { ref.getRef(), e});
    }
  }
}

代码示例来源:origin: org.glassfish.main.admin/config-api

public static List<Application> getSystemApplicationsReferencedFrom(Domain d, String sn) {
  if (d == null || sn == null)
    throw new IllegalArgumentException("Null argument");
  List<Application> allApps = d.getAllDefinedSystemApplications();
  if (allApps.isEmpty())
    return allApps; //if there are no sys-apps, none can reference one :)
  //allApps now contains ALL the system applications
  Server s = getServerNamed(d,sn);
  List<Application> referencedApps = new ArrayList<Application>();
  List<ApplicationRef> appsReferenced = s.getApplicationRef();
  for (ApplicationRef ref : appsReferenced) {
    for (Application app : allApps) {
      if (ref.getRef().equals(app.getName())) {
        referencedApps.add(app);
      }
    }
  }
  return Collections.unmodifiableList(referencedApps);
}

代码示例来源:origin: org.glassfish.admin/config-api

public static List<Application> getSystemApplicationsReferencedFrom(Domain d, String sn) {
  if (d == null || sn == null)
    throw new IllegalArgumentException("Null argument");
  List<Application> allApps = d.getAllDefinedSystemApplications();
  if (allApps.isEmpty())
    return allApps; //if there are no sys-apps, none can reference one :)
  //allApps now contains ALL the system applications
  Server s = getServerNamed(d,sn);
  List<Application> referencedApps = new ArrayList<Application>();
  List<ApplicationRef> appsReferenced = s.getApplicationRef();
  for (ApplicationRef ref : appsReferenced) {
    for (Application app : allApps) {
      if (ref.getRef().equals(app.getName())) {
        referencedApps.add(app);
      }
    }
  }
  return Collections.unmodifiableList(referencedApps);
}

代码示例来源:origin: org.glassfish.connectors/connectors-runtime

public boolean isEnabled(Application application){
  if(application == null){
    return false;
  }
  boolean appEnabled = Boolean.valueOf(application.getEnabled());
  ApplicationRef appRef = getServer().getApplicationRef(application.getName());
  boolean appRefEnabled = false;
  if(appRef != null ){
    appRefEnabled = Boolean.valueOf(appRef.getEnabled());
  }
  return appEnabled && appRefEnabled;
}

代码示例来源:origin: org.glassfish.main.admin/config-api

public static List<ApplicationRef> getApplicationRefsInTarget(
  Domain me, String tgt, boolean includeInstances) {
  List<String> targets = getTargets(me, tgt);
  List<ApplicationRef> allAppRefs = new ArrayList<ApplicationRef>();
  for (String target : targets) {
    Server server = me.getServerNamed(target);
    if (server != null) {
      allAppRefs.addAll(server.getApplicationRef());
    } else {
      Cluster cluster = getClusterNamed(me, target);
      if (cluster != null) {
        allAppRefs.addAll(cluster.getApplicationRef());
        if (includeInstances) {
          for (Server svr : cluster.getInstances() ) {
            allAppRefs.addAll(svr.getApplicationRef());
          }
        }
      }
    }
  }
  return allAppRefs;
}

代码示例来源:origin: org.glassfish.connectors/connectors-runtime

/**
 * Checks if the application reference is enabled
 * @param appName application-name
 * @since SJSAS 9.1 PE/SE/EE
 * @return boolean indicating the status
 */
private boolean isApplicationReferenceEnabled(String appName) {
  ApplicationRef appRef = getServer().getApplicationRef(appName);
  if (appRef == null) {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.fine("ResourcesUtil :: isApplicationReferenceEnabled null ref");
    }
    return false;
  }
  if(_logger.isLoggable(Level.FINE)) {
    _logger.fine("ResourcesUtil :: isApplicationReferenceEnabled appRef enabled ?" + appRef.getEnabled());
  }
  return ConnectorsUtil.parseBoolean(appRef.getEnabled());
}

代码示例来源:origin: org.glassfish.main.admin/config-api

public static ApplicationRef getApplicationRefInServer(Domain me, String sn, String name) {
  Servers ss = me.getServers();
  List<Server> list = ss.getServer();
  Server theServer = null;
  for (Server s : list) {
    if (s.getName().equals(sn)) {
      theServer = s;
      break;
    }
  }
  ApplicationRef aref = null;
  if (theServer != null) {
    List <ApplicationRef> arefs = theServer.getApplicationRef();
    for (ApplicationRef ar : arefs) {
      if (ar.getRef().equals(name)) {
        aref = ar;
        break;
      }
    }
  }
  return aref;
}

代码示例来源:origin: org.glassfish.main.admin/config-api

public ApplicationRef getApplicationRefInServer(String sn, String name) {
  Servers ss = domain.getServers();
  List<Server> list = ss.getServer();
  Server theServer = null;
  for (Server s : list) {
    if (s.getName().equals(sn)) {
      theServer = s;
      break;
    }
  }
  ApplicationRef aref = null;
  if (theServer != null) {
    List <ApplicationRef> arefs = theServer.getApplicationRef();
    for (ApplicationRef ar : arefs) {
      if (ar.getRef().equals(name)) {
        aref = ar;
        break;
      }
    }
  }
  return aref;
}

代码示例来源:origin: org.glassfish.admin/config-api

public static ApplicationRef getApplicationRefInServer(Domain me, String sn, String name) {
  Servers ss = me.getServers();
  List<Server> list = ss.getServer();
  Server theServer = null;
  for (Server s : list) {
    if (s.getName().equals(sn)) {
      theServer = s;
      break;
    }
  }
  ApplicationRef aref = null;
  if (theServer != null) {
    List <ApplicationRef> arefs = theServer.getApplicationRef();
    for (ApplicationRef ar : arefs) {
      if (ar.getRef().equals(name)) {
        aref = ar;
        break;
      }
    }
  }
  return aref;
}

代码示例来源:origin: org.glassfish.admin/config-api

public static ApplicationRef getApplicationRefInServer(String sn, String name) {
  Servers ss = domain.getServers();
  List<Server> list = ss.getServer();
  Server theServer = null;
  for (Server s : list) {
    if (s.getName().equals(sn)) {
      theServer = s;
      break;
    }
  }
  ApplicationRef aref = null;
  if (theServer != null) {
    List <ApplicationRef> arefs = theServer.getApplicationRef();
    for (ApplicationRef ar : arefs) {
      if (ar.getRef().equals(name)) {
        aref = ar;
        break;
      }
    }
  }
  return aref;
}

代码示例来源:origin: org.glassfish.main.security/security-ee

/**
 * Virtual servers are maintained in the reference contained 
 * in Server element. First, we need to find the server
 * and then get the virtual server from the correct reference
 *
 * @param appName Name of the app to get vs
 *
 * @return virtual servers as a string (separated by space or comma)
 */
private String getVirtualServers(String appName) {
  String ret = null;
  Server server = serverContext.getDefaultServices().getService(Server.class);
  for (ApplicationRef appRef : server.getApplicationRef()) {
    if (appRef.getRef().equals(appName)) {
      return appRef.getVirtualServers();
    }
  }
  
  return ret;
}

代码示例来源:origin: org.glassfish.web/web-glue

/**
 * Virtual servers are maintained in the reference contained
 * in Server element. First, we need to find the server
 * and then get the virtual server from the correct reference
 *
 * @param appName Name of the app to get vs
 *
 * @return virtual servers as a string (separated by space or comma)
 */
private String getVirtualServers(String appName) {
  String ret = null;
  Server server = Globals.getDefaultHabitat().getComponent(Server.class);
  for (ApplicationRef appRef : server.getApplicationRef()) {
    if (appRef.getRef().equals(appName)) {
      return appRef.getVirtualServers();
    }
  }
  return ret;
}

代码示例来源:origin: org.glassfish.security/security

/**
 * Virtual servers are maintained in the reference contained 
 * in Server element. First, we need to find the server
 * and then get the virtual server from the correct reference
 *
 * @param appName Name of the app to get vs
 *
 * @return virtual servers as a string (separated by space or comma)
 */
private String getVirtualServers(String appName) {
  String ret = null;
  Server server = serverContext.getDefaultHabitat().getComponent(Server.class);
  for (ApplicationRef appRef : server.getApplicationRef()) {
    if (appRef.getRef().equals(appName)) {
      return appRef.getVirtualServers();
    }
  }
  
  return ret;
}

代码示例来源:origin: org.glassfish.connectors/connectors-runtime

/**
 * Returns true if the given resource is referenced by this server.
 *
 * @param resourceInfo the name of the resource
 * @return true if the named resource is used/referred by this server
 */
protected boolean isReferenced(ResourceInfo resourceInfo) {
  boolean refExists = false;
  if (ConnectorsUtil.isModuleScopedResource(resourceInfo) ||
      ConnectorsUtil.isApplicationScopedResource(resourceInfo)) {
    refExists = getServer().getApplicationRef(resourceInfo.getApplicationName()) != null;
  } else {
    String resourceName = resourceInfo.getName();
    refExists = getServer().isResourceRefExists(resourceName);
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.fine("isReferenced :: " + resourceInfo + " - " + refExists);
  }
  return refExists;
}

相关文章