Example usage for java.util Hashtable size

List of usage examples for java.util Hashtable size

Introduction

In this page you can find the example usage for java.util Hashtable size.

Prototype

public synchronized int size() 

Source Link

Document

Returns the number of keys in this hashtable.

Usage

From source file:org.socraticgrid.displaydataaggregator.DisplayDataAggregatorImpl.java

public org.socraticgrid.common.dda.GetSummaryDataResponseType getSummaryDataForUser(
        org.socraticgrid.common.dda.GetSummaryDataForUserRequestType request) {
    GetSummaryDataResponseType response = new GetSummaryDataResponseType();
    Hashtable<String, String> sourceTable = new Hashtable<String, String>();

    try {/*from  w w w . j  a va 2s  .  c o  m*/
        ServiceError dataSourceError = getDataSources(sourceTable);
        if (dataSourceError != null) {
            throw new Exception("Error retrieving data sources.");
        }

        if (sourceTable.size() == 0) {
            throw new Exception("No data sources defined.");
        }

        //Convert userId
        String userId = request.getUserId();
        try {
            UniversalResourceAddressBean beanId = UniversalResourceAddressBeanFactory.getInstance()
                    .createUniversalResourceBean(request.getUserId());
            if (beanId instanceof IdAddressBean) {
                userId = ((IdAddressBean) beanId).getId();
            }
        } catch (Exception e) {
            log.warn("Bad user id: " + userId + ", " + e.getMessage());
        }

        for (String dataSource : request.getDataSources()) {
            String dataSourceUrl = sourceTable.get(dataSource);
            if (dataSourceUrl == null) {
                throw new Exception("Requested data source is not configured: " + dataSource);
            }

            try {
                //                    org.socraticgrid.aggregator.DisplayDataComponent service = new org.socraticgrid.aggregator.DisplayDataComponent();
                //                    org.socraticgrid.aggregator.DisplayDataComponentPortType port = service.getDisplayDataComponentPortSoap11();
                //                    ((javax.xml.ws.BindingProvider) port).getRequestContext().put(
                //                            javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                //                            dataSourceUrl);
                DisplayAlertDataUtil util = new DisplayAlertDataUtil();

                GetComponentSummaryDataForUserRequestType componentRequest = new GetComponentSummaryDataForUserRequestType();
                componentRequest.setUserId(userId);
                componentRequest.setGroupId(request.getGroupId());
                componentRequest.setLocationId(request.getLocationId());
                componentRequest.setPatientId(request.getPatientId());
                componentRequest.setProviderId(request.getProviderId());
                componentRequest.setOnlyNew(request.isOnlyNew());
                componentRequest.setArchive(request.isArchive());
                GetComponentSummaryDataResponseType componentResponse = util
                        .getComponentSummaryDataForUser("Alert", componentRequest);
                response.getSummaryObjects().addAll(componentResponse.getSummaryObjects());
            } catch (Exception e) {
                String errorMsg = "Error getting component summary data from: " + dataSource;
                log.error(errorMsg, e);
                ServiceError error = new ServiceError();
                error.setCode(ERROR_CODE);
                error.setText(errorMsg + ". " + e.getMessage());
                response.getErrorList().add(error);
            }

        } //for

    } catch (Exception e) {
        String errorMsg = "Error getting summary data.";
        log.error(errorMsg, e);
        ServiceError error = new ServiceError();
        error.setCode(ERROR_CODE);
        error.setText(errorMsg + ". " + e.getMessage());
        response.getErrorList().add(error);
    }

    //Get "read" status as needed
    ServiceError error = addReadStatus(request.getUserId(), response.getSummaryObjects());
    if (error != null) {
        response.getErrorList().add(error);
    }

    return response;
}

From source file:org.catechis.Stats.java

