Skip to content

Commit

Permalink
Make some public classes and methods package private
Browse files Browse the repository at this point in the history
  • Loading branch information
svenkatrav committed Sep 1, 2016
1 parent 3cc5e21 commit c1316bd
Show file tree
Hide file tree
Showing 25 changed files with 46 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
*
*/

package com.netflix.imflibrary.st2067_2;
package com.netflix.imflibrary;

import com.netflix.imflibrary.IMFErrorLogger;
import com.netflix.imflibrary.IMFErrorLoggerImpl;
import com.netflix.imflibrary.exceptions.IMFException;
import com.netflix.imflibrary.st0429_8.PackingList;

Expand All @@ -37,7 +35,7 @@ public final class IMPAsset
private final URI uri;
private final PackingList.Asset asset;
/**
* Constructor for an {@link com.netflix.imflibrary.st2067_2.IMPAsset IMPAsset} from a PackingList Asset and its URI. Construction
* Constructor for an {@link IMPAsset IMPAsset} from a PackingList Asset and its URI. Construction
* fails if the URI is not absolute
* @param uri the absolute URI
* @param asset the corresponding asset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
*
*/

package com.netflix.imflibrary.st2067_2;
package com.netflix.imflibrary;

import com.netflix.imflibrary.IMFErrorLogger;
import com.netflix.imflibrary.IMFErrorLoggerImpl;
import com.netflix.imflibrary.st0429_8.PackingList;
import com.netflix.imflibrary.st0429_9.AssetMap;
import com.netflix.imflibrary.st0429_9.BasicMapProfileV2FileSet;
Expand Down Expand Up @@ -82,7 +80,7 @@ public IMPDelivery(BasicMapProfileV2FileSet basicMapProfileV2FileSet) throws IOE

/**
* Getter for a list of IMPs contained in this delivery
* @return a list of type {@link com.netflix.imflibrary.st2067_2.InteroperableMasterPackage} corresponding to IMPs
* @return a list of type {@link InteroperableMasterPackage} corresponding to IMPs
* contained in this delivery
*/
public List<InteroperableMasterPackage> getInteroperableMasterPackages()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
*
*/

package com.netflix.imflibrary.st2067_2;
package com.netflix.imflibrary;

import com.netflix.imflibrary.IMFErrorLogger;
import com.netflix.imflibrary.exceptions.IMFException;
import com.netflix.imflibrary.st0429_8.PackingList;

Expand All @@ -41,12 +40,12 @@ public final class InteroperableMasterPackage

