当前位置: 首页>>代码示例>>Java>>正文


Java UUIDGenerator类代码示例

本文整理汇总了Java中org.apache.axiom.om.util.UUIDGenerator的典型用法代码示例。如果您正苦于以下问题:Java UUIDGenerator类的具体用法?Java UUIDGenerator怎么用?Java UUIDGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UUIDGenerator类属于org.apache.axiom.om.util包,在下文中一共展示了UUIDGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createMessageContext

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
/**
 * Create a new axis MessageContext for an incoming message through this transport
 * @return the newly created message context
 */
public MessageContext createMessageContext() {
    MessageContext msgCtx = new MessageContext();
    msgCtx.setConfigurationContext(cfgCtx);

    msgCtx.setIncomingTransportName(getTransportName());
    msgCtx.setTransportOut(transportOut);
    msgCtx.setTransportIn(transportIn);
    msgCtx.setServerSide(true);
    msgCtx.setMessageID(UUIDGenerator.getUUID());

    // There is a discrepency in what I thought, Axis2 spawns a nes threads to
    // send a message is this is TRUE - and I want it to be the other way
    msgCtx.setProperty(MessageContext.CLIENT_API_NON_BLOCKING, Boolean.valueOf(!isNonBlocking));

    // are these relevant?
    //msgCtx.setServiceGroupContextId(UUIDGenerator.getUUID());
    // this is required to support Sandesha 2
    //msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL,
    //        new HttpCoreRequestResponseTransport(msgContext));

    return msgCtx;
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:27,代码来源:AbstractTransportListener.java

示例2: testSetPropertyInServiceGroupContext2

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
public void testSetPropertyInServiceGroupContext2() throws Exception {
    if (!canRunTests) {
        return;
    }

    String sgcID = UUIDGenerator.getUUID();

    ServiceGroupContext serviceGroupContext1 =
            configurationContext1.createServiceGroupContext(serviceGroup1);
    serviceGroupContext1.setId(sgcID);
    configurationContext1.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext1);
    assertNotNull(serviceGroupContext1);

    ServiceGroupContext serviceGroupContext2 =
            configurationContext2.createServiceGroupContext(serviceGroup2);
    serviceGroupContext2.setId(sgcID);
    configurationContext2.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext2);
    assertNotNull(serviceGroupContext2);

    String key1 = "sgCtxKey";
    String val1 = "sgCtxVal1";
    serviceGroupContext1.setProperty(key1, val1);
    ctxMan1.updateContext(serviceGroupContext1);

    assertEquals(val1, serviceGroupContext2.getProperty(key1));
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:27,代码来源:ContextReplicationTest.java