/**This method takes a Hashtable with the test_date-score format.
* We steps thru the list, adding up the scores and then divides by the number of tests.
* We also check the dates, hanging on to the latest date for later retrieval in the
* getLastTest method./*w  w  w. j  a  v  a 2s. c  o m*/
*/
public double getAverage(Hashtable tests) {
    int number_of_tests = tests.size();
    double running_total = 0.0;
    int i = 0;
    last_time = 0;
    Enumeration e = tests.keys();
    while (e.hasMoreElements()) {
        String str_grade = (String) e.nextElement();
        String str_date = (String) tests.get(str_grade);
        Double dbl_score = new Double(str_grade);
        double score = dbl_score.doubleValue();
        running_total = (running_total + score);
        i++;
        compareDates(str_date);
    }
    running_total_of_tests = running_total_of_tests + running_total;
    total_test_count = total_test_count + number_of_tests;
    double average_score = (running_total / number_of_tests);
    return average_score;
}

From source file:pa_SymposiumPlanner.RuleML2008ChallengeChair.java

public void answerQuery() {
    try {//from w  ww  .ja  va  2  s. co  m
        address = PAConfiguration.getAddress();
        port = PAConfiguration.getPort(instantiation);
        poslAddress = PAConfiguration.getPOSL(instantiation, topic);
        rdfAddress = PAConfiguration.getRDFTaxonomy(instantiation);
        messageEndpoint = PAConfiguration.getEndpointName(instantiation, topic);
    } catch (BadConfigurationException e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
        System.exit(0);
    }

    try {
        System.out.println("5 Publicty Chair Servlet");
        String message = "";

        SAXReader reader = new SAXReader();
        message = reader.read(new File("D:\\RuleMLMessage.xml")).asXML();

        String[] varOrder = getVariableOrder(message);
        System.out.println("Received Message: " + message);

        // BackwardReasoner br = new BackwardReasoner();
        // Iterator solit =null;
        // DefiniteClause dc = null;
        // SymbolTable.reset();

        POSLParser pp = new POSLParser();
        // String contents = "c(a).\nc(b).\nc(c).";

        Date t1 = new GregorianCalendar().getTime();
        System.out.println(t1.getHours() + ":" + t1.getMinutes());
        // append time to contents

        System.out.println("day: " + t1.getDay());
        System.out.println("day: " + t1.getYear());
        System.out.println("day: " + t1.getMonth());

        // time
        String time = "time(" + t1.getHours() + ":integer).";
        System.out.println(time);

        String url = poslAddress;

        // String url = "http://www.jdrew.org/oojdrew/test.posl";
        String contents = "";

        // day of the week
        int day = t1.getDay();
        boolean weekday = true;

        if (day == 0 || day == 6) {
            weekday = false;
        }

        String dayOfWeek;

        if (weekday) {
            dayOfWeek = "day(weekday).";
        } else {
            dayOfWeek = "day(weekend).";
        }
        // full date
        Calendar cal = new GregorianCalendar();

        int year = cal.get(Calendar.YEAR);
        int month = cal.get(Calendar.MONTH) + 1;
        int day2 = cal.get(Calendar.DAY_OF_MONTH);

        String date;

        String day3 = "" + day2;

        if (day2 == 1 || day2 == 2 || day2 == 3 || day2 == 4 || day2 == 5 || day2 == 6 || day2 == 7 || day2 == 8
                || day2 == 9) {

            day3 = "0" + day2;
        }

        if (month == 10 || month == 11 || month == 12)
            date = "" + year + month + day3;
        else
            date = "" + year + "0" + month + day3;

        date = "date(" + date + ":integer).";

        System.out.println(date);

        //         String url2 = rdfAddress;
        //         HttpClient client2 = new HttpClient();
        //         GetMethod method2 = new GetMethod(url2);
        //         method2.setFollowRedirects(true);
        //         String typestr = "";
        //         // Execute the GET method
        //         int statusCode2 = client2.executeMethod(method2);
        //         if (statusCode2 != -1) {
        //            typestr = method2.getResponseBodyAsString();
        //         }
        //         System.out.println("Types: " + typestr);
        //         Types.reset();
        //         RDFSParser.parseRDFSString(typestr);

        try {
            HttpClient client = new HttpClient();
            GetMethod method = new GetMethod(url);
            method.setFollowRedirects(true);

            // Execute the GET method
            int statusCode = client.executeMethod(method);
            if (statusCode != -1) {
                contents = method.getResponseBodyAsString();
            }
        }

        catch (Exception e) {
            e.printStackTrace();
        }
        contents = contents + "\n" + time;
        contents = contents + "\n" + dayOfWeek;
        contents = contents + "\n" + date;

        BackwardReasoner br = new BackwardReasoner();
        Iterator solit = null;
        DefiniteClause dc = null;
        SymbolTable.reset();

        pp.parseDefiniteClauses(contents);

        br.loadClauses(pp.iterator());
        System.out.println("TEST");
        Iterator it = pp.iterator();
        while (it.hasNext()) {
            DefiniteClause d = (DefiniteClause) it.next();
            System.out.println("Loaded clause: " + d.toPOSLString());
        }

        br = new BackwardReasoner(br.clauses, br.oids);

        MessageParser m = new MessageParser(message);
        Element atom = null;

        try {
            atom = m.parseForContent();
        } catch (Exception e) {

            System.out.println("Invalid Message");
            // out.flush();
        }

        QueryBuilder q = new QueryBuilder(atom);
        String query = q.generateDoc();
        System.out.println("ABOUT TO INPUT THIS QUERY:" + query);
        RuleMLParser qp = new RuleMLParser();

        try {

            dc = qp.parseRuleMLQuery(query);

        }

        catch (Exception e) {
            System.out.println("Invalid Query");
            // out.flush();
        }

        // solit = br.iterativeDepthFirstSolutionIterator(dc);

        solit = br.iterativeDepthFirstSolutionIterator(dc);

        int varSize = 0;

        while (solit.hasNext()) {

            Vector data = new Vector();

            BackwardReasoner.GoalList gl = (BackwardReasoner.GoalList) solit.next();
            Hashtable varbind = gl.varBindings;

            //            javax.swing.tree.DefaultMutableTreeNode root = br.toTree();
            //            root.setAllowsChildren(true);
            //
            //            javax.swing.tree.DefaultTreeModel dtm = new DefaultTreeModel(
            //                  root);

            int i = 0;
            Object[][] rowdata = new Object[varbind.size()][2];
            varSize = varbind.size();

            Enumeration e = varbind.keys();
            while (e.hasMoreElements()) {
                Object k = e.nextElement();
                Object val = varbind.get(k);
                String ks = (String) k;
                rowdata[i][0] = ks;
                rowdata[i][1] = val;
                i++;
            }

            data.addElement(rowdata);
            String[] messages = new String[data.size()];
            MessageGenerator g = new MessageGenerator(data, varSize, messageEndpoint, m.getId(),
                    m.getProtocol(), m.getRel(), varOrder);
            messages = g.Messages2();

            String appender = "";

            URL sender = new URL(address + ":" + port);
            HttpMessage msg = new HttpMessage(sender);
            Properties props = new Properties();

            for (int i1 = 0; i1 < data.size(); i1++) {
                System.out.println(i1 + ")" + messages[i1].toString());
                props.put("text", messages[i1].toString());
                //               InputStream in = msg.sendGetMessage(props);
            }
            System.out.println("NEXT MESSAGE");
        }

        MessageGenerator g = new MessageGenerator(null, varSize, messageEndpoint, m.getId(), m.getProtocol(),
                m.getRel());
        URL sender = new URL(address + ":" + port);
        HttpMessage msg = new HttpMessage(sender);
        Properties props = new Properties();
        String finalMessage = g.finalMessage(query);
        System.out.println("******************\n" + finalMessage);
        props.put("text", finalMessage);
        //         InputStream in = msg.sendGetMessage(props);
        System.out.println("Stop_Communication");
    } catch (Exception e) {
        System.out.println("ERROR has occured : " + e.toString());

    }
}

