Package jadex.bridge
Class ResourceIdentifier
- java.lang.Object
-
- jadex.bridge.ResourceIdentifier
-
- All Implemented Interfaces:
IResourceIdentifier
public class ResourceIdentifier extends java.lang.Object implements IResourceIdentifier
Default implementation for resource identification. Contains only a local identifier and a global identifier that can be used to find the resource.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanENABLE_HASHESprotected IGlobalResourceIdentifiergidThe global identifier.protected static java.util.Set<java.lang.String>IGNOREDThe ignored directories for determining resource project name.protected static java.util.Set<java.lang.String>JADEX_PROJECTSThe jadex project names.protected ILocalResourceIdentifierlidThe local identifier.
-
Constructor Summary
Constructors Constructor Description ResourceIdentifier()Create a resource identifier.ResourceIdentifier(ILocalResourceIdentifier lid, IGlobalResourceIdentifier gid)Create a resource identifier.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Test if equals.IGlobalResourceIdentifiergetGlobalIdentifier()Get the global identifier.ILocalResourceIdentifiergetLocalIdentifier()Get the local identifier.inthashCode()Get the hashcode.static booleanisHashGid(IResourceIdentifier rid)Test if the global id is non-null and a hash id.static booleanisJadexRid(IResourceIdentifier rid)Test if a rid refers to one of the jadex platform modules, i.e.static booleanisLocal(IResourceIdentifier rid, IComponentIdentifier root)Test if a rid is local to this platform.static IResourceIdentifierridFromProperties(Properties rid, IComponentIdentifier root)Create a rid from properties.static PropertiesridToProperties(IResourceIdentifier rid, IComponentIdentifier root)Create properties from rid.voidsetGlobalIdentifier(IGlobalResourceIdentifier gid)Set the global identifier.voidsetLocalIdentifier(ILocalResourceIdentifier lid)Set the local identifier.java.lang.StringtoString()Get a string representation of this object.
-
-
-
Field Detail
-
ENABLE_HASHES
public static final boolean ENABLE_HASHES
- See Also:
- Constant Field Values
-
IGNORED
protected static final java.util.Set<java.lang.String> IGNORED
The ignored directories for determining resource project name.
-
JADEX_PROJECTS
protected static final java.util.Set<java.lang.String> JADEX_PROJECTS
The jadex project names.
-
lid
protected ILocalResourceIdentifier lid
The local identifier.
-
gid
protected IGlobalResourceIdentifier gid
The global identifier.
-
-
Constructor Detail
-
ResourceIdentifier
public ResourceIdentifier()
Create a resource identifier.
-
ResourceIdentifier
public ResourceIdentifier(ILocalResourceIdentifier lid, IGlobalResourceIdentifier gid)
Create a resource identifier.- Parameters:
lid- The local identifier.gid- The global idenfifier.
-
-
Method Detail
-
getLocalIdentifier
public ILocalResourceIdentifier getLocalIdentifier()
Get the local identifier. The local identifier consists of the platform component identifier and the URL of the resource.- Specified by:
getLocalIdentifierin interfaceIResourceIdentifier- Returns:
- The local identifier.
-
getGlobalIdentifier
public IGlobalResourceIdentifier getGlobalIdentifier()
Get the global identifier.- Specified by:
getGlobalIdentifierin interfaceIResourceIdentifier- Returns:
- The global identifier.
-
setLocalIdentifier
public void setLocalIdentifier(ILocalResourceIdentifier lid)
Set the local identifier.- Parameters:
lid- The lid to set.
-
setGlobalIdentifier
public void setGlobalIdentifier(IGlobalResourceIdentifier gid)
Set the global identifier.- Parameters:
gid- The gid to set.
-
hashCode
public int hashCode()
Get the hashcode.- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Test if equals. They are equal when a) global ids are equal b) or global ids are null and local ids are equal.- Overrides:
equalsin classjava.lang.Object
-
isHashGid
public static boolean isHashGid(IResourceIdentifier rid)
Test if the global id is non-null and a hash id.
-
ridToProperties
public static Properties ridToProperties(IResourceIdentifier rid, IComponentIdentifier root)
Create properties from rid.- Parameters:
The- resource identifier.- Returns:
- rid The resource identifier properties.
-
ridFromProperties
public static IResourceIdentifier ridFromProperties(Properties rid, IComponentIdentifier root)
Create a rid from properties.- Parameters:
rid- The resource identifier properties.- Returns:
- The resource identifier.
-
isLocal
public static boolean isLocal(IResourceIdentifier rid, IComponentIdentifier root)
Test if a rid is local to this platform. Test is performed by MAC address. Root cid is only used as fallback.
-
isJadexRid
public static boolean isJadexRid(IResourceIdentifier rid)
Test if a rid refers to one of the jadex platform modules, i.e. is not application-specific.
-
toString
public java.lang.String toString()
Get a string representation of this object.- Overrides:
toStringin classjava.lang.Object
-
-