Example usage for java.util Vector addElement

List of usage examples for java.util Vector addElement

Introduction

In this page you can find the example usage for java.util Vector addElement.

Prototype

public synchronized void addElement(E obj) 

Source Link

Document

Adds the specified component to the end of this vector, increasing its size by one.

Usage

From source file:Controlador.ControladorLecturas.java

public Vector vectorHumedadAmbiental() {
    Vector data = new Vector(1, 1);
    for (Lecturas lectura : lista) {
        Vector row = new Vector(1, 1);
        row.addElement(lectura.getHumedadambiente());
        row.addElement(lectura.getHora());
        data.addElement(row);//from ww w  .  j  a  v a2 s .  c  om
    }
    return data;
}

From source file:Controlador.ControladorLecturas.java

public Vector vectorHumedadSuelo() {
    Vector data = new Vector(1, 1);
    for (Lecturas lectura : lista) {
        Vector row = new Vector(1, 1);
        row.addElement(lectura.getHumedadsuelo());
        row.addElement(lectura.getHora());
        data.addElement(row);//from   w ww .j a  v  a  2 s.  c  o  m
    }
    return data;
}

From source file:gov.nih.nci.ncicb.cadsr.common.util.NCIBC4JUtil.java

public Vector getAllRows(RowIterator rowIterator) {
    Vector rows = new Vector(rowIterator.getRowCount());
    try {/*from w ww .  j a  v a 2s.  com*/
        rowIterator.reset();
        for (; rowIterator.hasNext(); rows.addElement(rowIterator.next()))
            ;
        rowIterator.reset();
    } catch (Exception exception) {
        if (rowIterator != null)
            rowIterator.reset();
        rows = new Vector();
    }
    return rows;
}

From source file:org.apache.tomcat.util.IntrospectionUtils.java

public static String[] findVoidSetters(Class c) {
    Method m[] = findMethods(c);/*  w  w  w.  j  a  v a2s. com*/
    if (m == null)
        return null;
    Vector v = new Vector();
    for (int i = 0; i < m.length; i++) {
        if (m[i].getName().startsWith("set") && m[i].getParameterTypes().length == 0) {
            String arg = m[i].getName().substring(3);
            v.addElement(unCapitalize(arg));
        }
    }
    String s[] = new String[v.size()];
    for (int i = 0; i < s.length; i++) {
        s[i] = (String) v.elementAt(i);
    }
    return s;
}

From source file:orca.shirako.container.RemoteRegistryCache.java

/**
 * Register an actor with the registry//from ww  w .  ja  va  2  s  .  c  o m
 * @param actor actor
 */