From source file:hr.restart.util.chart.ChartXY.java

/**
 * /*  w w  w.j ava 2s  .c  om*/
 * @return String[], with all captions from the DataSet
 */
private String[] makeCaptions() {

    Hashtable hcols = new Hashtable();
    Column[] ccols = getDataSet().getColumns();
    for (int i = 0; i < ccols.length; i++) {
        //System.out.println("checking "+ccols[i].getColumnName());
        if (ccols[i].getDataType() == Variant.BIGDECIMAL) {
            hcols.put(ccols[i].getColumnName(), ccols[i].getCaption());
        }
    }

    colNamesY = (String[]) hcols.keySet().toArray(new String[0]);
    String[] colCaptionsY = new String[hcols.size()];
    for (int i = 0; i < colNamesY.length; i++) {
        colCaptionsY[i] = hcols.get(colNamesY[i]).toString();
    }

    return colCaptionsY;
}

From source file:ucar.unidata.data.storm.Diamond7StormDataSource.java

/**
 * _more_//from w ww .ja v a2  s.  c o m
 *
 * @param stormInfo _more_
 * @param waysToUse _more_
 * @param observationWay _more_
 *
 * @return _more_
 *
 * @throws Exception _more_
 */
public StormTrackCollection getTrackCollectionInner(StormInfo stormInfo, Hashtable<String, Boolean> waysToUse,
        Way observationWay) throws Exception {

    if (observationWay == null) {
        observationWay = DEFAULT_OBSERVATION_WAY;
    }

    // long                 t1              = System.currentTimeMillis();
    StormTrackCollection trackCollection = new StormTrackCollection();
    //        initializeStormData();
    List<Way> forecastWays = getForecastWays(stormInfo);

    for (Way forecastWay : forecastWays) {
        if ((waysToUse != null) && (waysToUse.size() > 0) && (waysToUse.get(forecastWay.getId()) == null)) {
            continue;
        }
        List forecastTracks = getForecastTracks(stormInfo, forecastWay);
        if (forecastTracks.size() > 0) {
            trackCollection.addTrackList(forecastTracks);
        }
    }
    StormTrack obsTrack = getObservationTrack(stormInfo, observationWay);
    //                                         (Way) forecastWays.get(0));
    if (obsTrack != null) {
        List<StormTrack> tracks = trackCollection.getTracks();
        //  for (StormTrack stk : tracks) {
        //      addDistanceError(obsTrack, stk);
        //  }
        //long t2 = System.currentTimeMillis();
        //        System.err.println("time:" + (t2 - t1));
        trackCollection.addTrack(obsTrack);
    }
    return trackCollection;
}

