Skip to content

Commit

Permalink
Refactoring of source repository
Browse files Browse the repository at this point in the history
  • Loading branch information
l.garulli committed Apr 7, 2010
1 parent 39d1c16 commit b801013
Show file tree
Hide file tree
Showing 409 changed files with 41,406 additions and 0 deletions.
78 changes: 78 additions & 0 deletions _base/base-build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Copyright (c) 1999-2010 Luca Garulli - LICENSE: Apache 2.0 -->
<project basedir="." >
<property name="project.src" value="src/main/java" />
<property name="project.lib" value="lib" />
<property name="project.doc" value="doc" />
<property name="project.build" value="bin" />
<property name="project.dist" value="dist" />
<property name="project.is-debug" value="on" />
<property name="project.debug-level" value="lines, vars, source" />
<property name="project.target-comp" value="1.5" />

<path id="project.classpath">
<fileset dir="${project.lib}" includes="**/*.jar" />
<fileset dir=".." includes="**/dist/*.jar" />
</path>

<target name="init">
<mkdir dir="${project.build}" />
</target>

<target name="clean">
<delete dir="${project.build}" />
<delete dir="${project.dist}" />
</target>

<target name="compile" depends="init">
<javac destdir="${project.build}" debug="${project.is-debug}" debuglevel="${project.debug-level}" target="${project.target-comp}">
<src path="${project.src}" />
<classpath refid="project.classpath" />
</javac>
</target>

<target name="jar" depends="compile">
<mkdir dir="${project.dist}" />
<delete file="${project.dist}/${ant.project.name}.jar" />
<jar compress="true" basedir="${project.build}" destfile="${project.dist}/${ant.project.name}.jar">
<manifest>
<attribute name="Implementation-Vendor" value="${vendor}" />
<attribute name="Implementation-Title" value="${product}" />
<attribute name="Implementation-Version" value="${version}" />
<attribute name="Main-Class" value="${project.jar-mainclass}" />
<attribute name="Class-Path" value="${project.jar-classpath}" />
</manifest>
</jar>
<copy todir="${project.dist}">
<fileset dir="${project.lib}" includes="*.jar" />
</copy>
</target>

<target name="install" depends="jar">
<copy todir="${global.lib}">
<fileset dir="${project.dist}" includes="*.jar" />
</copy>
</target>

<target name="javadocs">
<javadoc classpathref="project.classpath" sourcepath="${project.src}" packagenames="com.orientechnologies.*" destdir="${project.doc}" private="true">
<doclet name="org.umlgraph.doclet.UmlGraphDoc" path="${project.lib}/UMLGraph.jar">
<param name="-hide" value="java.*" />
<param name="-collpackages" value="java.util.*" />
<param name="-qualify" />
<param name="-postfixpackage" />
<param name="-nodefontsize" value="9" />
<param name="-nodefontpackagesize" value="7" />
<param name="-link" value="http://java.sun.com/j2se/1.5.0/docs/guide/javadoc/doclet/spec" />
<param name="-link" value="http://java.sun.com/j2se/1.5/docs/api" />
</doclet>
</javadoc>
</target>

<target name="install-zip">
<mkdir dir="${project.dist}" />
<delete file="${project.dist}/${ant.project.name}.zip" />
<zip destfile="${project.dist}/${ant.project.name}.zip" basedir="." excludes="**.svn/" />
</target>

</project>
110 changes: 110 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="install" name="orient-ant">
<!-- Copyright (c) 1999-2010 Luca Garulli - LICENSE: Apache 2.0 -->

<property environment="env" />
<property name="vendor" value="Orient Technologies" />
<property name="product" value="Orient Database" />
<property name="version" value="0.9.4_snapshot" />
<property name="global.release" value="../releases/${version}" />
<property name="global.lib" value="${global.release}/lib" />

<macrodef name="delegate">
<attribute name="target"/>
<sequential>
<subant target="@{target}">
<property name="global.lib" value="../${global.lib}"/>

<fileset dir="commons" includes="build.xml" />
<fileset dir="core" includes="build.xml" />
<fileset dir="enterprise" includes="build.xml" />
<fileset dir="client" includes="build.xml" />
<fileset dir="server" includes="build.xml" />
<fileset dir="tools" includes="build.xml" />
<fileset dir="kv" includes="build.xml" />
</subant>

<echo> ___ ___ ____ _ </echo>
<echo> .' `.|_ ||_ _| | | </echo>
<echo>/ .-. \ | |_/ / | | </echo>
<echo>| | | | | __'. |_| </echo>
<echo>\ `-' /_| | \ \_ _ </echo>
<echo> `.___.'|____||____| (_) </echo>
</sequential>

</macrodef>

<target name="init">
<echo> . </echo>
<echo> .` ` </echo>
<echo> , `:. </echo>
<echo> `,` ,:` </echo>
<echo> .,. :,, </echo>
<echo> .,, ,,, </echo>
<echo> . .,.::::: ```` </echo>
<echo> ,` .::,,,,::.,,,,,,`;; .: </echo>
<echo> `,. ::,,,,,,,:.,,.` ` .: </echo>
<echo> ,,:,:,,,,,,,,::. ` ` `` .: </echo>
<echo> ,,:.,,,,,,,,,: `::, ,, ::,::` : :,::` :::: </echo>
<echo> ,:,,,,,,,,,,::,: ,, :. : :: : .: </echo>
<echo> :,,,,,,,,,,:,:: ,, : : : : .: </echo>
<echo> ` :,,,,,,,,,,:,::, ,, .:::::::: : : .: </echo>
<echo> `,...,,:,,,,,,,,,: .:,. ,, ,, : : .: </echo>
<echo> .,,,,::,,,,,,,: `: , ,, : ` : : .: </echo>
<echo> ...,::,,,,::.. `: .,, :, : : : .: </echo>
<echo> ,::::,,,. `: ,, ::::: : : .: </echo>
<echo> ,,:` `,,. </echo>
<echo> ,,, .,` </echo>
<echo> ,,. `, D A T A B A S E </echo>
<echo> `` `. </echo>
<echo> `` </echo>
<echo> ` </echo>
<echo> </echo>

