Class BoxServiceImpl
- java.lang.Object
-
- org.craftercms.studio.impl.v1.service.box.BoxServiceImpl
-
- All Implemented Interfaces:
BoxService
public class BoxServiceImpl extends Object implements BoxService
-
-
Field Summary
Fields Modifier and Type Field Description protected SiteAwareConfigProfileLoader<org.craftercms.commons.config.profiles.box.BoxProfile>
profileLoader
protected static String
URL_FORMAT
-
Constructor Summary
Constructors Constructor Description BoxServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAccessToken(String site, String profileId)
Gets an access token to allow direct access to the Box folder.protected com.box.sdk.BoxAPIConnection
getConnection(org.craftercms.commons.config.profiles.box.BoxProfile profile)
protected org.craftercms.commons.config.profiles.box.BoxProfile
getProfile(String site, String profileId)
String
getUrl(String site, String profileId, String fileId, String filename)
Builds a local URL for the given assetvoid
setProfileLoader(SiteAwareConfigProfileLoader<org.craftercms.commons.config.profiles.box.BoxProfile> profileLoader)
-
-
-
Field Detail
-
URL_FORMAT
protected static final String URL_FORMAT
- See Also:
- Constant Field Values
-
profileLoader
protected SiteAwareConfigProfileLoader<org.craftercms.commons.config.profiles.box.BoxProfile> profileLoader
-
-
Method Detail
-
setProfileLoader
public void setProfileLoader(SiteAwareConfigProfileLoader<org.craftercms.commons.config.profiles.box.BoxProfile> profileLoader)
-
getProfile
protected org.craftercms.commons.config.profiles.box.BoxProfile getProfile(String site, String profileId) throws BoxException
- Throws:
BoxException
-
getConnection
protected com.box.sdk.BoxAPIConnection getConnection(org.craftercms.commons.config.profiles.box.BoxProfile profile)
-
getAccessToken
public String getAccessToken(String site, String profileId) throws BoxException
Gets an access token to allow direct access to the Box folder.- Specified by:
getAccessToken
in interfaceBoxService
- Parameters:
site
- the name of the site to search for the configuration fileprofileId
- the name of the profile to search- Returns:
- the value of the access token
- Throws:
BoxException
- box error
-
getUrl
public String getUrl(String site, String profileId, String fileId, String filename) throws BoxException
Builds a local URL for the given asset- Specified by:
getUrl
in interfaceBoxService
- Parameters:
site
- site identifierprofileId
- the name of the profile to usefileId
- the id of the filefilename
- the name of the file- Returns:
- the local URL for the file
- Throws:
BoxException
- box error
-
-