From source file:ffx.ui.KeywordPanel.java

/**
 * <p>/*from   w  ww . java2 s. c o m*/
 * keyOpen</p>
 *
 * @param newKeyFile a {@link java.io.File} object.
 * @return a boolean.
 */
public boolean keyOpen(File newKeyFile) {
    if (newKeyFile != null && newKeyFile.exists() && newKeyFile.canRead()) {
        Hashtable<String, Keyword> newKeys = KeyFilter.open(newKeyFile);
        if (newKeys != null && newKeys.size() > 0) {
            if (currentSystem != null) {
                currentSystem.setKeyFile(currentKeyFile);
                currentSystem.setKeywords(currentKeys);
            }
            loadActive(currentSystem, newKeys, newKeyFile);
            return true;
        }
    }
    return false;
}

From source file:com.epic.framework.implementation.tapjoy.TapjoyURLConnection.java

/**
 * Performs a network request call using HTTP POST to the specified URL and parameters.
 * /*from  ww w  .  ja v  a 2 s .com*/
 * @param url                     The URL to connect to.
 * @param params                  POST parameters in key/value format.
 * @param paramsData               Any additional POST parameters in key/value format.
 * @return                         Response from the server.
 */
public String connectToURLwithPOST(String url, Hashtable<String, String> params,
        Hashtable<String, String> paramsData) {
    String httpResponse = null;

    try {
        String requestURL = url;

        // Replaces all spaces.
        requestURL = requestURL.replaceAll(" ", "%20");

        TapjoyLog.i(TAPJOY_URL_CONNECTION, "baseURL: " + url);
        TapjoyLog.i(TAPJOY_URL_CONNECTION, "requestURL: " + requestURL);

        HttpPost httpPost = new HttpPost(requestURL);

        List<NameValuePair> pairs = new ArrayList<NameValuePair>();

        Set<Entry<String, String>> entries = params.entrySet();
        Iterator<Entry<String, String>> iterator = entries.iterator();

        while (iterator.hasNext()) {
            Entry<String, String> item = iterator.next();
            pairs.add(new BasicNameValuePair(item.getKey(), item.getValue()));

            TapjoyLog.i(TAPJOY_URL_CONNECTION,
                    "key: " + item.getKey() + ", value: " + Uri.encode(item.getValue()));
        }

        if (paramsData != null && paramsData.size() > 0) {
            entries = paramsData.entrySet();
            iterator = entries.iterator();

            while (iterator.hasNext()) {
                Entry<String, String> item = iterator.next();
                pairs.add(new BasicNameValuePair("data[" + item.getKey() + "]", item.getValue()));

                TapjoyLog.i(TAPJOY_URL_CONNECTION,
                        "key: " + item.getKey() + ", value: " + Uri.encode(item.getValue()));
            }
        }

        httpPost.setEntity(new UrlEncodedFormEntity(pairs));

        TapjoyLog.i(TAPJOY_URL_CONNECTION, "HTTP POST: " + httpPost.toString());

        // Create a HttpParams object so we can set our timeout times.
        HttpParams httpParameters = new BasicHttpParams();

        // Time to wait to establish initial connection.
        HttpConnectionParams.setConnectionTimeout(httpParameters, 15000);

        // Time to wait for incoming data.
        HttpConnectionParams.setSoTimeout(httpParameters, 30000);

        // Create a http client with out timeout settings.
        HttpClient client = new DefaultHttpClient(httpParameters);

        HttpResponse response = client.execute(httpPost);
        HttpEntity entity = response.getEntity();

        httpResponse = EntityUtils.toString(entity);

        TapjoyLog.i(TAPJOY_URL_CONNECTION, "--------------------");
        TapjoyLog.i(TAPJOY_URL_CONNECTION, "response status: " + response.getStatusLine().getStatusCode());
        TapjoyLog.i(TAPJOY_URL_CONNECTION, "response size: " + httpResponse.length());
        TapjoyLog.i(TAPJOY_URL_CONNECTION, "response: ");
        TapjoyLog.i(TAPJOY_URL_CONNECTION, "" + httpResponse);
        TapjoyLog.i(TAPJOY_URL_CONNECTION, "--------------------");
    } catch (Exception e) {
        TapjoyLog.e(TAPJOY_URL_CONNECTION, "Exception: " + e.toString());
    }

    return httpResponse;
}

