Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

RequestCommand.java

00001 /*
00002  * OpenMobileIS - a free Java(TM) Framework for mobile applications Java(TM)
00003  * Copyright (C) 2004-2005 Philippe Delrieu
00004  * All rights reserved.
00005  * Contact: openmobileis@e-care.fr
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00020  * USA
00021  *
00022  *  Author : Philippe Delrieu
00023  * 
00024  */
00025 
00026 package org.openmobileis.synchro.openmsp.protocol;
00027 
00039 public class RequestCommand extends AbstractCommand  implements Element {
00044   final static long serialVersionUID = 1L;
00045 
00046 
00047   // credential : String[0] : Meta information and String[1] : data authentification
00048   protected String[] credential;
00049   // meta information (blob)
00050   protected String metaInfo;
00051 
00052   public  RequestCommand (int commandType) {
00053     super(commandType);
00054   }
00055 
00056   public void setCredential (String meta, String data) {
00057     credential = new String[2];
00058     credential[0] = meta;
00059     credential[1] = data;
00060   }
00061 
00062   public void setCredentialMeta (String meta) {
00063     if (credential == null)
00064       credential = new String[2];
00065     credential[0] = meta;
00066   }
00067 
00068    public void setCredentialData (String data) {
00069     if (credential == null)
00070       credential = new String[2];
00071     credential[1] = data;
00072   }
00073 
00074   public String[] getCrendential() {
00075     return credential;
00076    }
00077 
00078   public String getMetaInformation() {
00079     return metaInfo;
00080     }
00081 
00082   public void setMetaInformation (String meta) {
00083     this.metaInfo = meta;
00084     }
00085 
00086  public String toString() {
00087   String temp =  super.toString() + " meta : " + metaInfo;
00088   if (credential != null)
00089     temp = temp + " cred : " + credential[0] + " " + credential[1];
00090   return temp;
00091  }
00092 
00093 
00094   /*** Implements Element interface **/
00095  public void writeContent(StringBuffer buffer) {
00096    super.writeContent(buffer);
00097     if (credential != null) {
00098       MessageFactory.writeCredential(buffer, credential[0], credential[1]);
00099       buffer.append("\n");
00100     }
00101      if (metaInfo != null) {
00102       MessageFactory.writeElement(buffer, MessageFactory.TAG_META, metaInfo);
00103       buffer.append("\n");
00104      }
00105  }
00106 
00107 
00108  }

Generated on Wed Dec 14 21:05:34 2005 for OpenMobileIS by  doxygen 1.4.4