Skip to content

Commit 9b9ac8c

Browse files
RomanRoman
Roman
authored and
Roman
committed
Added FileDependency handling
1 parent 5726d51 commit 9b9ac8c

9 files changed

+51
-2
lines changed

Diff for: src/main/java/at/ac/tuwien/infosys/aic13/Main.java

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.slf4j.LoggerFactory;
1111

1212
import at.ac.tuwien.infosys.aic13.cloudscale.service.SentimentAnalysisService;
13+
import at.ac.tuwien.infosys.aic13.cloudscale.service.impl.SentimentAnalysisServiceCloudScaleImpl;
1314
import at.ac.tuwien.infosys.aic13.cloudscale.service.impl.SentimentAnalysisServiceDummyImpl;
1415
import at.ac.tuwien.infosys.cloudscale.annotations.CloudScaleShutdown;
1516

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
Copyright 2013 Philipp Leitner
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
package at.ac.tuwien.infosys.aic13.sentiment;
17+
18+
import java.io.File;
19+
import java.util.ArrayList;
20+
import java.util.List;
21+
22+
import at.ac.tuwien.infosys.cloudscale.annotations.FileDependency.DependentFile;
23+
import at.ac.tuwien.infosys.cloudscale.annotations.FileDependency.IFileDependencyProvider;
24+
25+
public class WEKAFileProvider implements IFileDependencyProvider {
26+
27+
@Override
28+
public DependentFile[] getDependentFiles() {
29+
30+
List<DependentFile> dependentFiles = new ArrayList<>();
31+
32+
for(File file : new File("files").listFiles()) {
33+
if(file.isFile())
34+
dependentFiles.add(new DependentFile(file.getPath()));
35+
}
36+
37+
return dependentFiles.toArray(new DependentFile[0]);
38+
39+
}
40+
41+
42+
43+
}

Diff for: src/main/java/at/ac/tuwien/infosys/aic13/sentiment/impl/ClassifierImpl.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
15+
16+
Modified by Roman Khassraf <roman at khassraf.at>
1517
*/
1618
package at.ac.tuwien.infosys.aic13.sentiment.impl;
1719

@@ -57,7 +59,6 @@ public SentimentType classify(String text)
5759
}
5860
catch(Exception ex)
5961
{
60-
// TODO: logging
6162
return SentimentType.Neutral;
6263
}
6364
}

Diff for: src/main/java/at/ac/tuwien/infosys/aic13/sentiment/impl/TwitterSentimentAnalyzerImpl.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,27 @@
1212
import at.ac.tuwien.infosys.aic13.sentiment.Classifier;
1313
import at.ac.tuwien.infosys.aic13.sentiment.TwitterQuery;
1414
import at.ac.tuwien.infosys.aic13.sentiment.TwitterSentimentAnalyzer;
15+
import at.ac.tuwien.infosys.aic13.sentiment.WEKAFileProvider;
1516
import at.ac.tuwien.infosys.cloudscale.annotations.ByValueParameter;
1617
import at.ac.tuwien.infosys.cloudscale.annotations.CloudObject;
1718
import at.ac.tuwien.infosys.cloudscale.annotations.DestructCloudObject;
19+
import at.ac.tuwien.infosys.cloudscale.annotations.FileDependency;
20+
import at.ac.tuwien.infosys.cloudscale.annotations.FileDependency.FileAccess;
1821

1922
/**
2023
*
2124
* @author Roman Khassraf <roman at khassraf.at>
2225
*/
2326
@CloudObject
27+
@FileDependency(dependencyProvider = WEKAFileProvider.class, accessType = FileAccess.ReadOnly)
2428
public class TwitterSentimentAnalyzerImpl implements TwitterSentimentAnalyzer {
2529

2630
private static final TwitterQuery twitterQuery = new WSTwitterQueryImpl();
2731
private static final Logger logger = LoggerFactory.getLogger(TwitterSentimentAnalyzerImpl.class);
2832

2933
@Override
3034
@DestructCloudObject
31-
public PublicSentimentQueryResult analyze(@ByValueParameter PublicSentimentQuery sentimentQuery) {
35+
public PublicSentimentQueryResult analyze(PublicSentimentQuery sentimentQuery) {
3236
logger.debug("Analyzing query.");
3337

3438
PublicSentimentQueryResult result = new PublicSentimentQueryResult();
Binary file not shown.
Binary file not shown.
Binary file not shown.
4.49 MB
Binary file not shown.

Diff for: src/main/resources/files/wlsvm.WLSVM.model

8.94 MB
Binary file not shown.

0 commit comments

Comments
 (0)