From source file:org.openflexo.foundation.ie.IEWOComponent.java

public Hashtable<IEObject, Hashtable<String, String>> getLocalizableObjects() {
    Hashtable<IEObject, Hashtable<String, String>> reply = new Hashtable<IEObject, Hashtable<String, String>>();
    Enumeration<IObject> en = getAllEmbeddedIEObjects(true).elements();
    while (en.hasMoreElements()) {
        IObject object = en.nextElement();
        if (object instanceof IEWidget) {
            Hashtable<String, String> props = ((IEWidget) object).getLocalizedProperties();
            if (props.size() > 0) {
                reply.put((IEWidget) object, props);
            }/*from  w w w  . ja  v a  2  s .  com*/
        }
    }
    return reply;
}

From source file:org.hdiv.filter.ValidatorHelperRequest.java

/**
 * It validates the parameters of an init page because our application can receive requests that require validation
 * but don't have any HDIV state. So, despite being init pages, editable data validation must be done.
 * //from w w w .jav  a 2  s.  c o  m
 * @param request
 *            HttpServletRequest to validate
 * @param target
 *            Part of the url that represents the target action
 * @return valid result if the values of the editable parameters pass the validations defined in hdiv-config.xml.
 *         False otherwise.
 * @since HDIV 1.1.2
 */
