Example usage for java.lang String value

List of usage examples for java.lang String value

Introduction

In this page you can find the example usage for java.lang String value.

Prototype

null value

To view the source code for java.lang String value.

Click Source Link

Document

The value is used for character storage.

Usage

From source file:com.npower.dm.bootstrap.BaseBootstrapService.java

/**
 * Create NAP Def setting//from w  w w  .j av  a2 s  . c  o m
 * @return setting
 */
protected NAPDefElement createNAPDef(Properties profile) {
    String napDefNapID = this.getProperty(profile, "napdef_napid");
    String napDefName = this.getProperty(profile, "napdef_name");
    String napDefAddr = this.getProperty(profile, "napdef_nap_addr");
    if (StringUtils.isEmpty(napDefNapID) || StringUtils.isEmpty(napDefName)
            || StringUtils.isEmpty(napDefAddr)) {
        return null;
    }
    NAPDefElement napDefElement = new NAPDefElement(napDefNapID, napDefName, napDefAddr);
    napDefElement.addBearer(Bearer.value(this.getProperty(profile, "napdef_bearer")));
    napDefElement.setNapAddrType(NAPAddrType.value(this.getProperty(profile, "napdef_apn")));

    String authType = this.getProperty(profile, "napdef_nap_auth_type");
    String authName = this.getProperty(profile, "napdef_nap_auth_name");
    String authSecret = this.getProperty(profile, "napdef_nap_auth_secret");
    if (!StringUtils.isEmpty(authType) && !StringUtils.isEmpty(authName)) {
        NAPAuthInfoElement napAuthInfo = new NAPAuthInfoElement(AuthType.value(authType));
        napAuthInfo.setAuthName(authName);
        napAuthInfo.setAuthSecret(authSecret);
        napDefElement.addNapAuthInfo(napAuthInfo);
    }
    return napDefElement;
}

From source file:com.npower.cp.convertor.AbstractProfileConvertor.java

/**
 * Create a NAP OTA Settings //w  ww  .  j ava2  s .  co m
 * @param assignment
 * @return
 */
protected NAPDefElement convertNAPProfile(ProfileConfig profile) throws DMException {
    String profileName = profile.getName();
    String napAPN = this.getAttributeValue(profile, "NAP-ADDRESS");
    String napBearer = this.getAttributeValue(profile, "BEARER");
    String id = getNapID(profile);

    NAPDefElement napDefElement = new NAPDefElement(id, profileName, napAPN);
    napDefElement.addBearer(Bearer.value(napBearer));
    napDefElement.setNapAddrType(NAPAddrType.APN);

    String authName = this.getAttributeValue(profile, "AUTHNAME");
    String authType = this.getAttributeValue(profile, "AUTHTYPE");
    String authSecret = this.getAttributeValue(profile, "AUTHSECRET");
    if (StringUtils.isNotEmpty(authName)) {
        NAPAuthInfoElement napAuthInfo = new NAPAuthInfoElement(AuthType.value(authType));
        napAuthInfo.setAuthName(authName);
        napAuthInfo.setAuthSecret(authSecret);
        napDefElement.addNapAuthInfo(napAuthInfo);
    }
    return napDefElement;
}

From source file:functionaltests.RestSmartProxyTest.java