示例3: testDataSourceWithTXTPlusAttachment

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
public void testDataSourceWithTXTPlusAttachment() throws Exception {
        Dispatch<DataSource> dispatch = getDispatch();

        Map attachments = new HashMap();
        Map requestContext = dispatch.getRequestContext();

//        requestContext.put(org.apache.axis2.transport.http.HTTPConstants.SO_TIMEOUT , new 
//        Integer(999999));
//        requestContext.put(org.apache.axis2.transport.http.HTTPConstants.CONNECTION_TIMEOUT, new 
//        Integer(999999));

        requestContext.put(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS,
                attachments);
        attachments.put(UUIDGenerator.getUUID(), new DataHandler(attachmentDS));

        DataSource request = txtDS;
        DataSource response = dispatch.invoke(request);
        assertTrue(response != null);
        assertEquals(response.getContentType(),"text/plain");
        String req = new String(getStreamAsByteArray(request.getInputStream()));
        String res = new String(getStreamAsByteArray(response.getInputStream()));
        assertEquals(req, res);
        Map attachments2 = (Map) dispatch.getResponseContext().get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
        assertTrue(attachments2 != null);
        assertEquals(attachments2.size(), 1);
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:27,代码来源:DispatchXMessageDataSourceTests.java

示例4: testDataSourceWithImagePlusAttachment

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
public void testDataSourceWithImagePlusAttachment() throws Exception {
    Dispatch<DataSource> dispatch = getDispatch();

    Map attachments = new HashMap();
    Map requestContext = dispatch.getRequestContext();

    requestContext.put(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS,
            attachments);
    attachments.put(UUIDGenerator.getUUID(), new DataHandler(attachmentDS));
    
    DataSource request = imageDS;
    DataSource response = dispatch.invoke(request);
    assertTrue(response != null);
    assertEquals(response.getContentType(),"image/jpeg");
    assertTrue(Arrays.equals(getStreamAsByteArray(request.getInputStream()), 
            getStreamAsByteArray(response.getInputStream())));
    Map attachments2 = (Map) dispatch.getResponseContext().get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
    assertTrue(attachments2 != null);
    assertEquals(attachments2.size(), 1);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:DispatchXMessageDataSourceTests.java

示例5: testDataSourceWithTXTPlusTwoAttachments

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
public void testDataSourceWithTXTPlusTwoAttachments() throws Exception {
    Dispatch<DataSource> dispatch = getDispatch();

    Map attachments = new HashMap();
    Map requestContext = dispatch.getRequestContext();

    requestContext.put(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS,
            attachments);
    attachments.put(UUIDGenerator.getUUID(), new DataHandler(attachmentDS));
    attachments.put(UUIDGenerator.getUUID(), new DataHandler(imageDS));

    DataSource request = txtDS;
    DataSource response = dispatch.invoke(request);
    assertTrue(response != null);
    assertEquals(response.getContentType(),"text/plain");
    String req = new String(getStreamAsByteArray(request.getInputStream()));
    String res = new String(getStreamAsByteArray(response.getInputStream()));
    assertEquals(req, res);
    Map attachments2 = (Map) dispatch.getResponseContext().get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
    assertTrue(attachments2 != null);
    assertEquals(attachments2.size(), 2);
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:23,代码来源:DispatchXMessageDataSourceTests.java

示例6: addPolicyToAllBindings

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
public void addPolicyToAllBindings(AxisService axisService, Policy policy)
        throws ServerException {
    try {
        if (policy.getId() == null) {
            // Generate an ID
            policy.setId(UUIDGenerator.getUUID());
        }
        Map endPointMap = axisService.getEndpoints();
        for (Object o : endPointMap.entrySet()) {
            Map.Entry entry = (Map.Entry) o;
            AxisEndpoint point = (AxisEndpoint) entry.getValue();
            AxisBinding binding = point.getBinding();
            String bindingName = binding.getName().getLocalPart();

            //only UTOverTransport is allowed for HTTP
            if (bindingName.endsWith("HttpBinding") &&
                    (!policy.getAttributes().containsValue("UTOverTransport"))) {
                continue;
            }
            binding.getPolicySubject().attachPolicy(policy);
            // Add the new policy to the registry
        }
    } catch (Exception e) {
        log.error("Error in adding security policy to all bindings", e);
        throw new ServerException("addPoliciesToService", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:28,代码来源:SecurityDeploymentInterceptor.java

示例7: addSecurityPolicyToAllBindings

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
/**
 * This method add Policy to service at the Registry. Does not add the
 * policy to Axis2. To all Bindings available
 *
 * @param axisService Service
 * @param policy      Policy
 * @throws org.wso2.carbon.utils.ServerException se
 */
public void addSecurityPolicyToAllBindings(AxisService axisService, Policy policy)
        throws ServerException {
    try {
        if (policy.getId() == null) {
            policy.setId(UUIDGenerator.getUUID());
        }

        Map endPointMap = axisService.getEndpoints();
        for (Object o : endPointMap.entrySet()) {
            Map.Entry entry = (Map.Entry) o;
            AxisEndpoint point = (AxisEndpoint) entry.getValue();
            AxisBinding binding = point.getBinding();
            String bindingName = binding.getName().getLocalPart();

            //only UTOverTransport is allowed for HTTP
            if (bindingName.endsWith("HttpBinding") &&
                    (!policy.getAttributes().containsValue("UTOverTransport"))) {
                continue;
            }
            binding.getPolicySubject().attachPolicy(policy);

        }
    } catch (Exception e) {
        log.error("Error in adding security policy to all bindings", e);
        throw new ServerException("addPoliciesToService", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:36,代码来源:SecurityServiceAdmin.java

示例8: createMessageContext

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
private MessageContext createMessageContext() throws AxisFault {
    MessageContext msgCtx = createSynapseMessageContext();
    org.apache.axis2.context.MessageContext axis2MsgCtx = ((Axis2MessageContext) msgCtx).getAxis2MessageContext();
    axis2MsgCtx.setServerSide(true);
    axis2MsgCtx.setMessageID(UUIDGenerator.getUUID());
    return msgCtx;
}
 
开发者ID:wso2-extensions,项目名称:esb-connector-file,代码行数:8,代码来源:FileMoveUnitTest.java

示例9: createMessageContext

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
/**
 * Create the message context.
 */
private MessageContext createMessageContext() {
    MessageContext msgCtx = this.synapseEnvironment.createMessageContext();
    org.apache.axis2.context.MessageContext axis2MsgCtx = ((Axis2MessageContext) msgCtx).getAxis2MessageContext();
    axis2MsgCtx.setServerSide(true);
    axis2MsgCtx.setMessageID(UUIDGenerator.getUUID());
    return msgCtx;
}
 
开发者ID:wso2-extensions,项目名称:esb-inbound-amazonsqs,代码行数:11,代码来源:AmazonSQSPollingConsumer.java

示例10: addSecurityPolicyToAllBindings

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
/**
 * This method add Policy to service at the Registry. Does not add the
 * policy to Axis2. To all Bindings available
 *
 * @param axisService Service
 * @param policy      Policy
 * @throws org.wso2.carbon.utils.ServerException se
 */
public void addSecurityPolicyToAllBindings(AxisService axisService, Policy policy)
        throws ServerException {
    String serviceGroupId = axisService.getAxisServiceGroup().getServiceGroupName();
    try {
        if (policy.getId() == null) {
            policy.setId(UUIDGenerator.getUUID());
        }

        Map endPointMap = axisService.getEndpoints();
        for (Object o : endPointMap.entrySet()) {
            Map.Entry entry = (Map.Entry) o;
            AxisEndpoint point = (AxisEndpoint) entry.getValue();
            AxisBinding binding = point.getBinding();
            String bindingName = binding.getName().getLocalPart();

            //only UTOverTransport is allowed for HTTP
            if (bindingName.endsWith("HttpBinding") &&
                    (!policy.getAttributes().containsValue("UTOverTransport"))) {
                continue;
            }
            binding.getPolicySubject().attachPolicy(policy);

        }
    } catch (Exception e) {
        log.error("Error in adding security policy to all bindings", e);
        throw new ServerException("addPoliciesToService", e);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:37,代码来源:SecurityServiceAdmin.java

示例11: updateMessageID

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
@Override
protected void updateMessageID() throws MessagingException {
    // although MailConstants.MAIL_HEADER_X_MESSAGE_ID solves the gmail problem with axis2-axis2
    // invocations it is not a generic solution.
    // we can over come gmail problem by setting the message id as follows with a valid gmail address
    // <[email protected]> this can be achived by appending from address at the end of uuid
 if (getHeader(MailConstants.MAIL_HEADER_MESSAGE_ID) == null) {
        String uuid = "<" + UUIDGenerator.getUUID().replaceAll(":",".") + fromAddress +">";
        setHeader(MailConstants.MAIL_HEADER_MESSAGE_ID, uuid);
    }
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:12,代码来源:WSMimeMessage.java

示例12: sendMessage

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
protected String sendMessage(ContentType contentType, byte[] message) throws Exception {
    String msgId = UUIDGenerator.getUUID();
    MimeMessage msg = new MimeMessage(session);
    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(channel.getRecipient().getAddress()));
    msg.setFrom(new InternetAddress(channel.getSender().getAddress()));
    msg.setSentDate(new Date());
    msg.setHeader(MailConstants.MAIL_HEADER_MESSAGE_ID, msgId);
    msg.setHeader(MailConstants.MAIL_HEADER_X_MESSAGE_ID, msgId);
    DataHandler dh = new DataHandler(new ByteArrayDataSource(message, contentType.toString()));
    layout.setupMessage(msg, dh);
    Transport.send(msg);
    return msgId;
}
 
开发者ID:wso2,项目名称:wso2-axis2-transports,代码行数:14,代码来源:MailClient.java

示例13: createMessageContext

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
private MessageContext createMessageContext(OperationContext oc, ConfigurationContext cc,
                                                int flowType) throws Exception {
        MessageContext mc = cc.createMessageContext();

        mc.setFLOW(flowType);
        mc.setTransportIn(transportIn);
        mc.setTransportOut(transportOut);

        mc.setServerSide(true);
//        mc.setProperty(MessageContext.TRANSPORT_OUT, System.out);

        SOAPFactory omFac = OMAbstractFactory.getSOAP11Factory();
        mc.setEnvelope(omFac.getDefaultEnvelope());

        AxisOperation axisOperation = oc.getAxisOperation();
        String action = axisOperation.getName().getLocalPart();
        mc.setSoapAction(action);
//        System.out.flush();

        mc.setMessageID(UUIDGenerator.getUUID());

        axisOperation.registerOperationContext(mc, oc);
        mc.setOperationContext(oc);

        ServiceContext sc = oc.getServiceContext();
        mc.setServiceContext(sc);

        mc.setTo(new EndpointReference("axis2/services/NullService"));
        mc.setWSAAction("DummyOp");

        AxisMessage axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        mc.setAxisMessage(axisMessage);

        return mc;
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:36,代码来源:MessageContextSaveCTest.java

示例14: createMessageContext

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
private MessageContext createMessageContext(OperationContext oc) throws Exception {
        MessageContext mc = configurationContext.createMessageContext();
        mc.setTransportIn(transportIn);
        mc.setTransportOut(transportOut);

        mc.setServerSide(true);
//        mc.setProperty(MessageContext.TRANSPORT_OUT, System.out);

        SOAPFactory omFac = OMAbstractFactory.getSOAP11Factory();
        mc.setEnvelope(omFac.getDefaultEnvelope());

        AxisOperation axisOperation = oc.getAxisOperation();
        String action = axisOperation.getName().getLocalPart();
        mc.setSoapAction(action);
//        System.out.flush();

        mc.setMessageID(UUIDGenerator.getUUID());

        axisOperation.registerOperationContext(mc, oc);
        mc.setOperationContext(oc);

        ServiceContext sc = oc.getServiceContext();
        mc.setServiceContext(sc);

        mc.setTo(new EndpointReference("axis2/services/NullService"));
        mc.setWSAAction("DummyOp");

        AxisMessage axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
        mc.setAxisMessage(axisMessage);

        return mc;
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:33,代码来源:MessageContextSaveBTest.java

示例15: testRemovePropertyFromServiceGroupContext2

import org.apache.axiom.om.util.UUIDGenerator; //导入依赖的package包/类
public void testRemovePropertyFromServiceGroupContext2() throws Exception {
    if (!canRunTests) {
        return;
    }

    // Add the property
    String sgcID = UUIDGenerator.getUUID();

    ServiceGroupContext serviceGroupContext1 =
            configurationContext1.createServiceGroupContext(serviceGroup1);
    serviceGroupContext1.setId(sgcID);
    configurationContext1.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext1);
    assertNotNull(serviceGroupContext1);

    ServiceGroupContext serviceGroupContext2 =
            configurationContext2.createServiceGroupContext(serviceGroup2);
    serviceGroupContext2.setId(sgcID);
    configurationContext2.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext2);
    assertNotNull(serviceGroupContext2);

    String key1 = "sgCtxKey";
    String val1 = "sgCtxVal1";
    serviceGroupContext1.setProperty(key1, val1);
    ctxMan1.updateContext(serviceGroupContext1);

    assertEquals(val1, serviceGroupContext2.getProperty(key1));

    // Remove the property
    serviceGroupContext2.removeProperty(key1);
    assertNull(serviceGroupContext2.getProperty(key1));
    ctxMan2.updateContext(serviceGroupContext2);
    assertNull(serviceGroupContext1.getProperty(key1));
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:34,代码来源:ContextReplicationTest.java


注:本文中的org.apache.axiom.om.util.UUIDGenerator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。