public ValidatorHelperResult validateStartPageParameters(HttpServletRequest request, String target) {

    if (this.hdivConfig.existValidations()) {

        Hashtable unauthorizedEditableParameters = new Hashtable();

        Enumeration parameters = request.getParameterNames();
        while (parameters.hasMoreElements()) {

            String parameter = (String) parameters.nextElement();
            String[] values = request.getParameterValues(parameter);

            this.validateEditableParameter(request, target, parameter, values, "text",
                    unauthorizedEditableParameters);

        }

        if (unauthorizedEditableParameters.size() > 0) {

            return this.processValidateParameterErrors(request, unauthorizedEditableParameters);
        }
    }
    return ValidatorHelperResult.VALID;
}

From source file:org.panlab.tgw.resources.PTMResource.java

@POST // The Java method will produce content identified by the MIME Media
// type "text/plain"
@Produces("text/xml")
@Consumes("application/x-www-form-urlencoded")
public String postResource(@PathParam("ptmid") String ptmid, @PathParam("resourceid") String resourceid,
        String content) {//  ww w. j  a  va 2 s  .  c  o m
    log.info("POST (" + j + ") /" + ptmid + "/" + resourceid + " " + content);
    try {

        XMLElement tempTop = XMLUtil.getTopElement(content);
        if (org.panlab.tgw.App.getStatus(ptmid) != 0) {
            String type = tempTop.m_name;
            return createError(org.panlab.tgw.App.statusText(org.panlab.tgw.App.getStatus(ptmid)), resourceid,
                    type);
        }
        if (org.panlab.tgw.App.getRAStatus(resourceid) != 0) {
            String type = tempTop.m_name;
            return createError("RA: " + resourceid + " has reported an error", resourceid, type);
        }
        String context = XMLUtil.getXMLElement(content, "context");
        String vctid = XMLUtil.getXMLElement(context, "vctId");
        content = XMLUtil.getXMLElement(content, "configuration");
        tempTop.m_value = content;
        content = tempTop.toString();
        if (tempTop.m_name.equalsIgnoreCase("vlan")) {
            Object[] tempList = XMLUtil.getElements(content);
            if (tempList != null && tempList.length > 0) {
                String tempid = ((XMLElement) (tempList[0])).m_value;
                tempid = tempid.substring(0, tempid.indexOf("."));
                ptmid = tempid;
                resourceid = ptmid + ".top-0";
                log.info("changed to: " + ptmid + "/" + resourceid);
            }
        }
        log.info("POST (" + j + ") /" + ptmid + "/" + resourceid + " vctID:" + vctid + " " + content);
        if (ptmid.equalsIgnoreCase("share")) {
            T1ServiceLocator l = new T1ServiceLocator();
            T1SoapBindingStub stub;
            XMLElement top = XMLUtil.getTopElement(content);
            Object elements[] = XMLUtil.getElements(content);
            log.info(top.m_name);
            if (top.m_name.equalsIgnoreCase("vpn")) {
                int vpnsize = elements.length;
                Hashtable<String, String> igwSettings = new Hashtable<String, String>();
                for (int i = 0; i < elements.length; i++) {
                    XMLElement temp = (XMLElement) elements[i];
                    log.info(temp.toString());
                    if (temp.m_attribute != null) {
                        String ptm = temp.m_value.substring(0, temp.m_value.indexOf("."));
                        stub = (T1SoapBindingStub) (l.getT1((URL) (org.panlab.tgw.App.ptm_indexes.get(ptm))));
                        ProvisioningResponse ref;
                        ref = stub.query(vctid, temp.m_value, "<connectivity></connectivity>", null);
                        log.info(ref.getConfig_data());
                        igwSettings.put(temp.m_value, ref.getConfig_data());
                    }
                }
                String vpn_id = "";
                Enumeration<String> en = igwSettings.keys();
                log.info("igwSettings " + igwSettings.size());
                while (en.hasMoreElements()) {
                    String current = en.nextElement();
                    String currentdetails = igwSettings.get(current);
                    log.info(current + ": " + currentdetails);
                    while (en.hasMoreElements()) {
                        String other = en.nextElement();
                        String otherdetails = igwSettings.get(other);

                        String ptm = current.substring(0, current.indexOf("."));
                        vpn_id += current;
                        stub = (T1SoapBindingStub) (l.getT1((URL) (org.panlab.tgw.App.ptm_indexes.get(ptm))));
                        ProvisioningResponse ref;
                        ref = stub.update(vctid, current, otherdetails, null);
                        log.info(ref.getStatus_code());
                        ptm = other.substring(0, other.indexOf("."));
                        vpn_id += other;
                        stub = (T1SoapBindingStub) (l.getT1((URL) (org.panlab.tgw.App.ptm_indexes.get(ptm))));
                        ref = stub.update(vctid, other, currentdetails, null);
                        log.info(ref.getStatus_code());

                    }
                    igwSettings.remove(current);
                    log.info("igwSettings " + igwSettings.size());
                    en = igwSettings.keys();
                }
                log.info("VPN_ID: " + vpn_id);
                return createOK(vpn_id, "vpn");
            } else
                return createError("Share ptm expects only vlan or vpn. Check VCT design", resourceid,
                        top.m_name);

        } else {
            T1ServiceLocator l = new T1ServiceLocator();
            T1SoapBindingStub stub;
            XMLElement top = XMLUtil.getTopElement(content);
            Object elements[] = XMLUtil.getElements(content);
            String conf = "";
            Vector<String> referencedRAIDs = new Vector<String>();
            for (int i = 0; i < elements.length; i++) {
                XMLElement temp = (XMLElement) elements[i];
                log.info(temp.toString());
                if (temp.m_attributes.containsKey("type")
                        && temp.m_attributes.get("type").equalsIgnoreCase("\"reference\"")) {
                    if (!(temp.m_value.equalsIgnoreCase(""))) {
                        referencedRAIDs.add(temp.m_value);
                        String ptm = temp.m_value.substring(0, temp.m_value.indexOf("."));
                        stub = (T1SoapBindingStub) (l.getT1((URL) (org.panlab.tgw.App.ptm_indexes.get(ptm))));
                        ProvisioningResponse ref;
                        if (resourceid.endsWith("top-0") && top.m_name.equalsIgnoreCase("vlan"))
                            ref = stub.query(vctid, temp.m_value, "<connectivity></connectivity>", null);
                        else
                            ref = stub.query(vctid, temp.m_value, "<reference></reference>", null);

                        log.info(temp.m_value + " ref data: " + ref.getConfig_data());
                        if (resourceid.endsWith("top-0") && top.m_name.equalsIgnoreCase("vlan"))
                            elements[i] = new XMLElement("item-" + i, null, null, ref.getConfig_data());
                        else
                            elements[i] = new XMLElement(temp.m_name, null, null, ref.getConfig_data());
                    }
                }
                if (temp.m_value != null)
                    conf += elements[i].toString();
            }

            ProvisioningResponse res = null;
            if (top.m_attributes.containsKey("action")
                    && top.m_attributes.get("action").equalsIgnoreCase("\"update\"")) {
                log.info(top.m_attributes.get("action"));
                log.info("SENDING: " + conf);
                stub = (T1SoapBindingStub) (l.getT1((URL) (org.panlab.tgw.App.ptm_indexes.get(ptmid))));
                if (top.m_attributes.containsKey("mode")
                        && top.m_attributes.get("mode").equalsIgnoreCase("\"asynchronous\""))
                    res = stub.update(vctid, resourceid, conf,
                            "https://" + System.getProperty("publicIP") + ":8070/axis/services/TeagleGW");
                else
                    res = stub.update(vctid, resourceid, conf, null);
                log.info("https://" + java.net.Inet4Address.getLocalHost() + ":8070/axis/services/TeagleGW");
            } else {
                conf = "<" + top.m_name + ">" + conf + "</" + top.m_name + ">";
                log.info("SENDING: " + conf);
                stub = (T1SoapBindingStub) (l.getT1((URL) (org.panlab.tgw.App.ptm_indexes.get(ptmid))));
                //log.info(vctid+" "+resourceid+" "+conf);
                if (top.m_attributes.containsKey("mode")
                        && top.m_attributes.get("mode").equalsIgnoreCase("\"asynchronous\""))
                    res = stub.create(vctid, resourceid, conf,
                            "https://62.103.214.70:8070/axis/services/TeagleGW");
                else
                    res = stub.create(vctid, resourceid, conf, null);
                if (res != null) {
                    if (!(res.getConfig_data().contains("FAIL")))
                        resourceid = XMLUtil.getXMLElement(res.getConfig_data(), "uuid");
                    else
                        resourceid = res.getConfig_data();
                }
            }
            if (res != null) {
                int referencedSize = referencedRAIDs.size();
                if (!(top.m_attributes.containsKey("mode")) || (top.m_attributes.containsKey("mode")
                        && !(top.m_attributes.get("mode").equalsIgnoreCase("\"asynchronous\""))))
                    if (referencedSize > 0) {
                        stub = (T1SoapBindingStub) (l.getT1((URL) (org.panlab.tgw.App.ptm_indexes.get(ptmid))));
                        ProvisioningResponse ref;
                        ref = stub.query(vctid, resourceid, "<reference></reference>", null);
                        conf = "<" + top.m_name + ">" + ref.getConfig_data() + "</" + top.m_name + ">";
                        log.info("The following data have to be sent to all referenced resources by "
                                + resourceid + " :" + conf);
                        if (!org.panlab.tgw.App.CIRCULAR_REFERENCE) {
                            log.info("reverse reference disabled");
                            referencedSize = 0;
                        }
                        for (int k = 0; k < referencedSize; k++) {
                            String temp = referencedRAIDs.remove(0);
                            if (temp != null) {
                                log.info("Updating " + temp);
                                log.info(conf);
                                String ptm = temp.substring(0, temp.indexOf("."));
                                stub = (T1SoapBindingStub) (l
                                        .getT1((URL) (org.panlab.tgw.App.ptm_indexes.get(ptm))));
                                ProvisioningResponse update;
                                update = stub.update(vctid, temp, conf, null);
                                log.info("Updated " + temp + " :" + update.getStatus_code());
                            }
                        }
                    }
                //String type = resourceid.substring(resourceid.lastIndexOf(".")+1,resourceid.lastIndexOf("-"));
                String response = "";
                if (top.m_attributes.containsKey("action")
                        && top.m_attributes.get("action").equalsIgnoreCase("\"update\"")) {
                    log.info("RETURNING conf: " + res.getConfig_data());
                    log.info("RETURNING status: " + res.getStatus_code());
                    log.info("RETURNING id: " + res.getRequest_id());
                    response = res.getStatus_code();
                } else {
                    log.info("RETURNING conf: " + res.getConfig_data());
                    log.info("RETURNING status: " + res.getStatus_code());
                    log.info("RETURNING id: " + res.getRequest_id());
                    response = res.getConfig_data();
                }
                if (top.m_attributes.containsKey("mode")
                        && top.m_attributes.get("mode").equalsIgnoreCase("\"asynchronous\"")) {
                    App.async_reqs.put(res.getRequest_id(), new Notification(res.getRequest_id(), "", "", vctid,
                            "RETURN_STATUS", "MESSAGE", "", ptmid, top.m_name, referencedRAIDs));

                    return createOK(null, top.m_name/*type*/, res.getRequest_id());
                } else {
                    m_ids.put(resourceid, vctid);
                    return createOK(resourceid, top.m_name/*type*/);
                }
            } else {
                //String type = resourceid.substring(resourceid.lastIndexOf(".")+1,resourceid.lastIndexOf("-"));
                return createError("Null response from PTM", resourceid, top.m_name/*type*/);
            }

        }
    } catch (Exception error) {
        //error.printStackTrace();
        String type = resourceid.substring(resourceid.lastIndexOf(".") + 1, resourceid.lastIndexOf("-"));
        log.info("RETURNING: " + error.getMessage());
        return createError(error.getMessage(), resourceid, type);
    }
}