Class AbstractAzResource<T extends AbstractAzResource<T,P,R>,P extends AbstractAzResource<P,?,?>,R>
- java.lang.Object
-
- com.microsoft.azure.toolkit.lib.common.model.AbstractAzResource<T,P,R>
-
- All Implemented Interfaces:
IAzureBaseResource<T,P>,AzResource<T,P,R>,AzResourceBase
- Direct Known Subclasses:
AbstractAzResourceManager,AzResource.None
public abstract class AbstractAzResource<T extends AbstractAzResource<T,P,R>,P extends AbstractAzResource<P,?,?>,R> extends Object implements AzResource<T,P,R>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.microsoft.azure.toolkit.lib.common.model.AzResource
AzResource.Draft<T extends AzResource<T,?,R>,R>, AzResource.None
-
Nested classes/interfaces inherited from interface com.microsoft.azure.toolkit.lib.common.model.AzResourceBase
AzResourceBase.FormalStatus
-
Nested classes/interfaces inherited from interface com.microsoft.azure.toolkit.lib.common.entity.IAzureBaseResource
IAzureBaseResource.Status
-
-
Field Summary
Fields Modifier and Type Field Description private AbstractAzResourceModule<T,P,R>moduleprivate Stringname(package private) AtomicReference<R>remoteRefprivate StringresourceGroupName(package private) AtomicReference<String>statusRef(package private) AtomicLongsyncTimeRef-
Fields inherited from interface com.microsoft.azure.toolkit.lib.common.model.AzResource
NONE, RESOURCE_GROUP_PLACEHOLDER
-
Fields inherited from interface com.microsoft.azure.toolkit.lib.common.entity.IAzureBaseResource
REST_SEGMENT_JOB_MANAGEMENT_RESOURCE, REST_SEGMENT_JOB_MANAGEMENT_TENANTID
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAzResource(String name, AbstractAzResourceModule<T,P,R> module)constructor for non-top resource only.protectedAbstractAzResource(String name, String resourceGroupName, AbstractAzResourceModule<T,P,R> module)protectedAbstractAzResource(T origin)copy constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private <D> Dcast(Object origin)voiddelete()protected voiddoModify(Runnable body, String status)protected RdoModify(Callable<R> body, String status)protected voiddoModifyAsync(Runnable body, String status)protected voiddoModifyAsync(Callable<R> body, String status)booleanexists()StringgetId()RgetRemote()StringgetStatus()StringgetStatusSync()abstract List<AzResourceModule<?,T,?>>getSubModules()abstract StringloadStatus(R remote)voidrefresh()protected RrefreshRemote()private voidreload()private voidreloadStatus()protected Optional<R>remoteOptional()protected voidsetRemote(R newRemote)protected voidsetStatus(String status)AzResource.Draft<T,R>update()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.microsoft.azure.toolkit.lib.common.model.AzResource
getFullResourceType, getModule, getName, getParent, getPortalUrl, getResourceGroupName, getResourceTypeName, getSubscription, getSubscriptionId, id, name, refreshStatus, resourceGroup, status, subscription, subscriptionId
-
Methods inherited from interface com.microsoft.azure.toolkit.lib.common.model.AzResourceBase
getFormalStatus
-
Methods inherited from interface com.microsoft.azure.toolkit.lib.common.entity.IAzureBaseResource
module, parent, portalUrl
-
-
-
-
Field Detail
-
module
@Nonnull private final AbstractAzResourceModule<T extends AbstractAzResource<T,P,R>,P extends AbstractAzResource<P,?,?>,R> module
-
remoteRef
@Nonnull final AtomicReference<R> remoteRef
-
syncTimeRef
final AtomicLong syncTimeRef
-
statusRef
final AtomicReference<String> statusRef
-
-
Constructor Detail
-
AbstractAzResource
protected AbstractAzResource(@Nonnull String name, @Nonnull String resourceGroupName, @Nonnull AbstractAzResourceModule<T,P,R> module)
-
AbstractAzResource
protected AbstractAzResource(@Nonnull String name, @Nonnull AbstractAzResourceModule<T,P,R> module)
constructor for non-top resource only.module.getParent().getResourceGroupName()is only reliable if current resource is not root of resource hierarchy tree.
-
-
Method Detail
-
exists
public final boolean exists()
- Specified by:
existsin interfaceAzResource<T extends AbstractAzResource<T,P,R>,P extends AbstractAzResource<P,?,?>,R>- Specified by:
existsin interfaceAzResourceBase- Specified by:
existsin interfaceIAzureBaseResource<T extends AbstractAzResource<T,P,R>,P extends AbstractAzResource<P,?,?>>
-
refresh
public void refresh()
- Specified by:
refreshin interfaceAzResource<T extends AbstractAzResource<T,P,R>,P extends AbstractAzResource<P,?,?>,R>- Specified by:
refreshin interfaceIAzureBaseResource<T extends AbstractAzResource<T,P,R>,P extends AbstractAzResource<P,?,?>>
-
reload
private void reload()
-
update
public AzResource.Draft<T,R> update()
- Specified by:
updatein interfaceAzResource<T extends AbstractAzResource<T,P,R>,P extends AbstractAzResource<P,?,?>,R>
-
delete
public void delete()
- Specified by:
deletein interfaceAzResource<T extends AbstractAzResource<T,P,R>,P extends AbstractAzResource<P,?,?>,R>
-
getRemote
@Nullable public final R getRemote()
- Specified by:
getRemotein interfaceAzResource<T extends AbstractAzResource<T,P,R>,P extends AbstractAzResource<P,?,?>,R>
-
reloadStatus
private void reloadStatus()
-
getStatus
@Nonnull public String getStatus()
- Specified by:
getStatusin interfaceAzResource<T extends AbstractAzResource<T,P,R>,P extends AbstractAzResource<P,?,?>,R>- Specified by:
getStatusin interfaceAzResourceBase- Specified by:
getStatusin interfaceIAzureBaseResource<T extends AbstractAzResource<T,P,R>,P extends AbstractAzResource<P,?,?>>
-
refreshRemote
protected R refreshRemote()
-
getId
@Nonnull public String getId()
- Specified by:
getIdin interfaceAzResource<T extends AbstractAzResource<T,P,R>,P extends AbstractAzResource<P,?,?>,R>- Specified by:
getIdin interfaceAzResourceBase- Specified by:
getIdin interfaceIAzureBaseResource<T extends AbstractAzResource<T,P,R>,P extends AbstractAzResource<P,?,?>>
-
getSubModules
public abstract List<AzResourceModule<?,T,?>> getSubModules()
-
-