Ejemplo n.º 1
0
public class LicenseInitInfo {
  private String id = StringUtil.getInstance().EMPTY_STRING;
  private BasicArrayList serverVector = new BasicArrayList();

  public LicenseInitInfo() {}

  public String getLicenseId() {
    return this.id;
  }

  public String getServer(int index) {
    return (String) this.serverVector.objectArray[index];
  }

  public int getNumberOfServers() {
    return this.serverVector.size();
  }

  public void setLicenseId(String value) {
    this.id = value;
  }

  public void clearServers() {
    this.serverVector = new BasicArrayList();
  }

  public void setServer(String value, int index) {
    this.serverVector.add(index, value);
  }

  public void addServer(String value) {
    this.serverVector.add(value);
  }

  public BasicArrayList getServerList() {
    return this.serverVector;
  }

  public void setServerList(BasicArrayList servers) {
    if (DebugFactory.getInstance() == NoDebug.getInstance()) {
      this.serverVector = servers;
    }
  }
}
 private void add(StreetAddress address,String index)
 {
    try
    {
       Vector values = new Vector();
       
       values.add(index);
       values.add(userName);
       values.add(StringUtil.getInstance().EMPTY_STRING);
       values.add(address.getName());
       values.add(address.getStreet());
       values.add(address.getCity());
       values.add(address.getState());
       values.add(address.getCode());
       values.add(address.getCountry());
       
       Calendar calendar=Calendar.getInstance();         
       String time = new String(new Long(calendar.getTimeInMillis()).toString());         
       values.add(time);
       
       super.insert(values);
       
       this.setDefault(getLastId());
       
       if(abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(abcs.logic.communication.log.config.type.LogConfigType.SQLLOGGING))
       {
          LogUtil.put(LogFactory.getInstance("Command Success",this,"add"));
       }
    }
    catch(Exception e)
    {
       if(abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(abcs.logic.communication.log.config.type.LogConfigType.SQLLOGGING))
       {
          LogUtil.put(LogFactory.getInstance("Command Failed",this,"add",e));
       }
    }
 }
   public void setDefault(String value)
   {
      try
      {
         HashMap updateKeyAndValue = new HashMap();
         HashMap whereKeyAndValue = new HashMap();

         whereKeyAndValue.put(UserData.USERNAME,userName);
         
         //remove old default value if it exist
         StreetAddress streetAddress = getDefault();
         if(streetAddress!=null)
         {
            updateKeyAndValue.put(StreetAddressData.DEFAULT, StringUtil.getInstance().EMPTY_STRING);
            whereKeyAndValue.put(StreetAddressData.ID,streetAddress.getId());
            super.updateWhere(whereKeyAndValue,updateKeyAndValue);
         }
         
         //now update new default         
         whereKeyAndValue.put(StreetAddressData.ID,value);
         updateKeyAndValue.put(StreetAddressData.DEFAULT,StreetAddressData.DEFAULT);
         
         super.updateWhere(whereKeyAndValue,updateKeyAndValue);         
         
         if(abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(abcs.logic.communication.log.config.type.LogConfigType.SQLLOGGING))
         {
            LogUtil.put(LogFactory.getInstance("Command Success",this,"setDefault"));
         }
      }
      catch(Exception e)
      {
         if(abcs.logic.communication.log.config.type.LogConfigTypes.LOGGING.contains(abcs.logic.communication.log.config.type.LogConfigType.SQLLOGGING))
         {
            LogUtil.put(LogFactory.getInstance("Command Failed",this,"setShippingAddress",e));
         }
      }
   }
public class OpenGLCapabilities {
  private static final OpenGLCapabilities instance = new OpenGLCapabilities();

  public static OpenGLCapabilities getInstance() {
    return instance;
  }

  private String glVersionString = StringUtil.getInstance().EMPTY_STRING;
  private String glExtensions = this.glVersionString;

  public final String VERSION_1_0 = "1.0";
  public final String VERSION_1_1 = "1.1";
  public final String VERSION_UNK = "Unk";

  private String glVersion = this.glVersionString;
  private boolean glExtensionDrawTexture;

  private boolean glThreedDrawTexture;

  private OpenGLCapabilities() {}

