resolving pom issues

application-manager-new
buddhinipun 9 years ago
parent e22089ef59
commit c1f3a670b5

@ -19,7 +19,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent> <parent>
<artifactId>connectedlap</artifactId> <artifactId>connectedlap-component</artifactId>
<groupId>org.wso2</groupId> <groupId>org.wso2</groupId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>

@ -1,100 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.agent</groupId>
<artifactId>connectedlap</artifactId>
<name>connectedlap</name>
<version>1.0</version>
<url>http://maven.apache.org</url>
<build>
<finalName>ConnectedLap</finalName>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/log4j.properties</exclude>
</excludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>org.wso2.agent.main.JavaApp</mainClass>
<classpathPrefix>dependency-jars/</classpathPrefix>
</manifest>
</archive>
<outputDirectory>${project.build.directory}/../../../feature/feature/src/main/resources/agent/</outputDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer>
<mainClass>org.wso2.agent.main.JavaApp</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<jdk.version>1.7</jdk.version>
</properties>
</project>

@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.agent</groupId> <groupId>org.wso2</groupId>
<artifactId>connectedlap</artifactId> <artifactId>connectedlap</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.0</version> <version>1.0</version>

@ -1,3 +1,21 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.
*/
package org.wso2.agent.common; package org.wso2.agent.common;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;

@ -1,3 +1,21 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.
*/
package org.wso2.agent.config; package org.wso2.agent.config;
import java.io.FileInputStream; import java.io.FileInputStream;

@ -1,3 +1,21 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.
*/
package org.wso2.agent.datasense; package org.wso2.agent.datasense;
import java.io.IOException; import java.io.IOException;