<mkdir dir="${global.release}" />
<mkdir dir="${global.lib}" />
<mkdir dir="${global.release}/databases" />
</target>

<target name="clean" depends="init">
<delegate target="clean"/>
<delete dir="${global.release}" />
</target>

<target name="compile" depends="init">
<delegate target="compile"/>
</target>

<target name="javadoc" depends="init">
<delegate target="javadoc"/>
</target>

<target name="install" depends="init">
<delegate target="install"/>

<copy todir="${global.release}">
<fileset dir=".">
<include name="*.txt"/>
<include name="*.xml"/>
</fileset>
</copy>

<copy todir="${global.release}/bin/" flatten="true">
<fileset dir="." includes="**/*.bat **/*.sh" />
</copy>

<copy todir="${global.release}/config/" flatten="true">
<fileset dir="." includes="**/*.config" />
</copy>

<copy todir="${global.release}/www/">
<fileset dir="kv/src/site"/>
</copy>
</target>

<target name="release" depends="init">
<delete file="../releases/orient-database-${version}.zip" />
<zip destfile="../releases/orient-database-${version}.zip" basedir="${global.release}" level="9" update="false" excludes="*.log" />
</target>

</project>
10 changes: 10 additions & 0 deletions client/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/orient-database-enterprise"/>
<classpathentry combineaccessrules="false" kind="src" path="/orient-database-core"/>
<classpathentry combineaccessrules="false" kind="src" path="/orient-commons"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions client/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>orient-database-client</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions client/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#Tue Feb 02 15:30:01 CET 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
8 changes: 8 additions & 0 deletions client/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Copyright (c) 1999-2010 Luca Garulli - LICENSE: Apache 2.0 -->
<project basedir="." default="compile" name="orient-database-client">
<property name="project.jar-classpath" value="orient-database-enterprise.jar" />
<property name="project.jar-mainclass" value="com.orientechnologies.orient.server.OServerMain" />

<import file="../_base/base-build.xml" />
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 1999-2010 Luca Garulli (l.garulli--at--orientechnologies.com)
*
* 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.
*/
package com.orientechnologies.orient.client;

import java.util.Map;

import com.orientechnologies.common.log.OLogManager;
import com.orientechnologies.orient.client.storage.OStorageRemote;
import com.orientechnologies.orient.core.engine.OEngineAbstract;
import com.orientechnologies.orient.core.exception.ODatabaseException;
import com.orientechnologies.orient.core.storage.OStorage;

public class OEngineRemote extends OEngineAbstract {
public static final String NAME = "remote";

public OEngineRemote() {
}

public OStorage getStorage(String iURL, Map<String, String> iConfiguration) {
try {
return new OStorageRemote(iURL, "rw");
} catch (Throwable t) {
OLogManager.instance().error(this, "Error on opening database: " + iURL, t, ODatabaseException.class);
}
return null;
}

public String getName() {
return NAME;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
* Copyright 1999-2010 Luca Garulli (l.garulli--at--orientechnologies.com)
*
* 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.
*/
package com.orientechnologies.orient.client.admin;

import java.io.IOException;
import java.net.UnknownHostException;

import com.orientechnologies.common.log.OLogManager;
import com.orientechnologies.orient.core.exception.OStorageException;
import com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryClient;
import com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryProtocol;

/**
* Remote admin of Orient Servers.
*/
public class OServerAdmin {
private String url;

// private String userName;
// private String userPassword;
protected OChannelBinaryClient network;
protected int sessionId;

public OServerAdmin(String iURL) throws IOException {
url = iURL;

// CONNECT
}

public OServerAdmin connect() throws IOException {
try {
createNetworkConnection();

network.writeByte((byte) OChannelBinaryProtocol.CONNECT);
network.flush();

readStatus();

sessionId = network.readInt();

} catch (Exception e) {
OLogManager.instance().error(this, "Can't connect the remote server: " + url, e, OStorageException.class);
close();
}
return this;
}

public OServerAdmin createDatabase(String iDatabaseName, String iDatabasePath, String iStorageMode) throws IOException {
try {
if (iStorageMode == null)
iStorageMode = "csv";

network.writeByte(OChannelBinaryProtocol.DB_CREATE);
network.writeString(iStorageMode);
network.flush();

readStatus();

} catch (Exception e) {
OLogManager.instance().error(this, "Can't create the remote storage: " + iDatabaseName, e, OStorageException.class);
close();
}
return this;
}

public void close() throws IOException {
network.socket.close();
}

protected void readStatus() throws IOException {
byte result = network.readByte();

if (result == OChannelBinaryProtocol.ERROR)
OLogManager.instance().error(this, network.readString(), null, OStorageException.class);
}

protected void createNetworkConnection() throws IOException, UnknownHostException {
String remoteHost;
int remotePort = 8000;

int pos = url.indexOf("/");
if (pos == -1) {
remoteHost = "localhost";
} else {
int posRemotePort = url.indexOf(":");

if (posRemotePort != -1) {
remoteHost = url.substring(0, posRemotePort);
remotePort = Integer.parseInt(url.substring(posRemotePort + 1, pos));
} else {
remoteHost = url.substring(0, pos);
}
}

network = new OChannelBinaryClient(remoteHost, remotePort, remotePort);
}
}
Loading

0 comments on commit b801013

Please sign in to comment.