public static void registerWithRegistry(IActor actor) {
    // External actor registry operations
    // If actor needs to be registered at external registry (i.e
    // PropertyRegistryUrl is set to the url for the registry),
    // register actor with external registry

    // NOTE: we register with local cache no matter what (if registry is specified or not)
    try {
        String act_name = actor.getName();
        String act_type = (new Integer(actor.getType())).toString();
        String act_guid = actor.getGuid().toString();
        String act_desc = actor.getDescription();

        String act_soapaxis2url = Globals.getContainer().getConfiguration()
                .getProperty(IOrcaConfiguration.PropertySoapAxis2Url);
        if (act_soapaxis2url != null) {
            act_soapaxis2url += "/services/" + actor.getName();
        } else {
            act_soapaxis2url = "None";
        }

        String act_class = actor.getClass().getCanonicalName();
        String act_mapper_class = actor.getPolicy().getClass().getCanonicalName();

        String act_pubkey = actor.getShirakoPlugin().getKeyStore().getActorCertificate().getPublicKey()
                .toString();
        if (act_pubkey == null) {
            act_pubkey = "None";
        }

        // get actor cert
        Certificate cert = actor.getShirakoPlugin().getKeyStore().getActorCertificate();
        byte[] bytes = null;

        try {
            bytes = cert.getEncoded();
        } catch (CertificateEncodingException e) {
            throw new RuntimeException("Failed to encode the certificate");
        }

        String base64 = Base64.encodeBytes(bytes);
        //Globals.Log.info("Actor certificate in BASE64: \n" + base64);
        String act_cert64 = base64;

        // register with local cache regardless of whether external registry is used
        HashMap<String, String> res = new HashMap<String, String>();
        res.put(RemoteRegistryCache.ActorName, act_name);
        res.put(RemoteRegistryCache.ActorGuid, act_guid);
        String actor_type = null;

        if (act_type.equalsIgnoreCase("1")) {
            actor_type = OrcaConstants.SM;
        }
        if (act_type.equalsIgnoreCase("2")) {
            actor_type = OrcaConstants.BROKER;
        }
        if (act_type.equalsIgnoreCase("3")) {
            actor_type = OrcaConstants.SITE;
        }
        res.put(RemoteRegistryCache.ActorType, actor_type);
        res.put(RemoteRegistryCache.ActorLocation, act_soapaxis2url);
        res.put(RemoteRegistryCache.ActorProtocol, OrcaConstants.ProtocolSoapAxis2);
        res.put(RemoteRegistryCache.ActorCert64, act_cert64);
        RemoteRegistryCache.getInstance().addLocalCacheEntry(act_guid, res);

        // now try registering with remote
        String registryUrl = Globals.getContainer().getConfiguration()
                .getProperty(OrcaContainer.PropertyRegistryUrl);
        String registryMethod = Globals.getContainer().getConfiguration()
                .getProperty(OrcaContainer.PropertyRegistryMethod);
        if (registryUrl == null || registryMethod == null) {
            Globals.Log.info("No external registry is specified.");
            return;
        }

        Globals.Log.info(
                "Registering actor with external registry at " + registryUrl + " using " + registryMethod);

        Vector<String> params = new Vector<String>();
        // This order of insert is very important, because the xml-rpc
        // server expects the strings in this order
        params.addElement(act_name);
        params.addElement(act_type);
        params.addElement(act_guid);
        params.addElement(act_desc);
        params.addElement(act_soapaxis2url);
        params.addElement(act_class);
        params.addElement(act_mapper_class);
        params.addElement(act_pubkey);
        params.addElement(act_cert64);
        try {
            Globals.Log
                    .debug("Inserting into registry - Actor:" + act_name + " | Type:" + act_type + " | GUID: "
                            + act_guid + " | Description: " + act_desc + " | soapaxis2url: " + act_soapaxis2url
                            + " | ActorClass: " + act_class + " | ActorMapperClass: " + act_mapper_class);

            // add actor key and cert into the multikeymanager
            mkm.addPrivateKey(act_guid, actor.getShirakoPlugin().getKeyStore().getActorPrivateKey(),
                    actor.getShirakoPlugin().getKeyStore().getActorCertificate());

            // before we do SSL to registry, set our identity
            mkm.setCurrentGuid(act_guid);

            XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
            config.setServerURL(new URL(registryUrl + "/"));
            XmlRpcClient client = new XmlRpcClient();
            client.setConfig(config);

            HttpClient h = new HttpClient(connMgr);
            // set this transport factory for host-specific SSLContexts to work
            XmlRpcCommonsTransportFactory f = new XmlRpcCommonsTransportFactory(client);
            f.setHttpClient(h);
            client.setTransportFactory(f);

            String stat = (String) client.execute(registryMethod, params);
            Globals.Log.info("Registry returned: " + stat);
        } catch (Exception ex) {
            Globals.Log.error("Could not connect to the registry server " + registryUrl + ": ", ex);
        }
        // start update thread
        ActorLiveness checkActorLive = new ActorLiveness(actor.getGuid().toString(), registryUrl,
                registryMethod);
    } catch (Exception e) {
        Globals.Log.error("An error occurred whle attempting to register actor " + actor.getName()
                + " with external registry", e);
    }
}

From source file:edu.indiana.lib.osid.base.repository.http.RecordStructure.java

public org.osid.repository.PartStructureIterator getPartStructures()
        throws org.osid.repository.RepositoryException {
    java.util.Vector results = new java.util.Vector();
    try {//w w w.  ja  v  a  2  s  .c  o  m
        results.addElement(ContributorPartStructure.getInstance());
        results.addElement(CoveragePartStructure.getInstance());
        results.addElement(CreatorPartStructure.getInstance());
        results.addElement(DatePartStructure.getInstance());
        results.addElement(DateRetrievedPartStructure.getInstance());
        results.addElement(DOIPartStructure.getInstance());
        results.addElement(EditionPartStructure.getInstance());
        results.addElement(EndPagePartStructure.getInstance());
        results.addElement(FormatPartStructure.getInstance());
        results.addElement(InLineCitationPartStructure.getInstance());
        results.addElement(IsnIdentifierPartStructure.getInstance());
        results.addElement(IssuePartStructure.getInstance());
        results.addElement(LanguagePartStructure.getInstance());
        results.addElement(NotePartStructure.getInstance());
        results.addElement(OpenUrlPartStructure.getInstance());
        results.addElement(PagesPartStructure.getInstance());
        results.addElement(PublicationLocationPartStructure.getInstance());
        results.addElement(PublisherPartStructure.getInstance());
        results.addElement(RelationPartStructure.getInstance());
        results.addElement(RightsPartStructure.getInstance());
        results.addElement(SourcePartStructure.getInstance());
        results.addElement(SourceTitlePartStructure.getInstance());
        results.addElement(StartPagePartStructure.getInstance());
        results.addElement(SubjectPartStructure.getInstance());
        results.addElement(TypePartStructure.getInstance());
        results.addElement(URLPartStructure.getInstance());
        results.addElement(VolumePartStructure.getInstance());
        results.addElement(YearPartStructure.getInstance());
    } catch (Throwable t) {
        throw new org.osid.repository.RepositoryException(
                org.osid.repository.RepositoryException.OPERATION_FAILED);
    }
    return new PartStructureIterator(results);
}

