On Mon, Sep 27, 2010 at 1:34 AM, Milinda Pathirage <[email protected]> wrote:
> > > On Mon, Sep 27, 2010 at 10:49 AM, Sumedha Rubasinghe <[email protected]>wrote: > >> >> >> On Mon, Sep 27, 2010 at 1:15 AM, Milinda Pathirage <[email protected]>wrote: >> >>> Ran the FindBugs, no bugs were found on latest modifications. >> >> >> Milinda, >> Can there be bugs in your code that FindBugs cannot find? >> > > Yes, there can be bugs that FindBugs can't find. :) > Apart from those bugs & the bugs that FindBugs can find, can there be any other bugs? /sumedha > > Milinda > >> >> /sumedha >> >>> >>> Thanks >>> Milinda >>> >>> >>> On Mon, Sep 27, 2010 at 10:39 AM, Afkham Azeez <[email protected]> wrote: >>> >>>> Milinda, >>>> Did you run FindBugs on the modified code before committing? >>>> >>>> Azeez >>>> >>>> >>>> >>>> On Mon, Sep 27, 2010 at 9:07 AM, <[email protected]> wrote: >>>> >>>>> Author: milinda >>>>> Date: Sun Sep 26 20:37:43 2010 >>>>> New Revision: 74208 >>>>> URL: http://wso2.org/svn/browse/wso2?view=rev&revision=74208 >>>>> >>>>> Log: >>>>> Some minor refactorings to TenantProcesStoreImpl >>>>> >>>>> Modified: >>>>> >>>>> trunk/carbon/components/bpel/org.wso2.carbon.bpel/src/main/java/org/wso2/carbon/bpel/ode/integration/store/TenantProcessStoreImpl.java >>>>> >>>>> Modified: >>>>> trunk/carbon/components/bpel/org.wso2.carbon.bpel/src/main/java/org/wso2/carbon/bpel/ode/integration/store/TenantProcessStoreImpl.java >>>>> URL: >>>>> http://wso2.org/svn/browse/wso2/trunk/carbon/components/bpel/org.wso2.carbon.bpel/src/main/java/org/wso2/carbon/bpel/ode/integration/store/TenantProcessStoreImpl.java?rev=74208&r1=74207&r2=74208&view=diff >>>>> >>>>> ============================================================================== >>>>> --- >>>>> trunk/carbon/components/bpel/org.wso2.carbon.bpel/src/main/java/org/wso2/carbon/bpel/ode/integration/store/TenantProcessStoreImpl.java >>>>> (original) >>>>> +++ >>>>> trunk/carbon/components/bpel/org.wso2.carbon.bpel/src/main/java/org/wso2/carbon/bpel/ode/integration/store/TenantProcessStoreImpl.java >>>>> Sun Sep 26 20:37:43 2010 >>>>> @@ -114,39 +114,30 @@ >>>>> >>>>> parentProcessStore.getLocalProcessStoreRootDirectory(), >>>>> deploymentUnit, >>>>> versionForThisDeployment); >>>>> + boolean isExistingPackage = >>>>> repository.isExistingBPELPackage(deploymentContext); >>>>> >>>>> - if (repository.isExistingBPELPackage(deploymentContext)) { >>>>> + if (isExistingPackage) { >>>>> if (repository.isBPELPackageReload(deploymentContext)) { >>>>> - BPELPackageInfo bpelPackage = >>>>> repository.getBPELPackageInfo(deploymentContext); >>>>> - for (String packageName : >>>>> bpelPackage.getAvailableVersions()) { >>>>> - loadExistingBPELPackage(packageName); >>>>> - } >>>>> - return; // Once we finish reloading exit from this >>>>> deployment >>>>> + reloadAllVersionsOfBPELPackage(deploymentContext); >>>>> + return; // Once we finish reloading exit from the >>>>> normal flow. >>>>> } // Else this is a update of existing BPEL package >>>>> } >>>>> >>>>> try { >>>>> Utils.extractBPELArchive(deploymentContext); >>>>> } catch (Exception e) { >>>>> - String logMessage = "Error extracting BPEL archive " + >>>>> deploymentUnit + "."; >>>>> - deploymentContext.setDeploymentFailureCause(logMessage); >>>>> - >>>>> repository.handleBPELPackageDeploymentError(deploymentContext); >>>>> - log.error(logMessage, e); >>>>> - return; >>>>> + onBPELArchiveExtractionError(deploymentContext, e); >>>>> + return; // Exist from the normal flow on extration error. >>>>> } >>>>> >>>>> if >>>>> (!validateBPELPackage(deploymentContext.getBpelPackageLocationInFileSystem())) >>>>> { >>>>> - String logMessage = "BPEL Package format issue. Cannot >>>>> find deploy.xml in BPEL archive " >>>>> - + deploymentContext.getArchiveName() + "."; >>>>> - deploymentContext.setDeploymentFailureCause(logMessage); >>>>> - >>>>> repository.handleBPELPackageDeploymentError(deploymentContext); >>>>> - log.error(logMessage); >>>>> - return; >>>>> + onBPELPackageValidationError(deploymentContext); >>>>> + return; // Exist from the normal flow on BPEL package >>>>> validation error. >>>>> } >>>>> >>>>> deployBPELPackageInODE(deploymentContext); >>>>> >>>>> - if (repository.isExistingBPELPackage(deploymentContext)) { >>>>> + if (isExistingPackage) { >>>>> repository.handleBPELPackageUpdate(deploymentContext); >>>>> } else { >>>>> repository.handleNewBPELPackageAddition(deploymentContext); >>>>> @@ -154,6 +145,127 @@ >>>>> >>>>> } >>>>> >>>>> + public void undeploy(String bpelPackageName) { >>>>> + >>>>> parentProcessStore.preBPELPackageUndeployment(bpelPackageName); >>>>> + >>>>> + String locationInRegistry = >>>>> Constants.REG_PATH_OF_BPEL_PACKAGES + "/" + bpelPackageName; >>>>> + try { >>>>> + if >>>>> (tenantConfigRegistry.resourceExists(locationInRegistry)) { >>>>> + tenantConfigRegistry.delete(locationInRegistry); >>>>> + } else { >>>>> + log.warn("BPEL Package " + bpelPackageName + " does >>>>> not exist in the registry."); >>>>> + } >>>>> + } catch (RegistryException e) { >>>>> + //String logMessage = "" >>>>> + log.error("Error occurred while removing BPEL package " + >>>>> bpelPackageName >>>>> + + " from registry."); >>>>> + } >>>>> + >>>>> + Collection<QName> undeployed = Collections.emptyList(); >>>>> + >>>>> + DeploymentUnitDir du = >>>>> deploymentUnits.remove(bpelPackageName); >>>>> + if (du != null) { >>>>> + long version = du.getVersion(); >>>>> + for (QName name : du.getProcessNames()) { >>>>> + undeployed.add(Utils.toPid(name, version)); >>>>> + } >>>>> + } >>>>> + >>>>> + parentProcessStore.postBPELPackageUndeployment(tenantId, >>>>> bpelPackageName, undeployed); >>>>> + >>>>> + } >>>>> + >>>>> + public void dehydrate() { >>>>> + } >>>>> + >>>>> + public void hydrate() { >>>>> + } >>>>> + >>>>> + public ProcessConf getProcessConfiguration(QName pid) { >>>>> + return processes.get(pid); >>>>> + } >>>>> + >>>>> + public void setState(QName pid, ProcessState processState) { >>>>> + if (!processes.containsKey(pid)) { >>>>> + String errMsg = "Process " + pid + " not found."; >>>>> + log.error(errMsg); >>>>> + throw new ContextException(errMsg); >>>>> + } >>>>> + >>>>> + if (processState == null) { >>>>> + String errMessage = "Process State cannot be null."; >>>>> + log.error(errMessage); >>>>> + throw new ContextException(errMessage); >>>>> + } >>>>> + >>>>> + parentProcessStore.setState(pid, processState); >>>>> + } >>>>> + >>>>> + public ConfigurationContext getTenantConfigContext() { >>>>> + return tenantConfigContext; >>>>> + } >>>>> + >>>>> + public Integer getTenantId() { >>>>> + return tenantId; >>>>> + } >>>>> + >>>>> + public Map<QName, ProcessConfigurationImpl> getProcesses() { >>>>> + return processes; >>>>> + } >>>>> + >>>>> + public List<QName> getProcessesInPackage(String packageName) { >>>>> + return processesInDeploymentUnit.get(packageName); >>>>> + } >>>>> + >>>>> + /** >>>>> + * Log and store the information to registry on BPEL archive >>>>> extraction error. >>>>> + * @param deploymentContext information about current deployment >>>>> + * @param e exception thrown by extraction utility >>>>> + * @throws RegistryException on error accessing registry for >>>>> persisting information. >>>>> + */ >>>>> + private void onBPELArchiveExtractionError(BPELDeploymentContext >>>>> deploymentContext, Exception e) >>>>> + throws RegistryException { >>>>> + String logMessage = "Error extracting BPEL archive " + >>>>> deploymentContext.getBpelArchive() >>>>> + + "."; >>>>> + deploymentContext.setDeploymentFailureCause(logMessage); >>>>> + >>>>> repository.handleBPELPackageDeploymentError(deploymentContext); >>>>> + log.error(logMessage, e); >>>>> + } >>>>> + >>>>> + /** >>>>> + * Log and store the information to registry on BPEL package >>>>> validation error. >>>>> + * @param deploymentContext information about current deployment >>>>> + * @throws RegistryException on error accessing registry for >>>>> persisting information. >>>>> + */ >>>>> + private void onBPELPackageValidationError(BPELDeploymentContext >>>>> deploymentContext) >>>>> + throws RegistryException { >>>>> + String logMessage = "BPEL Package format issue. Cannot find >>>>> deploy.xml in BPEL archive " >>>>> + + deploymentContext.getArchiveName() + "."; >>>>> + deploymentContext.setDeploymentFailureCause(logMessage); >>>>> + >>>>> repository.handleBPELPackageDeploymentError(deploymentContext); >>>>> + log.error(logMessage); >>>>> + } >>>>> + >>>>> + /** >>>>> + * Reload old versions of BPEL package. This is used to handle >>>>> restart of BPEL server. >>>>> + * At restart based on the last modifed time of the BPEL archives >>>>> we'll reload all the versions >>>>> + * of that BPEL archive. >>>>> + * @param deploymentContext information about current deployment >>>>> + * @throws RegistryException on error loading resources from >>>>> registry. >>>>> + */ >>>>> + private void reloadAllVersionsOfBPELPackage(BPELDeploymentContext >>>>> deploymentContext) >>>>> + throws RegistryException { >>>>> + BPELPackageInfo bpelPackage = >>>>> repository.getBPELPackageInfo(deploymentContext); >>>>> + for (String packageName : bpelPackage.getAvailableVersions()) >>>>> { >>>>> + loadExistingBPELPackage(packageName); >>>>> + } >>>>> + } >>>>> + >>>>> + /** >>>>> + * Deploy BPEL package in ODE and add process configuration >>>>> objects to necessary maps in process >>>>> + * store. >>>>> + * @param deploymentData information about current deployment >>>>> + */ >>>>> private void deployBPELPackageInODE(BPELDeploymentContext >>>>> deploymentData) { >>>>> File bpelPackage = new >>>>> File(deploymentData.getBpelPackageLocationInFileSystem()); >>>>> log.info("Strating deployment of processes from directory " >>>>> @@ -344,6 +456,8 @@ >>>>> * there's already version 2 than regexp >>>>> * "AbsenceRequest([-\\.](\d)+)?/AbsenceRequest.ode" will be >>>>> matched against >>>>> * "AbsenceRequest-2/AbsenceRequest.ode" and setRetirePackage() >>>>> will be called accordingly. >>>>> + * >>>>> + * @param du DeploymentUnitDir object containing in-memory >>>>> representation of BPEL package.Ê >>>>> */ >>>>> private void retirePreviousPackageVersions(DeploymentUnitDir du) { >>>>> //retire all the other versions of the same DU >>>>> @@ -378,94 +492,4 @@ >>>>> } >>>>> >>>>> >>>>> - /** >>>>> - * Return Registry resource if it exists and null if doesn't. >>>>> - * >>>>> - * @param bpelArchiveResourceLocation Location of the BPEL archive >>>>> resource in registry >>>>> - * @return Resource or null >>>>> - */ >>>>> - private Resource getExistingBPELArchiveResource(String >>>>> bpelArchiveResourceLocation) { >>>>> - >>>>> - try { >>>>> - if >>>>> (tenantConfigRegistry.resourceExists(bpelArchiveResourceLocation)) { >>>>> - return >>>>> tenantConfigRegistry.get(bpelArchiveResourceLocation); >>>>> - } >>>>> - } catch (RegistryException e) { >>>>> - log.error("Error accessing registry to check for existing >>>>> BPEL archives.", e); >>>>> - } >>>>> - return null; >>>>> - } >>>>> - >>>>> - public void undeploy(String bpelPackageName) { >>>>> - >>>>> parentProcessStore.preBPELPackageUndeployment(bpelPackageName); >>>>> - >>>>> - String locationInRegistry = >>>>> Constants.REG_PATH_OF_BPEL_PACKAGES + "/" + bpelPackageName; >>>>> - try { >>>>> - if >>>>> (tenantConfigRegistry.resourceExists(locationInRegistry)) { >>>>> - tenantConfigRegistry.delete(locationInRegistry); >>>>> - } else { >>>>> - log.warn("BPEL Package " + bpelPackageName + " does >>>>> not exist in the registry."); >>>>> - } >>>>> - } catch (RegistryException e) { >>>>> - //String logMessage = "" >>>>> - log.error("Error occurred while removing BPEL package " + >>>>> bpelPackageName >>>>> - + " from registry."); >>>>> - } >>>>> - >>>>> - Collection<QName> undeployed = Collections.emptyList(); >>>>> - >>>>> - DeploymentUnitDir du = >>>>> deploymentUnits.remove(bpelPackageName); >>>>> - if (du != null) { >>>>> - long version = du.getVersion(); >>>>> - for (QName name : du.getProcessNames()) { >>>>> - undeployed.add(Utils.toPid(name, version)); >>>>> - } >>>>> - } >>>>> - >>>>> - parentProcessStore.postBPELPackageUndeployment(tenantId, >>>>> bpelPackageName, undeployed); >>>>> - >>>>> - } >>>>> - >>>>> - public void dehydrate() { >>>>> - } >>>>> - >>>>> - public void hydrate() { >>>>> - } >>>>> - >>>>> - public ProcessConf getProcessConfiguration(QName pid) { >>>>> - return processes.get(pid); >>>>> - } >>>>> - >>>>> - public void setState(QName pid, ProcessState processState) { >>>>> - if (!processes.containsKey(pid)) { >>>>> - String errMsg = "Process " + pid + " not found."; >>>>> - log.error(errMsg); >>>>> - throw new ContextException(errMsg); >>>>> - } >>>>> - >>>>> - if (processState == null) { >>>>> - String errMessage = "Process State cannot be null."; >>>>> - log.error(errMessage); >>>>> - throw new ContextException(errMessage); >>>>> - } >>>>> - >>>>> - parentProcessStore.setState(pid, processState); >>>>> - } >>>>> - >>>>> - public ConfigurationContext getTenantConfigContext() { >>>>> - return tenantConfigContext; >>>>> - } >>>>> - >>>>> - public Integer getTenantId() { >>>>> - return tenantId; >>>>> - } >>>>> - >>>>> - public Map<QName, ProcessConfigurationImpl> getProcesses() { >>>>> - return processes; >>>>> - } >>>>> - >>>>> - public List<QName> getProcessesInPackage(String packageName) { >>>>> - return processesInDeploymentUnit.get(packageName); >>>>> - } >>>>> - >>>>> } >>>>> >>>>> >>>>> _______________________________________________ >>>>> Carbon-commits mailing list >>>>> [email protected] >>>>> https://wso2.org/cgi-bin/mailman/listinfo/carbon-commits >>>>> >>>>> >>>> >>>> >>>> -- >>>> *Afkham Azeez* >>>> Senior Software Architect & Senior Manager; WSO2, Inc.; http://wso2.com >>>> , >>>> * >>>> * >>>> *Member; Apache Software Foundation; >>>> **http://www.apache.org/*<http://www.apache.org/> >>>> * >>>> email: **[email protected]* <[email protected]>* cell: +94 77 3320919 >>>> blog: **http://blog.afkham.org* <http://blog.afkham.org>* >>>> twitter: >>>> **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> >>>> * >>>> linked-in: **http://lk.linkedin.com/in/afkhamazeez* >>>> * >>>> * >>>> *Lean . Enterprise . Middleware* >>>> >>>> >>> >>> >>> -- >>> Milinda Pathirage >>> Technical Lead and Product Manager, Business Process Server - WSO2 Inc; >>> http://wso2.com >>> Blog: http://blog.mpathirage.com >>> >>> Lean Enterprise Middleware >>> >>> _______________________________________________ >>> Carbon-dev mailing list >>> [email protected] >>> https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev >>> >>> >> >> _______________________________________________ >> Carbon-dev mailing list >> [email protected] >> https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev >> >> > > > -- > Milinda Pathirage > Technical Lead and Product Manager, Business Process Server - WSO2 Inc; > http://wso2.com > Blog: http://blog.mpathirage.com > > Lean Enterprise Middleware > > _______________________________________________ > Carbon-dev mailing list > [email protected] > https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev > >
_______________________________________________ Carbon-dev mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
