Package org.rhq.core.util.file

Examples of org.rhq.core.util.file.ContentFileInfo


     * @param file component file
     * @return
     */
    private String getDisplayVersion(File file) {
        //JarContentFileInfo extracts the version from archived and exploded deployments
        ContentFileInfo contentFileInfo = new JarContentFileInfo(file);
        return contentFileInfo.getVersion(null);
    }
View Full Code Here


        SupportedPackageType supportedPackageType = determinePackageType(file);
        if (supportedPackageType == null) {
            return null; // we can't handle this file - it is an unknown/unsupported package type
        }

        ContentFileInfo fileInfo = ContentFileInfoFactory.createContentFileInfo(file);
        String sha256;
        try {
            sha256 = new MessageDigestGenerator(MessageDigestGenerator.SHA_256).calcDigestString(file);
        } catch (IOException e) {
            throw new SyncException("Error digesting file", e);
        }
        String name = file.getName();
        String version = "[sha256=" + sha256 + "]";
        String displayVersion = fileInfo.getVersion(null);
        String packageTypeName = supportedPackageType.packageTypeName;
        String architectureName = supportedPackageType.architectureName;
        String resourceTypeName = supportedPackageType.resourceTypeName;
        String resourceTypePluginName = supportedPackageType.resourceTypePluginName;

        ContentProviderPackageDetailsKey key = new ContentProviderPackageDetailsKey(name, version, packageTypeName,
            architectureName, resourceTypeName, resourceTypePluginName);
        ContentProviderPackageDetails pkg = new ContentProviderPackageDetails(key);

        pkg.setDisplayName(name);
        pkg.setFileName(name);
        pkg.setFileCreatedDate(file.lastModified());
        pkg.setFileSize(file.length());
        pkg.setSHA256(sha256);
        pkg.setDisplayVersion(displayVersion);
        pkg.setLocation(getRelativePath(file));
        pkg.setShortDescription(fileInfo.getDescription(null));

        return pkg;
    }
View Full Code Here

        File mockFile = mock(File.class);
        when(mockRepoFolder.listFiles()).thenReturn(new File[] { mockFile });
        when(mockFile.getAbsolutePath()).thenReturn("test");

        ContentFileInfo contentFileInfo = mock(ContentFileInfo.class);
        PowerMockito.mockStatic(ContentFileInfoFactory.class);
        when(ContentFileInfoFactory.createContentFileInfo(any(File.class))).thenReturn(contentFileInfo);

        MessageDigestGenerator mockDigest = mock(MessageDigestGenerator.class);
        whenNew(MessageDigestGenerator.class).withArguments(anyString()).thenReturn(mockDigest);
View Full Code Here

        File mockFile = mock(File.class);
        when(mockRepoFolder.listFiles()).thenReturn(new File[] { mockFile, mockExtraFolder });
        when(mockFile.getAbsolutePath()).thenReturn("test");
        when(mockExtraFolder.isDirectory()).thenReturn(true);

        ContentFileInfo contentFileInfo = mock(ContentFileInfo.class);
        PowerMockito.mockStatic(ContentFileInfoFactory.class);
        when(ContentFileInfoFactory.createContentFileInfo(any(File.class))).thenReturn(contentFileInfo);

        MessageDigestGenerator mockDigest = mock(MessageDigestGenerator.class);
        whenNew(MessageDigestGenerator.class).withArguments(anyString()).thenReturn(mockDigest);
View Full Code Here

     * @param file component file
     * @return
     */
    private String getDisplayVersion(File file) {
        //JarContentFileInfo extracts the version from archived and exploded deployments
        ContentFileInfo contentFileInfo = new JarContentFileInfo(file);
        return contentFileInfo.getVersion(null);
    }
View Full Code Here

     * @param file component file
     * @return
     */
    private String getDisplayVersion(File file) {
        //JarContentFileInfo extracts the version from archived and exploded deployments
        ContentFileInfo contentFileInfo = new JarContentFileInfo(file);
        return contentFileInfo.getVersion(null);
    }
View Full Code Here

     * @return
     */
    @Deprecated
    private String getDisplayVersion(File file) {
        //JarContentFileInfo extracts the version from archived and exploded deployments
        ContentFileInfo contentFileInfo = new JarContentFileInfo(file);
        return contentFileInfo.getVersion(null);
    }
View Full Code Here

     *
     * Shamelessly copied from the AS5 plugin
     */
    private String getDisplayVersion(File file) {
        //JarContentFileInfo extracts the version from archived and exploded deployments
        ContentFileInfo contentFileInfo = new JarContentFileInfo(file);
        return contentFileInfo.getVersion(null);
    }
View Full Code Here

     * @param file component file
     * @return
     */
    private String getDisplayVersion(File file) {
        //JarContentFileInfo extracts the version from archived and exploded deployments
        ContentFileInfo contentFileInfo = new JarContentFileInfo(file);
        return contentFileInfo.getVersion(null);
    }
View Full Code Here

     * @param file component file
     * @return
     */
    private String getDisplayVersion(File file) {
        //JarContentFileInfo extracts the version from archived and exploded deployments
        ContentFileInfo contentFileInfo = new JarContentFileInfo(file);
        return contentFileInfo.getVersion(null);
    }
View Full Code Here

TOP

Related Classes of org.rhq.core.util.file.ContentFileInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.