${INSTALLER_SRC_DIR}/misc/libxml_utils.cpp
${INSTALLER_SRC_DIR}/misc/widget_location.cpp
${INSTALLER_SRC_DIR}/misc/widget_install_to_external.cpp
+ ${INSTALLER_SRC_DIR}/misc/plugin_path.cpp
${INSTALLER_SRC_DIR}/pkg-manager/pkgmgr_signal.cpp
)
namespace Jobs {
namespace PluginInstall {
-JobPluginInstall::JobPluginInstall(DPL::Utils::Path const &pluginPath,
+JobPluginInstall::JobPluginInstall(PluginPath const &pluginPath,
const PluginInstallerStruct &installerStruct)
:
Job(PluginInstallation),
#include <job_base.h>
#include <plugin_install/plugin_installer_struct.h>
#include <plugin_install/plugin_installer_context.h>
-#include <dpl/utils/path.h>
-
namespace Jobs {
namespace PluginInstall {
class JobPluginInstall :
/**
* @brief Automaticaly sets installation process
*/
- JobPluginInstall(DPL::Utils::Path const &pluginPath,
+ JobPluginInstall(PluginPath const &pluginPath,
const PluginInstallerStruct &installerStruct);
WrtDB::DbPluginHandle getNewPluginHandle() const
#include <dpl/wrt-dao-rw/plugin_dao.h>
#include "plugin_objects.h"
#include <wrt_plugin_export.h>
+#include <plugin_path.h>
using namespace WrtDB;
-namespace {
-const std::string DIRECTORY_SEPARATOR = std::string("/");
-}
-
#define SET_PLUGIN_INSTALL_PROGRESS(step, desc) \
m_context->installerTask->UpdateProgress( \
PluginInstallerContext::step, desc);
{
LogDebug("Plugin installation: step parse config file");
- DPL::Utils::Path filename = m_context->pluginFilePath;
- filename /= GlobalConfig::GetPluginMetafileName();
-
- if(!filename.Exists()){
+ if(!m_context->pluginFilePath.getMetaFile().Exists()){
m_dataFromConfigXML = false;
return;
}
- LogDebug("Plugin Config file::" << filename.Filename());
+ LogInfo("Plugin Config file::" << m_context->pluginFilePath.getMetaFile());
Try
{
PluginMetafileReader reader;
- reader.initialize(filename);
+ reader.initialize(m_context->pluginFilePath.getMetaFile());
reader.read(m_pluginInfo);
FOREACH(it, m_pluginInfo.m_featureContainer)
}
Catch(ValidationCore::ParserSchemaException::Base)
{
- LogError("Error during file processing " << filename.Filename());
+ LogError("Error during file processing " <<
+ m_context->pluginFilePath.getMetaFile());
ThrowMsg(Exceptions::PluginMetafileFailed,
"Metafile error");
}
return;
}
LogDebug("Plugin installation: step find plugin library");
- DPL::Utils::Path pluginPath = m_context->pluginFilePath;
- size_t indexpos = pluginPath.Fullpath().find_last_of('/');
-
- if (std::string::npos == indexpos) {
- indexpos = 0;
- } else {
- indexpos += 1; // move after '/'
- }
-
- std::string libName = pluginPath.Fullpath().substr(indexpos);
- libName = GlobalConfig::GetPluginPrefix() + libName +
- GlobalConfig::GetPluginSuffix();
- LogDebug("Plugin .so: " << libName);
- m_pluginInfo.m_libraryName = libName;
+ LogDebug("Plugin .so: " << m_context->pluginFilePath.getLibraryName());
+ m_pluginInfo.m_libraryName = m_context->pluginFilePath.getLibraryName();
}
void PluginInstallTask::stepCheckIfAlreadyInstalled()
DISABLE_IF_PLUGIN_WITHOUT_LIB()
- DPL::Utils::Path filename = m_context->pluginFilePath;
- filename /= m_pluginInfo.m_libraryName;
-
- LogDebug("Loading plugin: " << filename.Filename());
+ LogDebug("Loading plugin: " << m_context->pluginFilePath.getLibraryName());
- fprintf(stderr, " - Try to dlopen() : [%s] ", filename.Fullpath().c_str());
+ fprintf(stderr, " - Try to dlopen() : [%s] ", m_context->pluginFilePath.getLibraryPath().Fullpath().c_str());
- void *dlHandle = dlopen(filename.Fullpath().c_str(), RTLD_LAZY);
+ void *dlHandle = dlopen( m_context->pluginFilePath.getLibraryPath().Fullpath().c_str(), RTLD_LAZY);
if (dlHandle == NULL) {
const char* error = (const char*)dlerror();
fprintf(stderr,
"-> Failed!\n %s\n",
(error != NULL ? error : "unknown"));
LogError(
- "Failed to load plugin: " << filename.Filename() <<
+ "Failed to load plugin: " << m_context->pluginFilePath.getLibraryName() <<
". Reason: " << (error != NULL ? error : "unknown"));
ThrowMsg(Exceptions::PluginLibraryError, "Library error");
}
if (rawEntityList == NULL) {
dlclose(dlHandle);
- LogError("Failed to read class name" << filename.Filename());
+ LogError("Failed to read class name" << m_context->pluginFilePath.getLibraryName());
ThrowMsg(Exceptions::PluginLibraryError, "Library error");
}
if (NULL == onWidgetInitProc) {
dlclose(dlHandle);
- LogError("Failed to read onWidgetInit symbol" << filename.Filename());
+ LogError("Failed to read onWidgetInit symbol" << m_context->pluginFilePath.getLibraryName());
ThrowMsg(Exceptions::PluginLibraryError, "Library error");
}
const js_entity_definition_t *rawEntityListIterator = rawEntityList;
LogDebug("#####");
- LogDebug("##### Plugin: " << filename.Filename() << " supports new plugin API");
+ LogDebug("##### Plugin: "
+ << m_context->pluginFilePath.getLibraryName()
+ << " supports new plugin API");
LogDebug("#####");
while (rawEntityListIterator->parent_name != NULL &&
FOREACH(it, m_pluginInfo.m_featureContainer)
{
- LogError("PluginHandle: " << m_pluginHandle);
+ LogDebug("PluginHandle: " << m_pluginHandle);
FeatureDAO::RegisterFeature(*it, m_pluginHandle);
}
SET_PLUGIN_INSTALL_PROGRESS(REGISTER_FEATURES, "Features registered");
#include <string>
#include <dpl/wrt-dao-ro/feature_dao_read_only.h>
-#include <dpl/utils/path.h>
+#include <plugin_path.h>
//#include <plugin_model.h>
using namespace WrtDB;
PLUGIN_INSTALL_END
};
- DPL::Utils::Path pluginFilePath; ///< plugin directory
+ PluginPath pluginFilePath; ///< plugin directory
+ PluginPath metaFilePath;
+ bool m_dataFromConfigXML;
WrtDB::DbPluginHandle pluginHandle;
// if this value is true the plugin model may be created
// if not plugin installation has failed from some reason
//used to set installation progress
Jobs::PluginInstall::JobPluginInstall* installerTask;
};
-
#endif // WRT_SRC_INSTALLERCORE_PLUGININSTALLERTASKS_PLUGININSTALLERCONTEXT_H_
*/
#include "plugin_metafile_reader.h"
+#include <plugin_path.h>
using namespace WrtDB;
&PluginMetafileReader::tokenEndDeviceCapability);
}
+void PluginMetafileReader::initialize(const PluginPath &filename)
+{
+ m_parserSchema.initialize(filename.Fullpath(),
+ true,
+ ValidationCore::SaxReader::VALIDATION_DTD,
+ std::string());
+}
+
+void PluginMetafileReader::read(WrtDB::PluginMetafileData &data)
+{
+ m_parserSchema.read(data);
+}
+
void PluginMetafileReader::blankFunction(PluginMetafileData & /* data */)
{}
#define WRT_SRC_INSTALLER_CORE_PLUGIN_INSTALLER_TASKS_PLUGIN_METAFILE_READER_H_
#include <dpl/wrt-dao-ro/common_dao_types.h>
-#include <dpl/utils/path.h>
#include <vcore/ParserSchema.h>
+class PluginPath;
+
class PluginMetafileReader
{
public:
PluginMetafileReader();
- void initialize(const DPL::Utils::Path &filename)
- {
- m_parserSchema.initialize(filename.Fullpath(),
- true,
- ValidationCore::SaxReader::VALIDATION_DTD,
- std::string());
- }
-
- void read(WrtDB::PluginMetafileData &data)
- {
- m_parserSchema.read(data);
- }
+ void initialize(const PluginPath &filename);
+
+ void read(WrtDB::PluginMetafileData &data);
private:
void blankFunction(WrtDB::PluginMetafileData &data);
}
Jobs::JobHandle InstallerLogic::InstallPlugin(
- std::string const & pluginPath,
+ std::string const & pluginPath, // TODO change type to PluginPath
const PluginInstallerStruct &
installerStruct)
{
LogDebug("New Plugin Installation");
- //Conversion to DPL::Utils::Path is temporary
+ // TODO Conversion to PluginPath is temporary
m_job =
- new Jobs::PluginInstall::JobPluginInstall(DPL::Utils::Path(pluginPath), installerStruct);
+ new Jobs::PluginInstall::JobPluginInstall(PluginPath(pluginPath), installerStruct);
// before start install plugin, reset plugin data which is stopped
// during installing. (PluginDAO::INSTALLATION_IN_PROGRESS)
--- /dev/null
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file plugin_path_builder.cpp
+ * @author Kamil Nować (k.nowac@partner.samgsung.com)
+ * @version
+ * @brief
+ */
+
+#include <plugin_path.h>
+#include <dpl/wrt-dao-ro/global_config.h>
+#include <dlfcn.h>
+
+using namespace DPL::Utils;
+
+PluginPath::PluginPath(const Path& fullPath) : Path(fullPath.Fullpath())
+{
+ setLibraryCombinedName(
+ WrtDB::GlobalConfig::GetPluginPrefix(),
+ WrtDB::GlobalConfig::GetPluginSuffix());
+};
+PluginPath::PluginPath(const std::string& fullPath) : Path(fullPath)
+{
+ setLibraryCombinedName(
+ WrtDB::GlobalConfig::GetPluginPrefix(),
+ WrtDB::GlobalConfig::GetPluginSuffix());
+};
+PluginPath::PluginPath(const DPL::String& fullPath) : Path(fullPath)
+{
+ setLibraryCombinedName(
+ WrtDB::GlobalConfig::GetPluginPrefix(),
+ WrtDB::GlobalConfig::GetPluginSuffix());
+};
+PluginPath::PluginPath(){}
+
+PluginPath PluginPath::getMetaFile() const
+{
+ PluginPath metaFile = *this;
+ return metaFile /= WrtDB::GlobalConfig::GetPluginMetafileName();
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file plugin_path_builder.cpp
+ * @author Kamil Nować (k.nowac@partner.samgsung.com)
+ * @version
+ * @brief
+ */
+
+#ifndef PLUGIN_PATH_H
+#define PLUGIN_PATH_H
+
+#include <string>
+#include <dpl/string.h>
+#include <dpl/utils/path.h>
+
+class PluginPath: public DPL::Utils::Path{
+private:
+ std::string m_library;
+
+public:
+ PluginPath(const DPL::Utils::Path& fullPath);
+ PluginPath(const std::string& fullPath);
+ PluginPath(const DPL::String& fullPath);
+ PluginPath();
+
+ //getMetafile() this function adds metafile to current path.
+ PluginPath getMetaFile() const;
+
+ //setLibraryCombinedName This function creates name for library by adding
+ //prefix and suffix to PluginPath object filename.
+ void setLibraryCombinedName(const std::string& prefix, const std::string& sufix)
+ {
+ this->m_library = prefix + this->Filename() + sufix;
+ }
+
+ //getLibraryName returns library name
+ const std::string& getLibraryName() const
+ {
+ return m_library;
+ }
+ //getLibraryPath returns full path to the library
+ const PluginPath getLibraryPath() const
+ {
+ return this->operator /(m_library);
+ }
+};
+
+#endif // PLUGIN_PATH_H