@Test(timeout = TEN_MINUTES)
public void testInErrorEventsReception() throws Exception {
    TaskFlowJob job = createInErrorJob();

    final Semaphore semaphore = new Semaphore(0);
    printJobXmlRepresentation(job);/*from   w  w  w .j a va 2  s  . com*/

    final MutableBoolean taskHasBeenInError = new MutableBoolean(false);
    final MutableBoolean restartedFromErrorEventReceived = new MutableBoolean(false);

    SchedulerEventListenerExtended listener = new SchedulerEventListenerExtended() {

        @Override
        public void schedulerStateUpdatedEvent(SchedulerEvent eventType) {
            System.out.println("RestSmartProxyTest.schedulerStateUpdatedEvent " + eventType);
        }

        @Override
        public void jobSubmittedEvent(JobState job) {
            System.out.println("RestSmartProxyTest.jobSubmittedEvent");
        }

        @Override
        public void jobStateUpdatedEvent(NotificationData<JobInfo> notification) {
            JobStatus status = notification.getData().getStatus();

            System.out.println("RestSmartProxyTest.jobStateUpdatedEvent, eventType="
                    + notification.getEventType() + ", jobStatus=" + status);

            if (notification.getEventType() == SchedulerEvent.JOB_RESTARTED_FROM_ERROR) {
                restartedFromErrorEventReceived.setTrue();
            }

            if (status == JobStatus.IN_ERROR) {
                semaphore.release();
            }
        }

        @Override
        public void taskStateUpdatedEvent(NotificationData<TaskInfo> notification) {
            TaskStatus status = notification.getData().getStatus();
            System.out.println("RestSmartProxyTest.taskStateUpdatedEvent, taskStatus=" + status);

            if (status == TaskStatus.WAITING_ON_ERROR || status == TaskStatus.IN_ERROR) { // IN_ERROR previously
                taskHasBeenInError.setTrue();
            }
        }

        @Override
        public void usersUpdatedEvent(NotificationData<UserIdentification> notification) {
            System.out.println("RestSmartProxyTest.usersUpdatedEvent " + notification.getData());
        }

        @Override
        public void pullDataFinished(String jobId, String taskName, String localFolderPath) {
            System.out.println("RestSmartProxyTest.pullDataFinished");
        }

        @Override
        public void pullDataFailed(String jobId, String taskName, String remoteFolder_URL, Throwable t) {
            System.out.println("RestSmartProxyTest.pullDataFailed");
        }

        @Override
        public void jobUpdatedFullDataEvent(JobState job) {
            System.out.println("RestSmartProxyTest.jobUpdatedFullDataEvent");

        }
    };

    restSmartProxy.addEventListener(listener);

    JobId jobId = restSmartProxy.submit(job, inputLocalFolder.getAbsolutePath(), pushUrl,
            outputLocalFolder.getAbsolutePath(), pullUrl, false, false);

    // the next line blocks until jobStateUpdatedEvent is called on the
    // listener
    // with job status set to IN_ERROR
    semaphore.acquire();

    String jobIdAsString = jobId.value();

    System.out.println("Restarting all In-Error tasks");
    restSmartProxy.restartAllInErrorTasks(jobIdAsString);

    assertThat(restartedFromErrorEventReceived.booleanValue()).isTrue();
    assertThat(taskHasBeenInError.booleanValue()).isTrue();

}

From source file:org.apache.any23.extractor.html.HCardExtractor.java

private void fixIncludes(HTMLDocument document, Node node, IssueReport report) {
    NamedNodeMap attributes = node.getAttributes();
    // header case test 32
    if ("TD".equals(node.getNodeName()) && (null != attributes.getNamedItem("headers"))) {
        String id = attributes.getNamedItem("headers").getNodeValue();
        Node header = document.findNodeById(id);
        if (null != header) {
            node.appendChild(header.cloneNode(true));
            attributes.removeNamedItem("headers");
        }//from   w w w .  ja v  a 2  s .  c  om
    }

    // include pattern, test 31
    for (Node current : DomUtils.findAllByAttributeName(document.getDocument(), "class")) {
        if (!DomUtils.hasClassName(current, "include"))
            continue;
        // we have to remove the field soon to avoid infinite loops
        // no null check, we know it's there or we won't be in the loop
        current.getAttributes().removeNamedItem("class");
        ArrayList<TextField> res = new ArrayList<TextField>();
        HTMLDocument.readUrlField(res, current);
        TextField id = res.get(0);
        if (null == id)
            continue;
        TextField refId = new TextField(StringUtils.substringAfter(id.value(), "#"), id.source());
        Node included = document.findNodeById(refId.value());
        if (null == included)
            continue;
        if (DomUtils.isAncestorOf(included, current)) {
            final int[] nodeLocation = DomUtils.getNodeLocation(current);
            report.notifyIssue(IssueReport.IssueLevel.Warning,
                    "Current node tries to include an ancestor node.", nodeLocation[0], nodeLocation[1]);
            continue;
        }
        current.appendChild(included.cloneNode(true));
    }
}

