本文整理了Java中org.apache.ode.utils.GUID
类的一些代码示例,展示了GUID
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GUID
类的具体详情如下:
包路径:org.apache.ode.utils.GUID
类名称:GUID
[英]This class is used to generate globally unique IDs. The requirements for global uniqueness are as follows:
1) The time on any machine is never set back.
2) Each machine has a unique IP address.
3) Each process has the 'org.apache.ode.uid.port' property set to the
same non-zero value.
byte: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
[ IPADDRESS ] [ START TIME IN MS ] [ count]
This format allow more compact string representation.
Persistence mechanism maps 6 bits to a number-char mapping. Byte
0-5 (48 bits, 6 bits per char => 8 chars)
Since the current time typically has zeros for many of its most significant
digits, all leading zeros are truncated from the string representation.
The following 6 bit to char mapping is used:
0-9 -> 0-9
10-35 -> A-Z
36-60 -> a-y
61 -> za
62 -> zb
63 -> zc
[中]此类用于生成全局唯一ID。全局唯一性的要求如下:
1) The time on any machine is never set back.
2) Each machine has a unique IP address.
3) Each process has the 'org.apache.ode.uid.port' property set to the
same non-zero value.
byte: 0 1 2 3 4 5 6 7 8 9 10 11 12 13
[ IPADDRESS ] [ START TIME IN MS ] [ count]
This format allow more compact string representation.
Persistence mechanism maps 6 bits to a number-char mapping. Byte
0-5 (48 bits, 6 bits per char => 8 chars)
Since the current time typically has zeros for many of its most significant
digits, all leading zeros are truncated from the string representation.
The following 6 bit to char mapping is used:
0-9 -> 0-9
10-35 -> A-Z
36-60 -> a-y
61 -> za
62 -> zb
63 -> zc
代码示例来源:origin: org.wso2.bpel/ode-utils
/**
* Creates a new UUID. The algorithm used is the one in {@link UUID}, the
* open group algorithm took too damn long.
*
* @return a new "globally" unique identifier
*/
public String nextUUID() {
return new GUID().toString();
}
代码示例来源:origin: org.wso2.bpel/ode-utils
public boolean equals(Object o) {
try {
return compareTo(o) == 0;
} catch (ClassCastException ce) {
return false;
}
}
代码示例来源:origin: org.wso2.bpel/ode-utils
public static void main(String[] argv) throws Exception {
Set<GUID> set = new HashSet<GUID>();
for (int i = 0; i < 100000; ++i) {
GUID g = new GUID();
if (set.contains(g)) {
System.out.println("CONFLICT>>>");
}
set.add(g);
GUID ng = new GUID(g.toString());
if (!ng.toString().equals(g.toString()) || !ng.equals(g)) {
System.out.println("INEQUALITY>>>");
System.out.println(ng.toString());
System.out.println(g.toString());
} else {
System.out.println(g.toString());
}
}
}
代码示例来源:origin: org.wso2.bpel/ode-utils
/**
* Create a new unique GUID
*/
public GUID() {
short c;
byte[] b;
synchronized (GUID.class) {
c = ++cnt;
b = baseId;
if (cnt == Short.MAX_VALUE) {
cnt = Short.MIN_VALUE;
baseId = getSystemUniqId();
}
}
id = new byte[] { ipadd[0], ipadd[1], ipadd[2], ipadd[3], b[7], b[6],
b[5], b[4], b[3], b[2], b[1], b[0], (byte) ((c >>> 8) & 0xff),
(byte) (c & 0xff) };
}
代码示例来源:origin: org.jboss.soa.bpel/riftsaw-scheduler-simple
public JobDAOImpl(long when, boolean transacted, JobDetails jobDetail) {
this(when, new GUID().toString(),transacted,jobDetail);
}
代码示例来源:origin: org.wso2.bpel/ode-scheduler-simple
public Job(long when, boolean transacted, JobDetails jobDetail) {
this(when, new GUID().toString(),transacted,jobDetail);
}
代码示例来源:origin: org.jboss.soa.bpel/riftsaw-scheduler-simple
public JobDAO createJob(boolean transacted, JobDetails jobDetails,
boolean persisted, long scheduledDate){
return createJob(new GUID().toString(), transacted, jobDetails, persisted, scheduledDate);
}
代码示例来源:origin: org.wso2.bpel/ode-bpel-store
/**
* Constructor that hardwires OpenJPA on a new in-memory database. Suitable for tests.
*/
public ProcessStoreImpl(EndpointReferenceContext eprContext, DataSource inMemDs) {
this.eprContext = eprContext;
DataSource hsqlds = createInternalDS(new GUID().toString());
//when in memory we always create the model as we are starting from scratch
_cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, true, OdeConfigProperties.DEFAULT_TX_FACTORY_CLASS_NAME);
_inMemDs = hsqlds;
}
代码示例来源:origin: org.wso2.bpel/ode-utils
public static synchronized File getTemporaryFile(String handle, File parent) {
// force initialization if necessary
if (__singleton == null) {
getInstance();
}
if (handle == null) {
handle = "temp-";
}
if (parent == null) {
parent = (__workDir != null ? __workDir : __baseDir);
}
File tmp;
try {
tmp = File.createTempFile(handle + Long.toHexString(System.currentTimeMillis()), ".tmp", parent);
} catch (IOException ioe) {
__log.error("Unable to create temporary file in working directory " +
(parent == null ? "<null>; " : (parent.getPath() + "; ")) +
"falling back to current working directory.", ioe);
tmp = new File(handle + new GUID().toString());
}
registerTemporaryFile(tmp);
return tmp;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-implementation-bpel-runtime
protected Scheduler createScheduler() {
Properties odeProperties = new Properties();
// TODO Find correct values for these properties - MJE 22/06/2009
odeProperties.put("ode.scheduler.queueLength", "100" );
odeProperties.put("ode.scheduler.immediateInterval", "30000" );
odeProperties.put("ode.scheduler.nearFutureInterval", "600000" );
odeProperties.put("ode.scheduler.staleInterval", "100000" );
SimpleScheduler scheduler = new SimpleScheduler(new GUID().toString(),
new JdbcDelegate(_db.getDataSource()),
odeProperties );
scheduler.setExecutorService(_executorService);
scheduler.setTransactionManager(_txMgr);
return scheduler;
}
代码示例来源:origin: org.wso2.bpel/ode-utils
File odeTmp = new File(__baseDir, "ode-" + new GUID().toString());
if (odeTmp.mkdir()) {
__workDir = odeTmp;
代码示例来源:origin: org.jboss.soa.bpel/riftsaw-bpel-runtime
public Object getValue(String name, RowKey keys, RowVal values, Long iid) {
switch (genType) {
case ctimestamp:
case utimestamp:
return isTimeStamp() ? new Timestamp(new Date().getTime())
: new Date();
case uuid:
return new GUID().toString();
case pid:
return evarId.pid.toString();
case iid:
return iid;
case none:
default:
if (key && keys.get(name) != null)
return keys.get(name);
else
return values.get(name);
}
}
代码示例来源:origin: org.jboss.soa.bpel/riftsaw-bpel-runtime
public void initializePartnerLinks(Long parentScopeId, Collection<OPartnerLink> partnerLinks) {
if (BpelProcess.__log.isTraceEnabled()) {
BpelProcess.__log.trace(ObjectPrinter.stringifyMethodEnter("initializeEndpointReferences", new Object[] {
"parentScopeId", parentScopeId, "partnerLinks", partnerLinks }));
}
ScopeDAO parent = _dao.getScope(parentScopeId);
for (OPartnerLink partnerLink : partnerLinks) {
PartnerLinkDAO pdao = parent.createPartnerLink(partnerLink.getId(), partnerLink.name,
partnerLink.myRoleName, partnerLink.partnerRoleName);
// If there is a myrole on the link, initialize the session id so it
// is always
// available for opaque correlations. The myrole session id should
// never be changed.
if (partnerLink.hasMyRole())
pdao.setMySessionId(new GUID().toString());
}
}
代码示例来源:origin: org.wso2.carbon.business-process/org.wso2.carbon.bpel
public ProcessStoreImpl(EndpointReferenceContext eprContext,
DataSource ds,
ODEConfigurationProperties configurationProps) {
this.eprContext = eprContext;
if (ds != null) {
connectionFactory = new DbConfStoreConnectionFactory(ds, false,
configurationProps.getTxFactoryClass());
} else {
// If the datasource is not provided, then we create a HSQL-based in-memory
// database. Makes testing a bit simpler.
String guid = new GUID().toString();
DataSource hsqlds = createInternalDS(guid);
connectionFactory = new DbConfStoreConnectionFactory(hsqlds, true,
configurationProps.getTxFactoryClass());
inMemDs = hsqlds;
}
}
代码示例来源:origin: org.wso2.carbon.business-process/org.wso2.carbon.bpel
private MyRoleMessageExchange createMessageExchange(final MessageContext inMessageContext) {
Integer tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
MyRoleMessageExchange messageExchange;
String messageId = new GUID().toString();
messageExchange = odeBpelServer.getEngine().createMessageExchange("" + messageId,
serviceName,
inMessageContext.getAxisOperation().getName().getLocalPart(), null,
tenantId.toString());
if (log.isDebugEnabled()) {
log.debug("ODE routed to portType " + messageExchange.getPortType()
+ " operation " + messageExchange.getOperation()
+ " from service " + serviceName);
}
messageExchange.setProperty("isTwoWay", Boolean.toString(
inMessageContext.getAxisOperation() instanceof TwoChannelAxisOperation));
return messageExchange;
}
代码示例来源:origin: org.wso2.bpel/ode-bpel-test
public Void call() throws Exception {
try {
mex[0] = _server.getEngine().createMessageExchange(new GUID().toString(), _invocation.target, _invocation.operation);
mexContext.clearCurrentResponse();
Message request = mex[0].createMessage(_invocation.requestType);
request.setMessage(_invocation.request);
_invocation.invokeTime = System.currentTimeMillis();
running[0] = mex[0].invoke(request);
Status status = mex[0].getStatus();
CorrelationStatus cstatus = mex[0].getCorrelationStatus();
if (_invocation.expectedStatus != null && !status.equals(_invocation.expectedStatus))
failure(_invocation, "Unexpected message exchange status", _invocation.expectedStatus, status);
if (_invocation.expectedCorrelationStatus != null && !cstatus.equals(_invocation.expectedCorrelationStatus))
failure(_invocation, "Unexpected correlation status", _invocation.expectedCorrelationStatus, cstatus);
return null;
} catch (Exception ex) {
if (_invocation.expectedInvokeException == null)
failure(_invocation, "Unexpected invocation exception.", ex);
else if (_invocation.expectedInvokeException.isAssignableFrom(ex.getClass()))
failure(_invocation, "Unexpected invocation exception.", _invocation.expectedInvokeException, ex.getClass());
return null;
}
}
});
代码示例来源:origin: org.wso2.bpel/ode-bpel-store
public ProcessStoreImpl(EndpointReferenceContext eprContext, DataSource ds, String persistenceType, OdeConfigProperties props, boolean createDatamodel) {
this.eprContext = eprContext;
this.generateProcessEventsAll = props.getProperty("generateProcessEvents", "all").equals("all");
if (ds != null) {
// ugly hack
if (persistenceType.toLowerCase().indexOf("hib") != -1) {
_cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(ds, props.getProperties(), createDatamodel, props.getTxFactoryClass());
} else {
_cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(ds, createDatamodel, props.getTxFactoryClass());
}
} else {
// If the datasource is not provided, then we create a HSQL-based
// in-memory database. Makes testing a bit simpler.
DataSource hsqlds = createInternalDS(new GUID().toString());
if ("hibernate".equalsIgnoreCase(persistenceType)) {
_cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(hsqlds, props.getProperties(), createDatamodel, props.getTxFactoryClass());
} else {
_cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, createDatamodel, props.getTxFactoryClass());
}
_inMemDs = hsqlds;
}
}
代码示例来源:origin: org.jboss.soa.bpel/riftsaw-bpel-runtime
public static MyRoleMessageExchangeImpl createMyRoleMex(Exchange e, BpelEngineImpl engine) throws Exception {
MyRoleMessageExchangeImpl mex = (MyRoleMessageExchangeImpl) engine.createMessageExchange(new GUID().toString(), e.getService(), e.getOperation());
mex.getDAO().setCreateTime(e.getCreateTime().getTime());
MessageImpl m2 = (MessageImpl) mex.createMessage(new QName("replayer", "replayer"));
assign(m2._dao, e.getIn());
mex.getDAO().setRequest(m2._dao);
mex.getDAO().setStatus(Status.REQUEST.toString());
return mex;
}
代码示例来源:origin: org.apache.tuscany.sca/tuscany-implementation-bpel-runtime
try {
txMgr.begin();
mex = odeServer.getBpelServer().getEngine().createMessageExchange(new GUID().toString(),
bpelServiceName,
bpelOperationName);
代码示例来源:origin: org.apache.ode/ode-jbi
private void initBpelServer() throws JBIException {
if (__log.isDebugEnabled()) {
__log.debug("ODE initializing");
}
_ode._server = new BpelServerImpl();
// We don't want the server to automatically load deployed processes,
// we'll do that explcitly
_ode._eprContext = new EndpointReferenceContextImpl(_ode);
_ode._mexContext = new MessageExchangeContextImpl(_ode);
if (_ode._config.getThreadPoolMaxSize() == 0)
_ode._executorService = Executors.newCachedThreadPool();
else
_ode._executorService = Executors.newFixedThreadPool(_ode._config.getThreadPoolMaxSize());
_ode._scheduler = new SimpleScheduler(new GUID().toString(),new JdbcDelegate(_ode._dataSource), _ode._config.getProperties());
_ode._scheduler.setJobProcessor(_ode._server);
_ode._scheduler.setExecutorService(_ode._executorService);
_ode._scheduler.setTransactionManager((TransactionManager) _ode.getContext().getTransactionManager());
_ode._store = new ProcessStoreImpl(_ode._eprContext , _ode._dataSource, _ode._config.getDAOConnectionFactory(), _ode._config, false);
registerExternalVariableModules();
_ode._store.loadAll();
_ode._server.setInMemDaoConnectionFactory(new org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl(
_ode._scheduler, _ode._config.getInMemMexTtl()));
_ode._server.setDaoConnectionFactory(_ode._daocf);
_ode._server.setEndpointReferenceContext(_ode._eprContext);
_ode._server.setMessageExchangeContext(_ode._mexContext);
_ode._server.setBindingContext(new BindingContextImpl(_ode));
_ode._server.setScheduler(_ode._scheduler);
_ode._server.setConfigProperties(_ode._config.getProperties());
_ode._server.init();
}
内容来源于网络,如有侵权,请联系作者删除!