  public void initCapabilities(GL10 gl) throws Exception {
    // StringBuilder stringBuffer = new StringBuilder();

    glVersionString = gl.glGetString(GL10.GL_VERSION);
    glExtensions = gl.glGetString(GL10.GL_EXTENSIONS);

    /*
    class RendererSurfaceCreatedVisitor
    implements VisitorInterface
    {

        public Object visit(Object object)
        {
                BooleanFactory booleanFactory = BooleanFactory.getInstance();
                if (!AllBinaryRenderer.isSurfaceCreated())
                {
                    return booleanFactory.TRUE;
                }
                else
                {
                    return booleanFactory.FALSE;
                }
        }
    }
    */

    /*
     * The device often reports that it does have it when it does not
    if(this.isExtension(OpenGLFeatureFactory.getInstance().OPENGL_DRAW_TEXTURE))
    {
        this.setGlExtensionDrawTexture(true);
    }
    else
    {
        this.setGlExtensionDrawTexture(false);
    }
    */
    this.glExtensionDrawTexture = false;

    if (this.glVersionString.indexOf(" 1.0") >= 0) {
      this.glVersion = this.VERSION_1_0;
    } else if (this.glVersionString.indexOf(" 1.1") >= 0) {
      this.glVersion = this.VERSION_1_1;
    } else {
      this.glVersion = this.VERSION_UNK;
    }

    /*
    if (Features.getInstance().isDefault(
            OpenGLFeatureFactory.getInstance().OPENGL_AUTO_SELECT))
    {
        //if (GameFeatures.getInstance().isDefault(GameFeature.OPENGL_DRAW_TEXTURE))
        //{
            //StupidTimer.visit(new RendererSurfaceCreatedVisitor());

            if(isGlExtensionDrawTexture())
            {
                //ReloadConfiguration reloadConfiguration =
                    //ReloadConfiguration.getInstance();
                //reloadConfiguration.setOpenGL(true);
                //reloadConfiguration.write();

                stringBuffer.append("Found: ");
                stringBuffer.append(OpenGLFeatureFactory.getInstance().OPENGL_DRAW_TEXTURE);

                PreLogUtil.put(stringBuffer.toString(), this, "initGLCapabilities");

                OpenGLImageSpecificFactory.getInstance().setImageFactory(
                        new OpenGLESGL11ExtImageFactory());
            }
            else
            {
                stringBuffer.append("OpenGL is on but ");
                stringBuffer.append(OpenGLFeatureFactory.getInstance().OPENGL_DRAW_TEXTURE);
                stringBuffer.append(" was not available");

                PreLogUtil.put(stringBuffer.toString(), this, "initGLCapabilities");

                OpenGLImageSpecificFactory.getInstance().setImageFactory(
                        new OpenGLESGL10ImageFactory());
            }
        //}
    } else
    {
        stringBuffer.append(OpenGLFeatureFactory.getInstance().OPENGL_AUTO_SELECT);
        stringBuffer.append(" is not on");

        PreLogUtil.put(stringBuffer.toString(), this, "initGLCapabilities");

        OpenGLImageSpecificFactory.getInstance().setImageFactory(new OpenGLESGL10ImageFactory());
    }
    */

    OpenGLImageSpecificFactory.getInstance().setImageFactory(new OpenGLESGL10ImageFactory());
    // For now we will just use the poly version for opengl games
    // this.glThreedDrawTexture = true;
    // OpenGLImageSpecificFactory.getInstance().setImageFactory(new
    // OpenGLESGL10RectangleImageFactory());
  }

  private boolean isExtension(OpenGLFeature gameFeature) {
    int index = glExtensions.indexOf(gameFeature.getName());
    if (index >= 0) {
      return true;
    } else {
      return false;
    }
  }

  public String toString() {
    StringBuilder stringBuffer = new StringBuilder();

    stringBuffer.append("GL_VERSION: ");
    stringBuffer.append(glVersionString);
    stringBuffer.append(" GL_EXTENSIONS: ");
    stringBuffer.append(glExtensions);
    return stringBuffer.toString();
  }

  public boolean isGlExtensionDrawTexture() {
    return glExtensionDrawTexture;
  }

  public String getGlVersion() {
    return glVersion;
  }

  public boolean isGlThreedDrawTexture() {
    return glThreedDrawTexture;
  }
}