/** * 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(); }
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()); } } }
public Job(long when, boolean transacted, JobDetails jobDetail) { this(when, new GUID().toString(),transacted,jobDetail); }
public JobDAOImpl(long when, boolean transacted, JobDetails jobDetail) { this(when, new GUID().toString(),transacted,jobDetail); }
public JobDAO createJob(boolean transacted, JobDetails jobDetails, boolean persisted, long scheduledDate){ return createJob(new GUID().toString(), transacted, jobDetails, persisted, scheduledDate); }
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; }
File odeTmp = new File(__baseDir, "ode-" + new GUID().toString()); if (odeTmp.mkdir()) { __workDir = odeTmp;
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); } }
/** * 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; }
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; }
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; }
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()); } }
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; } } });
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; } }
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; } }
try { txMgr.begin(); mex = odeServer.getBpelServer().getEngine().createMessageExchange(new GUID().toString(), bpelServiceName, bpelOperationName);
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; }
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(); }