[jbosstools-issues] [JBoss JIRA] (JBIDE-12620) openshift java client: should not load all applications when creating a new application

Andre Dietisheim (JIRA) jira-events at lists.jboss.org
Fri Sep 14 11:03:32 EDT 2012


    [ https://issues.jboss.org/browse/JBIDE-12620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12718700#comment-12718700 ] 

Andre Dietisheim commented on JBIDE-12620:
------------------------------------------

the check makes no sense if we're only looking into the cached apps. I would either make no check at all, let the backend fail or eventually load all apps from the backend to check. Thinking twice I'd pretend that this is backend logic, to have unique application names. The client should not implement backend logic. I'll simply drop this check.
                
> openshift java client: should not load all applications when creating a new application
> ---------------------------------------------------------------------------------------
>
>                 Key: JBIDE-12620
>                 URL: https://issues.jboss.org/browse/JBIDE-12620
>             Project: Tools (JBoss Tools)
>          Issue Type: Enhancement
>          Components: openshift
>    Affects Versions: 3.3.0.Final
>            Reporter: Andre Dietisheim
>            Assignee: Andre Dietisheim
>             Fix For: 4.0.0.Alpha2
>
>
> When creating a new application, the openshift-java-client would lookup if the application name already exist. When doing that it'll load the existing apps from the backend if they're not cached yet:
> {code:title=stacktrace when creating a new application}
> at com.openshift.internal.client.AbstractOpenShiftResource$ServiceRequest.execute(AbstractOpenShiftResource.java:137)
> 	at com.openshift.internal.client.DomainResource.loadApplications(DomainResource.java:189)
> 	at com.openshift.internal.client.DomainResource.getApplications(DomainResource.java:179)
> 	at com.openshift.internal.client.DomainResource.getApplicationByName(DomainResource.java:141)
> 	at com.openshift.internal.client.DomainResource.hasApplicationByName(DomainResource.java:151)
> 	at com.openshift.internal.client.DomainResource.createApplication(DomainResource.java:126)
> 	at com.openshift.internal.client.DomainResource.createApplication(DomainResource.java:112)
> {code}
> {code:title=DomainResource looks applications up, to see if the name is already used. DomainResource#createApplication}
> if (hasApplicationByName(name)) {
> 	throw new OpenShiftException("Application with name \"{0}\" already exists.", name);
> }
> {code}
> {code:title=DomainResource#hasApplicationByName gets the available applications:}
> return getApplicationByName(name) != null;
> {code}
> {code:title=DomainResource#getApplicationByName}
> IApplication matchingApplication = null;
> for (IApplication application : getApplications()) {
> 	if (application.getName().equals(name)) {
> 		matchingApplication = application;
> 		break;
> 	}
> }
> return matchingApplication;
> {code}
> {code:title=DomainResource#getApplications would load the applications from the backend if they're not loaded yet}
> if (this.applications == null) {
> 	this.applications = loadApplications();
> }
> return CollectionUtils.toUnmodifiableCopy(applications);
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list