Example usage for java.util Collections unmodifiableSet

List of usage examples for java.util Collections unmodifiableSet

Introduction

In this page you can find the example usage for java.util Collections unmodifiableSet.

Prototype

public static <T> Set<T> unmodifiableSet(Set<? extends T> s) 

Source Link

Document

Returns an unmodifiable view of the specified set.

Usage

From source file:eu.europa.esig.dss.pdf.pdfbox.PdfBoxCMSInfo.java

@Override
public Set<PdfSignatureOrDocTimestampInfo> getOuterSignatures() {
    return Collections.unmodifiableSet(outerSignatures);
}

From source file:com.sysunite.weaver.nifi.CreateValueProperty.java

@Override
protected void init(final ProcessorInitializationContext context) {
    final List<PropertyDescriptor> descriptors = new ArrayList<PropertyDescriptor>();
    descriptors.add(PROP_NODE);/*  w  w  w . j a va 2  s. com*/
    descriptors.add(PROP_NODE_ATTRIBUTE);
    descriptors.add(PROP_CHILDNODE);
    descriptors.add(PROP_CHILDNODE_ATTRIBUTE);
    this.descriptors = Collections.unmodifiableList(descriptors);

    final Set<Relationship> relationships = new HashSet<Relationship>();
    relationships.add(MY_RELATIONSHIP);
    this.relationships = Collections.unmodifiableSet(relationships);
}

From source file:com.ning.maven.plugins.duplicatefinder.ClasspathDescriptor.java

public Set getElementsHavingClass(String className) {
    Set elements = (Set) classesWithElements.get(className);

    return elements == null ? null : Collections.unmodifiableSet(elements);
}

From source file:org.socraticgrid.hl7.ucs.nifi.processor.GetSMS.java

@Override
protected void init(final ProcessorInitializationContext context) {
    final List<PropertyDescriptor> properties = new ArrayList<>();
    properties.add(SMS_CONTROLLER_SERVICE);
    properties.add(SMS_SERVER_URL);
    properties.add(SMS_SERVER_ACCOUNT_KEY);
    properties.add(SMS_MESSAGE_COUNT);//from   w  ww. j  ava2s  .  co  m

    this.properties = Collections.unmodifiableList(properties);

    final Set<Relationship> relationships = new HashSet<>();
    relationships.add(REL_SMS_RECEIVED);
    relationships.add(REL_SMS_FAILURE);
    this.relationships = Collections.unmodifiableSet(relationships);
}

From source file:org.web4thejob.web.panel.DefaultEntityHierarchyPanel.java

@Override
public Set<CommandEnum> getSupportedCommands() {
    Set<CommandEnum> supported = new HashSet<CommandEnum>(super.getSupportedCommands());
    supported.add(CommandEnum.REFRESH);//from w  w  w. j av  a2s . c o  m
    supported.add(CommandEnum.ADDNEW);
    supported.add(CommandEnum.UPDATE);
    supported.add(CommandEnum.DELETE);
    supported.add(CommandEnum.MOVE_UP);
    supported.add(CommandEnum.MOVE_DOWN);
    return Collections.unmodifiableSet(supported);
}

From source file:com.kloudtek.kloudmake.service.filestore.FileStore.java

public synchronized Collection<String> getLocations() {
    return Collections.unmodifiableSet(locations);
}

From source file:dk.netarkivet.common.utils.archive.HeritrixArchiveHeaderWrapper.java

@Override
public Set<String> getHeaderFieldKeys() {
    return Collections.unmodifiableSet(headerFields.keySet());
}

From source file:nu.yona.server.goals.service.ActivityCategoryDto.java

@JsonView(AdminView.class)
public Set<String> getSmoothwallCategories() {
    return Collections.unmodifiableSet(smoothwallCategories);
}

From source file:com.jmeter.alfresco.http.upload.UploadDocumentTestHttp.java

@Override
public SampleResult runTest(final JavaSamplerContext context) {

    LOG.info("runTest() invoked..");

    final String serverAddress = context.getParameter(Constants.SERVER);
    final String uploadUri = serverAddress + ConfigReader.getProperty(Constants.UPLOAD_PATH);
    final String authURI = serverAddress + ConfigReader.getProperty(Constants.LOGIN_PATH);
    final String username = context.getParameter(Constants.USERNAME);
    final String password = context.getParameter(Constants.PASSWORD);
    final String inputUri = context.getParameter(Constants.INPUT_PATH);
    final String siteID = context.getParameter(Constants.SITE_ID);
    final String uploadDir = context.getParameter(Constants.UPLOAD_DIR);

    final HttpUtils httpUtils = new HttpUtils();
    final TaskTimer taskTimer = new TaskTimer();

    String authTicket = Constants.EMPTY;
    try {//from w w  w  . j  ava2 s  .  co m
        authTicket = httpUtils.getAuthTicket(authURI, username, password);
    } catch (IOException ioex) {
        LOG.error("IOException occured while getting the auth ticket: ", ioex);
    }

    final SampleResult result = new SampleResult();
    try {
        LOG.info("Starting load test..");
        final File fileObject = new File(inputUri);
        result.sampleStart(); // Record the start time of a sample
        final StringBuffer responseBody = new StringBuffer();

        //starting the task timer
        taskTimer.startTimer();
        LOG.info("Upload timer started for ' " + inputUri + " ' ::- " + taskTimer.getStartTime() + " ms.");

        //if uri is a directory the upload all files..
        if (fileObject.isDirectory()) {
            final Set<File> setOfUris = Collections.unmodifiableSet(DirectoryTraverser.getFileUris(fileObject));
            for (final Iterator<File> iterator = setOfUris.iterator(); iterator.hasNext();) {
                final File fileObj = iterator.next();
                //call document upload
                if (fileObj.isFile()) {
                    responseBody.append(
                            httpUtils.documentUpload(fileObj, authTicket, uploadUri, siteID, uploadDir));
                    responseBody.append(Constants.BR);
                }
            }
        } else {
            responseBody.append(httpUtils.documentUpload(fileObject, authTicket, uploadUri, siteID, uploadDir));
        }

        //ending the task timer
        taskTimer.endTimer();
        LOG.info("Total time spent during upload for ' " + inputUri + " ' ::- " + taskTimer.getTotalTime()
                + " ms.");

        result.sampleEnd();// Record the end time of a sample and calculate the elapsed time
        LOG.info("Ending load test..");
        result.setResponseMessage(responseBody.toString());
        result.setSuccessful(true);
        result.setResponseCodeOK();
        result.setContentType(Constants.MIME_TYPE);
    } catch (Exception excp) {
        //ending the task timer
        taskTimer.endTimer();
        LOG.info("Total time spent during upload for ' " + inputUri + " ' , when exception occured::- "
                + taskTimer.getTotalTime() + " ms.");

        result.sampleEnd(); // Record the end time of a sample and calculate the elapsed time
        result.setSuccessful(false);
        result.setResponseMessage("Exception occured while running test: " + excp);
        // get stack trace as a String to return as document data
        final StringWriter stringWriter = new StringWriter();
        excp.printStackTrace(new PrintWriter(stringWriter));
        result.setResponseData(stringWriter.toString(), Constants.ENCODING);
        result.setDataType(org.apache.jmeter.samplers.SampleResult.TEXT);
        result.setResponseCode(Constants.SERVER_ERR);
        LOG.error("Exception occured while running test: ", excp);
    }
    return result;
}

From source file:fr.gael.dhus.olingo.v1.map.AbstractFunctionalMap.java

@Override
public Set<K> keySet() {
    return Collections.unmodifiableSet(sourceMap.keySet());
}