Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SnapArchivingServers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software Control System
Tango controls archiving
SnapArchivingServers
Commits
23a55510
Commit
23a55510
authored
Jan 7, 2021
by
Arnaud Jelmoni
Browse files
Options
Downloads
Patches
Plain Diff
TANGOARCH-624
parent
d9f17221
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
snapextractor/src/main/java/org/tango/server/snapextractor/SnapExtractor.java
+46
-7
46 additions, 7 deletions
...in/java/org/tango/server/snapextractor/SnapExtractor.java
with
46 additions
and
7 deletions
snapextractor/src/main/java/org/tango/server/snapextractor/SnapExtractor.java
+
46
−
7
View file @
23a55510
...
@@ -94,6 +94,7 @@ import java.util.ResourceBundle;
...
@@ -94,6 +94,7 @@ import java.util.ResourceBundle;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.tango.DeviceState
;
import
org.tango.DeviceState
;
import
org.tango.server.ServerManager
;
import
org.tango.server.ServerManager
;
import
org.tango.server.annotation.Attribute
;
import
org.tango.server.annotation.Attribute
;
...
@@ -126,6 +127,10 @@ import fr.soleil.archiving.snap.api.extractor.datasources.db.SnapReaderFactory;
...
@@ -126,6 +127,10 @@ import fr.soleil.archiving.snap.api.extractor.datasources.db.SnapReaderFactory;
import
fr.soleil.archiving.snap.api.extractor.naming.DynamicAttributeNamerFactory
;
import
fr.soleil.archiving.snap.api.extractor.naming.DynamicAttributeNamerFactory
;
import
fr.soleil.archiving.snap.api.extractor.naming.IDynamicAttributeNamer
;
import
fr.soleil.archiving.snap.api.extractor.naming.IDynamicAttributeNamer
;
import
fr.soleil.archiving.snap.api.manager.SnapManagerApi
;
import
fr.soleil.archiving.snap.api.manager.SnapManagerApi
;
import
fr.soleil.archiving.snap.api.model.Snapshot
;
import
fr.soleil.archiving.snap.api.persistence.SnapshotPersistenceManager
;
import
fr.soleil.archiving.snap.api.persistence.SnapshotPersistenceManagerFactory
;
import
fr.soleil.archiving.snap.api.persistence.spring.dao.SnapshotDAO
;
import
fr.soleil.archiving.snap.api.tools.SnapAttributeExtract
;
import
fr.soleil.archiving.snap.api.tools.SnapAttributeExtract
;
import
fr.soleil.archiving.snap.api.tools.SnapshotingException
;
import
fr.soleil.archiving.snap.api.tools.SnapshotingException
;
...
@@ -147,6 +152,10 @@ import fr.soleil.archiving.snap.api.tools.SnapshotingException;
...
@@ -147,6 +152,10 @@ import fr.soleil.archiving.snap.api.tools.SnapshotingException;
@Device
@Device
public
class
SnapExtractor
{
public
class
SnapExtractor
{
@Autowired
SnapshotDAO
snapshotDao
;
private
SnapshotPersistenceManager
manager
;
private
static
final
String
_ERROR
=
"_ERROR"
;
private
static
final
String
_ERROR
=
"_ERROR"
;
...
@@ -162,6 +171,8 @@ public class SnapExtractor {
...
@@ -162,6 +171,8 @@ public class SnapExtractor {
@DeviceManagement
@DeviceManagement
private
DeviceManager
devManager
;
private
DeviceManager
devManager
;
public
void
setDevManager
(
final
DeviceManager
devManager
)
{
public
void
setDevManager
(
final
DeviceManager
devManager
)
{
this
.
devManager
=
devManager
;
this
.
devManager
=
devManager
;
}
}
...
@@ -228,6 +239,13 @@ public class SnapExtractor {
...
@@ -228,6 +239,13 @@ public class SnapExtractor {
this
.
isRac
=
isRac
;
this
.
isRac
=
isRac
;
}
}
@DeviceProperty
(
name
=
"beansFileName"
,
description
=
""
,
defaultValue
=
""
)
private
String
beansFileName
=
""
;
public
void
setBeansFileName
(
String
beansFileName
)
{
this
.
beansFileName
=
beansFileName
;
}
private
ISnapReader
snapReader
;
private
ISnapReader
snapReader
;
/**
/**
...
@@ -297,6 +315,9 @@ public class SnapExtractor {
...
@@ -297,6 +315,9 @@ public class SnapExtractor {
SnapManagerApi
.
initSnapConnection
(
dbHost
,
dbName
,
dbSchema
,
dbUser
,
dbPassword
,
isRac
);
SnapManagerApi
.
initSnapConnection
(
dbHost
,
dbName
,
dbSchema
,
dbUser
,
dbPassword
,
isRac
);
snapReader
=
SnapReaderFactory
.
getImpl
(
SnapReaderFactory
.
REAL
);
snapReader
=
SnapReaderFactory
.
getImpl
(
SnapReaderFactory
.
REAL
);
snapReader
.
openConnection
();
snapReader
.
openConnection
();
SnapshotPersistenceManagerFactory
factory
=
SnapshotPersistenceManagerFactory
.
getInstance
();
manager
=
factory
.
getManager
(
beansFileName
,
dbUser
,
dbPassword
);
manager
.
autowired
(
this
);
}
catch
(
final
SnapshotingException
e
)
{
}
catch
(
final
SnapshotingException
e
)
{
logger
.
error
(
"Failed to initialize device"
,
e
);
logger
.
error
(
"Failed to initialize device"
,
e
);
throw
e
.
toTangoException
();
throw
e
.
toTangoException
();
...
@@ -406,6 +427,31 @@ public class SnapExtractor {
...
@@ -406,6 +427,31 @@ public class SnapExtractor {
return
addAttributes
(
sae
);
return
addAttributes
(
sae
);
}
}
/**
* Execute command "GetSnap" on device. Loads a snapshot of given ID: if the
* snapshot exists, creates for each one of the snapshot's attributes a dynamic
* attribute for its read part, and, if the attribute isn't read-only, for its
* write part. Returns a table containing, as many times as there are attributes
* for the specified snapshot:
* <UL>
* <LI>the attribute complete name
* <LI>the name of the dynamic attribute containing the attribute's read value
* (if it has one, otherwise blank)
* <LI>the name of the dynamic attribute containing the attribute's write value
* (if it has one, otherwise blank)
* </UL>
*
* @param argin the snapshot's ID
* @return A table containing [attrRealName, dynAttrNameR,dynAttrNameW]*n
* @throws DevFailed
*/
@Command
(
name
=
"GetSnapTime"
,
inTypeDesc
=
"snapID"
,
outTypeDesc
=
"[attrRealName, dynAttrNameW,dynAttrNameR]*n"
)
public
String
getSnapTime
(
final
int
argin
)
throws
DevFailed
{
logger
.
info
(
"get snap time with id {}"
,
argin
);
Snapshot
snap
=
snapshotDao
.
findOne
(
argin
);
return
"Date snapshot : "
+
snap
.
getTime
();
}
/**
/**
* Execute command "GetSnapValue" on device. Loads a snapshot of given ID:
* Execute command "GetSnapValue" on device. Loads a snapshot of given ID:
* if the snapshot exists, find if the attribute exists for this snapshot if
* if the snapshot exists, find if the attribute exists for this snapshot if
...
@@ -649,13 +695,6 @@ public class SnapExtractor {
...
@@ -649,13 +695,6 @@ public class SnapExtractor {
}
else
if
(
writable
==
AttrWriteType
.
_READ_WRITE
)
{
}
else
if
(
writable
==
AttrWriteType
.
_READ_WRITE
)
{
dynMngt
.
addAttribute
(
new
SnapDynamicAttribute
(
writeName
,
writeDbData
));
dynMngt
.
addAttribute
(
new
SnapDynamicAttribute
(
writeName
,
writeDbData
));
}
}
// devManager.startPolling(readName, 0);
// add data to polling buffer
// final int dataLength = dbData.getDataAsTimedAttrData().length;
// for (int i = 0; i < dataLength; i++) {
// devManager.triggerPolling(readName);
// devManager.triggerPolling(writeName);
// }
}
}
@Command
(
name
=
"GetAttributeListForContext"
,
inTypeDesc
=
"Context ID"
,
outTypeDesc
=
"The list of attributes contained in the given context"
)
@Command
(
name
=
"GetAttributeListForContext"
,
inTypeDesc
=
"Context ID"
,
outTypeDesc
=
"The list of attributes contained in the given context"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment