Package com.sun.appserv.management.config

Examples of com.sun.appserv.management.config.DeployedItemRefConfig


 
      final Set<DeployedItemRefConfig>   refs = new HashSet<DeployedItemRefConfig>();
      final Set<DeployedItemRefConfigCR>  proxies = getTargetProxies( getDomainRoot(), targets );
      for( final DeployedItemRefConfigCR cr : proxies )
      {  
          final DeployedItemRefConfig ref =
              cr.createDeployedItemRefConfig( moduleID, refOptions );
          refs.add( ref );
      }
     
      return refs;
View Full Code Here


        /*
         *Navigate the proxies using either the stand-along server proxy or the cluster proxy, depending
         *on the type of the target.
         */
        DeployedItemRefConfig cfg = null;
       
        /*
         *In doing proxy-based template resolution, we'll locate a resolver - such as a stand-alone server config proxy -
         *that can translate templates if we encounter any.
         */
        TemplateResolver resolver = null;
       
        if( ! aTarget.getTargetType().equals(TargetType.CLUSTER)) {
            StandaloneServerConfig svrProxy =
                    (StandaloneServerConfig)getDomainConfigProxy().
                        getContainee(XTypes.STANDALONE_SERVER_CONFIG,
                                aTarget.getName());
            cfg = (DeployedItemRefConfig)svrProxy.getContainee(
                    XTypes.DEPLOYED_ITEM_REF_CONFIG, moduleID);
            resolver = svrProxy;
        } else {
            ClusterConfig clProxy = (ClusterConfig)getDomainConfigProxy().
                    getContainee(XTypes.CLUSTER_CONFIG, aTarget.getName());
            cfg = (DeployedItemRefConfig)clProxy.getContainee(
                    XTypes.DEPLOYED_ITEM_REF_CONFIG, moduleID);
            /*
             *We cannot assign the resolver yet because the cluster config proxy itself cannot resolve templates.
             */
            resolver = null;
        }

        // Get the list of virtual servers from the application-Ref
        String vServers = cfg.getVirtualServers();
       
        // if no virtual server configured, get default stuff
        if(vServers == null) {
            //FIXME - Need to assign resolver to something for cluster case to use proxy-based template resolution
            return(getDefaultHostPort(resolver));
View Full Code Here

            String msg = resBundle.getString("InvalidNumber");
            throw new IllegalArgumentException(msg);
        }
       
        try {
            DeployedItemRefConfig dRef = null;
            // disables cluster if target is a cluster
            if (isCluster(target)) {
                //get the clusterConfig for this cluster
                Map<String,ClusterConfig> clusterConfigs = mDomainConfig.getClusterConfigMap();
                ClusterConfig clusterConfig = clusterConfigs.get(target);
                //get the deployed item object corresponding to the given appName
                dRef = clusterConfig.getDeployedItemRefConfigMap().get(appName);
            } else { // target is a server
                //get the standalone serverConfig
                Map<String,StandaloneServerConfig> ssConfigMap =
                        mDomainConfig.getStandaloneServerConfigMap();
                StandaloneServerConfig ssc = ssConfigMap.get(target);
                if (ssc == null) {
                    //get the clustered server config
                    ClusteredServerConfig s = mDomainConfig.getClusteredServerConfigMap().get(target);
                    //get the deployed item object corresponding to the given appName
                    dRef = s.getDeployedItemRefConfigMap().get(appName);
                }else{
                    //get the deployed item object corresponding to the given appName
                    dRef = ssc.getDeployedItemRefConfigMap().get(appName);
                }
            }
            if (dRef == null) {
                mLogger.log(Level.FINEST," server " + target +
                        " does not exist in any cluster in the domain");
                String msg = formatter.format(resBundle.getString("AppRefNotDefined"),
                        target);
                throw new MBeanException(new RuntimeException(msg));
            }
            int curTout = Integer.parseInt(
                    dRef.getDisableTimeoutInMinutes());
            //check if the app is already in the state desired
            boolean enabled = dRef.getLBEnabled();
            if(!status){
                if ((enabled == false) && (curTout == timeout)) {
                    String msg = resBundle.getString("AppDisabledOnServer"
                            );
                    throw new MBeanException(new Exception(msg));
                }
                //set the disable timeout
                dRef.setDisableTimeoutInMinutes( "" + timeout );
                //disable the app
                dRef.setLBEnabled(false);
                mLogger.log(Level.INFO,resBundle.getString(
                        "http_lb_admin.ApplicationDisabled"));
            }else{
                if (enabled == true) {
                    String msg = resBundle.getString("AppEnabledOnServer"
                            );
                    throw new MBeanException(new Exception(msg));
                }
                //enable the app
                dRef.setLBEnabled(true);
                mLogger.log(Level.INFO,resBundle.getString(
                        "http_lb_admin.ApplicationEnabled"));
            }
        } catch(Exception ce) {
            throw new RuntimeException(ce);
View Full Code Here

    /*
     * Returns the list of associated Virtual Server in the given target
     */
    static public String getAssociatedVS(String appName, String targetName)
    {
    DeployedItemRefConfig appRef = getDeployedItemRefObject(appName, targetName);
    String vs = appRef.getVirtualServers();
    return vs;
    }
View Full Code Here

    static public boolean isApplicationEnabled(Enabled app, String target, Boolean forLB)
    {
  boolean master = app.getEnabled();
  if (!master) return false;    // no need to look at ref if master is off.
  String name = ((AMX)app).getName();
        DeployedItemRefConfig ref = getDeployedItemRefObject(name, target);
        if (forLB){
            if (ref != null)
                return ref.getLBEnabled();
            else
                return false;
        }
  if (ref == null)
      return master;
  return ref.getEnabled();
    }
View Full Code Here

  /*
   * Given the name of an application and the target, return the application-ref object of that target
   */
  static public DeployedItemRefConfig getDeployedItemRefObject(String name, String target){
      StandaloneServerConfig server = AMXUtil.getDomainConfig().getStandaloneServerConfigMap().get(target);
      DeployedItemRefConfig ref = null;
            if (server == null){
    ClusterConfig cluster = AMXUtil.getDomainConfig().getClusterConfigMap().get(target);
    ref = (cluster == null) ? null :  cluster.getDeployedItemRefConfigMap().get(name);
      }else{
    ref = server.getDeployedItemRefConfigMap().get(name);
View Full Code Here

        if (!master) {
            return false; // no need to look at ref if master is off.
        }
       
        String name = (String) JMXUtil.getAttribute(sipApp, "name");
        DeployedItemRefConfig ref = TargetUtil.getDeployedItemRefObject(name,
                target);
       
        if (forLB) {
            if (ref != null) {
                return ref.getLBEnabled();
            } else {
                return false;
            }
        }
       
        if (ref == null) {
            return master;
        }
       
        return ref.getEnabled();
    }
View Full Code Here

   
    public static void setApplicationEnabled(ObjectName sipApp, String target,
            boolean enabledFlag, boolean forLB) {
        //We use the ref to control enable status
        String name = (String) JMXUtil.getAttribute(sipApp, "name");
        DeployedItemRefConfig ref = TargetUtil.getDeployedItemRefObject(name,
                target);
       
        if (forLB) {
            if (ref != null) {
                ref.setLBEnabled(enabledFlag);
            }
           
            return;
        }
       
View Full Code Here

TOP

Related Classes of com.sun.appserv.management.config.DeployedItemRefConfig

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.