-
Notifications
You must be signed in to change notification settings - Fork 66
[OSJC-101] Add support for setting and retrieving additional gear storag... #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,7 @@ public interface ICartridge { | |
*/ | ||
public URL getUrl(); | ||
|
||
|
||
public CartridgeType getType(); | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2014 Red Hat, Inc. | ||
* Distributed under license by Red Hat, Inc. All rights reserved. | ||
* This program is made available under the terms of the | ||
* Eclipse Public License v1.0 which accompanies this distribution, | ||
* and is available at http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
******************************************************************************/ | ||
package com.openshift.client.cartridge; | ||
|
||
/** | ||
* Represents a standalone cartridge that has been deployed as opposed to IStandaloneCartridge | ||
* which really represents the metadata about a standalone cartridge | ||
*/ | ||
public interface IDeployedStandaloneCartridge extends IStandaloneCartridge{ | ||
|
||
/** | ||
* set the additional gear storage for the cartridge to the given | ||
* size. | ||
* | ||
* @param size The total additional gear storage for the cartridge | ||
* in gigabytes | ||
*/ | ||
public void setAdditionalGearStorage(int size); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,6 @@ | |
******************************************************************************/ | ||
package com.openshift.client.cartridge; | ||
|
||
import java.net.URL; | ||
|
||
import com.openshift.client.IApplication; | ||
import com.openshift.client.IOpenShiftResource; | ||
import com.openshift.client.OpenShiftException; | ||
|
@@ -23,14 +21,6 @@ | |
*/ | ||
public interface IEmbeddedCartridge extends IOpenShiftResource, IEmbeddableCartridge { | ||
|
||
/** | ||
* The url at which this cartridge may be reached | ||
* | ||
* @return the url for this cartridge | ||
* @throws OpenShiftException | ||
*/ | ||
public URL getUrl() throws OpenShiftException; | ||
|
||
/** | ||
* Destroys this cartridge (and removes it from the list of existing cartridges) | ||
* | ||
|
@@ -52,4 +42,13 @@ public interface IEmbeddedCartridge extends IOpenShiftResource, IEmbeddableCartr | |
* @return the resource properties | ||
*/ | ||
public CartridgeResourceProperties getProperties(); | ||
|
||
/** | ||
* set the additional gear storage for the cartridge to the given | ||
* size. | ||
* | ||
* @param size The total additional gear storage for the cartridge | ||
* in gigabytes | ||
*/ | ||
public void setAdditionalGearStorage(int size); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what looks weird to me is that we set the additional gear storage in the standalone cartridge while we can only get it in the gear group. Furthermore it looks to me as if you set the additional gear storage and then go and get the value from the gear group you'd get the old value? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The odd ways of setting and getting are in line with what the REST API On 10/14/2014 01:33 PM, André Dietisheim wrote:
Jeff Cantrill There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a IDeployedStandaloneCartridge#getAdditionalGearStorage and delegated to ApplicationResource behind the scenes: https://github.com/openshift/openshift-java-client/pull/167/files#diff-7f982b00d649ba3eb211bedaee0e4986R68 Since ApplicationResource currently wont cache the gear groups (TODO comment exists) we wont get hurt, any call to it would reload the gear groups. I usually "fix" this by force reloading the outdated resource as you mentioned above. I filed https://issues.jboss.org/browse/OSJC-130 for the missing caching even though it's very unlikely that we'll ever resolve it (moving to v3 client lib ahead) |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why choose a somehow exotic naming scheme ("update") and not use the common "setXX" naming scheme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only see StandaloneCartridgeResource and EmbeddedCartridgeResource to request additional storage, the other cartridge classes simply store the value (EmbeddableCartridge, StandaloneCartridge). IMHO we should then not add #updateAdditionalGearStorage to ICartridge but have this only in specific interfaces (IEmbeddedCartridge and IDeployedStandaloneCartridge (?)) since there's only added value for the deployed variants (StandaloneCartridgeResource and EmbeddedCartridgeResource) and no logic/added value for the cartridge definition classes (StandaloneCartridge, EmbeddableCartridge)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adietish I chose this name explicitly because of the information in the API documentation which is:
'additional_gear_storage Set additional filesystem storage in gigabytes for the gear profile that the cartridge is running on.' I confess I don't remember, if I tested it to see if it is truly a 'set' operation which would make sense given I think you would want to be able to lower or raise it depending upon your needs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adietish In regards to where this interface method should reside, if you believe it should move to a separate interface I could be convinced to change it. Maybe this is an opportunity to define a capability for cartridges. Could it be a 'deployed cartridge'? Is there any significance to identifying it as 'embedded' or 'standalone'? I also havent looked, but does that also require us to cast when we use it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I dont think that we should introduce major new design elements in the v2 library. I would simply make sure we have this in the 2 interfaces where we need it: the interface for StandaloneCartridgeResource (IDeployedStandaloneCartridge?) and IEmbeddedCartridge