From source file:org.apache.axis2.jaxws.description.impl.OperationDescriptionImpl.java

private void setFaultActions(AxisOperation newAxisOperation, String operationName, String targetNS,
        String portTypeName) {//from   ww w  .  j  av  a 2s  .co m
    // Walk the fault information
    FaultDescription[] faultDescs = getFaultDescriptions();

    //Generate fault actions according to the Default Action Pattern.
    if (faultDescs != null) {
        for (FaultDescription faultDesc : faultDescs) {

            AxisMessage faultMessage = new AxisMessage();
            String faultName = faultDesc.getName();

            if (faultName == null || faultName.equals("")) {
                faultName = faultDesc.getExceptionClassName();
                // Remove package name to get just class name
                faultName = faultName.substring((faultName.lastIndexOf('.')) + 1);
            }

            faultMessage.setName(faultName);
            if (log.isDebugEnabled()) {
                log.debug("Set faultName = " + faultName + " for faultMessage = " + faultMessage
                        + " and faultDesc = " + faultDesc);
            }

            String faultAction = WSDL11ActionHelper.getFaultActionFromStringInformation(targetNS, portTypeName,
                    operationName, faultMessage.getName());

            if (log.isDebugEnabled()) {
                log.debug("Default faultAction = " + faultAction);
            }

            newAxisOperation.addFaultAction(faultDesc.getExceptionClassName(), faultAction);
            newAxisOperation.setFaultMessages(faultMessage);
        }
    }

    //Override the fault actions based on any FaultAction annotations that are defined.
    FaultAction[] faultActions = getFaultActions();

    if (faultActions != null) {
        for (FaultAction faultAction : faultActions) {

            String className = null;

            if (faultAction instanceof FaultActionAnnot
                    && ((FaultActionAnnot) faultAction).classNameString() != null) {
                className = ((FaultActionAnnot) faultAction).classNameString();
            } else if (faultAction.className() != null) {
                className = faultAction.className().getName();
            }

            if (className != null) {
                if (log.isDebugEnabled()) {
                    log.debug("Looking for FaultDescription for class: " + className
                            + " from @FaultAction annotation");
                }
                FaultDescription faultDesc = resolveFaultByExceptionName(className);
                if (faultDesc != null) {
                    String faultActionString = faultAction.value();
                    if (log.isDebugEnabled()) {
                        log.debug("faultAction value = " + faultActionString);
                    }

                    if (faultActionString != null && !faultActionString.equals("")) {
                        newAxisOperation.addFaultAction(className, faultActionString);
                    }
                }
            }
        }
    }
}

From source file:org.deri.any23.extractor.html.HCardExtractor.java

private void fixIncludes(HTMLDocument document, Node node) {
    NamedNodeMap attributes = node.getAttributes();
    // header case test 32
    if ("TD".equals(node.getNodeName()) && (null != attributes.getNamedItem("headers"))) {
        String id = attributes.getNamedItem("headers").getNodeValue();
        Node header = document.findNodeById(id);
        if (null != header) {
            node.appendChild(header.cloneNode(true));
            attributes.removeNamedItem("headers");
        }//from  w ww  .j av a  2  s.co m
    }
    // include pattern, test 31

    for (Node current : document.findAll("//*[@class]")) {
        if (!DomUtils.hasClassName(current, "include"))
            continue;
        // we have to remove the field soon to avoid infinite loops
        // no null check, we know it's there or we won't be in the loop
        current.getAttributes().removeNamedItem("class");
        ArrayList<TextField> res = new ArrayList<TextField>();
        HTMLDocument.readUrlField(res, current);
        TextField id = res.get(0);
        if (null == id)
            continue;
        id = new TextField(StringUtils.substringAfter(id.value(), "#"), id.source());
        Node included = document.findNodeById(id.value());
        if (null == included)
            continue;
        current.appendChild(included.cloneNode(true));
    }
}