/**
* Constructor for an InterOperableMasterPackage object from a {@link com.netflix.imflibrary.st0429_8.PackingList} object,
* the URI corresponding to the PackingList document, and a list of type {@link com.netflix.imflibrary.st2067_2.IMPAsset} that
* the URI corresponding to the PackingList document, and a list of type {@link IMPAsset} that
* corresponds to assets referenced by this InteroperableMasterPackage object
* @param packingList the corresponding packingList object
* @param packingListURI an absolute URI for the PackingList document corresponding to the supplied PackingList object, construction
* fails if the URI is not absolute
* @param referencedAssets the list of type {@link com.netflix.imflibrary.st2067_2.IMPAsset} corresponding to assets
* @param referencedAssets the list of type {@link IMPAsset} corresponding to assets
* referenced by this InteroperableMasterPackage object
*/
public InteroperableMasterPackage(PackingList packingList, URI packingListURI, List<IMPAsset> referencedAssets)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static PayloadRecord.PayloadAssetType getPayloadType(PayloadRecord payloa
else if(PackingList.isFileOfSupportedSchema(resourceByteRangeProvider)){
return PayloadRecord.PayloadAssetType.PackingList;
}
else if(Composition.isFileOfSupportedSchema(resourceByteRangeProvider)){
else if(Composition.isCompositionPlaylist(resourceByteRangeProvider)){
return PayloadRecord.PayloadAssetType.CompositionPlaylist;
}
return PayloadRecord.PayloadAssetType.Unknown;
Expand Down
53 changes: 15 additions & 38 deletions src/main/java/com/netflix/imflibrary/st2067_2/Composition.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
import com.netflix.imflibrary.RESTfulInterfaces.PayloadRecord;
import com.netflix.imflibrary.exceptions.IMFException;
import com.netflix.imflibrary.exceptions.MXFException;
import com.netflix.imflibrary.st2067_2.CompositionModels.*;
import com.netflix.imflibrary.st2067_2.CompositionModels.st2067_2_2013.CompositionModel_st2067_2_2013;
import com.netflix.imflibrary.st2067_2.CompositionModels.st2067_2_2016.CompositionModel_st2067_2_2016;
import com.netflix.imflibrary.utils.DOMNodeObjectModel;
import com.netflix.imflibrary.st0377.HeaderPartition;
import com.netflix.imflibrary.st0377.PrimerPack;
Expand All @@ -49,7 +46,6 @@
import com.sandflow.smpte.klv.Triplet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.smpte_ra.schemas.st2067_2_2013.TrackFileResourceType;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Node;
Expand Down Expand Up @@ -433,37 +429,6 @@ private final String serializeIMFCoreConstaintsSchemasToString(List<CoreConstrai
return stringBuilder.toString();
}

/**
* A stateless method that verifies if the raw data represented by the ResourceByteRangeProvider corresponds to a valid
* IMF Composition Playlist document
*
* @param resourceByteRangeProvider - a byte range provider for the document that needs to be verified
* @return - a boolean indicating if the document represented is an IMF Composition or not
* @throws IOException - any I/O related error is exposed through an IOException
*/
public static boolean isFileOfSupportedSchema(ResourceByteRangeProvider resourceByteRangeProvider) throws IOException {

try (InputStream inputStream = resourceByteRangeProvider.getByteRangeAsStream(0, resourceByteRangeProvider.getResourceSize() - 1);) {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(inputStream);
NodeList nodeList = null;
for (String supportedSchemaURI : supportedCPLSchemaURIs) {
//obtain root node
nodeList = document.getElementsByTagNameNS(supportedSchemaURI, "CompositionPlaylist");
if (nodeList != null
&& nodeList.getLength() == 1) {
return true;
}
}
} catch (ParserConfigurationException | SAXException e) {
return false;
}

return false;
}

/**
* A method that returns a string representation of a Composition object
*
Expand Down Expand Up @@ -575,7 +540,7 @@ String getContentTitle() {
*
* @return {@link java.util.Map Map}&lt;{@link java.util.UUID UUID},{@link Composition.VirtualTrack VirtualTrack}&gt;. The UUID key corresponds to VirtualTrackID
*/
public Map<UUID, ? extends VirtualTrack> getVirtualTrackMap() {
Map<UUID, ? extends VirtualTrack> getVirtualTrackMap() {
return Collections.unmodifiableMap(this.virtualTrackMap);
}

Expand Down Expand Up @@ -1110,14 +1075,25 @@ public List<? extends Composition.VirtualTrack> getVirtualTracks() {
return new ArrayList<>(virtualTrackMap.values());
}

/**
* A utility method to retrieve the EssenceDescriptors within a Composition.
*
* @return A list of EssenceDescriptors in the Composition.
*/
@Nonnull
public List<DOMNodeObjectModel> getEssenceDescriptors() {
Map<UUID, DOMNodeObjectModel> essenceDescriptorMap = this.getEssenceDescriptorListMap();
return new ArrayList<>(essenceDescriptorMap.values());
}

/**
* A utility method to retrieve the UUIDs of the Track files referenced by a Virtual track within a Composition.
*
* @param virtualTrack - object model of an IMF virtual track {@link Composition.VirtualTrack}
* @return A list of TrackFileResourceType objects corresponding to the virtual track in the Composition.
*/
@Nonnull
public List<ResourceIdTuple> getVirtualTrackResourceIDs(@Nonnull Composition.VirtualTrack virtualTrack) {
public static List<ResourceIdTuple> getVirtualTrackResourceIDs(@Nonnull Composition.VirtualTrack virtualTrack) {

List<ResourceIdTuple> virtualTrackResourceIDs = new ArrayList<>();

Expand All @@ -1137,13 +1113,14 @@ public List<ResourceIdTuple> getVirtualTrackResourceIDs(@Nonnull Composition.Vir
return Collections.unmodifiableList(virtualTrackResourceIDs);
}


/**
* A utility method that will analyze the EssenceDescriptorList in a Composition and construct a HashMap mapping
* a UUID to a EssenceDescriptor.
*
* @return a HashMap mapping the UUID to its corresponding EssenceDescriptor in the Composition
*/
public Map<UUID, DOMNodeObjectModel> getEssenceDescriptorListMap() {
Map<UUID, DOMNodeObjectModel> getEssenceDescriptorListMap() {
IMFErrorLogger imfErrorLogger = new IMFErrorLoggerImpl();
Map<UUID, DOMNodeObjectModel> essenceDescriptorMap = new HashMap<>();
if (compositionPlaylistType.getEssenceDescriptorList() != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.netflix.imflibrary.st2067_2.CompositionModels.st2067_2_2013;
package com.netflix.imflibrary.st2067_2;

import com.netflix.imflibrary.IMFErrorLogger;
import com.netflix.imflibrary.exceptions.IMFException;
import com.netflix.imflibrary.st2067_2.*;
import com.netflix.imflibrary.st2067_2.CompositionModels.*;
import com.netflix.imflibrary.utils.UUIDHelper;
import com.netflix.imflibrary.writerTools.CompositionPlaylistBuilder_2013;
import org.w3c.dom.Element;
Expand All @@ -20,7 +19,7 @@
/**
* A class that models aspects of a Composition such as a VirtualTrack, TrackResources etc. compliant with the 2013 CompositionPlaylist specification st2067-3:2013.
*/
public final class CompositionModel_st2067_2_2013 {
final class CompositionModel_st2067_2_2013 {

//To prevent instantiation
private CompositionModel_st2067_2_2013(){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.netflix.imflibrary.st2067_2.CompositionModels.st2067_2_2016;
package com.netflix.imflibrary.st2067_2;

import com.netflix.imflibrary.IMFErrorLogger;
import com.netflix.imflibrary.exceptions.IMFException;
import com.netflix.imflibrary.st2067_2.*;
import com.netflix.imflibrary.st2067_2.CompositionModels.*;
import com.netflix.imflibrary.utils.UUIDHelper;
import com.netflix.imflibrary.writerTools.CompositionPlaylistBuilder_2016;
import org.w3c.dom.Element;
Expand All @@ -20,7 +19,7 @@
/**
* A class that models aspects of a Composition such as a VirtualTrack, TrackResources etc. compliant with the 2016 CompositionPlaylist specification st2067-3:2016.
*/
public final class CompositionModel_st2067_2_2016 {
final class CompositionModel_st2067_2_2016 {

//To prevent instantiation
private CompositionModel_st2067_2_2016(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
*
*/

package com.netflix.imflibrary.st2067_2.CompositionModels;
package com.netflix.imflibrary.st2067_2;

import com.netflix.imflibrary.IMFErrorLoggerImpl;
import com.netflix.imflibrary.exceptions.IMFException;
import com.netflix.imflibrary.st2067_2.Composition;

import java.math.BigInteger;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
*
*/

package com.netflix.imflibrary.st2067_2.CompositionModels;
package com.netflix.imflibrary.st2067_2;

import com.netflix.imflibrary.IMFErrorLogger;
import com.netflix.imflibrary.IMFErrorLoggerImpl;
import com.netflix.imflibrary.exceptions.IMFException;
import com.netflix.imflibrary.st2067_2.Composition;
import com.netflix.imflibrary.utils.UUIDHelper;

import javax.annotation.concurrent.Immutable;
Expand All @@ -32,7 +31,7 @@
* A class that models an IMF Composition Playlist structure.
*/
@Immutable
public final class IMFCompositionPlaylistType {
final class IMFCompositionPlaylistType {
private final UUID id;
private final Composition.EditRate editRate;
private final String annotation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@

import com.netflix.imflibrary.IMFErrorLogger;
import com.netflix.imflibrary.IMFErrorLoggerImpl;
import com.netflix.imflibrary.exceptions.IMFException;
import com.netflix.imflibrary.st2067_2.CompositionModels.*;
import com.netflix.imflibrary.utils.UUIDHelper;
import org.smpte_ra.schemas.st2067_2_2016.MarkerResourceType;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.HashSet;
import java.util.Iterator;
Expand All @@ -19,7 +15,7 @@
/**
* A class that performs 2013 CoreConstraints st2067-2:2013 related checks on the elements of a Composition Playlist such as VirtualTracks, Segments, Sequences and Resources.
*/
public final class IMFCoreConstraintsChecker {
final class IMFCoreConstraintsChecker {


//To prevent instantiation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@

package com.netflix.imflibrary.st2067_2;

import com.netflix.imflibrary.st2067_2.CompositionModels.IMFBaseResourceType;
import com.netflix.imflibrary.st2067_2.CompositionModels.IMFMarkerResourceType;
import com.netflix.imflibrary.st2067_2.CompositionModels.IMFTrackFileResourceType;
import com.netflix.imflibrary.utils.UUIDHelper;

import javax.annotation.concurrent.Immutable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
*/

package com.netflix.imflibrary.st2067_2.CompositionModels;
package com.netflix.imflibrary.st2067_2;

import com.netflix.imflibrary.utils.UUIDHelper;

Expand All @@ -29,7 +29,7 @@
* A class that models a Composition's Essence Descriptor.
*/
@Immutable
public final class IMFEssenceDescriptorBaseType {
final class IMFEssenceDescriptorBaseType {
protected final UUID id;
protected final List<Object> any;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
*/

package com.netflix.imflibrary.st2067_2.CompositionModels;
package com.netflix.imflibrary.st2067_2;

import javax.annotation.concurrent.Immutable;
import java.math.BigInteger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
*/

package com.netflix.imflibrary.st2067_2.CompositionModels;
package com.netflix.imflibrary.st2067_2;

import javax.annotation.concurrent.Immutable;
import java.math.BigInteger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@

package com.netflix.imflibrary.st2067_2;

import com.netflix.imflibrary.st2067_2.CompositionModels.IMFBaseResourceType;
import com.netflix.imflibrary.st2067_2.CompositionModels.IMFMarkerResourceType;
import org.smpte_ra.schemas.st2067_2_2013.BaseResourceType;

import javax.annotation.concurrent.Immutable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
*/

package com.netflix.imflibrary.st2067_2.CompositionModels;
package com.netflix.imflibrary.st2067_2;

import javax.annotation.concurrent.Immutable;
import java.util.List;
Expand All @@ -25,7 +25,7 @@
* A class that models Segment structure of an IMF Composition Playlist.
*/
@Immutable
public final class IMFSegmentType {
final class IMFSegmentType {
protected final String id;
protected final List<IMFSequenceType> sequenceList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
*
*/

package com.netflix.imflibrary.st2067_2.CompositionModels;

import com.netflix.imflibrary.st2067_2.Composition;
package com.netflix.imflibrary.st2067_2;

import javax.annotation.concurrent.Immutable;
import java.util.List;
Expand All @@ -27,7 +25,7 @@
* A class that models Sequence structure of an IMF Composition Playlist.
*/
@Immutable
public final class IMFSequenceType {
final class IMFSequenceType {
protected final String id;
protected final String trackId;
protected final List<? extends IMFBaseResourceType> resourceList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
*/

package com.netflix.imflibrary.st2067_2.CompositionModels;
package com.netflix.imflibrary.st2067_2;

import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
Expand Down
Loading

0 comments on commit c1316bd

Please sign in to comment.