From source file:FileTree.java

/** Add nodes from under "dir" into curTop. Highly recursive. */
DefaultMutableTreeNode addNodes(DefaultMutableTreeNode curTop, File dir) {
    String curPath = dir.getPath();
    DefaultMutableTreeNode curDir = new DefaultMutableTreeNode(curPath);
    if (curTop != null) { // should only be null at root
        curTop.add(curDir);//from  w ww  .  j  a va  2  s.  c  o m
    }
    Vector ol = new Vector();
    String[] tmp = dir.list();
    for (int i = 0; i < tmp.length; i++)
        ol.addElement(tmp[i]);
    Collections.sort(ol, String.CASE_INSENSITIVE_ORDER);
    File f;
    Vector files = new Vector();
    // Make two passes, one for Dirs and one for Files. This is #1.
    for (int i = 0; i < ol.size(); i++) {
        String thisObject = (String) ol.elementAt(i);
        String newPath;
        if (curPath.equals("."))
            newPath = thisObject;
        else
            newPath = curPath + File.separator + thisObject;
        if ((f = new File(newPath)).isDirectory())
            addNodes(curDir, f);
        else
            files.addElement(thisObject);
    }
    // Pass two: for files.
    for (int fnum = 0; fnum < files.size(); fnum++)
        curDir.add(new DefaultMutableTreeNode(files.elementAt(fnum)));
    return curDir;
}

From source file:com.iucosoft.eavertizare.gui.models.ClientiTableModel.java

private void rowAllClients() {
    Vector rowAll = new Vector();
    rowAll.addElement(null);
    rowAll.addElement(null);/*from  w ww  .java2  s. com*/
    rowAll.addElement(null);
    rowAll.addElement(null);
    rowAll.addElement("All clients");
    rowAll.addElement(null);
    rowAll.addElement(null);
    rowAll.addElement(null);

    super.addRow(rowAll);
}

From source file:com.iucosoft.eavertizare.gui.models.ClientiTableModel.java

public void refreshModel(String numeFirma) {
    clearModel();// w  ww .j av a2 s .  c  om
    Firma firma = firmaDao.findByName(numeFirma);
    List<Client> listaClienti = clientsDao.findAllClientsForFirmaLocal(firma);
    SimpleDateFormat sdf = new SimpleDateFormat("dd/M/yyyy");
    int nr = 1;

    //   rowAllClients();
    for (Client client : listaClienti) {

        Vector rowData = new Vector();
        rowData.addElement(nr++);
        rowData.addElement(client.getNume());
        rowData.addElement(client.getPrenume());
        rowData.addElement(client.getNrTelefon());
        rowData.addElement(client.getEmail());
        rowData.addElement(sdf.format(client.getDateExpirare()));
        rowData.addElement(client.getFirma().getNumeFirma());
        rowData.addElement(client.isTrimis());
        super.addRow(rowData);
    }
}

From source file:com.iucosoft.eavertizare.gui.models.ClientiTableModel.java

public void refreshModel() {
    clearModel();/*ww w .  j  ava2s. co  m*/
    List<Firma> listaFirme = firmaDao.findAll();
    List<Client> listaClienti;
    SimpleDateFormat sdf = new SimpleDateFormat("dd/M/yyyy");
    int nr = 1;

    //   rowAllClients();
    for (Firma firma : listaFirme) {
        listaClienti = clientsDao.findAllClientsForFirmaLocal(firma);
        for (Client client : listaClienti) {

            Vector rowData = new Vector();
            rowData.addElement(nr++);
            rowData.addElement(client.getNume());
            rowData.addElement(client.getPrenume());
            rowData.addElement(client.getNrTelefon());
            rowData.addElement(client.getEmail());
            rowData.addElement(sdf.format(client.getDateExpirare()));
            rowData.addElement(client.getFirma().getNumeFirma());
            //  rowData.addElement(new Boolean(true));
            rowData.addElement(client.isTrimis());
            super.addRow(rowData);
        }
    }
}