Package net.xoetrope.optional.service

Source Code of net.xoetrope.optional.service.XServiceHelper

package net.xoetrope.optional.service;

import net.xoetrope.xui.XProject;
import net.xoetrope.xui.build.BuildProperties;
import net.xoetrope.xui.data.XModel;

/**
* A helper to simplify access to services
* <p>Copyright (c) Xoetrope Ltd. 2001-2004</p>
* $Revision: 2.13 $
* License: see license.txt
*/
public class XServiceHelper
{
 
  /**
   * Set a named service node from the model.
   * @param project the current project
   * @param serviceName the name of the service
   * @return the service, or null if an error occured or the service is non existant
   */
  public static XServiceModelNode getService( XProject project, String serviceName )
  {
    try {
      XModel model = (XModel)project.getModel().get( serviceName );
      XServiceModelNode smn = (XServiceModelNode)model.get();
      return smn;
    }
    catch ( Exception e )   
    {     
      if ( BuildProperties.DEBUG )
        e.printStackTrace();
    }
   
    return null;
 

  /**
   * Set a named service proxy from the model.
   * @param project the current project
   * @param serviceName the name of the service
   * @return the service, or null if an error occured or the service is non existant
   */
  public static ServiceProxy getServiceProxy( XProject project, String serviceName )
  {
    try {
      XServiceModelNode smn = getService( project, serviceName );
      if ( smn != null )
        return smn.getServiceProxy();
    }
    catch ( Exception e )   
    {     
      if ( BuildProperties.DEBUG )
        e.printStackTrace();
    }
   
    return null;
 
}
TOP

Related Classes of net.xoetrope.optional.service.XServiceHelper

TOP
Copyright © 2018 www.massapi.com. 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.