@ -1,6 +1,25 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.
*/
package org.wso2.agent.main; package org.wso2.agent.main;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.Console;
import java.io.File; import java.io.File;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
@ -18,99 +37,101 @@ import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.WebResource;
/**
* Created by amila on 5/17/16.
*/
public class JavaApp { public class JavaApp {
final static int TIMEINTERVAL=10000;//ms final static int TIMEINTERVAL = 10000;//ms
public static String SUPASSWORD=""; public static String SUPASSWORD = "";
static int TIMECOUNTER=0;// 5 minute interval sender tracker; static int TIMECOUNTER = 0;// 5 minute interval sender tracker;
public static String deviceid; public static String deviceid;
public static void main(String args[]) { public static void main(String args[]) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter Super User Password"); System.out.println("Enter Super User Password");
System.out.print("Enter Password:"); BufferedReader br = null;
try{ try {
JavaApp.SUPASSWORD = String.valueOf(br.readLine()); Console console = System.console();
}catch(Exception e){ //String username = console.readLine("Username: ");
System.out.println("Retreving Password Failed!"); char[] password = console.readPassword("Password: ");
}finally{ JavaApp.SUPASSWORD = String.valueOf(password);
try{
br.close(); //br = new BufferedReader(new InputStreamReader(System.in));
}catch(Exception e){} //JavaApp.SUPASSWORD = String.valueOf(br.readLine());
} catch (Exception e) {
System.out.println("Retrieving Password Failed!");
} finally {
try {
br.close();
} catch (Exception e) {
}
} }
if(!new Configuration().checkRegistered()){ if (!new Configuration().checkRegistered()) {
SystemSpec spec=new Monitor().getSysInfo(JavaApp.SUPASSWORD); SystemSpec spec = new Monitor().getSysInfo(JavaApp.SUPASSWORD);
String devicetoken=new String(); String devicetoken = new String();
String devicerefreshtoken=new String(); String devicerefreshtoken = new String();
Configuration config=new Configuration(); Configuration config = new Configuration();
try { try {
String token=String.valueOf(config.getInitProperty("auth-token")); String token = String.valueOf(config.getInitProperty("auth-token"));
//token="9c7a1b4d6625cdd936b894cc0e7c7390"; //token="9c7a1b4d6625cdd936b894cc0e7c7390";
String refreshtoken=String.valueOf(config.getInitProperty("refresh-token")); String refreshtoken = String.valueOf(config.getInitProperty("refresh-token"));
String device_name=String.valueOf(config.getInitProperty("device-name")); String device_name = String.valueOf(config.getInitProperty("device-name"));
Client client = Client.create(Common.configureClient()); Client client = Client.create(Common.configureClient());
client.setConnectTimeout(50000); client.setConnectTimeout(50000);
WebResource webResource = client.resource("https://localhost:9443/CONNECTEDLAP/device/register"); WebResource webResource = client.resource("https://localhost:9443/CONNECTEDLAP/device/register");
String mac = spec.getMacaddress().replaceAll("\\:", ""); String mac = spec.getMacaddress().replaceAll("\\:", "");
deviceid = mac; deviceid = mac;
String request="{" String request = "{"
+ "\"owner\":\"admin\"," + "\"owner\":\"admin\","
+"\"deviceId\":\""+mac+"\"," + "\"deviceId\":\"" + mac + "\","
+"\"deviceName\": \""+device_name+"\"," + "\"deviceName\": \"" + device_name + "\","
+"\"discSpace\":"+spec.getStorage()+"," + "\"discSpace\":" + spec.getStorage() + ","
+"\"memory\":"+spec.getRamsize()+"," + "\"memory\":" + spec.getRamsize() + ","
+"\"cpuInfo\":\""+spec.getProcessor_speed()+"\"," + "\"cpuInfo\":\"" + spec.getProcessor_speed() + "\","
+ "\"networkType\":\""+spec.getNetworktype()+"\"," + "\"networkType\":\"" + spec.getNetworktype() + "\","
+"\"cpucorecount\":\""+spec.getProcessor_cores()+"\"" + "\"cpucorecount\":\"" + spec.getProcessor_cores() + "\""
+ "}"; + "}";
ClientResponse response = (ClientResponse)webResource.type("application/json").header("Authorization", "Bearer "+token).post(ClientResponse.class,request); ClientResponse response = (ClientResponse) webResource.type("application/json").header("Authorization", "Bearer " + token).post(ClientResponse.class, request);
System.out.println("Output from Server .... \n"); System.out.println("Output from Server .... \n");
String output = (String)response.getEntity(String.class); String output = (String) response.getEntity(String.class);
System.out.println(output); System.out.println(output);
JSONObject outputJson= new JSONObject(output); JSONObject outputJson = new JSONObject(output);
devicetoken=outputJson.getString("accessToken"); devicetoken = outputJson.getString("accessToken");
devicerefreshtoken=outputJson.getString("refreshToken"); devicerefreshtoken = outputJson.getString("refreshToken");
if (response.getStatus() != 200) { if (response.getStatus() != 200) {
throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); throw new RuntimeException("Failed : HTTP error code : " + response.getStatus());
} }
config.SaveRegistration(spec,devicetoken,devicerefreshtoken); config.SaveRegistration(spec, devicetoken, devicerefreshtoken);
} } catch (Exception e) {
catch (Exception e) { //e.printStackTrace();
//e.printStackTrace(); throw e;
throw e; }
}
}
} //String deviceid=String.valueOf(new Configuration().getProperty("deviceid"));
//String deviceid=String.valueOf(new Configuration().getProperty("deviceid")); String owner = String.valueOf(new Configuration().getInitProperty("owner"));
String owner=String.valueOf(new Configuration().getInitProperty("owner")); String devicetoken = String.valueOf(new Configuration().getProperty("devicetoken"));
String devicetoken=String.valueOf(new Configuration().getProperty("devicetoken")); String devicerefreshtoken = String.valueOf(new Configuration().getProperty("devicerefreshtoken"));
String devicerefreshtoken=String.valueOf(new Configuration().getProperty("devicerefreshtoken"));
while (true) {
while(true) {
try { try {
new RecordStore().saveData(new Monitor().getSysUsage(JavaApp.SUPASSWORD)); new RecordStore().saveData(new Monitor().getSysUsage(JavaApp.SUPASSWORD));
JavaApp.TIMECOUNTER+=TIMEINTERVAL; JavaApp.TIMECOUNTER += TIMEINTERVAL;
if(JavaApp.TIMECOUNTER>=10000){ if (JavaApp.TIMECOUNTER >= 10000) {
ArrayList<SystemUsage> sysUsageList=new RecordStore().readData(); ArrayList<SystemUsage> sysUsageList = new RecordStore().readData();
for (SystemUsage systemUsage : sysUsageList) { for (SystemUsage systemUsage : sysUsageList) {
new PushSystemUsage().pushData(systemUsage,deviceid,owner,devicetoken); new PushSystemUsage().pushData(systemUsage, deviceid, owner, devicetoken);
} }
File file = new File("usagelog"); File file = new File("usagelog");
if(file.delete()){ if (file.delete()) {
System.out.println(file.getName() + " is deleted!"); System.out.println(file.getName() + " is deleted!");
}else{ } else {
System.out.println("Delete operation is failed."); System.out.println("Delete operation is failed.");
} }
} }
Thread.sleep(JavaApp.TIMEINTERVAL); Thread.sleep(JavaApp.TIMEINTERVAL);
} catch(Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }

@ -1,3 +1,21 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.
*/
package org.wso2.agent.resourcemonitor; package org.wso2.agent.resourcemonitor;
import org.wso2.agent.resourcemonitor.infocollector.Collector; import org.wso2.agent.resourcemonitor.infocollector.Collector;

@ -1,3 +1,21 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.
*/
package org.wso2.agent.resourcemonitor.exception; package org.wso2.agent.resourcemonitor.exception;
@SuppressWarnings("serial") @SuppressWarnings("serial")

@ -1,3 +1,21 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.
*/
package org.wso2.agent.resourcemonitor.infocollector; package org.wso2.agent.resourcemonitor.infocollector;
import javax.management.OperationsException; import javax.management.OperationsException;

@ -1,3 +1,21 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.
*/
package org.wso2.agent.resourcemonitor.pojo; package org.wso2.agent.resourcemonitor.pojo;
public class SystemSpec { public class SystemSpec {

@ -1,3 +1,21 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.
*/
package org.wso2.agent.resourcemonitor.pojo; package org.wso2.agent.resourcemonitor.pojo;
public class SystemUsage { public class SystemUsage {

@ -1,3 +1,21 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.
*/
package org.wso2.agent.store; package org.wso2.agent.store;
import java.io.BufferedReader; import java.io.BufferedReader;

Loading…
Cancel
Save